Skip to main content
Pure Technical Services

vRealize Orchestrator 8 User Guide: Running Custom REST API Operations

Currently viewing public documentation. Please login to access the full scope of documentation.

For the most part, Pure Storage introduced a plugin for vRealize Orchestrator so that customers did not have to manually understand the underlying REST APIs. By creating inventory synchronization, actions, and workflows, the need to delve into the REST API is minimal. In general, follow the instructions here first if you feel the need to make custom REST calls in vRO.

vRealize Orchestrator 8 User Guide: Workflows

With that being said, not every REST operation is built into the vRO plugin, and often underlying feature support in the plugin might not arrive in time to coincide with your need for it. To give customers a simpler to use option, the plugin offers two workflows to run direct REST operations against Pure Storage platforms--one for the FlashArray or Cloud Block Store, and one for the FlashBlade.

This allows users to take advantage of the native plugin authentication but still have full access to the underlying REST API of the Pure Storage platforms.

Running Custom REST API Operations against the FlashArray or Cloud Block Store

Before you can run a REST API operation, you must authenticate first against a target. This is described in detail here:

vRealize Orchestrator 8 User Guide: Authentication

Once complete, you can run the REST API workflow against a FlashArray or Cloud Block Store platform.

clipboard_e7b7564cfe14c77add5bd7c47f2e22059.png

To run a REST API operation, right-click on the workflow Run FlashArray REST API under the Custom REST Operations folder and click Run.

The first step is to choose a FlashArray target:

1) Click to choose a FlashArray 2) Choose a FlashArray object 3) Click REST API Request Properties
clipboard_eb03ec9319b836b392d246fb97be1d3fd.png clipboard_e1825275d6e4116151799d71909b773a3.png clipboard_e78fa62ff7d24eb295f16cd256a71132a.png

The next step is to configure the REST operation. The FlashArray REST API documentation can be found in a few places:

  1. The support site: https://support.purestorage.com/FlashArray/PurityFA/Purity_FA_REST_API/Reference/FlashArray_REST_API_PDF_Reference_Guides
  2. Your FlashArray Web Interface. Click Help -> REST API Guide

clipboard_e6f32388b3ff8c91e1a513a0b14707c1e.png

Run Basic REST Operations

Once you have identified the operation, go back to vRO. Enter the resource URI. This includes the root object and any parameters, filters, or sorts. The workflow automatically adds the FlashArray address and REST version.

So if you want to pull all volumes from a FlashArray you would enter /volume (don't forget the preceding forward slash) and choose GET and click Run (note that this is a default workflow--use that instead of doing it here, using this though as a simple example).

clipboard_e8b6b849767b84021fb4fa30a8cf2d7e7.png

If you want to pull the space stats of a volume named activeDRpodA::ActiveDRVMFS-01 and with a query parameter of ?space=true

clipboard_e2d7f39fcec2b8631bd3cedf165634d38.png

Run REST Operations with a JSON Request Body

If you are executing a REST operation that requires a body, you can paste it into the Request Body input. So for instance, the creation of a volume. While this is a default workflow and that should be used instead of a custom REST operation, this is just an example.

Creation of a volume is a POST operation with a resource URI of /volume/<volume name> with a JSON body of {"size":"10T"}. So if I want to create volume called newvol-vro01 that is 1 TB in size:

clipboard_ed21fd4d8074da5cea1f824c0ab96e3a0.png

If I want to create a volume named newvol-vro02 with a 1 GB/s bandwidth limit that is 10 TB in size:

clipboard_efbc92a485adce60191992b6b96bc3443.png

The workflow logs the response:

clipboard_eefc7630d5db85cf55734a6f53e8b04ab.png

Integrating a REST Operation into a Workflow

Though the most likely scenario is that this response is passed into some other custom workflow of your creation. So the REST response is also stored in an output variable called actionResult:

clipboard_e67e1b6eb63315026d227376afbc84f78.png

So if you include this in your workflow you would pass that output into your next item:

clipboard_efa2a66db9fe6a46cc7a6847628fbf396.png

The response is returned in a JSON form, so to easily manipulate the data returned, it should be parsed and converted into a Javascript object. The best method for this is to use the JSON.parse() operation.

var restResponse = JSON.parse(actionResult);

So to pull the volume capacity metrics and print out the data reduction ratio the Javascript would be:

var restResponse = JSON.parse(actionResult);
System.log("The volume named " + restResponse.name + " has a data reduction ratio of " + restResponse.data_reduction + " to 1");

clipboard_e32b3d14d271e66eca8da4b89bb27ce13.png

clipboard_ef05e0072722c38db0ab6e76e7f2a968d.png

So with the following request:

clipboard_e07d57507f5b05946527a5ed73ee8c322.png

The resulting log would be:

clipboard_ecaf47701b959584bd49620aac40a59df.png

Running Custom REST API Operations against the FlashBlade

Before you can run a REST API operation, you must authenticate first against a target. This is described in detail here:

vRealize Orchestrator 8 User Guide: Authentication

Once complete, you can run the REST API workflow against a FlashBlade platform.

clipboard_e7b7564cfe14c77add5bd7c47f2e22059.png

To run a REST API operation, right-click on the workflow Run FlashBlade REST API under the Custom REST Operations folder and click Run.

The first step is to choose a FlashBlade target:

1) Click to choose a FlashBlade  2) Choose a FlashBlade object
clipboard_e466afb77cd0cfc5f015114a3988c1f7b.png clipboard_ec9b7fb36f31c8bf563c93551cc6ad8c0.png

The next step is to configure the REST operation. The FlashBlade REST API documentation can be found in a few places:

  1. The support site: https://support.purestorage.com/FlashBlade/Purity_FB/PurityFB_REST_API/Management_REST_API/FlashBlade_Management_REST_API_Reference_Guides 
  2. Your FlashBlade Web Interface. Click Help -> REST API Guide

clipboard_eb686dddd1dcff21aed7c292f8fedf983.png

Run Basic REST Operations

Once you have identified the operation, go back to vRO. Enter the resource URI. This includes the root object and any parameters, filters, or sorts. The workflow automatically adds the FlashBlade address and REST version.

So if you want to pull array information from a FlashBlade you would enter /arrays (don't forget the preceding forward slash) and choose GET and click Run.

clipboard_e37bd33c9b4697922ffceeb6d7cdc75fd.png

And the response is logged:

clipboard_ee34e5211523121fe7df6200873e47488.png

and stored in the output variable called response:

clipboard_ee33aca2808a2a3a96790daed9ddce9f3.png

If you want to pull the space stats of all object store usage we would add /space and the query for ?type=object-store

clipboard_ebcbba6e8d43335cc59519b5387966d3a.png

The space stats are in the response:

clipboard_e5a43a3e0342be7913d9c492b230797ad.png

Run REST Operations with a JSON Request Body

If you are executing a REST operation that requires a body, you can paste it into the Request Body input. So for instance, the creation of a NFS share.

Creation of a NFS share is a POST operation with a resource URI of /file-systems with a JSON body of {"name":"myNFS"}. 

clipboard_e9d36ae442f31f583d69e5e43551497b1.png

The workflow logs the response:

clipboard_e4eba1fb7c8db7d6010109b87b5964916.png

Integrating a REST Operation into a Workflow

Though the most likely scenario is that this response is passed into some other custom workflow of your creation. So the REST response is also stored in an output variable called response:

clipboard_ecc6a0ccb06dbc51307d076b15e0852ad.png

So if you include this in your workflow you would pass that output into your next item:

clipboard_e5d5ab8591185886924ae69e3187f3840.png

The response is returned in a JSON form, so to easily manipulate the data returned, it should be parsed and converted into a Javascript object. The best method for this is to use the JSON.parse() operation.

var restResponse = JSON.parse(response);

So to pull the volume capacity metrics and print out the data reduction ratio the Javascript would be:

var restResponse = JSON.parse(response);
System.log("The share named " + restResponse.items[0].name + " has a data reduction ratio of " + restResponse.items[0].space.data_reduction + " to 1");

clipboard_e63edfa75ba6915eddab31d884069cde3.png

 

So with the following request:

clipboard_e81580c62a11c6013b48d8c74713c6d3a.png

The resulting log would be:

clipboard_ed3dd3b09bafd426dba1e825f233a7537.png