Skip to content

Commit

Permalink
Migrate Storage from generation to main (Azure#26840)
Browse files Browse the repository at this point in the history
* Move Storage to main

* Update ChangeLog.md

---------

Co-authored-by: Yabo Hu <[email protected]>
  • Loading branch information
azure-powershell-bot and VeryEarly authored Dec 5, 2024
1 parent 31b4221 commit e7bc36e
Show file tree
Hide file tree
Showing 187 changed files with 5,783 additions and 1,118 deletions.
7 changes: 4 additions & 3 deletions src/Storage/Storage.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,18 @@ nested-object-to-string: true
identity-correction-for-post: true

directive:
- from: swagger-document
where: $.paths.["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/startAccountMigration"].post.operationId
transform: return "StartAccountMigration"
- remove-operation: StorageAccounts_Update
- where:
subject: ^StorageAccountCustomerInitiatedMigration$
set:
subject: StorageAccountMigration
- where:
verb: Invoke
subject: ^CustomerStorageAccountInitiatedMigration$
set:
verb: Start
subject: AccountMigration
hide: true
- where:
variant: ^Customer$|^CustomerViaIdentity$
remove: true
Expand Down
7 changes: 4 additions & 3 deletions src/Storage/Storage.Autorest/build-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ if(-not $NotIsolated -and -not $Debugger) {
$binFolder = Join-Path $PSScriptRoot 'bin'
$objFolder = Join-Path $PSScriptRoot 'obj'

$isAzure = [System.Convert]::ToBoolean('true')

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

Expand Down Expand Up @@ -186,5 +188,4 @@ if (-not $DisableAfterBuildTasks){
}
}


Write-Host -ForegroundColor Green '-------------Done-------------'
Write-Host -ForegroundColor Green '-------------Done-------------'
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
# ----------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Account Migration request can be triggered for a storage account to change its redundancy level.
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.
Zone-redundant storage (ZRS) replicates your storage account synchronously across three Azure availability zones in the primary region.
.Description
Account Migration request can be triggered for a storage account to change its redundancy level.
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.
Zone-redundant storage (ZRS) replicates your storage account synchronously across three Azure availability zones in the primary region.
.Example
Start-AzStorageAccountMigration -AccountName myaccount -ResourceGroupName myresourcegroup -TargetSku Standard_LRS -Name migration1 -AsJob
.Example
Get-AzStorageAccount -ResourceGroupName myresourcegroup -Name myaccount | Start-AzStorageAccountMigration -TargetSku Standard_LRS -AsJob
.Example
$properties = '{
"properties": {
"targetSkuName": "Standard_ZRS"
}
}'
Start-AzStorageAccountMigration -ResourceGroupName myresourcegroup -AccountName myaccount -JsonString $properties -AsJob
.Example
# Before executing the cmdlet, make sure you have a json file that contains {"properties": {"targetSkuName": <TargetSKU>}}
Start-AzStorageAccountMigration -ResourceGroupName myresourcegroup -AccountName myaccount -JsonFilePath properties.json -AsJob
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity
.Outputs
System.Boolean
.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 <IStorageIdentity>: Identity Parameter
[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.
[BlobInventoryPolicyName <String>]: The name of the storage account blob inventory policy. It should always be 'default'
[DeletedAccountName <String>]: Name of the deleted storage account.
[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.
[Id <String>]: Resource identity path
[Location <String>]: The location of the deleted storage account.
[ManagementPolicyName <String>]: The name of the Storage Account Management Policy. It should always be 'default'
[MigrationName <String>]: The name of the Storage Account Migration. It should always be 'default'
[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.
[PrivateEndpointConnectionName <String>]: The name of the private endpoint connection associated with the Azure resource
[ResourceGroupName <String>]: The name of the resource group within the user's subscription. The name is case insensitive.
[SubscriptionId <String>]: The ID of the target subscription.
[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.
.Link
https://learn.microsoft.com/powershell/module/az.storage/start-azstorageaccountmigration
#>
function Start-AzStorageAccountMigration {
[OutputType([System.Boolean])]
[CmdletBinding(DefaultParameterSetName='CustomerExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
[System.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.
${AccountName},

[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
[System.String]
# The name of the resource group within the user's subscription.
# The name is case insensitive.
${ResourceGroupName},

[Parameter(ParameterSetName='CustomerExpanded')]
[Parameter(ParameterSetName='CustomerViaJsonFilePath')]
[Parameter(ParameterSetName='CustomerViaJsonString')]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# The ID of the target subscription.
${SubscriptionId},

[Parameter(ParameterSetName='CustomerViaIdentityExpanded', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity]
# Identity Parameter
${InputObject},

[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
[Parameter(ParameterSetName='CustomerViaIdentityExpanded', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.PSArgumentCompleterAttribute("Standard_LRS", "Standard_GRS", "Standard_RAGRS", "Standard_ZRS", "Premium_LRS", "Premium_ZRS", "Standard_GZRS", "Standard_RAGZRS")]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# Target sku name for the account
${TargetSku},

[Parameter(ParameterSetName='CustomerExpanded')]
[Parameter(ParameterSetName='CustomerViaIdentityExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# current value is 'default' for customer initiated migration
${Name},

[Parameter(ParameterSetName='CustomerExpanded')]
[Parameter(ParameterSetName='CustomerViaIdentityExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# SrpAccountMigrationType in ARM contract which is 'accountMigrations'
${Type},

[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# Path of Json file supplied to the Customer operation
${JsonFilePath},

[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# Json string supplied to the Customer operation
${JsonString},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Azure')]
[System.Management.Automation.PSObject]
# The DefaultProfile parameter is not functional.
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
${DefaultProfile},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command as a job
${AsJob},

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

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

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

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Run the command asynchronously
${NoWait},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Returns true when the command succeeds
${PassThru},

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

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

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

process {
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.")
Az.Storage.internal\Start-AzStorageAccountMigration @PSBoundParameters
}
}
28 changes: 14 additions & 14 deletions src/Storage/Storage.Autorest/exports/ProxyCmdletDefinitions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -271,26 +271,26 @@ function Start-AzStorageAccountMigration {
[CmdletBinding(DefaultParameterSetName='CustomerExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
[System.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.
${AccountName},

[Parameter(ParameterSetName='CustomerExpanded', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
[System.String]
# The name of the resource group within the user's subscription.
# The name is case insensitive.
${ResourceGroupName},

[Parameter(ParameterSetName='CustomerExpanded')]
[Parameter(ParameterSetName='CustomerViaJsonFilePath')]
[Parameter(ParameterSetName='CustomerViaJsonString')]
[Parameter(ParameterSetName='CustomerViaJsonFilePath')]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
Expand Down Expand Up @@ -325,18 +325,18 @@ param(
# SrpAccountMigrationType in ARM contract which is 'accountMigrations'
${Type},

[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# Path of Json file supplied to the Customer operation
${JsonFilePath},

[Parameter(ParameterSetName='CustomerViaJsonString', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# Json string supplied to the Customer operation
${JsonString},

[Parameter(ParameterSetName='CustomerViaJsonFilePath', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Body')]
[System.String]
# Path of Json file supplied to the Customer operation
${JsonFilePath},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
Expand Down Expand Up @@ -430,12 +430,12 @@ begin {
}

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

0 comments on commit e7bc36e

Please sign in to comment.