Skip to main content
Pure Technical Services

vRealize Orchestrator 7 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 7 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 7 User Guide: Authentication

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

clipboard_ef1e8f20e23d83f1d7ba6ae7194a31fa9.png

To run a REST API operation, right-click on the workflow Run REST API un the FlashArray REST APIs folder and click Start Workflow.

The first step is to choose a FlashArray target:

1) Click to choose a FlashArray 2) Choose a FlashArray object 3) Click Next
clipboard_ea18447155061eb7f8ac57c28216b22b9.png clipboard_e2bcd848538da1a4f428afa21206425fb.png clipboard_e2905ec935fb2e000c861bfaeb8c1ff99.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 Submit (note that this is a default workflow--use that instead of doing it here, using this though as a simple example).

clipboard_ec750287a4303f32c554035d867da6bff.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_e8edc3a46acdeec0fe96b74adc57311c0.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_efb6c128fe381fccfe16ac55834f0ec9c.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_e568bf3c3458290ae2eda3fa36ffd631a.png

The workflow logs the response:

clipboard_ed1ab610167eb152f5386897eaeb9ff73.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_e5c16bf3930ff4ec9b254dc8c3fca8b28.png

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

clipboard_e9e950c636aec84ed7f6d4b9abfd2e253.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_e0bd2b8fbdab61ab5688c7379bc808dd0.png

clipboard_ee9de86c6910bdd0adfcee0436d9a9c04.png

So with the following request:

clipboard_e433db4c309caab28a6e47f74fd580698.png

The resulting log would be:

clipboard_e0d0d774cd85f75a9b26ba32a8491aac1.png