To change the lease on your deployment, you use the Deployment APIs to make a POST request with a new lease expiration date.

Prerequisites

Procedure

  1. Assign your deployment ID variable.
    deployment_id='<your_deployment_id>'
  2. Get a list of actions available for your deployment.
    curl -X GET \
      $url/deployment/api/deployments/$deployment_id/actions?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."
  3. Examine the response.
    • Confirm that you see the action "name": "ChangeLease".
    • "valid":true indicates that the action is valid for the deployment.
  4. Assign the action ID variable for the action "name": "ChangeLease".
    action_id='Deployment.ChangeLease'
  5. List the deployment actions for the action ID .
    curl -X GET \
      $url/deployment/api/deployments/$deployment_id/actions/$action_id?apiVersion=$api_version \
      -H "Authorization: Bearer $access_token" | jq "."
  6. Examine the response. The schema field shows the format of the input for an action on the deployment.
  7. To change the lease on the deployment, assign the lease expiry date using the format specified in the schema as in the following example.
    lease_expiry_date=2021-05-15T23:11:00Z
  8. Change the lease expiration date.
    curl -X POST \
      $url/deployment/api/deployments/$deployment_id/requests \
      -H "Authorization: Bearer $access_token" \
      -H 'Content-Type: application/json' \
      -d '{
        "actionId":"Deployment.ChangeLease",
        "inputs": {
            "Lease Expiration Date": "'"$lease_expiry_date"'"
        }
    }' | 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: Change the Lease on Your Deployment

Change the lease on your deployment with ID 5551a299-8b67-45e3-909e-a638d11b0d9f.

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'

List the actions available for your deployment.

$ curl -X GET \
  $url/deployment/api/deployments/$deployment_id/actions?apiVersion=$api_version \
  -H "Authorization: Bearer $access_token" | jq "."

A snippet of the response shows Deployment.ChangeLease.

...
{
    "id": "Deployment.ChangeLease",
    "name": "ChangeLease",
    "displayName": "Change Lease",
    "description": "Set a deployment's expiration date",
    "valid": true,
    "actionType": "RESOURCE_ACTION"
  }
...

Assign the action ID variable.

$ action_id='Deployment.ChangeLease'

To get the schema for your action, list the deployment actions by ID.

$ curl -X GET \
  $url/deployment/api/deployments/$deployment_id/actions/$action_id?apiVersion=$api_version \
  -H "Authorization: Bearer $access_token" | jq "."

A snippet of the response provides the schema for the lease expiration date.

...        
      "properties": {
      "Deployment expires in": {
        "type": "string",
        "readOnly": true,
        "default": "9d 21h 27m"
      },
      "Lease Expiration Date": {
        "type": "string",
        "title": "Lease Expiration Date",
        "description": "The lease can be extended by up to 90d 0h 0m",
        "format": "date-time",
        "formatMinimum": "2021-02-12T21:47:00Z",
        "formatMaximum": "2021-05-20T19:15:00Z",
        "default": "2021-02-22T19:15:00Z"
...

Assign the lease expiry date variable in the propert format.

$ lease_expiry_date=2021-05-15T23:11:00Z

Submit a request to change the lease expiration.

$ curl -X POST \
  $url/deployment/api/deployments/$deployment_id/requests \
  -H "Authorization: Bearer $access_token" \
  -H 'Content-Type: application/json' \
  -d '{
    "actionId":"Deployment.ChangeLease",
    "inputs": {
        "Lease Expiration Date": "'"$lease_expiry_date"'"
    }
}' | jq "."

A snippet of the response shows request ID.

...
  "id": "6b9b5534-0d84-4f07-9941-5c3cc26f7e3b",
  "name": "Change Lease",
  "deploymentId": "5551a299-8b67-45e3-909e-a638d11b0d9f",
...

Assign the request ID variable.

$ request_id='6b9b5534-0d84-4f07-9941-5c3cc26f7e3b'

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": "Deployment.ChangeLease",
  "completedTasks": 1,
  "totalTasks": 1,
  "status": "SUCCESSFUL"
}