libcloud.loadbalancer package¶
Subpackages¶
- libcloud.loadbalancer.drivers package
- Submodules
- libcloud.loadbalancer.drivers.alb module
- libcloud.loadbalancer.drivers.brightbox module
- libcloud.loadbalancer.drivers.cloudstack module
- libcloud.loadbalancer.drivers.dimensiondata module
- libcloud.loadbalancer.drivers.elb module
- libcloud.loadbalancer.drivers.gce module
- libcloud.loadbalancer.drivers.gogrid module
- libcloud.loadbalancer.drivers.ninefold module
- libcloud.loadbalancer.drivers.nttcis module
- libcloud.loadbalancer.drivers.rackspace module
- libcloud.loadbalancer.drivers.slb module
- libcloud.loadbalancer.drivers.softlayer module
- Module contents
Submodules¶
libcloud.loadbalancer.base module¶
-
class
libcloud.loadbalancer.base.
Member
(id, ip, port, balancer=None, extra=None)[source]¶ Bases:
object
Represents a load balancer member.
Parameters: - id (
str
) – Member ID. - ip – IP address of this member.
- ip –
str
- port – Port of this member
- port –
str
- balancer – Balancer this member is attached to. (optional)
- balancer –
LoadBalancer
- extra (
dict
) – Provider specific attributes.
- id (
-
class
libcloud.loadbalancer.base.
LoadBalancer
(id, name, state, ip, port, driver, extra=None)[source]¶ Bases:
object
Provide a common interface for handling Load Balancers.
Parameters: - id (
str
) – Load balancer ID. - name (
str
) – Load balancer name. - state (
libcloud.loadbalancer.types.State
) – State this loadbalancer is in. - ip (
str
) – IP address of this loadbalancer. - port (
int
) – Port of this loadbalancer. - driver (
Driver
) – Driver this loadbalancer belongs to. - extra (
dict
) – Provider specific attributes. (optional)
- id (
-
class
libcloud.loadbalancer.base.
Algorithm
[source]¶ Bases:
object
Represents a load balancing algorithm.
-
LEAST_CONNECTIONS
= 2¶
-
LEAST_CONNECTIONS_MEMBER
= 7¶
-
LEAST_CONNECTIONS_NODE
= 8¶
-
OBSERVED_MEMBER
= 9¶
-
OBSERVED_NODE
= 10¶
-
PERSISTENT_IP
= 6¶
-
PREDICTIVE_MEMBER
= 11¶
-
PREDICTIVE_NODE
= 12¶
-
RANDOM
= 0¶
-
ROUND_ROBIN
= 1¶
-
SHORTEST_RESPONSE
= 5¶
-
WEIGHTED_LEAST_CONNECTIONS
= 4¶
-
WEIGHTED_ROUND_ROBIN
= 3¶
-
-
class
libcloud.loadbalancer.base.
Driver
(key, secret=None, secure=True, host=None, port=None, **kwargs)[source]¶ Bases:
libcloud.common.base.BaseDriver
A base Driver class to derive from
This class is always subclassed by a specific driver.
-
balancer_attach_compute_node
(balancer, node)[source]¶ Attach a compute node as a member to the load balancer.
Parameters: - balancer (
LoadBalancer
) – LoadBalancer which should be used - node (
Node
) – Node to join to the balancer
Returns: Member after joining the balancer.
Return type: - balancer (
-
balancer_attach_member
(balancer, member)[source]¶ Attach a member to balancer
Parameters: - balancer (
LoadBalancer
) – LoadBalancer which should be used - member (
Member
) – Member to join to the balancer
Returns: Member after joining the balancer.
Return type: - balancer (
-
balancer_detach_member
(balancer, member)[source]¶ Detach member from balancer
Parameters: - balancer (
LoadBalancer
) – LoadBalancer which should be used - member (
Member
) – Member which should be used
Returns: True
if member detach was successful, otherwiseFalse
.Return type: bool
- balancer (
-
balancer_list_members
(balancer)[source]¶ Return list of members attached to balancer
Parameters: balancer ( LoadBalancer
) – LoadBalancer which should be usedReturn type: list
ofMember
-
connectionCls
¶ alias of
libcloud.common.base.ConnectionKey
-
create_balancer
(name, port, protocol, algorithm, members)[source]¶ Create a new load balancer instance
Parameters: - name (
str
) – Name of the new load balancer (required) - port (
str
) – Port the load balancer should listen on, defaults to 80 - protocol (
str
) – Loadbalancer protocol, defaults to http. - members (
list
ofMember
) – list of Members to attach to balancer - algorithm (
Algorithm
) – Load balancing algorithm, defaults to ROUND_ROBIN.
Return type: - name (
-
destroy_balancer
(balancer)[source]¶ Destroy a load balancer
Parameters: balancer ( LoadBalancer
) – LoadBalancer which should be usedReturns: True
if the destroy was successful, otherwiseFalse
.Return type: bool
-
get_balancer
(balancer_id)[source]¶ Return a
LoadBalancer
object.Parameters: balancer_id ( str
) – id of a load balancer you want to fetchReturn type: LoadBalancer
-
list_balancers
()[source]¶ List all loadbalancers
Return type: list
ofLoadBalancer
-
list_supported_algorithms
()[source]¶ Return algorithms supported by this driver.
Return type: list
ofstr
-
name
= None¶
-
update_balancer
(balancer, **kwargs)[source]¶ Sets the name, algorithm, protocol, or port on a load balancer.
Parameters: - balancer (
LoadBalancer
) – LoadBalancer which should be used - name (
str
) – New load balancer name - algorithm (
Algorithm
) – New load balancer algorithm - protocol (
str
) – New load balancer protocol - port (
int
) – New load balancer port
Return type: - balancer (
-
website
= None¶
-
libcloud.loadbalancer.providers module¶
-
class
libcloud.loadbalancer.providers.
Provider
[source]¶ Bases:
object
Defines for each of the supported providers
Non-Dummy drivers are sorted in alphabetical order. Please preserve this ordering when adding new drivers.
Variables: ALIYUN_SLB – Aliyun SLB loadbalancer driver -
ALB
= 'alb'¶
-
ALIYUN_SLB
= 'aliyun_slb'¶
-
BRIGHTBOX
= 'brightbox'¶
-
CLOUDSTACK
= 'cloudstack'¶
-
DIMENSIONDATA
= 'dimensiondata'¶
-
ELB
= 'elb'¶
-
GCE
= 'gce'¶
-
GOGRID
= 'gogrid'¶
-
NINEFOLD
= 'ninefold'¶
-
NTTCIS
= 'nttcis'¶
-
RACKSPACE
= 'rackspace'¶
-
RACKSPACE_UK
= 'rackspace_uk'¶
-
RACKSPACE_US
= 'rackspace_us'¶
-
SOFTLAYER
= 'softlayer'¶
-
libcloud.loadbalancer.types module¶
-
class
libcloud.loadbalancer.types.
Provider
[source]¶ Bases:
object
Defines for each of the supported providers
Non-Dummy drivers are sorted in alphabetical order. Please preserve this ordering when adding new drivers.
Variables: ALIYUN_SLB – Aliyun SLB loadbalancer driver -
ALB
= 'alb'¶
-
ALIYUN_SLB
= 'aliyun_slb'¶
-
BRIGHTBOX
= 'brightbox'¶
-
CLOUDSTACK
= 'cloudstack'¶
-
DIMENSIONDATA
= 'dimensiondata'¶
-
ELB
= 'elb'¶
-
GCE
= 'gce'¶
-
GOGRID
= 'gogrid'¶
-
NINEFOLD
= 'ninefold'¶
-
NTTCIS
= 'nttcis'¶
-
RACKSPACE
= 'rackspace'¶
-
RACKSPACE_UK
= 'rackspace_uk'¶
-
RACKSPACE_US
= 'rackspace_us'¶
-
SOFTLAYER
= 'softlayer'¶
-
-
class
libcloud.loadbalancer.types.
State
[source]¶ Bases:
object
Standard states for a loadbalancer
Variables: - RUNNING – loadbalancer is running and ready to use
- UNKNOWN – loabalancer state is unknown
-
DELETED
= 4¶
-
ERROR
= 3¶
-
PENDING
= 1¶
-
RUNNING
= 0¶
-
UNKNOWN
= 2¶
Module contents¶
Module for working with Load Balancers