Programming Guide vRealize Automation 7.2 This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. To check for more recent editions of this document, see http://www.vmware.com/support/pubs.
Programming Guide You can find the most up-to-date technical documentation on the VMware Web site at: http://www.vmware.com/support/ The VMware Web site also provides the latest product updates. If you have comments about this documentation, submit your feedback to: docfeedback@vmware.com Copyright © 2008–2016 VMware, Inc. All rights reserved. Copyright and trademark information. VMware, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 www.vmware.com 2 VMware, Inc.
Contents vRealize Automation Programming Guide 5 1 Overview of the vRealize Automation REST API 7 2 REST API Authentication 9 Using HTTP Bearer Tokens 9 Configure the Duration of an HTTP Bearer Token Request an HTTP Bearer Token 10 Validate an HTTP Bearer Token 12 Delete an HTTP Bearer Token 13 9 3 REST API Use Cases 15 Create a Tenant 16 Syntax for Displaying Your Current Tenants 18 Syntax for Requesting a New Tenant 20 Syntax for Listing All Tenant Identity Stores 23 Syntax for Linking an Identity
Programming Guide Perform a Day 2 Action: Power Off 98 Perform a Day 2 Action: Change Lease Working with Reservations 101 Create a Reservation 101 Display a List of Reservations 244 Update a Reservation 254 Delete a Reservation 264 Working with Reservation Policies 265 List Reservation Policies 265 100 Create a Reservation Policy 268 Display a Reservation Policy by ID 270 Update a Reservation Policy 271 Delete a Reservation Policy 273 Working with Key Pairs 274 Get a Key Pair List 274 Create a Key Pair
vRealize Automation Programming Guide The Programming Guide provides information about the vRealize Automation REST APIs, including how to use the REST API services and resources, create HTTP bearer tokens for authentication and authorization, and construct REST API service calls. Intended Audience This information is intended for administrators and programmers who want to configure and manage vRealize Automation programmatically using the vRealize Automation REST API.
Programming Guide 6 VMware, Inc.
Overview of the vRealize Automation REST API 1 The vRealize Automation REST API provides consumer, administrator, and provider-level access to the service catalog with the same services that support the vRealize Automation console user interface. You can perform vRealize Automation functions programmatically by using REST API service calls. The vRealize Automation REST API offers the following services and functions. Table 1‑1.
Programming Guide Table 1‑1. vRealize Automation REST API Services (Continued) Service Description IP Address Management Service Allocate and deallocate IP addresses from IP address management (IPAM) providers. Licensing Service Retrieve permissions and post serial keys. Management Service (Reclamation Service) Retrieve work item forms, callbacks, and tasks. Manage endpoint details including tenant, password, user name, and endpoint URL. Retrieve performance metrics.
2 REST API Authentication In the REST API, vRealize Automation requires HTTP bearer tokens in request headers for authentication of consumer requests. A consumer request applies to tasks that you can perform in the vRealize Automation console, such as requesting a machine. To acquire an HTTP bearer token, you authenticate with an identity service that manages the communication with the SSO server.
Programming Guide Prerequisites n Log in to the vRealize Automation appliance with SSH as root. The password is the one you specified when you deployed the appliance. n The /etc/vcac/security.properties file on the appliance must be editable. Procedure 1 Open the /etc/vcac/security.properties file for editing. 2 Add the following lines to the file, where N is an integer specifying the duration of the token in hours. identity.basic.token.lifetime.hours=N #The number is in hours.
Chapter 2 REST API Authentication For example, the following sample output displays based on the command input: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Cache-Control: no-cache, no-store Pragma: no-cache Expires: Thur, 16 Jul 2015 23:59:59 GMT Content-Type: application/json;charset=UTF-8 Content-Length: 324 Date: Wed, 15 Jul 2015 13:04:50 GMT { "expires":"2015-16-01T13:09:45.
Programming Guide Status Code Description 200 OK Your request succeeded and the resource was updated. The response body contains the full representation of the resource. 400 BAD REQUEST The data you provided in the POST failed validation. Inspect the response body for details. 401 UNAUTHORIZED The request could not authenticate the user or authentication credentials required. Example: curl Command You can enter the following command line format to request an HTTP bearer token.
Chapter 2 REST API Authentication Delete an HTTP Bearer Token You can delete an HTTP bearer token. Prerequisites n “Request an HTTP Bearer Token,” on page 10. Procedure u Create the request to delete the HTTP bearer token, as in the following example.
Programming Guide 14 VMware, Inc.
REST API Use Cases 3 Available use cases provide the prerequisite, command line options and format, and sample results to help you perform a variety of vRealize Automation functions, such as requesting a machine or creating a reservation. You can find information about all of the available vRealize Automation REST API calls in the vRealize Automation API Reference zip file located in the vRealize Automation Documentation Center.
Programming Guide n Working with Key Pairs on page 274 You can work with the keyValuePair data element of the REST API workitem service to list, create, and update key pairs. n Working with Network Profiles on page 287 You can use the vRealize Automation IaaS proxy provider service and IPAM service REST API to create, list, and update network profiles.
Chapter 3 REST API Use Cases n Syntax for Assigning a User to a Role on page 30 You can use the REST API identity service to assign a user to a role. n Syntax for Displaying all Roles Assigned to a User on page 31 You can use the REST API identity service to display all of the roles assigned to a user. Procedure 1 Use the identity service to display all the available tenants.
Programming Guide "name": "openLDAPDemo", "password": "password", "type": "LDAP", "url": "ldap://10.000.00.000:389", "userBaseSearchDn": "ou=demo,dc=example,dc=mycompany,dc=com", "userNameDn": "cn=demoadmin,ou=demo,dc=example,dc=mycompany,dc=com" } Use the following command to call the example JSON text file and link an identity store to a tenant. The command also tests that vRealize Automation can connect to the identity store successfully.
Chapter 3 REST API Use Cases 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: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists.
Programming Guide Example: curl Command The following example command displays all available tenants. curl --insecure -H "Accept:text/xml" -H "Authorization: Bearer $token" https://$host/identity/api/tenants Format the XML output to improve its readability. For information about formatting output, see Chapter 5, “Filtering and Formatting REST API Information,” on page 361. Example: JSON Output The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases Parameter Description URL https://$host/identity/api/tenants/$tenantId --data @ $inputFileName.json $token Specifies a valid HTTP bearer token with necessary credentials. $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $tenantId Specifies the ID of the tenant. $tenantURL Specifies the URL of the tenant. $tenantName Specifies the name of the tenant.
Programming Guide Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Chapter 3 REST API Use Cases The first example calls the following sample newTenant.json file. { "@type" : "Tenant", "id" : "development", "urlName" : "development", "name" : "DevelopmentTenant", "description" : "Tenant for all developers", "contactEmail" : "admin@mycompany.com", "defaultTenant" : false } Example 1: Use the following example to call the above newTenant.json file, which contains parameters for the tenant request.
Programming Guide Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Chapter 3 REST API Use Cases Example: JSON Output The following JSON output is returned based on the command input. HTTP/1.1 200 OK Server: Apache-Beach/1.1 Cache-Control: no-cache, no-store Pragma: no-cache Expires: Wed, 31 Dec 1969 23:59:59 GMT Content-Type: application/json;charset=UTF-8 Content-Length: 830 Date: Sat, 01 Feb 2014 13:07:54 GMT {"links":[], "content":[ {"@type":"IdentityStore", "domain":"vcac.mycompany.com", "name":"openLDAPPromocom", "description":null, "alias":"promocom.
Programming Guide Parameter Description URL https://$host/identity/api/tenants/$tenantId/directories/$domainName --data @$inputFileName.json $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. $tenantId Specifies the ID of the tenant. userId Specifies the ID of the user in the form name@domain. $domainAlias Specifies the domain alias.
Chapter 3 REST API Use Cases Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Programming Guide "url": "ldap://10.000.00.000:389", "userBaseSearchDn": "ou=demo,dc=example,dc=mycompany,dc=com", "userNameDn": "cn=demoadmin,ou=demo,dc=example,dc=mycompany,dc=com" } Example: curl Command The following example command calls the example JSON text file and links an identity store to a tenant. The command also tests that vRealize Automation can connect to the identity store successfully. If the command finishes successfully,vRealize Automation succeeded in connecting to the identity store.
Chapter 3 REST API Use Cases Keep-Alive = timeout=15, max=100 Connection = Keep-Alive } Successful Unlinked Identity Store Error The following output indicates that an identity store is not linked to the specified tenant. To resolve the problem, correct the identity store and connection details in the JSON input file and rerun the command. Command failed [Rest Error]: {Status code: 400}, {Error code: 90027} , {Error Source: null}, {Error Msg: Cannot connect to the directory service.
Programming Guide Property Description disabled Specifies the Boolean flag indicating if the user is disabled. principalId Specifies the principal ID of the user in username@domain format. tenantName Specifies the name of tenant to which user belongs. name Specifies the first and last name concatenated. Example: curl Command The following example command queries the configured LDAP directory for a specific user.
Chapter 3 REST API Use Cases Example: curl Command The following example command string submits a request to assign the user tony in the domain example.mycompany.com to the tenant administrator role. It provides empty braces for the required JSON payload. See “Syntax for Searching LDAP or Active Directory for a User,” on page 29 for more information about getting the user name and domain values.
Programming Guide Example: JSON Output The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases "name" : "My Tenant Identity Stores, Groups and Users Administration User Interfaces", "description" : "Access my tenant identity stores, groups and users administration GUIs.", "prereqAdminPermissions" : null } ] } ], "metadata" : { "size" : 20, "totalElements" : 1, "totalPages" : 1, "number" : 1, "offset" : 0 Request a Machine You can use REST API catalog service commands to complete a variety of tasks related to requesting a machine.
Programming Guide n Syntax for Viewing Details of a Machine Request on page 47 You can use the vRealize Automation REST API catalog service to view the details of a machine request. Procedure 1 List all shared catalog items in the catalog. You can browse the API and use HATEOAS links to navigate to additional API calls that are relevant to the current context.
Chapter 3 REST API Use Cases 6 (Optional) View the details of your request. You can perform a GET on the URI in the Location header to retrieve the updated request details. curl --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token” https://$host/catalogservice/api/consumer/requests/7aaf9baf-aa4e-47c4-997b-edd7c7983a5b Accept: application/json The status information is particularly noteworthy in the request details.
Programming Guide Parameter Description $filter Boolean expression for whether a particular entry should be included in the response. Valid OData properties include the following: n name - filter based on catalog item name. n status - filter based on catalog item status. n service/id - filter based on catalog item service id. n service/name - filter based on catalog item service name.
Chapter 3 REST API Use Cases Example: JSON Output The following JSON output is returned based on the command input.
Programming Guide "totalPages": 1, "number": 1, "offset": 0 } } Syntax for Getting Information for a Catalog Item You can use the REST API catalog service to get information about a specific catalog item if desired. REST API Catalog Service The REST API supports OData filtering. For more information about supported OData filters, refer to the vRealize Automation API Reference, particularly the REST API Tips page located at https://$host/component-registry/services/docs/odata.html.
Chapter 3 REST API Use Cases Parameter Description $filter Boolean expression for whether a particular entry should be included in the response. Valid OData properties include the following: n name - filter based on catalog item name. n status - filter based on catalog item status. n service/id - filter based on catalog item service id. n service/name - filter based on catalog item service name.
Programming Guide Example: JSON Output The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases "totalPages": 1, "number": 1, "offset": 0 } } Syntax for Getting a Template Request for a Catalog Item You can use the REST API catalog service to request catalog items. VMware supplies a number of templates to help you create different types of machine requests.
Programming Guide Example Curl Command The following example command retrieves the catalog item with an ID of dc808d12-3786-4f7c-b5a1- d5f997c8ad66. curl --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token” https://$host/catalogservice/api/consumer/entitledCatalogItems/dc808d12-3786-4f7c-b5a1-d5f997c8ad66/requests/template Example: JSON Output The following JSON output is returned based on the command input. { "type": "com.vmware.vcac.catalog.domain.request.
Chapter 3 REST API Use Cases "componentTypeId": "com.vmware.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Compute.Machine.
Programming Guide "number_of_instances": 1, "os_arch": "x86_64", "os_distribution": null, "os_type": "Linux", "os_version": null, "platform_name": "vsphere", "platform_type": "virtual", "property_groups": [ null ], "provisioning_workflow": { "componentId": null, "classId": "Infrastructure.Compute.ProvisioningWorkflow", "id": "CloneWorkflow" }, "reservation_policy": { "componentId": null, "classId": "Infrastructure.Reservation.Policy.
Chapter 3 REST API Use Cases Parameter Description URL https://$host/catalog-service/api/consumer/requests/requestId $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. catalogItemId The identifier of a catalog item. Typically, this is provided by users via the REST URI when making an entitledCatalogItem provisioning request.
Programming Guide Property Description dateSubmitted Specifies the date when this request was first submitted. dateApproved Specifies the date when this request was approved. dateCompleted Specifies the date when this request was completed. quote Contains a quote made by the provider defining the estimated cost(s) associated with the request and/or any resources provisioned as a result of the request. requestCompletion Contains additional request completion information.
Chapter 3 REST API Use Cases } Response Headers { Date = Wed, 03 Dec 2014 20:58:34 GMT ETag = "0" Location = https://$host/catalog-service/api/consumer/requests/7aaf9baf-aa4e-47c4-997bedd7c7983a5b { $requestObjectDetails } Content-Type = application/json;charset=UTF-8 Content-Length = 0 Vary = Accept-Encoding,User-Agent Keep-Alive = timeout=15, max=100 Connection = Keep-Alive } null Syntax for Viewing Details of a Machine Request You can use the vRealize Automation REST API catalog service to view the det
Programming Guide Parameter Description $token Specifies a valid HTTP bearer token with necessary credentials. $requestId Specifies the request ID. See “Syntax for Displaying Your Provisioned Resources,” on page 70 to view all of your requests and search for a request ID. The required request ID is located at the end of the Location URL in the response header. The request ID is located in the Location field of the response header if you submitted the request with the –headers flag.
Chapter 3 REST API Use Cases Property Description retriesRemaning Specifies the number of attempts remaining to move this request from its current state to the next state in the request workflow. Some state transitions require calls to external services. These calls may fail due to transient errors such as momentary network errors. In these cases, the catalog will retry the call a number of times before failing. This property defines the number of retries remaining for the current state transition.
Programming Guide }, "requestData": { $detailsOfSubmittedRequest }, "retriesRemaining": 3, "requestedItemName": "Linux", "requestedItemDescription": "Linux blueprint for API demo", "stateName": "Successful", "approvalStatus": "POST_APPROVED", "executionStatus": "STOPPED", "waitingStatus": "NOT_WAITING", "phase": "SUCCESSFUL", "catalogItemRef": { "id": "7c8275d6-1bd6-452a-97c4-d6c053e4baa4", "label": "Linux" } } Approve a Machine Request You can use a sequence of REST API workitem service commands to appro
Chapter 3 REST API Use Cases n Syntax for Updating Cost Information on page 67 You can use the composition service to update and display cost information for a deployment. The cost of a deployment is based on which blueprint you request plus details of the specific request. For example, if the blueprint allows for a range of CPU, memory, or storage values, the cost depends on the value requested. Procedure 1 List all available work item IDs.
Programming Guide Output The command output contains property names and values based on the command input parameters. Property Links Description Specifies an array of link objects, each of which contains the following parts: rel n Specifies the name of the link. n Self refers to the object that was returned or requested. This property does not exist when you query for a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists.
Chapter 3 REST API Use Cases Example: curl Command The following example command retrieves all the available work item IDs. curl --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token” https://$host/workitem-service/api/workitems Example: JSON Output The following JSON output is returned based on the command input.
Programming Guide "id" : "duration", "label" : "Duration", "description" : "The length of stay, measured in days.", "dataType" : { "type" : "primitive", "typeId" : "INTEGER" }, "displayAdvice" : null, "state" : { "dependencies" : [ ], "facets" : [ ] }, "filterable" : false, "sortable" : false, "isMultiValued" : false }, { "id" : "location", "label" : "Destination", "description" : "The destination to which travel is being requested.
Chapter 3 REST API Use Cases "forms" : { "workItemDetails" : { "type" : "external", "formId" : "travel.seating.task" }, "workItemSubmission" : { "type" : "external", "formId" : "travel.seating.task" }, "workItemNotification" : { "type" : "external", "formId" : "travel.itinerary.details" } } }, . . . "completedDate" : null, "assignedDate" : "2014-02-20T23:55:31.600Z", "createdDate" : "2014-02-20T23:55:31.600Z", "assignedOrCompletedDate" : "2014-02-20T23:55:31.
Programming Guide "type" : "string", "value" : "tony@example.mycompany.
Chapter 3 REST API Use Cases } }, { "key" : "phase", "value" : { "type" : "string", "value" : "Pre Approval" } }, { "key" : "requestDescription", "value" : { "type" : "string", "value" : "t" } }, { "key" : "requestLease", "value" : { "type" : "timeSpan", "unit" : "DAYS", "amount" : 5 } }, { "key" : "requestedBy", "value" : { "type" : "string", "value" : "tony@example.mycompany.
Programming Guide Parameter Description $token Specifies a valid HTTP bearer token with necessary credentials. workitem_ID Specifies the unique identifier of a work item. See “Syntax for Listing Work Items,” on page 51. Output The command output contains property names and values based on the command input parameters. Property Links Description Specifies an array of link objects, each of which contains the following parts: rel n Specifies the name of the link.
Chapter 3 REST API Use Cases Example: curl Command The following example command retrieves the necessary details for the specified work item. curl --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token” https://$host/workitem-service/api/workitems/5e3e9519-78ea-4409-a52c-e4aa3bc56511 Example: JSON Output The following JSON output is returned based on the command input. To view the contents of a JSON output file, for example workItemDetails.
Programming Guide } ], "completeByEmail" : true, "commentsField" : "businessJustification", "listView" : { "columns" : [ { "id" : "requestedItemName", "label" : "Requested Item", "description" : "", "dataType" : { "type" : "primitive", "typeId" : "STRING" }, "displayAdvice" : null, "state" : { "dependencies" : [ ], "facets" : [ ] }, "filterable" : false, "sortable" : false, "isMultiValued" : false }, . . .
Chapter 3 REST API Use Cases }, "workItemNotification" : { "type" : "external", "formId" : "approval.notification" } } }, "completedDate" : null, "assignedDate" : "2014-02-25T01:26:07.153Z", "createdDate" : "2014-02-25T01:26:07.153Z", "assignedOrCompletedDate" : "2014-02-25T01:26:07.153Z", "serviceId" : "2af18227-6a00-49e9-a76b-96de3ee767d2", "workItemRequest" : { "itemId" : "069dc3ce-a260-4d6a-b191-683141c994c0", "itemName" : "test-blueprint", "itemDescription" : "", "itemRequestor" : "fritz@example.
Programming Guide }, { "key" : "requestLease" }, { "key" : "requestedBy", "value" : { "type" : "string", "value" : "fritz@example.mycompany.com" } } ] } }, "status" : "Active", "availableActions" : [ ] } Syntax for Constructing a JSON File to Approve a Machine Request You can specify a JSON file in your vRealize Automation REST API command line input.
Chapter 3 REST API Use Cases "type": "string", "value": "solves abx request" } }, { "key": "source-source-provider-VirtualMachine.LeaseDays", "value": { "type": "integer", "value": 0 } } ] }, "workItemId": "5e3e9519-78ea-4409-a52c-e4aa3bc56511", "workItemActionId": "com.mycompany.csp.core.approval.action.approve" } Certain parameters are available to use in the JSON template. Table 3‑2.
Programming Guide "key": "provider-blueprintId", "value": { "type": "string", "value": "e16edcf9-6a10-4bc7-98e2-a33361aeb857" } }, { "key": "provider-provisioningGroupId", "value": { "type": "string", "value": "cccd7a7e-5283-416b-beb0-45eb4e924dcb" } }, { "key": "requestedFor", "value": { "type": "string", "value": "fritz@example.mycompany.com" } }, { "key": "provider-VirtualMachine.CPU.Count", "value": { "type": "integer", "value": 1 } }, { "key": "provider-VirtualMachine.Memory.
Chapter 3 REST API Use Cases { "key": "provider-VirtualMachine.Disk0.Letter", "value": { "type": "string", "value": "C" } }, { "key": "provider-VirtualMachine.Disk0.Label", "value": { "type": "string", "value": "main" } }] } } Syntax for Approving a Submitted Machine Request You can approve a work item request to complete the request by using the vRealize Automation REST API.
Programming Guide Property Description version Displays the object version number. assignees Displays the list of work item assignees. subTenantId Optionally associates the work item with a specific business group granting users with management responsibilities over that business group permission to see the approval. tenantId Specifies the tenant ID for the work item. callbackEntityId Specifies the callback entity ID for the work item.
Chapter 3 REST API Use Cases If a user who is not authorized to approve the request submits the request, the following error response is received: Command failed [Rest Error]: {Status code: 400}, {Error code: 12017} , {Error Source: null}, {Error Msg: User fritz@example.mycompany.com not authorized to complete work item with ID 5e3e9519-78ea-4409-a52c-e4aa3bc56511.}, {System Msg: User fritz@example.mycompany.com not authorized to complete Work item with id 5e3e9519-78ea-4409-a52c-e4aa3bc56511.
Programming Guide Property Description setupFee Specifies the one time setup fee associated with the component. totalLeasePriceInfo Specifies the minimum cost and maximum cost for the lease period. averageDailyPriceInfo Specifies the average daily price, which depends on the reservation available for the component. count Specifies the instance count of the component. memory Specifies memory requested for this component.
Chapter 3 REST API Use Cases }, { "key": "memory", "value": { "type": "integer", "value": 2048 } } ] } } } ] } } Example: JSON Output for a Blueprint Cost Update [{"componentId":"vSphere_Machine_1", "setupFee":"$0.00", "totalLeasePriceInfo":{"min":50.0543225806451601,"max": 50.0543225806451601,"displayString":"$50.05"}, "averageDailyPriceInfo":{"min":16.6847741935483867,"max": 16.6847741935483867,"displayString":"$16.68"}, "count":3 "fieldMap":{"setup_fee":{"min":0,"max":0,"displayString":"$0.
Programming Guide n Syntax for Displaying Provisioned Resources by Resource Type on page 72 You can use the REST API catalog service to display a list of the provisioned resources that you own filtered by machine resource type. n Syntax for Displaying All Available Resource Types on page 75 You can use the REST API catalog service to display all the resource types that are available on the system.
Chapter 3 REST API Use Cases Parameter Description URL https://$host/catalog-service/api/consumer/resources $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. Output The command output contains property names and values based on the command input parameters. Property Description id Specifies the unique identifier of this resource.
Programming Guide Example: JSON Output The following JSON output is returned based on the command input. { "links" : [ { "@type" : "link", "rel" : "next", "href" : "https://vra152-009-067.mycompany.com/catalog-service/api/consumer/resources/? page=2&limit=1" } ], "content" : [ { "@type" : "ConsumerResource", "id" : "c24e8c75-c201-489c-b51c-8d7009c23563", "iconId" : "Travel_100.png", "resourceTypeRef" : { "id" : "com.mycompany.mystuff.samples.travel.
Chapter 3 REST API Use Cases n Infrastructure.AppServic n Infrastructure.Cloud n Infrastructure.Physical n Infrastructure.vApp n Infrastructure.Virtual Output The command output contains property names and values based on the command input parameters. Property Description id Specifies the unique identifier of this resource. iconId Specifies an icon for this request based on the requested object type. resourceTypeRef Specifies the resource type. name Specifies the resource name.
Programming Guide Example: JSON Output In this example, the highlighted resource ID (3bfde906-81b9-44c3-8c2d-07d2c9768168) corresponds to a provisioned machine owned by the logged-in user. The resource IDs are used in requests to retrieve the details for the corresponding machines. Also in this example, the subtenantRef ID (eab762cb-6e75-4379-83ef-171a71c9f00e) corresponds to the business group of the logged-in user.
Chapter 3 REST API Use Cases Syntax for Displaying All Available Resource Types You can use the REST API catalog service to display all the resource types that are available on the system. Input Use the supported input parameters to control the command output. Parameter Description URL https://$host/catalog-service/api/consumer/resourceTypes $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server.
Programming Guide Property Description forms Specifies the forms used to render this resource. resourceData Displays the extended provider-defined properties of the resource. Example: curl Command The following example command displays all available resource types. curl --insecure -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$host/catalog-service/api/consumer/resourceTypes Example: JSON Output The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases Property Description id Specifies the unique identifier of this resource. iconId Specifies an icon for this request based on the requested object type. resourceTypeRef Specifies the resource type. name Specifies the resource name. description Specifies the resource description. status Specifies the resource status. catalogItem Specifies the catalog item that defines the service this resource is based on.
Programming Guide For the following command input, the specified subtenant IDs correspond to business groups that are managed by the logged-in user. rest get catalog-service --u "consumer/resources/types/Infrastructure.
Chapter 3 REST API Use Cases "leaseRate" : { "type" : "moneyTimeRate", "cost" : { "type" : "money", "currencyCode" : "USD", "amount" : 0.0 }, "basis" : { "type" : "timeSpan", "unit" : "DAYS", "amount" : 1 } } }, "costToDate" : { "type" : "money", "currencyCode" : "USD", "amount" : 0.0 }, "totalCost" : null, "childResources" : [ ], "operations" : [ { "name" : "Reprovision", "description" : "Reprovision a machine.", "iconId" : "machineReprovision.
Programming Guide "key" : "NETWORK_LIST", "value" : { "type" : "multiple", "elementTypeId" : "COMPLEX", "resources" : [ { "type" : "complex", "componentTypeId" : "com.mycompany.csp.component.iaas.proxy.provider", "componentId" : null, "classId" : "vra.api.model.
Chapter 3 REST API Use Cases "type" : "multiple", "elementTypeId" : "COMPLEX", "resources" : [ { "type" : "complex", "componentTypeId" : "com.mycompany.csp.component.iaas.proxy.provider", "componentId" : null, "classId" : "vra.api.model.
Programming Guide }, { "key" : "MachineStorage", "value" : { "type" : "integer", "value" : 1 } }, { "key" : "MachineDailyCost", "value" : { "type" : "decimal", "value" : 0.
Chapter 3 REST API Use Cases "key" : "MachineGuestOperatingSystem" }, { "key" : "MachineName", "value" : { "type" : "string", "value" : "test2" } }, { "key" : "MachineDestructionDate" }, { "key" : "MachineCPU", "value" : { "type" : "integer", "value" : 1 } }, { "key" : "MachineInterfaceType", "value" : { "type" : "string", "value" : "Test" } }, { "key" : "MachineReservationName", "value" : { "type" : "string", "value" : "Test Agent-Res-1" } }, { "key" : "Reconfigure", "value" : { "type" : "boolean", "value
Programming Guide Syntax for Viewing Machine Details You can use the vRealize Automation REST API catalog service to display the machine details for a provisioned machine. Using the API to Get Deployment Details You can use the REST API to view deployed machine details by appending /resourceViews to the request details URI that you generated when you retrieved request details.
Chapter 3 REST API Use Cases Parameter Description $skip Specifies the number of entries to skip. filter Contains a Boolean expression to determine if a particular entry is included in the response. Output The command output contains property names and values based on the command input parameters. Property Description id Specifies the unique identifier of this resource. iconId Specifies an icon for this request based on the requested object type. resourceTypeRef Specifies the resource type.
Programming Guide Example: JSON Output In the following example, the provisioned machine resourceID value specified in the command line was 7aaf9baf-aa4e-47c4-997b-edd7c7983a5b.
Chapter 3 REST API Use Cases "owners": [ "Connie Summers" ], "businessGroupId": "c0683388-6db2-4cb5-9033-b24d15ad3766", "tenantId": "mycompany", "dateCreated": "2015-07-29T13:51:36.368Z", "lastUpdated": "2015-07-29T13:55:35.
Programming Guide n Perform a Day 2 Action: Change Lease on page 100 You can use the REST API catalog service to change a lease. For actions that require user input, you may need to edit the template prior to submitting the request. Procedure 1 Display a list of all provisioned resources.
Chapter 3 REST API Use Cases After you edit the template as desired, you can POST it to the corresponding URI. HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Cache-Control: no-cache, no-store Pragma: no-cache Expires: Sat, 01 August 2015 23:04:50 GMT Content-Type: application/json;charset=UTF-8 Date: Sat, 01 August 2015 13:04:50 GMT { "type": "com.vmware.vcac.catalog.domain.request.
Programming Guide Parameter Description URL https://$host/catalog-service/api/consumer/resources/$resourceId $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. id UUID of a request. page Specifies a page number. limit Specifies the number of entries to display on a page.
Chapter 3 REST API Use Cases Table 3‑5. Output Parameters (Continued) Property Description totalCost An optional rate card of the costs and charges levied for the entire lease period. data The extended, provider defined properties of the resource. Example Curl Command This example retrieves all children of the resource with an ID of 7aaf9baf-aa4e-47c4-997b-edd7c7983a5b.
Programming Guide ], "resourceId": "c4d3db3e-e397-44ff-a1c9-0ecebdba12f4", "iconId": "cafe_default_icon_genericCatalogItem", "name": "Linux-80813151", "description": null, "status": null, "catalogItemId": "7c8275d6-1bd6-452a-97c4-d6c053e4baa4", "catalogItemLabel": "Linux", "requestId": "7aaf9baf-aa4e-47c4-997b-edd7c7983a5b", "resourceType": "{com.vmware.csp.component.cafe.composition@resource.type.deployment.
Chapter 3 REST API Use Cases Table 3‑6. HATEOAS Link Functions as Defined by rel Field Link Description GET: Parent Resource URI to get the resourceView for the parent item. See “Syntax for Getting Deployment Details,” on page 89. GET:Template {com.vmware.csp.component.cafe.composition@res ource.action.deployment.$actionName URI to get a template request for a specific action that you can perform on this resource. POST: {com.vmware.csp.component.cafe.composition@res ource.action.deployment.
Programming Guide Table 3‑7. Output Parameters (Continued) Property Description businessGroupId The unique identifier of the business group that owns this resource. tenantId The unique identifier of the tenant that owns this resource. owners The owner of this resource. resourceType The type identifier of this resource. For example, Virtual Machine. parentResourceId The unique identifier of the parent resource. Used for child resources of a multimachine resource.
Chapter 3 REST API Use Cases "@type": "link", "rel": "POST: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.ChangeLease}", "href": "https://$host/catalogservice/api/consumer/resources/dd37b7a1-829c-4773-b5beb229453eca4a/actions/b5739e30-871d-48c7-9012-f2a7cf431dc1/requests" }, { "@type": "link", "rel": "GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.
Programming Guide "unit": "DAYS", "amount": 1 } } }, "costToDate": { "type": "money", "currencyCode": "USD", "amount": 0 }, "totalCost": null, "parentResourceId": "c4d3db3e-e397-44ff-a1c9-0ecebdba12f4", "hasChildren": false, "data": { "ChangeLease": true, "ConnectViaRdp": true, "ConnectViaVmrc": true, "DISK_VOLUMES": [ { "componentTypeId": "com.vmware.csp.component.iaas.proxy.provider", "componentId": null, "classId": "dynamicops.api.model.
Chapter 3 REST API Use Cases "MachineStorage": 12, "MachineType": "Virtual", "NETWORK_LIST": [ { "componentTypeId": "com.vmware.csp.component.iaas.proxy.provider", "componentId": null, "classId": "dynamicops.api.model.
Programming Guide "iconId": "cafe_default_icon_genericCatalogItem", "name": "Existing Network", "description": null, "status": null, "catalogItemId": null, "catalogItemLabel": null, "requestId": null, "resourceType": "{com.vmware.csp.component.iaas.proxy.provider@network.network.type.registration.name.Infrastruct ure.Network.Network.Existing}", "owners": [ "Connie Summers" ], "businessGroupId": "c0683388-6db2-4cb5-9033-b24d15ad3766", "tenantId": "mycompany", "dateCreated": "2015-07-29T13:55:14.
Chapter 3 REST API Use Cases {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.PowerOff}", "href": "https://$host/api/consumer/resources/dd37b7a1-829c-4773-b5beb229453eca4a/actions/02bad06d-f92b-4cf8-b964-37bb5d57be38/requests" } Procedure 1 Get the template for the resource action request.
Programming Guide Perform a Day 2 Action: Change Lease You can use the REST API catalog service to change a lease. For actions that require user input, you may need to edit the template prior to submitting the request. This command leverages the links for the change lease action from the command used in the “Syntax for Navigating to the Children of a Deployed Resource,” on page 92 example. { "@type": "link", "rel": "GET Template: {com.vmware.csp.component.iaas.proxy.provider@resource.action.name.machine.
Chapter 3 REST API Use Cases 3 Use a POST command to send the template without modification to the corresponding URI. $curl --insecure -s -H" Content-Type: multipart/form-data" -H "Authorization: Bearer $token" https://$hosts/catalog-service/api/consumer/resources/dd37b7a1-829c-4773-b5beb229453eca4a/actions/b5739e30-871d-48c7-9012-f2a7cf431dc1/requests Accept: application/json Content-Type: application/json Authorization: Bearer $token { "type": "com.vmware.vcac.catalog.domain.request.
Programming Guide Prerequisites n Log in to vRealize Automation as a fabric group administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. n Obtain the schema class ID of the reservation type to create. See “Display a List of Supported Reservation Types,” on page 114.
Chapter 3 REST API Use Cases 4 Obtain a compute resource for the vRealize Automation reservation by using the reservation service. Use the following command to get a compute resource for a vSphere reservation. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.Virtual.
Programming Guide 5 Use the vRealize Automation REST API reservation service to get a resources schema for any supported reservation type, including a vSphere, Amazon, or vCloud Air reservation. a Display information about available resources, such as storage and network information, for a vSphere reservation by using the reservation service. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.
Chapter 3 REST API Use Cases 6 Use the vRealize Automation REST API to create any supported reservation type, including a vSphere, Amazon, or vCloud Air reservation. a Create a vSphere reservation by using the vRealize Automation reservation service. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations -d “ { "name": "TestCreateReservation", "reservationTypeId": "Infrastructure.Reservation.Virtual.
Programming Guide "values": { "entries": [{ "key": "reservationNetworkPath", "value": { "type": "entityRef", "componentId": null, "classId": "Network", "id": "44cb65d5-b321-43dd-a2ab-8ecf387bff8f", "label": "VM Network SQA" } }] } }] } }, { "key": "custom-Properties-key0", "value": { "type": "string", "value": "custom-property-value0" } }, { "key": "custom-Properties-key2", "value": { "type": "string", "value": "custom-property-value2" } }, { "key": "reservationMemory", "value": { "type": "complex", "compo
Chapter 3 REST API Use Cases { "key": "computeResource", "value": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "cc254a84-95b8-434a-874d-bdfef8e8ad2c", "label": "NSX61-RC-ComputeClusterA" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 2 } }, { "key": "reservationStorages", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "classId": "StoragePath", "id": "f48a527b-30a6-4d54-8829-f549bc195b69", "label": "VNXe:qe-vnxe-nfs-1" } }, { "key": "storageFreeSizeGB", "value": { "type": "integer", "value": 120 } }, { "key": "storagePriority", "value": { "type": "integer", "value": 1 } }] } }] } }, { "key": "resourcePool", "value": { "type": "entityRef", "componentId": null, "classId": "ResourcePools", "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62", "label": "CoreDev" } { "text": "", "dependencyValues": { "entries": [{ "
Chapter 3 REST API Use Cases }] } } ” b Create a vCloud Air reservation by using the vRealize Automation reservation service. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations -d “ { "id": "bf922450-d495-460d-9dbf-1c09b0692db2", "name": "TestvAppReservation", "reservationTypeId": "Infrastructure.Reservation.Cloud.
Programming Guide "classId": "ComputeResource", "id": "c527a0f5-b1ae-4b61-8145-ad9d5c434dc7", "label": "Engineering Allocation VDC" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 0 } }, { "key": "allocationModel", "value": { "type": "integer", "value": 0 } }, { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [ { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Programming Guide } ] } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Chapter 3 REST API Use Cases ], "alerts": [ { "alertPercentLevel": 80, "referenceResourceId": "machine", "id": "machine" } ] }, "extensionData": { "entries": [ { "key": "computeResource", "value": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "9d1a3b5a-7162-4a5a-85b7-ec1b2824f554", "label": "EC2 841 Endpoint-us-east-1" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 0 } }, { "key": "securityGroups", "value": { "type": "multiple", "elementTypeId": "ENTI
Programming Guide "label": "test1" } ] } }, { "key": "locations", "value": { "type": "multiple", "elementTypeId": "ENTITY_REFERENCE", "items": [ { "type": "entityRef", "componentId": null, "classId": "AvailabilityZone", "id": "10", "label": "us-east-1a" } ] } }, { "key": "keyPairs", "value": { "type": "string", "value": "Per Provisioning Group" } } ] } }” 7 Use the reservation ID to verify that the reservation exists.
Chapter 3 REST API Use Cases Procedure u Display a list of supported vRealize Automation reservation types by using the reservation service. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations/types JSON Output for a vSphere Reservation { "links": [], "content": [{ "@type": "ReservationType", "createdDate": "2015-10-13T04:44:32.008Z", "lastUpdated": "2015-10-13T04:44:32.009Z", "version": 1, "id": "Infrastructure.Reservation.
Programming Guide "name": "vCloud", "description": "vCloud Air Reservation", "category": "Cloud", "serviceTypeId": "com.mycompany.csp.iaas.blueprint.service", "tenantId": null, "formReference": { "type": "external", "formId": "Infrastructure.Reservation.Cloud.vCloudAir.form.new" }, "schemaClassId": "Infrastructure.Reservation.Cloud.vCloudAir", "alertTypes": [ { "createdDate": "2015-11-06T10:21:06.010Z", "lastUpdated": "2015-11-06T10:21:06.
Chapter 3 REST API Use Cases "number": 1, "offset": 0 } } JSON Output for an Amazon Reservation { "links": [], "content": [{ { "@type": "ReservationType", "createdDate": "2015-10-13T04:44:32.074Z", "lastUpdated": "2015-10-13T04:44:32.075Z", "version": 1, "id": "Infrastructure.Cloud.Amazon", "name": "Amazon", "description": "Amazon Reservation", "category": "Cloud", "serviceTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide Parameter Description URL https://$host/reservation-service/api/reservations/types Method Get $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. Output The command output contains property names and values based on the command input parameters.
Chapter 3 REST API Use Cases Property alertTypes Metadata Description Contains the alert type list defined in the reservation type: n createdDate -- Alert type created date n lastUpdated -- Alert type last updated date n version -- Alert type version n id -- Unique identifier of alert type n name -- Name of alert type n description -- Long description of alert type n referenceResourceId -- Unique identifier of reference resource Specifies the paging-related data: Size: n n Specifies the maximum number
Programming Guide "tenantId": null, "formReference": { "type": "external", "formId": "Infrastructure.Reservation.Virtual.vSphere.form.new" }, "schemaClassId": "Infrastructure.Reservation.Virtual.vSphere", "alertTypes": [{ "createdDate": "2015-10-13T04:44:32.008Z", "lastUpdated": "2015-10-13T04:44:32.
Chapter 3 REST API Use Cases "name": "storage", "description": null, "referenceResourceId": "storage" }, { "createdDate": "2015-11-06T10:21:06.010Z", "lastUpdated": "2015-11-06T10:21:06.010Z", "version": 0, "id": "ef96fec4-a607-4944-a0af-fbe7df862ee2", "name": "memory", "description": null, "referenceResourceId": "memory" }, { "createdDate": "2015-11-06T10:21:06.011Z", "lastUpdated": "2015-11-06T10:21:06.
Programming Guide "version": 1, "id": "Infrastructure.Cloud.Amazon", "name": "Amazon", "description": "Amazon Reservation", "category": "Cloud", "serviceTypeId": "com.mycompany.csp.iaas.blueprint.service", "tenantId": null, "formReference": { "type": "external", "formId": "Infrastructure.Cloud.Amazon.form.new" }, "schemaClassId": "Infrastructure.Cloud.Amazon", "alertTypes": [{ "createdDate": "2015-10-13T04:44:32.075Z", "lastUpdated": "2015-10-13T04:44:32.
Chapter 3 REST API Use Cases Procedure u Display a schema definition for a specific vRealize Automation vSphere reservation type. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.Virtual.vSphere/default The schema definition in this example includes 9 extension fields that are supported for the vSphere type reservation.
Programming Guide "displayAdvice": null, "permissibleValues": { "type": "dynamic", "customAllowed": false, "dependencies": ["computeResource"] }, "state": { "dependencies": [], "facets": [] }, "isMultiValued": false }, { "id": "reservationVCNSSecurityGroups", "label": "Security Groups", "description": "Security groups of the vCNS settings", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "facets": [{ "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } }] }, "isMultiValued": false }, { "id": "computeResource", "label": "Compute Resource", "description": "The compute resource for the reservation", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "state": { "dependencies": [], "facets": [] }, "isMultiValued": false }, { "id": "reservationStorages", "label": "Storage", "dataType": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases }, "state": { "dependencies": [], "facets": [] }, "isMultiValued": false }, { "id": "reservationVCNSRoutedGateways", "label": "Routed Gateways", "dataType": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide Table 3‑8. Fields Common To All Reservation Types (Continued) Parameter Description Parameter Type subTenantId Specifies the subtenant ID that contains the reservation. GUID enabled Specifies whether the reservation is enabled. Boolean priority Specifies the priority of the reservation during VM provisioning. Integer reservationPolicyId Specifies the reservation policy ID to bind to this reservation. GUID alertPolicy Specifies the alert policy of the reservation.
Chapter 3 REST API Use Cases Parameter Description $token Specifies a valid HTTP bearer token with necessary credentials. $schemaclassid Specifies the schema class of the reservation type. The schema class ID for a vSphere reservation is Infrastructure.Reservation.Virtual.vSphere. Each supported reservation type contains specific fields. The supported fields are defined in the schema.
Programming Guide Property Description state Provides a structure for defining the state of a content construct, for example {@link LayoutSection}. The element state identifies the field paths in the client data context upon which that element state depends. For example, the callback facet result indicates that facet evaluation must be delegated to the server of the object. This evaluation may be dependent on data collected in the client data context.
Chapter 3 REST API Use Cases "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } }] }, "isMultiValued": true }, { "id": "reservationVCNSTransportZone", "label": "Transport Zone", "description": "Transport zone of the vCNS settings", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "dependencies": [], "facets": [] }, "isMultiValued": true }, { "id": "reservationMemory", "label": "Memory", "dataType": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "state": { "dependencies": [], "facets": [{ "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } }] }, "isMultiValued": false }, { "id": "machineQuota", "label": "Machine Quota", "description": "The machine quota for the reservation", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [], "facets": [] }, "isMultiValued": false }, { "id": "reservationStorages", "label":
Programming Guide "value": true } } }] }, "isMultiValued": true }, { "id": "resourcePool", "label": "Resource Pool", "description": "The resource pool for the reservation", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases Display a Schema Definition for an Amazon Reservation You can use the REST API reservation service to display a schema definition for a specific vRealize Automation reservation type, for example an Amazon reservation. Prerequisites n Log in to vRealize Automation as a fabric group administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available.
Programming Guide "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } }, { "type": "mandatory", "value": { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } } ] }, "isMultiValued": true }, { "id": "locations", "label": "Locations", "description": "The locations", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.
Chapter 3 REST API Use Cases ], "facets": [ { "type": "visible", "value": { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } }, { "type": "mandatory", "value": { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } } ] }, "isMultiValued": true }, { "id": "loadBalancers", "label": "Load balancers", "description": "The load balan
Programming Guide "locations", "computeResource" ] }, "state": { "dependencies": [ ], "facets": [ { "type": "visible", "value": { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } } ] }, "isMultiValued": true }, { "id": "specificKeyPairs", "label": "Specific key pair", "description": "The specific key pair", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases { "type": "visible", "value": { "type": "and", "subClauses": [ { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "keyPairs" } }, { "type": "expression", "operator": { "type": "equals" }, "leftOperand": { "type": "constant", "value": { "type": "string", "value": "Specific Key Pair" } }, "rightOperand": { "type": "path", "path": "keyPairs" } } ] } }, { "type": "mandatory", "value": { "type": "and", "subClauses": [ { "type": "exp
Programming Guide "leftOperand": { "type": "constant", "value": { "type": "string", "value": "Specific Key Pair" } }, "rightOperand": { "type": "path", "path": "keyPairs" } } ] } } ] }, "isMultiValued": false }, { "id": "computeResource", "label": "Compute Resource", "description": "The compute resource for the reservation", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases }, "isMultiValued": false }, { "id": "VPC", "label": "VPC", "dataType": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.Cloud.Amazon.VPC", "typeFilter": null, "label": "VPC", "schema": { "fields": [ { "id": "VPCSubnets", "label": "Subnets", "description": "The subnets.", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "type": "boolean", "value": true } } } ] }, "isMultiValued": true }, { "id": "VPCSecurityGroups", "label": "Security groups", "description": "The security groups", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases }, "isMultiValued": true }, { "id": "VPCName", "label": "VPC Name", "description": "The virtual private cloud.", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "state": { "dependencies": [ ], "facets": [ ] }, "isMultiValued": true } ] } }, "displayAdvice": "DATA_TABLE", "permissibleValues": { "type": "dynamic", "customAllowed": false, "dependencies": [ "computeResource" ] }, "state": { "dependencies": [ ], "facets": [ { "type": "visible", "value": { "type": "or", "subClauses": [ { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "locations" } } }, { "type": "not", "
Chapter 3 REST API Use Cases } } ] } }, { "type": "mandatory", "value": { "type": "or", "subClauses": [ { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "locations" } } }, { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "securityGroups" } } } ] } } ] }, "isMultiValued": true }, { "id": "machineQuota", "label": "Machine Quota", "description":
Programming Guide ], "facets": [ ] }, "isMultiValued": false }, { "id": "keyPairs", "label": "Key pair", "description": "The key pair", "dataType": { "type": "primitive", "typeId": "STRING" }, "displayAdvice": null, "permissibleValues": { "type": "static", "customAllowed": false, "values": [ { "underlyingValue": { "type": "string", "value": "Not Specified" }, "label": null }, { "underlyingValue": { "type": "string", "value": "Per Provisioning Group" }, "label": null }, { "underlyingValue": { "type": "strin
Chapter 3 REST API Use Cases { "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false } ] Syntax for Displaying a Schema Definition for an Amazon Reservation You can use the REST API reservation service to display a schema definition for a specific vRealize Automation reservation type, for example an Amazon reservation. Overview Each reservation contains several fields.
Programming Guide The following table describes the Amazon EC2 reservation types field IDs that appear in the output schema definitions. Table 3‑11.
Chapter 3 REST API Use Cases Property Description dataType Specifies the dataType field value: n type: Specifies the field value type: n Self refers to the object that was returned or requested. n First, Previous, Next, and Last refer to corresponding pages of a pageable list. n Specifies the application or service that determines the other names. componentTypeid: n Specifies the type ID of the component. component: n classId: n Specifies the unique identifier of the component.
Programming Guide Example: curl Command The following example command retrieves schema definition information for an Amazon type reservation. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.Cloud.Amazon/default Example: JSON Output The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases }, { "type": "mandatory", "value": { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } } ] }, "isMultiValued": true }, { "id": "locations", "label": "Locations", "description": "The locations", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "leftOperand": { "type": "path", "path": "VPC" } } } }, { "type": "mandatory", "value": { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } } ] }, "isMultiValued": true }, { "id": "loadBalancers", "label": "Load balancers", "description": "The load balancers", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "value": { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "VPC" } } } } ] }, "isMultiValued": true }, { "id": "specificKeyPairs", "label": "Specific key pair", "description": "The specific key pair", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "type": "path", "path": "keyPairs" } }, { "type": "expression", "operator": { "type": "equals" }, "leftOperand": { "type": "constant", "value": { "type": "string", "value": "Specific Key Pair" } }, "rightOperand": { "type": "path", "path": "keyPairs" } } ] } }, { "type": "mandatory", "value": { "type": "and", "subClauses": [ { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "keyPairs" } }, { "type": "expression", "operator": { "type": "e
Chapter 3 REST API Use Cases } ] } } ] }, "isMultiValued": false }, { "id": "computeResource", "label": "Compute Resource", "description": "The compute resource for the reservation", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "typeFilter": null, "label": "VPC", "schema": { "fields": [ { "id": "VPCSubnets", "label": "Subnets", "description": "The subnets.", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "label": "Security groups", "description": "The security groups", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "classId": "VirtualPrivateCloud", "typeFilter": null, "label": "Virtual Private Cloud" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "readOnly", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "VPCLoadBalancers", "label": "Load balancers", "description": "The load balancers.", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases } }, "displayAdvice": "DATA_TABLE", "permissibleValues": { "type": "dynamic", "customAllowed": false, "dependencies": [ "computeResource" ] }, "state": { "dependencies": [ ], "facets": [ { "type": "visible", "value": { "type": "or", "subClauses": [ { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "locations" } } }, { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDef
Programming Guide "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "locations" } } }, { "type": "not", "subClause": { "type": "expression", "operator": { "type": "isDefined" }, "leftOperand": { "type": "path", "path": "securityGroups" } } } ] } } ] }, "isMultiValued": true }, { "id": "machineQuota", "label": "Machine Quota", "description": "The machine quota for the reservation", "dataType": { "type": "primitive", "typeId": "I
Chapter 3 REST API Use Cases "dataType": { "type": "primitive", "typeId": "STRING" }, "displayAdvice": null, "permissibleValues": { "type": "static", "customAllowed": false, "values": [ { "underlyingValue": { "type": "string", "value": "Not Specified" }, "label": null }, { "underlyingValue": { "type": "string", "value": "Per Provisioning Group" }, "label": null }, { "underlyingValue": { "type": "string", "value": "Per Machine" }, "label": null }, { "underlyingValue": { "type": "string", "value": "Specific
Programming Guide }, "isMultiValued": false } ] Display a Schema Definition for a vCloud Air Reservation You can use the vRealize Automation REST API reservation service to display a schema definition for a specific reservation type, for example a vCloud Air reservation. Prerequisites n Log in to vRealize Automation as a fabric group administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available.
Chapter 3 REST API Use Cases }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "networkProfile", "label": "Network Profile", "description": "The Network Profile", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "permissibleValues": { "type": "dynamic", "customAllowed": false, "dependencies": [ "computeResource" ] }, "state": { "dependencies": [ ], "facets": [ { "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": true }, { "id": "allocationModel", "label": "Allocation Model", "description": "The allocation model for the reservation", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state
Chapter 3 REST API Use Cases "id": "reservationMemory", "label": "Memory", "dataType": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Programming Guide }, "isMultiValued": false } ] } }, "displayAdvice": "DATA_TABLE", "state": { "dependencies": [ ], "facets": [ ] }, "isMultiValued": false }, { "id": "computeResource", "label": "Compute Resource", "description": "The compute resource for the reservation", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases }, { "id": "machineQuota", "label": "Machine Quota", "description": "The machine quota for the reservation", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ ] }, "isMultiValued": false }, { "id": "reservationStorages", "label": "Storage", "dataType": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Programming Guide "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "storageReservationPriority", "label": "Priority", "description": "The reservation priority for the storage", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "computeResourceStorageTotalSiz
Chapter 3 REST API Use Cases "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "storageReservedSizeGB", "label": "This reservation reserved (GB)", "description": "The reserved capacity size (GB) for the storage", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ ] }, "isMultiValued": false }, { "id": "storageEnabled", "label": "Enabled", "description": "Whether the storage is enabled to reserve
Programming Guide "isMultiValued": false }, { "id": "computeResourceStorageFreeSizeGB", "label": "Free (GB)", "description": "The free capacity (GB) for the storage", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "readOnly", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false } ] } }, "displayAdvice": "DATA_TABLE", "permissibleValues": { "type": "dynamic",
Chapter 3 REST API Use Cases } ] }, "isMultiValued": true } ] } Syntax for Displaying a Schema Definition for a vCloud Air Reservation You can use the REST API reservation service to display a schema definition for a specific vRealize Automation reservation type, for example a vCloud Air reservation. Overview SomevRealize Automation reservation fields are common to all reservation types and some are type-specific. The list of type-specific fields is defined in a schema.
Programming Guide Table 3‑13. Extension Fields Supported in vCloud Reservations (Continued) Permissible Value Depends on Field Infrastructure.Reservation .Memory No NA Entity Reference ComputeResource Yes NA machineQuota Integer NA No NA reservationStorages Complex Type Infrastructure.Reservation .Storage Yes computeResource Field ID Data Type Type Class reservationMemory Complex Type computeResource Note The information in the table is subject to change.
Chapter 3 REST API Use Cases Property Description dataType Specifies the dataType field value: n type: Specifies the field value type: n Self refers to the object that was returned or requested. n First, Previous, Next, and Last refer to corresponding pages of a pageable list. n Specifies the application or service that determines the other names. componentTypeid: n Specifies the type ID of the component. component: n classId: n Specifies the unique identifier of the component.
Programming Guide Example: curl Command The following example command retrieves schema definition information for a vCloud Air reservation. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.Cloud.vCloudAir/default Example: JSON Output The schema definition in this example includes 6 extension fields that are supported for the vCloud Air type reservation.
Chapter 3 REST API Use Cases }, "isMultiValued": false }, { "id": "networkProfile", "label": "Network Profile", "description": "The Network Profile", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "value": true } } } ] }, "isMultiValued": true }, { "id": "allocationModel", "label": "Allocation Model", "description": "The allocation model for the reservation", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "readOnly", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "reservationMemory", "label": "Memory", "dataType": { "
Chapter 3 REST API Use Cases }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "readOnly", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "memoryReservedSizeMb", "label": "Memory Reservation (MB)", "description": "The reserved capacity (MB) for the memory", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ ] }, "isMultiValued
Programming Guide "id": "computeResource", "label": "Compute Resource", "description": "The compute resource for the reservation", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "isMultiValued": false }, { "id": "reservationStorages", "label": "Storage", "dataType": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.Storage", "typeFilter": null, "label": "Storage", "schema": { "fields": [ { "id": "storagePath", "label": "Storage Path", "description": "The storage path of the storage", "dataType": { "type": "ref", "componentTypeId": "com.mycompany.csp.iaas.
Programming Guide "state": { "dependencies": [ ], "facets": [ { "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "computeResourceStorageTotalSizeGB", "label": "Total (GB)", "description": "The total physical capacity (GB) for the storage", "dataType": { "type": "primitive", "typeId": "INTEGER" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "readOnly", "value": { "type": "consta
Chapter 3 REST API Use Cases "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ ] }, "isMultiValued": false }, { "id": "storageEnabled", "label": "Enabled", "description": "Whether the storage is enabled to reserve", "dataType": { "type": "primitive", "typeId": "BOOLEAN" }, "displayAdvice": null, "state": { "dependencies": [ ], "facets": [ { "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false }, { "id": "com
Programming Guide "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": false } ] } }, "displayAdvice": "DATA_TABLE", "permissibleValues": { "type": "dynamic", "customAllowed": false, "dependencies": [ "computeResource" ] }, "state": { "dependencies": [ ], "facets": [ { "type": "mandatory", "value": { "type": "constantClause", "value": { "type": "boolean", "value": true } } } ] }, "isMultiValued": true } ] } Get the Business Group ID for a Reservation
Chapter 3 REST API Use Cases n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. Procedure u Get business group ID for a vRealize Automation reservation with the reservation service.
Programming Guide "extensionData": { "entries": [] }, "tenant": "qe" }, { "@type": "Subtenant", "id": "92926c91-37de-4647-9aee-70b8d557ce8d", "name": "Quality Engineering", "description": "created by demo content", "subtenantRoles": null, "extensionData": { "entries": [{ "key": "iaas-manager-emails", "value": { "type": "string", "value": " user1@mycompany.
Chapter 3 REST API Use Cases Property Description Links Species an array of link objects, each of which contains the following parts: rel Specifies the name of the link. n Self refers to the object that was returned or requested. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service determines the other names. n href Content Specifies the URL which produces the result.
Programming Guide "value": "user1@mycompany.com" } }] }, "tenant": "qe" }, { "@type": "Subtenant", "id": "ade5b8d3-decf-405e-bd0b-297f976ef721", "name": "Finance", "description": "Finance", "subtenantRoles": null, "extensionData": { "entries": [{ "key": "iaas-manager-emails", "value": { "type": "string", "value": " user1@mycompany.
Chapter 3 REST API Use Cases "number": 1, "offset": 0 } } Get a Compute Resource for the Reservation You can use the REST API reservation service to obtain compute resources for vRealize Automation reservations. Prerequisites n Log in to vRealize Automation as a fabric group administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials.
Programming Guide JSON Output for a vSphere Reservation { "values": [{ "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "047e00f5-5424-4ed2-a751-4a334aeaff54", "label": "VC51-Cluster" }, "label": "VC51-Cluster" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "a4349488-9a56-4906-83a5-7d8b33c9d435", "label": "NSX61-RC-ManagementCluster" }, "label": "NSX61-RC-ManagementCluster" }, { "underlyingValue": { "
Chapter 3 REST API Use Cases "label": "EC2 841 Endpoint-us-west-1" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "4e362590-b634-4269-9da4-548260148fa3", "label": "EC2 841 Endpoint-us-west-2" }, "label": "EC2 841 Endpoint-us-west-2" }, { "underlyingValue": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "9d1a3b5a-7162-4a5a-85b7-ec1b2824f554", "label": "EC2 841 Endpoint-us-east-1" }, "label": "EC2 841 Endpoint-us-east-1
Programming Guide Parameter Description $token Specifies a valid HTTP bearer token with necessary credentials. $schemaclassid Specifies the schema class ID. For a vSphere reservation, specify Infrastructure.Reservation.Virtual.vSphere as the $schemaclassid value. For an Amazon EC2 reservation, specify Infrastructure.Reservation.Cloud.Amazon as the the $schemaclassid value. For a vCloud reservation, specify Infrastructure.Reservation.Cloud.vCloud as the the $schemaclassid value.
Chapter 3 REST API Use Cases Example: curl Command for an Amazon EC2 reservation The following command retrieves a compute resource for an Amazon EC2 reservation. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.Cloud.Amazon/default/computeResource/values -d “{}” Example: curl Command for a vCloud reservation The following command retrieves a compute resource for a vCloud reservation.
Programming Guide "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "cc254a84-95b8-434a-874d-bdfef8e8ad2c", "label": "NSX61-RC-ComputeClusterA" }, "label": "NSX61-RC-ComputeClusterA" }] } Example: JSON Output for an Amazon Reservation In this example, there are 3 available compute resources that you can use to create an Amazon EC2 reservation.
Chapter 3 REST API Use Cases Example: Output for a vCloud Reservation In this example, there is 1 available compute resource that you can use to create a vCloud reservation. Save a copy of the underlyingValue section of the compute resource that you want to an XML editor and use the section content later to create a reservation request.
Programming Guide } }] } }” The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases Table 3‑14. Extension Fields Supported in vSphere Reservations (Continued) Field ID Data Type Type Class Permissible Value Depends on Field resourcePool Entity Reference ResourcePools Yes computeResource reservationVCNSRouted Gateways Complex Type reservationVCNSRoutedG ateway Yes computeResource Note The information in the table is subject to change. Call the data and schema service to retrieve the latest field information.
Programming Guide Example: curl Command The following example command returns vSphere reservation storage information. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.Virtual.
Chapter 3 REST API Use Cases Get Resources Schema for an Amazon Reservation You can use the vRealize Automation REST API reservation service to display resource schema, such as storage and network information, for an Amazon reservation. Prerequisites n Log in to vRealize Automation as a fabric group administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Get the required compute resource ID.
Programming Guide "id": "10", "label": "default" }, "label": "default" } ] } Syntax for Getting Resources Schema for an Amazon Reservation You can use the REST API reservation service data and schema service to display resource schema information, such as storage and network data, for an Amazon reservation. Overview This example illustrates how to get a permissible value list for the securityGroups field. You can use the generated output as input for creating or updating an Amazon reservation. Table 3‑15.
Chapter 3 REST API Use Cases Parameter Description $schemaclassid Specifies the schema class ID. This example illustrates how to use the securityGroups field of an Amazon reservation type as an example. The schema class ID of an Amazon reservation is Infrastructure.Reservation.Cloud.Amazon. For this example, the input value for $schemaclassid is Infrastructure.Reservation.Cloud.Amazon. $fieldId Specifies the field ID of the resource. For example, the field ID for the resource pool is securityGroups.
Programming Guide Example: JSON Output The following JSON output is returned based on the command input. Copy the output from an underlyingValue section into an XML editor and use it as input to create or update a reservation.
Chapter 3 REST API Use Cases The following JSON output is returned based on the command input. { "values": [ { "underlyingValue": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Programming Guide } }, { "key": "storagePath", "value": { "type": "entityRef", "componentId": null, "classId": "Storage", "id": "e655aa78-e5fb-4722-9e8a-0cd4139248cf", "label": "High Performance Storage" } }, { "key": "computeResourceStorageFreeSizeGB", "value": { "type": "integer", "value": 691 } } ] } }, "label": "High Performance Storage" } ] } Syntax for Getting Resources Schema for a vCloud Air Reservation You can use the vRealize Automation REST API reservation service to display information about a
Chapter 3 REST API Use Cases Input Use the supported input parameters to control the command output. Parameter Description URL https://$host/reservation-service/api/dataservice/schema/$schemaclassid/default/$fieldid/values Method Post $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. $schemaclassid Specifies the schema class ID.
Programming Guide Example: curl Command The following example command returns vCloud Air reservation storage information. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/dataservice/schema/Infrastructure.Reservation.Cloud.vCloudAir/default/reservationStorages/values “ -d Example: JSON Output The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases "underlyingValue": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Programming Guide n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. n Display a list of the reservation types that are supported in the vRealize Automation server. See “Display a List of Supported Reservation Types,” on page 114. n Obtain the permissible value field information required to create a new reservation.
Chapter 3 REST API Use Cases "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide { "key": "memoryReservedSizeMb", "value": { "type": "integer", "value": 15872 } }] } } }, { "key": "computeResource", "value": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "cc254a84-95b8-434a-874d-bdfef8e8ad2c", "label": "NSX61-RC-ComputeClusterA" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 2 } }, { "key": "reservationStorages", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTy
Chapter 3 REST API Use Cases "value": { "type": "boolean", "value": true } }, { "key": "reservationStoragePath", "value": { "type": "entityRef", "componentId": null, "classId": "StoragePath", "id": "f48a527b-30a6-4d54-8829-f549bc195b69", "label": "VNXe:qe-vnxe-nfs-1" } }, { "key": "storageFreeSizeGB", "value": { "type": "integer", "value": 120 } }, { "key": "storagePriority", "value": { "type": "integer", "value": 1 } }] } }] } }, { "key": "resourcePool", "value": { "type": "entityRef", "componentId": null
Programming Guide Input Description URL https://$host/reservation-service/api/reservations Method Post $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. HTTP body The HTTP body describes the reservation to create and calls the REST API used to create the reservation.
Chapter 3 REST API Use Cases "id": "storage" }, { "alertPercentLevel": 20, "referenceResourceId": "memory", "id": "memory" }, { "alertPercentLevel": 30, "referenceResourceId": "cpu", "id": "cpu" }, { "alertPercentLevel": 40, "referenceResourceId": "machine", "id": "machine" }] }, "extensionData": { "entries": [{ "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "type": "string", "value": "custom-property-value2" } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "componentId": null, "classId": "reservationStorage", "typeFilter": null, "values": { "entries": [{ "key": "storageTotalSizeGB", "value": { "type": "integer", "value": 394 } }, { "key": "storageReservedSizeGB", "value": { "type": "integer", "value": 32 } }, { "key": "storageEnabled", "value": { "type": "boolean", "value": true } }, { "key": "reservationStoragePath", "value": { "type": "entityRef", "componentId": null, "classId": "StoragePath", "id": "f48a527b-30a6-4d54-8829-f54
Programming Guide "value": { "type": "entityRef", "componentId": null, "classId": "ResourcePools", "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62", "label": "CoreDev" } }] } } ” Example: JSON Output The following sample location URL is displayed, including the new vSphere reservation ID. Location: https://$host/reservation-service/api/reservations/94d74105-831a-4598-8f42-efd590fea15c Copy the output response into an XML editor for use in a future procedure, such as updating or deleting the reservation.
Chapter 3 REST API Use Cases "enabled": false, "frequencyReminder": 0, "emailBgMgr": true, "recipients": [ ], "alerts": [ { "alertPercentLevel": 80, "referenceResourceId": "storage", "id": "storage" }, { "alertPercentLevel": 80, "referenceResourceId": "memory", "id": "memory" }, { "alertPercentLevel": 80, "referenceResourceId": "cpu", "id": "cpu" }, { "alertPercentLevel": 80, "referenceResourceId": "machine", "id": "machine" } ] }, "extensionData": { "entries": [ { "key": "computeResource", "value": { "typ
Programming Guide { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [ { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Chapter 3 REST API Use Cases "componentId": null, "classId": "Storage", "id": "e655aa78-e5fb-4722-9e8a-0cd4139248cf", "label": "High Performance Storage" } }, { "key": "storagePriority", "value": { "type": "integer", "value": 1 } }, { "key": "storageReservedSizeGB", "value": { "type": "integer", "value": 100 } }, { "key": "storageEnabled", "value": { "type": "boolean", "value": true } }, { "key": "computeResourceStorageFreeSizeGB", "value": { "type": "integer", "value": 691 } } ] } } ] } }, { "key": "reser
Programming Guide } }, { "key": "memoryReservedSizeMb", "value": { "type": "integer", "value": 4096 } } ] } } } ] } } “ The output is a location URL, including the new vCloud Air reservation ID. Location: https://$host/reservation-service/api/reservations/3289b039-2a11-4ab4-a0bc-b583e4c6d085 Syntax for Creating a vCloud Air Reservation You can use the REST API reservation service to create a vCloud Air reservation. Input Use the supported input parameters to control the command output.
Chapter 3 REST API Use Cases Property Description status When the reservation is successfully created, the HTTP response status is 201 created. Header.Location The HTTP response contains a Location attribute that is formatted as https://$host /reservation-service/api/reservations/$reservationId. $reservationId Specifies the new reservation ID. Example: curl Command The following sample command creates a vCloud Air reservation. The HTTP body is included as part of the command line input.
Programming Guide { "key": "computeResource", "value": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "c527a0f5-b1ae-4b61-8145-ad9d5c434dc7", "label": "Engineering Allocation VDC" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 0 } }, { "key": "allocationModel", "value": { "type": "integer", "value": 0 } }, { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [ { "type": "complex", "componentTypeId": "com.
Chapter 3 REST API Use Cases "key": "reservationStorages", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [ { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Programming Guide "value": 691 } } ] } } ] } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Chapter 3 REST API Use Cases n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. n Display a list of the reservation types that are supported in the vRealize Automation server. See “Display a List of Supported Reservation Types,” on page 114.
Programming Guide { "key": "machineQuota", "value": { "type": "integer", "value": 0 } }, { "key": "securityGroups", "value": { "type": "multiple", "elementTypeId": "ENTITY_REFERENCE", "items": [ { "type": "entityRef", "componentId": null, "classId": "AmazonSecurityGroup", "id": "10", "label": "default" } ] } }, { "key": "loadBalancers", "value": { "type": "multiple", "elementTypeId": "ENTITY_REFERENCE", "items": [ { "type": "entityRef", "componentId": null, "classId": "ElasticLoadBalancer", "id": "3", "lab
Chapter 3 REST API Use Cases { "key": "keyPairs", "value": { "type": "string", "value": "Per Provisioning Group" } } ] } }” The output is a sample location URL, including the new Amazon reservation ID. Location: https://$host/reservation-service/api/reservations/3289b039-2a11-4ab4-a0bcb583e4c6d085 Syntax for Creating an Amazon Reservation You can use the REST API reservation service to create an Amazon reservation. Input Use the supported input parameters to control the command output.
Programming Guide Example: curl Command The following example command creates an Amazon reservation. The HTTP body is included as part of the command line input. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations -d “ { "name": "TestEC2Reservation", "reservationTypeId": "Infrastructure.Reservation.Cloud.
Chapter 3 REST API Use Cases { "type": "entityRef", "componentId": null, "classId": "AmazonSecurityGroup", "id": "10", "label": "default" } ] } }, { "key": "loadBalancers", "value": { "type": "multiple", "elementTypeId": "ENTITY_REFERENCE", "items": [ { "type": "entityRef", "componentId": null, "classId": "ElasticLoadBalancer", "id": "3", "label": "test1" } ] } }, { "key": "locations", "value": { "type": "multiple", "elementTypeId": "ENTITY_REFERENCE", "items": [ { "type": "entityRef", "componentId": null,
Programming Guide Example: JSON Output The following sample location URL is displayed, including the new Amazon reservation ID. Location: https://$host/reservation-service/api/reservations/3289b039-2a11-4ab4-a0bc-b583e4c6d085 Copy the output response into an XML editor for use in a future procedure, such as updating or deleting the reservation.
Chapter 3 REST API Use Cases }, { "alertPercentLevel": 20, "referenceResourceId": "memory", "id": "memory" }, { "alertPercentLevel": 30, "referenceResourceId": "cpu", "id": "cpu" }, { "alertPercentLevel": 40, "referenceResourceId": "machine", "id": "machine" }] }, "extensionData": { "entries": [{ "key": "key4", "value": { "type": "string", "value": "custom-property-value4" } }, { "key": "key3", "value": { "type": "string", "value": "custom-property-value3" } }, { "key": "reservationNetworks", "value": { "t
Programming Guide "key": "reservationNetworkPath", "value": { "type": "entityRef", "componentId": null, "classId": "Network", "id": "44cb65d5-b321-43dd-a2ab-8ecf387bff8f", "label": "VM Network SQA" } }] } }] } }, { "key": "key0", "value": { "type": "string", "value": "custom-property-value0" } }, { "key": "key2", "value": { "type": "string", "value": "custom-property-value2" } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "value": { "type": "string", "value": "custom-property-value-Updated" } }, { "key": "computeResource", "value": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "047e00f5-5424-4ed2-a751-4a334aeaff54", "label": "VC51-Cluster" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 2 } }, { "key": "reservationStorages", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.
Programming Guide { "key": "reservationStoragePath", "value": { "type": "entityRef", "componentId": null, "classId": "StoragePath", "id": "f48a527b-30a6-4d54-8829-f549bc195b69", "label": "VNXe:qe-vnxe-nfs-1" } }, { "key": "storageFreeSizeGB", "value": { "type": "integer", "value": 120 } }, { "key": "reservationStorageReservationPriority", "value": { "type": "integer", "value": 1 } }] } }] } }, { "key": "resourcePool", "value": { "type": "entityRef", "componentId": null, "classId": "ResourcePools", "id": "4
Chapter 3 REST API Use Cases ], "alerts": [ { "alertPercentLevel": 80, "referenceResourceId": "storage", "id": "storage" }, { "alertPercentLevel": 80, "referenceResourceId": "memory", "id": "memory" }, { "alertPercentLevel": 80, "referenceResourceId": "cpu", "id": "cpu" }, { "alertPercentLevel": 80, "referenceResourceId": "machine", "id": "machine" } ] }, "extensionData": { "entries": [ { "key": "computeResource", "value": { "type": "entityRef", "componentId": null, "classId": "ComputeResource", "id": "c52
Programming Guide "elementTypeId": "COMPLEX", "items": [ { "type": "complex", "componentTypeId": "com.vmware.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Chapter 3 REST API Use Cases } }, { "key": "storageReservationPriority", "value": { "type": "integer", "value": 1 } }, { "key": "storageReservedSizeGB", "value": { "type": "integer", "value": 100 } }, { "key": "storageEnabled", "value": { "type": "boolean", "value": true } }, { "key": "computeResourceStorageFreeSizeGB", "value": { "type": "integer", "value": 691 } } ] } } ] } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.vmware.csp.iaas.blueprint.
Programming Guide "value": { "type": "integer", "value": 4096 } } ] } } } ] } } Syntax for Verifying a Reservation and Getting Reservation Details After you create a vRealize Automation reservation, you can use the REST API reservation service and the reservation ID to verify that the reservation exists. You can also use the ID to get information about the reservation in preparation for updating or deleting it. Input Use the supported input parameters to control the command output.
Chapter 3 REST API Use Cases Example: JSON Output for a vSphere Reservation The following JSON output is returned based on the command input. Copy the output response into an XML editor for future step usage. { "id": "94d74105-831a-4598-8f42-efd590fea15c ", "name": "TestReservation", "reservationTypeId": "Infrastructure.Reservation.Virtual.
Programming Guide { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "componentId": null, "classId": "reservationMemory", "typeFilter": null, "values": { "entries": [{ "key": "hostMemoryTotalSizeMB", "value": { "type": "integer", "value": 57187 } }, { "key": "reservationMemoryReservedSizeMb", "value": { "type": "integer", "value": 15888 } }] } } }, { "key": "key1", "value": { "type": "string", "value": "custom-property-value-Updated" } }, { "key": "computeResource", "value": { "type": "entityRef", "componentId": null, "classId": "ComputeResource
Programming Guide "typeFilter": null, "values": { "entries": [{ "key": "storageTotalSizeGB", "value": { "type": "integer", "value": 394 } }, { "key": "reservationStorageReservedSizeGB", "value": { "type": "integer", "value": 31 } }, { "key": "reservationStorageEnabled", "value": { "type": "boolean", "value": true } }, { "key": "reservationStoragePath", "value": { "type": "entityRef", "componentId": null, "classId": "StoragePath", "id": "f48a527b-30a6-4d54-8829-f549bc195b69", "label": "VNXe:qe-vnxe-nfs-1" }
Chapter 3 REST API Use Cases "componentId": null, "classId": "ResourcePools", "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62", "label": "CoreDev" } }] } } Example: Example Output for a vCloud Reservation { "id": "bf922450-d495-460d-9dbf-1c09b0692db2", "name": "TestvAppReservation", "reservationTypeId": "Infrastructure.Reservation.Cloud.
Programming Guide "componentId": null, "classId": "ComputeResource", "id": "c527a0f5-b1ae-4b61-8145-ad9d5c434dc7", "label": "Engineering Allocation VDC" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 0 } }, { "key": "allocationModel", "value": { "type": "integer", "value": 0 } }, { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [ { "type": "complex", "componentTypeId": "com.vmware.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "items": [ { "type": "complex", "componentTypeId": "com.vmware.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Programming Guide } } ] } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.vmware.csp.iaas.blueprint.service", "componentId": null, "classId": "Infrastructure.Reservation.
Chapter 3 REST API Use Cases Procedure u Display a list of existing vRealize Automation reservations. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations The following sample output lists two vSphere reservations, named MyTestReservation1 and MyTestReservation2 . { "links": [], "content": [{ "id": "94d74105-831a-4598-8f42-efd590fea15c ", "name": "TestReservation", "reservationTypeId": "Infrastructure.Reservation.Virtual.
Programming Guide { "key": "key3", "value": { "type": "string", "value": "custom-property-value3" } }, { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases }] } }, { "key": "resourcePool", "value": { "type": "entityRef", "componentId": null, "classId": "ResourcePools", "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62", "label": "CoreDev" } }], "metadata": { "size": 0, "totalElements": 1, "totalPages": 1, "number": 1, "offset": 0 } } Syntax for Displaying a List of Reservations You can use the REST API reservation service to display a list of existing vRealize Automation reservations.
Programming Guide Property Description Size Specifies the maximum number of rows per page. totalElements 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. Example: curl Command The following example command displays a list of reservations.
Chapter 3 REST API Use Cases }, { "alertPercentLevel": 40, "referenceResourceId": "machine", "id": "machine" }] }, "extensionData": { "entries": [{ "key": "key4", "value": { "type": "string", "value": "custom-property-value4" } }, { "key": "key3", "value": { "type": "string", "value": "custom-property-value3" } }, { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide }] } }, { "key": "key0", "value": { "type": "string", "value": "custom-property-value0" } }, { "key": "key2", "value": { "type": "string", "value": "custom-property-value2" } }, { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "classId": "ComputeResource", "id": "047e00f5-5424-4ed2-a751-4a334aeaff54", "label": "VC51-Cluster" } }, { "key": "machineQuota", "value": { "type": "integer", "value": 2 } }, { "key": "reservationStorages", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide { "key": "storageFreeSizeGB", "value": { "type": "integer", "value": 120 } }, { "key": "reservationStorageReservationPriority", "value": { "type": "integer", "value": 1 } }] } }] } }, { "key": "resourcePool", "value": { "type": "entityRef", "componentId": null, "classId": "ResourcePools", "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62", "label": "CoreDev" } }], "metadata": { "size": 0, "totalElements": 1, "totalPages": 1, "number": 1, "offset": 0 } } Update a Reservation You can use the RES
Chapter 3 REST API Use Cases Procedure u Use the reservation service to update an existing reservation. The following example command updates a reservation with an ID of 94d74105-831a-4598-8f42efd590fea15c. curl –X PUT--insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations/94d74105-831a-4598-8f42-efd590fea15c –d “ { "id": "94d74105-831a-4598-8f42-efd590fea15c", "name": "TestReservation", "reservationTypeId": "Infrastructure.Reservation.
Programming Guide "value": { "type": "string", "value": "custom-property-value3" } }, { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases { "key": "reservationMemory", "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases } }, { "key": "resourcePool", "value": { "type": "entityRef", "componentId": null, "classId": "ResourcePools", "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62", "label": "CoreDev" } }] } } ” The following output is returned based on the command input. If the command is successful, the HTTP response body is empty except for a 204 No Content status statement.
Programming Guide Example: curl Command The following example command updates the reservation with an ID of 94d74105-831a-4598-8f42efd590fea15c to use compute resource ID 047e00f5-5424-4ed2-a751-4a334aeaff54. curl –X PUT--insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations/94d74105-831a-4598-8f42-efd590fea15c –d “ { "name": "TestReservation", "reservationTypeId": "Infrastructure.Reservation.Virtual.
Chapter 3 REST API Use Cases "value": "custom-property-value3" } }, { "key": "reservationNetworks", "value": { "type": "multiple", "elementTypeId": "COMPLEX", "items": [{ "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide "value": { "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Chapter 3 REST API Use Cases "type": "complex", "componentTypeId": "com.mycompany.csp.iaas.blueprint.
Programming Guide { "key": "resourcePool", "value": { "type": "entityRef", "componentId": null, "classId": "ResourcePools", "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62", "label": "CoreDev" } }] } } ” Example: JSON Output If the command is successful, the HTTP response body is empty except for a 204 No Content status statement. Delete a Reservation You can use the vRealize Automation REST API reservation service to delete an existing reservation.
Chapter 3 REST API Use Cases Parameter Description URL https://$host/reservation-service/api/reservations/$reservationId Method Delete $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. $reservationId Specifies the unique identifier of the reservation to delete.
Programming Guide Procedure u Run the following example command to list all available reservation policies. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/reservation-service/api/reservations/policies The following example output lists two reservation policies, named reservationPolicyTest and reservationPolicyTest2. You can use the ID value for each reservation policy to update or delete them.
Chapter 3 REST API Use Cases Property Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object which was returned or requested. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Programming Guide "metadata": { "size": 0, "totalElements": 2, "totalPages": 1, "number": 1, "offset": 0 } } Create a Reservation Policy You can use the REST API reservation service to create a reservation policy. For information about available command input and output parameters, see “Syntax for Creating a Reservation Policy,” on page 268. Prerequisites n Log in to vRealize Automation as a fabric group administrator.
Chapter 3 REST API Use Cases Parameter Description $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. HTTP body Describes the reservation policy to create. n $name - reservation policy name n $description - reservation policy description $reservationPolicyTypeId Specifies the reservation policy type ID. The supported reservation policy types are Reservation.
Programming Guide Display a Reservation Policy by ID You can use the REST API reservation service with a reservation policy ID to display information about a specific reservation policy. For information about available command input and output parameters, see “Syntax for Displaying a Reservation Policy by ID,” on page 270. Prerequisites n Log in to vRealize Automation as a fabric group administrator.
Chapter 3 REST API Use Cases Parameter Description $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server. $token Specifies a valid HTTP bearer token with necessary credentials. Example: Output The command output contains property names and values based on the command input parameters. Parameter Description $id Specifies the reservation policy ID. $name Specifies the reservation policy name.
Programming Guide Procedure 1 Query the reservation policy and copy the response output to an editor. 2 Change the following information to use as the basis of the command input for this task. 3 n Reservation policy name n Reservation policy description n Reservation policy type ID Update the name and description values for the reservation policy ID. The following example syntax updates the information for reservation policy ID 94d74105-831a-4598-8f42-efd590fea15c.
Chapter 3 REST API Use Cases Output If the command is successful, the HTTP response body is empty except for a 204 No Content status statement. Example: curl Command The following example command updates the name and description values for the reservation policy with an ID of 94d74105-831a-4598-8f42-efd590fea15c.
Programming Guide Syntax for Deleting a Reservation Policy Syntax You can use the REST API reservation service to delete a vRealize Automation reservation policy. Input Use the supported input parameters to control the command output. Parameter Description URL https://$host/reservation-service/api/reservations/policies/$id Method Delete $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server.
Chapter 3 REST API Use Cases Procedure u Use the following sample command to list all available reservation policies. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/iaas-proxy-provider/api/keyPairs The following JSON output is returned based on your command input.
Programming Guide +NvBmbozpDkH9wg3mQ1SOP5iSMAMue6fx+b/SpOZ5MPnNjRo +VXG3qFl936AB4F1F2ObD27GyjibeYmhQkITtp/yGYCZ68PhCun0/eiEjmXiOUx/5jYGOUEZ1Ddojhc5M/PClR46vQ/3I yv5pUGPno +wkn34lk6s2PO2axrXvQqTwoiYC3f2p1gp0qYidIzKa2KHrUCOF4hnjQ3v3z93ORMCK3wN5uQ3xMFOd7+1XpetxvG9d7L 1lU/sgCVmEhdOSnhLC5Jeq70MVwixPocnJR4nyotPE==" },//Omit 18 more key pairs ], "metadata": { "size": 0, "totalElements": 20, "totalPages": 1, "number": 1, "offset": 0 } } What to do next Syntax for Getting a Key Pair List You can use the vRealize
Chapter 3 REST API Use Cases Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Programming Guide "@type": "KeyPair", "id": 26, "name": "TestKeyPair", "computeResourceId": "ca4dcca0-85ce-49dd-8371-4ce7c8e2d5e6", "secretKey": "" }, { "@type": "KeyPair", "id": 27, "name": "EC2KeyPair", "computeResourceId": "ca4dcca0-85ce-49dd-8371-4ce7c8e2d5e6", "secretKey": "jmfhkPFLe1xF4LsgxyYDlBH65IjiKsNH3xgeUhNt6AyIcSA2eZsxH9FNFcDst1cRLQUmLYLUCN6ZlrVtD3C5CYAOEE9UplO +YKnAcqUSyXB6PQ3I/NuebdtGrx38fkTJsEpRqxLppWPJpVlHYRO2O7GhhWnE6F3bPwwg3dWwymqWHxBZlCcuEcztovbhN8r 7/hKsXKbNSJz +J8DVhPB7PPdHJJ4E/6a9IXkN
Chapter 3 REST API Use Cases Create a Key Pair You can use the vRealize Automation REST API to create a key pair. Prerequisites n Log in to vRealize Automation as a tenant administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. n Get the required compute resource ID.
Programming Guide +bXZzwgFQ2JE4SYxojNHPYwBjadFm0A2eVPtOivMYYYr8FCUYtfbjjIS1TyJaKIFhhqs6bA6/PH +NvBmbozpDkH9wg3mQ1SOP5iSMAMue6fx+b/SpOZ5MPnNjRo +VXG3qFl936AB4F1F2ObD27GyjibeYmhQkITtp/yGYCZ68PhCun0/eiEjmXiOUx/5jYGOUEZ1Ddojhc5M/PClR46vQ/3I yv5pUGPno +wkn34lk6s2PO2axrXvQqTwoiYC3f2p1gp0qYidIzKa2KHrUCOF4hnjQ3v3z93ORMCK3wN5uQ3xMFOd7+1XpetxvG9d7L 1lU/sgCVmEhdOSnhLC5Jeq70MVwixPocnJR4nyotPE==" } “ Syntax for Creating a Key Pair You can use the vRealize Automation REST API to create a key pair.
Chapter 3 REST API Use Cases { "name": "TestKeyPair", "computeResourceId": "ca4dcca0-85ce-49dd-8371-4ce7c8e2d5e6", "secretKey": "jmfhkPFLe1xF4LsgxyYDlBH65IjiKsNH3xgeUhNt6AyIcSA2eZsxH9FNFcDst1cRLQUmLYLUCN6ZlrVtD3C5CYAOEE9UplO +YKnAcqUSyXB6PQ3I/NuebdtGrx38fkTJsEpRqxLppWPJpVlHYRO2O7GhhWnE6F3bPwwg3dWwymqWHxBZlCcuEcztovbhN8r 7/hKsXKbNSJz +J8DVhPB7PPdHJJ4E/6a9IXkNQs/T0NknCOyc0YcFVpgrc3PMGabi8vd/7v0nEtDARyA8WwAGgtedHGtBo2gciY1Bu/0SNr2y CzsZcqbVeg4ufkjlv0G1Ed1FfGHMh5kuVC7alk2aSI5YkWnS4d9YJYi7diYmc7GmrVW0XWNz4kEMdQ
Programming Guide n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. Procedure u Use the following sample command to query a key pair.
Chapter 3 REST API Use Cases Example: JSON Output The following JSON output is returned based on the command input. { "id": 26, "name": "TestKeyPair", "computeResourceId": "ca4dcca0-85ce-49dd-8371-4ce7c8e2d5e6", "secretKey": "" } Update a Key Pair You can use the vRealize Automation REST API to update an existing key pair. Prerequisites n Log in to vRealize Automation as a tenant administrator.
Programming Guide I3sIL3CeGr7ynhOTEEQiAOWqgIUyDvrvc2Ma4RjjI4b3eFfBMkLWqTqs33+/5QktQz +p5JrIb192STI/PwHY51MfkbDErpeNFY479P7yKlZGbB8WVBfFpJCoVTQoZNio1ZhA7nA+rkqNbM4mcHQ +ZaYfxCc1UKO1AYBGS9ARz5OtYQU64Ei7tpWUbsYDXIA9Ss4VRASHvA7M3s +N61TPQ9HZuof/c6TbzOWE0ojtxEyO3sDsBWumm13/61+JT3k0rIdmV25aVvxrUv1S3JLI/o/zGgR9yTOeADIXHWsF4lQ yai9MnmEaclHVWmK+LiVZSAfk6auEm +13a24+UM9Mg6ninfzeIq0cjdT3OUweXgDnK0BMGX0wfSIYIrpRrDr9QdVoHGtdqZvJ62F8aITjO8urIK +bXZzwgFQ2JE4SYxojNHPYwBjadFm0A2eVPtOivMYYYr8FCUYtfbjjIS1TyJaKIFhhqs6bA6/PH +
Chapter 3 REST API Use Cases Example: curl Command curl –X PUT --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/iaas-proxy-provider/api/keyPairs/26 -d “ { "id": 26, "name": "TestKeyPair", "computeResourceId": "ca4dcca0-85ce-49dd-8371-4ce7c8e2d5e6", "secretKey": "jmfhkPFLe1xF4LsgxyYDlBH65IjiKsNH3xgeUhNt6AyIcSA2eZsxH9FNFcDst1cRLQUmLYLUCN6ZlrVtD3C5CYAOEE9UplO +YKnAcqUSyXB6PQ3I/NuebdtGrx38fkTJsEpRqxLppWPJpVlHYRO2O7GhhWnE6F3bPwwg3dWwymqWHxBZlCcuEcztovbhN8r 7/hKsXKbNSJz +J8
Programming Guide n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. Procedure u Use the following sample command to delete a key pair.
Chapter 3 REST API Use Cases Example: JSON Output The output contains an empty HTTP response body and the following status code. 204 No Content Working with Network Profiles You can use the vRealize Automation IaaS proxy provider service and IPAM service REST API to create, list, and update network profiles. You can access the following types of network profile by using the same programming calls. Different types of network profiles contain different fields.
Programming Guide n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. Procedure u Use the following sample command to list all available network profiles. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/ iaas-proxy-provider/api/network/profiles The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases "lastModifiedDate": "2014-11-11T02:29:05.000Z" }, { "id": "f6deba8c-fbf4-4ea0-9d9c-325e9db2f13e", "name": null, "description": null, "IPv4Address": "10.118.190.114", "IPSortValue": 0, "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:29:05.000Z", "lastModifiedDate": "2014-11-11T02:29:05.000Z" }, { "id": "9d5a9d25-26d7-4ce3-93a2-61242a88c5b2", "name": null, "description": null, "IPv4Address": "10.118.190.
Programming Guide "dnsSuffix": "mycompany.com", "dnsSearchSuffix": "", "primaryWinsAddress": "10.0.0.1", "secondaryWinsAddress": "", "dhcpStartIPAddress": null, "dhcpEndIPAddress": null, "leaseTimeInSeconds": 0 }, { "@type": "PrivateNetworkProfile", "id": "594e4016-b067-4d19-aa81-63502675f925", "name": "privateTest", "description": "", "createdDate": "2014-11-11T02:26:44.000Z", "lastModifiedDate": "2014-11-11T02:26:44.
Chapter 3 REST API Use Cases "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:25:57.000Z", "lastModifiedDate": "2014-11-11T02:25:57.000Z" }, ] } ], "profileType": "PRIVATE", "subnetMask": "255.255.255.0", "gatewayAddress": "10.118.190.230", "dhcpStartIPAddress": null, "dhcpEndIPAddress": null, "leaseTimeInSeconds": 0 }, { "@type": "RoutedNetworkProfile", "id": "a3dbfc76-7eab-4c1f-8f59-8fcc0b50ec6c", "name": "routedTest", "description": "", "createdDate": "2014-11-11T02:31:11.
Programming Guide "isHidden": false, "definedRanges": [ { "id": "3a85a049-522f-4b64-8f60-6e7b252ad204", "name": "range", "description": "", "beginIPv4Address": "10.110.183.200", "endIPv4Address": "10.110.183.201", "state": "UNALLOCATED", "createdDate": "2014-11-11T02:23:38.000Z", "lastModifiedDate": "2014-11-11T02:23:38.000Z", "definedAddresses": [ { "id": "f229ea1a-18de-4dae-ae7b-0cec7feaa99b", "name": null, "description": null, "IPv4Address": "10.110.183.
Chapter 3 REST API Use Cases "lastModifiedDate": "2014-11-11T02:24:04.000Z" }, "id": "43d8bae4-7b78-40d2-a9ef-350d28901c24", "name": null, "description": null, "IPv4Address": "10.110.183.180", "IPSortValue": 0, "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:24:04.000Z", "lastModifiedDate": "2014-11-11T02:24:04.000Z" }, { "id": "c270ce8e-a418-4d02-89db-3b84f6816a75", "name": null, "description": null, "IPv4Address": "10.110.183.
Programming Guide "number": 1, "offset": 0 } } Syntax for Getting a Network Profile List You can use the vRealize Automation IaaS proxy provider REST API to get a list of current network profiles. Input Use the supported input parameters to control the command output. Parameter Description URL https://$host/iaas-proxy-provider/api/network/profiles Method Get $host Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server.
Chapter 3 REST API Use Cases Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Programming Guide Parameter Description n If you are creating or querying an external network profile that uses extrernal, IPAM , specifies the endpoint ID for the external IPAM provider. If you are creating a network profile and the profile does not use external IPAM, code null for this value. subnetMask: n Specifies the subnet mask. gatewayAddress: n Specifies the IP address of the network gateway. primaryDnsAddress: n Specifies the IP address of the primary DNS server.
Chapter 3 REST API Use Cases Parameter Description n n Number: Specifies the current page number. Offset: Specifies the number of rows skipped. Example: curl Command The following example command returns a list of network profiles. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/ iaas-proxy-provider/api/network/profiles Example: JSON Output The following JSON output is returned based on the command input.
Programming Guide "IPSortValue": 0, "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:29:05.000Z", "lastModifiedDate": "2014-11-11T02:29:05.000Z" }, { "id": "f6deba8c-fbf4-4ea0-9d9c-325e9db2f13e", "name": null, "description": null, "IPv4Address": "10.118.190.114", "IPSortValue": 0, "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:29:05.000Z", "lastModifiedDate": "2014-11-11T02:29:05.
Chapter 3 REST API Use Cases "subnetMask": "255.255.255.0", "gatewayAddress": "10.118.190.230", "primaryDnsAddress": "10.110.182.45", "secondaryDnsAddress": "", "dnsSuffix": "mycompany.com", "dnsSearchSuffix": "", "primaryWinsAddress": "10.0.0.
Programming Guide "name": null, "description": null, "IPv4Address": "10.118.190.112", "IPSortValue": 0, "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:25:57.000Z", "lastModifiedDate": "2014-11-11T02:25:57.000Z" }, ] } ], "profileType": "PRIVATE", "subnetMask": "255.255.255.0", "gatewayAddress": "10.118.190.
Chapter 3 REST API Use Cases "name": "externalTest", "description": "", "createdDate": "2014-11-11T02:24:07.000Z", "lastModifiedDate": "2014-11-11T02:24:07.000Z", "isHidden": false, "definedRanges": [ { "id": "3a85a049-522f-4b64-8f60-6e7b252ad204", "name": "range", "description": "", "beginIPv4Address": "10.110.183.200", "endIPv4Address": "10.110.183.201", "state": "UNALLOCATED", "createdDate": "2014-11-11T02:23:38.000Z", "lastModifiedDate": "2014-11-11T02:23:38.
Programming Guide "IPSortValue": 0, "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:24:04.000Z", "lastModifiedDate": "2014-11-11T02:24:04.000Z" }, "id": "43d8bae4-7b78-40d2-a9ef-350d28901c24", "name": null, "description": null, "IPv4Address": "10.110.183.180", "IPSortValue": 0, "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:24:04.000Z", "lastModifiedDate": "2014-11-11T02:24:04.
Chapter 3 REST API Use Cases "size": 0, "totalElements": 4, "totalPages": 1, "number": 1, "offset": 0 } } Create a Network Profile You can use the vRealize Automation IaaS proxy provider REST API to create an external, NAT, or routed network profile. Prerequisites n Log in to vRealize Automation as a tenant administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available.
Programming Guide "dnsSuffix": "mycompany.com", "dnsSearchSuffix": "", "primaryWinsAddress": "10.0.0.1", "secondaryWinsAddress": "" } “ The JSON output consists of a location URL, which points to the newly created network profile. The output contains an empty HTTP response body and the following or similar header statement. Copy the location URL into a text editor for future use. Location: https://vcac148-084-241.eng.mycompany.
Chapter 3 REST API Use Cases "@type": "ExternalNetworkProfile", "name": "externalTestCreate", "description": "", "isHidden": false, "definedRanges": [ { "name": "range", "description": "", "beginIPv4Address": "10.110.183.221", "endIPv4Address": "10.110.183.240", "state": "UNALLOCATED" } ], "profileType": "EXTERNAL", "IPAMEndpointId": null, "subnetMask": "255.255.255.0", "gatewayAddress": "10.110.183.253", "primaryDnsAddress": "10.110.182.45", "secondaryDnsAddress": "", "dnsSuffix": "mycompany.
Programming Guide Input Description $token Specifies a valid HTTP bearer token with necessary credentials. HTTP Body The HTTP body specifies the information for creating an external IPAM profile. n profileType n Specify EXTERNAL for this parameter. id n Specifies null. name n Specifies the name of the profile. IPAMEndpointId n Specifies the endpoint ID for an external IPAM provider. addressSpaceExternalId n Specify the address space of the IPAM provider.
Chapter 3 REST API Use Cases Property Description status The http response should contain a Location attribute that is formatted as https://$host/iaas-proxy-provider/api/keyPairs/$keypairID. Header.Location The HTTP response should contain a Location attribute that is formatted as https://$host/iaas-proxyprovider/api/network/profiles/$networkProfileID. $networkProfileID Specifies the unique identifier of the new network profile.
Programming Guide n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. n Obtain the network profile ID to query. See “Get a Network Profile List,” on page 287. Procedure u Use the following command to query the existing network profile ID 68b6a183-fc8a-4592af23-92f8d410ee32.
Chapter 3 REST API Use Cases "state": "UNALLOCATED", "hostName": "", "createdDate": "2014-11-11T02:23:38.000Z", "lastModifiedDate": "2014-11-11T02:23:38.000Z" }, } ], "profileType": "EXTERNAL", "IPAMEndpointId": null, "subnetMask": "255.255.255.0", "gatewayAddress": "10.110.183.253", "primaryDnsAddress": "10.110.182.45", "secondaryDnsAddress": "", "dnsSuffix": "mycompany.com", "dnsSearchSuffix": "", "primaryWinsAddress": "10.0.0.
Programming Guide Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This property does not exist when you query for a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Chapter 3 REST API Use Cases Parameter Description n n ROUTED IPAMEndpointId n If you are querying an external network profile that uses external IPAM, shows the endpoint ID for the external IPAM provider. subnetMask: n Specifies the subnet mask. gatewayAddress: n Specifies the IP address of the network gateway. primaryDnsAddress: n Specifies the IP address of the primary DNS server. This parameter is only available for external, NAT, and routed network profiles.
Programming Guide Parameter Description n Offset: Specifies the number of rows skipped. Example: curl Command The following example command queries the existing network profile ID 68b6a183-fc8a-4592af23-92f8d410ee32. curl --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/ iaas-proxy-provider/api/network/profiles/68b6a183-fc8a-4592-af23-92f8d410ee32 Example: JSON Output The following JSON output is returned based on the command input.
Chapter 3 REST API Use Cases }, } ], "profileType": "EXTERNAL", "IPAMEndpointId": null, "subnetMask": "255.255.255.0", "gatewayAddress": "10.110.183.253", "primaryDnsAddress": "10.110.182.45", "secondaryDnsAddress": "", "dnsSuffix": "mycompany.com", "dnsSearchSuffix": "", "primaryWinsAddress": "10.0.0.1", "secondaryWinsAddress": "" } Update a Network Profile You can use the vRealize Automation REST API to update an existing network profile.
Programming Guide "definedAddresses": [ ] } ], "profileType": "EXTERNAL", "IPAMEndpointId": null, "subnetMask": "255.255.255.0", "gatewayAddress": "10.110.183.253", "primaryDnsAddress": "10.110.182.45", "secondaryDnsAddress": "", "dnsSuffix": "mycompany.com", "dnsSearchSuffix": "", "primaryWinsAddress": "10.0.0.1", "secondaryWinsAddress": "" } “ The output contains an empty HTTP response body and the following status code.
Chapter 3 REST API Use Cases "name": "externalTestEdit", "description": "", "createdDate": "2014-11-16T09:11:55.000Z", "lastModifiedDate": "2014-11-16T09:11:55.000Z", "isHidden": false, "definedRanges": [ { "id": "ce266d4c-5fbb-47a9-a391-c77444c20b09", "name": "range", "description": "", "beginIPv4Address": "10.110.183.239", "endIPv4Address": "10.110.183.240", "state": "UNALLOCATED", "createdDate": "2014-11-16T09:11:55.000Z", "lastModifiedDate": "2014-11-16T09:11:55.
Programming Guide Procedure u Delete the network profile. The following example command deletes the network profile 263b80f5-d34f-47f2-b0b1-5a3db991c2e9. curl –X “Delete” --insecure -H "Accept:application/json" -H "Authorization: Bearer $token" https://$host/network/profiles/263b80f5-d34f-47f2-b0b1-5a3db991c2e9 The output contains an empty HTTP response body and the following status code.
Chapter 3 REST API Use Cases Prerequisites n Log in to vRealize Automation as a tenant administrator. n Verify that the host name and fully qualified domain name of the vRealize Automation instance are available. n Verify that you have a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. n Obtain the endpoint ID for the external IPAM provider device you want to query.
Programming Guide "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.local", "preferredWINS": "", "alternateWINS": "" }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.1.
Chapter 3 REST API Use Cases }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.2.
Programming Guide { "key": "Building", "value": { "type": "string", "value": "Building 3" } }, { "key": "City", "value": { "type": "string", "value": "Boston" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.3.0", "subnetPrefixLength": 24, "externalId": "network-3", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.
Chapter 3 REST API Use Cases "type": "string", "value": "Santa Clara" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.4.0", "subnetPrefixLength": 24, "externalId": "network-4", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.
Programming Guide "ipVersion": "IPv4", "gateway": "192.168.5.0", "subnetPrefixLength": 24, "externalId": "network-5", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.local", "preferredWINS": "", "alternateWINS": "" }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.6.
Chapter 3 REST API Use Cases "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.local", "preferredWINS": "", "alternateWINS": "" }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.7.
Programming Guide "id": null, "name": "192.168.8.0/24", "description": "Created by vRO package stub workflow", "extensionData": { "entries": [ { "key": "Building", "value": { "type": "string", "value": "Building 8" } }, { "key": "City", "value": { "type": "string", "value": "Santa Clara" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.8.
Chapter 3 REST API Use Cases } }, { "key": "City", "value": { "type": "string", "value": "Boston" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.9.0", "subnetPrefixLength": 24, "externalId": "network-9", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.
Programming Guide }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.10.0", "subnetPrefixLength": 24, "externalId": "network-10", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.
Chapter 3 REST API Use Cases "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.local", "preferredWINS": "", "alternateWINS": "" }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.12.
Programming Guide }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.13.0/24", "description": "Created by vRO package stub workflow", "extensionData": { "entries": [ { "key": "Building", "value": { "type": "string", "value": "Building 13" } }, { "key": "City", "value": { "type": "string", "value": "Boston" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.
Chapter 3 REST API Use Cases { "key": "Building", "value": { "type": "string", "value": "Building 14" } }, { "key": "City", "value": { "type": "string", "value": "Santa Clara" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.14.0", "subnetPrefixLength": 24, "externalId": "network-14", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.
Programming Guide "type": "string", "value": "Boston" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.15.0", "subnetPrefixLength": 24, "externalId": "network-15", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.
Chapter 3 REST API Use Cases "ipVersion": "IPv4", "gateway": "192.168.16.0", "subnetPrefixLength": 24, "externalId": "network-16", "dnsInfo": { "@type": "DNSInfo", "id": null, "name": null, "description": null, "dnsSuffix": "sqa.local", "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.local", "preferredWINS": "", "alternateWINS": "" }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.17.
Programming Guide "primaryDNS": "", "secondaryDNS": "", "dnsSearchSuffixes": "search.sqa.local,search2.sqa.local", "preferredWINS": "", "alternateWINS": "" }, "addressSpaceId": "default" }, { "@type": "IPRange", "id": null, "name": "192.168.18.
Chapter 3 REST API Use Cases "id": null, "name": "192.168.19.0/24", "description": "Created by vRO package stub workflow", "extensionData": { "entries": [ { "key": "Building", "value": { "type": "string", "value": "Building 19" } }, { "key": "City", "value": { "type": "string", "value": "Boston" } } ] }, "providerEndpointId": "C20F305C-07A5-4BA7-88AC-35DA7B9713E0", "providerEndpointURI": null, "start": null, "end": null, "ipVersion": "IPv4", "gateway": "192.168.19.
Programming Guide Import and Export Content You can use the REST API content management service to import and export content, such as blueprints, between vRealize Automation systems. vRealize Automation customers often experiment with system artifacts such as catalog items, XaaS services, resource actions, and IaaS blueprints in their development or staging environments. When appropriate, users need to move these artifacts to their production environments.
Chapter 3 REST API Use Cases 2 Display a list of available content in vRealize Automation. Content includes published artifacts such as blueprints, software, properties etc. $curl --insecure -s -H"Content-Type: application/json" -H "Authorization: Bearer $token" https://$host/content-management-service/api/contents 3 If applicable, you can also apply filtering by content type. This example sets the contentTypeId to composite-blueprint.
Programming Guide The REST API supports import and export of the following registered content types: n composite-blueprint - the content type corresponding to the composite blueprint n software-component - the content type corresponding to the software component n property-group - the content type corresponding to the property groups n property-definition - the content type corresponding to the property definitions Everything as a Service (XaaS) content types: n XaaS-blueprint n XaaS-resource-ac
Chapter 3 REST API Use Cases Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Programming Guide "serviceTypeId": "com.vmware.csp.core.properties.service" }, { "@type": "ContentType", "id": "property-definition", "name": "Property Definition", "description": "Content type corresponding to the property definitions.", "classId": "PropertyDefinition", "serviceTypeId": "com.vmware.csp.core.properties.
Chapter 3 REST API Use Cases "@type": "ContentType", "id": "software-component", "name": "Software Component Content Type", "description": "{com.vmware.csp.component.software.service@software.component.content.type.description}", "classId": "softwareComponentType", "serviceTypeId": "com.vmware.csp.component.software.
Programming Guide Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Chapter 3 REST API Use Cases Example: JSON Output { "links": [], "content": [ { "@type": "Content", "id": "6ba58cb4-257d-4833-b2dc-f090f92f86be", "contentId": "3482e3a7-c6c2-4372-b8e1-0db517b93406", "name": "Echo String", "description": null, "contentTypeId": "asd-blueprint", "mimeType": null, "tenantId": "qe", "subtenantId": null, "dependencies": [], "createdDate": "2015-08-18T19:14:54.899Z", "lastUpdated": "2015-08-18T19:14:54.
Programming Guide "name": "CustomRes", "description": null, "contentTypeId": "asd-resource-type", "mimeType": null, "tenantId": "qe", "subtenantId": null, "dependencies": [], "createdDate": "2015-08-18T20:56:11.052Z", "lastUpdated": "2015-08-18T20:56:11.052Z", "version": 0 }, { "@type": "Content", "id": "4754ad69-a6a7-447f-96de-2ed6fa260f7c", "contentId": "Software.Apache_LB", "name": "Apache_LB", "description": "Apache 2.
Chapter 3 REST API Use Cases "id": "9b348c29-88ff-4fa8-b93e-f80bc7c3e723", "contentId": "vSphere", "name": "vSphere", "description": "vSphere", "contentTypeId": "composite-blueprint", "mimeType": null, "tenantId": "qe", "subtenantId": null, "dependencies": [], "createdDate": "2015-08-04T14:46:54.201Z", "lastUpdated": "2015-08-04T16:59:30.
Programming Guide Input Parameter Description createdDate The package creation date. lastUpdated The date when the package was last updated. version The package version identifier. tenantId The ID of the tenant associated with the package. Used to enforce ownership. subTenantId (Optional) The ID of the sub tenant or business group associated with the package id Specifies the unique identifier for the content. This is also used as a folder name to group similar content artifacts.
Chapter 3 REST API Use Cases Syntax for Listing Packages in the Content Service You can use the REST API content management service to list the packages within the content service. Input You must provide the appropriate request parameters to list packages within the content service. Name Description Type page Page Number. Default is 1. Query limit Number of entries per page. Default is 20. Query $orderby Multiple comma-separated properties sorted in ascending or descending order.
Programming Guide Parameter Description Links Specifies an array of link objects, each of which contains the following parts: n rel Specifies the name of the link. n Self refers to the object that was returned or requested. This parameter does not appear when you query a single profile. n First, Previous, Next, and Last refer to corresponding pages of pageable lists. Specifies the application or service that determines the other names. n n href Specifies the URL that produces the result.
Chapter 3 REST API Use Cases Example: JSON Output The following example lists all packages within the content service. { "links": [ ], "content": [ { "@type": "Package", "createdDate": "2015-08-04T22:22:53.490Z", "lastUpdated": "2015-08-04T22:22:53.
Programming Guide Example: Example: JSON Output The export command returns a message that indicates whether or not the package was exported. A successful export produces a package.zip exported to the specified location. The returned message is '200 Successes' with the Package or 404 - 'Not Found' if it does not find a package with provided ID.
Chapter 3 REST API Use Cases Example Curl Command This example uses the 'DukesBankApp.zip' - which is out-of-the-box content provided on the vRealize Automation virtual appliance. You can copy the file from /usr/lib/vcac/tools/initialconfig/sample-oob-content/DukesBankApp.zip using WinSCP (Windows) or scp (Mac). $curl --insecure -s -H" Content-Type: multipart/form-data" -H "Authorization: Bearer $token" https://$host/content-management-service/api/packages/validate -F "file=@DukesBankApp.
Programming Guide "contentImportErrors": null } ] } Syntax for Importing a Package You can use the REST API content management service to import a package containing content as a .zip file. Import a Package To verify success of a package import, use vRealize Automation to view the imported items on the target system. Output The command output contains property names and values based on the command input parameters. Table 3‑20.
Chapter 3 REST API Use Cases }, { "contentId": "MySql", "contentName": "MySql", "contentTypeId": "software-component", "contentImportStatus": "SUCCESS", "contentImportErrors": null }, { "contentId": "JBossAppServer", "contentName": "JBossAppServer", "contentTypeId": "software-component", "contentImportStatus": "SUCCESS", "contentImportErrors": null }, { "contentId": "Dukes-Bank-DB-setup", "contentName": "Dukes-Bank-DB-setup", "contentTypeId": "software-component", "contentImportStatus": "SUCCESS", "content
Programming Guide 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. cpu: 1 memory: min: 512 max: 8192 os_type: Linux os_distribution: rhel action: LinkedClone archive_days: 1 provisioning_workflow: {id: CloneWorkflow} lease_days: 3 source_machine_name: cbp_centos_63_x86 cost_center: sales _cluster: 2 apache: type: Software.Apache data: host: '${_resource~web}' http_port: 8080 Each of these lines plays an important role in the blueprint structure.
Chapter 3 REST API Use Cases n Whenever a property binding refers to output of some other component, it creates an implicit dependency between components. Available Constraints To define constraints in any blueprint field. create a new hierarchy or level in YAML, and use any of the keys below to define constraints and their values. Table 3‑21. Blueprint Constraints ID or Key Corresponding CAFE Constraint Description default com.vmware.vcac.platform.content.facets.
Programming Guide n Verify that there is a valid HTTP bearer token that matches your login credentials. See Chapter 2, “REST API Authentication,” on page 9. Procedure 1 Use the following command to import a 6.2.x package into vRealize Automation 7.0. curl --insecure -X POST -H"Authorization: Bearer $token"-H"Content-Type: multipart/formdata"-F"file=@XaaSContent.
Chapter 3 REST API Use Cases Output The command output contains property names and values based on the command input parameters. Table 3‑24. Import and Export Response Body Parameters Parameter Description importStatus Over all status of the import/validation operation, one failure in import/validation result guarantees failed status. Values are as follows: n Successful - Denotes the successful import or validation status at a particular component or package level.
Programming Guide 356 VMware, Inc.
Related Tools and Documentation 4 In addition to the provided use case code snippets, you can expand your options for working with the vRealize Automation REST API by using related tools and documentation. You can use the vRealize CloudClient to simplify your interaction with the vRealize Automation REST API. You can also use third party tools such as Chrome Developer Tools or Firebug to further expand your vRealize Automation REST API programming options.
Programming Guide For information about requesting a bearer token, and about available pagination, sorting, and filtering options for any given command, see the Tips option on the vRealize Automation API landing page for the selected service API. View Reference Information for an API Using the vRealize Automation API Reference, you can view reference information for the REST APIs in each vRealize Automation service, including parameter values, return codes, and implementaton notes.
Chapter 4 Related Tools and Documentation Procedure 1 Click the Catalog tab in the vRealize Automation console. 2 Click the catalog Item you want to request. 3 Enter the request information for the catalog item, but do not submit your changes. 4 Press the Ctrl-Shift-I keys simultaneously to open the Chrome Developer Tools. For example: 5 a Click the Network tab. b Click Record Network Log. c Click Submit in the console.
Programming Guide 360 VMware, Inc.
Filtering and Formatting REST API Information 5 You can filter and format your vRealize Automation REST API command line and command line output. You can use filters in your command line to limit JSON output to specific conditions. For example, you can use a filter in a catalog item request to display only catalog items that contain a specific catalog ID. Or you can use the requestID resource call to format the output of a command that displays request status.
Programming Guide 362 VMware, Inc.
Index A Active Directory, searching for a user 29 API reference information, viewing 358 approvals approving requests to complete workitems 65 machine request 50 approvers, listing workitems 51 authenticating, requesting a bearer token 11 Authentication, configuring HTTP bearer tokens for 9 authorization, requesting an HTTP bearer token 11 deleting a reservation 264 deployed resources, navigating to the children of 92 display available content, syntax 339 displaying reservations 244 E export a package 34
Programming Guide K key pairs creating a key pair 280 delete a key pair 286 displaying a list of key pairs 276 querying a key pair 282 updating a key pair 284 using the API to create or update 274 L LDAP, searching for a user 29 List content service packages, syntax 345 listing provisioned resources 69 listing supported content types, syntax 335 M machine requests approving 50 submitting a machine request 44 machine request, approving with JSON file input 62 managing provisioned deployments 87 N network
Index REST API authenticating with bearer tokens 9 performing use cases with 15 services available 7 using the API Reference 357 using the REST API services 357 role, assigning a user to 30 roles, displaying all assigned to a user 31 S schema definition for a vSphere reservation task 122 services, using the API service documentation 7 T tenants displaying your current 18 linking identity stores to 25 listing identity stores for a named tenant 23 requesting new 20 third party tools, working with the REST
Programming Guide 366 VMware, Inc.