From 8edfb97b1f959bb138a0dd898b6e659e4b95b73f Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Mon, 10 Jun 2019 10:07:13 -0400 Subject: [PATCH] Create function and related docs Get-ZANetworkVpgAveragePerformance --- ...t-ZANetworkVpgAveragePerformance.Tests.ps1 | 19 +++ .../Get-ZANetworkVpgAveragePerformance.ps1 | 31 +++++ docs/Get-ZANetworkVpgAveragePerformance.md | 109 ++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 create mode 100644 docs/Get-ZANetworkVpgAveragePerformance.md diff --git a/Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 b/Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 @@ -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 + } +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 new file mode 100644 index 0000000..0485cdb --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkVpgAveragePerformance { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The VPG identifier.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [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 interval selected within the duration of the report. The interval can be per minute - for up to 6 hours, per hour - for 6 hours to 15 days, or per day - for 15 days up to 30 days. If an interval is not specified, the default is 60 seconds. Submit value in Seconds." + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/vpg-network-performance-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/docs/Get-ZANetworkVpgAveragePerformance.md b/docs/Get-ZANetworkVpgAveragePerformance.md new file mode 100644 index 0000000..b781da5 --- /dev/null +++ b/docs/Get-ZANetworkVpgAveragePerformance.md @@ -0,0 +1,109 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkVpgAveragePerformance.md +schema: 2.0.0 +--- + +# Get-ZANetworkVpgAveragePerformance + +## SYNOPSIS + +Get average and maximum network performance of throughput vs. WAN traffic for a specific VPG filtered by start date and end date, and optional intervals. + +## SYNTAX + +``` +Get-ZANetworkVpgAveragePerformance [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Get average and maximum network performance of throughput vs. WAN traffic for a specific VPG filtered by start date and end date, and optional intervals + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkVpgAveragePerformance -vpgIdentifier "3456-7890-1234" -interval 3600 +``` + +Get Network VPG Average Performance for VPG with Identifier "3456-7890-1234" for the last 7 days at an interval of 1 hour. + +## 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: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per minute - for up to 6 hours, per hour - for 6 hours to 15 days, or per day - for 15 days up to 30 days. If an interval is not specified, the default is 60 seconds. Submit value in Seconds. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +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: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The VPG identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +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 VPG Average Performance](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_vpg_network_performance_average)