blob: d4878c4a941275a1573689edc48ac5f21a891953 [file] [log] [blame]
Samuel A. Falvo II0262e972014-01-24 16:06:56 -08001package notificationPlans
2
3import (
4 "fmt"
Ash Wilson2ebb21c2014-09-08 15:01:32 -04005
Samuel A. Falvo II0262e972014-01-24 16:06:56 -08006 "github.com/racker/perigee"
Jon Perritt5eb55b12014-08-18 14:48:23 -05007 identity "github.com/rackspace/gophercloud/openstack/identity/v2"
Samuel A. Falvo II2b963212014-02-09 02:12:30 -08008 "github.com/rackspace/gophercloud/rackspace/monitoring"
Samuel A. Falvo II0262e972014-01-24 16:06:56 -08009)
10
11var ErrNotImplemented = fmt.Errorf("notificationPlans feature not yet implemented")
12
13type Client struct {
14 options monitoring.Options
15}
16
17type DeleteResults map[string]interface{}
18
19func NewClient(mo monitoring.Options) *Client {
20 return &Client{
21 options: mo,
22 }
23}
24
25func (c *Client) Delete(id string) (DeleteResults, error) {
26 var dr DeleteResults
27
Samuel A. Falvo IIc70164d2014-02-09 12:12:36 -080028 tok, err := identity.GetToken(c.options.Authentication)
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080029 if err != nil {
30 return nil, err
31 }
Samuel A. Falvo II0262e972014-01-24 16:06:56 -080032 url := fmt.Sprintf("%s/notification_plans/%s", c.options.Endpoint, id)
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080033 err = perigee.Delete(url, perigee.Options{
Samuel A. Falvo II0262e972014-01-24 16:06:56 -080034 Results: &dr,
35 OkCodes: []int{204},
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080036 MoreHeaders: map[string]string{
Ash Wilson2ebb21c2014-09-08 15:01:32 -040037 "X-Auth-Token": tok.ID,
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080038 },
Samuel A. Falvo II0262e972014-01-24 16:06:56 -080039 })
40 return dr, err
41}