floatingips

package
v0.1.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2015 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

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 floating IP resources. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Types

type CreateOpts

type CreateOpts struct {
	FloatingNetworkID string
	FloatingIP        string
	PortID            string
	FixedIP           string
	TenantID          string
}

CreateOpts contains all the values needed to create a new floating IP resource. The only required fields are FloatingNetworkID and PortID which refer to the external network and internal port respectively.

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 uses the values provided to create a new floating IP resource. You can create floating IPs on external networks only. If you provide a FloatingNetworkID which refers to a network that is not external (i.e. its `router:external' attribute is False), the operation will fail and return a 400 error.

If you do not specify a FloatingIP address value, the operation will automatically allocate an available address for the new resource. If you do choose to specify one, it must fall within the subnet range for the external network - otherwise the operation returns a 400 error. If the FloatingIP address is already in use, the operation returns a 409 error code.

You can associate the new resource with an internal port by using the PortID field. If you specify a PortID that is not valid, the operation will fail and return 404 error code.

You must also configure an IP address for the port associated with the PortID you have provided - this is what the FixedIP refers to: an IP fixed to a port. Because a port might be associated with multiple IP addresses, you can use the FixedIP field to associate a particular IP address rather than have the API assume for you. If you specify an IP address that is not valid, the operation will fail and return a 400 error code. If the PortID and FixedIP are already associated with another resource, the operation will fail and returns a 409 error code.

func (CreateResult) Extract

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

Extract a result and extracts a FloatingIP resource.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of an update operation.

func Delete

Delete will permanently delete a particular floating IP resource. Please ensure this is what you want - you can also disassociate the IP from existing internal ports.

type FloatingIP

type FloatingIP struct {
	// Unique identifier for the floating IP instance.
	ID string `json:"id" mapstructure:"id"`

	// UUID of the external network where the floating IP is to be created.
	FloatingNetworkID string `json:"floating_network_id" mapstructure:"floating_network_id"`

	// Address of the floating IP on the external network.
	FloatingIP string `json:"floating_ip_address" mapstructure:"floating_ip_address"`

	// UUID of the port on an internal network that is associated with the floating IP.
	PortID string `json:"port_id" mapstructure:"port_id"`

	// The specific IP address of the internal port which should be associated
	// with the floating IP.
	FixedIP string `json:"fixed_ip_address" mapstructure:"fixed_ip_address"`

	// Owner of the floating IP. Only admin users can specify a tenant identifier
	// other than its own.
	TenantID string `json:"tenant_id" mapstructure:"tenant_id"`

	// The condition of the API resource.
	Status string `json:"status" mapstructure:"status"`
}

FloatingIP represents a floating IP resource. A floating IP is an external IP address that is mapped to an internal port and, optionally, a specific IP address on a private network. In other words, it enables access to an instance on a private network from an external network. For this reason, floating IPs can only be defined on networks where the `router:external' attribute (provided by the external network extension) is set to True.

func ExtractFloatingIPs

func ExtractFloatingIPs(page pagination.Page) ([]FloatingIP, error)

ExtractFloatingIPs accepts a Page struct, specifically a FloatingIPPage struct, and extracts the elements into a slice of FloatingIP structs. In other words, a generic collection is mapped into a relevant slice.

type FloatingIPPage

type FloatingIPPage struct {
	pagination.LinkedPageBase
}

FloatingIPPage is the page returned by a pager when traversing over a collection of floating IPs.

func (FloatingIPPage) IsEmpty

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

IsEmpty checks whether a NetworkPage struct is empty.

func (FloatingIPPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of floating IPs 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 GetResult

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

GetResult represents the result of a get operation.

func Get

Get retrieves a particular floating IP resource based on its unique ID.

func (GetResult) Extract

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

Extract a result and extracts a FloatingIP resource.

type ListOpts

type ListOpts struct {
	ID                string `q:"id"`
	FloatingNetworkID string `q:"floating_network_id"`
	PortID            string `q:"port_id"`
	FixedIP           string `q:"fixed_ip_address"`
	FloatingIP        string `q:"floating_ip_address"`
	TenantID          string `q:"tenant_id"`
	Limit             int    `q:"limit"`
	Marker            string `q:"marker"`
	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 floating IP 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.

type UpdateOpts

type UpdateOpts struct {
	PortID string
}

UpdateOpts contains the values used when updating a floating IP resource. The only value that can be updated is which internal port the floating IP is linked to. To associate the floating IP with a new internal port, provide its ID. To disassociate the floating IP from all ports, provide an empty string.

type UpdateResult

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

UpdateResult represents the result of an update operation.

func Update

Update allows floating IP resources to be updated. Currently, the only way to "update" a floating IP is to associate it with a new internal port, or disassociated it from all ports. See UpdateOpts for instructions of how to do this.

func (UpdateResult) Extract

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

Extract a result and extracts a FloatingIP resource.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL