Jon Perritt | 95c6752 | 2014-11-04 10:37:21 -0600 | [diff] [blame] | 1 | package ports |
| 2 | |
| 3 | import ( |
| 4 | "github.com/rackspace/gophercloud" |
| 5 | os "github.com/rackspace/gophercloud/openstack/networking/v2/ports" |
| 6 | "github.com/rackspace/gophercloud/pagination" |
| 7 | ) |
| 8 | |
| 9 | // List returns a Pager which allows you to iterate over a collection of |
| 10 | // ports. 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 ports 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 port 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 network using the values |
| 26 | // provided. You must remember to provide a NetworkID value. |
Jon Perritt | db9a9b3 | 2015-03-09 12:08:50 -0600 | [diff] [blame] | 27 | // |
| 28 | // NOTE: Currently the SecurityGroup option is not implemented to work with |
| 29 | // Rackspace. |
Jon Perritt | 95c6752 | 2014-11-04 10:37:21 -0600 | [diff] [blame] | 30 | func Create(c *gophercloud.ServiceClient, opts os.CreateOptsBuilder) os.CreateResult { |
| 31 | return os.Create(c, opts) |
| 32 | } |
| 33 | |
| 34 | // Update accepts a UpdateOpts struct and updates an existing port using the |
| 35 | // values provided. |
| 36 | func Update(c *gophercloud.ServiceClient, networkID string, opts os.UpdateOptsBuilder) os.UpdateResult { |
| 37 | return os.Update(c, networkID, opts) |
| 38 | } |
| 39 | |
| 40 | // Delete accepts a unique ID and deletes the port associated with it. |
| 41 | func Delete(c *gophercloud.ServiceClient, networkID string) os.DeleteResult { |
| 42 | return os.Delete(c, networkID) |
| 43 | } |