Documentation

LoadBalancer extends PersistentResource
in package
implements HasPtrRecordsInterface

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.

Interfaces, Classes and Traits

HasPtrRecordsInterface
An interface for resources that can hold PTR records (for reverse DNS).

Table of Contents

PATCH_CONTENT_TYPE  = OpenCloudCommonConstantsMime::JSON_PATCH
$accessList  : Collection
The access list management feature allows fine-grained network access controls to be applied to the load balancer's virtual IP address.
$algorithm  : Algorithm
Algorithm that defines how traffic should be directed between back-end nodes.
$cluster  : mixed
$connectionLogging  : ConnectionLogging
Current connection logging configuration.
$connectionThrottle  : ConnectionThrottle
Specifies limits on the number of connections per IP address to help mitigate malicious or abusive traffic to your applications.
$created  : mixed
$healthMonitor  : HealthMonitor
The type of health monitor check to perform to ensure that the service is performing properly.
$httpsRedirect  : bool
Enables or disables HTTP to HTTPS redirection for the load balancer.
$id  : mixed
$metadata  : array<string|int, mixed>|Metadata
Information (metadata) that can be associated with each load balancer for the client's personal use.
$name  : string
Name of the load balancer to create. The name must be 128 characters or less in length, and all UTF-8 characters are valid.
$nodeCount  : mixed
$nodes  : array<string|int, mixed>|Collection
Nodes to be added to the load balancer.
$port  : string
Port of the service which is being load balanced.
$protocol  : string
Protocol of the service which is being load balanced.
$sessionPersistence  : SessionPersistance
Forces multiple requests, of the same protocol, from clients to be directed to the same node.
$sourceAddresses  : mixed
$status  : mixed
$timeout  : int
The timeout value for the load balancer and communications with its nodes.
$updated  : mixed
$virtualIps  : array<string|int, mixed>|Collection
Type of virtual IP to add along with the creation of a load balancer.
$aliases  : array<string|int, mixed>
The aliases configure for the properties of the instance.
$associatedCollections  : mixed
$associatedResources  : mixed
$createKeys  : mixed
$json_name  : mixed
$parent  : BaseResource
$service  : ServiceInterface
$url_resource  : mixed
$logger  : LoggerInterface
The logger instance
$properties  : array<string|int, mixed>
Holds all the properties added by overloading.
__call()  : mixed
Intercept non-existent method calls for dynamic getter/setter functionality.
__construct()  : mixed
access()  : Access
Return an access resource
accessList()  : PaginatedIterator
addCertificateMapping()  : array<string|int, mixed>
Creates a certificate mapping.
addNode()  : void
This method creates a Node object and adds it to a list of Nodes to be added to the LoadBalancer. This method will not add the nodes directly to the load balancer itself; it stores them in an array and the nodes are added later, in one of two ways:
addNodes()  : array<string|int, mixed>
Creates currently added nodes by sending them to the API
addVirtualIp()  : void
Adds a virtual IP to the load balancer. You can use the strings 'PUBLIC' or 'SERVICENET' to indicate the public or internal networks, or you can pass the `Id` of an existing IP address.
certificateMapping()  : CertificateMapping
Returns a Certificate Mapping.
certificateMappingList()  : PaginatedIterator
Returns a Collection of Certificate Mappings.
checkExtension()  : bool
Check whether an extension is valid
checkJsonError()  : mixed
Checks the most recent JSON operation for errors.
connectionLogging()  : mixed
connectionThrottle()  : ConnectionThrottle
Return a connection throttle resource
contentCaching()  : mixed
create()  : Response
Create a new resource
createAccessList()  : Response
Creates an access list. You must provide an array of \stdClass objects, each of which contains `type' and `address' properties. Valid types for the former are: "DENY" or "ALLOW". The address must be a valid IP address, either v4 or v6.
createUrl()  : Url
delete()  : Response
Delete this resource
enableConnectionLogging()  : Response
Set the connection logging setting for this load balancer
enableContentCaching()  : Response
Set the content caching setting for this load balancer
errorPage()  : ErrorPage
Returns the load balancer's error page object
findLink()  : bool
Find a resource link based on a type
generateUuid()  : mixed
getClient()  : ClientInterface
Convenience method to return the service's client
getInstance()  : static
getLogger()  : LoggerInterface
Returns the Logger object.
getMetadata()  : Metadata
getParent()  : mixed
getService()  : ServiceInterface
getUrl()  : mixed
Get this resource's URL
hasConnectionLogging()  : bool
Find out whether connection logging is enabled for this load balancer
hasContentCaching()  : bool
Find out whether content caching is enabled for this load balancer
hasLogger()  : bool
healthMonitor()  : HealthMonitor
Returns the load balancer's health monitor object
id()  : mixed
jsonCollectionElement()  : string
Returns the nested keys that could (rarely) prefix collection items. For example:
jsonCollectionName()  : string
Returns the top-level key for collection responses
jsonName()  : mixed
Returns the top-level key for the returned response JSON document
makeResourceIteratorOptions()  : mixed
metadata()  : Metadata
Return a metadata item
metadataList()  : PaginatedIterator
Return a collection of metadata items
name()  : string
node()  : Node
Returns a Node
nodeEvent()  : NodeEvent
Returns a NodeEvent object
nodeEventList()  : PaginatedIterator
Returns a Collection of NodeEvents
nodeList()  : PaginatedIterator
returns a Collection of Nodes
parseResponse()  : mixed
Parse a HTTP response for the required content
populate()  : mixed
Populates the current object based on an unknown data type.
refresh()  : Response
Refresh the state of a resource
refreshFromLocationUrl()  : mixed
Given a `location` URL, refresh this resource
region()  : mixed
removeCertificateMapping()  : Response
Remove a certificate mapping.
removeNode()  : Response
Remove a node from this load-balancer
resourceName()  : mixed
Returns the URI path for this resource
sessionPersistence()  : SessionPersistence
Return the session persistence resource
setLogger()  : $this
Sets the logger.
setMetadata()  : $this
setParent()  : self
setService()  : PersistentObject
SSLTermination()  : SSLTermination
Return a SSL Termination resource
stats()  : Stats
Returns statistics on the load balancer operation
status()  : string
stripNamespace()  : mixed
toCamel()  : mixed
Convert a string to camelCase format.
toUnderscores()  : mixed
Convert string to underscore format.
update()  : Response
Update a resource
updateCertificateMapping()  : array<string|int, mixed>
Updates a certificate mapping.
url()  : mixed
usage()  : PaginatedIterator
virtualIp()  : VirtualIp
Returns a single Virtual IP (not called publicly)
virtualIpList()  : PaginatedIterator
waitFor()  : mixed
A method to repeatedly poll the API resource, waiting for an eventual state change
createJson()  : object
Provides JSON for create request body
generateJsonPatch()  : string
Generates a JSON Patch representation and return its
getAlias()  : string
Returns the alias configured for the given key. If no alias exists it returns the original key.
getJsonHeader()  : mixed
getPatchHeaders()  : mixed
getProperty()  : mixed
Grab value out of the data array.
getUpdateablePropertiesAsArray()  : mixed
Returns the object's properties as an array
noCreate()  : mixed
noDelete()  : mixed
noUpdate()  : mixed
primaryKeyField()  : string
Returns the primary key field for the object
propertyExists()  : bool
Basic check to see whether property exists.
recursivelyAliasPropertyValue()  : mixed
Returns the given property value's alias, if configured; Else, the unchanged property value is returned. If the given property value is an array or an instance of \stdClass, it is aliases recursively.
refreshFromParent()  : mixed
Causes resource to refresh based on parent's URL
setProperty()  : mixed
We can set a property under three conditions:
updateJson()  : mixed
Provides JSON for update request body
checkAttributePrefix()  : bool
Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array
isAccessible()  : bool
Does the property exist in the object variable list (i.e. does it have public or protected visibility?)

Constants

PATCH_CONTENT_TYPE

public mixed PATCH_CONTENT_TYPE = OpenCloudCommonConstantsMime::JSON_PATCH

Properties

$accessList

The access list management feature allows fine-grained network access controls to be applied to the load balancer's virtual IP address.

public Collection $accessList

$algorithm

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

public Algorithm $algorithm

$connectionThrottle

Specifies limits on the number of connections per IP address to help mitigate malicious or abusive traffic to your applications.

public ConnectionThrottle $connectionThrottle

$healthMonitor

The type of health monitor check to perform to ensure that the service is performing properly.

public HealthMonitor $healthMonitor

$httpsRedirect

Enables or disables HTTP to HTTPS redirection for the load balancer.

public bool $httpsRedirect

$metadata

Information (metadata) that can be associated with each load balancer for the client's personal use.

public array<string|int, mixed>|Metadata $metadata = array()

$name

Name of the load balancer to create. The name must be 128 characters or less in length, and all UTF-8 characters are valid.

public string $name

$nodes

Nodes to be added to the load balancer.

public array<string|int, mixed>|Collection $nodes = array()

$port

Port of the service which is being load balanced.

public string $port

$protocol

Protocol of the service which is being load balanced.

public string $protocol

$sessionPersistence

Forces multiple requests, of the same protocol, from clients to be directed to the same node.

public SessionPersistance $sessionPersistence

$timeout

The timeout value for the load balancer and communications with its nodes.

public int $timeout

Defaults to 30 seconds with a maximum of 120 seconds.

$virtualIps

Type of virtual IP to add along with the creation of a load balancer.

public array<string|int, mixed>|Collection $virtualIps = array()

$aliases

The aliases configure for the properties of the instance.

protected array<string|int, mixed> $aliases = array()

$associatedCollections

protected mixed $associatedCollections = array('certificateMappings' => 'CertificateMapping', 'nodes' => 'Node', 'virtualIps' => 'VirtualIp', 'accessList' => 'Access')

$associatedResources

protected mixed $associatedResources = array('certificateMapping' => 'CertificateMapping', 'node' => 'Node', 'virtualIp' => 'VirtualIp', 'connectionLogging' => 'ConnectionLogging', 'healthMonitor' => 'HealthMonitor', 'sessionPersistance' => 'SessionPersistance')

$createKeys

protected mixed $createKeys = array('name', 'port', 'protocol', 'virtualIps', 'nodes', 'accessList', 'algorithm', 'connectionLogging', 'connectionThrottle', 'healthMonitor', 'sessionPersistence', 'httpsRedirect')

$json_name

protected static mixed $json_name = 'loadBalancer'

$url_resource

protected static mixed $url_resource = 'loadbalancers'

$properties

Holds all the properties added by overloading.

private array<string|int, mixed> $properties = array()

Methods

__call()

Intercept non-existent method calls for dynamic getter/setter functionality.

public __call( $method,  $args) : mixed
Parameters
$method :
$args :
Tags
throws
RuntimeException
Return values
mixed

access()

Return an access resource

public access([mixed $data = null ]) : Access
Parameters
$data : mixed = null
Return values
Access

addCertificateMapping()

Creates a certificate mapping.

public addCertificateMapping(string $hostName, string $privateKey, string $certificate[, string $intermediateCertificate = null ]) : array<string|int, mixed>
Parameters
$hostName : string

The domain name for the certificate.

$privateKey : string

The private key for the certificate

$certificate : string

The certificate itself.

$intermediateCertificate : string = null

The intermediate certificate chain.

Tags
throws
MissingValueError
Return values
array<string|int, mixed>

An array of \Guzzle\Http\Message\Response objects.

addNode()

This method creates a Node object and adds it to a list of Nodes to be added to the LoadBalancer. This method will not add the nodes directly to the load balancer itself; it stores them in an array and the nodes are added later, in one of two ways:

public addNode(string $address, int $port[, bool $condition = NodeCondition::ENABLED ][, string $type = null ][, int $weight = null ]) : void
  • for a new load balancer, the nodes are added as part of the create() method call
  • for an existing load balancer, you must call the addNodes() method
Parameters
$address : string

the IP address of the node

$port : int

the port # of the node

$condition : bool = NodeCondition::ENABLED

the initial condition of the node

$type : string = null

either PRIMARY or SECONDARY

$weight : int = null

the node weight (for round-robin)

Tags
throws
InvalidArgumentException
Return values
void

addNodes()

Creates currently added nodes by sending them to the API

public addNodes() : array<string|int, mixed>
Tags
throws
MissingValueError
Return values
array<string|int, mixed>

of Response objects

addVirtualIp()

Adds a virtual IP to the load balancer. You can use the strings 'PUBLIC' or 'SERVICENET' to indicate the public or internal networks, or you can pass the `Id` of an existing IP address.

public addVirtualIp([mixed $type = IpType::PUBLIC_TYPE ][, int $ipVersion = null ]) : void
Parameters
$type : mixed = IpType::PUBLIC_TYPE
$ipVersion : int = null

either null, 4, or 6 (both, IPv4, or IPv6)

Return values
void

certificateMapping()

Returns a Certificate Mapping.

public certificateMapping([int|array<string|int, mixed> $id = null ]) : CertificateMapping
Parameters
$id : int|array<string|int, mixed> = null

(Optional) Either a particular Certificate mapping ID, or an array of data about the mapping. An array can include these keys: hostName, privateKey, certificate, intermediateCertificate.

Return values
CertificateMapping

checkJsonError()

Checks the most recent JSON operation for errors.

public static checkJsonError() : mixed
Tags
throws
JsonError
codeCoverageIgnore
Return values
mixed

connectionLogging()

public connectionLogging() : mixed
Tags
deprecated
Return values
mixed

contentCaching()

public contentCaching() : mixed
Tags
deprecated
Return values
mixed

create()

Create a new resource

public create([array<string|int, mixed> $params = array() ]) : Response
Parameters
$params : array<string|int, mixed> = array()
Return values
Response

createAccessList()

Creates an access list. You must provide an array of \stdClass objects, each of which contains `type' and `address' properties. Valid types for the former are: "DENY" or "ALLOW". The address must be a valid IP address, either v4 or v6.

public createAccessList(array<string|int, stdClass$list) : Response
Parameters
$list : array<string|int, stdClass>
Return values
Response

enableConnectionLogging()

Set the connection logging setting for this load balancer

public enableConnectionLogging( $bool) : Response
Parameters
$bool :

Set to TRUE to enable, FALSE to disable

Return values
Response

enableContentCaching()

Set the content caching setting for this load balancer

public enableContentCaching( $bool) : Response
Parameters
$bool :

Set to TRUE to enable, FALSE to disable

Return values
Response

Find a resource link based on a type

public findLink([string $type = 'self' ]) : bool
Parameters
$type : string = 'self'
Return values
bool

generateUuid()

public static generateUuid() : mixed
Return values
mixed

getInstance()

public static getInstance() : static
Return values
static

getParent()

public getParent() : mixed
Return values
mixed

getUrl()

Get this resource's URL

public getUrl([null $path = null ][, array<string|int, mixed> $query = array() ]) : mixed
Parameters
$path : null = null

URI path to add on

$query : array<string|int, mixed> = array()

Query to add on

Return values
mixed

hasConnectionLogging()

Find out whether connection logging is enabled for this load balancer

public hasConnectionLogging() : bool
Return values
bool

Returns TRUE if enabled, FALSE if not

hasContentCaching()

Find out whether content caching is enabled for this load balancer

public hasContentCaching() : bool
Return values
bool

Returns TRUE if enabled, FALSE if not

hasLogger()

public hasLogger() : bool
Return values
bool

jsonCollectionElement()

Returns the nested keys that could (rarely) prefix collection items. For example:

public static jsonCollectionElement() : string

{ "keypairs": [ { "keypair": { "fingerprint": "...", "name": "key1", "public_key": "..." } }, { "keypair": { "fingerprint": "...", "name": "key2", "public_key": "..." } } ] }

In the above example, "keypairs" would be the $json_collection_name and "keypair" would be the $json_collection_element

Return values
string

jsonCollectionName()

Returns the top-level key for collection responses

public static jsonCollectionName() : string
Return values
string

jsonName()

Returns the top-level key for the returned response JSON document

public static jsonName() : mixed
Tags
throws
DocumentError
Return values
mixed

makeResourceIteratorOptions()

public makeResourceIteratorOptions(mixed $resource) : mixed
Parameters
$resource : mixed
Return values
mixed

metadata()

Return a metadata item

public metadata([mixed $data = null ]) : Metadata
Parameters
$data : mixed = null
Return values
Metadata

node()

Returns a Node

public node([mixed $id = null ]) : Node
Parameters
$id : mixed = null
Return values
Node

parseResponse()

Parse a HTTP response for the required content

public parseResponse(Response $response) : mixed
Parameters
$response : Response
Return values
mixed

populate()

Populates the current object based on an unknown data type.

public populate(mixed $info[, mixed $setObjects = true ]) : mixed
Parameters
$info : mixed
$setObjects : mixed = true
Tags
throws
InvalidArgumentError
Return values
mixed

refreshFromLocationUrl()

Given a `location` URL, refresh this resource

public refreshFromLocationUrl( $url) : mixed
Parameters
$url :
Return values
mixed

removeCertificateMapping()

Remove a certificate mapping.

public removeCertificateMapping(int $id) : Response
Parameters
$id : int

ID of the certificate mapping.

Return values
Response

removeNode()

Remove a node from this load-balancer

public removeNode(mixed $nodeId) : Response
Parameters
$nodeId : mixed
Return values
Response

resourceName()

Returns the URI path for this resource

public static resourceName() : mixed
Tags
throws
UrlError
Return values
mixed

setMetadata()

public setMetadata(mixed $data) : $this
Parameters
$data : mixed
Return values
$this

stripNamespace()

public stripNamespace(mixed $namespace) : mixed
Parameters
$namespace : mixed
Return values
mixed

toCamel()

Convert a string to camelCase format.

public toCamel( $string[, bool $capitalise = true ]) : mixed
Parameters
$string :
$capitalise : bool = true

Optional flag which allows for word capitalization.

Return values
mixed

toUnderscores()

Convert string to underscore format.

public toUnderscores( $string) : mixed
Parameters
$string :
Return values
mixed

update()

Update a resource

public update([array<string|int, mixed> $params = array() ]) : Response
Parameters
$params : array<string|int, mixed> = array()
Return values
Response

updateCertificateMapping()

Updates a certificate mapping.

public updateCertificateMapping(int $id[, string $hostName = null ][, string $privateKey = null ][, string $certificate = null ][, string $intermediateCertificate = null ]) : array<string|int, mixed>
Parameters
$id : int

ID of the certificate mapping.

$hostName : string = null

(Optional) The domain name of the certificate.

$privateKey : string = null

(Optional) The private key for the certificate.

$certificate : string = null

The certificate itself.

$intermediateCertificate : string = null

The intermediate certificate chain.

Return values
array<string|int, mixed>

An array of \Guzzle\Http\Message\Response objects.

url()

public url([mixed $path = null ][, array<string|int, mixed> $query = array() ]) : mixed
Parameters
$path : mixed = null
$query : array<string|int, mixed> = array()
Tags
deprecated
Return values
mixed

virtualIp()

Returns a single Virtual IP (not called publicly)

public virtualIp([mixed $data = null ]) : VirtualIp
Parameters
$data : mixed = null
Return values
VirtualIp

waitFor()

A method to repeatedly poll the API resource, waiting for an eventual state change

public waitFor([null $state = null ][, null $timeout = null ][, null $callback = null ][, null $interval = null ]) : mixed
Parameters
$state : null = null

The expected state of the resource

$timeout : null = null

The maximum timeout to wait

$callback : null = null

The callback to use to check the state

$interval : null = null

How long between each refresh request

Return values
mixed

createJson()

Provides JSON for create request body

protected createJson() : object
Return values
object

generateJsonPatch()

Generates a JSON Patch representation and return its

protected generateJsonPatch(mixed $updatedProperties) : string
Parameters
$updatedProperties : mixed

Properties of the resource to update

Return values
string

JSON Patch representation for updates

getAlias()

Returns the alias configured for the given key. If no alias exists it returns the original key.

protected getAlias(string $key) : string
Parameters
$key : string
Return values
string

getJsonHeader()

protected static getJsonHeader() : mixed
Return values
mixed

getPatchHeaders()

protected static getPatchHeaders() : mixed
Return values
mixed

getProperty()

Grab value out of the data array.

protected getProperty(string $property) : mixed
Parameters
$property : string
Return values
mixed

getUpdateablePropertiesAsArray()

Returns the object's properties as an array

protected getUpdateablePropertiesAsArray() : mixed
Return values
mixed

primaryKeyField()

Returns the primary key field for the object

protected primaryKeyField() : string
Return values
string

propertyExists()

Basic check to see whether property exists.

protected propertyExists(string $property[, bool $allowRetry = true ]) : bool
Parameters
$property : string

The property name being investigated.

$allowRetry : bool = true

If set to TRUE, the check will try to format the name in underscores because there are sometimes discrepancies between camelCaseNames and underscore_names.

Return values
bool

recursivelyAliasPropertyValue()

Returns the given property value's alias, if configured; Else, the unchanged property value is returned. If the given property value is an array or an instance of \stdClass, it is aliases recursively.

protected recursivelyAliasPropertyValue(mixed $propertyValue) : mixed
Parameters
$propertyValue : mixed

Array or \stdClass instance to alias

Return values
mixed

Property value, aliased recursively

refreshFromParent()

Causes resource to refresh based on parent's URL

protected refreshFromParent() : mixed
Return values
mixed

setProperty()

We can set a property under three conditions:

protected setProperty(mixed $property, mixed $value) : mixed
  1. If it has a concrete setter: setProperty()
  2. If the property exists
  3. If the property name's prefix is in an approved list
Parameters
$property : mixed
$value : mixed
Return values
mixed

updateJson()

Provides JSON for update request body

protected updateJson([mixed $params = array() ]) : mixed
Parameters
$params : mixed = array()
Return values
mixed

checkAttributePrefix()

Checks the attribute $property and only permits it if the prefix is in the specified $prefixes array

private checkAttributePrefix(string $property) : bool

This is to support extension namespaces in some services.

Parameters
$property : string

the name of the attribute

Return values
bool

isAccessible()

Does the property exist in the object variable list (i.e. does it have public or protected visibility?)

private isAccessible( $property) : bool
Parameters
$property :
Return values
bool

Search results