Create Function and associated docs

Get-ZANetworkSiteAverageIOPS
This commit is contained in:
Wes Carroll
2019-06-10 09:06:52 -04:00
parent ee4419687a
commit 5447d1b443
3 changed files with 234 additions and 0 deletions
@@ -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,47 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZANetworkSiteAverageIOPS {
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
param (
[Parameter(
HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.",
ParameterSetName = "ProtectedSite",
Mandatory
)]
[Parameter(
HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.",
ParameterSetName = "RecoverySite"
)]
[ValidateNotNullOrEmpty()]
[string]$protectedSiteIdentifier,
[Parameter(
HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.",
ParameterSetName = "RecoverySite",
Mandatory
)]
[Parameter(
HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.",
ParameterSetName = "ProtectedSite"
)]
[ValidateNotNullOrEmpty()]
[string]$recoverySiteIdentifier,
[Parameter(
HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date."
)]
[ValidateNotNullOrEmpty()]
[string]$startDate,
[Parameter(
HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time."
)]
[ValidateNotNullOrEmpty()]
[string]$endDate,
[Parameter(
HelpMessage = "The ZORG identifier by which to filter the executive summary."
)]
[ValidateNotNullOrEmpty()]
[string]$zOrgIdentifier
)
$filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters
$uri = "reports/sites-network-iops-average{0}" -f $filter
Invoke-ZARestRequest -uri $uri
}
+168
View File
@@ -0,0 +1,168 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkSiteAverageIOPS.md
schema: 2.0.0
---
# Get-ZANetworkSiteAverageIOPS
## SYNOPSIS
Get average and maximum IOPS performance for sites, filtered by start date and end date, and optional intervals.
## SYNTAX
### ProtectedSite (Default)
```
Get-ZANetworkSiteAverageIOPS -protectedSiteIdentifier <String> [-recoverySiteIdentifier <String>]
[-startDate <String>] [-endDate <String>] [-zOrgIdentifier <String>] [<CommonParameters>]
```
### RecoverySite
```
Get-ZANetworkSiteAverageIOPS [-protectedSiteIdentifier <String>] -recoverySiteIdentifier <String>
[-startDate <String>] [-endDate <String>] [-zOrgIdentifier <String>] [<CommonParameters>]
```
## DESCRIPTION
Get average and maximum IOPS performance for sites, filtered by start date and end date, and optional intervals.
The following options are available:
* To view average and maximum IOPS performance of all outgoing traffic from a protected site to all its replicating sites, specify only the protected site identifier.
* To view average and maximum IOPS performance between two sites, specify both the protected site identifier and the recovery site identifier.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZANetworkSiteAverageIOPS -protectedSiteIdentifier "7890-1234-5678"
```
Returns outgoing networks IOPS average from site with identifier "7890-1234-5678"
### Example 2
```powershell
PS C:\> Get-ZANetworkSiteAverageIOPS -protectedSiteIdentifier "7890-1234-5678" -recoverySiteIdentifier "9876-5432-1098"
```
Returns network IOPS average between sites with identifiers "7890-1234-5678" and "9876-5432-1098"
## PARAMETERS
### -endDate
End date in RFC 3339 standard ('1970-01-01T00:00:00Z').
If the end date is omitted, the default end date is the current time.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -protectedSiteIdentifier
Protected site identifier.
A site identification is required for at least one of the sites.
```yaml
Type: String
Parameter Sets: ProtectedSite
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
```yaml
Type: String
Parameter Sets: RecoverySite
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -recoverySiteIdentifier
Recovery site identifier.
If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.
```yaml
Type: String
Parameter Sets: ProtectedSite
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
```yaml
Type: String
Parameter Sets: RecoverySite
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -startDate
Start date in RFC 3339 standard ('1970-01-01T00:00:00Z').
If the start date is omitted, the default start date is 7 days before the end date.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -zOrgIdentifier
The ZORG identifier by which to filter the executive summary.
```yaml
Type: String
Parameter Sets: (All)
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 Network Site Average IOPS](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_sites_network_iops_average)