| Samuel A. Falvo II | 0262e97 | 2014-01-24 16:06:56 -0800 | [diff] [blame] | 1 | package notificationPlans | 
|  | 2 |  | 
|  | 3 | import ( | 
|  | 4 | "fmt" | 
| Samuel A. Falvo II | 0262e97 | 2014-01-24 16:06:56 -0800 | [diff] [blame] | 5 | "github.com/racker/perigee" | 
| Jon Perritt | 5eb55b1 | 2014-08-18 14:48:23 -0500 | [diff] [blame] | 6 | identity "github.com/rackspace/gophercloud/openstack/identity/v2" | 
| Samuel A. Falvo II | 2b96321 | 2014-02-09 02:12:30 -0800 | [diff] [blame] | 7 | "github.com/rackspace/gophercloud/rackspace/monitoring" | 
| Samuel A. Falvo II | 0262e97 | 2014-01-24 16:06:56 -0800 | [diff] [blame] | 8 | ) | 
|  | 9 |  | 
|  | 10 | var ErrNotImplemented = fmt.Errorf("notificationPlans feature not yet implemented") | 
|  | 11 |  | 
|  | 12 | type Client struct { | 
|  | 13 | options monitoring.Options | 
|  | 14 | } | 
|  | 15 |  | 
|  | 16 | type DeleteResults map[string]interface{} | 
|  | 17 |  | 
|  | 18 | func NewClient(mo monitoring.Options) *Client { | 
|  | 19 | return &Client{ | 
|  | 20 | options: mo, | 
|  | 21 | } | 
|  | 22 | } | 
|  | 23 |  | 
|  | 24 | func (c *Client) Delete(id string) (DeleteResults, error) { | 
|  | 25 | var dr DeleteResults | 
|  | 26 |  | 
| Samuel A. Falvo II | c70164d | 2014-02-09 12:12:36 -0800 | [diff] [blame] | 27 | tok, err := identity.GetToken(c.options.Authentication) | 
| Samuel A. Falvo II | a1a95cc | 2014-01-24 16:31:40 -0800 | [diff] [blame] | 28 | if err != nil { | 
|  | 29 | return nil, err | 
|  | 30 | } | 
| Samuel A. Falvo II | 0262e97 | 2014-01-24 16:06:56 -0800 | [diff] [blame] | 31 | url := fmt.Sprintf("%s/notification_plans/%s", c.options.Endpoint, id) | 
| Samuel A. Falvo II | a1a95cc | 2014-01-24 16:31:40 -0800 | [diff] [blame] | 32 | err = perigee.Delete(url, perigee.Options{ | 
| Samuel A. Falvo II | 0262e97 | 2014-01-24 16:06:56 -0800 | [diff] [blame] | 33 | Results: &dr, | 
|  | 34 | OkCodes: []int{204}, | 
| Samuel A. Falvo II | a1a95cc | 2014-01-24 16:31:40 -0800 | [diff] [blame] | 35 | MoreHeaders: map[string]string{ | 
| Samuel A. Falvo II | c70164d | 2014-02-09 12:12:36 -0800 | [diff] [blame] | 36 | "X-Auth-Token": tok.Id, | 
| Samuel A. Falvo II | a1a95cc | 2014-01-24 16:31:40 -0800 | [diff] [blame] | 37 | }, | 
| Samuel A. Falvo II | 0262e97 | 2014-01-24 16:06:56 -0800 | [diff] [blame] | 38 | }) | 
|  | 39 | return dr, err | 
|  | 40 | } |