Jamie Hannaford | 936a547 | 2015-02-10 14:38:28 +0100 | [diff] [blame] | 1 | package instances |
| 2 | |
| 3 | import ( |
| 4 | "github.com/racker/perigee" |
| 5 | "github.com/rackspace/gophercloud" |
Jamie Hannaford | 302c0b6 | 2015-02-16 14:12:34 +0100 | [diff] [blame^] | 6 | "github.com/rackspace/gophercloud/pagination" |
Jamie Hannaford | 936a547 | 2015-02-10 14:38:28 +0100 | [diff] [blame] | 7 | ) |
| 8 | |
| 9 | func GetDefaultConfig(client *gophercloud.ServiceClient, id string) ConfigResult { |
| 10 | var res ConfigResult |
| 11 | |
| 12 | resp, err := perigee.Request("GET", configURL(client, id), perigee.Options{ |
| 13 | MoreHeaders: client.AuthenticatedHeaders(), |
| 14 | Results: &res.Body, |
| 15 | OkCodes: []int{200}, |
| 16 | }) |
| 17 | |
| 18 | res.Header = resp.HttpResponse.Header |
| 19 | res.Err = err |
| 20 | |
| 21 | return res |
| 22 | } |
Jamie Hannaford | f77fc10 | 2015-02-10 14:56:02 +0100 | [diff] [blame] | 23 | |
| 24 | func AssociateWithConfigGroup(client *gophercloud.ServiceClient, instanceID, configGroupID string) UpdateResult { |
| 25 | reqBody := map[string]string{ |
| 26 | "configuration": configGroupID, |
| 27 | } |
| 28 | |
| 29 | var res UpdateResult |
| 30 | |
| 31 | resp, err := perigee.Request("PUT", resourceURL(client, instanceID), perigee.Options{ |
| 32 | MoreHeaders: client.AuthenticatedHeaders(), |
| 33 | ReqBody: map[string]map[string]string{"instance": reqBody}, |
| 34 | OkCodes: []int{202}, |
| 35 | }) |
| 36 | |
| 37 | res.Header = resp.HttpResponse.Header |
| 38 | res.Err = err |
| 39 | |
| 40 | return res |
| 41 | } |
Jamie Hannaford | 302c0b6 | 2015-02-16 14:12:34 +0100 | [diff] [blame^] | 42 | |
| 43 | func ListBackups(client *gophercloud.ServiceClient, instanceID string) pagination.Pager { |
| 44 | |
| 45 | } |