To change the lease on your deployment, you use the Deployment APIs to make a POST request with a new lease expiration date.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Automation 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.
Procedure
Example: Change the Lease on Your Deployment
Change the lease on your deployment with ID 5551a299-8b67-45e3-909e-a638d11b0d9f.
Assign variables.
$ url='https://appliance.domain.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" }