Skip to content

Commit e7bc36e

Browse files
Migrate Storage from generation to main (Azure#26840)
* Move Storage to main * Update ChangeLog.md --------- Co-authored-by: Yabo Hu <[email protected]>
1 parent 31b4221 commit e7bc36e

File tree

187 files changed

+5783
-1118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+5783
-1118
lines changed

src/Storage/Storage.Autorest/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@ nested-object-to-string: true
4444
identity-correction-for-post: true
4545

4646
directive:
47+
- from: swagger-document
48+
where: $.paths.["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/startAccountMigration"].post.operationId
49+
transform: return "StartAccountMigration"
4750
- remove-operation: StorageAccounts_Update
4851
- where:
4952
subject: ^StorageAccountCustomerInitiatedMigration$
5053
set:
5154
subject: StorageAccountMigration
5255
- where:
53-
verb: Invoke
54-
subject: ^CustomerStorageAccountInitiatedMigration$
55-
set:
5656
verb: Start
5757
subject: AccountMigration
58+
hide: true
5859
- where:
5960
variant: ^Customer$|^CustomerViaIdentity$
6061
remove: true

src/Storage/Storage.Autorest/build-module.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ if(-not $NotIsolated -and -not $Debugger) {
7575
$binFolder = Join-Path $PSScriptRoot 'bin'
7676
$objFolder = Join-Path $PSScriptRoot 'obj'
7777

78+
$isAzure = [System.Convert]::ToBoolean('true')
79+
7880
if(-not $Debugger) {
7981
Write-Host -ForegroundColor Green 'Cleaning build folders...'
8082
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder
@@ -151,7 +153,7 @@ if($NoDocs) {
151153
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
152154
}
153155
$null = New-Item -ItemType Directory -Force -Path $docsFolder
154-
$addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true')
156+
$addComplexInterfaceInfo = !$isAzure
155157
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo
156158
}
157159

@@ -186,5 +188,4 @@ if (-not $DisableAfterBuildTasks){
186188
}
187189
}
188190

189-
190-
Write-Host -ForegroundColor Green '-------------Done-------------'
191+
Write-Host -ForegroundColor Green '-------------Done-------------'
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# ----------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
13+
# is regenerated.
14+
# ----------------------------------------------------------------------------------
15+
16+
<#
17+
.Synopsis
18+
Account Migration request can be triggered for a storage account to change its redundancy level.
19+
The migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa in order to have better reliability and availability.
20+
Zone-redundant storage (ZRS) replicates your storage account synchronously across three Azure availability zones in the primary region.
21+
.Description
22+
Account Migration request can be triggered for a storage account to change its redundancy level.
23+
The migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa in order to have better reliability and availability.
24+
Zone-redundant storage (ZRS) replicates your storage account synchronously across three Azure availability zones in the primary region.
25+
.Example
26+
Start-AzStorageAccountMigration -AccountName myaccount -ResourceGroupName myresourcegroup -TargetSku Standard_LRS -Name migration1 -AsJob
27+
.Example
28+
Get-AzStorageAccount -ResourceGroupName myresourcegroup -Name myaccount | Start-AzStorageAccountMigration -TargetSku Standard_LRS -AsJob
29+
.Example
30+
$properties = '{
31+
"properties": {
32+
"targetSkuName": "Standard_ZRS"
33+
}
34+
}'
35+
Start-AzStorageAccountMigration -ResourceGroupName myresourcegroup -AccountName myaccount -JsonString $properties -AsJob
36+
.Example
37+
# Before executing the cmdlet, make sure you have a json file that contains {"properties": {"targetSkuName": <TargetSKU>}}
38+
Start-AzStorageAccountMigration -ResourceGroupName myresourcegroup -AccountName myaccount -JsonFilePath properties.json -AsJob
39+
40+
.Inputs
41+
Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity
42+
.Outputs
43+
System.Boolean
44+
.Notes
45+
COMPLEX PARAMETER PROPERTIES
46+
47+
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.
48+
49+
INPUTOBJECT <IStorageIdentity>: Identity Parameter
50+
[AccountName <String>]: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
51+
[BlobInventoryPolicyName <String>]: The name of the storage account blob inventory policy. It should always be 'default'
52+
[DeletedAccountName <String>]: Name of the deleted storage account.
53+
[EncryptionScopeName <String>]: The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
54+
[Id <String>]: Resource identity path
55+
[Location <String>]: The location of the deleted storage account.
56+
[ManagementPolicyName <String>]: The name of the Storage Account Management Policy. It should always be 'default'
57+
[MigrationName <String>]: The name of the Storage Account Migration. It should always be 'default'
58+
[ObjectReplicationPolicyId <String>]: For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file.
59+
[PrivateEndpointConnectionName <String>]: The name of the private endpoint connection associated with the Azure resource
60+
[ResourceGroupName <String>]: The name of the resource group within the user's subscription. The name is case insensitive.
61+
[SubscriptionId <String>]: The ID of the target subscription.
62+
[Username <String>]: The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account.
63+
.Link
64+
https://learn.microsoft.com/powershell/module/az.storage/start-azstorageaccountmigration
65+
#>
66+
function Start-AzStorageAccountMigration {
67+
[OutputType([System.Boolean])]
68+
[CmdletBinding(DefaultParameterSetName='CustomerExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
69+
param(
70+
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
71+
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
72+
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
73+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
74+
[System.String]
75+
# The name of the storage account within the specified resource group.
76+
# Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
77+
${AccountName},
78+
79+
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
80+
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
81+
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
82+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
83+
[System.String]
84+
# The name of the resource group within the user's subscription.
85+
# The name is case insensitive.
86+
${ResourceGroupName},
87+
88+
[Parameter(ParameterSetName='CustomerExpanded')]
89+
[Parameter(ParameterSetName='CustomerViaJsonFilePath')]
90+
[Parameter(ParameterSetName='CustomerViaJsonString')]
91+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
92+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
93+
[System.String]
94+
# The ID of the target subscription.
95+
${SubscriptionId},
96+
97+
[Parameter(ParameterSetName='CustomerViaIdentityExpanded', Mandatory, ValueFromPipeline)]
98+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
99+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity]
100+
# Identity Parameter
101+
${InputObject},
102+
103+
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
104+
[Parameter(ParameterSetName='CustomerViaIdentityExpanded', Mandatory)]
105+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.PSArgumentCompleterAttribute("Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS")]
106+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
107+
[System.String]
108+
# Target sku name for the account
109+
${TargetSku},
110+
111+
[Parameter(ParameterSetName='CustomerExpanded')]
112+
[Parameter(ParameterSetName='CustomerViaIdentityExpanded')]
113+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
114+
[System.String]
115+
# current value is 'default' for customer initiated migration
116+
${Name},
117+
118+
[Parameter(ParameterSetName='CustomerExpanded')]
119+
[Parameter(ParameterSetName='CustomerViaIdentityExpanded')]
120+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
121+
[System.String]
122+
# SrpAccountMigrationType in ARM contract which is 'accountMigrations'
123+
${Type},
124+
125+
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
126+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
127+
[System.String]
128+
# Path of Json file supplied to the Customer operation
129+
${JsonFilePath},
130+
131+
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
132+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
133+
[System.String]
134+
# Json string supplied to the Customer operation
135+
${JsonString},
136+
137+
[Parameter()]
138+
[Alias('AzureRMContext', 'AzureCredential')]
139+
[ValidateNotNull()]
140+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Azure')]
141+
[System.Management.Automation.PSObject]
142+
# The DefaultProfile parameter is not functional.
143+
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
144+
${DefaultProfile},
145+
146+
[Parameter()]
147+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
148+
[System.Management.Automation.SwitchParameter]
149+
# Run the command as a job
150+
${AsJob},
151+
152+
[Parameter(DontShow)]
153+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
154+
[System.Management.Automation.SwitchParameter]
155+
# Wait for .NET debugger to attach
156+
${Break},
157+
158+
[Parameter(DontShow)]
159+
[ValidateNotNull()]
160+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
161+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.SendAsyncStep[]]
162+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
163+
${HttpPipelineAppend},
164+
165+
[Parameter(DontShow)]
166+
[ValidateNotNull()]
167+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
168+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.SendAsyncStep[]]
169+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
170+
${HttpPipelinePrepend},
171+
172+
[Parameter()]
173+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
174+
[System.Management.Automation.SwitchParameter]
175+
# Run the command asynchronously
176+
${NoWait},
177+
178+
[Parameter()]
179+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
180+
[System.Management.Automation.SwitchParameter]
181+
# Returns true when the command succeeds
182+
${PassThru},
183+
184+
[Parameter(DontShow)]
185+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
186+
[System.Uri]
187+
# The URI for the proxy server to use
188+
${Proxy},
189+
190+
[Parameter(DontShow)]
191+
[ValidateNotNull()]
192+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
193+
[System.Management.Automation.PSCredential]
194+
# Credentials for a proxy server to use for the remote call
195+
${ProxyCredential},
196+
197+
[Parameter(DontShow)]
198+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
199+
[System.Management.Automation.SwitchParameter]
200+
# Use the default credentials for the proxy
201+
${ProxyUseDefaultCredentials}
202+
)
203+
204+
process {
205+
Write-Warning("After your request to convert the account’s redundancy configuration is validated, the conversion will typically complete in a few days, but can take a few weeks depending on current resource demands in the region, account size, and other factors. The conversion can’t be stopped after being initiated, and for accounts with geo redundancy a failover can’t be initiated while conversion is in progress. The data within the storage account will continue to be accessible with no loss of durability or availability.")
206+
Az.Storage.internal\Start-AzStorageAccountMigration @PSBoundParameters
207+
}
208+
}

src/Storage/Storage.Autorest/exports/ProxyCmdletDefinitions.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -271,26 +271,26 @@ function Start-AzStorageAccountMigration {
271271
[CmdletBinding(DefaultParameterSetName='CustomerExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
272272
param(
273273
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
274-
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
275274
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
275+
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
276276
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
277277
[System.String]
278278
# The name of the storage account within the specified resource group.
279279
# Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
280280
${AccountName},
281281

282282
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
283-
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
284283
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
284+
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
285285
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
286286
[System.String]
287287
# The name of the resource group within the user's subscription.
288288
# The name is case insensitive.
289289
${ResourceGroupName},
290290

291291
[Parameter(ParameterSetName='CustomerExpanded')]
292-
[Parameter(ParameterSetName='CustomerViaJsonFilePath')]
293292
[Parameter(ParameterSetName='CustomerViaJsonString')]
293+
[Parameter(ParameterSetName='CustomerViaJsonFilePath')]
294294
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
295295
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
296296
[System.String]
@@ -325,18 +325,18 @@ param(
325325
# SrpAccountMigrationType in ARM contract which is 'accountMigrations'
326326
${Type},
327327

328-
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
329-
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
330-
[System.String]
331-
# Path of Json file supplied to the Customer operation
332-
${JsonFilePath},
333-
334328
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
335329
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
336330
[System.String]
337331
# Json string supplied to the Customer operation
338332
${JsonString},
339333

334+
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
335+
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
336+
[System.String]
337+
# Path of Json file supplied to the Customer operation
338+
${JsonFilePath},
339+
340340
[Parameter()]
341341
[Alias('AzureRMContext', 'AzureCredential')]
342342
[ValidateNotNull()]
@@ -430,12 +430,12 @@ begin {
430430
}
431431

432432
$mapping = @{
433-
CustomerExpanded = 'Az.Storage.private\Start-AzStorageAccountMigration_CustomerExpanded';
434-
CustomerViaIdentityExpanded = 'Az.Storage.private\Start-AzStorageAccountMigration_CustomerViaIdentityExpanded';
435-
CustomerViaJsonFilePath = 'Az.Storage.private\Start-AzStorageAccountMigration_CustomerViaJsonFilePath';
436-
CustomerViaJsonString = 'Az.Storage.private\Start-AzStorageAccountMigration_CustomerViaJsonString';
433+
CustomerExpanded = 'Az.Storage.custom\Start-AzStorageAccountMigration';
434+
CustomerViaJsonString = 'Az.Storage.custom\Start-AzStorageAccountMigration';
435+
CustomerViaJsonFilePath = 'Az.Storage.custom\Start-AzStorageAccountMigration';
436+
CustomerViaIdentityExpanded = 'Az.Storage.custom\Start-AzStorageAccountMigration';
437437
}
438-
if (('CustomerExpanded', 'CustomerViaJsonFilePath', 'CustomerViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
438+
if (('CustomerExpanded', 'CustomerViaJsonString', 'CustomerViaJsonFilePath') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
439439
$testPlayback = $false
440440
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
441441
if ($testPlayback) {

0 commit comments

Comments
 (0)