Merge pull request #80 from ZertoPublic:Get-ZertoEvent-Fix

Get zerto event fix
This commit is contained in:
Wes Carroll
2020-05-09 11:04:59 -04:00
committed by GitHub
3 changed files with 15 additions and 3 deletions
+8
View File
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Zerto Virtual Manager
#### Fixed
* Updated `Get-ZertoEvent` to translate a vpg name parameter to a vpgIdentifier per the API documentation
## [1.4.1] ## [1.4.1]
### General ### General
+1 -1
View File
@@ -12,7 +12,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$ParameterTestCases = @( $ParameterTestCases = @(
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; 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 = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
+6 -2
View File
@@ -19,8 +19,8 @@ function Get-ZertoEvent {
HelpMessage = "The name of the VPG for which you want to return events." HelpMessage = "The name of the VPG for which you want to return events."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[Alias("vpg")] [Alias("vpgName")]
[string]$vpgName, [string]$vpg,
[Parameter( [Parameter(
ParameterSetName = "filter", ParameterSetName = "filter",
HelpMessage = "The identifier of the VPG for which you want to return events." 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 # If a filter is applied, create the filter and return the events that fall in that filter
"filter" { "filter" {
$filter = Get-ZertoApiFilter -filterTable $PSBoundParameters $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 $uri = "{0}{1}" -f $baseUri, $filter
$returnObject = Invoke-ZertoRestRequest -uri $uri $returnObject = Invoke-ZertoRestRequest -uri $uri
} }