blob: 21055a8c21e47dc91cac94a739418d413af73474 [file] [log] [blame]
Jamie Hannaforda7f671a2014-09-11 10:25:08 +02001package networks
2
Jamie Hannaford01e14922014-09-11 15:23:49 +02003import (
4 "github.com/racker/perigee"
5 "github.com/rackspace/gophercloud"
6)
7
Jamie Hannaforda7f671a2014-09-11 10:25:08 +02008// User-defined options sent to the API when creating or updating a network.
9type 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 Hannaford01e14922014-09-11 15:23:49 +020023
24func APIVersions(c *gophercloud.ServiceClient) (*APIVersionsList, error) {
Jamie Hannaford01e14922014-09-11 15:23:49 +020025 var resp APIVersionsList
Jamie Hannafordf14d4562014-09-11 17:46:18 +020026 _, 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
38func APIInfo(c *gophercloud.ServiceClient, v string) (*APIInfoList, error) {
39 var resp APIInfoList
40 _, err := perigee.Request("GET", APIInfoURL(c, v), perigee.Options{
Jamie Hannaford01e14922014-09-11 15:23:49 +020041 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}