Skip to content

Commit 558b2b1

Browse files
committed
Add RegionCapacity
1 parent d2e382d commit 558b2b1

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

Infrastructure/AzureStack.Infra.psm1

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ export-modulemember -function Disable-AzSScaleUnitNode
839839

840840
<#
841841
.SYNOPSIS
842-
Disable Maintenance Mode
842+
Enable Maintenance Mode
843843
#>
844844

845845
Function Enable-AzSScaleUnitNode{
@@ -875,6 +875,45 @@ Function Enable-AzSScaleUnitNode{
875875
export-modulemember -function Enable-AzSScaleUnitNode
876876

877877

878+
<#
879+
.SYNOPSIS
880+
Get Region Capacity
881+
#>
882+
883+
Function Get-AzSRegionCapacity{
884+
[CmdletBinding(DefaultParameterSetName='GetRegionCapacity')]
885+
Param(
886+
887+
[Parameter(Mandatory=$true, ParameterSetName='GetRegionCapacity')]
888+
[ValidateNotNullorEmpty()]
889+
[String] $TenantId,
890+
891+
[Parameter(Mandatory=$true, ParameterSetName='GetRegionCapacity')]
892+
[ValidateNotNullorEmpty()]
893+
[System.Management.Automation.PSCredential] $azureStackCredentials,
894+
895+
[Parameter(Mandatory=$true, HelpMessage="The Azure Stack Administrator Environment Name", ParameterSetName='GetRegionCapacity')]
896+
[string] $EnvironmentName,
897+
898+
[Parameter(ParameterSetName='GetRegionCapacity')]
899+
[string] $region = 'local'
900+
901+
902+
903+
)
904+
$ARMEndpoint = GetARMEndpoint -EnvironmentName $EnvironmentName -ErrorAction Stop
905+
906+
$subscription, $headers = (Get-AzureStackAdminSubTokenHeader -TenantId $tenantId -AzureStackCredentials $azureStackCredentials -EnvironmentName $EnvironmentName)
907+
$URI= "${ArmEndpoint}/subscriptions/${subscription}/resourceGroups/system.$region/providers/Microsoft.InfrastructureInsights.Admin/regionHealths?api-version=2016-05-01"
908+
$Capacity=Invoke-RestMethod -Method GET -Uri $uri -ContentType 'application/json' -Headers $Headers
909+
$RCapacity=$Capacity.value
910+
$RCapacity| select name,properties
911+
912+
913+
}
914+
export-modulemember -function Get-AzSRegionCapacity
915+
916+
878917
Function Set-AzSLocationInformation {
879918
Param(
880919
[Parameter(Mandatory = $true)]

0 commit comments

Comments
 (0)