LoadBalancersResource


Create a load balancer


Define a new load balancer in the location, which may be assigned to a virtual datacenter.
Note: use the load balancer media type with the embedded entities (routingRule, healthCheck and addresses)

When the operation returns a load balancer without a *providerId* it means the entity was successfuly stored in the Abiquo database but it was missing some information so it could not be properly created in the provider. In this case, the load balancer can be created in the provider with an Update a load balancer request, and the *providerId* will be added.
For example, some providers require the ''virtualdatacenter'' link in creation.

Reusing an existing load balancer address:
Some providers allow the reuse of addresses from other load balancers. You can check this capability with the plugin constraint *LOADBALANCER_ADDRESSESS_REUSE*. This is useful in Rackspace where HTTP/HTTPS is represented using two different load balancer configurations (which share the same entry point). To use this functionality, send the link of the load balancer address instead of or in conjunction with the ''loadBalancerAddress'' element in the load balancer representation.

Note the sslcertificate is never stored or returned by the Abiquo API, so the request requires all the information to actually create the loadbalancer in the provider (eg. AWS will need the ''privatenetwork'' subnet link)

If the provider supports firewalls you should synchronize firewall rules before creating the load balancer inside a virtual datacenter, in order to properly assign a firewall to the load balancer. Otherwise a LOADBALANCER-21 error is raised "Firewall not found while importing load balancer; try to synchronize firewalls before load balancers" .

POST https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers

Roles : [ROLE_MANAGE_LOADBALANCERS]

Content-Type : loadbalancer Accept : loadbalancer

Error Codes

  • CONSTR-REQUIRED - HealthCheck : The property 'name' must have a value.
  • GEN-6 - Invalid link reference with rel virtualdatacenter
  • LOADBALANCER-11 - Selected private networks are not in the same virtual datacenter
  • LOADBALANCER-12 - Selected firewalls are not in the same virtual datacenter
  • LOADBALANCER-13 - Certificate cannot be stored in the provider. Ensure the load balancer is properly created
  • LOADBALANCER-18 - The requested SSL certificate does not exist
  • LOADBALANCER-21 - Firewall not found while importing load balancer; try to synchronize firewalls before load balancers
  • LOADBALANCER-24 - Load balancer requires at least one routing rule
  • LOADBALANCER-25 - Create VLAN networks (or elastic IPs) in the provider before assigning them to the load balancer
  • LOADBALANCER-28 - Plugin does not support the specified network type, check LOADBALANCER_SUBNETS_TYPE constraint
  • LOADBALANCER-29 - Plugin does not support the association of a load balancer with a virtual datacenter and it does not support the use of private networks with load balancers
  • LOADBALANCER-4 - A routing rule with the same port in and port out already exists for the load balancer
  • LOADBALANCER-6 - Not all required fields are present for the embedded SSL certificate
  • LOADBALANCER-7 - A link to the SSL certificate or the embedded form must be used, but not both at the same time.
  • LOADBALANCER-9 - There is already one health check with the same path and protocol in the load balancer
  • LOCATION-4 - The location does not exist
  • LOCATION-5 - The given virtual datacenter is not compatible with the given location
  • NETDEVICE-5 - The entity is associated with a device that is not configured in the current virtual datacenter
  • VDC-0 - The requested virtual datacenter does not exist

Example

List load balancers


Retrieve a list of all load balancers created in a location.
Remember it's also possible to retrieve load balancers from the virtual datacenter

GET https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers

Roles : [ROLE_MANAGE_LOADBALANCERS]

Parameter Type Default Value Description
startwith Integer 0 The first element to be retrieved of the filtered search
by String name Parameter for ordering. Valid values {@link com.abiquo.server.core.cloud.LoadBalancer.ORDER_BY}
has String If present filter to apply in the search.
limit Integer 25 The number of entities to retrieve
asc Boolean true If the value of the 'by' parameter must be sorted in ascending order (true) or descending order (false)
vdcs String Requires source==REMOTE. Comma separated list of virtual datacenter IDs, only import if the loadbalancer belongs to one of them
source String LOCAL Use ''REMOTE'' to force synchronization with the provider
syncvms boolean false Requires source==REMOTE. Registered VMs of new or updated load balancers will be synchronized.

Accept : loadbalancers

Error Codes

  • LOCATION-4 - The location does not exist
  • NETDEVICE-1 - The device does not exist
  • VDC-0 - The requested virtual datacenter does not exist

Example

Delete a load balancer


Deletes a load balancer and all its related entities (routing rules and health checks)

DELETE https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}

Roles : [ROLE_MANAGE_LOADBALANCERS]

Parameter Type Default Value Description
force boolean false If true, logical delete is performed

Example

Get a load balancer


Retrieves a load balancer

GET https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}

Roles : [ROLE_MANAGE_LOADBALANCERS]

Parameter Type Default Value Description
source String LOCAL Use ''REMOTE'' to force the synchronization with the provider
syncvms boolean false Requires source==REMOTE. Registered VMs of new or updated load balancers will be synchronized.

Accept : loadbalancer

Error Codes

  • LOADBALANCER-1 - The requested load balancer does not exist
  • LOCATION-4 - The location does not exist
  • NETDEVICE-1 - The device does not exist

Example

Update a load balancer


Depending on the provider, some elements of the load balancer may not be changed. For example, in AWS you cannot change the name of the load balancer, whereas in RackSpace you can.
Note: DO NOT use the load balancer media type with the embedded entities (routingRule, healthCheck and addresses), instead use the subresources paths returned in the load balancer

PUT https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}

Roles : [ROLE_MANAGE_LOADBALANCERS]

Content-Type : loadbalancer Accept : loadbalancer

Error Codes

  • CONSTR-LENGTH - The property 'name' length must be between 1 and 128.
  • LOADBALANCER-1 - The requested load balancer does not exist
  • LOADBALANCER-11 - Selected private networks are not in the same virtual datacenter
  • LOADBALANCER-12 - Selected firewalls are not in the same virtual datacenter
  • LOADBALANCER-22 - Cannot embed RoutingRules, HealthChecks or LoadBalancerAddresses during modify, use sub-resources instead
  • LOADBALANCER-25 - Create VLAN networks (or elastic IPs) in the provider before assigning them to the load balancer
  • LOCATION-5 - The given virtual datacenter is not compatible with the given location
  • NETDEVICE-5 - The entity is associated with a device that is not configured in the current virtual datacenter

Example

List load balancer addresses of a load balancer


GET https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}/addresses

Roles : [ROLE_MANAGE_LOADBALANCERS]

Example

List health check state of all the virtual machines registered in the load balancer


Perform a check in the provider to determine the current state of the load balancer members.

GET https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}/healthstates

Roles : [ROLE_MANAGE_LOADBALANCERS]

Accept : healthstates

Error Codes

  • LOADBALANCER-1 - The requested load balancer does not exist
  • LOCATION-4 - The location does not exist
  • NETDEVICE-1 - The device does not exist

Example

List virtual machines flat registered in the load balancer


GET https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}/virtualmachines

Roles : [ROLE_MANAGE_LOADBALANCERS, ROLE_ASSIGN_LOADBALANCERS]

Example

List virtual machines registered in the load balancer


Retrieves the virtual machines currently attached to a load balancer

GET https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}/virtualmachines

Roles : [ROLE_MANAGE_LOADBALANCERS, ROLE_ASSIGN_LOADBALANCERS]

Accept : links

Error Codes

  • LOADBALANCER-1 - The requested load balancer does not exist
  • LOCATION-4 - The location does not exist

Example

Update virtual machines registered in a load balancer


Updates the virtual machines attached to a load balancer.
The given virtual machine links must be valid and virtual machines must be present in the load balancer's location. If the load balancer is assigned to a virtual datacenter, virtual machines must be in the same virtual datacenter.

If the load balancer is not already created (no ''providerId'') in the provider, the process will fail.

PUT https://example.com/api/cloud/locations/{location}/devices/{device}/loadbalancers/{loadbalancer}/virtualmachines

Roles : [ROLE_MANAGE_LOADBALANCERS, ROLE_ASSIGN_LOADBALANCERS]

Content-Type : links Accept : links

Error Codes

  • LOADBALANCER-1 - The requested load balancer does not exist
  • LOADBALANCER-15 - Virtual machines cannot be attached to load balancer in the provider. Ensure the load balancer is properly created
  • LOADBALANCER5-16 - Given virtual machines are not compatible with the load balancer
  • LOCATION-4 - The location does not exist
  • PUBLIC-10 - The enterprise does not have credentials for this provider
  • PUBLIC-9 - Plugin not loaded or not a cloud provider
  • RS-2 - The remote service does not exist
  • VAPP-0 - The requested virtual appliance does not exist
  • VDC-0 - The requested virtual datacenter does not exist
  • VM-1 - The requested virtual machine does not exist
  • VM-68 - Malformed virtual machine link

Example