diff --git a/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 new file mode 100644 index 0000000..ebb5dec --- /dev/null +++ b/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 @@ -0,0 +1,24 @@ +function Export-ZertoVpg { + [cmdletbinding()] + param( + [string]$outputPath, + [string[]]$vpgName + ) + + begin { + + } + + process { + foreach ($name in $vpgName) { + $vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -vpgIdentifier $(Get-ZertoVpg -name $name).vpgIdentifier + $vpgSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier + $filePath = "{0}\{1}.json" -f $outputPath, $name + $vpgSettings | Convertto-Json -depth 10 | Out-File -FilePath $filePath + } + } + + end { + + } +} \ No newline at end of file diff --git a/ZertoApiWrapper/Public/New-ZertoVpg.ps1 b/ZertoApiWrapper/Public/New-ZertoVpg.ps1 index 7b34854..a944121 100644 --- a/ZertoApiWrapper/Public/New-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/New-ZertoVpg.ps1 @@ -228,7 +228,7 @@ function New-ZertoVpg { process { $baseUri = "vpgsettings" # Create a VPG Settings Identifier - $vpgSettingsIdentifier = Invoke-ZertoRestRequest -uri $baseUri -body "{}" -method "POST" + $vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier # Put base settings into an object easy to manipulate $baseSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier # Set settings equal to passed and default parameters diff --git a/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 b/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 new file mode 100644 index 0000000..5fe72bf --- /dev/null +++ b/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 @@ -0,0 +1,26 @@ +function New-ZertoVpgSettingsIdentifier { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "Identifier of the VPG to create a VPG settings identifier. If a vpgIdentifier is not provided, a new VPG settings object is created without any configured settings. This would be used for creating a new VPG from scratch." + )] + [string]$vpgIdentifier = $null + ) + + begin { + $baseUri = "vpgSettings" + if ($null -eq $vpgIdentifier) { + $body = "{}" + } else { + $body = "{""VpgIdentifier"":""$vpgIdentifier""}" + } + } + + process { + Invoke-ZertoRestRequest -uri $baseUri -body $body -Method "POST" + } + + end { + + } +} \ No newline at end of file