Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Changes may cause incorrect behavior and will be lost if the code is regenerated
#>
function New-AzsComputeQuota {
[OutputType([Microsoft.AzureStack.Management.Compute.Admin.Models.Quota])]
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
Expand Down Expand Up @@ -89,45 +88,43 @@ function New-AzsComputeQuota {
Process {

$ErrorActionPreference = 'Stop'
if ($PSCmdlet.ShouldProcess("$Name" , "Add new compute quota")) {
if ($Force.IsPresent -or $PSCmdlet.ShouldContinue("Add new compute quota?", "Adding a new compute quota with name $Name")) {
if ($Force.IsPresent -or $PSCmdlet.ShouldContinue("Add new compute quota?", "Adding a new compute quota with name $Name")) {

$NewServiceClient_params = @{
FullClientTypeName = 'Microsoft.AzureStack.Management.Compute.Admin.ComputeAdminClient'
}
$NewServiceClient_params = @{
FullClientTypeName = 'Microsoft.AzureStack.Management.Compute.Admin.ComputeAdminClient'
}

$GlobalParameterHashtable = @{}
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable
$GlobalParameterHashtable = @{}
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable

$GlobalParameterHashtable['SubscriptionId'] = $null
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
}
$GlobalParameterHashtable['SubscriptionId'] = $null
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
}

$ComputeAdminClient = New-ServiceClient @NewServiceClient_params
$ComputeAdminClient = New-ServiceClient @NewServiceClient_params

# Default location if missing
if ([String]::IsNullOrEmpty($Location)) {
$Location = (Get-AzureRmLocation).Location
}
# Default location if missing
if ([String]::IsNullOrEmpty($Location)) {
$Location = (Get-AzureRmLocation).Location
}

# Create object
$flattenedParameters = @('AvailabilitySetCount', 'CoresLimit', 'VmScaleSetCount', 'VirtualMachineCount', 'Location' )
$utilityCmdParams = @{}
$flattenedParameters | ForEach-Object {
$utilityCmdParams[$_] = Get-Variable -Name $_ -ValueOnly
}
$NewQuota = New-QuotaObject @utilityCmdParams
# Create object
$flattenedParameters = @('AvailabilitySetCount', 'CoresLimit', 'VmScaleSetCount', 'VirtualMachineCount', 'Location' )
$utilityCmdParams = @{}
$flattenedParameters | ForEach-Object {
$utilityCmdParams[$_] = Get-Variable -Name $_ -ValueOnly
}
$NewQuota = New-QuotaObject @utilityCmdParams

Write-Verbose -Message 'Performing operation CreateOrUpdateWithHttpMessagesAsync on $ComputeAdminClient.'
$TaskResult = $ComputeAdminClient.Quotas.CreateOrUpdateWithHttpMessagesAsync($Location, $Name, $NewQuota)
Write-Verbose -Message 'Performing operation CreateOrUpdateWithHttpMessagesAsync on $ComputeAdminClient.'
$TaskResult = $ComputeAdminClient.Quotas.CreateOrUpdateWithHttpMessagesAsync($Location, $Name, $NewQuota)

if ($TaskResult) {
$GetTaskResult_params = @{
TaskResult = $TaskResult
}
Get-TaskResult @GetTaskResult_params
if ($TaskResult) {
$GetTaskResult_params = @{
TaskResult = $TaskResult
}
Get-TaskResult @GetTaskResult_params
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Licensed under the MIT License. See License.txt in the project root for license
#>
function New-AzsIpPool {
[OutputType([Microsoft.AzureStack.Management.Fabric.Admin.Models.ProvisioningState])]
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $false)]
[string]
Expand Down Expand Up @@ -98,84 +97,82 @@ function New-AzsIpPool {

$ErrorActionPreference = 'Stop'

if ($PSCmdlet.ShouldProcess("$Name" , "Add IP pool")) {
if ($Force.IsPresent -or $PSCmdlet.ShouldContinue("Add IP pool?", "Performing operation add IP pool for $Name")) {
if ($Force.IsPresent -or $PSCmdlet.ShouldContinue("Add IP pool?", "Performing operation add IP pool for $Name")) {

$NewServiceClient_params = @{
FullClientTypeName = 'Microsoft.AzureStack.Management.Fabric.Admin.FabricAdminClient'
}
$NewServiceClient_params = @{
FullClientTypeName = 'Microsoft.AzureStack.Management.Fabric.Admin.FabricAdminClient'
}

$GlobalParameterHashtable = @{}
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable
$GlobalParameterHashtable = @{}
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable

$GlobalParameterHashtable['SubscriptionId'] = $null
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
}
$GlobalParameterHashtable['SubscriptionId'] = $null
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
}

$FabricAdminClient = New-ServiceClient @NewServiceClient_params
$FabricAdminClient = New-ServiceClient @NewServiceClient_params

if ([String]::IsNullOrEmpty($Location)) {
$Location = (Get-AzureRMLocation).Location
}
if ([String]::IsNullOrEmpty($ResourceGroupName)) {
$ResourceGroupName = "System.$Location"
}
if ([String]::IsNullOrEmpty($Location)) {
$Location = (Get-AzureRMLocation).Location
}
if ([String]::IsNullOrEmpty($ResourceGroupName)) {
$ResourceGroupName = "System.$Location"
}

$flattenedParameters = @('NumberOfIpAddressesInTransition', 'StartIpAddress', 'Tags', 'AddressPrefix', 'NumberOfIpAddresses', 'Location', 'EndIpAddress', 'NumberOfAllocatedIpAddresses')
$utilityCmdParams = @{}
$flattenedParameters | ForEach-Object {
if ($PSBoundParameters.ContainsKey($_)) {
$utilityCmdParams[$_] = $PSBoundParameters[$_]
}
$flattenedParameters = @('NumberOfIpAddressesInTransition', 'StartIpAddress', 'Tags', 'AddressPrefix', 'NumberOfIpAddresses', 'Location', 'EndIpAddress', 'NumberOfAllocatedIpAddresses')
$utilityCmdParams = @{}
$flattenedParameters | ForEach-Object {
if ($PSBoundParameters.ContainsKey($_)) {
$utilityCmdParams[$_] = $PSBoundParameters[$_]
}
$Pool = New-IpPoolObject @utilityCmdParams

Write-Verbose -Message 'Performing operation CreateOrUpdateWithHttpMessagesAsync on $FabricAdminClient.'
$TaskResult = $FabricAdminClient.IpPools.CreateOrUpdateWithHttpMessagesAsync($ResourceGroupName, $Location, $Name, $Pool)

Write-Verbose -Message "Waiting for the operation to complete."

$PSSwaggerJobScriptBlock = {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[System.Threading.Tasks.Task]
$TaskResult,

[Parameter(Mandatory = $true)]
[string]
$TaskHelperFilePath
)
if ($TaskResult) {
. $TaskHelperFilePath
$GetTaskResult_params = @{
TaskResult = $TaskResult
}
}
$Pool = New-IpPoolObject @utilityCmdParams

Write-Verbose -Message 'Performing operation CreateOrUpdateWithHttpMessagesAsync on $FabricAdminClient.'
$TaskResult = $FabricAdminClient.IpPools.CreateOrUpdateWithHttpMessagesAsync($ResourceGroupName, $Location, $Name, $Pool)

Write-Verbose -Message "Waiting for the operation to complete."

$PSSwaggerJobScriptBlock = {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[System.Threading.Tasks.Task]
$TaskResult,

[Parameter(Mandatory = $true)]
[string]
$TaskHelperFilePath
)
if ($TaskResult) {
. $TaskHelperFilePath
$GetTaskResult_params = @{
TaskResult = $TaskResult
}

Get-TaskResult @GetTaskResult_params
Get-TaskResult @GetTaskResult_params

}
}
}

$PSCommonParameters = Get-PSCommonParameter -CallerPSBoundParameters $PSBoundParameters
$TaskHelperFilePath = Join-Path -Path $ExecutionContext.SessionState.Module.ModuleBase -ChildPath 'Get-TaskResult.ps1'
if (-not $AsJob.IsPresent) {
Invoke-Command -ScriptBlock $PSSwaggerJobScriptBlock `
-ArgumentList $TaskResult, $TaskHelperFilePath `
@PSCommonParameters
} else {
$ScriptBlockParameters = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]'
$ScriptBlockParameters['TaskResult'] = $TaskResult
$ScriptBlockParameters['AsJob'] = $true
$ScriptBlockParameters['TaskHelperFilePath'] = $TaskHelperFilePath
$PSCommonParameters.GetEnumerator() | ForEach-Object { $ScriptBlockParameters[$_.Name] = $_.Value }

Start-PSSwaggerJobHelper -ScriptBlock $PSSwaggerJobScriptBlock `
-CallerPSBoundParameters $ScriptBlockParameters `
-CallerPSCmdlet $PSCmdlet `
@PSCommonParameters
}
$PSCommonParameters = Get-PSCommonParameter -CallerPSBoundParameters $PSBoundParameters
$TaskHelperFilePath = Join-Path -Path $ExecutionContext.SessionState.Module.ModuleBase -ChildPath 'Get-TaskResult.ps1'
if (-not $AsJob.IsPresent) {
Invoke-Command -ScriptBlock $PSSwaggerJobScriptBlock `
-ArgumentList $TaskResult, $TaskHelperFilePath `
@PSCommonParameters
} else {
$ScriptBlockParameters = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]'
$ScriptBlockParameters['TaskResult'] = $TaskResult
$ScriptBlockParameters['AsJob'] = $true
$ScriptBlockParameters['TaskHelperFilePath'] = $TaskHelperFilePath
$PSCommonParameters.GetEnumerator() | ForEach-Object { $ScriptBlockParameters[$_.Name] = $_.Value }

Start-PSSwaggerJobHelper -ScriptBlock $PSSwaggerJobScriptBlock `
-CallerPSBoundParameters $ScriptBlockParameters `
-CallerPSCmdlet $PSCmdlet `
@PSCommonParameters
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Licensed under the MIT License. See License.txt in the project root for license
#>
function New-AzsNetworkQuota {
[OutputType([Microsoft.AzureStack.Management.Network.Admin.Models.Quota])]
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
Expand Down Expand Up @@ -114,49 +113,47 @@ function New-AzsNetworkQuota {

$ErrorActionPreference = 'Stop'

if ($PSCmdlet.ShouldProcess("$Name" , "Create new network quota")) {
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Create new network quota?", "Performing operation create network quota with $Name."))) {
if (($Force.IsPresent -or $PSCmdlet.ShouldContinue("Create new network quota?", "Performing operation create network quota with $Name."))) {

$NewServiceClient_params = @{
FullClientTypeName = 'Microsoft.AzureStack.Management.Network.Admin.NetworkAdminClient'
}
$NewServiceClient_params = @{
FullClientTypeName = 'Microsoft.AzureStack.Management.Network.Admin.NetworkAdminClient'
}

$GlobalParameterHashtable = @{}
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable
$GlobalParameterHashtable = @{}
$NewServiceClient_params['GlobalParameterHashtable'] = $GlobalParameterHashtable

$GlobalParameterHashtable['SubscriptionId'] = $null
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
}
$GlobalParameterHashtable['SubscriptionId'] = $null
if ($PSBoundParameters.ContainsKey('SubscriptionId')) {
$GlobalParameterHashtable['SubscriptionId'] = $PSBoundParameters['SubscriptionId']
}

$NetworkAdminClient = New-ServiceClient @NewServiceClient_params
$NetworkAdminClient = New-ServiceClient @NewServiceClient_params

if ([String]::IsNullOrEmpty($Location)) {
$Location = (Get-AzureRMLocation).Location
}
if ([String]::IsNullOrEmpty($Location)) {
$Location = (Get-AzureRMLocation).Location
}

# Create object
$flattenedParameters = @(
'MaxNicsPerSubscription', 'MaxPublicIpsPerSubscription',
'MaxVirtualNetworkGatewayConnectionsPerSubscription', 'MaxVnetsPerSubscription',
'MaxVirtualNetworkGatewaysPerSubscription', 'MaxSecurityGroupsPerSubscription',
'MaxLoadBalancersPerSubscription', 'MigrationPhase'
)
$utilityCmdParams = @{}
$flattenedParameters | ForEach-Object {
$utilityCmdParams[$_] = Get-Variable -Name $_ -ValueOnly
}
$Quota = New-QuotaObject @utilityCmdParams
# Create object
$flattenedParameters = @(
'MaxNicsPerSubscription', 'MaxPublicIpsPerSubscription',
'MaxVirtualNetworkGatewayConnectionsPerSubscription', 'MaxVnetsPerSubscription',
'MaxVirtualNetworkGatewaysPerSubscription', 'MaxSecurityGroupsPerSubscription',
'MaxLoadBalancersPerSubscription', 'MigrationPhase'
)
$utilityCmdParams = @{}
$flattenedParameters | ForEach-Object {
$utilityCmdParams[$_] = Get-Variable -Name $_ -ValueOnly
}
$Quota = New-QuotaObject @utilityCmdParams

Write-Verbose -Message 'Performing operation CreateOrUpdateWithHttpMessagesAsync on $NetworkAdminClient.'
$TaskResult = $NetworkAdminClient.Quotas.CreateOrUpdateWithHttpMessagesAsync($Location, $Name, $Quota)
Write-Verbose -Message 'Performing operation CreateOrUpdateWithHttpMessagesAsync on $NetworkAdminClient.'
$TaskResult = $NetworkAdminClient.Quotas.CreateOrUpdateWithHttpMessagesAsync($Location, $Name, $Quota)

if ($TaskResult) {
$GetTaskResult_params = @{
TaskResult = $TaskResult
}
Get-TaskResult @GetTaskResult_params
if ($TaskResult) {
$GetTaskResult_params = @{
TaskResult = $TaskResult
}
Get-TaskResult @GetTaskResult_params
}
}
}
Expand Down
Loading