gophercloud: github.com/rackspace/gophercloud/openstack/networking/v2/networks Index | Files

package networks

import "github.com/rackspace/gophercloud/openstack/networking/v2/networks"

Package networks contains functionality for working with Neutron network resources. A network is an isolated virtual layer-2 broadcast domain that is typically reserved for the tenant who created it (unless you configure the network to be shared). Tenants can create multiple networks until the thresholds per-tenant quota is reached.

In the v2.0 Networking API, the network is the main entity. Ports and subnets are always associated with a network.

Index

Package Files

doc.go errors.go requests.go results.go urls.go

func ExtractNetworks Uses

func ExtractNetworks(page pagination.Page) ([]Network, error)

ExtractNetworks accepts a Page struct, specifically a NetworkPage struct, and extracts the elements into a slice of Network structs. In other words, a generic collection is mapped into a relevant slice.

func IDFromName Uses

func IDFromName(client *gophercloud.ServiceClient, name string) (string, error)

IDFromName is a convenience function that returns a network's ID given its name.

func List Uses

func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List returns a Pager which allows you to iterate over a collection of networks. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type AdminState Uses

type AdminState *bool

AdminState gives users a solid type to work with for create and update operations. It is recommended that users use the `Up` and `Down` enums.

var (
    Up   AdminState = &iTrue
    Down AdminState = &iFalse
)

Convenience vars for AdminStateUp values.

type CreateOpts Uses

type CreateOpts networkOpts

CreateOpts is the common options struct used in this package's Create operation.

func (CreateOpts) ToNetworkCreateMap Uses

func (opts CreateOpts) ToNetworkCreateMap() (map[string]interface{}, error)

ToNetworkCreateMap casts a CreateOpts struct to a map.

type CreateOptsBuilder Uses

type CreateOptsBuilder interface {
    ToNetworkCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder is the interface options structs have to satisfy in order to be used in the main Create operation in this package. Since many extensions decorate or modify the common logic, it is useful for them to satisfy a basic interface in order for them to be used.

type CreateResult Uses

type CreateResult struct {
    // contains filtered or unexported fields
}

CreateResult represents the result of a create operation.

func Create Uses

func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult

Create accepts a CreateOpts struct and creates a new network using the values provided. This operation does not actually require a request body, i.e. the CreateOpts struct argument can be empty.

The tenant ID that is contained in the URI is the tenant that creates the network. An admin user, however, has the option of specifying another tenant ID in the CreateOpts struct.

func (CreateResult) Extract Uses

func (r CreateResult) Extract() (*Network, error)

Extract is a function that accepts a result and extracts a network resource.

type DeleteResult Uses

type DeleteResult struct {
    gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation.

func Delete Uses

func Delete(c *gophercloud.ServiceClient, networkID string) DeleteResult

Delete accepts a unique ID and deletes the network associated with it.

type GetResult Uses

type GetResult struct {
    // contains filtered or unexported fields
}

GetResult represents the result of a get operation.

func Get Uses

func Get(c *gophercloud.ServiceClient, id string) GetResult

Get retrieves a specific network based on its unique ID.

func (GetResult) Extract Uses

func (r GetResult) Extract() (*Network, error)

Extract is a function that accepts a result and extracts a network resource.

type ListOpts Uses

type ListOpts struct {
    Status       string `q:"status"`
    Name         string `q:"name"`
    AdminStateUp *bool  `q:"admin_state_up"`
    TenantID     string `q:"tenant_id"`
    Shared       *bool  `q:"shared"`
    ID           string `q:"id"`
    Marker       string `q:"marker"`
    Limit        int    `q:"limit"`
    SortKey      string `q:"sort_key"`
    SortDir      string `q:"sort_dir"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the network attributes you want to see returned. SortKey allows you to sort by a particular network attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToNetworkListQuery Uses

func (opts ListOpts) ToNetworkListQuery() (string, error)

ToNetworkListQuery formats a ListOpts into a query string.

type ListOptsBuilder Uses

type ListOptsBuilder interface {
    ToNetworkListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type Network Uses

type Network struct {
    // UUID for the network
    ID  string `mapstructure:"id" json:"id"`

    // Human-readable name for the network. Might not be unique.
    Name string `mapstructure:"name" json:"name"`

    // The administrative state of network. If false (down), the network does not forward packets.
    AdminStateUp bool `mapstructure:"admin_state_up" json:"admin_state_up"`

    // Indicates whether network is currently operational. Possible values include
    // `ACTIVE', `DOWN', `BUILD', or `ERROR'. Plug-ins might define additional values.
    Status string `mapstructure:"status" json:"status"`

    // Subnets associated with this network.
    Subnets []string `mapstructure:"subnets" json:"subnets"`

    // Owner of network. Only admin users can specify a tenant_id other than its own.
    TenantID string `mapstructure:"tenant_id" json:"tenant_id"`

    // Specifies whether the network resource can be accessed by any tenant or not.
    Shared bool `mapstructure:"shared" json:"shared"`
}

Network represents, well, a network.

type NetworkPage Uses

type NetworkPage struct {
    pagination.LinkedPageBase
}

NetworkPage is the page returned by a pager when traversing over a collection of networks.

func (NetworkPage) IsEmpty Uses

func (p NetworkPage) IsEmpty() (bool, error)

IsEmpty checks whether a NetworkPage struct is empty.

func (NetworkPage) NextPageURL Uses

func (p NetworkPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of networks has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type UpdateOpts Uses

type UpdateOpts networkOpts

UpdateOpts is the common options struct used in this package's Update operation.

func (UpdateOpts) ToNetworkUpdateMap Uses

func (opts UpdateOpts) ToNetworkUpdateMap() (map[string]interface{}, error)

ToNetworkUpdateMap casts a UpdateOpts struct to a map.

type UpdateOptsBuilder Uses

type UpdateOptsBuilder interface {
    ToNetworkUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder is the interface options structs have to satisfy in order to be used in the main Update operation in this package. Since many extensions decorate or modify the common logic, it is useful for them to satisfy a basic interface in order for them to be used.

type UpdateResult Uses

type UpdateResult struct {
    // contains filtered or unexported fields
}

UpdateResult represents the result of an update operation.

func Update Uses

func Update(c *gophercloud.ServiceClient, networkID string, opts UpdateOptsBuilder) UpdateResult

Update accepts a UpdateOpts struct and updates an existing network using the values provided. For more information, see the Create function.

func (UpdateResult) Extract Uses

func (r UpdateResult) Extract() (*Network, error)

Extract is a function that accepts a result and extracts a network resource.

Package networks imports 4 packages (graph) and is imported by 93 packages. Updated 2016-07-23. Refresh now. Tools for package owners.