vips

package
v0.2.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2015 License: Apache-2.0, Apache-2.0 Imports: 4 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 routers. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Default policy settings return only those routers that are owned by the tenant who submits the request, unless an admin user submits the request.

Types

type AdminState

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

type CreateOpts struct {
	// Required. Human-readable name for the VIP. Does not have to be unique.
	Name string

	// Required. The network on which to allocate the VIP's address. A tenant can
	// only create VIPs on networks authorized by policy (e.g. networks that
	// belong to them or networks that are shared).
	SubnetID string

	// Required. The protocol - can either be TCP, HTTP or HTTPS.
	Protocol string

	// Required. The port on which to listen for client traffic.
	ProtocolPort int

	// Required. The ID of the pool with which the VIP is associated.
	PoolID string

	// Required for admins. Indicates the owner of the VIP.
	TenantID string

	// Optional. The IP address of the VIP.
	Address string

	// Optional. Human-readable description for the VIP.
	Description string

	// Optional. Omit this field to prevent session persistence.
	Persistence *SessionPersistence

	// Optional. The maximum number of connections allowed for the VIP.
	ConnLimit *int

	// Optional. The administrative state of the VIP. A valid value is true (UP)
	// or false (DOWN).
	AdminStateUp *bool
}

CreateOpts contains all the values needed to create a new virtual IP.

type CreateResult

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

CreateResult represents the result of a create operation.

func Create

Create is an operation which provisions a new virtual IP based on the configuration defined in the CreateOpts struct. Once the request is validated and progress has started on the provisioning process, a CreateResult will be returned.

Please note that the PoolID should refer to a pool that is not already associated with another vip. If the pool is already used by another vip, then the operation will fail with a 409 Conflict error will be returned.

Users with an admin role can create VIPs on behalf of other tenants by specifying a TenantID attribute different than their own.

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts a router.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation.

func Delete

Delete will permanently delete a particular virtual IP based on its unique ID.

type GetResult

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

GetResult represents the result of a get operation.

func Get

Get retrieves a particular virtual IP based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a router.

type ListOpts

type ListOpts struct {
	ID              string `q:"id"`
	Name            string `q:"name"`
	AdminStateUp    *bool  `q:"admin_state_up"`
	Status          string `q:"status"`
	TenantID        string `q:"tenant_id"`
	SubnetID        string `q:"subnet_id"`
	Address         string `q:"address"`
	PortID          string `q:"port_id"`
	Protocol        string `q:"protocol"`
	ProtocolPort    int    `q:"protocol_port"`
	ConnectionLimit int    `q:"connection_limit"`
	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 SessionPersistence

type SessionPersistence struct {
	// The type of persistence mode
	Type string `mapstructure:"type" json:"type"`

	// Name of cookie if persistence mode is set appropriately
	CookieName string `mapstructure:"cookie_name" json:"cookie_name,omitempty"`
}

SessionPersistence represents the session persistence feature of the load balancing service. It attempts to force connections or requests in the same session to be processed by the same member as long as it is ative. Three types of persistence are supported:

SOURCE_IP: With this mode, all connections originating from the same source

IP address, will be handled by the same member of the pool.

HTTP_COOKIE: With this persistence mode, the load balancing function will

create a cookie on the first request from a client. Subsequent
requests containing the same cookie value will be handled by
the same member of the pool.

APP_COOKIE: With this persistence mode, the load balancing function will

rely on a cookie established by the backend application. All
requests carrying the same cookie value will be handled by the
same member of the pool.

type UpdateOpts

type UpdateOpts struct {
	// Human-readable name for the VIP. Does not have to be unique.
	Name string

	// Required. The ID of the pool with which the VIP is associated.
	PoolID string

	// Optional. Human-readable description for the VIP.
	Description string

	// Optional. Omit this field to prevent session persistence.
	Persistence *SessionPersistence

	// Optional. The maximum number of connections allowed for the VIP.
	ConnLimit *int

	// Optional. The administrative state of the VIP. A valid value is true (UP)
	// or false (DOWN).
	AdminStateUp *bool
}

UpdateOpts contains all the values needed to update an existing virtual IP. Attributes not listed here but appear in CreateOpts are immutable and cannot be updated.

type UpdateResult

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

UpdateResult represents the result of an update operation.

func Update

Update is an operation which modifies the attributes of the specified VIP.

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a router.

type VIPPage

type VIPPage struct {
	pagination.LinkedPageBase
}

VIPPage is the page returned by a pager when traversing over a collection of routers.

func (VIPPage) IsEmpty

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

IsEmpty checks whether a RouterPage struct is empty.

func (VIPPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of routers 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 VirtualIP

type VirtualIP struct {
	// The unique ID for the VIP.
	ID string `mapstructure:"id" json:"id"`

	// Owner of the VIP. Only an admin user can specify a tenant ID other than its own.
	TenantID string `mapstructure:"tenant_id" json:"tenant_id"`

	// Human-readable name for the VIP. Does not have to be unique.
	Name string `mapstructure:"name" json:"name"`

	// Human-readable description for the VIP.
	Description string `mapstructure:"description" json:"description"`

	// The ID of the subnet on which to allocate the VIP address.
	SubnetID string `mapstructure:"subnet_id" json:"subnet_id"`

	// The IP address of the VIP.
	Address string `mapstructure:"address" json:"address"`

	// The protocol of the VIP address. A valid value is TCP, HTTP, or HTTPS.
	Protocol string `mapstructure:"protocol" json:"protocol"`

	// The port on which to listen to client traffic that is associated with the
	// VIP address. A valid value is from 0 to 65535.
	ProtocolPort int `mapstructure:"protocol_port" json:"protocol_port"`

	// The ID of the pool with which the VIP is associated.
	PoolID string `mapstructure:"pool_id" json:"pool_id"`

	// The ID of the port which belongs to the load balancer
	PortID string `mapstructure:"port_id" json:"port_id"`

	// Indicates whether connections in the same session will be processed by the
	// same pool member or not.
	Persistence SessionPersistence `mapstructure:"session_persistence" json:"session_persistence"`

	// The maximum number of connections allowed for the VIP. Default is -1,
	// meaning no limit.
	ConnLimit int `mapstructure:"connection_limit" json:"connection_limit"`

	// The administrative state of the VIP. A valid value is true (UP) or false (DOWN).
	AdminStateUp bool `mapstructure:"admin_state_up" json:"admin_state_up"`

	// The status of the VIP. Indicates whether the VIP is operational.
	Status string `mapstructure:"status" json:"status"`
}

VirtualIP is the primary load balancing configuration object that specifies the virtual IP address and port on which client traffic is received, as well as other details such as the load balancing method to be use, protocol, etc. This entity is sometimes known in LB products under the name of a "virtual server", a "vserver" or a "listener".

func ExtractVIPs

func ExtractVIPs(page pagination.Page) ([]VirtualIP, error)

ExtractVIPs accepts a Page struct, specifically a VIPPage struct, and extracts the elements into a slice of VirtualIP structs. In other words, a generic collection is mapped into a relevant slice.

Jump to

Keyboard shortcuts

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