Create Get-ZATask files and content
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#Requires -Modules Pester
|
||||
$moduleFileName = "ZertoApiWrapper.psd1"
|
||||
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper")
|
||||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
|
||||
$file = Get-ChildItem "$here\$sut"
|
||||
$modulePath = $here -replace "Public", ""
|
||||
$moduleFile = Get-ChildItem "$modulePath\$moduleFileName"
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
Import-Module $moduleFile -Force
|
||||
|
||||
Describe $file.BaseName -Tag 'Unit' {
|
||||
|
||||
It "is valid Powershell (Has no script errors)" {
|
||||
$contents = Get-Content -Path $file -ErrorAction Stop
|
||||
$errors = $null
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Get-ZATask {
|
||||
[cmdletbinding( DefaultParameterSetName = "zOrg")]
|
||||
param(
|
||||
[Parameter(
|
||||
HelpMessage = "The ZORG identifier by which to filter the task list. If the ZORG identifier is omitted, a list of all the tasks is retrieved.",
|
||||
ParameterSetName = "zOrg"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$zOrgIdentifier,
|
||||
[Parameter(
|
||||
HelpMessage = "The maximum number of tasks to return.",
|
||||
ParameterSetName = "zOrg"
|
||||
)]
|
||||
[ValidateRange(1, 1000000)]
|
||||
[int]$limitTo,
|
||||
[Parameter(
|
||||
HelpMessage = "The task Idnetifier",
|
||||
ParameterSetName = "taskId",
|
||||
Mandatory = $true
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$taskIdentifier
|
||||
)
|
||||
$uri = "monitoring/tasks"
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
zOrg {
|
||||
if ( $PSBoundParameters.Keys.Count -gt 0 ) {
|
||||
$filterString = Get-ZertoApiFilter -filterTable $PSBoundParameters
|
||||
$uri = "{0}{1}" -f $uri, $filterString
|
||||
}
|
||||
}
|
||||
|
||||
taskId {
|
||||
$uri = "{0}/{1}" -f $uri, $taskIdentifier
|
||||
}
|
||||
}
|
||||
Invoke-ZARestRequest -uri $uri
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZATask.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-ZATask
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
Retrieve details of all existing tasks.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### zOrg (Default)
|
||||
```
|
||||
Get-ZATask [-zOrgIdentifier <String>] [-limitTo <Int32>] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### taskId
|
||||
```
|
||||
Get-ZATask -taskIdentifier <String> [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
Retrieve details of all existing tasks.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Get-ZATask
|
||||
```
|
||||
|
||||
Retrieve details of all existing tasks.
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Get-ZATask -zOrgIdentifier "1234-5678-9012"
|
||||
```
|
||||
|
||||
Retrieve details of all existing tasks for zOrg with Identifier "1234-5678-9012".
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Get-ZATask -taskIdentifier "9012-3456-7890"
|
||||
```
|
||||
|
||||
Retrieve details of a specific task with identifier "9012-3456-7890".
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -limitTo
|
||||
The maximum number of tasks to return.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: zOrg
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 0
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -taskIdentifier
|
||||
The task Idnetifier
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: taskId
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -zOrgIdentifier
|
||||
The ZORG identifier by which to filter the task list.
|
||||
If the ZORG identifier is omitted, a list of all the tasks is retrieved.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: zOrg
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
[Zerto Analytics REST API Endpoint for Tasks](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_tasks)
|
||||
Reference in New Issue
Block a user