Files
ZertoApiWrapper/ZertoApiWrapper/Public/Get-ZAAlert.ps1
T
justin 869db85705 working branch updates
Lots of updates to improve vscode syntax highlighting as well as some updates to the main invoke rest command per chatgpt recommendations :)
2025-02-09 20:35:40 -05:00

41 lines
1.3 KiB
PowerShell

<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
#>
function Get-ZAAlert {
[cmdletbinding( DefaultParameterSetName = "zOrg")]
param(
[Parameter(
HelpMessage = "The ZORG identifier by which to filter the alert list. If the ZORG identifier is omitted, a list of all the alerts is retrieved.",
ParameterSetName = "zOrg"
)]
[ValidateNotNullOrEmpty()]
[string]$zOrgIdentifier,
[Parameter(
HelpMessage = "The maximum number of alerts to return.",
ParameterSetName = "zOrg"
)]
[ValidateRange(1, 1000000)]
[int]$limitTo,
[Parameter(
HelpMessage = "The alert Idnetifier",
ParameterSetName = "alertId",
Mandatory
)]
[ValidateNotNullOrEmpty()]
[string]$alertIdentifier
)
$uri = "monitoring/alerts"
switch ($PSCmdlet.ParameterSetName) {
zOrg {
if ( $PSBoundParameters.Keys.Count -gt 0 ) {
$filterString = Get-ZertoApiFilter -filterTable $PSBoundParameters
$uri = "{0}{1}" -f $uri, $filterString
}
}
alertId {
$uri = "{0}/{1}" -f $uri, $alertIdentifier
}
}
Invoke-ZARestRequest -uri $uri
}