Documentation

Overview

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

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func List

      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.

      Types

      type CreateOpts

      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

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

          ToNetworkCreateMap casts a CreateOpts struct to a map.

          type CreateOptsBuilder

          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

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

              CreateResult represents the result of a create operation.

              func Create

                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

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

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

                  type DeleteResult

                  type DeleteResult struct {
                  	gophercloud.ErrResult
                  }

                    DeleteResult represents the result of a delete operation.

                    func Delete

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

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

                      type GetResult

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

                        GetResult represents the result of a get operation.

                        func Get

                          Get retrieves a specific network based on its unique ID.

                          func (GetResult) Extract

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

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

                            type Network

                            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.

                              func ExtractNetworks

                              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.

                                type NetworkPage

                                type NetworkPage struct {
                                	pagination.SinglePageBase
                                }

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

                                  func (NetworkPage) IsEmpty

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

                                    IsEmpty returns true if the NetworkPage contains no Networks.