amphorae

package
v0.0.0-...-08576c7 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package amphorae provides information and interaction with Amphorae of OpenStack Load-balancing service.

Example to List Amphorae

listOpts := amphorae.ListOpts{
	LoadbalancerID: "6bd55cd3-802e-447e-a518-1e74e23bb106",
}

allPages, err := amphorae.List(octaviaClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allAmphorae, err := amphorae.ExtractAmphorae(allPages)
if err != nil {
	panic(err)
}

for _, amphora := range allAmphorae {
	fmt.Printf("%+v\n", amphora)
}

Example to Failover an amphora

ampID := "d67d56a6-4a86-4688-a282-f46444705c64"

err := amphorae.Failover(octaviaClient, ampID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

List returns a Pager which allows you to iterate over a collection of amphorae. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Types

type Amphora

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

	// The ID of the load balancer.
	LoadbalancerID string `json:"loadbalancer_id"`

	// The management IP of the amphora.
	LBNetworkIP string `json:"lb_network_ip"`

	// The ID of the amphora resource in the compute system.
	ComputeID string `json:"compute_id"`

	// The IP address of the Virtual IP (VIP).
	HAIP string `json:"ha_ip"`

	// The ID of the Virtual IP (VIP) port.
	HAPortID string `json:"ha_port_id"`

	// The date the certificate for the amphora expires.
	CertExpiration time.Time `json:"-"`

	// Whether the certificate is in the process of being replaced.
	CertBusy bool `json:"cert_busy"`

	// The role of the amphora. One of STANDALONE, MASTER, BACKUP.
	Role string `json:"role"`

	// The status of the amphora. One of: BOOTING, ALLOCATED, READY, PENDING_CREATE, PENDING_DELETE, DELETED, ERROR.
	Status string `json:"status"`

	// The vrrp port’s ID in the networking system.
	VRRPPortID string `json:"vrrp_port_id"`

	// The address of the vrrp port on the amphora.
	VRRPIP string `json:"vrrp_ip"`

	// The bound interface name of the vrrp port on the amphora.
	VRRPInterface string `json:"vrrp_interface"`

	// The vrrp group’s ID for the amphora.
	VRRPID int `json:"vrrp_id"`

	// The priority of the amphora in the vrrp group.
	VRRPPriority int `json:"vrrp_priority"`

	// The availability zone of a compute instance, cached at create time. This is not guaranteed to be current. May be
	// an empty-string if the compute service does not use zones.
	CachedZone string `json:"cached_zone"`

	// The ID of the glance image used for the amphora.
	ImageID string `json:"image_id"`

	// The UTC date and timestamp when the resource was created.
	CreatedAt time.Time `json:"-"`

	// The UTC date and timestamp when the resource was last updated.
	UpdatedAt time.Time `json:"-"`
}

Amphora is virtual machine, container, dedicated hardware, appliance or device that actually performs the task of load balancing in the Octavia system.

func ExtractAmphorae

func ExtractAmphorae(r pagination.Page) ([]Amphora, error)

ExtractAmphorae accepts a Page struct, specifically a AmphoraPage struct, and extracts the elements into a slice of Amphora structs. In other words, a generic collection is mapped into a relevant slice.

func (*Amphora) UnmarshalJSON

func (a *Amphora) UnmarshalJSON(b []byte) error

type AmphoraPage

type AmphoraPage struct {
	pagination.LinkedPageBase
}

AmphoraPage is the page returned by a pager when traversing over a collection of amphorae.

func (AmphoraPage) IsEmpty

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

IsEmpty checks whether a AmphoraPage struct is empty.

func (AmphoraPage) NextPageURL

func (r AmphoraPage) NextPageURL() (string, error)

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

type FailoverResult struct {
	gophercloud.ErrResult
}

FailoverResult represents the result of a failover operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Failover

func Failover(c *gophercloud.ServiceClient, id string) (r FailoverResult)

Failover performs a failover of an amphora.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as an amphora.

func Get

func Get(c *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves a particular amphora based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts an amphora.

type ListOpts

type ListOpts struct {
	LoadbalancerID string `q:"loadbalancer_id"`
	ImageID        string `q:"image_id"`
	Role           string `q:"role"`
	Status         string `q:"status"`
	HAPortID       string `q:"ha_port_id"`
	VRRPPortID     string `q:"vrrp_port_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 Amphorae attributes you want to see returned. SortKey allows you to sort by a particular attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToAmphoraListQuery

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

ToAmphoraListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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