libcloud.loadbalancer.drivers.elb module
- class libcloud.loadbalancer.drivers.elb.ElasticLBDriver(access_id, secret, region, token=None)[source]
Bases:
Driver
- Parameters:
key (
str
) – API key or username to be used (required)secret (
str
) – Secret password to be used (required)secure (
bool
) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.host (
str
) – Override hostname used for connections.port (
int
) – Override port used for connections.api_version (
str
) – Optional API version. Only used by drivers which support multiple API versions.region (
str
) – Optional driver region. Only used by drivers which support multiple regions.
- Return type:
None
- 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 usednode (
Node
) – Node to join to the balancer
- Returns:
Member after joining the balancer.
- Return type:
Member
- balancer_detach_member(balancer, member)[source]
Detach member from balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member which should be used
- Returns:
True
if member detach was successful, otherwiseFalse
.- Return type:
bool
- balancer_list_members(balancer)[source]
Return list of members attached to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Return type:
list
ofMember
- connectionCls
alias of
ELBConnection
- create_balancer(name, port, protocol, algorithm, members, ex_members_availability_zones=None)[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 80protocol (
str
) – Loadbalancer protocol, defaults to http.members (
list
ofMember
) – list of Members to attach to balanceralgorithm (
Algorithm
) – Load balancing algorithm, defaults to ROUND_ROBIN.
- Return type:
LoadBalancer
- destroy_balancer(balancer)[source]
Destroy a load balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Returns:
True
if the destroy was successful, otherwiseFalse
.- Return type:
bool
- ex_create_balancer_listeners(name, listeners=None)[source]
Creates one or more listeners on a load balancer for the specified port
- Parameters:
name (
str
) – The mnemonic name associated with the load balancerlisteners (``list of tuple`) – Each tuple contain values, (LoadBalancerPortNumber, InstancePortNumber, Protocol,[SSLCertificateId])
- ex_create_balancer_policy(name, policy_name, policy_type, policy_attributes=None)[source]
Create a new load balancer policy
- Parameters:
name (
str
) – Balancer name to create the policy forpolicy_name (
str
) – policy to be createdpolicy_type (
str
) – policy type being used to create policy.policy_attributes (
PolicyAttribute list
) – Each list contain values, [‘AttributeName’, ‘value’]
- ex_delete_balancer_policy(name, policy_name)[source]
Delete a load balancer policy
- Parameters:
name (
str
) – balancer name for which policy will be deletedpolicy_name (
str
) – The Mnemonic name for the policy being deleted
- ex_list_balancer_policies(balancer)[source]
Return a list of policy description string.
- Return type:
list
ofstr
- ex_list_balancer_policy_types()[source]
Return a list of policy type description string.
- Return type:
list
ofstr
- ex_set_balancer_policies_backend_server(name, instance_port, policies)[source]
Replaces the current set of policies associated with a port on which the back-end server is listening with a new set of policies
- Parameters:
name (
str
) – balancer name to set policies of backend serverinstance_port (
int
) – Instance Portpolicies (``string list`) – List of policies to be associated with the balancer
- ex_set_balancer_policies_listener(name, port, policies)[source]
Associates, updates, or disables a policy with a listener on the load balancer
- Parameters:
name (
str
) – balancer name to set policies for listernerport (
str
) – port to usepolicies (
string list
) – List of policies to be associated with the balancer
- get_balancer(balancer_id, ex_fetch_tags=False)[source]
Return a
LoadBalancer
object.- Parameters:
balancer_id (
str
) – id of a load balancer you want to fetch- Return type:
LoadBalancer
- list_balancers(ex_fetch_tags=False)[source]
List all loadbalancers
- Return type:
list
ofLoadBalancer
- name = 'Amazon Elastic Load Balancing'
- signature_version = '4'
- website = 'http://aws.amazon.com/elasticloadbalancing/'