Update for explicit reverse and keep params
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||||
function Invoke-ZertoMoveCommit {
|
function Invoke-ZertoMoveCommit {
|
||||||
[cmdletbinding(SupportsShouldProcess = $true)]
|
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Main")]
|
||||||
param(
|
param(
|
||||||
[Parameter(
|
[Parameter(
|
||||||
HelpMessage = "Name(s) of the VPG(s) to commit.",
|
HelpMessage = "Name(s) of the VPG(s) to commit.",
|
||||||
@@ -9,11 +9,16 @@ function Invoke-ZertoMoveCommit {
|
|||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string[]]$vpgName,
|
[string[]]$vpgName,
|
||||||
[Parameter(
|
[Parameter(
|
||||||
HelpMessage = "Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False"
|
HelpMessage = "Use this switch to reverse protect the VPG(s) to the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.",
|
||||||
|
ParameterSetName = 'ReverseProtect',
|
||||||
|
Mandatory
|
||||||
|
|
||||||
)]
|
)]
|
||||||
[switch]$reverseProtection,
|
[switch]$reverseProtection,
|
||||||
[Parameter(
|
[Parameter(
|
||||||
HelpMessage = "Use this switch to keep the source VMs. If not set, they will be destroyed."
|
HelpMessage = "Use this switch to keep the source VMs at the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.",
|
||||||
|
ParameterSetName = 'KeepSource',
|
||||||
|
Mandatory
|
||||||
)]
|
)]
|
||||||
[switch]$keepSourceVms
|
[switch]$keepSourceVms
|
||||||
)
|
)
|
||||||
@@ -21,12 +26,16 @@ function Invoke-ZertoMoveCommit {
|
|||||||
begin {
|
begin {
|
||||||
$baseUri = "vpgs"
|
$baseUri = "vpgs"
|
||||||
$body = @{ }
|
$body = @{ }
|
||||||
if ($reverseProtection) {
|
Switch ($PSCmdlet.ParameterSetName){
|
||||||
$body["ReverseProtection"] = $true
|
'KeepSource' {
|
||||||
$body["KeepSourceVms"] = $false
|
$body["KeepSourceVms"] = $true
|
||||||
} elseif ($keepSourceVms) {
|
$body["ReverseProtection"] = $false
|
||||||
$body["KeepSourceVms"] = $true
|
}
|
||||||
$body["ReverseProtection"] = $false
|
|
||||||
|
'ReverseProtect' {
|
||||||
|
$body["ReverseProtection"] = $true
|
||||||
|
$body["KeepSourceVms"] = $false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user