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