Create FailoverCommit Function.

This commit is contained in:
Wes Carroll
2019-02-27 14:06:25 -05:00
parent 8416155d40
commit 341ed95402
@@ -0,0 +1,35 @@
function Invoke-ZertoFailoverCommit {
[cmdletbiding()]
param(
[Parameter(
HelpMessage = "Name(s) of the VPG(s) to commit.",
Mandatory = $true
)]
[string[]]$vpgName,
[Parameter(
HelpMessage = "Use this switch to reverse protect the VPG(s) to the source site."
)]
[switch]$reverseProtect
)
begin {
$baseUri = "vpgs"
if ( $reverseProtect ) {
$body = @{"IsReverseProtect" = 1}
} else {
$body = @{"IsReverseProtect" = 0}
}
}
process {
foreach ($name in $vpgName) {
$vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier
$uri = "{0}/{1}/FailoverCommit" -f $baseUri, $vpgId
Invoke-ZertoRestRequest -uri $uri -body $($body | convertto-json) -method "POST"
}
}
end {
# Nothing to do
}
}