From 865ca1dd3923797fc7b7e3c2e7d7e4e9aec37c10 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 7 May 2020 20:21:39 -0400 Subject: [PATCH] Update Logic to Convert VpgName to VpgIdentifier --- Tests/Public/Get-ZertoEvent.Tests.ps1 | 2 +- ZertoApiWrapper/Public/Get-ZertoEvent.ps1 | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Tests/Public/Get-ZertoEvent.Tests.ps1 b/Tests/Public/Get-ZertoEvent.Tests.ps1 index b35a69f..5e94a0e 100644 --- a/Tests/Public/Get-ZertoEvent.Tests.ps1 +++ b/Tests/Public/Get-ZertoEvent.Tests.ps1 @@ -12,7 +12,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' { $ParameterTestCases = @( @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } - @{ParameterName = 'vpgName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpg'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } diff --git a/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 b/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 index 8094ac2..3f49004 100644 --- a/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 @@ -19,8 +19,8 @@ function Get-ZertoEvent { HelpMessage = "The name of the VPG for which you want to return events." )] [ValidateNotNullOrEmpty()] - [Alias("vpg")] - [string]$vpgName, + [Alias("vpgName")] + [string]$vpg, [Parameter( ParameterSetName = "filter", HelpMessage = "The identifier of the VPG for which you want to return events." @@ -137,6 +137,10 @@ function Get-ZertoEvent { # If a filter is applied, create the filter and return the events that fall in that filter "filter" { $filter = Get-ZertoApiFilter -filterTable $PSBoundParameters + if ($PSBoundParameters.Keys -contains 'vpg') { + $vpgIdentifier = (Get-ZertoVpg -name $vpg).vpgIdentifier + $filter = $filter.replace("vpg=$vpg", "vpg=$vpgIdentifier") + } $uri = "{0}{1}" -f $baseUri, $filter $returnObject = Invoke-ZertoRestRequest -uri $uri }