Syntax for Updating a Tenant ID

PUT /api/security-groups/{id} updates the tenant for the security group with a specified ID.

Input

Use the supported input parameters to control the command output.

Table 1. Input parameters
Parameter Description
URL https://$vRA/network-service/api/security-groups/{id}, where id is the ID of the security group to update.
$vRA

Specifies the appliance name and fully qualified domain name, or IP address of the vRealize Automation server.

$token

Specifies a valid HTTP bearer token with necessary credentials.

$securityId Specifies the unique security object identifier.
$securityName Specifies the name of the security object.
$description Specifies a description of the security object.
$externalId Specifies the external ID of the security object.
$tenantId Specifies the tenant ID value. Valid values are: <unscoped>, null, and tenant_name, where:
  • "tenantID": "<unscoped>" — Hides the security object from all tenants.
  • "tenantID": null — Specifies global tenancy. The object is visible to all tenants with a reservation on the specific endpoint in which the security object exists.
  • "tenantID": "my_tenant_example" — The security object is only visible to the tenant named my_tenant_example.
$extensionData Contains an array of Literals name "entries". Each Literanl contains a key and a value. The value, in turn, contains a type (such as a string or integer) and the Literal's value.

JSON Input File Template

To simplify command line input, you can call a JSON file with input parameters from the command line. You create the JSON file using a text editor, replacing italicized variables in the following template with your specific values.

{
   "@type": "SecurityGroup",
   "id": "$securityId",
   "name": "$securityName",
   "description": "$description",
   "externalId": "$externalId",
   "tenantId": "$tenantId",
   "extensionData": {
      "entries": [...]
   },
   "securityGroupTypeId": "$securityGroupTypeId",
   "internal": false,
   "machineIdCollection": null,
   "ipAddressCollection": null
}

Output

The command output contains property names and values based on the command input parameters.

Parameter Description
Links

Specifies an array of link objects, each of which contains the following parts:

  • rel: Specifies the name of the link.
    • Self refers to the object that was returned or requested. This property does not exist when you query for a single profile.
    • First, Previous, Next, and Last refer to corresponding pages of pageable lists.
    • Specifies the application or service that determines the other names.
  • href: Specifies the URL that produces the result.
Content Specifies an array of data rows, each of which represents one of the security objects returned in a pageable list. Each security object can contain the following information:
  • id: Specifies the unique security object identifier.
  • name: Specifies the name of the security object.
  • description: Specifies a description of the security object.
  • externalId: Specifies the external ID of the security object.
  • tenantId: Specifies the tenant ID value. Default value is null.
  • extensionData: Contains an array of Literals name "entries". Each Literanl contains a key and a value. The value, in turn, contains a type (such as a string or integer) and the Literal's value.
  • securityGroupTypeId: For internal use only. Applies to security groups only.
  • internal: For internal use only. Applies to security groups only.
  • machineIdCollection: For internal use only. Applies to security groups only.
  • ipAddressCollection: For internal use only. Applies to security groups only.
Metadata Specifies the following paging-related data:
  • Size: Specifies the maximum number of rows per page.
  • totalElement: Specifies the number of rows returned.
  • totalPages: Specifies the total number of pages of data available.
  • Number: Specifies the current page number.
  • Offset: Specifies the number of rows skipped.

curl Command to Update the Tenant ID for a Security Group With JSON File

The following sample updateTenantId.json file contains parameters for the request to update a security group with ID=24.
{
   "@type": "SecurityGroup",
   "id": "24",
   "name": "security-group-name",
   "description": "Managed by VMware vRealize Automation",
   "externalId": "securitygroup-19567",
   "tenantId": "my_tenant_example",
   "extensionData": {
      "entries": [...]
   },
   "securityGroupTypeId": "Infrastructure.Network.SecurityGroup.NSX",
   "internal": false,
   "machineIdCollection": null,
   "ipAddressCollection": null
}
The following example requests a tenant ID update for security group with ID=24 by calling the updateTenantId.json file.
curl -X PUT --insecure -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $token” -H "Cache-control: no cache" https://$vRA/network-service/api/security-groups/24 --data @C:/Temp/updateTenantId.json

curl Command to Update the Tenant ID for a Security Group With Parameters Inline

The following example requests a tenant ID update for security group with ID=24 with input parameters specified inline.
curl -X PUT --insecure -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $token” -H "Cache-control: no cache" https://$vRA/network-service/api/security-groups/24 --data 
{
   "@type": "SecurityGroup",
   "id": "24",
   "name": "security-group-name",
   "description": "Managed by VMware vRealize Automation",
   "externalId": "securitygroup-19567",
   "tenantId": "my_tenant_example",
   "extensionData": {
      "entries": [...]
   },
   "securityGroupTypeId": "Infrastructure.Network.SecurityGroup.NSX",
   "internal": false,
   "machineIdCollection": null,
   "ipAddressCollection": null
}