Jon Perritt | 95c6752 | 2014-11-04 10:37:21 -0600 | [diff] [blame] | 1 | package subnets |
| 2 | |
| 3 | import ( |
| 4 | "github.com/rackspace/gophercloud" |
| 5 | os "github.com/rackspace/gophercloud/openstack/networking/v2/subnets" |
| 6 | "github.com/rackspace/gophercloud/pagination" |
| 7 | ) |
| 8 | |
| 9 | // List returns a Pager which allows you to iterate over a collection of |
| 10 | // subnets. It accepts a ListOpts struct, which allows you to filter and sort |
| 11 | // the returned collection for greater efficiency. |
| 12 | // |
| 13 | // Default policy settings return only those subnets that are owned by the tenant |
| 14 | // who submits the request, unless the request is submitted by a user with |
| 15 | // administrative rights. |
| 16 | func List(c *gophercloud.ServiceClient, opts os.ListOptsBuilder) pagination.Pager { |
| 17 | return os.List(c, opts) |
| 18 | } |
| 19 | |
| 20 | // Get retrieves a specific subnet based on its unique ID. |
| 21 | func Get(c *gophercloud.ServiceClient, networkID string) os.GetResult { |
| 22 | return os.Get(c, networkID) |
| 23 | } |
| 24 | |
| 25 | // Create accepts a CreateOpts struct and creates a new subnet using the values |
| 26 | // provided. You must remember to provide a valid NetworkID, CIDR and IP version. |
| 27 | func Create(c *gophercloud.ServiceClient, opts os.CreateOptsBuilder) os.CreateResult { |
| 28 | return os.Create(c, opts) |
| 29 | } |
| 30 | |
| 31 | // Update accepts a UpdateOpts struct and updates an existing subnet using the |
| 32 | // values provided. |
| 33 | func Update(c *gophercloud.ServiceClient, networkID string, opts os.UpdateOptsBuilder) os.UpdateResult { |
| 34 | return os.Update(c, networkID, opts) |
| 35 | } |
| 36 | |
| 37 | // Delete accepts a unique ID and deletes the subnet associated with it. |
| 38 | func Delete(c *gophercloud.ServiceClient, networkID string) os.DeleteResult { |
| 39 | return os.Delete(c, networkID) |
| 40 | } |