When creating a cloud zone, you can specify a folder with a path that relates to a datacenter, so that when you deploy a machine you deploy it to that folder.
The following procedure shows how to find a folder that you can use when creating a cloud zone.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Cloud Assembly Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
Note: Users with the following RBAC permissions can also use the folder API to create a cloud zone:
- provisioning_cloud-zones_read
- provisioning_cloud-zones_manage
- Verify that you have the cloud account ID for the cloud account with the folder that you want to use. See Add a vSphere Cloud Account.
Procedure
Results
Example: Create a Cloud Zone with a Folder
Assign variables and specify an ID for a vSphere cloud account.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ cloud_account_id='2636b316-b514-47f3-93b8-78f18df51a29'
List the information for the vSphere cloud account.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/cloud-accounts/$cloud_account_id/?apiVersion=$api_version" | jq "."
Examine the response to find the region where you want to create a cloud zone. A snippet of the response shows the enabledRegions with an external region ID and your cloud account ID.
...
"enabledRegions": [
{
"externalRegionId": "Datacenter:datacenter-3",
"name": "SDDC-Datacenter",
"cloudAccountId": "2636b316-b514-47f3-93b8-78f18df51a29",
"id": "8d633554-90ca-4f8a-8a0f-1cd3cd90a522",
"updatedAt": "2022-04-02",
...
Assign the external region ID variable.
$ external_region_id= 'Datacenter:datacenter-3' $ region_id= '8d633554-90ca-4f8a-8a0f-1cd3cd90a522'
List folders associated with the external region and cloud account.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/folders?externalRegionid=$external_region_id&cloudaccountid=$cloud_account_id/?apiVersion=$api_version" | jq "."
A snippet of the response shows the folders associated with the external region and the cloud account. The external ID is the value that you assign to the folder when creating the cloud zone.
... "cloudAccountIds": [ "2636b316-b514-47f3-93b8-78f18df51a29" ] "externalId": "dbuyukliiska", "name": "dbuyukliiska", "id": "3863f2cc-0340-483f-b24e-d351b7c53c8c", "createdAt": "2022-04-02", "updatedAt": "2022-04-02", ...
Assign the external ID.
$ external_id='dbuyukliiska'
Create a cloud zone with a specified folder.
curl -X POST \ "$url/iaas/api/zones?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "regionId": "'$region_id'", "name": "Demo-zone-with-folder-1", "folder": "'$external_id'" } | jq "."
A snippet of the response from your request shows the folder and cloud zone ID.
... "folder": "dbuyukliiska", "externalRegionId": "Datacenter:datacenter-3", "cloudAccountId": "2636b316-b514-47f3-93b8-78f18df51a29", "name": "Demo-zone-with-folder-1", "id": "258bccb1-a337-4b63-9a8a-44a414761d93", "updatedAt": "2021-11-22", ...