diff --git a/ZertoApiWrapper/Public/Get-ZertoAzureNetwork.ps1 b/ZertoApiWrapper/Public/Get-ZertoAzureNetwork.ps1 new file mode 100644 index 0000000..edf65cd --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZertoAzureNetwork.ps1 @@ -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 { + + } +} diff --git a/ZertoApiWrapper/Public/Get-ZertoAzureSecurityGroup.ps1 b/ZertoApiWrapper/Public/Get-ZertoAzureSecurityGroup.ps1 new file mode 100644 index 0000000..2b8c4c7 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZertoAzureSecurityGroup.ps1 @@ -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 { + + } +} diff --git a/ZertoApiWrapper/Public/Get-ZertoAzureSubnet.ps1 b/ZertoApiWrapper/Public/Get-ZertoAzureSubnet.ps1 new file mode 100644 index 0000000..dcb677f --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZertoAzureSubnet.ps1 @@ -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 { + + } +} diff --git a/ZertoApiWrapper/Public/Get-ZertoAzureVmInstanceType.ps1 b/ZertoApiWrapper/Public/Get-ZertoAzureVmInstanceType.ps1 new file mode 100644 index 0000000..75c6c2d --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZertoAzureVmInstanceType.ps1 @@ -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 { + + } +}