A StackStorm API client for C#.NET including a PowerShell module
The docs are available on readthedocs.org
The .NET client is available on nuget.org
St2Client apiClient = new St2Client("http://12.3.2.3:9100", "http://12.3.2.3:9101", "testu", "testp");
// login and get a token
await apiClient.RefreshTokenAsync();
var actions = await apiClient.Actions.GetActionsAsync();
The PowerShell Module includes the following commands:
- New-St2ClientConnection - Creates a new connection object
- Get-St2Actions - Get the actions (can filter by pack name)
- Get-St2Packs - Get the packs available
- Get-St2Executions - Get the executions
- Remove-St2Action - Delete an Action
- Invoke-St2Action - Invoke an Action
Import-Module .\St2.Client.Powershell.dll
$conn = New-St2ClientConnection -Username testu -Password testp -ApiUrl "http://12.3.2.3:9101" -AuthApiUrl "http://12.3.2.3:9100"
$MyPack = Get-St2Packs -Name "example"
$actions = Get-St2Actions -Pack $MyPack
foreach($action in $actions){
Write-Output "Getting executions for action $action.name"
Get-St2Executions -Action $action -Connection $conn
}
$action = Get-St2Actions -PackName "st2_dimensiondata" -Name "list_locations"
Invoke-St2Action -Action $action -Parameters @{"region"="dd-au"}