Request Deployment
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.
- Verify that all general prerequisites and prerequisites for both theAutomation Service BrokerCatalog service and theAutomation Service BrokerDeployment 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.
- Assign the project ID variable.project_id='<your_project_id>'
- Assign the catalog item ID variable.catalog_item_id='<your_catalog_item_id>'
- List the available versions of the catalog item that can be requested.curl -X GET \ $url/catalog/api/items/$catalog_item_id/versions \ -H "Authorization: Bearer $access_token" | jq "."
- Examine the response to verify the version of the item that you want has been published to the catalog.
- Assign the catalog item version.catalog_item_version='<your_catalog_item_version>'
- Assign your deployment name variable.deployment_name='<your_deployment_name>'If your deployment name includes spaces, use double quotes as in the following example.deployment_name="This deployment name includes spaces"
- To ensure that the deployment name you plan to use does not already exist, list all deployments.curl -X GET \ -G --data-urlencode "name=$deployment_name" \ $url/deployment/api/deployments?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" | jq "."
- Examine the response. If your deployment name appears, create a new name and reassign your deployment name variable.
- To deploy a cloud template, assign variables for image mapping and flavor mapping.image_mapping='<your_image_mapping_name>' flavor_mapping='<your_flavor_mapping_name>'The image mapping specifies the OS image for a VM. The flavor mapping specifies the CPU count and RAM of a VM.
- Request the deployment from a 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 "."Theinputsfield includes values for request time variables such as size, image, or password.
- To obtain the deployment ID, examine the response.
- Assign the deployment ID variable.deployment_id='<your_deployment_id>'
- Get the status of the deployment.curl -X GET \ $url/deployment/api/deployments/$deployment_id?apiVersion=$api_version \ -H "Authorization: Bearer $access_token" | jq "."
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" }