To request a deployment from a catalog item, you make a POST request with a project ID that has a cloud template version released to the project. The request body includes the ID of the catalog item from which you are requesting the deployment, and the version of the released cloud template.
Prerequisites
- Verify that all general prerequisites and prerequisites for both the Automation Service Broker Catalog service and the Automation Service Broker Deployment service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that the flavor mapping and image mapping specified in the released cloud template version exist in your cloud account. See Create Flavor Mappings and Create Image Mappings.
- Verify that you have the ID for a project that has the cloud template versioned and released to it. See the prerequisites section of Create and Update a Cloud Template.
- Verify that you have the ID of the catalog item from which you plan to request a deployment. See Create a Catalog Source and List Discovered Items.
- Verify that you have the version of a cloud template released to the project that you want to request for deployment. See Version and Release a Cloud Template to a VMware Aria Automation Service Broker Catalog.
- Verify that you have created an entitlement for your catalog item or create one using Create a Content Sharing Policy.
Procedure
Example: Request Deployment of a Cloud Template from a Catalog Item
Request the deployment of a cloud template with catalog item ID 718917c0-1e02-3141-8142-11da5acaed8f. When requesting the deployment, set image mapping set to ubuntu and flavor mapping set to small.
Assign variables.
$ url='https://appliance.domain.com'
$ api_version='2020-08-25'
$ project_id='394a4ccb-22c6-4ef0-8c75-8b77efbefb51'
$ catalog_item_id='718917c0-1e02-3141-8142-11da5acaed8f'
List available versions.
$ curl -X GET \ $url/catalog/api/items/$catalog_item_id/versions \ -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response shows version numbers.
... { "id": "v2", "description": "Creating a version from the current draft", "createdAt": "2021-11-087T19:33:04.445Z" }, { "id": "v1", "description": "Creating a version from the current draft", "createdAt": "2021-11-08T19:25:43.327Z" } ...
Assign the catalog item version number.
$ catalog_item_version='v2'
Assign a deployment name and check to ensure that it does not already exist.
$ deployment_name="Example Deployment of Cloud Template" $ curl -X GET \ -G --data-urlencode "name=$deployment_name" \ $url/deployment/api/deployments?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response shows existing deployments. Example Deployment of Cloud Template is not listed.
{ "id": "c14e787f-60ee-4cce-a5b5-c9440bf181ab", "name": "Not Example Deployment", "orgId": "c9258a19-fef0-4431-a999-d711e1741c60", "catalogItemId": "947b9db2-cf89-3b83-8035-bbcf83bd4c34", ...
To deploy a cloud template, you must assign image mapping and flavor mapping variables.
$ image_mapping='ubuntu' $ flavor_mapping='small'
Request a deployment from the catalog item.
$ curl -X POST \ $url/catalog/api/items/$catalog_item_id/request?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" \ -H 'Content-Type: application/json' \ -d '{ "deploymentName":"'"$deployment_name"'", "projectId":"'"$project_id"'", "inputs":{ "count":1, "image":"'"$image_mapping"'", "flavor":"'"$flavor_mapping"'" }, "version":"'"$catalog_item_version"'" }' | jq "."
The response provides the deployment ID.
{ "deploymentId": "3721d9e2-fce3-48eb-96e5-d8f381354610", "deploymentName": "Example Deployment of Cloud Template" }
Assign the deployment ID.
$ deployment_id='3721d9e2-fce3-48eb-96e5-d8f381354610'
Get the deployment status.
$ curl -X GET \ $url/deployment/api/deployments/$deployment_id?apiVersion=$api_version" -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response shows the deployment status.
}, "projectId": "394a4ccb-22c6-4ef0-8c75-8b77efbefb51", "status": "CREATE_SUCCESSFUL" }