Skip to content

Commit ec050fc

Browse files
author
Maddie Clayton
authored
Merge pull request #7075 from deathly809/Storage1.5.0
[Azure Stack][Admin] Storage for Azure Stack 1.5.0
2 parents d47ebfe + b25b813 commit ec050fc

33 files changed

+276
-139
lines changed

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Azs.Storage.Admin.psd1

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Licensed under the MIT License. See License.txt in the project root for license
1717
RootModule = 'Azs.Storage.Admin.psm1'
1818

1919
# Version number of this module.
20-
ModuleVersion = '0.1.1'
20+
ModuleVersion = '0.2.0'
2121

2222
# Supported PSEditions
2323
# CompatiblePSEditions = @()
@@ -38,7 +38,7 @@ Licensed under the MIT License. See License.txt in the project root for license
3838
Description = 'Storage Admin Client'
3939

4040
# Minimum version of the Windows PowerShell engine required by this module
41-
# PowerShellVersion = ''
41+
PowerShellVersion = '5.0'
4242

4343
# Name of the Windows PowerShell host required by this module
4444
# PowerShellHostName = ''
@@ -56,8 +56,8 @@ Licensed under the MIT License. See License.txt in the project root for license
5656
# ProcessorArchitecture = ''
5757

5858
# Modules that must be imported into the global environment prior to importing this module
59-
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; RequiredVersion = '3.4.1'; },
60-
@{ModuleName = 'AzureRM.Resources'; RequiredVersion = '4.4.1'; })
59+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.5.1'; },
60+
@{ModuleName = 'AzureRM.Resources'; ModuleVersion = '6.0.2'; })
6161

6262
# Assemblies that must be loaded prior to importing this module
6363
# RequiredAssemblies = @()
@@ -116,19 +116,43 @@ Licensed under the MIT License. See License.txt in the project root for license
116116
PSData = @{
117117

118118
# Tags applied to this module. These help with module discovery in online galleries.
119-
# Tags = @()
119+
Tags = @('AzureStack', 'Azure Stack', 'Admin', 'Storage', 'Azure Stack Storage', 'SRP')
120120

121121
# A URL to the license for this module.
122-
# LicenseUri = ''
122+
LicenseUri = 'https://aka.ms/azps-license'
123123

124124
# A URL to the main website for this project.
125-
# ProjectUri = ''
125+
ProjectUri = 'https://github.com/Azure/azure-powershell'
126126

127127
# A URL to an icon representing this module.
128128
# IconUri = ''
129129

130130
# ReleaseNotes of this module
131-
# ReleaseNotes = ''
131+
ReleaseNotes = '## 2018.8.12
132+
* Module dependencies updated
133+
* AzureRM.Profile
134+
* AzureRM.Resources
135+
* Support handling names of nested resources
136+
* Get-AzsStorageAccount
137+
* Get-AzsStorageContainer
138+
* Get-AzsStorageDestinationShare
139+
* Get-AzsStorageQuota
140+
* Get-AzsStorageShare
141+
* Get-AzsStorageShareMetric
142+
* Get-AzsStorageShareMetricDefinition
143+
* Remove-AzsStorageQuota
144+
* Restore-AzsStorageAccount
145+
* Set-AzsStorageQuota
146+
* Start-AzsStorageContainerMigration
147+
* Deprecations
148+
* Get-AzsStorageShare, the parameter ShareName is now an alias for Name
149+
* Get-AzsStorageShareMetric, the parameter ShareName is now an alias for Name
150+
* Get-AzsStorageShareMetricDefinition, the parameter ShareName is now an alias for Name
151+
* Start-AzsReclaimStorageCapacity, the parameter FarmName is now an alias for Name
152+
* Start-AzsStorageContainerMigration, the parameter ContainerName is now an alias for Name
153+
* Bug fixes
154+
* Handle ErrrorAction correctly now
155+
'
132156

133157
} # End of PSData hashtable
134158

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Azs.Storage.Admin.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ if (Test-Path -Path $ClrPath -PathType Container) {
2929
. (Join-Path -Path $PSScriptRoot -ChildPath 'Get-ApplicableFilters.ps1')
3030
. (Join-Path -Path $PSScriptRoot -ChildPath 'Test-FilteredResult.ps1')
3131
. (Join-Path -Path $PSScriptRoot -ChildPath 'Get-ArmResourceIdParameterValue.ps1')
32+
. (Join-Path -Path $PSScriptRoot -ChildPath 'Get-ResourceNameSuffix.ps1')
3233
$allPs1FilesPath = Join-Path -Path $PSScriptRoot -ChildPath 'Generated.PowerShell.Commands' | Join-Path -ChildPath '*.ps1'
3334
Get-ChildItem -Path $allPs1FilesPath -Recurse -File | ForEach-Object { . $_.FullName}

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsStorageAccount.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ function Get-AzsStorageAccount {
9696

9797
Process {
9898

99-
100-
10199
$NewServiceClient_params = @{
102100
FullClientTypeName = 'Microsoft.AzureStack.Management.Storage.Admin.StorageAdminClient'
103101
}
@@ -132,6 +130,7 @@ function Get-AzsStorageAccount {
132130
Write-Verbose -Message 'Performing operation ListWithHttpMessagesAsync on $StorageAdminClient.'
133131
$TaskResult = $StorageAdminClient.StorageAccounts.ListWithHttpMessagesAsync($ResourceGroupName, $FarmName, $Summary.IsPresent)
134132
} elseif ('Get' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
133+
$Name = Get-ResourceNameSuffix -ResourceName $Name
135134
Write-Verbose -Message 'Performing operation GetWithHttpMessagesAsync on $StorageAdminClient.'
136135
$TaskResult = $StorageAdminClient.StorageAccounts.GetWithHttpMessagesAsync($ResourceGroupName, $FarmName, $Name)
137136
} else {

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsStorageContainer.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function Get-AzsStorageContainer {
7171

7272
Process {
7373

74-
74+
$ShareName = Get-ResourceNameSuffix -ResourceName $ShareName
7575

7676
$NewServiceClient_params = @{
7777
FullClientTypeName = 'Microsoft.AzureStack.Management.Storage.Admin.StorageAdminClient'
@@ -98,9 +98,7 @@ function Get-AzsStorageContainer {
9898
$GetTaskResult_params = @{
9999
TaskResult = $TaskResult
100100
}
101-
102101
Get-TaskResult @GetTaskResult_params
103-
104102
}
105103
}
106104

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsStorageDestinationShare.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ function Get-AzsStorageDestinationShare {
5858

5959
Process {
6060

61+
$SourceShareName = Get-ResourceNameSuffix -Resourcename $SourceShareName
62+
6163

6264

6365
$NewServiceClient_params = @{

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsStorageQuota.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ function Get-AzsStorageQuota {
8080

8181
Process {
8282

83-
84-
8583
$NewServiceClient_params = @{
8684
FullClientTypeName = 'Microsoft.AzureStack.Management.Storage.Admin.StorageAdminClient'
8785
}
@@ -139,6 +137,7 @@ function Get-AzsStorageQuota {
139137
return
140138
}
141139
if ('Get' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
140+
$Name = Get-ResourceNameSuffix -ResourceName $Name
142141
Write-Verbose -Message 'Performing operation GetWithHttpMessagesAsync on $StorageAdminClient.'
143142
$TaskResult = $StorageAdminClient.StorageQuotas.GetWithHttpMessagesAsync($Location, $Name)
144143
} elseif ('List' -eq $PsCmdlet.ParameterSetName) {

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsStorageShare.ps1

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Licensed under the MIT License. See License.txt in the project root for license
1313
.PARAMETER ResourceGroupName
1414
Resource group name.
1515
16-
.PARAMETER ShareName
16+
.PARAMETER Name
1717
Share name.
1818
1919
.PARAMETER ResourceId
@@ -41,8 +41,9 @@ function Get-AzsStorageShare {
4141

4242
[Parameter(Mandatory = $true, ParameterSetName = 'Get')]
4343
[ValidateNotNullOrEmpty()]
44+
[Alias('ShareName')]
4445
[System.String]
45-
$ShareName,
46+
$Name,
4647

4748
[Parameter(Mandatory = $false, ParameterSetName = 'Get')]
4849
[Parameter(Mandatory = $false, ParameterSetName = 'List')]
@@ -69,7 +70,11 @@ function Get-AzsStorageShare {
6970

7071
Process {
7172

72-
73+
if ($PSBoundParameters.ContainsKey('Name')) {
74+
if ( $MyInvocation.Line -match "\s-ShareName\s") {
75+
Write-Warning -Message "The parameter alias ShareName will be deprecated in future release. Please use the parameter Name instead"
76+
}
77+
}
7378

7479
$NewServiceClient_params = @{
7580
FullClientTypeName = 'Microsoft.AzureStack.Management.Storage.Admin.StorageAdminClient'
@@ -87,24 +92,23 @@ function Get-AzsStorageShare {
8792

8893
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
8994
$GetArmResourceIdParameterValue_params = @{
90-
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.Storage.Admin/farms/{FarmName}/shares/{shareName}'
95+
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.Storage.Admin/farms/{FarmName}/shares/{ShareName}'
9196
}
9297

9398
$GetArmResourceIdParameterValue_params['Id'] = $ResourceId
9499
$ArmResourceIdParameterValues = Get-ArmResourceIdParameterValue @GetArmResourceIdParameterValue_params
95100
$ResourceGroupName = $ArmResourceIdParameterValues['resourceGroup']
96-
97101
$FarmName = $ArmResourceIdParameterValues['FarmName']
102+
$Name = $ArmResourceIdParameterValues['ShareName']
98103

99-
$ShareName = $ArmResourceIdParameterValues['shareName']
100104
} elseif ([System.String]::IsNullOrEmpty($ResourceGroupName)) {
101105
$ResourceGroupName = "System.$((Get-AzureRmLocation).Location)"
102106
}
103107

104108
$filterInfos = @(
105109
@{
106110
'Type' = 'powershellWildcard'
107-
'Value' = $ShareName
111+
'Value' = $Name
108112
'Property' = 'Name'
109113
})
110114
$applicableFilters = Get-ApplicableFilters -Filters $filterInfos
@@ -134,8 +138,9 @@ function Get-AzsStorageShare {
134138
Write-Verbose -Message 'Performing operation ListWithHttpMessagesAsync on $StorageAdminClient.'
135139
$TaskResult = $StorageAdminClient.Shares.ListWithHttpMessagesAsync($ResourceGroupName, $FarmName)
136140
} elseif ('Get' -eq $PsCmdlet.ParameterSetName -or 'ResourceId' -eq $PsCmdlet.ParameterSetName) {
141+
$Name = Get-ResourceNameSuffix -ResourceName $Name
137142
Write-Verbose -Message 'Performing operation GetWithHttpMessagesAsync on $StorageAdminClient.'
138-
$TaskResult = $StorageAdminClient.Shares.GetWithHttpMessagesAsync($ResourceGroupName, $FarmName, $ShareName)
143+
$TaskResult = $StorageAdminClient.Shares.GetWithHttpMessagesAsync($ResourceGroupName, $FarmName, $Name)
139144
} else {
140145
Write-Verbose -Message 'Failed to map parameter set to operation method.'
141146
throw 'Module failed to find operation to execute.'

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsStorageShareMetric.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Licensed under the MIT License. See License.txt in the project root for license
1616
.PARAMETER ResourceGroupName
1717
Resource group name.
1818
19-
.PARAMETER ShareName
19+
.PARAMETER Name
2020
Share name.
2121
2222
.PARAMETER FarmName
@@ -27,7 +27,7 @@ Licensed under the MIT License. See License.txt in the project root for license
2727
2828
.EXAMPLE
2929
30-
PS C:\> Get-AzsStorageShareMetric -FarmName f9b8e2e2-e4b4-44e0-9d92-6a848b1a5376 -ShareName "||SU1FileServer.azurestack.local|SU1_ObjStore"
30+
PS C:\> Get-AzsStorageShareMetric -FarmName f9b8e2e2-e4b4-44e0-9d92-6a848b1a5376 -Name "||SU1FileServer.azurestack.local|SU1_ObjStore"
3131
3232
Get the list of metrics for a storage share.
3333
#>
@@ -42,8 +42,9 @@ function Get-AzsStorageShareMetric {
4242

4343
[Parameter(Mandatory = $true)]
4444
[ValidateNotNullOrEmpty()]
45+
[Alias('ShareName')]
4546
[System.String]
46-
$ShareName,
47+
$Name,
4748

4849
[Parameter(Mandatory = $false)]
4950
[ValidateLength(1, 90)]
@@ -72,7 +73,13 @@ function Get-AzsStorageShareMetric {
7273

7374
Process {
7475

76+
if ($PSBoundParameters.ContainsKey('Name')) {
77+
if ( $MyInvocation.Line -match "\s-ShareName\s") {
78+
Write-Warning -Message "The parameter alias ShareName will be deprecated in future release. Please use the parameter Name instead"
79+
}
80+
}
7581

82+
$Name = Get-ResourceNameSuffix -ResourceName $Name
7683

7784
$NewServiceClient_params = @{
7885
FullClientTypeName = 'Microsoft.AzureStack.Management.Storage.Admin.StorageAdminClient'
@@ -93,7 +100,7 @@ function Get-AzsStorageShareMetric {
93100
}
94101

95102
Write-Verbose -Message 'Performing operation ListMetricsWithHttpMessagesAsync on $StorageAdminClient.'
96-
$TaskResult = $StorageAdminClient.Shares.ListMetricsWithHttpMessagesAsync($ResourceGroupName, $FarmName, $ShareName)
103+
$TaskResult = $StorageAdminClient.Shares.ListMetricsWithHttpMessagesAsync($ResourceGroupName, $FarmName, $Name)
97104

98105
if ($TaskResult) {
99106
$GetTaskResult_params = @{

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Get-AzsStorageShareMetricDefinition.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Licensed under the MIT License. See License.txt in the project root for license
1616
.PARAMETER ResourceGroupName
1717
Resource group name.
1818
19-
.PARAMETER ShareName
19+
.PARAMETER Name
2020
Share name.
2121
2222
.PARAMETER FarmName
@@ -27,7 +27,7 @@ Licensed under the MIT License. See License.txt in the project root for license
2727
2828
.EXAMPLE
2929
30-
PS C:\> Get-AzsStorageShareMetricDefinition -FarmName f9b8e2e2-e4b4-44e0-9d92-6a848b1a5376 -ShareName "||SU1FileServer.azurestack.local|SU1_ObjStore"
30+
PS C:\> Get-AzsStorageShareMetricDefinition -FarmName f9b8e2e2-e4b4-44e0-9d92-6a848b1a5376 -Name "||SU1FileServer.azurestack.local|SU1_ObjStore"
3131
3232
Get the list of metric definitions for a storage share.
3333
#>
@@ -42,8 +42,9 @@ function Get-AzsStorageShareMetricDefinition {
4242

4343
[Parameter(Mandatory = $true)]
4444
[ValidateNotNullOrEmpty()]
45+
[Alias('ShareName')]
4546
[System.String]
46-
$ShareName,
47+
$Name,
4748

4849
[Parameter(Mandatory = $false)]
4950
[ValidateLength(1, 90)]
@@ -72,7 +73,13 @@ function Get-AzsStorageShareMetricDefinition {
7273

7374
Process {
7475

76+
if ($PSBoundParameters.ContainsKey('Name')) {
77+
if ( $MyInvocation.Line -match "\s-ShareName\s") {
78+
Write-Warning -Message "The parameter alias ShareName will be deprecated in future release. Please use the parameter Name instead"
79+
}
80+
}
7581

82+
$Name = Get-ResourceNameSuffix -ResourceName $Name
7683

7784
$NewServiceClient_params = @{
7885
FullClientTypeName = 'Microsoft.AzureStack.Management.Storage.Admin.StorageAdminClient'
@@ -93,7 +100,7 @@ function Get-AzsStorageShareMetricDefinition {
93100
}
94101

95102
Write-Verbose -Message 'Performing operation ListMetricDefinitionsWithHttpMessagesAsync on $StorageAdminClient.'
96-
$TaskResult = $StorageAdminClient.Shares.ListMetricDefinitionsWithHttpMessagesAsync($ResourceGroupName, $FarmName, $ShareName)
103+
$TaskResult = $StorageAdminClient.Shares.ListMetricDefinitionsWithHttpMessagesAsync($ResourceGroupName, $FarmName, $Name)
97104

98105
if ($TaskResult) {
99106
$GetTaskResult_params = @{

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/New-AzsStorageQuota.ps1

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,9 @@ function New-AzsStorageQuota {
7373
}
7474

7575
# Validate this resource does not exist.
76-
$_objectCheck = $null
77-
try {
78-
Write-Verbose "Checking to see if storage quota already exists."
79-
$_objectCheck = Get-AzsStorageQuota -Name $Name -Location $Location
80-
} catch {
81-
# No op
82-
} finally {
83-
if ($_objectCheck -ne $null) {
84-
throw "A storage quota with name $Name at location $Location already exists."
85-
}
76+
if ($null -ne (Get-AzsStorageQuota -Name $Name -Location $Location -ErrorAction SilentlyContinue)) {
77+
Write-Error "A storage quota with the name $Name at location $location already exists"
78+
return
8679
}
8780

8881
$flattenedParameters = @('NumberOfStorageAccounts', 'CapacityInGb')

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Remove-AzsStorageQuota.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ function Remove-AzsStorageQuota {
7070

7171
Process {
7272

73-
74-
7573
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
7674
$GetArmResourceIdParameterValue_params = @{
7775
IdTemplate = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage.Admin/locations/{location}/quotas/{quotaName}'
@@ -81,6 +79,8 @@ function Remove-AzsStorageQuota {
8179
$location = $ArmResourceIdParameterValues['location']
8280

8381
$Name = $ArmResourceIdParameterValues['quotaName']
82+
} else {
83+
$Name = Get-ResourceNameSuffix -ResourceName $Name
8484
}
8585

8686
if ($PSCmdlet.ShouldProcess("$Name" , "Delete the storage quota")) {

src/StackAdmin/Azs.Storage.Admin/Module/Azs.Storage.Admin/Generated.PowerShell.Commands/SwaggerPathCommands/Restore-AzsStorageAccount.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ function Restore-AzsStorageAccount {
7474

7575
Process {
7676

77-
78-
7977
if ('ResourceId' -eq $PsCmdlet.ParameterSetName) {
8078
$GetArmResourceIdParameterValue_params = @{
8179
IdTemplate = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.Storage.Admin/farms/{FarmName}/storageaccounts/{accountId}'
@@ -87,6 +85,8 @@ function Restore-AzsStorageAccount {
8785

8886
$FarmName = $ArmResourceIdParameterValues['FarmName']
8987
$Name = $ArmResourceIdParameterValues['accountId']
88+
} else {
89+
$Name = Get-ResourceNameSuffix -ResourceName $Name
9090
}
9191

9292
# Should process

0 commit comments

Comments
 (0)