aliyun.slb.model module

class aliyun.slb.model.BackendServer(instance_id, weight)[source]

Bases: object

BackendServer describing ECS instances attached to an SLB

Parameters:
  • instance_id (str) – ECS InstanceId (also SLB ServerId) attached
  • weight (int) – SLB weight. Between 1 and 1000. Default 100.
Properties:
status (str): (read-only) SLB ServerHealthStatus either ‘normal’ or ‘abnormal’
class aliyun.slb.model.BackendServerStatus(server_id, status)[source]

Bases: object

class aliyun.slb.model.HTTPListener(load_balancer_id, listener_port, backend_server_port, listener_status='active', scheduler='wrr', health_check=False, connect_timeout=5, interval=2, x_forwarded_for=False, sticky_session=False, sticky_session_type=None, cookie_timeout=None, cookie=None, domain=None, uri='')[source]

Bases: aliyun.slb.model.Listener

HTTP Load Balancer Listener

Parameters:
  • load_balancer_id (str) – LoadBalancerId unique identifier of the SLB.
  • listener_port (int, required) – port the Load Balancer listens on
  • backend_server_port (int, required) – port number to connect to servers
  • listener_status (str) – ‘active’ (default) or ‘stopped’
  • scheduler (str) – wrr or wlc. Round Robin (default) or Least Connections.
  • health_check (bool) – True for ‘on’ and False for ‘off’ (default)
  • connect_timeout (int) – number of seconds to timeout and fail a health check
  • interval (int) – number of seconds between health checks
  • x_forwarded_for (bool) – Wether or not to append IPs to X-Fordwarded-For HTTP header
  • sticky_session (bool) – Use SLB Sticky Sessions. Default False.
  • sticky_session_type (str) – ‘insert’ to have the SLB add a cookie to requests ‘server’ to have the SLB look for a server-injected cookie sticky_session must be ‘on’
  • cookie_timeout (int [0-86400]) – Lifetime of cookie in seconds. Max 1 day. sticky_session must be True.
  • cookie (str) – The Cookie key to use as sticky_session indicator. sticky_session_type must be ‘server’
  • domain (str) – the Host header to use for the health check
  • uri (str) – URL path for healthcheck. E.g. /health
class aliyun.slb.model.Listener(load_balancer_id, listener_port, backend_server_port, listener_status=None, scheduler='wrr', health_check=False, connect_timeout=5, interval=2)[source]

Bases: object

(Abstract by use) base class for LoadBalancerListeners

Parameters:
  • load_balancer_id (int, required) – ID of the SLB instance
  • listener_port (int, required) – port the Load Balancer listens on
  • backend_server_port (int, required) – port number to connect to servers
  • listener_status (str) – ‘active’ (default) or ‘stopped’.
  • scheduler (str) – wrr or wlc. Round Robin (default) or Least Connections.
  • health_check (bool) – True for ‘on’ and False for ‘off’ (default)
  • healthy_threshold (int) – number of health check successes to become healthy
  • unhealthy_threshold (int) – number of health check failures to become unhealthy
  • connect_timeout (int) – number of seconds to timeout and fail a health check
  • interval (int) – number of seconds between health checks
class aliyun.slb.model.ListenerStatus(listener_port, backend_servers=None)[source]

Bases: object

Status for listener port and backend server list pairings.

Parameters:
  • listener_port (int) – Number between 1 and 65535.
  • backend_servers (list of BackendServerStatus) –
class aliyun.slb.model.LoadBalancer(load_balancer_id, region_id, load_balancer_name, load_balancer_status, address, address_type, listener_ports, backend_servers=None)[source]

Bases: object

An Aliyun Server Load Balancer (SLB) instance. Modeled after the DescribeLoadBalancerAttribute SLB API.

Parameters:
  • load_balancer_id (str) – unique identifier of the SLB.
  • region_id (str) – region id for the SLB.
  • load_balancer_name (str) – description of the SLB.
  • load_balancer_status (str) – status of the SLB. ‘inactive’ or ‘active’
  • address (str) – IP address of the SLB.
  • address_type (str) – internet vs intranet
  • listener_ports (list int) – Ports which have listeners
  • backend_servers (list of BackendServer, optional) – BackendServers to put into the load balancer
class aliyun.slb.model.LoadBalancerStatus(load_balancer_id, load_balancer_name, status)[source]

Bases: object

Simple status of SLB

Parameters:
  • load_balancer_id (str) – LoadBalancerId unique identifier of the SLB.
  • load_balancer_name (str) – name of the SLB.
  • status (str) – SLB status.
class aliyun.slb.model.Region(region_id)[source]

Bases: object

class aliyun.slb.model.TCPListener(load_balancer_id, listener_port, backend_server_port, listener_status='active', scheduler='wrr', health_check=False, connect_timeout=5, interval=2, connect_port=None, persistence_timeout=0)[source]

Bases: aliyun.slb.model.Listener

TCP Load Balancer Listener

Parameters:
  • load_balancer_id (str) – LoadBalancerId unique identifier of the SLB.
  • listener_port (int, required) – port the Load Balancer listens on
  • backend_server_port (int, required) – port number to connect to servers
  • listener_status (str) – ‘active’ (default) or ‘stopped’.
  • scheduler (str) – wrr or wlc. Round Robin (default) or Least Connections.
  • health_check (bool) – True for ‘on’ and False for ‘off’ (default)
  • connect_timeout (int) – number of seconds to timeout and fail a health check
  • interval (int) – number of seconds between health checks
  • connect_port (int) – defaults to backend_server_port
  • persistence_timeout (int) – number of seconds to hold TCP connection open