Files
ZertoApiWrapper/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1
T
2020-02-28 08:15:53 -05:00

42 lines
1.2 KiB
PowerShell

<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Checkpoint-ZertoVpg {
[cmdletbinding()]
param(
[Parameter(
Mandatory = $true,
HelpMessage = "Name of the VPG to tag.",
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true
)]
[ValidateNotNullOrEmpty()]
[string[]]$vpgName,
[Parameter(
Mandatory = $true,
HelpMessage = "Text to tag the checkpoint with."
)]
[ValidateNotNullOrEmpty()]
[string]$checkpointName
)
begin {
$baseUri = "vpgs"
}
process {
foreach ($name in $vpgName) {
$vpgIdentifier = $(get-zertovpg -name $name).vpgIdentifier
if ($vpgIdentifier) {
$uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier
$body = @{"checkpointName" = $checkpointName}
Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST"
} else {
Write-Output "Cannot find VPG named $name. Please check the name and try again."
}
}
}
end {
}
}