Skip to content

rtortori/ico-python-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intersight Cloud Orchestrator

Python Examples

This repository contains sample Python code for Intersight Cloud Orchestrator (ICO)

DISCLAIMER: This is NOT an official Cisco repository and comes with NO WARRANTY AND/OR SUPPORT
Please check LICENSE-CISCO for additional details

Instructions

  1. Generate an API key and secret from Intersight
  2. Take note of the API Key ID, download and store the Secret Key in your filesystem
  3. Set the INTERSIGHT_API_KEY_ID and the INTERSIGHT_API_PRIVATE_KEY environment variables with the Api Key ID and the Secret Key path respectively. The env-linux-mac-example.sh file contains an example for Linux and MacOS.
  4. (optional) Create a Virtualenv: python3 -m venv .venv && source .venv/bin/activate
  5. Install Intersight Python SDK: pip install intersight

Examples for Workflows

Use Case 1: Get all Workflows
Script: ico_wf_get_definitions_list.py
Returns: All workflow definitions data in JSON format

Use Case 2: Get Definition of a Specific Workflow
Script: ico_wf_get_definition_by_name.py
Usage: Set the workflow_name variable with the workflow name you want to fetch (i.e. "Deploy a Virtual Machine"
Returns: Server response in JSON format of the requested workflow definition

Use Case 3: Get all Requests
Script: ico_wf_get_requests_list.py
Returns: All execution requests data in JSON format

Use Case 4: Get a specific Request
Script: ico_wf_get_request_by_moid.py
Usage: Set the moid variable with the request moid you want to fetch
Returns: Server response in JSON format of the requested workflow execution

Use Case 5: Get Task Outputs of a specific Workflow Execution
Script: ico_wf_get_request_tasks_outputs_by_moid.py
Usage: Set the moid variable with the request moid you want to fetch
Returns: Outputs of the Task Executed in the specific request

Use Case 6: Execute a Workflow
Script: ico_wf_execute_by_name.py
Usage: Set variables based on your workflow definition (see code for examples)
Returns: Server response in JSON format, a summary of the request moid and the user who invoked the execution

Use Case 7: Rollback a Workflow
Script: ico_wf_rollback_by_moid.py
Usage: Set the workflow_moid variable with the request moid you want to rollback
Returns: Moid of the rollback request, Moid of the rollbacked request and Status


Examples for Tasks

Use Case 1: Get Tasks Definitions
Script: ico_tasks_get_definitions_list.py
Returns: All tasks definitions data in JSON format

Use Case 2: Get Task Definition by Name
Script: ico_tasks_get_definition_by_name.py
Usage: Set the name variable with the task moid you want to fetch
Returns: Server response in JSON format of the requested task definition

Use Case 3: Get Task Definition by Moid
Script: ico_tasks_get_definition_by_moid.py
Usage: Set the moid variable with the task moid you want to fetch
Returns: Server response in JSON format of the requested task definition


Examples for Data Types

Use Case 1: Get Data Types Definitions
Script: ico_datatypes_get_definitions_list.py
Returns: All Data Types definitions data in JSON format

Use Case 2: Get Data Type Definition by Moid
Script: ico_datatypes_get_definition_by_moid.py
Usage: Set the moid variable with the task moid you want to fetch
Returns: Server response in JSON format of the requested Data Type definition


Example for Summaries

Use Case: Show ICO Workflows, Tasks and Data Types summary stats
Script: ico_statistics_get.py
Sample Output:

### Workflow Designer Statistics ###

Total Workflows: 157
System Workflows: 29
User Workflows: 128
Valid/Invalid Workflows: 146/11

### Executions Statistics ###

Total Executions: 633
Success/Failed Executions: 387/246
Last Request: "Rollback Deploy a Virtual Machine", by user user@cisco.com, with Moid 624739d1696f6e2d315a1b21

### Task Designer Statistics ###

Total Tasks: 221
System Tasks: 145
Custom Tasks: 76

### Data Types Statistics ###

Total Data Types: 226
System Data Types: 211
Custom Data Types: 15

About

Sample Python Scripts for Intersight Cloud Orchestrator (ICO)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published