load_balancers

package
v2.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package load_balancers contains functionality for working with ECL Managed Load Balancer resources.

Example to list load balancers

listOpts := load_balancers.ListOpts{}

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

allLoadBalancers, err := load_balancers.ExtractLoadBalancers(allPages)
if err != nil {
	panic(err)
}

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

Example to create a load balancer

reservedFixedIP1 := load_balancers.CreateOptsReservedFixedIP{
	IPAddress: "192.168.0.2",
}
reservedFixedIP2 := load_balancers.CreateOptsReservedFixedIP{
	IPAddress: "192.168.0.3",
}
reservedFixedIP3 := load_balancers.CreateOptsReservedFixedIP{
	IPAddress: "192.168.0.4",
}
reservedFixedIP4 := load_balancers.CreateOptsReservedFixedIP{
	IPAddress: "192.168.0.5",
}
interface1 := load_balancers.CreateOptsInterface{
	NetworkID: "d6797cf4-42b9-4cad-8591-9dd91c3f0fc3",
	VirtualIPAddress: "192.168.0.1",
	ReservedFixedIPs: &[]load_balancers.CreateOptsReservedFixedIP{reservedFixedIP1, reservedFixedIP2, reservedFixedIP3, reservedFixedIP4},
}
syslogServer1 := load_balancers.CreateOptsSyslogServer{
	IPAddress: "192.168.0.6",
	Port: 514,
	Protocol: "udp",
}

var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
	panic(err)
}

createOpts := load_balancers.CreateOpts{
	Name: "load_balancer",
	Description: "description",
	Tags: tags,
	PlanID: "00713021-9aea-41da-9a88-87760c08fa72",
	SyslogServers: &[]load_balancers.CreateOptsSyslogServer{syslogServer1},
	Interfaces: &[]load_balancers.CreateOptsInterface{interface1},
}

loadBalancer, err := load_balancers.Create(managedLoadBalancerClient, createOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", loadBalancer)

Example to show a load balancer

showOpts := load_balancers.ShowOpts{}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
loadBalancer, err := load_balancers.Show(managedLoadBalancerClient, id, showOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", loadBalancer)

Example to update a load balancer

name := "load_balancer"
description := "description"

var tags map[string]interface{}
tagsJson := `{"key":"value"}`
err := json.Unmarshal([]byte(tagsJson), &tags)
if err != nil {
	panic(err)
}

updateOpts := load_balancers.UpdateOpts{
	Name: &name,
	Description: &description,
	Tags: &tags,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
loadBalancer, err := load_balancers.Update(managedLoadBalancerClient, updateOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", loadBalancer)

Example to delete a load balancer

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := load_balancers.Delete(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
	panic(err)
}

Example to perform apply-configurations action on a load balancer

actionOpts := load_balancers.ActionOpts{
	ApplyConfigurations: true,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := load_balancers.Action(cli, id, actionOpts).ExtractErr()
if err != nil {
	panic(err)
}

Example to perform system-update action on a load balancer

systemUpdate := load_balancers.ActionOptsSystemUpdate{
	SystemUpdateID: "31746df7-92f9-4b5e-ad05-59f6684a54eb",
}
actionOpts := load_balancers.ActionOpts{
	SystemUpdate: &systemUpdate,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := load_balancers.Action(cli, id, actionOpts).ExtractErr()
if err != nil {
	panic(err)
}

Example to perform apply-configurations and system-update action on a load balancer

systemUpdate := load_balancers.ActionOptsSystemUpdate{
	SystemUpdateID: "31746df7-92f9-4b5e-ad05-59f6684a54eb",
}
actionOpts := load_balancers.ActionOpts{
	ApplyConfigurations: true,
	SystemUpdate: &systemUpdate,
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := load_balancers.Action(cli, id, actionOpts).ExtractErr()
if err != nil {
	panic(err)
}

Example to perform cancel-configurations action on a load balancer

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := load_balancers.CancelConfigurations(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
	panic(err)
}

Example to create staged load balancer configurations

reservedFixedIP1 := load_balancers.CreateStagedOptsReservedFixedIP{
	IPAddress: "192.168.0.2",
}
reservedFixedIP2 := load_balancers.CreateStagedOptsReservedFixedIP{
	IPAddress: "192.168.0.3",
}
reservedFixedIP3 := load_balancers.CreateStagedOptsReservedFixedIP{
	IPAddress: "192.168.0.4",
}
reservedFixedIP4 := load_balancers.CreateStagedOptsReservedFixedIP{
	IPAddress: "192.168.0.5",
}
interface1 := load_balancers.CreateStagedOptsInterface{
	NetworkID: "d6797cf4-42b9-4cad-8591-9dd91c3f0fc3",
	VirtualIPAddress: "192.168.0.1",
	ReservedFixedIPs: &[]load_balancers.CreateStagedOptsReservedFixedIP{reservedFixedIP1, reservedFixedIP2, reservedFixedIP3, reservedFixedIP4},
}
syslogServer1 := load_balancers.CreateStagedOptsSyslogServer{
	IPAddress: "192.168.0.6",
	Port: 514,
	Protocol: "udp",
}
createStagedOpts := load_balancers.CreateStagedOpts{
	SyslogServers: &[]load_balancers.CreateStagedOptsSyslogServer{syslogServer1},
	Interfaces: &[]load_balancers.CreateStagedOptsInterface{interface1},
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
loadBalancerConfigurations, err := load_balancers.CreateStaged(managedLoadBalancerClient, id, createStagedOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", loadBalancerConfigurations)

Example to show staged load balancer configurations

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
loadBalancerConfigurations, err := load_balancers.ShowStaged(managedLoadBalancerClient, id).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", loadBalancerConfigurations)

Example to update staged load balancer configurations

reservedFixedIP1IPAddress := "192.168.0.2"
reservedFixedIP1 := load_balancers.UpdateStagedOptsReservedFixedIP{
	IPAddress: &reservedFixedIP1IPAddress,
}

reservedFixedIP2IPAddress := "192.168.0.3"
reservedFixedIP2 := load_balancers.UpdateStagedOptsReservedFixedIP{
	IPAddress: &reservedFixedIP2IPAddress,
}

reservedFixedIP3IPAddress := "192.168.0.4"
reservedFixedIP3 := load_balancers.UpdateStagedOptsReservedFixedIP{
	IPAddress: &reservedFixedIP3IPAddress,
}

reservedFixedIP4IPAddress := "192.168.0.5"
reservedFixedIP4 := load_balancers.UpdateStagedOptsReservedFixedIP{
	IPAddress: &reservedFixedIP4IPAddress,
}

interface1NetworkID := "d6797cf4-42b9-4cad-8591-9dd91c3f0fc3"
interface1VirtualIPAddress := "192.168.0.1"
interface1 := load_balancers.UpdateStagedOptsInterface{
	NetworkID: &interface1NetworkID,
	VirtualIPAddress: &interface1VirtualIPAddress,
	ReservedFixedIPs: &[]load_balancers.UpdateStagedOptsReservedFixedIP{reservedFixedIP1, reservedFixedIP2, reservedFixedIP3, reservedFixedIP4},
}

syslogServer1IPAddress := "192.168.0.6"
syslogServer1Port := 514
syslogServer1Protocol := "udp"
syslogServer1 := load_balancers.UpdateStagedOptsSyslogServer{
	IPAddress: &syslogServer1IPAddress,
	Port: &syslogServer1Port,
	Protocol: &syslogServer1Protocol,
}

updateStagedOpts := load_balancers.UpdateStagedOpts{
	SyslogServers: &[]load_balancers.UpdateStagedOptsSyslogServer{syslogServer1},
	Interfaces: &[]load_balancers.UpdateStagedOptsInterface{interface1},
}

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
loadBalancerConfigurations, err := load_balancers.UpdateStaged(managedLoadBalancerClient, updateStagedOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", loadBalancerConfigurations)

Example to cancel staged load balancer configurations

id := "497f6eca-6276-4993-bfeb-53cbbbba6f08"
err := load_balancers.CancelStaged(managedLoadBalancerClient, id).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractLoadBalancersInto

func ExtractLoadBalancersInto(r pagination.Page, v interface{}) error

ExtractLoadBalancersInto interprets the results of a single page from a List() call, producing a slice of load balancer entities.

func List

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

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

Types

type ActionOpts added in v2.8.0

type ActionOpts struct {

	// - Added or changed configurations of the load balancer and related resources will be applied
	ApplyConfigurations bool `json:"apply-configurations,omitempty"`

	// - Apply the system update to the load balancer
	SystemUpdate *ActionOptsSystemUpdate `json:"system-update,omitempty"`
}

ActionOpts represents options used to perform action on a existing load balancer.

func (ActionOpts) ToLoadBalancerActionMap added in v2.8.0

func (opts ActionOpts) ToLoadBalancerActionMap() map[string]interface{}

ToLoadBalancerActionMap builds a request body from ActionOpts.

type ActionOptsBuilder added in v2.8.0

type ActionOptsBuilder interface {
	ToLoadBalancerActionMap() map[string]interface{}
}

ActionOptsBuilder allows extensions to add additional parameters to the Action request.

type ActionOptsSystemUpdate added in v2.8.0

type ActionOptsSystemUpdate struct {

	// - ID of the system update that will be applied to the load balancer
	SystemUpdateID string `json:"system_update_id"`
}

ActionOptsSystemUpdate represents system-update information in the load balancer action.

type ActionResult

type ActionResult struct {
	eclcloud.ErrResult
}

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

func Action added in v2.8.0

func Action(c *eclcloud.ServiceClient, id string, opts ActionOptsBuilder) (r ActionResult)

Action accepts a ActionOpts struct and performs action on a existing load balancer using the values provided.

func CancelConfigurations

func CancelConfigurations(c *eclcloud.ServiceClient, id string) (r ActionResult)

CancelConfigurations performs action on a existing load balancer.

type CancelStagedResult

type CancelStagedResult struct {
	eclcloud.ErrResult
}

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

func CancelStaged

func CancelStaged(c *eclcloud.ServiceClient, id string) (r CancelStagedResult)

CancelStaged accepts a unique ID and deletes load balancer configurations associated with it.

type ConfigurationInResponse

type ConfigurationInResponse struct {

	// - Syslog servers to which access logs are transferred
	// - The facility code of syslog is 0 (kern), and the severity level is 6 (info)
	// - Only access logs to listeners which `protocol` is either `"http"` or `"https"` are transferred
	//   - If `protocol` of `syslog_servers` is `"tcp"`
	//     - Access logs are transferred to all healthy syslog servers set in `syslog_servers`
	//   - If `protocol` of `syslog_servers` is `"udp"`
	//     - Access logs are transferred to the syslog server set first in `syslog_servers` as long as it is healthy
	//     - Access logs are transferred to the syslog server set second (last) in `syslog_servers` if the first syslog server is not healthy
	SyslogServers []SyslogServerInResponse `json:"syslog_servers,omitempty"`

	// - Interfaces that attached to the load balancer
	Interfaces []InterfaceInResponse `json:"interfaces,omitempty"`
}

ConfigurationInResponse represents a configuration in a load balancer.

type CreateOpts

type CreateOpts struct {

	// - Name of the load balancer
	// - This field accepts single-byte characters only
	Name string `json:"name,omitempty"`

	// - Description of the load balancer
	// - This field accepts single-byte characters only
	Description string `json:"description,omitempty"`

	// - Tags of the load balancer
	// - Set JSON object up to 32,768 characters
	//   - Nested structure is permitted
	// - This field accepts single-byte characters only
	Tags map[string]interface{} `json:"tags,omitempty"`

	// - ID of the plan
	PlanID string `json:"plan_id,omitempty"`

	// - Syslog servers to which access logs are transferred
	// - The facility code of syslog is 0 (kern), and the severity level is 6 (info)
	// - Only access logs to listeners which `protocol` is either `"http"` or `"https"` are transferred
	//   - If `protocol` of `syslog_servers` is `"tcp"`
	//     - Access logs are transferred to all healthy syslog servers set in `syslog_servers`
	//   - If `protocol` of `syslog_servers` is `"udp"`
	//     - Access logs are transferred to the syslog server set first in `syslog_servers` as long as it is healthy
	//     - Access logs are transferred to the syslog server set second (last) in `syslog_servers` if the first syslog server is not healthy
	SyslogServers *[]CreateOptsSyslogServer `json:"syslog_servers,omitempty"`

	// - Interfaces that attached to the load balancer
	// - `virtual_ip_address` and `reserved_fixed_ips` can not be changed once attached
	//   - To change `virtual_ip_address` and `reserved_fixed_ips` , recreating the interface is needed
	Interfaces *[]CreateOptsInterface `json:"interfaces,omitempty"`
}

CreateOpts represents options used to create a new load balancer.

func (CreateOpts) ToLoadBalancerCreateMap

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

ToLoadBalancerCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToLoadBalancerCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateOptsInterface

type CreateOptsInterface struct {

	// - ID of the network that this interface belongs to
	// - Set a unique network ID in `interfaces`
	// - Set a network of which plane is data
	// - Must not set ID of a network that uses ISP shared address (RFC 6598)
	NetworkID string `json:"network_id"`

	// - Virtual IP address of the interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	// - Set an unique IP address in `virtual_ip_address` and `reserved_fixed_ips`
	// - Set a network IP address and broadcast IP address
	// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
	VirtualIPAddress string `json:"virtual_ip_address"`

	// - IP addresses that are pre-reserved for applying configurations of load balancer to be performed without losing redundancy
	ReservedFixedIPs *[]CreateOptsReservedFixedIP `json:"reserved_fixed_ips"`
}

CreateOptsInterface represents interface information in the load balancer creation.

type CreateOptsReservedFixedIP

type CreateOptsReservedFixedIP struct {

	// - The IP address assign to this interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	// - Set an unique IP address in `virtual_ip_address` and `reserved_fixed_ips`
	// - Must not set a network IP address and broadcast IP address
	// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
	IPAddress string `json:"ip_address"`
}

CreateOptsReservedFixedIP represents reserved_fixed_ip information in the load balancer creation.

type CreateOptsSyslogServer

type CreateOptsSyslogServer struct {

	// - IP address of the syslog server
	// - The load balancer sends ICMP to this IP address for health check purpose
	IPAddress string `json:"ip_address"`

	// - Port number of the syslog server
	Port int `json:"port,omitempty"`

	// - Protocol of the syslog server
	// - Set same protocol in all syslog servers which belong to the same load balancer
	Protocol string `json:"protocol,omitempty"`
}

CreateOptsSyslogServer represents syslog_server information in the load balancer creation.

type CreateResult

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

CreateResult represents the result of a Create operation. Call its Extract method to interpret it as a LoadBalancer.

func Create

func Create(c *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and creates a new load balancer using the values provided.

func (CreateResult) Extract

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

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

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a load balancer, if possible.

type CreateStagedOpts

type CreateStagedOpts struct {

	// - Syslog servers to which access logs are transferred
	// - The facility code of syslog is 0 (kern), and the severity level is 6 (info)
	// - Only access logs to listeners which `protocol` is either `"http"` or `"https"` are transferred
	//   - If `protocol` of `syslog_servers` is `"tcp"`
	//     - Access logs are transferred to all healthy syslog servers set in `syslog_servers`
	//   - If `protocol` of `syslog_servers` is `"udp"`
	//     - Access logs are transferred to the syslog server set first in `syslog_servers` as long as it is healthy
	//     - Access logs are transferred to the syslog server set second (last) in `syslog_servers` if the first syslog server is not healthy
	SyslogServers *[]CreateStagedOptsSyslogServer `json:"syslog_servers,omitempty"`

	// - Interfaces that attached to the load balancer
	// - `virtual_ip_address` and `reserved_fixed_ips` can not be changed once attached
	//   - To change `virtual_ip_address` and `reserved_fixed_ips` , recreating the interface is needed
	Interfaces *[]CreateStagedOptsInterface `json:"interfaces,omitempty"`
}

CreateStagedOpts represents options used to create new load balancer configurations.

func (CreateStagedOpts) ToLoadBalancerCreateStagedMap

func (opts CreateStagedOpts) ToLoadBalancerCreateStagedMap() (map[string]interface{}, error)

ToLoadBalancerCreateStagedMap builds a request body from CreateStagedOpts.

type CreateStagedOptsBuilder

type CreateStagedOptsBuilder interface {
	ToLoadBalancerCreateStagedMap() (map[string]interface{}, error)
}

CreateStagedOptsBuilder allows extensions to add additional parameters to the CreateStaged request.

type CreateStagedOptsInterface

type CreateStagedOptsInterface struct {

	// - ID of the network that this interface belongs to
	// - Set a unique network ID in `interfaces`
	// - Set a network of which plane is data
	// - Must not set ID of a network that uses ISP shared address (RFC 6598)
	NetworkID string `json:"network_id"`

	// - Virtual IP address of the interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	// - Set an unique IP address in `virtual_ip_address` and `reserved_fixed_ips`
	// - Must not set a network IP address and broadcast IP address
	// - If there are no changes to the `network_id` within the `interfaces[]` , set the current `virtual_ip_address` value
	// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
	VirtualIPAddress string `json:"virtual_ip_address"`

	// - IP addresses that are pre-reserved for applying configurations of load balancer to be performed without losing redundancy
	// - If there are no changes to the `network_id` within the `interfaces[]` , set the current `reserved_fixed_ips` value
	ReservedFixedIPs *[]CreateStagedOptsReservedFixedIP `json:"reserved_fixed_ips"`
}

CreateStagedOptsInterface represents interface information in the load balancer configurations creation.

type CreateStagedOptsReservedFixedIP

type CreateStagedOptsReservedFixedIP struct {

	// - The IP address assign to this interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	// - Set an unique IP address in `virtual_ip_address` and `reserved_fixed_ips`
	// - Must not set a network IP address and broadcast IP address
	// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
	IPAddress string `json:"ip_address"`
}

CreateStagedOptsReservedFixedIP represents reserved_fixed_ip information in the load balancer configurations creation.

type CreateStagedOptsSyslogServer

type CreateStagedOptsSyslogServer struct {

	// - IP address of the syslog server
	// - The load balancer sends ICMP to this IP address for health check purpose
	IPAddress string `json:"ip_address"`

	// - Port number of the syslog server
	Port int `json:"port,omitempty"`

	// - Protocol of the syslog server
	// - Set same protocol in all syslog servers which belong to the same load balancer
	Protocol string `json:"protocol,omitempty"`
}

CreateStagedOptsSyslogServer represents syslog_server information in the load balancer configurations creation.

type CreateStagedResult

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

CreateStagedResult represents the result of a CreateStaged operation. Call its Extract method to interpret it as a LoadBalancer.

func CreateStaged

func CreateStaged(c *eclcloud.ServiceClient, id string, opts CreateStagedOptsBuilder) (r CreateStagedResult)

CreateStaged accepts a CreateStagedOpts struct and creates new load balancer configurations using the values provided.

func (CreateStagedResult) Extract

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

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

func (CreateStagedResult) ExtractInto

func (r CreateStagedResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a load balancer, if possible.

type DeleteResult

type DeleteResult struct {
	eclcloud.ErrResult
}

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

func Delete

func Delete(c *eclcloud.ServiceClient, id string) (r DeleteResult)

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

type InterfaceInResponse

type InterfaceInResponse struct {

	// - ID of the network that this interface belongs to
	NetworkID string `json:"network_id"`

	// - Virtual IP address of the interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	VirtualIPAddress string `json:"virtual_ip_address"`

	// - IP addresses that are pre-reserved for applying configurations of load balancer to be performed without losing redundancy
	ReservedFixedIPs []ReservedFixedIPInResponse `json:"reserved_fixed_ips"`
}

InterfaceInResponse represents a interface in a load balancer.

type ListOpts

type ListOpts struct {

	// - ID of the resource
	ID string `q:"id"`

	// - Name of the resource
	// - This field accepts single-byte characters only
	Name string `q:"name"`

	// - Description of the resource
	// - This field accepts single-byte characters only
	Description string `q:"description"`

	// - Configuration status of the resource
	ConfigurationStatus string `q:"configuration_status"`

	// - Monitoring status of the load balancer
	MonitoringStatus string `q:"monitoring_status"`

	// - Operation status of the resource
	OperationStatus string `q:"operation_status"`

	// - The zone / group where the primary virtual server of load balancer is deployed
	PrimaryAvailabilityZone string `q:"primary_availability_zone"`

	// - The zone / group where the secondary virtual server of load balancer is deployed
	SecondaryAvailabilityZone string `q:"secondary_availability_zone"`

	// - Primary or secondary availability zone where the load balancer is currently running
	ActiveAvailabilityZone string `q:"active_availability_zone"`

	// - Revision of the load balancer
	Revision int `q:"revision"`

	// - ID of the plan
	PlanID string `q:"plan_id"`

	// - ID of the owner tenant of the resource
	TenantID string `q:"tenant_id"`
}

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 load balancer attributes you want to see returned.

func (ListOpts) ToLoadBalancerListQuery

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

ToLoadBalancerListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type LoadBalancer

type LoadBalancer struct {

	// - ID of the load balancer
	ID string `json:"id"`

	// - Name of the load balancer
	Name string `json:"name"`

	// - Description of the load balancer
	Description string `json:"description"`

	// - Tags of the load balancer (JSON object format)
	Tags map[string]interface{} `json:"tags"`

	// - Configuration status of the load balancer
	//   - `"ACTIVE"`
	//     - There are no configurations of the load balancer that waiting to be applied
	//   - `"CREATE_STAGED"`
	//     - The load balancer has been added and waiting to be applied
	//   - `"UPDATE_STAGED"`
	//     - Changed configurations of the load balancer exists that waiting to be applied
	ConfigurationStatus string `json:"configuration_status"`

	// - Monitoring status of the load balancer
	//   - `"ACTIVE"`
	//     - The load balancer is operating normally
	//   - `"INITIAL"`
	//     - The load balancer is not deployed and does not monitored
	//   - `"UNAVAILABLE"`
	//     - The load balancer is not operating normally
	MonitoringStatus string `json:"monitoring_status"`

	// - Operation status of the load balancer
	//   - `"NONE"` :
	//     - There are no operations of the load balancer
	//     - The load balancer and related resources can be operated
	//   - `"PROCESSING"`
	//     - The latest operation of the load balancer is processing
	//     - The load balancer and related resources cannot be operated
	//   - `"COMPLETE"`
	//     - The latest operation of the load balancer has been succeeded
	//     - The load balancer and related resources can be operated
	//   - `"STUCK"`
	//     - The latest operation of the load balancer has been stopped
	//     - Operators of NTT Communications will investigate the operation
	//     - The load balancer and related resources cannot be operated
	//   - `"ERROR"`
	//     - The latest operation of the load balancer has been failed
	//     - The operation was roll backed normally
	//     - The load balancer and related resources can be operated
	OperationStatus string `json:"operation_status"`

	// - The zone / group where the primary virtual server of load balancer is deployed
	PrimaryAvailabilityZone string `json:"primary_availability_zone,omitempty"`

	// - The zone / group where the secondary virtual server of load balancer is deployed
	SecondaryAvailabilityZone string `json:"secondary_availability_zone,omitempty"`

	// - Primary or secondary availability zone where the load balancer is currently running
	// - If can not define active availability zone, returns `"UNDEFINED"`
	ActiveAvailabilityZone string `json:"active_availability_zone"`

	// - Revision of the load balancer
	Revision int `json:"revision"`

	// - ID of the plan
	PlanID string `json:"plan_id"`

	// - Name of the plan
	PlanName string `json:"plan_name"`

	// - ID of the owner tenant of the load balancer
	TenantID string `json:"tenant_id"`

	// - Syslog servers to which access logs are transferred
	// - The facility code of syslog is 0 (kern), and the severity level is 6 (info)
	// - Only access logs to listeners which `protocol` is either `"http"` or `"https"` are transferred
	//   - If `protocol` of `syslog_servers` is `"tcp"`
	//     - Access logs are transferred to all healthy syslog servers set in `syslog_servers`
	//   - If `protocol` of `syslog_servers` is `"udp"`
	//     - Access logs are transferred to the syslog server set first in `syslog_servers` as long as it is healthy
	//     - Access logs are transferred to the syslog server set second (last) in `syslog_servers` if the first syslog server is not healthy
	SyslogServers []SyslogServerInResponse `json:"syslog_servers,omitempty"`

	// - Interfaces that attached to the load balancer
	Interfaces []InterfaceInResponse `json:"interfaces,omitempty"`

	// - Running configurations of the load balancer
	// - If `changes` is `true`, return object
	// - If current configuration does not exist, return `null`
	Current ConfigurationInResponse `json:"current,omitempty"`

	// - Added or changed configurations of the load balancer that waiting to be applied
	// - If `changes` is `true`, return object
	// - If staged configuration does not exist, return `null`
	Staged ConfigurationInResponse `json:"staged,omitempty"`
}

LoadBalancer represents a load balancer.

func ExtractLoadBalancers

func ExtractLoadBalancers(r pagination.Page) ([]LoadBalancer, error)

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

type LoadBalancerPage

type LoadBalancerPage struct {
	pagination.LinkedPageBase
}

LoadBalancerPage is the page returned by a pager when traversing over a collection of load balancer.

func (LoadBalancerPage) IsEmpty

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

IsEmpty checks whether a LoadBalancerPage struct is empty.

type ReservedFixedIPInResponse

type ReservedFixedIPInResponse struct {

	// - The IP address assign to this interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	IPAddress string `json:"ip_address"`
}

ReservedFixedIPInResponse represents a reserved fixed ip in a load balancer.

type ShowOpts

type ShowOpts struct {

	// - If `true` is set, `current` and `staged` are returned in response body
	Changes bool `q:"changes"`
}

ShowOpts represents options used to show a load balancer.

func (ShowOpts) ToLoadBalancerShowQuery

func (opts ShowOpts) ToLoadBalancerShowQuery() (string, error)

ToLoadBalancerShowQuery formats a ShowOpts into a query string.

type ShowOptsBuilder

type ShowOptsBuilder interface {
	ToLoadBalancerShowQuery() (string, error)
}

ShowOptsBuilder allows extensions to add additional parameters to the Show request.

type ShowResult

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

ShowResult represents the result of a Show operation. Call its Extract method to interpret it as a LoadBalancer.

func Show

func Show(c *eclcloud.ServiceClient, id string, opts ShowOptsBuilder) (r ShowResult)

Show retrieves a specific load balancer based on its unique ID.

func (ShowResult) Extract

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

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

func (ShowResult) ExtractInto

func (r ShowResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a load balancer, if possible.

type ShowStagedResult

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

ShowStagedResult represents the result of a ShowStaged operation. Call its Extract method to interpret it as a LoadBalancer.

func ShowStaged

func ShowStaged(c *eclcloud.ServiceClient, id string) (r ShowStagedResult)

ShowStaged retrieves specific load balancer configurations based on its unique ID.

func (ShowStagedResult) Extract

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

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

func (ShowStagedResult) ExtractInto

func (r ShowStagedResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a load balancer, if possible.

type SyslogServerInResponse

type SyslogServerInResponse struct {

	// - IP address of the syslog server
	// - The load balancer sends ICMP to this IP address for health check purpose
	IPAddress string `json:"ip_address"`

	// - Port number of the syslog server
	Port int `json:"port"`

	// - Protocol of the syslog server
	Protocol string `json:"protocol"`
}

SyslogServerInResponse represents a syslog server in a load balancer.

type UpdateOpts

type UpdateOpts struct {

	// - Name of the load balancer
	// - This field accepts single-byte characters only
	Name *string `json:"name,omitempty"`

	// - Description of the load balancer
	// - This field accepts single-byte characters only
	Description *string `json:"description,omitempty"`

	// - Tags of the load balancer
	// - Set JSON object up to 32,768 characters
	//   - Nested structure is permitted
	// - This field accepts single-byte characters only
	Tags *map[string]interface{} `json:"tags,omitempty"`
}

UpdateOpts represents options used to update a existing load balancer.

func (UpdateOpts) ToLoadBalancerUpdateMap

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

ToLoadBalancerUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

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

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult represents the result of a Update operation. Call its Extract method to interpret it as a LoadBalancer.

func Update

func Update(c *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates a existing load balancer using the values provided.

func (UpdateResult) Extract

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

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

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a load balancer, if possible.

type UpdateStagedOpts

type UpdateStagedOpts struct {

	// - Syslog servers to which access logs are transferred
	// - The facility code of syslog is 0 (kern), and the severity level is 6 (info)
	// - Only access logs to listeners which `protocol` is either `"http"` or `"https"` are transferred
	//   - If `protocol` of `syslog_servers` is `"tcp"`
	//     - Access logs are transferred to all healthy syslog servers set in `syslog_servers`
	//   - If `protocol` of `syslog_servers` is `"udp"`
	//     - Access logs are transferred to the syslog server set first in `syslog_servers` as long as it is healthy
	//     - Access logs are transferred to the syslog server set second (last) in `syslog_servers` if the first syslog server is not healthy
	SyslogServers *[]UpdateStagedOptsSyslogServer `json:"syslog_servers,omitempty"`

	// - Interfaces that attached to the load balancer
	// - `virtual_ip_address` and `reserved_fixed_ips` can not be changed once attached
	//   - To change `virtual_ip_address` and `reserved_fixed_ips` , recreating the interface is needed
	Interfaces *[]UpdateStagedOptsInterface `json:"interfaces,omitempty"`
}

UpdateStagedOpts represents options used to update existing Load Balancer configurations.

func (UpdateStagedOpts) ToLoadBalancerUpdateStagedMap

func (opts UpdateStagedOpts) ToLoadBalancerUpdateStagedMap() (map[string]interface{}, error)

ToLoadBalancerUpdateStagedMap builds a request body from UpdateStagedOpts.

type UpdateStagedOptsBuilder

type UpdateStagedOptsBuilder interface {
	ToLoadBalancerUpdateStagedMap() (map[string]interface{}, error)
}

UpdateStagedOptsBuilder allows extensions to add additional parameters to the UpdateStaged request.

type UpdateStagedOptsInterface

type UpdateStagedOptsInterface struct {

	// - ID of the network that this interface belongs to
	// - Set a unique network ID in `interfaces`
	// - Set a network of which plane is data
	// - Must not set ID of a network that uses ISP shared address (RFC 6598)
	NetworkID *string `json:"network_id"`

	// - Virtual IP address of the interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	// - Set an unique IP address in `virtual_ip_address` and `reserved_fixed_ips`
	// - Must not set a network IP address and broadcast IP address
	// - If there are no changes to the `network_id` within the `interfaces[]` , set the current `virtual_ip_address` value
	// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
	VirtualIPAddress *string `json:"virtual_ip_address"`

	// - IP addresses that are pre-reserved for applying configurations of load balancer to be performed without losing redundancy
	// - If there are no changes to the `network_id` within the `interfaces[]` , set the current `reserved_fixed_ips` value
	ReservedFixedIPs *[]UpdateStagedOptsReservedFixedIP `json:"reserved_fixed_ips"`
}

UpdateStagedOptsInterface represents interface information in load balancer configurations updation.

type UpdateStagedOptsReservedFixedIP

type UpdateStagedOptsReservedFixedIP struct {

	// - The IP address assign to this interface within subnet
	// - Do not use this IP address at the interface of other devices, allowed address pairs, etc
	// - Set an unique IP address in `virtual_ip_address` and `reserved_fixed_ips`
	// - Must not set a network IP address and broadcast IP address
	// - Must not set a link-local IP address (RFC 3927) which includes Common Function Gateway
	IPAddress *string `json:"ip_address"`
}

UpdateStagedOptsReservedFixedIP represents reserved_fixed_ip information in load balancer configurations updation.

type UpdateStagedOptsSyslogServer

type UpdateStagedOptsSyslogServer struct {

	// - IP address of the syslog server
	// - The load balancer sends ICMP to this IP address for health check purpose
	IPAddress *string `json:"ip_address"`

	// - Port number of the syslog server
	Port *int `json:"port,omitempty"`

	// - Protocol of the syslog server
	// - Set same protocol in all syslog servers which belong to the same load balancer
	Protocol *string `json:"protocol,omitempty"`
}

UpdateStagedOptsSyslogServer represents syslog_server information in load balancer configurations updation.

type UpdateStagedResult

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

UpdateStagedResult represents the result of a UpdateStaged operation. Call its Extract method to interpret it as a LoadBalancer.

func UpdateStaged

func UpdateStaged(c *eclcloud.ServiceClient, id string, opts UpdateStagedOptsBuilder) (r UpdateStagedResult)

UpdateStaged accepts a UpdateStagedOpts struct and updates existing Load Balancer configurations using the values provided.

func (UpdateStagedResult) Extract

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

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

func (UpdateStagedResult) ExtractInto

func (r UpdateStagedResult) ExtractInto(v interface{}) error

ExtractInto interprets any commonResult as a load balancer, if possible.

Directories

Path Synopsis
Package testing contains load balancer unit tests
Package testing contains load balancer unit tests

Jump to

Keyboard shortcuts

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