blob: dcb0855dba3c9eee786c3f3c8fad106b8fc14414 [file] [log] [blame]
Jon Perritt95c67522014-11-04 10:37:21 -06001package networks
2
3import (
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.
12func 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.
17func 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.
28func 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.
34func 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.
39func Delete(c *gophercloud.ServiceClient, networkID string) os.DeleteResult {
40 return os.Delete(c, networkID)
41}