To query and edit zones associated with a project, you use Project endpoints in the IaaS API.

Prerequisites for extracting zones associated with a project

  • Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
  • Verify that you have your project ID. If you do not have the ID, list all projects to find the name and ID of the project with the associated zones that you want to query or edit.
    curl -X GET -H 'Accept: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/projects?apiVersion=$api_version" | jq "."

    Examine the response to find your project name and ID as in the following example snippet.

    ...
        ],
        "name": "project1",
        "description": "",
        "id": "6c2f2d0d-ecee-42e3-90be-7bb66d6da2f9",
        "orgId": "f098d692-e980-41a5-b349-83084fce1ea0",
    ...

Querying zones associated with a project

You can retrieve the first 100 cloud zones associated with a project without including a query option. To retrieve information about cloud zones that are not among the first 100 listed, you add query options to your request.

For a complete list of query options, see Querying with the VMware Aria Automation APIs.

This example assumes that you have more than 100 zones associated with the project ID 6c2f2d0d-ecee-42e3-90be-7bb66d6da2f9. The following procedure shows how to use paging to get the second page of zones associated with the project.

For more information about pagination parameters, see Using Pagination and Count.

Assign the project ID variable.

project_id='6c2f2d0d-ecee-42e3-90be-7bb66d6da2f9'

Append query options top=100 and skip=100 to the request to retrieve cloud zones.

curl -X GET \
"$url/iaas/api/projects/$project_id/zones?apiVersion=$api_version&$top=100&skip=100" \
-H 'Accept: application/json' \
-H "Authorization: Bearer $access_token" \
| jq "."

The following response lists the second page of zones. Since there are 102 zones associated with the project, the second page lists two zones.

"content": [
   {
      "zoneId": "3cf514d6-0dfc-4941-95de-40b01d60e8d3",
      "priority": 0,
      "maxNumberInstances": 0,
      "allocatedInstancesCount": 2,
      "memoryLimitMB": 0,
      "allocatedMemoryMB": 1254,
      "cpuLimit": 0,
      "allocatedCpu": 2,
      "gpuLimit": 0,
      "allocatedGpu": 0,
      "storageLimitGB": 0,
      "allocatedStorageGB": 0.0,
      "id": "0966203d-63f5-41c7-8dcd-7c1833932ec4-3cf514d6-0dfc-4941-95de-40b01d60e8d3",
      "updatedAt": "2021-10-28",
      "orgId": "ce811934-ea1a-4f53-b6ec-465e6ca7d126",
      "_links": {
         "project": { "href": "/iaas/api/projects/6c2f2d0d-ecee-42e3-90be-7bb66d6da2f9" }
         }
   }   ,
   {
      "zoneId": "e4c56d64-a5bc-4656-bfc6-9f8009af66d3",
      "priority": 0,
      "maxNumberInstances": 0,
      "allocatedInstancesCount": 0,
      "memoryLimitMB": 0,
      "allocatedMemoryMB": 0,
      "cpuLimit": 0,
      "allocatedCpu": 0,
      "gpuLimit": 0,
      "allocatedGpu": 0,
      "storageLimitGB": 0,
      "allocatedStorageGB": 0.0,
      "id": "0966203d-63f5-41c7-8dcd-7c1833932ec4-e4c56d64-a5bc-4656-bfc6-9f8009af66d3",
      "updatedAt": "2022-01-07",
      "orgId": "ce811934-ea1a-4f53-b6ec-465e6ca7d126",
      "_links": {
         "project":{ "href": "/iaas/api/projects/6c2f2d0d-ecee-42e3-90be-7bb66d6da2f9" }
      }
   }
],
"totalElements": 2,
"numberOfElements": 2

Editing cloud zone assignments

You can edit the following cloud zone assignments in your project:
  • Storage limit (GB)
  • CPU limit
  • Memory limit (MB)
  • Maximum number of instances
  • Provisioning priority

This example assumes that you have two zones associated with the project ID 094a2fab-7715-4844-94f9-71b45452da27, one with provisioning priority 0 and one with provisioning priority 1. The following procedure shows how to edit the zone assignments to add a new zone with priority 1 and change an existing zone to priority 2.

Assign the project ID variable.

project_id='094a2fab-7715-4844-94f9-71b45452da27'

List the zones provisioned in your project.

curl -X GET \
"$url/iaas/api/projects/$project_id/zones?apiVersion=$api_version&$top=100&skip=100" \
-H 'Accept: application/json' \
-H "Authorization: Bearer $access_token" \
| jq "."
A snippet of the response shows two zone IDs:
  • 3c2bbe36-bf8e-4484-9c31-ce552422aaf1
  • 8992bdf0-136f-401c-822a-e22dae67259b
...
  }
     "zoneId": "3c2bbe36-bf8e-4484-9c31-ce552422aaf1",
     "priority": 0
     "maxNumberInstances": 0,
     "allocatedInstancesCount":0,
     ...
  },
  {
     "zoneId": "8992bdf0-136f-401c-822a-e22dae67259b",
     "priority": 1
     "maxNumberInstances": 0,
     "allocatedInstancesCount":0,
     ...
  }
}
...
Note: When updating project zone assignments, the update deletes any cloud zones that are not included in the request payload. So when making the request, you must include zone IDs for all cloud zones that will remain in the project after the update, even if there is no change to the zone assignment specification.
The zone assignment update includes information for three zones in the project:
  • For zone ID 3c2bbe36-bf8e-4484-9c31-ce552422aaf1, maintain the zone with "priority": 0.
  • For zone ID 8992bdf0-136f-401c-822a-e22dae67259b, maintain the zone but change to "priority": 2.
  • For zone ID 66067958-7e43-47f8-9bc9-0d32594c47e9, add a new zone with "priority": 1.
curl -X PUT \
  "$url/iaas/api/projects/$project_id/zones?apiVersion=$api_version"
  -H 'Content-Type: application/json' 
  -H "Authorization: Bearer $access_token" 
  -d '{ 
   "zoneAssignmentSpecifications": [
        {
            "zoneId": "3c2bbe36-bf8e-4484-9c31-ce552422aaf1",
            "priority": 0
        },
        {
            "zoneId": "8992bdf0-136f-401c-822a-e22dae67259b",
            "priority": 2
        }.
        {
            "zoneId": "66067958-7e43-47f8-9bc9-0d32594c47e9",
            "priority": 1
        }
    } 
  }' | jq "."

Examine the response.

{     
"progress": 0,     
"status": "INPROGRESS",     
"name": "Project Zones Assignment Task",     
"id": "a6241aeb-909e-4689-af5a-940b52d216ff",     
"selfLink": "/iaas/api/request-tracker/a6241aeb-909e-4689-af5a-940b52d216ff" 
} 

Assign the selflink variable.

selfLink_id='a6241aeb-909e-4689-af5a-940b52d216ff'

Use the selfLink for tracking.

curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version" | jq "."

The zone assignments are complete when the response includes "status": "FINISHED".

{     
   "progress": 100,     
   "status": "FINISHED",       
   "name": "Project Zones Assignment Task",
   "id": "a6241aeb-909e-4689-af5a-940b52d216ff",     
   "selfLink": "/iaas/api/request-tracker/a6241aeb-909e-4689-af5a-940b52d216ff" 
} 

If you list the zones provisioned in your project again, a snippet of the response shows the newly added cloud zone and updated provisioning priorities.

...
  }
     "zoneId": "3c2bbe36-bf8e-4484-9c31-ce552422aaf1",
     "priority": 0
     "maxNumberInstances": 0,
     "allocatedInstancesCount":0,
     ...
  },
  {
     "zoneId": "8992bdf0-136f-401c-822a-e22dae67259b",
     "priority": 2
     "maxNumberInstances": 0,
     "allocatedInstancesCount":0,
     ...
  }
  {
     "zoneId": "66067958-7e43-47f8-9bc9-0d32594c47e9",
     "priority": 1
     "maxNumberInstances": 0,
     "allocatedInstancesCount":0,
     ...
  }
}
...