To reconfigure the load balancer in your deployment, you use the Deployment APIs to make a POST request with the ID of the load balancer to update.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Service Broker Deployment service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you have the ID of the deployment you want to reconfigure. See Deploy a Cloud Template with Contents Inline.
- Verify that you have the ID of the load balancer in your deployment. See Get Deployment Resource IDs.
Procedure
Example: Reconfigure the Load Balancer in Your Deployment
For your deployment with ID 5551a299-8b67-45e3-909e-a638d11b0d9f, reconfigure the load balancer with resource ID d5b4569d-2234-4fc4-a594-45e6b0251588.
Assign variables.
$ url='https://appliance.domain.com'
$ api_version='2020-08-25'
$ deployment_id='5551a299-8b67-45e3-909e-a638d11b0d9f'
Assign the load balancer ID.
$ load_balancer_id='d5b4569d-2234-4fc4-a594-45e6b0251588'
List the actions available for the load balancer resource.
$ curl -X GET \ $url/deployment/api/deployments/$deployment_id/resources/$load_balancer_id/actions?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response shows LoadBalancer.Reconfigure action.
... { "id": "Cloud.LoadBalancer.LoadBalancer.Reconfigure", "name": "LoadBalancer.Reconfigure", "displayName": "Reconfigure", "description": "Reconfigure Load Balancer", "valid": true, "actionType": "RESOURCE_ACTION" } ...
Assign the action ID variable.
$ reconfigure_action_id='Cloud.LoadBalancer.LoadBalancer.Reconfigure'
To get the schema for your action, list the resource actions by ID.
$ curl -X GET \ $url/deployment/api/deployments/$deployment_id/resources/$load_balancer_id/actions/$reconfigure_action_id?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response provides the schema for the load balancing action.
... "schema": { "type": "object", "title": "Reconfigure Load Balancer", "description": "Request schema for updating routes of load balancer resource", "properties": { "routes": { "type": "array", "items": { "type": "object", "properties": { "protocol": { "type": "string", "title": "Protocol", "description": "The communication protocol for an incoming request to the load balancer. HTTP, HTTPS, or TCP.", "enum": [ "HTTP", "HTTPS", "TCP" ] }, "port": { "type": "string", "title": "Port", "description": "The listening port for an incoming request to the load balancer.", "pattern": "^\\d+$" }, "instanceProtocol": { "type": "string", "title": "Instance protocol", "description": "The communication protocol used between the load balancer and the machines in the pool. HTTP, HTTPS, or TCP.", "enum": [ "HTTP", "HTTPS", "TCP" ] ...
Submit a request to reconfigure the load balancer with new route properties.
$ curl -X POST \ $url/deployment/api/deployments/$deployment_id/resources/$load_balancer_id/requests \ -H "Authorization: Bearer $access_token" \ -H 'Content-Type: application/json' \ -d '{ "actionId": "Cloud.LoadBalancer.LoadBalancer.Reconfigure", "inputs": { "routes": [ { "port": "81", "protocol": "TCP", "instancePort": "81", "instanceProtocol": "TCP", "healthCheckConfiguration": { "port": "81", "urlPath": "/index.html", "protocol": "HTTP", "timeoutSeconds": 5, "intervalSeconds": 60, "healthyThreshold": 2, "unhealthyThreshold": 5 } } ] } }' | jq "."
A snippet of the response shows request ID.
... "id": "7342a348-65e0-4376-9472-94be56b928a9", "name": "Reconfigure", "deploymentId": "13c04d0a-fd81-4bcc-99b1-ac499fb1821d", ...
Assign the request ID variable.
$ request_id='342a348-65e0-4376-9472-94be56b928a9'
Check the status of the request.
$ curl -X GET \ $url/deployment/api/requests/$request_id?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response shows that the request was successful.
... "actionId": "Cloud.LoadBalancer.LoadBalancer.Reconfigure", "completedTasks": 1, "totalTasks": 1, "status": "SUCCESSFUL", }