Files
ZertoApiWrapper/ZertoApiWrapper/Public/Get-ZertoServiceProfile.ps1
T
2019-04-16 22:46:21 -04:00

50 lines
1.5 KiB
PowerShell

<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZertoServiceProfile {
[cmdletbinding( DefaultParameterSetName = "main" )]
param (
[Parameter(
ParameterSetName = "siteIdentifier",
HelpMessage = "The identifier of the site for which service profiles should be returned."
)]
[ValidateNotNullOrEmpty()]
[Alias("siteId")]
[string]$siteIdentifier,
[Parameter(
ParameterSetName = "serviceProfileId",
HelpMessage = "The service profile ID for which information should be returned."
)]
[ValidateNotNullOrEmpty()]
[Alias("serviceProfileIdentifier")]
[string[]]$serviceProfileId
)
begin {
$baseUri = "serviceprofiles"
$returnObject = [System.Collections.ArrayList]@()
}
process {
switch ( $PSCmdlet.ParameterSetName ) {
"siteIdentifier" {
$uri = "{0}?site={1}" -f $baseUri, $siteIdentifier
$returnObject = Invoke-ZertoRestRequest -uri $uri
}
"serviceProfileId" {
$returnObject = foreach ( $id in $serviceProfileId ) {
$uri = "{0}/{1}" -f $baseUri, $id
Invoke-ZertoRestRequest -uri $uri
}
}
default {
$returnObject = Invoke-ZertoRestRequest -uri $baseUri
}
}
}
end {
return $returnObject
}
}