diff --git a/Tests/Public/Get-ZAMonitoring.Tests.ps1 b/Tests/Public/Get-ZAMonitoring.Tests.ps1 new file mode 100644 index 0000000..50d2f9d --- /dev/null +++ b/Tests/Public/Get-ZAMonitoring.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 + } +} \ No newline at end of file diff --git a/ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 b/ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 new file mode 100644 index 0000000..a196baa --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 @@ -0,0 +1,18 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAMonitoring { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the user's statistics for a single account. If the ZORG identifier is omitted, statistics related to all sites, for a single account, is retrieved." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + $uri = "monitoring/" + if ( -not [String]::IsNullorEmpty($zOrgIdentifier) ){ + $filterTable = @{"zOrgIdentifier" = $zOrgIdentifier} + $filterString = Get-ZertoApiFilter -filterTable $filterTable + $uri = "{0}{1}" -f $uri, $filterString + } + Invoke-ZARestRequest -uri $uri +} \ No newline at end of file