Create Add-ZertoPeerSite and tests

This commit is contained in:
Wes Carroll
2019-02-24 21:26:40 -05:00
parent af86d6ddae
commit 613c8550fe
2 changed files with 51 additions and 0 deletions
@@ -0,0 +1,29 @@
function Add-ZertoPeerSite {
[cmdletbinding( SupportsShouldProcess = $true )]
param(
[parameter(
Mandatory = $true,
HelpMessage = "Target Hostname or IP address to pair the localsite to."
)]
[string]$targetHost,
[Parameter(
HelpMessage = "Target communication port. Default is 9081"
)]
[int]$targetPort = 9081
)
begin {
$baseUri = "peersites"
$body = @{"HostName" = $targetHost; "Port" = $targetPort}
}
process {
if ($PSCmdlet.ShouldProcess("Pairing with Site $targetHost")) {
Invoke-ZertoRestRequest -uri $baseUri -body $($body | ConvertTo-Json) -method "POST"
}
}
end {
# Nothing to do
}
}