From 8b6f4999b2ffcb1a522386254f8603e237761de7 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Sun, 9 Jun 2019 15:27:02 -0400 Subject: [PATCH] Create Function and Required Docs Get-ZAJournalSiteSizeStat --- .../Get-ZAJournalSiteSizeStat.Tests.ps1 | 19 +++ .../Public/Get-ZAJournalSiteSizeStat.ps1 | 31 +++++ docs/Get-ZAJournalSiteSizeStat.md | 123 ++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 Tests/Public/Get-ZAJournalSiteSizeStat.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalSiteSizeStat.ps1 create mode 100644 docs/Get-ZAJournalSiteSizeStat.md diff --git a/Tests/Public/Get-ZAJournalSiteSizeStat.Tests.ps1 b/Tests/Public/Get-ZAJournalSiteSizeStat.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZAJournalSiteSizeStat.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-ZAJournalSiteSizeStat.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalSiteSizeStat.ps1 new file mode 100644 index 0000000..4461d57 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalSiteSizeStat.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalSiteSizeStat { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/site-journal-size-stats{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/docs/Get-ZAJournalSiteSizeStat.md b/docs/Get-ZAJournalSiteSizeStat.md new file mode 100644 index 0000000..35069c1 --- /dev/null +++ b/docs/Get-ZAJournalSiteSizeStat.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalSiteSizeStat.md +schema: 2.0.0 +--- + +# Get-ZAJournalSiteSizeStat + +## SYNOPSIS + +Get Max, Avg. and Min of total Journal Size statistics for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## SYNTAX + +``` +Get-ZAJournalSiteSizeStat [-recoverySiteIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Get Max, Avg. and Min of total Journal Size statistics for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalSiteSizeStat -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns Journal Size Statistics information for the recovery site with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalSiteSizeStat -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Size Statistics information for the recovery site with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalSiteSizeStat -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal Size Statistics information for the recovery site with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default 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 hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. 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 +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +The identifier of the VPG. + +```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 Journal Site size Stats](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_site_journal_size_stats)