Skip to content

Commit

Permalink
Merge pull request Azure#32 from zyxyoshine/SRPAdmin
Browse files Browse the repository at this point in the history
[Azs.Storage.Admin] Update customization, docs, examples, tests and recording
  • Loading branch information
bganapa authored Feb 14, 2020
2 parents 6e8a836 + 917a6e8 commit b377e26
Show file tree
Hide file tree
Showing 50 changed files with 8,241 additions and 4 deletions.
136 changes: 136 additions & 0 deletions src/Azs.Storage.Admin/custom/Get-AzsStorageQuota.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
<#
.Synopsis
Returns the specified storage quota.
.Description
Returns the specified storage quota.
.Example
To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/azs.storage.admin/get-azsstoragequota
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.IStorageAdminIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.Api201908Preview.IStorageQuota
.Notes
COMPLEX PARAMETER PROPERTIES
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
INPUTOBJECT <IStorageAdminIdentity>: Identity Parameter
[AccountId <String>]: Internal storage account ID, which is not visible to tenant.
[AsyncOperationId <String>]: Async Operation Id.
[Id <String>]: Resource identity path
[Location <String>]: Resource location.
[QuotaName <String>]: The name of the storage quota.
[ResourceGroup <String>]: Resource group name.
[ServiceName <String>]: Storage service name.
[SubscriptionId <String>]: Subscription Id.
.Link
https://docs.microsoft.com/en-us/powershell/module/azs.storage.admin/get-azsstoragequota
#>
function Get-AzsStorageQuota {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.Api201908Preview.IStorageQuota])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Get')]
[Parameter(ParameterSetName='List')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.DefaultInfo(Script='(Get-AzLocation)[0].Location')]
[System.String]
# Resource location.
${Location},

[Parameter(ParameterSetName='Get', Mandatory)]
[Alias('QuotaName')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Path')]
[System.String]
# The name of the storage quota.
${Name},

[Parameter(ParameterSetName='Get')]
[Parameter(ParameterSetName='List')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String[]]
# Subscription Id.
${SubscriptionId},

[Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.IStorageAdminIdentity]
# Identity Parameter
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
${DefaultProfile},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
)

process {
# Generated cmdlet does not support {prefix}/{name} for quota name, so extract the {name} part here
if ($PSBoundParameters.ContainsKey('Name'))
{
if ($null -ne $Name -and $Name.Contains('/'))
{
$PSBoundParameters['Name'] = $Name.Split("/")[-1]
}
}

Azs.Storage.Admin.internal\Get-AzsStorageQuota @PSBoundParameters
}
}
142 changes: 142 additions & 0 deletions src/Azs.Storage.Admin/custom/New-AzsStorageQuota.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
<#
.Synopsis
Create or update an existing storage quota.
.Description
Create or update an existing storage quota.
.Example
To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/azs.storage.admin/new-azsstoragequota
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.Api201908Preview.IStorageQuota
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.Api201908Preview.IStorageQuota
.Notes
COMPLEX PARAMETER PROPERTIES
To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
QUOTAOBJECT <IStorageQuota>: Storage quota.
[CapacityInGb <Int32?>]: Maximum capacity (GB).
[NumberOfStorageAccount <Int32?>]: Total number of storage accounts.
.Link
https://docs.microsoft.com/en-us/powershell/module/azs.storage.admin/new-azsstoragequota
#>
function New-AzsStorageQuota {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.Api201908Preview.IStorageQuota])]
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(Mandatory)]
[Alias('QuotaName')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Path')]
[System.String]
# The name of the storage quota.
${Name},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.DefaultInfo(Script='(Get-AzLocation)[0].Location')]
[System.String]
# Resource location.
${Location},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# Subscription Id.
${SubscriptionId},

[Parameter(ParameterSetName='Create', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Models.Api201908Preview.IStorageQuota]
# Storage quota.
# To construct, see NOTES section for QUOTAOBJECT properties and create a hash table.
${QuotaObject},

[Parameter(ParameterSetName='CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.DefaultInfo(Script='500')]
[System.Int32]
# Maximum capacity (GB).
${CapacityInGb},

[Parameter(ParameterSetName='CreateExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.DefaultInfo(Script='20')]
[System.Int32]
# Total number of storage accounts.
${NumberOfStorageAccounts},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
${DefaultProfile},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.StorageAdmin.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
)

process {
# Generated cmdlet does not support {prefix}/{name} for quota name, so extract the {name} part here
if ($PSBoundParameters.ContainsKey('Name'))
{
if ($null -ne $Name -and $Name.Contains('/'))
{
$PSBoundParameters['Name'] = $Name.Split("/")[-1]
}
}

Azs.Storage.Admin.internal\New-AzsStorageQuota @PSBoundParameters
}
}
Loading

0 comments on commit b377e26

Please sign in to comment.