libcloud.loadbalancer.drivers package¶
Submodules¶
libcloud.loadbalancer.drivers.alb module¶
- class libcloud.loadbalancer.drivers.alb.ApplicationLBDriver(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
- connectionCls¶
alias of
ALBConnection
- create_balancer(name, port, protocol, algorithm, members, ex_scheme=None, ex_security_groups=None, ex_subnets=None, ex_tags=None, ex_ssl_cert_arn=None)[source]¶
Create a new load balancer instance.
AWS ALB balancer creation consists of 5 steps: http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/Welcome.html
create_balancer() is a standard API method so, it’s made as a wrapper here to preserve compatibility with other drivers where LB creation is one-step process. It calls respective ALB methods to assemble ready-to-use load balancer.
- Parameters:
name (
str
) – Name of the new load balancerport (
int
) – Port number to setup load balancer listenerprotocol (
str
) – Load balancer protocol, should be ‘HTTP’ or ‘HTTPS’.algorithm (
Algorithm
orNone
) – Load balancing algorithm. Ignored for AWS ALB.members (
list
ofMember
) – List of Members to attach to the balancer. If ‘port’ attribute is set for the memeber - load balancer will send traffic there. Otherwise - load balancer port is used on the memeber’s side. ‘ip’ attribute is ignored.ex_scheme (
str
) – Scheme of load balancer. Can be ‘internet-facing’ or ‘internal’.ex_security_groups (
list
ofstr
) – List of load balancer security group ids.ex_subnets (
list
ofstr
) – List of load balancer subnet ids.ex_tags (
dict
) – Tags to assign to the load balancer.ex_ssl_cert_arn (
str
) – SSL certificate ARN to use when load balancer protocol is ‘HTTPS’.
- Returns:
LoadBalancer object
- Return type:
LoadBalancer
- ex_create_balancer(name, addr_type='ipv4', scheme='internet-facing', security_groups=None, subnets=None, tags=None)[source]¶
AWS-specific method to create a new load balancer. Since ALB is a composite object (load balancer, target group, listener etc) - extra methods must be called to assemble ready-to-use balancer.
- Parameters:
name (
str
) – Name of the new load balanceraddr_type (
str
) – Load balancer address type. Can be ‘ipv4’ or ‘ipv6’.scheme (
str
) – Scheme of load balancer. Can be ‘internet-facing’ or ‘internal’.security_groups (
list
ofstr
) – List of load balancer security group ids.subnets (
list
ofstr
) – List of load balancer subnet ids.tags (
dict
) – Tags to assign to the load balancer.
- Returns:
LoadBalancer object
- Return type:
LoadBalancer
- ex_create_listener(balancer, port, proto, target_group, action='forward', ssl_cert_arn=None, ssl_policy=None)[source]¶
Create a listener for application load balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer to create listener forport (
int
) – Port number to setup load balancer listenerproto (
str
) – Load balancer protocol, should be ‘HTTP’ or ‘HTTPS’.target_group (
ALBTargetGroup
) – Target group associated with the listener.action (
str
) – Default action for the listener, valid value is ‘forward’ssl_cert_arn (
str
) – SSL certificate ARN to use when listener protocol is ‘HTTPS’.ssl_policy (
str
) – The security policy that defines which ciphers and protocols are supported. The default is the current predefined security policy. Example: ‘ELBSecurityPolicy-2016-08’
- Returns:
Listener object
- Return type:
ALBListener
- ex_create_listener_rule(listener, priority, target_group, action='forward', condition_field=None, condition_value=None)[source]¶
Create a rule for listener.
- Parameters:
listener (
ALBListener
) – Listener object where to create rulepriority (
str
) – The priority for the rule. A listener can’t have multiple rules with the same priority.target_group (
ALBTargetGroup
) – Target group object to associate with ruleaction (
str
) – Action for the rule, valid value is ‘forward’condition_field (
str
) – Rule condition field name. The possible values are ‘host-header’ and ‘path-pattern’.condition_value – Value to match. Wildcards are supported, for example: ‘/img/*’
- Returns:
Rule object
- Return type:
ALBRule
- ex_create_target_group(name, port, proto, vpc, health_check_interval=30, health_check_path='/', health_check_port='traffic-port', health_check_proto='HTTP', health_check_timeout=5, health_check_matcher='200', healthy_threshold=5, unhealthy_threshold=2)[source]¶
Create a target group for AWS ALB load balancer.
- Parameters:
name (
str
) – Name of target groupport (
int
) – The port on which the targets receive traffic. This port is used unless you specify a port override when registering the target.proto (
str
) – The protocol to use for routing traffic to the targets. Can be ‘HTTP’ or ‘HTTPS’.vpc (
str
) – The identifier of the virtual private cloud (VPC).health_check_interval (
int
) – The approximate amount of time, in seconds, between health checks of an individual target. The default is 30 seconds.health_check_path (
str
) – The ping path that is the destination on the targets for health checks. The default is /health_check_port (
str
) – The port the load balancer uses when performing health checks on targets. The default is traffic-port, which indicates the port on which each target receives traffic from the load balancer.health_check_proto (
str
) – The protocol the load balancer uses when performing health checks on targets. Can be ‘HTTP’ (default) or ‘HTTPS’.health_check_timeout (
int
) – The amount of time, in seconds, during which no response from a target means a failed health check. The default is 5s.health_check_matcher (
str
) – The HTTP codes to use when checking for a successful response from a target. Valid values: “200”, “200,202”, “200-299”.healthy_threshold (
int
) – The number of consecutive health checks successes required before considering an unhealthy target healthy. The default is 5unhealthy_threshold (
int
) – The number of consecutive health check failures required before considering a target unhealthy. The default is 2.
- Returns:
Target group object.
- Return type:
ALBTargetGroup
- ex_get_listener(listener_id)[source]¶
Get listener object by ARN
- Parameters:
listener_id (
str
) – ARN of listener object to get- Returns:
Listener object
- Return type:
ALBListener
- ex_get_rule(rule_id)[source]¶
Get rule by ARN.
- Parameters:
rule_id (
str
) – ARN of rule- Returns:
Rule object
- Return type:
ALBRule
- ex_get_target_group(target_group_id)[source]¶
Get target group object by ARN
- Parameters:
target_group_id (
str
) – ARN of target group- Returns:
Target group object
- Return type:
ALBTargetGroup
- ex_register_targets(target_group, members=None)[source]¶
Register members as targets at target group
- Parameters:
target_group (
dict
) – Target group dict where register members.members (
list
ofMember
) – List of Members to attach to the balancer. If ‘port’ attribute is set for the memeber - load balancer will send traffic there. Otherwise - load balancer port is used on the memeber’s side. ‘ip’ attribute is ignored.
- Returns:
True on success, False if no members provided.
- Return type:
bool
- get_balancer(balancer_id)[source]¶
Get a load balancer object by ARN
- Parameters:
balancer_id (
str
) – ARN of load balancer you wish to fetch.- Return type:
LoadBalancer
- name = 'Amazon Application Load Balancing'¶
- signature_version = '4'¶
- website = 'http://aws.amazon.com/elasticloadbalancing/'¶
libcloud.loadbalancer.drivers.brightbox module¶
- class libcloud.loadbalancer.drivers.brightbox.BrightboxLBDriver(key, secret=None, secure=True, host=None, port=None, **kwargs)[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
- LB_STATE_MAP = {'active': 0, 'creating': 1, 'deleted': 2, 'deleting': 2, 'failed': 2, 'failing': 2}¶
- 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_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member 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
BrightboxConnection
- 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 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
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters:
balancer_id (
str
) – id of a load balancer you want to fetch- Return type:
LoadBalancer
- name = 'Brightbox'¶
- website = 'http://www.brightbox.co.uk/'¶
libcloud.loadbalancer.drivers.cloudstack module¶
- class libcloud.loadbalancer.drivers.cloudstack.CloudStackLBDriver(key, secret=None, secure=True, host=None, path=None, port=None, *args, **kwargs)[source]¶
Bases:
CloudStackDriverMixIn
,Driver
Driver for CloudStack load balancers.
@inherits:
Driver.__init__
- LB_STATE_MAP = {'Active': 0}¶
- api_name = 'cloudstack_lb'¶
- balancer_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member 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
- create_balancer(name, members, protocol='http', port=80, algorithm=1, location=None, private_port=None, network_id=None, vpc_id=None)[source]¶
@inherits:
Driver.create_balancer
- Parameters:
location (
NodeLocation
) – Locationprivate_port (
int
) – Private portnetwork_id (
str
) – The guest network this rule will be created for.
- 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
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters:
balancer_id (
str
) – id of a load balancer you want to fetch- Return type:
LoadBalancer
- list_protocols()[source]¶
We don’t actually have any protocol awareness beyond TCP.
- Return type:
list
ofstr
- name = 'CloudStack'¶
- type = 'cloudstack'¶
- website = 'http://cloudstack.org/'¶
libcloud.loadbalancer.drivers.dimensiondata module¶
- class libcloud.loadbalancer.drivers.dimensiondata.DimensionDataLBDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region='dd-na', **kwargs)[source]¶
Bases:
Driver
DimensionData node 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
- api_version = 1.0¶
- balancer_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member 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.
In Dimension Data terminology these are the members of the pools within a virtual listener.
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Return type:
list
ofMember
- connectionCls¶
alias of
DimensionDataConnection
- create_balancer(name, port=None, protocol=None, algorithm=None, members=None, ex_listener_ip_address=None)[source]¶
Create a new load balancer instance
- Parameters:
name (
str
) – Name of the new load balancer (required)port (
int
) – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’protocol (
str
) – Loadbalancer protocol, defaults to http.members (
list
ofMember
) – list of Members to attach to balancer (optional)algorithm (
Algorithm
) – Load balancing algorithm, defaults to ROUND_ROBIN.ex_listener_ip_address (
str
) – Must be a valid IPv4 in dot-decimal notation (x.x.x.x).
- Return type:
LoadBalancer
- destroy_balancer(balancer)[source]¶
Destroy a load balancer (virtual listener)
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Returns:
True
if the destroy was successful, otherwiseFalse
.- Return type:
bool
- ex_create_node(network_domain_id, name, ip, ex_description, connection_limit=25000, connection_rate_limit=2000)[source]¶
Create a new node
- Parameters:
network_domain_id – Network Domain ID (required)
name (
str
) – name of the node (required)ip (
str
) – IPv4 address of the node (required)ex_description (
str
) – Description of the node (required)connection_limit (
int
) – Maximum number of concurrent connections per secconnection_rate_limit (
int
) – Maximum number of concurrent sessions
- Returns:
Instance of
DimensionDataVIPNode
- Return type:
DimensionDataVIPNode
- ex_create_pool(network_domain_id, name, balancer_method, ex_description, health_monitors=None, service_down_action='NONE', slow_ramp_time=30)[source]¶
Create a new pool
- Parameters:
network_domain_id – Network Domain ID (required)
name (
str
) – name of the node (required)balancer_method (
str
) – The load balancer algorithm (required)ex_description (
str
) – Description of the node (required)health_monitors (
list
ofDimensionDataDefaultHealthMonitor
) – A list of health monitors to use for the pool.service_down_action (
str
) – What to do when node is unavailable NONE, DROP or RESELECTslow_ramp_time (
int
) – Number of seconds to stagger ramp up of nodes
- Returns:
Instance of
DimensionDataPool
- Return type:
DimensionDataPool
- ex_create_pool_member(pool, node, port=None)[source]¶
Create a new member in an existing pool from an existing node
- Parameters:
pool (
DimensionDataPool
) – Instance ofDimensionDataPool
(required)node (
DimensionDataVIPNode
) – Instance ofDimensionDataVIPNode
(required)port (
str
) – Port the the service will listen on
- Returns:
The node member, instance of
DimensionDataPoolMember
- Return type:
DimensionDataPoolMember
- ex_create_virtual_listener(network_domain_id, name, ex_description, port=None, pool=None, listener_ip_address=None, persistence_profile=None, fallback_persistence_profile=None, irule=None, protocol='TCP', connection_limit=25000, connection_rate_limit=2000, source_port_preservation='PRESERVE')[source]¶
Create a new virtual listener (load balancer)
- Parameters:
network_domain_id – Network Domain ID (required)
name (
str
) – name of the listener (required)ex_description (
str
) – Description of the node (required)port (
int
) – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’pool (
DimensionDataPool
) – The pool to use for the listenerlistener_ip_address (
str
) – The IPv4 Address of the virtual listenerpersistence_profile (
DimensionDataPersistenceProfile
) – Persistence profilefallback_persistence_profile (
DimensionDataPersistenceProfile
) – Fallback persistence profileirule (
DimensionDataDefaultiRule
) – The iRule to applyprotocol – For STANDARD type, ANY, TCP or UDP for PERFORMANCE_LAYER_4 choice of ANY, TCP, UDP, HTTP
connection_limit (
int
) – Maximum number of concurrent connections per secconnection_rate_limit (
int
) – Maximum number of concurrent sessionssource_port_preservation (
str
) – Choice of PRESERVE, PRESERVE_STRICT or CHANGE
- Returns:
Instance of the listener
- Return type:
DimensionDataVirtualListener
- ex_destroy_node(node_id)[source]¶
Destroy a specific node
- Parameters:
node_id (
str
) – The ID of of aDimensionDataVIPNode
- Returns:
True
for success,False
for failure- Return type:
bool
- ex_destroy_pool(pool)[source]¶
Destroy an existing pool
- Parameters:
pool (
DimensionDataPool
) – The instance ofDimensionDataPool
to destroy- Returns:
True
for success,False
for failure- Return type:
bool
- ex_destroy_pool_member(member, destroy_node=False)[source]¶
Destroy a specific member of a pool
- Parameters:
pool (
DimensionDataPoolMember
) – The instance of a pool memberdestroy_node (
bool
) – Also destroy the associated node
- Returns:
True
for success,False
for failure- Return type:
bool
- ex_get_current_network_domain()[source]¶
Get the current network domain ID of the driver.
- Returns:
ID of the network domain
- Return type:
str
- ex_get_default_health_monitors(network_domain_id)[source]¶
Get the default health monitors available for a network domain
- Parameters:
network_domain_id (
str
) – The ID of of aDimensionDataNetworkDomain
- Return type:
list of
DimensionDataDefaultHealthMonitor
- ex_get_default_irules(network_domain_id)[source]¶
Get the default iRules available for a network domain
- Parameters:
network_domain_id (
str
) – The ID of of aDimensionDataNetworkDomain
- Return type:
list of
DimensionDataDefaultiRule
- ex_get_default_persistence_profiles(network_domain_id)[source]¶
Get the default persistence profiles available for a network domain
- Parameters:
network_domain_id (
str
) – The ID of of aDimensionDataNetworkDomain
- Return type:
list of
DimensionDataPersistenceProfile
- ex_get_node(node_id)[source]¶
Get the node specified by node_id
- Returns:
Returns an instance of
DimensionDataVIPNode
- Return type:
Instance of
DimensionDataVIPNode
- ex_get_nodes(ex_network_domain_id=None)[source]¶
Get the nodes within this geography or in given network.
- Parameters:
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Returns:
Returns an
list
ofDimensionDataVIPNode
- Return type:
list
ofDimensionDataVIPNode
- ex_get_pool(pool_id)[source]¶
Get a specific pool inside the current geography
- Parameters:
pool_id (
str
) – The identifier of the pool- Returns:
Returns an instance of
DimensionDataPool
- Return type:
DimensionDataPool
- ex_get_pool_member(pool_member_id)[source]¶
Get a specific member of a pool
- Parameters:
pool (
str
) – The id of a pool member- Returns:
Returns an instance of
DimensionDataPoolMember
- Return type:
DimensionDataPoolMember
- ex_get_pool_members(pool_id)[source]¶
Get the members of a pool
- Parameters:
pool (
DimensionDataPool
) – The instance of a pool- Returns:
Returns an
list
ofDimensionDataPoolMember
- Return type:
list
ofDimensionDataPoolMember
- ex_get_pools(ex_network_domain_id=None)[source]¶
Get all of the pools inside the current geography or in given network.
- Parameters:
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Returns:
Returns a
list
of typeDimensionDataPool
- Return type:
list
ofDimensionDataPool
- ex_set_current_network_domain(network_domain_id)[source]¶
Set the network domain (part of the network) of the driver
- Parameters:
network_domain_id (
str
) – ID of the pool (required)
- ex_set_node_state(node, enabled)[source]¶
Change the state of a node (enable/disable)
- Parameters:
pool (
DimensionDataNode
) – The instance ofDimensionDataNode
to updateenabled (
bool
) – The target state of the node
- Returns:
The instance of
DimensionDataNode
- Return type:
DimensionDataNode
- ex_update_node(node)[source]¶
Update the properties of a node
- Parameters:
pool (
DimensionDataNode
) – The instance ofDimensionDataNode
to update- Returns:
The instance of
DimensionDataNode
- Return type:
DimensionDataNode
- ex_update_pool(pool)[source]¶
Update the properties of an existing pool only method, serviceDownAction and slowRampTime are updated
- Parameters:
pool (
DimensionDataPool
) – The instance ofDimensionDataPool
to update- Returns:
True
for success,False
for failure- Return type:
bool
- ex_wait_for_state(state, func, poll_interval=2, timeout=60, *args, **kwargs)[source]¶
Wait for the function which returns a instance with field status to match
Keep polling func until one of the desired states is matched
- Parameters:
state (
str
orlist
) – Either the desired state (str) or a list of statesfunc (
function
) – The function to call, e.g. ex_get_vlanpoll_interval (int) – The number of seconds to wait between checks
timeout (int) – The total number of seconds to wait to reach a state
args (Positional arguments) – The arguments for func
kwargs (Keyword arguments) – The arguments for func
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters:
balancer_id (
str
) – id of a load balancer you want to fetch- Return type:
LoadBalancer
- list_balancers(ex_network_domain_id=None)[source]¶
List all loadbalancers inside a geography or in given network.
In Dimension Data terminology these are known as virtual listeners
- Parameters:
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Return type:
list
ofLoadBalancer
- list_protocols()[source]¶
Return a list of supported protocols.
Since all protocols are support by Dimension Data, this is a list of common protocols.
- Return type:
list
ofstr
- name = 'Dimension Data Load Balancer'¶
- network_domain_id = None¶
- selected_region = None¶
- type = 'dimensiondata'¶
- website = 'https://cloud.dimensiondata.com/'¶
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/'¶
libcloud.loadbalancer.drivers.gce module¶
- class libcloud.loadbalancer.drivers.gce.GCELBDriver(*args, **kwargs)[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
- apiname = 'googleapis'¶
- 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_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member 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, otherwise False
- 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
GCEConnection
- create_balancer(name, port, protocol, algorithm, members, ex_region=None, ex_healthchecks=None, ex_address=None, ex_session_affinity=None)[source]¶
Create a new load balancer instance.
For GCE, this means creating a forwarding rule and a matching target pool, then adding the members to the target pool.
- Parameters:
name (
str
) – Name of the new load balancer (required)port (
str
) – Port or range of ports the load balancer should listen on, defaults to all ports. Examples: ‘80’, ‘5000-5999’protocol (
str
) – Load balancer protocol. Should be ‘tcp’ or ‘udp’, defaults to ‘tcp’.members (
list
ofMember
orNode
) – List of Members to attach to balancer. Can be Member objects or Node objects. Node objects are preferred for GCE, but Member objects are accepted to comply with the established libcloud API. Note that the ‘port’ attribute of the members is ignored.algorithm (
Algorithm
orNone
) – Load balancing algorithm. Ignored for GCE which uses a hashing-based algorithm.ex_region (C{GCERegion} or
str
) – Optional region to create the load balancer in. Defaults to the default region of the GCE Node Driver.ex_healthchecks (
list
ofGCEHealthCheck
orlist
ofstr
) – Optional list of healthcheck objects or names to add to the load balancer.ex_address (C{GCEAddress}) – Optional static address object to be assigned to the load balancer.
ex_session_affinity (
str
) – Optional algorithm to use for session affinity. This will modify the hashing algorithm such that a client will tend to stick to a particular Member.
- Returns:
LoadBalancer object
- Return type:
LoadBalancer
- destroy_balancer(balancer)[source]¶
Destroy a load balancer.
For GCE, this means destroying the associated forwarding rule, then destroying the target pool that was attached to the forwarding rule.
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Returns:
True if successful
- Return type:
bool
- ex_balancer_attach_healthcheck(balancer, healthcheck)[source]¶
Attach a healthcheck to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedhealthcheck (
GCEHealthCheck
) – Healthcheck to add
- Returns:
True if successful
- Return type:
bool
- ex_balancer_detach_healthcheck(balancer, healthcheck)[source]¶
Detach healtcheck from balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedhealthcheck (
GCEHealthCheck
) – Healthcheck to remove
- Returns:
True if successful
- Return type:
bool
- ex_balancer_list_healthchecks(balancer)[source]¶
Return list of healthchecks attached to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Return type:
list
ofHealthChecks
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters:
balancer_id – Name of load balancer you wish to fetch. For GCE, this is the name of the associated forwarding rule.
balancer_id –
str
- Return type:
LoadBalancer
- list_balancers(ex_region=None)[source]¶
List all loadbalancers
- Parameters:
ex_region (
str
orGCERegion
orNone
) – The region to return balancers from. If None, will default to self.region. If ‘all’, will return all balancers.- Return type:
list
ofLoadBalancer
- list_protocols()[source]¶
Return a list of supported protocols.
For GCE, this is simply a hardcoded list.
- Return type:
list
ofstr
- name = 'Google Compute Engine Load Balancer'¶
- website = 'https://cloud.google.com/'¶
libcloud.loadbalancer.drivers.ninefold module¶
- class libcloud.loadbalancer.drivers.ninefold.NinefoldLBDriver(key, secret=None, secure=True, host=None, path=None, port=None, *args, **kwargs)[source]¶
Bases:
CloudStackLBDriver
Driver for load balancers on Ninefold’s Compute platform.
@inherits:
Driver.__init__
- host = 'api.ninefold.com'¶
- name = 'Ninefold LB'¶
- path = '/compute/v1.0/'¶
- type = 'ninefold'¶
- website = 'http://ninefold.com/'¶
libcloud.loadbalancer.drivers.nttcis module¶
- class libcloud.loadbalancer.drivers.nttcis.NttCisLBDriver(key, network_domain_id, secret=None, secure=True, host=None, port=None, api_version=None, region='na', **kwargs)[source]¶
Bases:
Driver
NttCis LB 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
- api_version = 1.0¶
- balancer_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member 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.
In NTTC-CIS terminology these are the members of the pools within a virtual listener.
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Return type:
list
ofMember
- connectionCls¶
alias of
NttCisConnection
- create_balancer(name, listener_port=None, port=None, protocol=None, algorithm=None, members=None, optimization_profile='TCP', ex_listener_ip_address=None)[source]¶
Create a new load balancer instance
- Parameters:
name (
str
) – Name of the new load balancer (required)listener_port – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’
port (
int
) – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’ Assumed that node ports will different from listener port.protocol (
str
) – Loadbalancer protocol, defaults to http.members (
list
ofMember
) – list of Members to attach to balancer (optional)algorithm (
Algorithm
) – Load balancing algorithm, defaults to ROUND_ROBIN.optimization_profile – For STANDARD type and protocol TCP an optimization type of TCP, LAN_OPT, WAN_OPT, MOBILE_OPT, or TCP_LEGACY is required. Default is TCP
ex_listener_ip_address (
str
) – Must be a valid IPv4 in dot-decimal notation (x.x.x.x).
- Return type:
LoadBalancer
- destroy_balancer(balancer)[source]¶
Destroy a load balancer (virtual listener)
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be used- Returns:
True
if the destroy was successful, otherwiseFalse
.- Return type:
bool
- ex_create_node(network_domain_id, name, ip, ex_description=None, connection_limit=25000, connection_rate_limit=2000)[source]¶
Create a new node
- Parameters:
network_domain_id – Network Domain ID (required)
name (
str
) – name of the node (required)ip (
str
) – IPv4 address of the node (required)ex_description (
str
) – Description of the node (required)connection_limit (
int
) – Maximum number of concurrent connections per secconnection_rate_limit (
int
) – Maximum number of concurrent sessions
- Returns:
Instance of
NttCisVIPNode
- Return type:
NttCisVIPNode
- ex_create_pool(network_domain_id, name, balancer_method, ex_description, health_monitors=None, service_down_action='NONE', slow_ramp_time=30)[source]¶
Create a new pool
- Parameters:
network_domain_id – Network Domain ID (required)
name (
str
) – name of the node (required)balancer_method (
str
) – The load balancer algorithm (required)ex_description (
str
) – Description of the node (required)health_monitors (
list
ofNttCisDefaultHealthMonitor
) – A list of health monitors to use for the pool.service_down_action (
str
) – What to do when node is unavailable NONE, DROP or RESELECTslow_ramp_time (
int
) – Number of seconds to stagger ramp up of nodes
- Returns:
Instance of
NttCisPool
- Return type:
NttCisPool
- ex_create_pool_member(pool, node, port=None)[source]¶
Create a new member in an existing pool from an existing node
- Parameters:
pool (
NttCisPool
) – Instance ofNttCisPool
(required)node (
NttCisVIPNode
) – Instance ofNttCisVIPNode
(required)port (
str
) – Port the the service will listen on
- Returns:
The node member, instance of
NttCisPoolMember
- Return type:
NttCisPoolMember
- ex_create_ssl_offload_profile(netowrk_domain_id, name, ssl_domain_cert_id, description=None, ciphers=None, ssl_cert_chain_id=None)[source]¶
Creates an SSL Offload profile
- Parameters:
network_domain_id – The network domain’s Id
name (
str
) – Offload profile’s namessl_domain_cert_id (
str
) – Certificate’s Iddescription (
str
) – (Optional) Profile’s descriptionciphers – (Optional) The default cipher string is:
“MEDIUM:HIGH:!EXPORT:!ADH:!MD5:!RC4:!SSLv2:!SSLv3: !ECDHE+AES-GCM:!ECDHE+AES:!ECDHE+3DES:!ECDHE_ECDSA: !ECDH_RSA:!ECDH_ECDSA:@SPEED” It is possible to choose just a subset of this string :type ciphers:
str
:param ssl_cert_chain_id: (Optional) Bind the certificate chain to the profile. :type ssl_cert_chain_id: str` :returns:bool
- ex_create_virtual_listener(network_domain_id, name, ex_description, port=None, pool=None, listener_ip_address=None, persistence_profile=None, fallback_persistence_profile=None, irule=None, protocol='TCP', optimization_profile='TCP', connection_limit=25000, connection_rate_limit=2000, source_port_preservation='PRESERVE')[source]¶
Create a new virtual listener (load balancer)
- Parameters:
network_domain_id – Network Domain ID (required)
name (
str
) – name of the listener (required)ex_description (
str
) – Description of the node (required)port (
int
) – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’pool (
NttCisPool
) – The pool to use for the listenerlistener_ip_address (
str
) – The IPv4 Address of the virtual listenerpersistence_profile (
NttCisPersistenceProfile
) – Persistence profilefallback_persistence_profile (
NttCisPersistenceProfile
) – Fallback persistence profileirule (
NttCisDefaultiRule
) – The iRule to applyprotocol – For STANDARD type, ANY, TCP or UDP for PERFORMANCE_LAYER_4 choice of ANY, TCP, UDP, HTTP
optimization_profile – For STANDARD type and protocol TCP an optimization type of TCP, LAN_OPT, WAN_OPT, MOBILE_OPT, or TCP_LEGACY is required. Default is ‘TCP’.
connection_limit (
int
) – Maximum number of concurrent connections per secconnection_rate_limit (
int
) – Maximum number of concurrent sessionssource_port_preservation (
str
) – Choice of PRESERVE, PRESERVE_STRICT or CHANGE
- Returns:
Instance of the listener
- Return type:
NttCisVirtualListener
- ex_delete_ssl_certificate_chain(cert_chain_id)[source]¶
Deletes a certificate chain
- Parameters:
cert_chain_id (
str
) – Id of certificate chain to delete
:return
bool
- ex_delete_ssl_domain_certificate(dom_cert_id)[source]¶
Deletes an SSL domain certificate
- Parameters:
dom_cert_id (
str
) – Id of certificate to delete- Returns:
bool
- ex_delete_ssl_offload_profile(profile_id)[source]¶
Delete an offload profile
- Parameters:
profile_id (
str
) – Id of profile to be deleted- Returns:
bool
- ex_destroy_node(node_id)[source]¶
Destroy a specific node
- Parameters:
node_id (
str
) – The ID of of aNttCisVIPNode
- Returns:
True
for success,False
for failure- Return type:
bool
- ex_destroy_pool(pool)[source]¶
Destroy an existing pool
- Parameters:
pool (
NttCisPool
) – The instance ofNttCisPool
to destroy- Returns:
True
for success,False
for failure- Return type:
bool
- ex_destroy_pool_member(member, destroy_node=False)[source]¶
Destroy a specific member of a pool
- Parameters:
pool (
NttCisPoolMember
) – The instance of a pool memberdestroy_node (
bool
) – Also destroy the associated node
- Returns:
True
for success,False
for failure- Return type:
bool
- ex_edit_ssl_offload_profile(profile_id, name, ssl_domain_cert_id, description=None, ciphers=None, ssl_cert_chain_id=None)[source]¶
The function edits the ssl offload profile
- Parameters:
profil_id – The id of the profile to be edited
name (
str
) – The name of the profile, new name or previous namessl_domain_cert_id (
str
) – The certificate id to use, new or currentdescription (
str
) – (Optional) Profile’s descriptionciphers (
str
) – (Optional) String of acceptable ciphers to usessl_cert_chain_id – If using a certificate chain
or changing to a new one :type: ssl_cert_chain_id:
str
:returns:bool
- ex_get_current_network_domain()[source]¶
Get the current network domain ID of the driver.
- Returns:
ID of the network domain
- Return type:
str
- ex_get_default_health_monitors(network_domain)[source]¶
Get the default health monitors available for a network domain
- Parameters:
network_domain_id (
str
) – The ID of of aNttCisNetworkDomain
- Return type:
list of
NttCisDefaultHealthMonitor
- ex_get_default_irules(network_domain_id)[source]¶
Get the default iRules available for a network domain
- Parameters:
network_domain_id (
str
) – The ID of of aNttCisNetworkDomain
- Return type:
list of
NttCisDefaultiRule
- ex_get_default_persistence_profiles(network_domain_id)[source]¶
Get the default persistence profiles available for a network domain
- Parameters:
network_domain_id (
str
) – The ID of of aNttCisNetworkDomain
- Return type:
list of
NttCisPersistenceProfile
- ex_get_node(node_id)[source]¶
Get the node specified by node_id
- Returns:
Returns an instance of
NttCisVIPNode
- Return type:
Instance of
NttCisVIPNode
- ex_get_nodes(ex_network_domain_id=None)[source]¶
Get the nodes within this geography or in given network.
- Parameters:
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Returns:
Returns an
list
ofNttCisVIPNode
- Return type:
list
ofNttCisVIPNode
- ex_get_pool(pool_id)[source]¶
Get a specific pool inside the current geography
- Parameters:
pool_id (
str
) – The identifier of the pool- Returns:
Returns an instance of
NttCisPool
- Return type:
NttCisPool
- ex_get_pool_member(pool_member_id)[source]¶
Get a specific member of a pool
- Parameters:
pool (
str
) – The id of a pool member- Returns:
Returns an instance of
NttCisPoolMember
- Return type:
NttCisPoolMember
- ex_get_pool_members(pool_id)[source]¶
Get the members of a pool
- Parameters:
pool (
NttCisPool
) – The instance of a pool- Returns:
Returns an
list
ofNttCisPoolMember
- Return type:
list
ofNttCisPoolMember
- ex_get_pools(ex_network_domain_id=None)[source]¶
Get all of the pools inside the current geography or in given network.
- Parameters:
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Returns:
Returns a
list
of typeNttCisPool
- Return type:
list
ofNttCisPool
- ex_get_ssl_certificate_chain(chain_id)[source]¶
Function gets the certificate chain by id. Use this if only if the id is already known :param cert_id: The id of the specific cert :return: :class: `NttCiscertificatechain
- ex_get_ssl_domain_cert(cert_id)[source]¶
Function gets the cert by id. Use this if only if the id is already known
- Parameters:
cert_id (
str
) – The id of the specific cert- Returns:
- class:
`NttCisdomaincertificate
- ex_import_ssl_cert_chain(network_domain_id, name, chain_crt_file, description=None)[source]¶
Import an ssl certificate chain for ssl offloading onto the the load balancer
- Parameters:
network_domain_id (
str
) – The Network Domain’s Id.name (
str
) – The name of the ssl certificate chainchain_crt_file (
str
) – The complete path to the certificate chain filedescription (
str
) – (Optional) A description of the certificate chain
- Returns:
bool
- ex_import_ssl_domain_certificate(network_domain_id, name, crt_file, key_file, description=None)[source]¶
Import an ssl cert for ssl offloading onto the the load balancer
- Parameters:
network_domain_id (
str
) – The Network Domain’s Id.name (
str
) – The name of the ssl certificatecrt_file (
str
) – The complete path to the certificate filekey_file (
str
) – The complete pathy to the key filedescription – (Optional) A description of the certificate
- Returns:
bool
- ex_list_ssl_certificate_chains(params={})[source]¶
Functions takes a named parameter that can be one or none of the following to filter returned items
- Parameters:
params – A sequence of comma separated keyword arguments
- and a value
id=
network_domain_id=
name=
state=
create_time=
expiry_time=
- Returns:
list of :class: NttCissslcertficiatechain
- ex_list_ssl_domain_certs(params={})[source]¶
Functions takes a named parameter that can be one or none of the following
- Parameters:
params – A sequence of comma separated keyword arguments
- and a value
id=
network_domain_id=
name=
state=
create_time=
expiry_time=
- Returns:
list of :class: NttCisDomaincertificate
- ex_list_ssl_offload_profiles(params={})[source]¶
Functions takes a named parameter that can be one or none of the following to filter returned items
- Parameters:
params – A sequence of comma separated keyword arguments
- and a value
id=
network_domain_id=
datacenter_id=
name=
state=
ssl_domain_certificate_id=
ssl_domain_certificate_name=
ssl_certificate_chain_id=
ssl_certificate_chain_name=
create_time=
- Returns:
list of :class: NttCisSslssloffloadprofile
- ex_set_current_network_domain(network_domain_id)[source]¶
Set the network domain (part of the network) of the driver
- Parameters:
network_domain_id (
str
) – ID of the pool (required)
- ex_set_node_state(node, enabled)[source]¶
Change the state of a node (enable/disable)
- Parameters:
pool (
NttCisNode
) – The instance ofNttCisNode
to updateenabled (
bool
) – The target state of the node
- Returns:
The instance of
NttCisNode
- Return type:
NttCisNode
- ex_update_listener(virtual_listener, **kwargs)[source]¶
Update a current virtual listener. :param virtual_listener: The listener to be updated :return: The edited version of the listener
- ex_update_node(node)[source]¶
Update the properties of a node
- Parameters:
pool (
NttCisNode
) – The instance ofNttCisNode
to update- Returns:
The instance of
NttCisNode
- Return type:
NttCisNode
- ex_update_pool(pool)[source]¶
Update the properties of an existing pool only method, serviceDownAction and slowRampTime are updated
- Parameters:
pool (
NttCisPool
) – The instance ofNttCisPool
to update- Returns:
True
for success,False
for failure- Return type:
bool
- ex_wait_for_state(state, func, poll_interval=2, timeout=60, *args, **kwargs)[source]¶
Wait for the function which returns a instance with field status to match
Keep polling func until one of the desired states is matched
- Parameters:
state (
str
orlist
) – Either the desired state (str) or a list of statesfunc (
function
) – The function to call, e.g. ex_get_vlanpoll_interval (int) – The number of seconds to wait between checks
timeout (int) – The total number of seconds to wait to reach a state
args (Positional arguments) – The arguments for func
kwargs (Keyword arguments) – The arguments for func
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters:
balancer_id (
str
) – id of a load balancer you want to fetch- Return type:
LoadBalancer
- list_balancers(ex_network_domain_id=None)[source]¶
List all loadbalancers inside a geography or in given network.
In NTTC-CIS terminology these are known as virtual listeners
- Parameters:
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Return type:
list
ofLoadBalancer
- list_protocols()[source]¶
Return a list of supported protocols.
Since all protocols are support by NTTC-CIS, this is a list of common protocols.
- Return type:
list
ofstr
- name = 'NTTC-CIS Load Balancer'¶
- selected_region = None¶
- type = 'nttcis'¶
- website = 'https://cloud.nttcis.com/'¶
libcloud.loadbalancer.drivers.rackspace module¶
- class libcloud.loadbalancer.drivers.rackspace.RackspaceAccessRule(id=None, rule_type=None, address=None)[source]¶
Bases:
object
An access rule allows or denies traffic to a Load Balancer based on the incoming IPs.
- Parameters:
id (
int
) – Unique identifier to refer to this rule by.rule_type – RackspaceAccessRuleType.ALLOW or RackspaceAccessRuleType.DENY.
address (
str
) – IP address or cidr (can be IPv4 or IPv6).
- class libcloud.loadbalancer.drivers.rackspace.RackspaceAccessRuleType[source]¶
Bases:
object
- ALLOW = 0¶
- DENY = 1¶
- class libcloud.loadbalancer.drivers.rackspace.RackspaceConnection(*args, **kwargs)[source]¶
Bases:
RackspaceConnection
,PollingConnection
Initialize user_id and key; set secure to an
int
based on passed value.- cache_busting = True¶
- get_poll_request_kwargs(response, context, request_kwargs)[source]¶
Return keyword arguments which are passed to the request() method when polling for the job status.
- Parameters:
response (
dict
) – Response object returned by poll request.request_kwargs – Kwargs previously used to initiate the poll request.
:return
dict
Keyword arguments
- has_completed(response)[source]¶
Return job completion status.
- Parameters:
response (
HTTPResponse
) – Response object returned by poll request.
:return
bool
True if the job has completed, False otherwise.
- poll_interval = 2¶
- request(action, params=None, data='', headers=None, method='GET')[source]¶
Request a given action.
Basically a wrapper around the connection object’s request that does some helpful pre-processing.
- Parameters:
action (
str
) – A path. This can include arguments. If included, any extra parameters are appended to the existing ones.params (
dict
) – Optional mapping of additional parameters to send. If None, leave as an emptydict
.data (
unicode
) – A body of data to send with the request.headers (
dict
) – Extra headers to add to the request None, leave as an emptydict
.method (
str
) – An HTTP method such as “GET” or “POST”.raw (
bool
) – True to perform a “raw” request aka only send the headers and use the rawResponseCls class. This is used with storage API when uploading a file.stream (
bool
) – True to return an iterator in Response.iter_content and allow streaming of the response data (for downloading large files)retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
- Returns:
An
Response
instance.- Return type:
Response
instance
- responseCls¶
alias of
RackspaceResponse
- class libcloud.loadbalancer.drivers.rackspace.RackspaceConnectionThrottle(min_connections, max_connections, max_connection_rate, rate_interval_seconds)[source]¶
Bases:
object
- Parameters:
min_connections (
int
) – Minimum number of connections per IP address before applying throttling.max_connections (
int
) – Maximum number of connections per IP address. (Must be between 0 and 100000, 0 allows an unlimited number of connections.)max_connection_rate (
int
) – Maximum number of connections allowed from a single IP address within the given rate_interval_seconds. (Must be between 0 and 100000, 0 allows an unlimited number of connections.)rate_interval_seconds (
int
) – Interval at which the max_connection_rate is enforced. (Must be between 1 and 3600.)
- class libcloud.loadbalancer.drivers.rackspace.RackspaceHTTPHealthMonitor(type, delay, timeout, attempts_before_deactivation, path, body_regex, status_regex)[source]¶
Bases:
RackspaceHealthMonitor
A HTTP health monitor adds extra features to a Rackspace health monitor.
- Parameters:
path (
str
) – the HTTP path to monitor.body_regex (
str
) – Regular expression used to evaluate the body of the HTTP response.status_regex (
str
) – Regular expression used to evaluate the HTTP status code of the response.
- class libcloud.loadbalancer.drivers.rackspace.RackspaceHealthMonitor(type, delay, timeout, attempts_before_deactivation)[source]¶
Bases:
object
- Parameters:
type (
str
) – type of load balancer. currently CONNECT (connection monitoring), HTTP, HTTPS (connection and HTTP monitoring) are supported.delay (
int
) – minimum seconds to wait before executing the health monitor. (Must be between 1 and 3600)timeout (
int
) – maximum seconds to wait when establishing a connection before timing out. (Must be between 1 and 3600)attempts_before_deactivation (
int
) – Number of monitor failures before removing a node from rotation. (Must be between 1 and 10)
- class libcloud.loadbalancer.drivers.rackspace.RackspaceLBDriver(key, secret=None, secure=True, host=None, port=None, region='ord', **kwargs)[source]¶
Bases:
Driver
,OpenStackDriverMixin
- 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
- CONDITION_LB_MEMBER_MAP = {0: 'ENABLED', 1: 'DISABLED', 2: 'DRAINING'}¶
- LB_MEMBER_CONDITION_MAP = {'DISABLED': 1, 'DRAINING': 2, 'ENABLED': 0}¶
- LB_STATE_MAP = {'ACTIVE': 0, 'BUILD': 1, 'DELETED': 4, 'ERROR': 3, 'PENDING_DELETE': 1, 'PENDING_UPDATE': 1}¶
- api_name = 'rackspace_lb'¶
- balancer_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member 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
RackspaceConnection
- create_balancer(name, members, protocol='http', port=80, algorithm=1)[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_balancer_access_list(balancer)[source]¶
List the access list.
- Parameters:
balancer (
LoadBalancer
) – Balancer which should be used- Return type:
list
ofRackspaceAccessRule
- ex_balancer_attach_members(balancer, members)[source]¶
Attaches a list of members to a load balancer.
- Parameters:
balancer (
LoadBalancer
) – The Balancer to which members will be attached.members (
list
ofMember
) – A list of Members to attach.
- Return type:
list
ofMember
- ex_balancer_detach_members(balancer, members)[source]¶
Detaches a list of members from a balancer (the API supports up to 10). This method blocks until the detach request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – The Balancer to detach members from.members (
list
ofMember
) – A list of Members to detach.
- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_balancer_detach_members_no_poll(balancer, members)[source]¶
Detaches a list of members from a balancer (the API supports up to 10). This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – The Balancer to detach members from.members (
list
ofMember
) – A list of Members to detach.
- Returns:
Returns whether the detach request was accepted.
- Return type:
bool
- ex_balancer_update_member(balancer, member, **kwargs)[source]¶
Updates a Member’s extra attributes for a Balancer. The attributes can include ‘weight’ or ‘condition’. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update the member on.member (
Member
) – Member which should be used**kwargs –
New attributes. Should contain either ‘weight’
or ‘condition’. ‘condition’ can be set to ‘ENABLED’, ‘DISABLED’. or ‘DRAINING’. ‘weight’ can be set to a positive integer between 1 and 100, with a higher weight indicating that the node will receive more traffic (assuming the Balancer is using a weighted algorithm). :type **kwargs:
dict
- Returns:
Updated Member.
- Return type:
Member
- ex_balancer_update_member_no_poll(balancer, member, **kwargs)[source]¶
Updates a Member’s extra attributes for a Balancer. The attribute can include ‘weight’ or ‘condition’. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update the member on.member (
Member
) – Member which should be used**kwargs –
New attributes. Should contain either ‘weight’
or ‘condition’. ‘condition’ can be set to ‘ENABLED’, ‘DISABLED’. or ‘DRAINING’. ‘weight’ can be set to a positive integer between 1 and 100, with a higher weight indicating that the node will receive more traffic (assuming the Balancer is using a weighted algorithm). :type **kwargs:
dict
- Returns:
Returns whether the update request was accepted.
- Return type:
bool
- ex_create_balancer(name, members, protocol='http', port=80, algorithm=1, vip='PUBLIC')[source]¶
Creates a new load balancer instance
- Parameters:
name (
str
) – Name of the new load balancer (required)members (
list
ofMember
) –list
of:class:`Member`s to attach to balancerprotocol (
str
) – Loadbalancer protocol, defaults to http.port (
str
) – Port the load balancer should listen on, defaults to 80algorithm (
Algorithm
) – Load balancing algorithm, defaults to LBAlgorithm.ROUND_ROBINvip (
str
) – Virtual ip type of PUBLIC, SERVICENET, or ID of a virtual ip
- Return type:
LoadBalancer
- ex_create_balancer_access_rule(balancer, rule)[source]¶
Adds an access rule to a Balancer’s access list. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to create the access rule for.rule (
RackspaceAccessRule
) – Access Rule to add to the balancer.
- Returns:
The created access rule.
- Return type:
- ex_create_balancer_access_rule_no_poll(balancer, rule)[source]¶
Adds an access rule to a Balancer’s access list. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to create the access rule for.rule (
RackspaceAccessRule
) – Access Rule to add to the balancer.
- Returns:
Returns whether the create request was accepted.
- Return type:
bool
- ex_create_balancer_access_rules(balancer, rules)[source]¶
Adds a list of access rules to a Balancer’s access list. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to create the access rule for.rules (
list
ofRackspaceAccessRule
) – List ofRackspaceAccessRule
to add to the balancer.
- Returns:
The created access rules.
- Return type:
- ex_create_balancer_access_rules_no_poll(balancer, rules)[source]¶
Adds a list of access rules to a Balancer’s access list. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to create the access rule for.rules (
list
ofRackspaceAccessRule
) – List ofRackspaceAccessRule
to add to the balancer.
- Returns:
Returns whether the create request was accepted.
- Return type:
bool
- ex_destroy_balancer_access_rule(balancer, rule)[source]¶
Removes an access rule from a Balancer’s access list. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to remove the access rule from.rule (
RackspaceAccessRule
) – Access Rule to remove from the balancer.
- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_destroy_balancer_access_rule_no_poll(balancer, rule)[source]¶
Removes an access rule from a Balancer’s access list. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to remove the access rule from.rule (
RackspaceAccessRule
) – Access Rule to remove from the balancer.
- Returns:
Returns whether the destroy request was accepted.
- Return type:
bool
- ex_destroy_balancer_access_rules(balancer, rules)[source]¶
Removes a list of access rules from a Balancer’s access list. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to remove the access rules from.rules (
list
ofRackspaceAccessRule
) – List ofRackspaceAccessRule
objects to remove from the balancer.
- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_destroy_balancer_access_rules_no_poll(balancer, rules)[source]¶
Removes a list of access rules from a Balancer’s access list. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to remove the access rules from.rules (
list
ofRackspaceAccessRule
) – List ofRackspaceAccessRule
objects to remove from the balancer.
- Returns:
Returns whether the destroy request was accepted.
- Return type:
bool
- ex_destroy_balancers(balancers)[source]¶
Destroys a list of Balancers (the API supports up to 10).
- Parameters:
balancers (
list
ofLoadBalancer
) – A list of Balancers to destroy.- Returns:
Returns whether the destroy request was accepted.
- Return type:
bool
- ex_disable_balancer_connection_logging(balancer)[source]¶
Disables connection logging for a Balancer. This method blocks until the enable request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable connection logging on.- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_disable_balancer_connection_logging_no_poll(balancer)[source]¶
Disables connection logging for a Balancer. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable connection logging on.- Returns:
Returns whether the disable request was accepted.
- Return type:
bool
- ex_disable_balancer_connection_throttle(balancer)[source]¶
Disables a Balancer’s connection throttle. This method blocks until the disable request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable connection throttle on.- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_disable_balancer_connection_throttle_no_poll(balancer)[source]¶
Disables a Balancer’s connection throttle. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable connection throttle on.- Returns:
Returns whether the disable request was accepted.
- Return type:
bool
- ex_disable_balancer_custom_error_page(balancer)[source]¶
Disables a Balancer’s custom error page, returning its error page to the Rackspace-provided default. This method blocks until the disable request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable the custom error page for.- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_disable_balancer_custom_error_page_no_poll(balancer)[source]¶
Disables a Balancer’s custom error page, returning its error page to the Rackspace-provided default. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable the custom error page for.- Returns:
Returns whether the disable request was accepted.
- Return type:
bool
- ex_disable_balancer_health_monitor(balancer)[source]¶
Disables a Balancer’s health monitor. This method blocks until the disable request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable health monitor on.- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_disable_balancer_health_monitor_no_poll(balancer)[source]¶
Disables a Balancer’s health monitor. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable health monitor on.- Returns:
Returns whether the disable request was accepted.
- Return type:
bool
- ex_disable_balancer_session_persistence(balancer)[source]¶
Disables session persistence for a Balancer. This method blocks until the disable request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable session persistence on.- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_disable_balancer_session_persistence_no_poll(balancer)[source]¶
Disables session persistence for a Balancer. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to disable session persistence for.- Returns:
Returns whether the disable request was accepted.
- Return type:
bool
- ex_enable_balancer_connection_logging(balancer)[source]¶
Enables connection logging for a Balancer. This method blocks until the enable request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to enable connection logging on.- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_enable_balancer_connection_logging_no_poll(balancer)[source]¶
Enables connection logging for a Balancer. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to enable connection logging on.- Returns:
Returns whether the enable request was accepted.
- Return type:
bool
- ex_enable_balancer_session_persistence(balancer)[source]¶
Enables session persistence for a Balancer by setting the persistence type to ‘HTTP_COOKIE’. This method blocks until the enable request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to enable session persistence on.- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_enable_balancer_session_persistence_no_poll(balancer)[source]¶
Enables session persistence for a Balancer by setting the persistence type to ‘HTTP_COOKIE’. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to enable session persistence on.- Returns:
Returns whether the enable request was accepted.
- Return type:
bool
- ex_get_balancer_error_page(balancer)[source]¶
List error page configured for the specified load balancer.
- Parameters:
balancer (
LoadBalancer
) – Balancer which should be used- Return type:
str
- ex_list_algorithm_names()[source]¶
Lists algorithms supported by the API. Returned as strings because this list may change in the future.
- Return type:
list
ofstr
- ex_list_current_usage(balancer)[source]¶
Return current load balancer usage report.
- Parameters:
balancer (
LoadBalancer
) – Balancer to remove the access rules from.- Returns:
Raw load balancer usage object.
- Return type:
dict
- ex_list_protocols_with_default_ports()[source]¶
List protocols with default ports.
- Return type:
list
oftuple
- Returns:
A list of protocols with default ports included.
- ex_update_balancer_connection_throttle(balancer, connection_throttle)[source]¶
Updates a Balancer’s connection throttle. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update connection throttle on.connection_throttle (
RackspaceConnectionThrottle
) – Connection Throttle for the balancer.
- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_update_balancer_connection_throttle_no_poll(balancer, connection_throttle)[source]¶
Sets a Balancer’s connection throttle. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update connection throttle on.connection_throttle (
RackspaceConnectionThrottle
) – Connection Throttle for the balancer.
- Returns:
Returns whether the update request was accepted.
- Return type:
bool
- ex_update_balancer_error_page(balancer, page_content)[source]¶
Updates a Balancer’s custom error page. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update the custom error page for.page_content (
str
) – HTML content for the custom error page.
- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_update_balancer_error_page_no_poll(balancer, page_content)[source]¶
Updates a Balancer’s custom error page. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update the custom error page for.page_content (
str
) – HTML content for the custom error page.
- Returns:
Returns whether the update request was accepted.
- Return type:
bool
- ex_update_balancer_health_monitor(balancer, health_monitor)[source]¶
Sets a Balancer’s health monitor. This method blocks until the update request has been processed and the balancer is in a RUNNING state again.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update.health_monitor (
RackspaceHealthMonitor
) – Health Monitor for the balancer.
- Returns:
Updated Balancer.
- Return type:
LoadBalancer
- ex_update_balancer_health_monitor_no_poll(balancer, health_monitor)[source]¶
Sets a Balancer’s health monitor. This method returns immediately.
- Parameters:
balancer (
LoadBalancer
) – Balancer to update health monitor on.health_monitor (
RackspaceHealthMonitor
) – Health Monitor for the balancer.
- Returns:
Returns whether the update request was accepted.
- Return type:
bool
- ex_update_balancer_no_poll(balancer, **kwargs)[source]¶
Update balancer no poll.
@inherits:
Driver.update_balancer
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters:
balancer_id (
str
) – id of a load balancer you want to fetch- Return type:
LoadBalancer
- list_balancers(ex_member_address=None, ex_status=None, ex_changes_since=None, ex_params={})[source]¶
@inherits:
Driver.list_balancers
- Parameters:
ex_member_address (
str
) – Optional IP address of the attachment member. If provided, only the load balancers which have this member attached will be returned.ex_status (
str
) – Optional. Filter balancers by statusex_changes_since (
str
) – Optional. List all load balancers that have changed since the specified date/timeex_params (
dict
) – Optional. Set parameters to be submitted to the API in the query string
- name = 'Rackspace LB'¶
- update_balancer(balancer, **kwargs)[source]¶
Sets the name, algorithm, protocol, or port on a load balancer.
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedname (
str
) – New load balancer namealgorithm (
Algorithm
) – New load balancer algorithmprotocol (
str
) – New load balancer protocolport (
int
) – New load balancer port
- Return type:
LoadBalancer
- website = 'http://www.rackspace.com/'¶
- class libcloud.loadbalancer.drivers.rackspace.RackspaceResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
libcloud.loadbalancer.drivers.slb module¶
- class libcloud.loadbalancer.drivers.slb.SLBDriver(access_id, secret, region)[source]¶
Bases:
Driver
Aliyun SLB load balancer 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_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters:
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member 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
SLBConnection
- create_balancer(name, port, protocol, algorithm, members, ex_bandwidth=None, ex_internet_charge_type=None, ex_address_type=None, ex_vswitch_id=None, ex_master_zone_id=None, ex_slave_zone_id=None, ex_client_token=None, **kwargs)[source]¶
Create a new load balancer instance
@inherits:
Driver.create_balancer
- Parameters:
ex_bandwidth (
int
in range [1, 1000]) – The max bandwidth limit for paybybandwidth internet charge type, in Mbps unitex_internet_charge_type (a
str
of paybybandwidth or paybytraffic) – The internet charge typeex_address_type (a
str
of internet or intranet) – The listening IP address typeex_vswitch_id (
str
) – The vswitch id in a VPC networkex_master_zone_id (
str
) – The id of the master availability zoneex_slave_zone_id (
str
) – The id of the slave availability zoneex_client_token (
str
) – The token generated by client to identify requests
- 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_listener(balancer, backend_port, protocol, algorithm, bandwidth, **kwargs)[source]¶
Create load balancer listening rule.
- Parameters:
balancer (
LoadBalancer
) – the balancer which the rule belongs to. The listener created will listen on the port of the the balancer as default. ‘ListenerPort’ in kwargs will OVERRIDE it.backend_port (
int
) – the backend server portprotocol (
str
) – the balancer protocol, default to httpalgorithm (
Algorithm
) – the balancer routing algorithmbandwidth (
str
) – the listener bandwidth limits
- Returns:
the created listener
- Return type:
SLBLoadBalancerListener
- ex_delete_certificate(certificate_id)[source]¶
Delete the given server certificate
- Parameters:
certificate_id (
str
) – the id of the certificate to delete- Returns:
whether process is success
- Return type:
bool
- ex_get_balancer_attribute(balancer)[source]¶
Get balancer attribute
- Parameters:
balancer (
LoadBalancer
) – the balancer to get attribute- Returns:
the balancer attribute
- Return type:
SLBLoadBalancerAttribute
- ex_list_certificates(certificate_ids=[])[source]¶
List all server certificates
- Parameters:
certificate_ids (
str
) – certificate ids to filter results- Returns:
certificates
- Return type:
SLBServerCertificate
- ex_list_listeners(balancer)[source]¶
Get all listener related to the given balancer
- Parameters:
balancer (
LoadBalancer
) – the balancer to list listeners- Returns:
a list of listeners
- Return type:
list
ofSLBLoadBalancerListener
- ex_set_certificate_name(certificate_id, name)[source]¶
Set server certificate name.
- Parameters:
certificate_id (
str
) – the id of the server certificate to updatename (
str
) – the new name
- Returns:
whether updating is success
- Return type:
bool
- ex_start_listener(balancer, port)[source]¶
Start balancer’s listener listening the given port.
- Parameters:
balancer (
LoadBalancer
) – a load balancerport (
int
) – listening port
- Returns:
whether operation is success
- Return type:
bool
- ex_stop_listener(balancer, port)[source]¶
Stop balancer’s listener listening the given port.
- Parameters:
balancer (
LoadBalancer
) – a load balancerport (
int
) – listening port
- Returns:
whether operation is success
- Return type:
bool
- ex_upload_certificate(name, server_certificate, private_key)[source]¶
Upload certificate and private key for https load balancer listener
- Parameters:
name (
str
) – the certificate nameserver_certificate (
str
) – the content of the certificate to upload in PEM formatprivate_key (
str
) – the content of the private key to upload in PEM format
- Returns:
new created certificate info
- Return type:
SLBServerCertificate
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters:
balancer_id (
str
) – id of a load balancer you want to fetch- Return type:
LoadBalancer
- list_balancers(ex_balancer_ids=None, ex_filters=None)[source]¶
List all loadbalancers
@inherits
Driver.list_balancers
- Parameters:
ex_balancer_ids (
list
ofstr
) – a list of balancer ids to filter results Only balancers which’s id in this list will be returnedex_filters (
dict
) – attributes to filter results. Only balancers which have all the desired attributes and values will be returned
- name = 'Aliyun Server Load Balancer'¶
- namespace = None¶
- path = '/'¶
- website = 'https://www.aliyun.com/product/slb'¶