Skip to content

Commit 6fc1be2

Browse files
Migrate ResourceMover from generation to main (#22748)
* Move ResourceMover to main * Update ChangeLog.md --------- Co-authored-by: Beisi Zhou <[email protected]>
1 parent cdab351 commit 6fc1be2

File tree

496 files changed

+10772
-8276
lines changed

Some content is hidden

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

496 files changed

+10772
-8276
lines changed

src/ResourceMover/Az.ResourceMover.format.ps1xml

Lines changed: 242 additions & 140 deletions
Large diffs are not rendered by default.

src/ResourceMover/Az.ResourceMover.psd1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 12/31/2021
6+
# Generated on: 9/7/2023
77
#
88

99
@{
@@ -119,9 +119,7 @@ PrivateData = @{
119119
# IconUri = ''
120120

121121
# ReleaseNotes of this module
122-
ReleaseNotes = '* Added support for Tags in azure resource mover
123-
* Added support for SystemData in azure resource mover
124-
* Released 2021-08-01 api-version'
122+
# ReleaseNotes = ''
125123

126124
# Prerelease string of this module
127125
# Prerelease = ''

src/ResourceMover/Az.ResourceMover.psm1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
}
2626
}
2727
if(-not $accountsModule) {
28-
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.2.3' } | Measure-Object).Count -gt 0
28+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'2.7.5' } | Measure-Object).Count -gt 0
2929
if($hasAdequateVersion) {
30-
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.2.3 -Scope Global -PassThru
30+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 2.7.5 -Scope Global -PassThru
3131
}
3232
}
3333
}
3434

3535
if(-not $accountsModule) {
36-
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37-
} elseif (($accountsModule.Version -lt [System.Version]'2.2.3') -and (-not $localAccounts)) {
38-
Write-Error "`nThis module requires $accountsName version 2.2.3 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
36+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
37+
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
38+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
3939
}
4040
Write-Information "Loaded Module '$($accountsModule.Name)'"
4141

@@ -50,6 +50,10 @@
5050

5151
# Tweaks the pipeline on module load
5252
$instance.OnModuleLoad = $VTable.OnModuleLoad
53+
54+
# Following two delegates are added for telemetry
55+
$instance.GetTelemetryId = $VTable.GetTelemetryId
56+
$instance.Telemetry = $VTable.Telemetry
5357

5458

5559
# Tweaks the pipeline per call

src/ResourceMover/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Upgraded API version to 2023-08-01.
22+
* Improved error reporting to the customer using custom cmdlets to handle the error in a better manner.
2123

2224
## Version 1.1.0
2325
* Added support for Tags in azure resource mover

src/ResourceMover/README.md

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This directory contains the PowerShell module for the ResourceMover service.
1717
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
1818

1919
## Module Requirements
20-
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.2.3 or greater
20+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
2121

2222
## Authentication
2323
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
@@ -54,13 +54,13 @@ title: ResourceMover
5454
service-name: ResourceMover
5555
prefix: Az
5656
subject-prefix: $(service-name)
57-
branch: master
57+
branch: bf2585e
5858
repo: https://github.com/Azure/azure-rest-api-specs/tree/$(branch)
5959
module-name: $(prefix).$(service-name)
6060
namespace: Microsoft.Azure.PowerShell.Cmdlets.$(service-name)
6161
clear-output-folder: true
6262
output-folder: .
63-
aks: $(repo)/specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01
63+
aks: $(repo)/specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2023-08-01
6464
input-file:
6565
- $(aks)/resourcemovercollection.json
6666
module-version: 1.0.0
@@ -132,7 +132,63 @@ directive:
132132
suppress-format: true
133133
- no-inline:
134134
- ResourceSettings
135-
- from: source-file-csharp
135+
- from: ResourceMover.cs
136136
where: $
137-
transform: $ = $.replace(/error = true;/g, '//error = true;');
137+
transform: $ = $.replace(/throw new Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Runtime.UndeclaredResponseException\(_response\);/g,"await onDefault\(_response,_response.Content.ReadAsStringAsync\(\).ContinueWith\( body => Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.CloudError.FromJson\(Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Runtime.Json.JsonNode.Parse\(body.Result\)\) \)\);");
138+
139+
- from: swagger-document
140+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}"].put
141+
transform: $["description"] = "Creates or updates a move collection. The following types of move collections based on the move scenario are supported currently:\<br>\<br>**1. RegionToRegion** (Moving resources across regions)\<br>\<br>**2. RegionToZone** (Moving virtual machines into a zone within the same region)"
142+
143+
- from: swagger-document
144+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}"].get
145+
transform: $["description"] = "Gets the move collection.\<br>\<br>**The 'Get-AzResourceMoverMoveCollection' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
146+
147+
- from: swagger-document
148+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}"].delete
149+
transform: $["description"] = "Deletes a move collection.\<br>\<br>**The 'Remove-AzResourceMoverMoveCollection' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
150+
151+
- from: swagger-document
152+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/prepare"].post
153+
transform: $["description"] = "Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true.\<br>\<br>**The 'Invoke-AzResourceMoverPrepare' command is not applicable on move collections with moveType 'RegionToZone' since prepare is not a valid operation for region to zone move scenario.**"
154+
155+
- from: swagger-document
156+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove"].post
157+
transform: $["description"] = "Moves the set of resources included in the request body.The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending.To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true.\<br>\<br>**The 'Invoke-AzResourceMoverInitiateMove' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
158+
159+
- from: swagger-document
160+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/commit"].post
161+
transform: $["description"] = "Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true.\<br>\<br>**The 'Invoke-AzResourceMoverCommit' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
162+
163+
- from: swagger-document
164+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/discard"].post
165+
transform: $["description"] = "Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true.\<br>\<br>**The 'Invoke-AzResourceMoverDiscard' command is not applicable on move collections with moveType 'RegionToZone' since discard is not a valid operation for region to zone move scenario.**"
166+
167+
- from: swagger-document
168+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/resolveDependencies"].post
169+
transform: $["description"] = "Computes, resolves and validate the dependencies of the moveResources in the move collection.\<br>\<br>**Please note that for 'RegionToRegion' type move collections the 'Resolve-AzResourceMoverMoveCollectionDependency' command just resolves the move collection, the user is required to identify the list of unresolved dependencies using 'Get-AzResourceMoverUnresolvedDependency' and then manually add them to the move collection using 'Add-AzResourceMoverMoveResource' command.**\<br>\<br>**However, for moveType 'RegionToZone' this command finds the required dependencies and automatically adds them to the move collection in a single step.**"
170+
171+
- from: swagger-document
172+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/unresolvedDependencies"].get
173+
transform: $["description"] = "Gets a list of unresolved dependencies.\<br>\<br>**The 'Get-AzResourceMoverUnresolvedDependency' command is applicable for 'RegionToRegion' type move collections.**\<br>\<br>**However, for move collections with moveType 'RegionToZone' dependencies are automatically added to the move collection once 'Resolve-AzResourceMoverMoveCollectionDependency' is executed. Please refer to 'Resolve-AzResourceMoverMoveCollectionDependency' command documentation for additional details.**"
174+
175+
- from: swagger-document
176+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove"].post
177+
transform: $["description"] = "Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true.\<br>\<br>**The 'Invoke-AzResourceMoverBulkRemove ' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
178+
179+
- from: swagger-document
180+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}"].put
181+
transform: $["description"] = "Creates or updates a Move Resource in the move collection.\<br>\<br>**The 'Add-AzResourceMoverMoveResource' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
182+
183+
- from: swagger-document
184+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}"].delete
185+
transform: $["description"] = "Deletes a Move Resource from the move collection.\<br>\<br>**The 'Remove-AzResourceMoverMoveResource' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
186+
187+
- from: swagger-document
188+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}"].get
189+
transform: $["description"] = "Gets the Move Resource.\<br>\<br>**The 'Get-AzResourceMoverMoveResource' command remains same for both 'RegionToRegion' and 'RegionToZone' type move collections.**"
190+
191+
- from: swagger-document
192+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/requiredFor"].get
193+
transform: $["description"] = "List of the move resources for which an arm resource is required for.\<br>\<br>**The 'Get-AzResourceMoverRequiredForResources' command is applicable for 'RegionToRegion' type move collections.\<br>\<br>However, for move collections with moveType 'RegionToZone' dependencies are automatically added to the move collection once 'Resolve-AzResourceMoverMoveCollectionDependency' is executed. Please refer to 'Resolve-AzResourceMoverMoveCollectionDependency' command documentation for additional details.**"
138194
```

0 commit comments

Comments
 (0)