blob: 1bef64d13b828da153be2c4552ce37d0883bae7e [file] [log] [blame]
Samuel A. Falvo II0262e972014-01-24 16:06:56 -08001package notificationPlans
2
3import (
4 "fmt"
Samuel A. Falvo II0262e972014-01-24 16:06:56 -08005 "github.com/racker/perigee"
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -08006 "github.com/rackspace/gophercloud/openstack/identity"
Samuel A. Falvo II2b963212014-02-09 02:12:30 -08007 "github.com/rackspace/gophercloud/rackspace/monitoring"
Samuel A. Falvo II0262e972014-01-24 16:06:56 -08008)
9
10var ErrNotImplemented = fmt.Errorf("notificationPlans feature not yet implemented")
11
12type Client struct {
13 options monitoring.Options
14}
15
16type DeleteResults map[string]interface{}
17
18func NewClient(mo monitoring.Options) *Client {
19 return &Client{
20 options: mo,
21 }
22}
23
24func (c *Client) Delete(id string) (DeleteResults, error) {
25 var dr DeleteResults
26
Samuel A. Falvo IIc70164d2014-02-09 12:12:36 -080027 tok, err := identity.GetToken(c.options.Authentication)
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080028 if err != nil {
29 return nil, err
30 }
Samuel A. Falvo II0262e972014-01-24 16:06:56 -080031 url := fmt.Sprintf("%s/notification_plans/%s", c.options.Endpoint, id)
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080032 err = perigee.Delete(url, perigee.Options{
Samuel A. Falvo II0262e972014-01-24 16:06:56 -080033 Results: &dr,
34 OkCodes: []int{204},
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080035 MoreHeaders: map[string]string{
Samuel A. Falvo IIc70164d2014-02-09 12:12:36 -080036 "X-Auth-Token": tok.Id,
Samuel A. Falvo IIa1a95cc2014-01-24 16:31:40 -080037 },
Samuel A. Falvo II0262e972014-01-24 16:06:56 -080038 })
39 return dr, err
40}