Interactive execution of Workflows as CLI using REST APIs in PowerShell

by Occasional Contributor on ‎2014-08-05 10:39 PM

Attached is a PowerShell script that provides a CLI like interface to execute WFA workflows.

It is a PowerShell wrapper over REST calls to WFA.

The script has the following capabilities:

1. Show all workflows

2. Show details of a workflow

3. Execute a workflow

4. Get the job execution details of a workflow


1. Show all workflows

    This is going to list all the workflows that are present in the WFA database. Each workflow maps to a Serial Number which can be used to get details of the workflow, execute the workflow or get the job status for the workflow.

2. Show details of a workflow

      This will help fetch details of a workflow such as Name, UUID, Description, Certification, Version, Categories and User Inputs, based on the workflow serial number entered.

3. Execute a workflow

    This will execute a workflow based on the serial number entered. On selecting a workflow, each user input will be prompted for, interactively.

    Once the workflow execution is triggered, a job id is returned and an option is provided to wait for workflow completion.

4. Get the job execution details of a workflow

    This will return the job status and job details of a workflow based on the serial number and job id entered.

Notes:

1. To run this, you need to :

    - download the file and unzip it

    - modify the wfa server ip-address, username, password, protocol, port in the script

    - execute it using PowerShell ISE.

Attached are screenshots for the execution phases.

2. Can be executed by Operators, Architects and Admins.

3. This will work on PowerShell versions 2.0 onwards.

4. Can use http/https as protocols

5. Dependent user inputs will not show a validate set. Example: On selecting a specific cluster as user input, if the next user input is a vserver, and it depends on the cluster, the valid set of vservers will not be shown as in the WFA UI.

6. This script is based on the script written by Mirko, which entirely used SOAP APIs.

Comments
adaikkap Former NetApp Employee

Nice work Dhruv.

There is a similar one done by mike arndt as well

https://communities.netapp.com/docs/DOC-33448

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.