# Class LoadBalancer

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.

  OpenCloud\Common\Base
  OpenCloud\Common\Resource\BaseResource
  OpenCloud\Common\Resource\PersistentResource
  OpenCloud\LoadBalancer\Resource\LoadBalancer implements OpenCloud\DNS\Resource\HasPtrRecordsInterface

Namespace: OpenCloud\LoadBalancer\Resource
Located at OpenCloud/LoadBalancer/Resource/LoadBalancer.php

Methods summary
`public` | # `addNode( string $address, integer $port, boolean $condition = OpenCloud\LoadBalancer\Resource\NodeCondition::ENABLED, string $type = null, integer $weight = null )` 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: 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: 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` $address the IP address of the node $port `integer` $port the port # of the node $condition `boolean` $condition the initial condition of the node $type `string` $type either PRIMARY or SECONDARY $weight `integer` $weight the node weight (for round-robin) #### Throws ``InvalidArgumentException``
`public array` | # `addNodes( )` Creates currently added nodes by sending them to the API Creates currently added nodes by sending them to the API #### Returns `array` of \Guzzle\Http\Message\Response objects #### Throws ``OpenCloud\Common\Exceptions\MissingValueError``
`public Guzzle\Http\Message\Response` | # `removeNode( integer $nodeId )` Remove a node from this load-balancer Remove a node from this load-balancer #### Parameters $nodeId `integer` $id id of the node #### Returns `Guzzle\Http\Message\Response`
`public` | # `addVirtualIp( string $type = OpenCloud\LoadBalancer\Resource\IpType::PUBLIC_TYPE, integer $ipVersion = null )` 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. 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. #### Parameters $type `string` $id either 'public' or 'servicenet' or an ID of an existing IP address $ipVersion `integer` $ipVersion either null, 4, or 6 (both, IPv4, or IPv6)
`public `OpenCloud\LoadBalancer\Resource\Node`` | # `node( mixed $id = null )` Returns a Node Returns a Node #### Returns ``OpenCloud\LoadBalancer\Resource\Node``
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `nodeList( )` returns a Collection of Nodes returns a Collection of Nodes #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`public `OpenCloud\LoadBalancer\Resource\NodeEvent`` | # `nodeEvent( )` Returns a NodeEvent object Returns a NodeEvent object #### Returns ``OpenCloud\LoadBalancer\Resource\NodeEvent``
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `nodeEventList( )` Returns a Collection of NodeEvents Returns a Collection of NodeEvents #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`public `OpenCloud\LoadBalancer\Resource\VirtualIp`` | # `virtualIp( mixed $data = null )` Returns a single Virtual IP (not called publicly) Returns a single Virtual IP (not called publicly) #### Returns ``OpenCloud\LoadBalancer\Resource\VirtualIp``
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `virtualIpList( )` #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`public `OpenCloud\LoadBalancer\Resource\SessionPersistence`` | # `sessionPersistence( )` Return the session persistence resource Return the session persistence resource #### Returns ``OpenCloud\LoadBalancer\Resource\SessionPersistence``
`public `OpenCloud\LoadBalancer\Resource\ErrorPage`` | # `errorPage( )` Returns the load balancer's error page object Returns the load balancer's error page object #### Returns ``OpenCloud\LoadBalancer\Resource\ErrorPage``
`public `OpenCloud\LoadBalancer\Resource\HealthMonitor`` | # `healthMonitor( )` Returns the load balancer's health monitor object Returns the load balancer's health monitor object #### Returns ``OpenCloud\LoadBalancer\Resource\HealthMonitor``
`public `OpenCloud\LoadBalancer\Resource\Stats`` | # `stats( )` Returns statistics on the load balancer operation Returns statistics on the load balancer operation #### Returns ``OpenCloud\LoadBalancer\Resource\Stats``
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `usage( )` #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`public `OpenCloud\LoadBalancer\Resource\Access`` | # `access( mixed $data = null )` Return an access resource Return an access resource #### Returns ``OpenCloud\LoadBalancer\Resource\Access``
`public Guzzle\Http\Message\Response` | # `createAccessList( array $list )` 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. 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. #### Parameters $list ``stdClass[]`` $list #### Returns `Guzzle\Http\Message\Response`
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `accessList( )` #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`public `OpenCloud\LoadBalancer\Resource\ConnectionThrottle`` | # `connectionThrottle( )` Return a connection throttle resource Return a connection throttle resource #### Returns ``OpenCloud\LoadBalancer\Resource\ConnectionThrottle``
`public boolean` | # `hasConnectionLogging( )` Find out whether connection logging is enabled for this load balancer Find out whether connection logging is enabled for this load balancer #### Returns `boolean` Returns TRUE if enabled, FALSE if not
`public Guzzle\Http\Message\Response` | # `enableConnectionLogging( mixed $bool )` Set the connection logging setting for this load balancer Set the connection logging setting for this load balancer #### Parameters $bool `mixed` $bool Set to TRUE to enable, FALSE to disable #### Returns `Guzzle\Http\Message\Response`
`public boolean` | # `hasContentCaching( )` Find out whether content caching is enabled for this load balancer Find out whether content caching is enabled for this load balancer #### Returns `boolean` Returns TRUE if enabled, FALSE if not
`public Guzzle\Http\Message\Response` | # `enableContentCaching( mixed $bool )` Set the content caching setting for this load balancer Set the content caching setting for this load balancer #### Parameters $bool `mixed` $bool Set to TRUE to enable, FALSE to disable #### Returns `Guzzle\Http\Message\Response`
`public `OpenCloud\LoadBalancer\Resource\SSLTermination`` | # `SSLTermination( )` Return a SSL Termination resource Return a SSL Termination resource #### Returns ``OpenCloud\LoadBalancer\Resource\SSLTermination``
`public `OpenCloud\LoadBalancer\Resource\Metadata`` | # `metadata( mixed $data = null )` Return a metadata item Return a metadata item #### Returns ``OpenCloud\LoadBalancer\Resource\Metadata``
`public `OpenCloud\Common\Collection\PaginatedIterator`` | # `metadataList( )` Return a collection of metadata items Return a collection of metadata items #### Returns ``OpenCloud\Common\Collection\PaginatedIterator``
`protected object` | # `createJson( )` Provides JSON for create request body Provides JSON for create request body #### Returns `object` #### Throws ``RuntimeException`` #### Overrides `OpenCloud\Common\Resource\PersistentResource::createJson()`
`protected` | # `updateJson( mixed $params = array() )` Provides JSON for update request body Provides JSON for update request body #### Overrides `OpenCloud\Common\Resource\PersistentResource::updateJson()`

Methods inherited from OpenCloud\Common\Resource\PersistentResource
`checkExtension(), create(), delete(), getAlias(), noCreate(), noDelete(), noUpdate(), refresh(), refreshFromLocationUrl(), update(), waitFor()`

Methods inherited from OpenCloud\Common\Resource\BaseResource
`__construct(), findLink(), getClient(), getMetadata(), getParent(), getService(), getUrl(), jsonCollectionElement(), jsonCollectionName(), jsonName(), parseResponse(), primaryKeyField(), resourceName(), setMetadata(), setParent(), setService()`

Methods inherited from OpenCloud\Common\Base
`__call(), checkJsonError(), generateUuid(), getInstance(), getJsonHeader(), getLogger(), getProperty(), makeResourceIteratorOptions(), populate(), propertyExists(), setLogger(), setProperty(), stripNamespace(), toCamel(), toUnderscores()`

Properties summary
`public mixed` | $id | `` | #
`public string` | $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. 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` | $port | `` | # Port of the service which is being load balanced. Port of the service which is being load balanced.
`public string` | $protocol | `` | # Protocol of the service which is being load balanced. Protocol of the service which is being load balanced.
`public array|Collection` | $virtualIps | `array()` | # Type of virtual IP to add along with the creation of a load balancer. Type of virtual IP to add along with the creation of a load balancer.
`public array|Collection` | $nodes | `array()` | # Nodes to be added to the load balancer. Nodes to be added to the load balancer.
`public Collection` | $accessList | `` | # The access list management feature allows fine-grained network access controls to be applied to the load balancer's virtual IP address. The access list management feature allows fine-grained network access controls to be applied to the load balancer's virtual IP address.
`public `OpenCloud\LoadBalancer\Resource\Algorithm`` | $algorithm | `` | # Algorithm that defines how traffic should be directed between back-end nodes. Algorithm that defines how traffic should be directed between back-end nodes.
`public `OpenCloud\LoadBalancer\Resource\ConnectionLogging`` | $connectionLogging | `` | # Current connection logging configuration. Current connection logging configuration.
`public `OpenCloud\LoadBalancer\Resource\ConnectionThrottle`` | $connectionThrottle | `` | # Specifies limits on the number of connections per IP address to help mitigate malicious or abusive traffic to your applications. Specifies limits on the number of connections per IP address to help mitigate malicious or abusive traffic to your applications.
`public `OpenCloud\LoadBalancer\Resource\HealthMonitor`` | $healthMonitor | `` | # The type of health monitor check to perform to ensure that the service is performing properly. The type of health monitor check to perform to ensure that the service is performing properly.
`public SessionPersistance` | $sessionPersistence | `` | # Forces multiple requests, of the same protocol, from clients to be directed to the same node. Forces multiple requests, of the same protocol, from clients to be directed to the same node.
`public array|`OpenCloud\LoadBalancer\Resource\Metadata`` | $metadata | `array()` | # Information (metadata) that can be associated with each load balancer for the client's personal use. Information (metadata) that can be associated with each load balancer for the client's personal use.
`public integer` | $timeout | `` | # The timeout value for the load balancer and communications with its nodes. Defaults to 30 seconds with a maximum of 120 seconds. The timeout value for the load balancer and communications with its nodes. Defaults to 30 seconds with a maximum of 120 seconds.
`public mixed` | $created | `` | #
`public mixed` | $updated | `` | #
`public mixed` | $status | `` | #
`public mixed` | $nodeCount | `` | #
`public mixed` | $sourceAddresses | `` | #
`public mixed` | $cluster | `` | #
`protected static string` | $json_name | `'loadBalancer'` | #
`protected static string` | $url_resource | `'loadbalancers'` | #
`protected array` | $associatedResources | `array( 'node' => 'Node', 'virtualIp' => 'VirtualIp', 'connectionLogging' => 'ConnectionLogging', 'healthMonitor' => 'HealthMonitor', 'sessionPersistance' => 'SessionPersistance' )` | #
`protected array` | $associatedCollections | `array( 'nodes' => 'Node', 'virtualIps' => 'VirtualIp', 'accessList' => 'Access' )` | #
`protected array` | $createKeys | `array( 'name', 'port', 'protocol', 'virtualIps', 'nodes', 'accessList', 'algorithm', 'connectionLogging', 'connectionThrottle', 'healthMonitor', 'sessionPersistence' )` | #

Properties inherited from OpenCloud\Common\Resource\BaseResource
`$parent, $service`

Properties inherited from OpenCloud\Common\Base
`$aliases`