Fix Body Creation Method

This commit is contained in:
Wes Carroll
2020-05-17 11:05:15 -04:00
parent 8f735bee62
commit 77b7e1c376
+4 -16
View File
@@ -62,32 +62,20 @@ function Start-ZertoCloneVpg {
} }
} }
$body['VmIdentifiers'] = $vmIdentifiers $body['VmIdentifiers'] = $vmIdentifiers
if ($checkpointIdentifier) {
$body['CheckpointIdentifier'] = $checkpointIdentifier
}
} }
}
process {
$uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier
$body = [ordered]@{ }
if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) { if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) {
$body['checkpointId'] = $checkpointIdentifier $body['checkpointId'] = $checkpointIdentifier
} }
if ( $datastoreIdentifier ) {
$body['DatastoreIdentifier'] = $datastoreIdentifier
}
if ( $vmIdentifiers ) {
$body['VmIdentifiers'] = $vmIdentifiers
}
Write-Verbose $body Write-Verbose $body
$uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier
if ($PSCmdlet.ShouldProcess("Clone Vpg")) { if ($PSCmdlet.ShouldProcess("Clone Vpg")) {
Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST" Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST"
Write-Verbose "Call Submitted to $uri"
Write-Verbose "With the following information: $($body | ConvertTo-Json)"
} }
} }
end { end {
Write-Verbose "Call Submitted to $uri"
Write-Verbose "With the following information: $($body | ConvertTo-Json)"
} }
} }