A simple client for calling HyperV orchestator runbooks API in python
Project description
Simple client for calling HyperV orchestrator runbooks in python.
Installation
Using pip:
$ pip install pyHyperV
Import & Initialize pyHyperV
import pyHyperV
orchestratorEndpoint = "http://hostname.local:81/Orchestrator2012/Orchestrator.svc"
username = "domain\\username"
password = "password"
o = pyHyperV.orchestrator(orchestratorEndpoint, username, password)
Execute Runbook
pyHyperV.orchestrator.Execute(runbookID, runbookParameters, dictionary=False)
You can send the parameters to orchestrator using the parameter ID or the parameter name.
Using Parameter IDs
Example of sending using the parameter ID:
runbookID = '285f017e-bc97-4b03-a999-64e08065769e'
runbookParameters = {
'f90e6468-31d3-4aa8-9d50-f8bf5bf689e2' : 'value',
'edb8d27d-38ad-4d29-a255-30d8360a3852' : 'value',
'b61abea1-4001-42fd-99b5-470acc5c1386' : 'value',
'32725695-0b25-47e0-abbe-b28e22eca8ad' : 'value',
}
o.Execute(runbookID, runbookParameters)
Using Parameter Names
To send a request using the parameter names indead of the IDs, add the dictionary=True flag. The parameter names must match the names for each parameter in orchestrator.
Example:
runbookID = '285f017e-bc97-4b03-a999-64e08065769e'
runbookParameters = {
'HDD' : '50gb',
'CPU' : '2',
'RAM' : '2048',
'OS' : 'Server2012',
}
o.Execute(runbookID, runbookParameters, dictionary=True)
Response
Successfully initiating a runbook execution will return a 201 status code, along with the orchestrator job ID. The job ID returned can be used to check the status of the job using the GetJobStatus function.
Example Response:
{
'status' : 201,
'result': {
'id' : '3c87fd6c-69f5-41c9-bd55-ec2aa6ec7c64',
'status' : 'pending',
'CreationTime' : '2014-04-02T12:11:05.617',
'LastModifiedTime' : '2014-04-02T12:19:08.963',
}
}
Get Runbook Parameters
pyHyperV.orchestrator.GetParameters(runbookID)
This function returns the parameter names and paramater IDs required by the runbook specified.
Example:
runbookID = '285f017e-bc97-4b03-a999-64e08065769e'
o.GetParameters(runbookID)
Example Response:
{
'status' : 200,
'result': {
'HDD' : 'f90e6468-31d3-4aa8-9d50-f8bf5bf689e2',
'CPU' : 'edb8d27d-38ad-4d29-a255-30d8360a3852',
'RAM' : 'b61abea1-4001-42fd-99b5-470acc5c1386',
'OS' : '32725695-0b25-47e0-abbe-b28e22eca8ad',
}
}
Get Job Status
pyHyperV.orchestrator.GetJobStatus(jobID)
This function allows you to check the status of an orchestrator job/task.
Example:
jobID = '285f017e-bc97-4b03-a999-64e08065769e'
o.GetParameters(jobID)
Example Response:
{
'status' : 200,
'result': {
'id' : '3c87fd6c-69f5-41c9-bd55-ec2aa6ec7c64',
'status' : 'Complete',
'CreationTime' : '2014-04-02T12:11:05.617',
'LastModifiedTime' : '2014-04-02T12:19:08.963',
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyHyperV-0.0.2.tar.gz.
File metadata
- Download URL: pyHyperV-0.0.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8c8ff8884aae04caa76da751d65415f17e32bec1d234b98b7de807ba7ae9d12
|
|
| MD5 |
c651b1692ca4ede239a7c3481ef54f59
|
|
| BLAKE2b-256 |
a7df57c22e3f53f52c473eb69ee052f5bba214976f9ea564b16bc71d5cd78467
|
File details
Details for the file pyHyperV-0.0.2.macosx-10.8-x86_64.exe.
File metadata
- Download URL: pyHyperV-0.0.2.macosx-10.8-x86_64.exe
- Upload date:
- Size: 68.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4032c68e62b8e612663020e22469bbde7cc7829e86f1c89f06c11e2bd12f305d
|
|
| MD5 |
6b39a81fe7ccea20e8a183cc11f96f32
|
|
| BLAKE2b-256 |
4024d91889c2d89a43b9a68e6de3b394d81bab0b70794ef35884bd96ab82cbdd
|