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

Procedure

  1. Assign your deployment ID variable.
    deployment_id='<your_deployment_id>'
  2. Assign your load balancer ID variable.
    load_balancer_id='<your_load_balancer_id>'
  3. Get a list of actions available for the load balancer in your deployment.
    curl -X GET \
      $url/deployment/api/deployments/$deployment_id/resources/$load_balancer_id/actions?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."
  4. Examine the response.
    • Confirm that you see the action "name": "LoadBalancer.Reconfigure".
    • "valid":true indicates that the action is valid for the deployment resource.
  5. Assign the action ID variable for the reconfigure action "name": "LoadBalancer.Reconfigure".
    reconfigure_action_id='Cloud.LoadBalancer.LoadBalancer.Reconfigure'
  6. List the resource actions for the action 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 "."
  7. Examine the response. The schema field shows the format of the input for an action on the load balancer resource.
  8. Reconfigure the load balancer with input inline.
    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 "."
  9. Examine the response and assign the request ID.
    request_id='<your_request_id>'
  10. Check the status of the request.
    curl -X GET \
      $url/deployment/api/requests/$request_id?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."
    If the request is successful, the response shows "status":"SUCCESSFUL".

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.

Note: If your organization uses an API service that is hosted outside of the United States, your URL variable must include a country abbreviation. See Regional Endpoints for VMware Aria Automation APIs.
$ url='https://api.mgmt.cloud.vmware.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",
}