blob: a7fb7bb15fcfba567486f7a5aa93fb0755dc9953 [file] [log] [blame]
Jon Perritt95c67522014-11-04 10:37:21 -06001package subnets
2
3import (
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.
16func 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.
21func 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.
27func 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.
33func 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.
38func Delete(c *gophercloud.ServiceClient, networkID string) os.DeleteResult {
39 return os.Delete(c, networkID)
40}