Azure VPG Helper Functions Creation
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||||
|
function Get-ZertoAzureNetwork {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = "SiteName")]
|
||||||
|
param (
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Name the Azure Site you wish to get the Networks.",
|
||||||
|
ParameterSetName = "SiteName"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteName,
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Site Identifier of the Azure Site you wish to get the Networks.",
|
||||||
|
ParameterSetName = "SiteIdentifier"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteIdentifier
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ParameterSetName -match "SiteName") {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $SiteName }
|
||||||
|
if ($null -eq $SiteInfo) {
|
||||||
|
Write-Error "Unable to find a peer site with the name $SiteName. Please check your parameters and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$SiteIdentifier = $SiteInfo | Select-Object -ExpandProperty SiteIdentifier
|
||||||
|
} else {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite -siteIdentifier $SiteIdentifier
|
||||||
|
}
|
||||||
|
if ($SiteInfo.SiteType -notmatch "Azure") {
|
||||||
|
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$uri = "virtualizationsites/{0}/publicCloud/virtualNetworks" -f $SiteIdentifier
|
||||||
|
Invoke-ZertoRestRequest -uri $uri
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||||
|
function Get-ZertoAzureSecurityGroup {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = "SiteName")]
|
||||||
|
param (
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Name the Azure Site you wish to get the Security Groups.",
|
||||||
|
ParameterSetName = "SiteName"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteName,
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Site Identifier of the Azure Site you wish to get the Security Groups.",
|
||||||
|
ParameterSetName = "SiteIdentifier"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteIdentifier
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ParameterSetName -match "SiteName") {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $SiteName }
|
||||||
|
if ($null -eq $SiteInfo) {
|
||||||
|
Write-Error "Unable to find a peer site with the name $SiteName. Please check your parameters and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$SiteIdentifier = $SiteInfo | Select-Object -ExpandProperty SiteIdentifier
|
||||||
|
} else {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite -siteIdentifier $SiteIdentifier
|
||||||
|
}
|
||||||
|
if ($SiteInfo.SiteType -notmatch "Azure") {
|
||||||
|
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$uri = "virtualizationsites/{0}/publicCloud/securityGroups" -f $SiteIdentifier
|
||||||
|
Invoke-ZertoRestRequest -uri $uri
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||||
|
function Get-ZertoAzureSubnet {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = "SiteName")]
|
||||||
|
param (
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Name the Azure Site you wish to get the Subnets.",
|
||||||
|
ParameterSetName = "SiteName"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteName,
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Site Identifier of the Azure Site you wish to get the Subnets.",
|
||||||
|
ParameterSetName = "SiteIdentifier"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteIdentifier
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ParameterSetName -match "SiteName") {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $SiteName }
|
||||||
|
if ($null -eq $SiteInfo) {
|
||||||
|
Write-Error "Unable to find a peer site with the name $SiteName. Please check your parameters and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$SiteIdentifier = $SiteInfo | Select-Object -ExpandProperty SiteIdentifier
|
||||||
|
} else {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite -siteIdentifier $SiteIdentifier
|
||||||
|
}
|
||||||
|
if ($SiteInfo.SiteType -notmatch "Azure") {
|
||||||
|
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$uri = "virtualizationsites/{0}/publicCloud/subnets" -f $SiteIdentifier
|
||||||
|
Invoke-ZertoRestRequest -uri $uri
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||||
|
function Get-ZertoAzureVmInstanceType {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = "SiteName")]
|
||||||
|
param (
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Name the Azure Site you wish to get the Vm Instance Types.",
|
||||||
|
ParameterSetName = "SiteName"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteName,
|
||||||
|
[Parameter(
|
||||||
|
Mandatory,
|
||||||
|
HelpMessage = "Site Identifier of the Azure Site you wish to get the Vm Instance Types.",
|
||||||
|
ParameterSetName = "SiteIdentifier"
|
||||||
|
)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$SiteIdentifier
|
||||||
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ParameterSetName -match "SiteName") {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $SiteName }
|
||||||
|
if ($null -eq $SiteInfo) {
|
||||||
|
Write-Error "Unable to find a peer site with the name $SiteName. Please check your parameters and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$SiteIdentifier = $SiteInfo | Select-Object -ExpandProperty SiteIdentifier
|
||||||
|
} else {
|
||||||
|
$SiteInfo = Get-ZertoPeerSite -siteIdentifier $SiteIdentifier
|
||||||
|
}
|
||||||
|
if ($SiteInfo.SiteType -notmatch "Azure") {
|
||||||
|
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
|
||||||
|
}
|
||||||
|
$uri = "virtualizationsites/{0}/publicCloud/vmInstanceTypes" -f $SiteIdentifier
|
||||||
|
Invoke-ZertoRestRequest -uri $uri
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user