Load Balancers

OneAndOne::LoadBalancer()

The LoadBalancer class allows a user to perform actions against the 1and1 API.

list(page: nil, per_page: nil, sort: nil, q: nil, fields: nil)

Return a list of all load balancers.

Parameters:
  • page (int) – Allows the use of pagination. Indicate which page to start on.
  • per_page (int) – Number of items per page.
  • sort (str) – sort: 'name' retrieves a list of elements sorted alphabetically. sort: 'creation_date' retrieves a list of elements sorted by their creation date in descending order.
  • q (str) – q is for query. Use this parameter to return only the items that match your search query.
  • fields (str) – Returns only the parameters requested. (i.e. fields: ‘id, name, description, hardware.ram’)
Return type:

JSON

create(name: nil, description: nil, health_check_test: nil, health_check_interval: nil, persistence: nil, persistence_time: nil, method: nil, rules: nil, health_check_path: nil, health_check_parse: nil)

Create a load balancer.

Parameters:
  • name (str) – load balancer name.
  • description (str) – load balancer description.
  • health_check_test (str) – possible values are "NONE" or "TCP".
  • health_check_interval (int) – Health check period in seconds. Can range between 5 and 300 seconds.
  • persistence (bool) – enable or disable persistence.
  • persistence_time (int) – Persistence time in seconds. Required if persistence is enabled. Can range from 30 to 1200 seconds
  • method (str) – balancing procedure. Possible values are "ROUND_ROBIN" or "LEAST_CONNECTIONS".
  • rules (array) – takes an array of “rule” objects to be added to the load balancer.
  • health_check_path (str) – Url to call for checking. Required for HTTP health check.
  • health_check_parse (str) – Regular expression to check. Required for HTTP health check.
get(load_balancer_id: @id)

Returns the current specs of a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
Return type:

JSON

modify(load_balancer_id: @id, name: nil, description: nil, health_check_test: nil, health_check_interval: nil, persistence: nil, persistence_time: nil, method: nil, health_check_path: nil, health_check_parse: nil)

Modify a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
  • name (str) – load balancer name.
  • description (str) – load balancer description.
  • health_check_test (str) – possible values are "NONE",``”TCP”, or ``"HTTP".
  • health_check_interval (int) – Health check period in seconds.
  • persistence (bool) – enable or disable persistnece.
  • persistence_time (int) – Persistence time in seconds. Required if persistence is enabled.
  • method (str) – balancing procedure. possible values are "ROUND_ROBIN" or "LEAST_CONNECTIONS".
  • health_check_path (str) – Url to call for checking. Required for HTTP health check.
  • health_check_parse (str) – Regular expression to check. Required for HTTP health check.
Return type:

JSON

delete(load_balancer_id: @id)

Delete a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
Return type:

JSON

ips(load_balancer_id: @id)

Returns a list of the IP’s assigned to a load balancer.

Delete a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
Return type:

JSON

ip(load_balancer_id: @id, ip_id: nil)

Returns information about an IP assigned to a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
  • ip_id (str) – the unique identifier for the IP.
Return type:

JSON

remove_ip(load_balancer_id: @id, ip_id: nil)

Remove an IP from a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
  • ip_id (str) – the unique identifier for the IP.
Return type:

JSON

add_ips(load_balancer_id: @id, ips: nil)

Assign IP’s to a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
  • ips (array) – takes an array of IP strings to be added to the load balancer.
Return type:

JSON

rules(load_balancer_id: @id)

Returns a list of the load balancer’s rules.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
Return type:

JSON

rule(load_balancer_id: @id, rule_id: nil)

Returns information about a load balancer’s rule.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
  • rule_id (str) – the unique identifier for the rule.
Return type:

JSON

add_rules(load_balancer_id: @id, rules: nil)

Add rules to a load balancer.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
  • rules (array) – takes an array of “rule” objects to be added to the load balancer.
Return type:

JSON

remove_rule(load_balancer_id: @id, rule_id: nil)

Remove a load balancer’s rule.

Parameters:
  • load_balancer_id (str) – the unique identifier for the load balancer.
  • rule_id (str) – the unique identifier for the rule.
Return type:

JSON

wait_for()

Polls the load balancer until an “ACTIVE” state is returned. Use this when chaining actions.

Return type:nil