Jamie Hannaford | a7f671a | 2014-09-11 10:25:08 +0200 | [diff] [blame] | 1 | package networks |
| 2 | |
Jamie Hannaford | 01e1492 | 2014-09-11 15:23:49 +0200 | [diff] [blame] | 3 | import ( |
| 4 | "github.com/racker/perigee" |
| 5 | "github.com/rackspace/gophercloud" |
| 6 | ) |
| 7 | |
Jamie Hannaford | a7f671a | 2014-09-11 10:25:08 +0200 | [diff] [blame] | 8 | // User-defined options sent to the API when creating or updating a network. |
| 9 | type NetworkOpts struct { |
| 10 | // The administrative state of the network, which is up (true) or down (false). |
| 11 | AdminStateUp bool `json:"admin_state_up"` |
| 12 | // The network name (optional) |
| 13 | Name string `json:"name"` |
| 14 | // Indicates whether this network is shared across all tenants. By default, |
| 15 | // only administrative users can change this value. |
| 16 | Shared bool `json:"shared"` |
| 17 | // Admin-only. The UUID of the tenant that will own the network. This tenant |
| 18 | // can be different from the tenant that makes the create network request. |
| 19 | // However, only administrative users can specify a tenant ID other than their |
| 20 | // own. You cannot change this value through authorization policies. |
| 21 | TenantID string `json:"tenant_id"` |
| 22 | } |
Jamie Hannaford | 01e1492 | 2014-09-11 15:23:49 +0200 | [diff] [blame] | 23 | |
| 24 | func APIVersions(c *gophercloud.ServiceClient) (*APIVersionsList, error) { |
Jamie Hannaford | 01e1492 | 2014-09-11 15:23:49 +0200 | [diff] [blame] | 25 | var resp APIVersionsList |
Jamie Hannaford | f14d456 | 2014-09-11 17:46:18 +0200 | [diff] [blame^] | 26 | _, err := perigee.Request("GET", APIVersionsURL(c), perigee.Options{ |
| 27 | MoreHeaders: c.Provider.AuthenticatedHeaders(), |
| 28 | Results: &resp, |
| 29 | OkCodes: []int{200}, |
| 30 | }) |
| 31 | if err != nil { |
| 32 | return nil, err |
| 33 | } |
| 34 | |
| 35 | return &resp, nil |
| 36 | } |
| 37 | |
| 38 | func APIInfo(c *gophercloud.ServiceClient, v string) (*APIInfoList, error) { |
| 39 | var resp APIInfoList |
| 40 | _, err := perigee.Request("GET", APIInfoURL(c, v), perigee.Options{ |
Jamie Hannaford | 01e1492 | 2014-09-11 15:23:49 +0200 | [diff] [blame] | 41 | MoreHeaders: c.Provider.AuthenticatedHeaders(), |
| 42 | Results: &resp, |
| 43 | OkCodes: []int{200}, |
| 44 | }) |
| 45 | if err != nil { |
| 46 | return nil, err |
| 47 | } |
| 48 | |
| 49 | return &resp, nil |
| 50 | } |