From 65d89031f33e1c83f2c726dabac26135f3f25f28 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Tue, 26 Feb 2019 13:05:30 -0500 Subject: [PATCH] Create Pause and Resume operations --- ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 | 26 +++++++++++++++++++++ ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 | 26 +++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 create mode 100644 ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 diff --git a/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 new file mode 100644 index 0000000..16db296 --- /dev/null +++ b/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 @@ -0,0 +1,26 @@ +function Resume-ZertoVpg { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "Name(s) of VPG(s) to resume replication", + Mandatory = $true + )] + [string[]]$vpgName + ) + + begin { + $baseUri = "vpgs" + } + + process { + foreach ($name in $vpgName) { + $id = $(Get-ZertoVpg -name $name).vpgIdentifier + $uri = "{0}/{1}/resume" -f $baseUri, $id + Invoke-ZertoRestRequest -uri $uri -method "POST" + } + } + + end { + #Nothing to do + } +} diff --git a/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 new file mode 100644 index 0000000..9627ede --- /dev/null +++ b/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 @@ -0,0 +1,26 @@ +function Suspend-ZertoVpg { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "Name(s) of VPG(s) to pause replication", + Mandatory = $true + )] + [string[]]$vpgName + ) + + begin { + $baseUri = "vpgs" + } + + process { + foreach ($name in $vpgName) { + $id = $(Get-ZertoVpg -name $name).vpgIdentifier + $uri = "{0}/{1}/pause" -f $baseUri, $id + Invoke-ZertoRestRequest -uri $uri -method "POST" + } + } + + end { + #Nothing to do + } +}