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

package networks

import "github.com/rackspace/gophercloud/rackspace/compute/v2/networks"

Package networks provides information and interaction with the network API resource for the Rackspace Cloud Servers service.

Index

Package Files

doc.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 List Uses

func List(c *gophercloud.ServiceClient) 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 CreateOpts Uses

type CreateOpts struct {
    // REQUIRED. See Network object for more info.
    CIDR string
    // REQUIRED. See Network object for more info.
    Label string
}

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 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.
    Label string `mapstructure:"label" json:"label"`

    // Classless Inter-Domain Routing
    CIDR string `mapstructure:"cidr" json:"cidr"`
}

Network represents, well, a network.

type NetworkPage Uses

type NetworkPage struct {
    pagination.SinglePageBase
}

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

func (NetworkPage) IsEmpty Uses

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

IsEmpty returns true if the NetworkPage contains no Networks.

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