working branch updates
Lots of updates to improve vscode syntax highlighting as well as some updates to the main invoke rest command per chatgpt recommendations :)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Add-ZertoPeerSite {
|
function Add-ZertoPeerSite {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Add-ZertoVpgVm {
|
function Add-ZertoVpgVm {
|
||||||
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VpgName")]
|
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VpgName")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Checkpoint-ZertoVpg {
|
function Checkpoint-ZertoVpg {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Copy-ZertoVpg {
|
function Copy-ZertoVpg {
|
||||||
[CmdletBinding(SupportsShouldProcess)]
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Edit-ZertoVra {
|
function Edit-ZertoVra {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Export-ZertoVmNicSetting {
|
function Export-ZertoVmNicSetting {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Export-ZertoVpg {
|
function Export-ZertoVpg {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAAlert {
|
function Get-ZAAlert {
|
||||||
[cmdletbinding( DefaultParameterSetName = "zOrg")]
|
[cmdletbinding( DefaultParameterSetName = "zOrg")]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZADatastore {
|
function Get-ZADatastore {
|
||||||
[CmdletBinding(DefaultParameterSetName = "AllInfo")]
|
[CmdletBinding(DefaultParameterSetName = "AllInfo")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAEvent {
|
function Get-ZAEvent {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalAverageHistory {
|
function Get-ZAJournalAverageHistory {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalAverageSize {
|
function Get-ZAJournalAverageSize {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalBreach {
|
function Get-ZAJournalBreach {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalHistoryStat {
|
function Get-ZAJournalHistoryStat {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalSiteAverageHistory {
|
function Get-ZAJournalSiteAverageHistory {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalSiteAverageSize {
|
function Get-ZAJournalSiteAverageSize {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalSiteHistoryStat {
|
function Get-ZAJournalSiteHistoryStat {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalSiteHistorySummary {
|
function Get-ZAJournalSiteHistorySummary {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalSiteSizeStat {
|
function Get-ZAJournalSiteSizeStat {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalStatusProportion {
|
function Get-ZAJournalStatusProportion {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalStorageStat {
|
function Get-ZAJournalStorageStat {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAJournalSummary {
|
function Get-ZAJournalSummary {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZALicense {
|
function Get-ZALicense {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param()
|
param()
|
||||||
$uri = "licenses"
|
$uri = "licenses"
|
||||||
Invoke-ZARestRequest -uri $uri
|
Invoke-ZARestRequest -uri $uri
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAMonitoring {
|
function Get-ZAMonitoring {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
@@ -15,4 +16,4 @@ function Get-ZAMonitoring {
|
|||||||
$uri = "{0}{1}" -f $uri, $filterString
|
$uri = "{0}{1}" -f $uri, $filterString
|
||||||
}
|
}
|
||||||
Invoke-ZARestRequest -uri $uri
|
Invoke-ZARestRequest -uri $uri
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkSiteAverageIOPS {
|
function Get-ZANetworkSiteAverageIOPS {
|
||||||
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkSiteAveragePerformance {
|
function Get-ZANetworkSiteAveragePerformance {
|
||||||
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkSiteStat {
|
function Get-ZANetworkSiteStat {
|
||||||
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkSiteSummary {
|
function Get-ZANetworkSiteSummary {
|
||||||
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
[CmdletBinding(DefaultParameterSetName = "ProtectedSite")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkVpgAverageIOPS {
|
function Get-ZANetworkVpgAverageIOPS {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkVpgAveragePerformance {
|
function Get-ZANetworkVpgAveragePerformance {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkVpgStat {
|
function Get-ZANetworkVpgStat {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZANetworkVpgSummary {
|
function Get-ZANetworkVpgSummary {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAPlannerJournalSizeReport {
|
function Get-ZAPlannerJournalSizeReport {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAPlannerNetworkPerformanceReport {
|
function Get-ZAPlannerNetworkPerformanceReport {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAPlannerSite {
|
function Get-ZAPlannerSite {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAPlannerStatsReport {
|
function Get-ZAPlannerStatsReport {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAPlannerWanReport {
|
function Get-ZAPlannerWanReport {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAPlannerZcasReport {
|
function Get-ZAPlannerZcasReport {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAProtectedVm {
|
function Get-ZAProtectedVm {
|
||||||
[cmdletbinding(DefaultParameterSetName = "AllVMs")]
|
[cmdletbinding(DefaultParameterSetName = "AllVMs")]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAProtectedVmReport {
|
function Get-ZAProtectedVmReport {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZARPOAccountAverage {
|
function Get-ZARPOAccountAverage {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZARPOAverage {
|
function Get-ZARPOAverage {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZARPOBreach {
|
function Get-ZARPOBreach {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZARPOStat {
|
function Get-ZARPOStat {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZARPOStatusProportion {
|
function Get-ZARPOStatusProportion {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZARPOSummary {
|
function Get-ZARPOSummary {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZASite {
|
function Get-ZASite {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZASitePair {
|
function Get-ZASitePair {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZASiteTopology {
|
function Get-ZASiteTopology {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZATask {
|
function Get-ZATask {
|
||||||
[cmdletbinding( DefaultParameterSetName = "zOrg")]
|
[cmdletbinding( DefaultParameterSetName = "zOrg")]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAVolume {
|
function Get-ZAVolume {
|
||||||
[CmdletBinding(DefaultParameterSetName = "VpgIdentifier")]
|
[CmdletBinding(DefaultParameterSetName = "VpgIdentifier")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAVpg {
|
function Get-ZAVpg {
|
||||||
[cmdletbinding(DefaultParameterSetName = 'zOrg')]
|
[cmdletbinding(DefaultParameterSetName = 'zOrg')]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZAzOrg {
|
function Get-ZAzOrg {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param()
|
param()
|
||||||
$uri = "monitoring/zorgs"
|
$uri = "monitoring/zorgs"
|
||||||
Invoke-ZARestRequest -uri $uri
|
Invoke-ZARestRequest -uri $uri
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoAlert {
|
function Get-ZertoAlert {
|
||||||
[cmdletbinding( defaultParameterSetName = "main" )]
|
[cmdletbinding( defaultParameterSetName = "main" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoDatastore {
|
function Get-ZertoDatastore {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoEvent {
|
function Get-ZertoEvent {
|
||||||
[cmdletbinding( defaultParameterSetName = "main" )]
|
[cmdletbinding( defaultParameterSetName = "main" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoLicense {
|
function Get-ZertoLicense {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param()
|
param()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoLocalSite {
|
function Get-ZertoLocalSite {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoPeerSite {
|
function Get-ZertoPeerSite {
|
||||||
[cmdletbinding( defaultParameterSetName = "main" )]
|
[cmdletbinding( defaultParameterSetName = "main" )]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoProtectedVm {
|
function Get-ZertoProtectedVm {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoRecoveryReport {
|
function Get-ZertoRecoveryReport {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoResourcesReport {
|
function Get-ZertoResourcesReport {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoServiceProfile {
|
function Get-ZertoServiceProfile {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoTask {
|
function Get-ZertoTask {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoUnprotectedVm {
|
function Get-ZertoUnprotectedVm {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param()
|
param()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoVirtualizationSite {
|
function Get-ZertoVirtualizationSite {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoVolume {
|
function Get-ZertoVolume {
|
||||||
[cmdletbinding( DefaultParameterSetName = "main" )]
|
[cmdletbinding( DefaultParameterSetName = "main" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoVpgSetting {
|
function Get-ZertoVpgSetting {
|
||||||
[cmdletbinding(
|
[cmdletbinding(
|
||||||
DefaultParameterSetName = "main",
|
DefaultParameterSetName = "main",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoVra {
|
function Get-ZertoVra {
|
||||||
[cmdletbinding(
|
[cmdletbinding(
|
||||||
DefaultParameterSetName = "main"
|
DefaultParameterSetName = "main"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoZorg {
|
function Get-ZertoZorg {
|
||||||
[cmdletbinding( DefaultParameterSetName = "default" )]
|
[cmdletbinding( DefaultParameterSetName = "default" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Get-ZertoZsspSession {
|
function Get-ZertoZsspSession {
|
||||||
[cmdletbinding( DefaultParameterSetName = "default" )]
|
[cmdletbinding( DefaultParameterSetName = "default" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Import-ZertoVmNicSetting {
|
function Import-ZertoVmNicSetting {
|
||||||
[CmdletBinding(SupportsShouldProcess)]
|
[CmdletBinding(SupportsShouldProcess)]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Import-ZertoVpg {
|
function Import-ZertoVpg {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Install-ZertoVra {
|
function Install-ZertoVra {
|
||||||
[cmdletbinding( SupportsShouldProcess )]
|
[cmdletbinding( SupportsShouldProcess )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZARestRequest {
|
function Invoke-ZARestRequest {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoEvacuateVra {
|
function Invoke-ZertoEvacuateVra {
|
||||||
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VraIdentifier")]
|
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VraIdentifier")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoFailover {
|
function Invoke-ZertoFailover {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoFailoverCommit {
|
function Invoke-ZertoFailoverCommit {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoFailoverRollback {
|
function Invoke-ZertoFailoverRollback {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoForceSync {
|
function Invoke-ZertoForceSync {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoMove {
|
function Invoke-ZertoMove {
|
||||||
[CmdletBinding( DefaultParameterSetName = "id", SupportsShouldProcess = $true )]
|
[CmdletBinding( DefaultParameterSetName = "id", SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoMoveCommit {
|
function Invoke-ZertoMoveCommit {
|
||||||
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Main")]
|
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Main")]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Invoke-ZertoMoveRollback {
|
function Invoke-ZertoMoveRollback {
|
||||||
[cmdletbinding(SupportsShouldProcess = $true)]
|
[cmdletbinding(SupportsShouldProcess = $true)]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,170 +1,130 @@
|
|||||||
function Invoke-ZertoRestRequest {
|
function Invoke-ZertoRestRequest {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
# Parameter help description
|
[Parameter(HelpMessage = "API method to be used. GET, PUT, POST, or DELETE. If unspecified, defaults to GET.")]
|
||||||
[Parameter(
|
|
||||||
Helpmessage = "API method to be used. GET, PUT, POST, or DELETE. Refer to documentation for the API endpoint to ensure the correct method is being used. If unspecified, defaults to GET"
|
|
||||||
)]
|
|
||||||
[ValidateSet("GET", "PUT", "POST", "DELETE")]
|
[ValidateSet("GET", "PUT", "POST", "DELETE")]
|
||||||
[string]$method = "GET",
|
[string]$method = "GET",
|
||||||
[Parameter(
|
|
||||||
Mandatory,
|
[Parameter(Mandatory, HelpMessage = "URI endpoint to be utilized. Only the endpoint needs to be submitted.")]
|
||||||
Helpmessage = "URI endpoint to be utilized. When submitting the URI, only the endpoint needs to be submitted. Please review the help documentation for examples."
|
|
||||||
)]
|
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]$uri,
|
[string]$uri,
|
||||||
[Parameter(
|
|
||||||
Helpmessage = "Body to be submitted to the REST API endpoint. This needs to be submitted in JSON format"
|
[Parameter(HelpMessage = "Body to be submitted to the REST API endpoint in JSON format.")]
|
||||||
)]
|
[string]$body = "",
|
||||||
[ValidateNotNullOrEmpty()]
|
|
||||||
[string]$body,
|
[Parameter(HelpMessage = "PSCredential object, used only when authenticating with the ZVM.")]
|
||||||
[Parameter(
|
|
||||||
Helpmessage = "PSCredential object. This is ONLY used when authenticating with the ZVM. No other endpoints require this and generally is not used."
|
|
||||||
)]
|
|
||||||
[PSCredential]$credential,
|
[PSCredential]$credential,
|
||||||
[Parameter(
|
|
||||||
Helpmessage = "Use this switch if you would like the request headers returned along with the body. Useful for troubleshooting to get HTTP error codes."
|
[Parameter(HelpMessage = "Use this switch to return request headers along with the response body.")]
|
||||||
)]
|
|
||||||
[switch]$returnHeaders
|
[switch]$returnHeaders
|
||||||
)
|
)
|
||||||
# API version. Currently this is locked at v1 in all versions of Zerto. Should this change, will look
|
|
||||||
# at making this as parameter to be selected during function call.
|
|
||||||
$apiVersion = "v1"
|
$apiVersion = "v1"
|
||||||
# While the API can use XML or JSON, this module is built on JSON functionality. Currently forcing all
|
|
||||||
# content types and language to JSON.
|
|
||||||
$contentType = "application/json"
|
|
||||||
$callerErrorActionPreference = $ErrorActionPreference
|
$callerErrorActionPreference = $ErrorActionPreference
|
||||||
# If the ZVM server and Port not defined, Stop Call
|
|
||||||
if ( -not ((Test-Path variable:script:zvmServer) -and (Test-Path variable:script:zvmPort)) ) {
|
# Ensure required script variables exist
|
||||||
Throw "Zerto Connection does not Exist. Please run Connect-ZertoServer first to establish a connection"
|
if (-not (Test-Path variable:script:zvmServer) -or -not (Test-Path variable:script:zvmPort)) {
|
||||||
|
Throw "Zerto connection does not exist. Run Connect-ZertoServer first."
|
||||||
}
|
}
|
||||||
|
|
||||||
# If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired
|
# Ensure $Script:Reconnect is defined
|
||||||
if ( (Test-Path variable:script:zvmHeaders) -and (Test-Path variable:script:AuthExpiresAt) -and $([datetime]$script:AuthExpiresAt) -lt $(Get-Date) -and $Script:Reconnect -eq $False ) {
|
if (-not (Test-Path variable:script:Reconnect)) { $Script:Reconnect = $false }
|
||||||
|
|
||||||
|
# Check for expired session
|
||||||
|
if ((Test-Path variable:script:AuthExpiresAt) -and $([datetime]$script:AuthExpiresAt) -lt (Get-Date)) {
|
||||||
Remove-Variable -Name AuthExpiresAt -Scope Script
|
Remove-Variable -Name AuthExpiresAt -Scope Script
|
||||||
Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager"
|
if ($Script:Reconnect) {
|
||||||
} elseif (( (Test-Path variable:script:zvmHeaders) -and (Test-Path variable:script:AuthExpiresAt) -and $([datetime]$script:AuthExpiresAt) -lt $(Get-Date) -and $Script:Reconnect -eq $True )) {
|
Write-Verbose "Authorization expired. Reauthorizing."
|
||||||
Write-Verbose "Authorization had expired. Attempting Reauthorization."
|
Connect-ZertoServer -zertoServer $Script:zvmServer -zertoPort $script:zvmPort -credential $Script:CachedCredential
|
||||||
Remove-Variable -Name AuthExpiresAt -Scope Script
|
|
||||||
Connect-ZertoServer -zertoServer $Script:zvmServer -zertoPort $script:zvmPort -credential $Script:CachedCredential
|
|
||||||
}# else {
|
|
||||||
|
|
||||||
# Build the URI to be submitted
|
|
||||||
$submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri
|
|
||||||
try {
|
|
||||||
# Set the zvmLastAction time and try to submit the REST Request
|
|
||||||
$script:zvmLastAction = (Get-Date).Ticks
|
|
||||||
# If running PwSh - Use this Invoke-RestMethod with passed Variables
|
|
||||||
if ($PSVersionTable.PSVersion.Major -ge 6) {
|
|
||||||
# If we are authenticating to the ZVM, Use this block to use Invoke-WebRequest and format the Headers and Body as expected.
|
|
||||||
if ($uri -eq "auth/realms/zerto/protocol/openid-connect/token" -and $method -eq "POST") {
|
|
||||||
$data = @{
|
|
||||||
'client_id' = $script:zertoClientId
|
|
||||||
'username' = $credential.GetNetworkCredential().UserName
|
|
||||||
'password' = $credential.GetNetworkCredential().Password
|
|
||||||
'grant_type' = 'password'
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = @{
|
|
||||||
'Uri' = 'https://' + $script:zvmServer + ':' + $script:zvmPort + '/auth/realms/zerto/protocol/openid-connect/token'
|
|
||||||
'Method' = 'Post'
|
|
||||||
'Body' = $data
|
|
||||||
'ContentType' = 'application/x-www-form-urlencoded'
|
|
||||||
}
|
|
||||||
$apiRequestResults = Invoke-RestMethod @params -SkipCertificateCheck
|
|
||||||
|
|
||||||
$ExpiresIn = $apiRequestResults.expires_in
|
|
||||||
$script:AuthExpiresAt = (Get-Date).AddSeconds($ExpiresIn)
|
|
||||||
$script:refreshToken = $apiRequestResults.refresh_token
|
|
||||||
$responseHeaders = @{ }
|
|
||||||
$responseHeaders['Authorization'] = "Bearer " + @($apiRequestResults.access_token)
|
|
||||||
|
|
||||||
# If we are logging out from the ZVM, use this block to use Invoke-WebRequest and format the Headers and Body as expected.
|
|
||||||
} elseif ($uri -eq "auth/realms/zerto/protocol/openid-connect/logout" -and $method -eq "POST") {
|
|
||||||
$data = @{
|
|
||||||
'client_id' = $script:zertoClientId
|
|
||||||
'logout' = 'true'
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = @{
|
|
||||||
'Uri' = 'https://' + $script:zvmServer + ':' + $script:zvmPort + '/auth/realms/zerto/protocol/openid-connect/logout'
|
|
||||||
'Method' = 'Post'
|
|
||||||
'Body' = $data
|
|
||||||
'ContentType' = 'application/x-www-form-urlencoded'
|
|
||||||
}
|
|
||||||
|
|
||||||
$apiRequestResults = Invoke-RestMethod @params -SkipCertificateCheck
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
# If running PowerShell 5.1 --> Do the Following
|
Throw "Authorization token expired. Please reauthorize."
|
||||||
# Check to see if All Certs are Trusted. If not, Create the Policy to Trust All Certificates
|
}
|
||||||
if ([System.Net.ServicePointManager]::CertificatePolicy.GetType().Name -ne "TrustAllCertsPolicy") {
|
|
||||||
Try {
|
|
||||||
$type = @'
|
|
||||||
using System.Net;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
|
||||||
public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
'@
|
|
||||||
Add-Type -TypeDefinition $type -ErrorAction SilentlyContinue
|
|
||||||
} Catch {
|
|
||||||
if ($error[0].Exception -ne "Cannot add type. The type name 'TrustAllCertsPolicy already exists.") {
|
|
||||||
Write-Debug $error[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
|
||||||
|
|
||||||
|
$submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri
|
||||||
|
$script:zvmLastAction = (Get-Date).Ticks
|
||||||
|
$responseHeaders = @{}
|
||||||
|
$apiRequestResults = $null
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Set default headers
|
||||||
|
$headers = @{
|
||||||
|
"Accept" = "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
# If authorization headers exist, add them
|
||||||
|
if (Test-Path variable:script:zvmHeaders) {
|
||||||
|
$headers["Authorization"] = "Bearer $($script:zvmHeaders.Authorization)"
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = @{
|
||||||
|
Uri = $submittedURI
|
||||||
|
Method = $method
|
||||||
|
Headers = $headers
|
||||||
|
Body = $body
|
||||||
|
TimeoutSec = 100
|
||||||
|
}
|
||||||
|
|
||||||
|
# Handle authentication requests
|
||||||
|
if ($uri -match "auth/realms/.*/protocol/openid-connect/token" -and $method -eq "POST") {
|
||||||
|
$data = @{
|
||||||
|
'client_id' = $script:zertoClientId
|
||||||
|
'username' = $credential.GetNetworkCredential().UserName
|
||||||
|
'password' = $credential.GetNetworkCredential().Password
|
||||||
|
'grant_type' = 'password'
|
||||||
}
|
}
|
||||||
# If we are authenticating to the ZVM, Use this block to use Invoke-WebRequest and format the Headers as expected.
|
|
||||||
if ($uri -eq "auth/realms/zerto/protocol/openid-connect/token" -and $method -eq "POST") {
|
|
||||||
$data = @{
|
|
||||||
'client_id' = $script:zertoClientId
|
|
||||||
'username' = $credential.GetNetworkCredential().UserName
|
|
||||||
'password' = $credential.GetNetworkCredential().Password
|
|
||||||
'grant_type' = 'password'
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = @{
|
$params.Uri = "https://{0}:{1}/auth/realms/zerto/protocol/openid-connect/token" -f $script:zvmServer, $script:zvmPort
|
||||||
'Uri' = 'https://' + $script:zvmServer + ':' + $script:zvmPort + '/auth/realms/zerto/protocol/openid-connect/token'
|
$params.Body = $data
|
||||||
'Method' = 'POST'
|
$params.ContentType = "application/x-www-form-urlencoded"
|
||||||
'Body' = $data
|
} else {
|
||||||
'ContentType' = 'application/x-www-form-urlencoded'
|
$params.ContentType = "application/json"
|
||||||
}
|
}
|
||||||
$apiRequestResults = Invoke-RestMethod @params
|
|
||||||
|
|
||||||
$ExpiresIn = $apiRequestResults.expires_in
|
# Handle certificate validation for PowerShell 5.1
|
||||||
$script:AuthExpiresAt = (Get-Date).AddSeconds($ExpiresIn)
|
if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||||
$script:refreshToken = $apiRequestResults.refresh_token
|
$params["SkipCertificateCheck"] = $true
|
||||||
$responseHeaders = @{ }
|
} elseif ([System.Net.ServicePointManager]::CertificatePolicy.GetType().Name -ne "TrustAllCertsPolicy") {
|
||||||
$responseHeaders['Authorization'] = "Bearer " + @($apiRequestResults.access_token)
|
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
|
||||||
} elseif ($method -ne "GET") {
|
}
|
||||||
# If the Method is something other than 'GET' use this call with a body parameter
|
|
||||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
$apiRequestResults = Invoke-RestMethod @params -ResponseHeadersVariable responseHeaders
|
||||||
} else {
|
|
||||||
# If the Method we are calling is 'GET' use this call without a body parameter
|
# Debugging - Inspect Response Type
|
||||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -ContentType $contentType -Credential $credential -TimeoutSec 100
|
Write-Verbose "Response Type: $($apiRequestResults.GetType().FullName)"
|
||||||
|
Write-Verbose "Response Content: $($apiRequestResults | ConvertTo-Json -Depth 10)"
|
||||||
|
|
||||||
|
# Ensure response is parsed properly
|
||||||
|
if ($apiRequestResults -is [string]) {
|
||||||
|
try {
|
||||||
|
$apiRequestResults = $apiRequestResults | ConvertFrom-Json -ErrorAction Stop
|
||||||
|
} catch {
|
||||||
|
Write-Verbose "Response is not in JSON format, returning raw output."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
|
||||||
# If an error is encountered, Catch
|
# Handle token expiration update
|
||||||
|
if ($uri -match "auth/realms/.*/protocol/openid-connect/token" -and $method -eq "POST") {
|
||||||
|
if ($apiRequestResults -is [System.Collections.IDictionary]) {
|
||||||
|
Write-Verbose "API response is a dictionary. Extracting values..."
|
||||||
|
}
|
||||||
|
$script:AuthExpiresAt = (Get-Date).AddSeconds($apiRequestResults.expires_in)
|
||||||
|
$script:refreshToken = $apiRequestResults.refresh_token
|
||||||
|
$headers["Authorization"] = "Bearer " + $apiRequestResults.access_token
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
Write-Error -ErrorRecord $_ -ErrorAction $callerErrorActionPreference
|
Write-Error -ErrorRecord $_ -ErrorAction $callerErrorActionPreference
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# If the calling function does not need the headers (Default Action) return the results of the API Call
|
# Return response based on $returnHeaders flag
|
||||||
if (-not $returnHeaders) {
|
if (-not $returnHeaders) {
|
||||||
return $apiRequestResults
|
return $apiRequestResults
|
||||||
} else {
|
} else {
|
||||||
#If Headers are required, build a PS Custom Object with the Results and the Headers
|
return [PSCustomObject]@{
|
||||||
$apiRequestAndHeaderResults = New-Object -TypeName psobject
|
apiRequestResults = $apiRequestResults
|
||||||
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "apiRequestResults" -Value $apiRequestResults
|
Headers = $responseHeaders
|
||||||
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "Headers" -Value $responseHeaders
|
}
|
||||||
return $apiRequestAndHeaderResults
|
|
||||||
#}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function New-ZertoPairingToken {
|
function New-ZertoPairingToken {
|
||||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function New-ZertoVpg {
|
function New-ZertoVpg {
|
||||||
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "recoveryHostDatastore")]
|
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "recoveryHostDatastore")]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function New-ZertoVpgSettingsIdentifier {
|
function New-ZertoVpgSettingsIdentifier {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "newVpg" )]
|
[cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "newVpg" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Remove-ZertoPeerSite {
|
function Remove-ZertoPeerSite {
|
||||||
[cmdletbinding(
|
[cmdletbinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Remove-ZertoVpg {
|
function Remove-ZertoVpg {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "vpgIdentifier" )]
|
[cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "vpgIdentifier" )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Remove-ZertoVpgSettingsIdentifier {
|
function Remove-ZertoVpgSettingsIdentifier {
|
||||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Remove-ZertoVpgVm {
|
function Remove-ZertoVpgVm {
|
||||||
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")]
|
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Resume-ZertoVpg {
|
function Resume-ZertoVpg {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Save-ZertoVpgSetting {
|
function Save-ZertoVpgSetting {
|
||||||
[cmdletbinding(
|
[cmdletbinding(
|
||||||
SupportsShouldProcess = $true
|
SupportsShouldProcess = $true
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Set-ZertoAlert {
|
function Set-ZertoAlert {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Set-ZertoLicense {
|
function Set-ZertoLicense {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param (
|
param (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Set-ZertoUserCredential {
|
function Set-ZertoUserCredential {
|
||||||
[cmdletbinding(
|
[cmdletbinding(
|
||||||
SupportsShouldProcess,
|
SupportsShouldProcess,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Start-ZertoCloneVpg {
|
function Start-ZertoCloneVpg {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Start-ZertoFailoverTest {
|
function Start-ZertoFailoverTest {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Stop-ZertoCloneVpg {
|
function Stop-ZertoCloneVpg {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||||
|
#>
|
||||||
function Stop-ZertoFailoverTest {
|
function Stop-ZertoFailoverTest {
|
||||||
[cmdletbinding( SupportsShouldProcess = $true )]
|
[cmdletbinding( SupportsShouldProcess = $true )]
|
||||||
param(
|
param(
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user