As a Cloud Assembly administrator, you use the PATCH iaas/api/projects request to attach a cloud zone to a project.
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.
- Verify that you have added a project and you have the project ID. See Create a Project to use in Cloud Assembly.
Procedure
Example: Attach a Cloud Zone to Your Project
For the new project Example-project, add a cloud zone.
$ url='https://appliance.domain.com'
$ api_version='2021-07-15'
$ project_id='5944aacb-91de-4541-bb9e-ef2a5403f81b'
List all cloud zones.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/zones?apiVersion=$api_version" | jq "."
Examine the response to find the cloud zone you want and assign the zone ID variable.
$ zone_id='4965d34c3bfe0275574bc5fd8782a'
List the details of your project.
$ curl -X GET -H 'Accept: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/projects/$project_id?apiVersion=$api_version" | jq "."
A snippet of the response shows an existing cloud zone.
... "zones": [ { "zoneId": "3cc2ecb989eee87557b0d532d4bb0", "priority": 0, "maxNumberInstances": 0 } ...
Add the new cloud zone. Include the existing cloud zone 3cc2ecb989eee87557b0d532d4bb0 in the PATCH request.
$ curl -X PATCH \ "$url/iaas/api/projects/$project_id?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "zoneAssignmentConfigurations" : [ { "zoneId" : "'$zone_id'", "priority": 1, "maxNumberInstances": 50 }, { "zoneId" : "3cc2ecb989eee87557b0d532d4bb0", "priority": 2, "maxNumberInstances": 100 } ] }' | jq "."
The response after adding a cloud zone lists the project with its administrators, members, and zone.
{ "administrators": [ { "email": "[email protected]" } ], "members": [ { "email": "[email protected]" } ], "zones": [ { "zoneId": "4965d34c3bfe0275574bc5fd8782a", "priority": 1, "maxNumberInstances": 50 }, { "zoneId": "3cc2ecb989eee87557b0d532d4bb0", "priority": 2, "maxNumberInstances": 100 } ], "sharedResources": true, "name": "Example-project", "description": "This is an example project", "id": "5944aacb-91de-4541-bb9e-ef2a5403f81b", "organizationId": "8327d53f-91ea-420a-8613-ba8f3149db95", "orgId": "8327d53f-91ea-420a-8613-ba8f3149db95", "_links": { "self": { "href": "/iaas/api/projects/edfd6f26-5d82-428f-96b0-b10ac5e4aca9" } } }