From 1317a6c039a36fc12451e29231aa535ceb767a68 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Sun, 8 Mar 2020 17:33:24 -0400 Subject: [PATCH] Create Get-ZAPlannerJournalSizeReport.ps1 --- .../Public/Get-ZAPlannerJournalSizeReport.ps1 | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 diff --git a/ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 b/ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 new file mode 100644 index 0000000..5ea91a5 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 @@ -0,0 +1,58 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAPlannerJournalSizeReport { + [cmdletbinding()] + param( + [Parameter( + Mandatory, + HelpMessage = "The site identifier(s) for which to return detailed information." + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + Mandatory, + HelpMessage = "Type of target recovery site." + )] + [ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')] + [string]$recoveryType, + [Parameter( + Mandatory, + HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site." + )] + [ValidateNotNullOrEmpty()] + [string[]]$vmIdentifier, + [Parameter( + HelpMessage = "The desired journal history in hours. The default is 24 hours. Limited to a 1 hour up to 720 hours, or the equivalent of 30 days" + )] + [ValidateRange(1, 720)] + [Int]$desiredJournalHistory = 24, + [Parameter( + HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $uri = "planner/reports/stats/journal-size" + $body = @{ + siteIdentifier = $siteIdentifier + recoveryType = $recoveryType + desiredJournalHistory = $desiredJournalHistory + vms = New-Object System.Collections.Generic.List[psobject] + } + if ( -not [String]::IsNullOrEmpty($startDate) ) { + $body['startDate'] = $startDate + } + if ( -not [String]::IsNullOrEmpty($endDate) ) { + $body['endDate'] = $endDate + } + foreach ($vmId in $vmIdentifier) { + $body['vms'].Add(@{'identifier' = $vmId; 'desiredJournalHistory' = $desiredJournalHistory }) + } + $reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json) + $uri = '{0}?reportId={1}' -f $uri, $reportId.reportId + Invoke-ZARestRequest -uri $uri +}