SoftLayer.load_balancer¶
Load Balancer Manager/helpers
license: | MIT, see LICENSE for more details. |
---|
- class SoftLayer.managers.load_balancer.LoadBalancerManager(client)[source]¶
Manages load balancers.
Parameters: client (SoftLayer.API.Client) – the API client instance - add_local_lb(price_item_id, datacenter)[source]¶
Creates a local load balancer in the specified data center
Parameters: - price_item_id (int) – The price item ID for the load balancer
- datacenter (string) – The datacenter to create the loadbalancer in
Returns: A dictionary containing the product order
- add_service(loadbal_id, service_group_id, ip_address_id, port=80, enabled=True, hc_type=21, weight=1)[source]¶
Adds a new service to the service group
Parameters: - loadbal_id (int) – The id of the loadbal where the service resides
- service_group_id (int) – The group to add the service to
- ip_address id (int) – The ip address ID of the service
- port (int) – the port of the service
- enabled (bool) – Enable or disable the service
- hc_type (int) – The health check type
- weight (int) – the weight to give to the service
- add_service_group(lb_id, allocation=100, port=80, routing_type=2, routing_method=10)[source]¶
Adds a new service group to the load balancer
Parameters: - loadbal_id (int) – The id of the loadbal where the service resides
- allocation (int) – percent of connections to allocate toward the group
- port (int) – the port of the service group
- routing_type (int) – the routing type to set on the service group
- routing_method (int) – The routing method to set on the group
- cancel_lb(loadbal_id)[source]¶
Cancels the specified load balancer.
Parameters: loadbal_id (int) – Load Balancer ID to be cancelled.
- delete_service(service_id)[source]¶
Deletes a service from the loadbal_id
Parameters: service_id (int) – The id of the service to delete
- delete_service_group(group_id)[source]¶
Deletes a service group from the loadbal_id
Parameters: group_id (int) – The id of the service group to delete
- edit_service(loadbal_id, service_id, ip_address_id=None, port=None, enabled=None, hc_type=None, weight=None)[source]¶
Edits an existing service properties
Parameters: - loadbal_id (int) – The id of the loadbal where the service resides
- service_id (int) – The id of the service to edit
- ip_address (string) – The ip address of the service
- port (int) – the port of the service
- enabled (bool) – enable or disable the search
- hc_type (int) – The health check type
- weight (int) – the weight to give to the service
- edit_service_group(loadbal_id, group_id, allocation=None, port=None, routing_type=None, routing_method=None)[source]¶
Edit an existing service group
Parameters: - loadbal_id (int) – The id of the loadbal where the service resides
- group_id (int) – The id of the service group
- allocation (int) – the % of connections to allocate to the group
- port (int) – the port of the service group
- routing_type (int) – the routing type to set on the service group
- routing_method (int) – The routing method to set on the group
- get_hc_types()[source]¶
Retrieves the health check type values
Returns: A dictionary containing the health check types
- get_ip_address(ip_address=None)[source]¶
Retrieves the IP address object given the ip address itself
Returns: A dictionary containing the IP address properties
- get_lb_pkgs()[source]¶
Retrieves the local load balancer packages.
Returns: A dictionary containing the load balancer packages
- get_local_lb(loadbal_id, **kwargs)[source]¶
Returns a specified local load balancer given the id.
Parameters: loadbal_id (int) – The id of the load balancer to retrieve Returns: A dictionary containing the details of the load balancer
- get_local_lbs()[source]¶
Returns a list of all local load balancers on the account.
Returns: A list of all local load balancers on the current account.
- get_routing_methods()[source]¶
Retrieves the load balancer routing methods.
Returns: A dictionary containing the load balancer routing methods
- get_routing_types()[source]¶
Retrieves the load balancer routing types.
Returns: A dictionary containing the load balancer routing types
- reset_service_group(loadbal_id, group_id)[source]¶
Resets all the connections on the service group
Parameters: - loadbal_id (int) – The id of the loadbal
- group_id (int) – The id of the service group to reset
- resolve_ids(identifier)¶
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters: identifier (string) – identifying string Returns list: