Create Export-ZertoVpg

This commit is contained in:
Wes Carroll
2019-03-13 14:15:44 -04:00
parent 67d04889fe
commit ae2de975ca
3 changed files with 51 additions and 1 deletions
@@ -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 {
}
}
+1 -1
View File
@@ -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
@@ -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 {
}
}