To create a Google Cloud Platform (GCP) cloud account, you make a POST request. The request body includes parameters specific to Google Cloud Platform that are required to create the cloud account.
Prerequisites
- 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 the following parameters for the new cloud account:
- GCP project ID
- GCP private key ID
- GCP private key
- GCP client email
Procedure
Example: Create a Google Cloud Platform Cloud Account
Assign the required variables.
Note: If your organization uses an API service that is hosted outside of the United States, your URL variable must include a country abbreviation. See
Regional Endpoints for VMware Aria Automation APIs.
$ url='https://api.mgmt.cloud.vmware.com' $ api_version='2021-07-15' $ gcp_project_id='Example-e2e' $ gcp_private_key_id='defg3c20c85abcde6a95b44222c4c1d68554b87e' $ gcp_private_key='-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAA ... 3izE4KDeebLh7SkWFbUt7lFW25UL20\\nKAY7FRTKpvbO+6Z/BnVePVI=\\n-----END PRIVATE KEY-----\\n' $ gcp_client_email='[email protected]'
Create the cloud account.
$ curl -X POST \ "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $access_token" \ -d '{ "cloudAccountType":"gcp", "privateKeyId":"'$gcp_private_key_id'", "privateKey":"'$gcp_private_key'", "cloudAccountProperties":{ "projectId":"'$gcp_project_id'", "clientEmail":"'$gcp_client_email'" }, "regionIds":["us-west2"], "createDefaultZones":true, "name":"demo-gcp-account", "description": "This is a demo GCP cloud account", }' | jq "."
A snippet of the response from your request shows the account ID.
...
"tags": [],
"name": "demo-GCP-account",
"id": "c8c3c9bfdb449475-7f703c5265a63d87-f8e705d89b2569e1aac66c6d00bf4fc7ef4b1c44100f0e944af31eb8ba3d2a5a-f4226a20b65c4675574bc5fbff6c0",
"updatedAt": "2022-04-02",
"organizationId": "8327d53f-91ea-420a-8613-ba8f3149db95",
...