The API is not working properly after upgrade of vRA from 8.11 to 8.18.1
search cancel

The API is not working properly after upgrade of vRA from 8.11 to 8.18.1

book

Article ID: 396758

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

Adding a cloud zone to a project removes existing cloud zone assignment from the project when updating it using the PATCH method via the API.

Environment

Aria Automation 8.18.1 after upgrade from vRA 8.11

Cause

This occurs because the zoneAssignmentConfigurations property is a nested property of the ProjectSpecification schema to the PATCH /iaas/api/projects/:id API

Resolution

When a new cloud zone needs to be added to the project, the client should send in the body of the request the full list of zones + the new zone added to the list.

Example:

// Current state of the project
// GET /iaas/api/projects/project-1-uuid
{
  // ...
  "id": "project-1-uuid",
  "zones": [
    {
      "zoneId": "zone-1-uuid",
      "id": "project-1-uuidzone-1-uuid",
      // ...
    }
  ]
}

// Payload to add a new zone
// PATCH /iaas/api/projects/project-1-uuid
{
  // ...
  "zoneAssignmentConfigurations": [
    {
      "zoneId": "zone-1-uuid",
      // ...
    },
    {
      "zoneId": "zone-2-uuid",
      // ...
    },
  ]
}

// Project state after the update
// GET /iaas/api/projects/project-1-uuid
{
  // ...
  "id": "project-1-uuid",
  "zones": [
    {
      "zoneId": "zone-1-uuid",
      "id": "project-1-uuidzone-1-uuid",
      // ...
    },
    {
      "zoneId": "zone-2-uuid",
      "id": "project-1-uuidzone-2-uuid",
      // ...
    }
  ]
}

To achieve this, the following algorithm can be used to update the projects:

CREATE the new cloud zone

FOR each project in all projects:
    READ project (GET /iaas/api/projects/{project_id})
    BUILD zoneAssignmentConfigurations property by using existing zones property of 
          the project and adding the new zone at the end of the list
    UPDATE the project (PATCH /iaas/api/projects/{project_id})
END LOOP

Additional Information

In the event that ansible is being used, an Ansible playbook example has been attached (assign_zones.yaml)

Attachments

assign_zones.yaml get_app