gophercloud: github.com/rackspace/gophercloud/rackspace/lb/v1/lbs Index | Files

package lbs

import "github.com/rackspace/gophercloud/rackspace/lb/v1/lbs"

Package lbs provides information and interaction with the Load Balancer API resource for the Rackspace Cloud Load Balancer service.

A load balancer is a logical device which belongs to a cloud account. It is used to distribute workloads between multiple back-end systems or services, based on the criteria defined as part of its configuration. This configuration is defined using the Create operation, and can be updated with Update.

To conserve IPv4 address space, it is highly recommended that you share Virtual IPs between load balancers. If you have at least one load balancer, you may create subsequent ones that share a single virtual IPv4 and/or a single IPv6 by passing in a virtual IP ID to the Update operation (instead of a type). This feature is also highly desirable if you wish to load balance both an insecure and secure protocol using one IP or DNS name. In order to share a virtual IP, each Load Balancer must utilize a unique port.

All load balancers have a Status attribute that shows the current configuration status of the device. This status is immutable by the caller and is updated automatically based on state changes within the service. When a load balancer is first created, it is placed into a BUILD state while the configuration is being generated and applied based on the request. Once the configuration is applied and finalized, it is in an ACTIVE status. In the event of a configuration change or update, the status of the load balancer changes to PENDING_UPDATE to signify configuration changes are in progress but have not yet been finalized. Load balancers in a SUSPENDED status are configured to reject traffic and do not forward requests to back-end nodes.

An HTTP load balancer has the X-Forwarded-For (XFF) HTTP header set by default. This header contains the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer, which many web applications are already designed to use when determining the source address for a request.

It also includes the X-Forwarded-Proto (XFP) HTTP header, which has been added for identifying the originating protocol of an HTTP request as "http" or "https" depending on which protocol the client requested. This is useful when using SSL termination.

Finally, it also includes the X-Forwarded-Port HTTP header, which has been added for being able to generate secure URLs containing the specified port. This header, along with the X-Forwarded-For header, provides the needed information to the underlying application servers.

Index

Package Files

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

func DeleteErrorPage Uses

func DeleteErrorPage(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult

DeleteErrorPage will delete the current error page for the load balancer.

func DisableCaching Uses

func DisableCaching(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult

DisableCaching will disable content-caching for the specified load balancer.

func DisableLogging Uses

func DisableLogging(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult

DisableLogging will disable connection logging for a specified load balancer.

func EnableCaching Uses

func EnableCaching(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult

EnableCaching will enable content-caching for the specified load balancer.

func EnableLogging Uses

func EnableLogging(client *gophercloud.ServiceClient, id int) gophercloud.ErrResult

EnableLogging will enable connection logging for a specified load balancer.

func ExtractAlgorithms Uses

func ExtractAlgorithms(page pagination.Page) ([]Algorithm, error)

ExtractAlgorithms accepts a Page struct, specifically an AlgorithmPage struct, and extracts the elements into a slice of Algorithm structs. In other words, a generic collection is mapped into a relevant slice.

func ExtractLBs Uses

func ExtractLBs(page pagination.Page) ([]LoadBalancer, error)

ExtractLBs accepts a Page struct, specifically a LBPage struct, and extracts the elements into a slice of LoadBalancer structs. In other words, a generic collection is mapped into a relevant slice.

func ExtractProtocols Uses

func ExtractProtocols(page pagination.Page) ([]Protocol, error)

ExtractProtocols accepts a Page struct, specifically a ProtocolPage struct, and extracts the elements into a slice of Protocol structs. In other words, a generic collection is mapped into a relevant slice.

func IsContentCached Uses

func IsContentCached(client *gophercloud.ServiceClient, id int) (bool, error)

IsContentCached will check to see whether the specified load balancer caches content. When content caching is enabled, recently-accessed files are stored on the load balancer for easy retrieval by web clients. Content caching improves the performance of high traffic web sites by temporarily storing data that was recently accessed. While it's cached, requests for that data are served by the load balancer, which in turn reduces load off the back-end nodes. The result is improved response times for those requests and less load on the web server.

func IsLoggingEnabled Uses

func IsLoggingEnabled(client *gophercloud.ServiceClient, id int) (bool, error)

IsLoggingEnabled returns true if the load balancer has connection logging enabled and false if not.

func List Uses

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

List is the operation responsible for returning a paginated collection of load balancers. You may pass in a ListOpts struct to filter results.

func ListAlgorithms Uses

func ListAlgorithms(client *gophercloud.ServiceClient) pagination.Pager

ListAlgorithms is the operation responsible for returning a paginated collection of load balancer algorithms.

func ListProtocols Uses

func ListProtocols(client *gophercloud.ServiceClient) pagination.Pager

ListProtocols is the operation responsible for returning a paginated collection of load balancer protocols.

type Algorithm Uses

type Algorithm struct {
    // The name of the algorithm, e.g RANDOM, ROUND_ROBIN, etc.
    Name string
}

Algorithm defines how traffic should be directed between back-end nodes.

type AlgorithmPage Uses

type AlgorithmPage struct {
    pagination.SinglePageBase
}

AlgorithmPage is the page returned by a pager when traversing over a collection of LB algorithms.

func (AlgorithmPage) IsEmpty Uses

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

IsEmpty checks whether an AlgorithmPage struct is empty.

type Cluster Uses

type Cluster struct {
    Name string
}

Cluster - temp

type ConnectionLogging Uses

type ConnectionLogging struct {
    Enabled bool
}

ConnectionLogging - temp

type CreateOpts Uses

type CreateOpts struct {
    // Required - name of the load balancer to create. The name must be 128
    // characters or fewer in length, and all UTF-8 characters are valid.
    Name string

    // Optional - nodes to be added.
    Nodes []nodes.Node

    // Required - protocol of the service that is being load balanced.
    // See http://docs.rackspace.com/loadbalancers/api/v1.0/clb-devguide/content/protocols.html
    // for a full list of supported protocols.
    Protocol string

    // Optional - enables or disables Half-Closed support for the load balancer.
    // Half-Closed support provides the ability for one end of the connection to
    // terminate its output, while still receiving data from the other end. Only
    // available for TCP/TCP_CLIENT_FIRST protocols.
    HalfClosed gophercloud.EnabledState

    // Optional - the type of virtual IPs you want associated with the load
    // balancer.
    VIPs []vips.VIP

    // Optional - the access list management feature allows fine-grained network
    // access controls to be applied to the load balancer virtual IP address.
    AccessList *acl.AccessList

    // Optional - algorithm that defines how traffic should be directed between
    // back-end nodes.
    Algorithm string

    // Optional - current connection logging configuration.
    ConnectionLogging *ConnectionLogging

    // Optional - specifies a limit on the number of connections per IP address
    // to help mitigate malicious or abusive traffic to your applications.
    ConnThrottle *throttle.ConnectionThrottle

    // Optional - the type of health monitor check to perform to ensure that the
    // service is performing properly.
    HealthMonitor *monitors.Monitor

    // Optional - arbitrary information that can be associated with each LB.
    Metadata map[string]interface{}

    // Optional - port number for the service you are load balancing.
    Port int

    // Optional - the timeout value for the load balancer and communications with
    // its nodes. Defaults to 30 seconds with a maximum of 120 seconds.
    Timeout int

    // Optional - specifies whether multiple requests from clients are directed
    // to the same node.
    SessionPersistence *sessions.SessionPersistence

    // Optional - enables or disables HTTP to HTTPS redirection for the load
    // balancer. When enabled, any HTTP request returns status code 301 (Moved
    // Permanently), and the requester is redirected to the requested URL via the
    // HTTPS protocol on port 443. For example, http://example.com/page.html
    // would be redirected to https://example.com/page.html. Only available for
    // HTTPS protocol (port=443), or HTTP protocol with a properly configured SSL
    // termination (secureTrafficOnly=true, securePort=443).
    HTTPSRedirect gophercloud.EnabledState
}

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

func (CreateOpts) ToLBCreateMap Uses

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

ToLBCreateMap casts a CreateOpts struct to a map.

type CreateOptsBuilder Uses

type CreateOptsBuilder interface {
    ToLBCreateMap() (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 is the operation responsible for asynchronously provisioning a new load balancer based on the configuration defined in CreateOpts. Once the request is validated and progress has started on the provisioning process, a response struct is returned. When extracted (with Extract()), you have to the load balancer's unique ID and status.

Once an ID is attained, you can check on the progress of the operation by calling Get and passing in the ID. If the corresponding request cannot be fulfilled due to insufficient or invalid data, an HTTP 400 (Bad Request) error response is returned with information regarding the nature of the failure in the body of the response. Failures in the validation process are non-recoverable and require the caller to correct the cause of the failure.

func (CreateResult) Extract Uses

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

Extract interprets any commonResult as a LB, if possible.

type Datetime Uses

type Datetime struct {
    Time time.Time `mapstructure:"-"`
}

Datetime represents the structure of a Created or Updated field.

type DeleteResult Uses

type DeleteResult struct {
    gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation.

func BulkDelete Uses

func BulkDelete(c *gophercloud.ServiceClient, ids []int) DeleteResult

BulkDelete removes all the load balancers referenced in the slice of IDs. Any and all configuration data associated with these load balancers is immediately purged and is not recoverable.

If one of the items in the list cannot be removed due to its current status, a 400 Bad Request error is returned along with the IDs of the ones the system identified as potential failures for this request.

func Delete Uses

func Delete(c *gophercloud.ServiceClient, id int) DeleteResult

Delete removes a single load balancer.

type ErrorPage Uses

type ErrorPage struct {
    Content string
}

ErrorPage represents the HTML file that is shown to an end user who is attempting to access a load balancer node that is offline/unavailable.

During provisioning, every load balancer is configured with a default error page that gets displayed when traffic is requested for an offline node.

You can add a single custom error page with an HTTP-based protocol to a load balancer. Page updates override existing content. If a custom error page is deleted, or the load balancer is changed to a non-HTTP protocol, the default error page is restored.

type ErrorPageResult Uses

type ErrorPageResult struct {
    gophercloud.Result
}

ErrorPageResult represents the result of an error page operation - specifically getting or creating one.

func GetErrorPage Uses

func GetErrorPage(client *gophercloud.ServiceClient, id int) ErrorPageResult

GetErrorPage will retrieve the current error page for the load balancer.

func SetErrorPage Uses

func SetErrorPage(client *gophercloud.ServiceClient, id int, html string) ErrorPageResult

SetErrorPage will set the HTML of the load balancer's error page to a specific value.

func (ErrorPageResult) Extract Uses

func (r ErrorPageResult) Extract() (*ErrorPage, error)

Extract interprets any commonResult as an ErrorPage, if possible.

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 int) GetResult

Get is the operation responsible for providing detailed information regarding a specific load balancer which is configured and associated with your account. This operation is not capable of returning details for a load balancer which has been deleted.

func (GetResult) Extract Uses

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

Extract interprets any commonResult as a LB, if possible.

type LBPage Uses

type LBPage struct {
    pagination.LinkedPageBase
}

LBPage is the page returned by a pager when traversing over a collection of LBs.

func (LBPage) IsEmpty Uses

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

IsEmpty checks whether a NetworkPage struct is empty.

type ListOpts Uses

type ListOpts struct {
    ChangesSince string `q:"changes-since"`
    Status       Status `q:"status"`
    NodeAddr     string `q:"nodeaddress"`
    Marker       string `q:"marker"`
    Limit        int    `q:"limit"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToLBListQuery Uses

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

ToLBListQuery formats a ListOpts into a query string.

type ListOptsBuilder Uses

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

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

type LoadBalancer Uses

type LoadBalancer struct {
    // Human-readable name for the load balancer.
    Name string

    // The unique ID for the load balancer.
    ID  int

    // Represents the service protocol being load balanced. See Protocol type for
    // a list of accepted values.
    // See http://docs.rackspace.com/loadbalancers/api/v1.0/clb-devguide/content/protocols.html
    // for a full list of supported protocols.
    Protocol string

    // Defines how traffic should be directed between back-end nodes. The default
    // algorithm is RANDOM. See Algorithm type for a list of accepted values.
    Algorithm string

    // The current status of the load balancer.
    Status Status

    // The number of load balancer nodes.
    NodeCount int `mapstructure:"nodeCount"`

    // Slice of virtual IPs associated with this load balancer.
    VIPs []vips.VIP `mapstructure:"virtualIps"`

    // Datetime when the LB was created.
    Created Datetime

    // Datetime when the LB was created.
    Updated Datetime

    // Port number for the service you are load balancing.
    Port int

    // HalfClosed provides the ability for one end of the connection to
    // terminate its output while still receiving data from the other end. This
    // is only available on TCP/TCP_CLIENT_FIRST protocols.
    HalfClosed bool

    // Timeout represents the timeout value between a load balancer and its
    // nodes. Defaults to 30 seconds with a maximum of 120 seconds.
    Timeout int

    // The cluster name.
    Cluster Cluster

    // Nodes shows all the back-end nodes which are associated with the load
    // balancer. These are the devices which are delivered traffic.
    Nodes []nodes.Node

    // Current connection logging configuration.
    ConnectionLogging ConnectionLogging

    // SessionPersistence specifies whether multiple requests from clients are
    // directed to the same node.
    SessionPersistence sessions.SessionPersistence

    // ConnectionThrottle specifies a limit on the number of connections per IP
    // address to help mitigate malicious or abusive traffic to your applications.
    ConnectionThrottle throttle.ConnectionThrottle

    // The source public and private IP addresses.
    SourceAddrs SourceAddrs `mapstructure:"sourceAddresses"`

    // Represents the access rules for this particular load balancer. IP addresses
    // or subnet ranges, depending on their type (ALLOW or DENY), can be permitted
    // or blocked.
    AccessList acl.AccessList
}

LoadBalancer represents a load balancer API resource.

type Protocol Uses

type Protocol struct {
    // The name of the protocol, e.g. HTTP, LDAP, FTP, etc.
    Name string

    // The port number for the protocol.
    Port int
}

Protocol represents the network protocol which the load balancer accepts.

type ProtocolPage Uses

type ProtocolPage struct {
    pagination.SinglePageBase
}

ProtocolPage is the page returned by a pager when traversing over a collection of LB protocols.

func (ProtocolPage) IsEmpty Uses

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

IsEmpty checks whether a ProtocolPage struct is empty.

type SourceAddrs Uses

type SourceAddrs struct {
    IPv4Public  string `json:"ipv4Public" mapstructure:"ipv4Public"`
    IPv4Private string `json:"ipv4Servicenet" mapstructure:"ipv4Servicenet"`
    IPv6Public  string `json:"ipv6Public" mapstructure:"ipv6Public"`
    IPv6Private string `json:"ipv6Servicenet" mapstructure:"ipv6Servicenet"`
}

SourceAddrs represents the source public and private IP addresses.

type Stats Uses

type Stats struct {
    // The number of connections closed by this load balancer because its
    // ConnectTimeout interval was exceeded.
    ConnectTimeout int `mapstructure:"connectTimeOut"`

    // The number of transaction or protocol errors for this load balancer.
    ConnectError int

    // Number of connection failures for this load balancer.
    ConnectFailure int

    // Number of connections closed by this load balancer because its Timeout
    // interval was exceeded.
    DataTimedOut int

    // Number of connections closed by this load balancer because the
    // 'keepalive_timeout' interval was exceeded.
    KeepAliveTimedOut int

    // The maximum number of simultaneous TCP connections this load balancer has
    // processed at any one time.
    MaxConnections int `mapstructure:"maxConn"`

    // Number of simultaneous connections active at the time of the request.
    CurrentConnections int `mapstructure:"currentConn"`

    // Number of SSL connections closed by this load balancer because the
    // ConnectTimeout interval was exceeded.
    SSLConnectTimeout int `mapstructure:"connectTimeOutSsl"`

    // Number of SSL transaction or protocol erros in this load balancer.
    SSLConnectError int `mapstructure:"connectErrorSsl"`

    // Number of SSL connection failures in this load balancer.
    SSLConnectFailure int `mapstructure:"connectFailureSsl"`

    // Number of SSL connections closed by this load balancer because the
    // Timeout interval was exceeded.
    SSLDataTimedOut int `mapstructure:"dataTimedOutSsl"`

    // Number of SSL connections closed by this load balancer because the
    // 'keepalive_timeout' interval was exceeded.
    SSLKeepAliveTimedOut int `mapstructure:"keepAliveTimedOutSsl"`

    // Maximum number of simultaneous SSL connections this load balancer has
    // processed at any one time.
    SSLMaxConnections int `mapstructure:"maxConnSsl"`

    // Number of simultaneous SSL connections active at the time of the request.
    SSLCurrentConnections int `mapstructure:"currentConnSsl"`
}

Stats represents all the key information about a load balancer's usage.

type StatsResult Uses

type StatsResult struct {
    gophercloud.Result
}

StatsResult represents the result of a Stats operation.

func GetStats Uses

func GetStats(client *gophercloud.ServiceClient, id int) StatsResult

GetStats will retrieve detailed stats related to the load balancer's usage.

func (StatsResult) Extract Uses

func (r StatsResult) Extract() (*Stats, error)

Extract interprets any commonResult as a Stats struct, if possible.

type Status Uses

type Status string

Status represents the potential state of a load balancer resource.

const (
    // ACTIVE indicates that the LB is configured properly and ready to serve
    // traffic to incoming requests via the configured virtual IPs.
    ACTIVE Status = "ACTIVE"

    // BUILD indicates that the LB is being provisioned for the first time and
    // configuration is being applied to bring the service online. The service
    // cannot yet serve incoming requests.
    BUILD Status = "BUILD"

    // PENDINGUPDATE indicates that the LB is online but configuration changes
    // are being applied to update the service based on a previous request.
    PENDINGUPDATE Status = "PENDING_UPDATE"

    // PENDINGDELETE indicates that the LB is online but configuration changes
    // are being applied to begin deletion of the service based on a previous
    // request.
    PENDINGDELETE Status = "PENDING_DELETE"

    // SUSPENDED indicates that the LB has been taken offline and disabled.
    SUSPENDED Status = "SUSPENDED"

    // ERROR indicates that the system encountered an error when attempting to
    // configure the load balancer.
    ERROR Status = "ERROR"

    // DELETED indicates that the LB has been deleted.
    DELETED Status = "DELETED"
)

type UpdateOpts Uses

type UpdateOpts struct {
    // Optional - new name of the load balancer.
    Name string

    // Optional - the new protocol you want your load balancer to have.
    // See http://docs.rackspace.com/loadbalancers/api/v1.0/clb-devguide/content/protocols.html
    // for a full list of supported protocols.
    Protocol string

    // Optional - see the HalfClosed field in CreateOpts for more information.
    HalfClosed gophercloud.EnabledState

    // Optional - see the Algorithm field in CreateOpts for more information.
    Algorithm string

    // Optional - see the Port field in CreateOpts for more information.
    Port int

    // Optional - see the Timeout field in CreateOpts for more information.
    Timeout int

    // Optional - see the HTTPSRedirect field in CreateOpts for more information.
    HTTPSRedirect gophercloud.EnabledState
}

UpdateOpts represents the options for updating an existing load balancer.

func (UpdateOpts) ToLBUpdateMap Uses

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

ToLBUpdateMap casts an UpdateOpts struct to a map.

type UpdateOptsBuilder Uses

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

UpdateOptsBuilder represents a type that can be converted into a JSON-like map structure.

type UpdateResult Uses

type UpdateResult struct {
    gophercloud.ErrResult
}

UpdateResult represents the result of an update operation.

func Update Uses

func Update(c *gophercloud.ServiceClient, id int, opts UpdateOptsBuilder) UpdateResult

Update is the operation responsible for asynchronously updating the attributes of a specific load balancer. Upon successful validation of the request, the service returns a 202 Accepted response, and the load balancer enters a PENDING_UPDATE state. A user can poll the load balancer with Get to wait for the changes to be applied. When this happens, the load balancer will return to an ACTIVE state.

Package lbs imports 13 packages (graph). Updated 2016-07-23. Refresh now. Tools for package owners.