Jon Perritt | 95c6752 | 2014-11-04 10:37:21 -0600 | [diff] [blame] | 1 | package networks |
| 2 | |
| 3 | import ( |
| 4 | "github.com/rackspace/gophercloud" |
| 5 | os "github.com/rackspace/gophercloud/openstack/networking/v2/networks" |
| 6 | "github.com/rackspace/gophercloud/pagination" |
| 7 | ) |
| 8 | |
| 9 | // List returns a Pager which allows you to iterate over a collection of |
| 10 | // networks. It accepts a ListOpts struct, which allows you to filter and sort |
| 11 | // the returned collection for greater efficiency. |
| 12 | func List(c *gophercloud.ServiceClient, opts os.ListOptsBuilder) pagination.Pager { |
| 13 | return os.List(c, opts) |
| 14 | } |
| 15 | |
| 16 | // Get retrieves a specific network based on its unique ID. |
| 17 | func Get(c *gophercloud.ServiceClient, networkID string) os.GetResult { |
| 18 | return os.Get(c, networkID) |
| 19 | } |
| 20 | |
| 21 | // Create accepts a CreateOpts struct and creates a new network using the values |
| 22 | // provided. This operation does not actually require a request body, i.e. the |
| 23 | // CreateOpts struct argument can be empty. |
| 24 | // |
| 25 | // The tenant ID that is contained in the URI is the tenant that creates the |
| 26 | // network. An admin user, however, has the option of specifying another tenant |
| 27 | // ID in the CreateOpts struct. |
| 28 | func Create(c *gophercloud.ServiceClient, opts os.CreateOptsBuilder) os.CreateResult { |
| 29 | return os.Create(c, opts) |
| 30 | } |
| 31 | |
| 32 | // Update accepts a UpdateOpts struct and updates an existing network using the |
| 33 | // values provided. For more information, see the Create function. |
| 34 | func Update(c *gophercloud.ServiceClient, networkID string, opts os.UpdateOptsBuilder) os.UpdateResult { |
| 35 | return os.Update(c, networkID, opts) |
| 36 | } |
| 37 | |
| 38 | // Delete accepts a unique ID and deletes the network associated with it. |
| 39 | func Delete(c *gophercloud.ServiceClient, networkID string) os.DeleteResult { |
| 40 | return os.Delete(c, networkID) |
| 41 | } |