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" |
| 6 | ) |
| 7 | |
| 8 | func GetDefaultConfig(client *gophercloud.ServiceClient, id string) ConfigResult { |
| 9 | var res ConfigResult |
| 10 | |
| 11 | resp, err := perigee.Request("GET", configURL(client, id), perigee.Options{ |
| 12 | MoreHeaders: client.AuthenticatedHeaders(), |
| 13 | Results: &res.Body, |
| 14 | OkCodes: []int{200}, |
| 15 | }) |
| 16 | |
| 17 | res.Header = resp.HttpResponse.Header |
| 18 | res.Err = err |
| 19 | |
| 20 | return res |
| 21 | } |
Jamie Hannaford | f77fc10 | 2015-02-10 14:56:02 +0100 | [diff] [blame^] | 22 | |
| 23 | func AssociateWithConfigGroup(client *gophercloud.ServiceClient, instanceID, configGroupID string) UpdateResult { |
| 24 | reqBody := map[string]string{ |
| 25 | "configuration": configGroupID, |
| 26 | } |
| 27 | |
| 28 | var res UpdateResult |
| 29 | |
| 30 | resp, err := perigee.Request("PUT", resourceURL(client, instanceID), perigee.Options{ |
| 31 | MoreHeaders: client.AuthenticatedHeaders(), |
| 32 | ReqBody: map[string]map[string]string{"instance": reqBody}, |
| 33 | OkCodes: []int{202}, |
| 34 | }) |
| 35 | |
| 36 | res.Header = resp.HttpResponse.Header |
| 37 | res.Err = err |
| 38 | |
| 39 | return res |
| 40 | } |