Skip to content

Commit 8233c92

Browse files
committed
Migrate migrate module to autorest v4
1 parent e9a75c4 commit 8233c92

File tree

123 files changed

+1430
-700
lines changed

Some content is hidden

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

123 files changed

+1430
-700
lines changed

src/Migrate/Migrate.Autorest/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
[assembly: System.Reflection.AssemblyVersionAttribute("2.9.0")]
2525
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
2626
[assembly: System.CLSCompliantAttribute(false)]
27+

src/Migrate/Migrate.Autorest/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ module-version: 3.0.13
5858
title: Migrate
5959
subject-prefix: 'Migrate'
6060

61-
use-extension:
62-
"@autorest/powershell": "3.x"
63-
6461
directive:
6562
# Correct some swagger operationIds
6663
- from: Microsoft.OffAzure/stable/2020-01-01/migrate.json
@@ -516,3 +513,14 @@ directive:
516513
model-name: Fabric
517514
set:
518515
suppress-format: true
516+
517+
- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
518+
where:
519+
verb: Remove
520+
subject: VCenterVcenter
521+
remove: true
522+
- from: Microsoft.Migrate/preview/2018-09-01-preview/migrate.json
523+
where:
524+
verb: Update
525+
subject: ReplicationRecoveryServicesProvider|VCenter
526+
remove: true

src/Migrate/Migrate.Autorest/custom/Az.Migrate.custom.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# region Generated
22
# Load the private module dll
3-
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.Migrate.private.dll')
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Migrate.private.dll')
44

55
# Load the internal module
6-
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.Migrate.internal.psm1'
6+
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.Migrate.internal.psm1'
77
if(Test-Path $internalModulePath) {
88
$null = Import-Module -Name $internalModulePath
99
}

src/Migrate/Migrate.Autorest/custom/AzLocalDiskInput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33
using System;
44

5-
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901
5+
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models
66
{
77
public class AzLocalDiskInput
88
{

src/Migrate/Migrate.Autorest/custom/AzLocalNicInput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20240901
4+
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models
55
{
66
public class AzLocalNicInput
77
{

src/Migrate/Migrate.Autorest/custom/Get-AzMigrateDiscoveredServer.ps1

Lines changed: 78 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
# ----------------------------------------------------------------------------------
3-
#
4-
# Copyright Microsoft Corporation
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
54
# Licensed under the Apache License, Version 2.0 (the "License");
65
# you may not use this file except in compliance with the License.
76
# You may obtain a copy of the License at
@@ -11,78 +10,99 @@
1110
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1211
# See the License for the specific language governing permissions and
1312
# limitations under the License.
13+
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
14+
# is regenerated.
1415
# ----------------------------------------------------------------------------------
1516

1617
<#
1718
.Synopsis
1819
Get All discovered servers in a migrate project.
1920
.Description
2021
Get Azure migrate server commandlet fetches all servers in a migrate project.
22+
.Example
23+
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
24+
.Example
25+
Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
26+
.Example
27+
Get-AzMigrateDiscoveredServer -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
28+
.Example
29+
Get-AzMigrateDiscoveredServer -Name idclab-a360-fareast-corp-micros-86617dcf-effe-59ad-8c3a-cdd3ea7300d3_5029e62c-31d2-a6c3-5316-aa39f47c49fc -ApplianceName BBVMwareAVS -SubscriptionId xxx-xxx-xxx -ResourceGroupName julytest -ProjectName julytest
30+
.Example
31+
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -DisplayName Contoso | Format-Table DisplayName,Name,Type
32+
.Example
33+
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName BugBashAVSVMware -ProjectName BugBashAVSVMware -ApplianceName BBVMwareAVS -DisplayName Contoso | Format-Table DisplayName,Name,Type
34+
.Example
35+
Get-AzMigrateDiscoveredServer -SubscriptionId xxx-xxx-xxx -ResourceGroupName "test-rg" -ProjectName "testproj" -SourceMachineType "HyperV" | Format-Table DisplayName,Name,Type
36+
37+
.Outputs
38+
Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IHyperVMachine
39+
.Outputs
40+
Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IVMwareMachine
2141
.Link
2242
https://learn.microsoft.com/powershell/module/az.migrate/get-azmigratediscoveredserver
2343
#>
24-
2544
function Get-AzMigrateDiscoveredServer {
26-
[OutputType(
27-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IVMwareMachine],
28-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IHyperVMachine])]
29-
[CmdletBinding(DefaultParameterSetName = 'List', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
30-
param (
31-
[Parameter(Mandatory)]
32-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
33-
[System.String]
34-
# Specifies the migrate project name.
35-
${ProjectName},
36-
37-
[Parameter(Mandatory)]
38-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
39-
[System.String]
40-
# Specifies the resource group name.
41-
${ResourceGroupName},
42-
43-
[Parameter(ParameterSetName = 'Get', Mandatory)]
44-
[Parameter(ParameterSetName = 'GetInSite', Mandatory)]
45-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
46-
[System.String]
47-
# Specifies the source machine name. This is an internal Name. For users, use display name.
48-
${Name},
49-
50-
[Parameter(ParameterSetName = 'List')]
51-
[Parameter(ParameterSetName = 'ListInSite')]
52-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
53-
[System.String]
54-
# Specifies the source machine display name.
55-
${DisplayName},
56-
57-
[Parameter(ParameterSetName = 'GetInSite', Mandatory)]
58-
[Parameter(ParameterSetName = 'ListInSite', Mandatory)]
59-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
60-
[System.String]
61-
# Specifies the appliance name. This internally maps to a site.
62-
${ApplianceName},
63-
64-
[Parameter()]
65-
[ValidateSet("VMware", "HyperV")]
66-
[ArgumentCompleter( { "VMware", "HyperV" })]
67-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
68-
[System.String]
69-
# Specifies the source machine type. Currently, only HyperV and VMware are supported.
70-
${SourceMachineType} = "VMware",
71-
72-
[Parameter()]
73-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
74-
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
75-
[System.String[]]
76-
# Specifies the subscription id.
77-
${SubscriptionId}
78-
)
79-
45+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IVMwareMachine], [Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.IHyperVMachine])]
46+
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
47+
param(
48+
[Parameter(Mandatory)]
49+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
50+
[System.String]
51+
# Specifies the migrate project name.
52+
${ProjectName},
53+
54+
[Parameter(Mandatory)]
55+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
56+
[System.String]
57+
# Specifies the resource group name.
58+
${ResourceGroupName},
59+
60+
[Parameter(ParameterSetName='List')]
61+
[Parameter(ParameterSetName='ListInSite')]
62+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
63+
[System.String]
64+
# Specifies the source machine display name.
65+
${DisplayName},
66+
67+
[Parameter()]
68+
[ValidateSet("VMware", "HyperV")]
69+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
70+
[System.String]
71+
# Specifies the source machine type.
72+
# Currently, only HyperV and VMware are supported.
73+
${SourceMachineType} = "VMware",
74+
75+
[Parameter()]
76+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
77+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
78+
[System.String[]]
79+
# Specifies the subscription id.
80+
${SubscriptionId},
81+
82+
[Parameter(ParameterSetName='GetInSite', Mandatory)]
83+
[Parameter(ParameterSetName='Get', Mandatory)]
84+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
85+
[System.String]
86+
# Specifies the source machine name.
87+
# This is an internal Name.
88+
# For users, use display name.
89+
${Name},
90+
91+
[Parameter(ParameterSetName='GetInSite', Mandatory)]
92+
[Parameter(ParameterSetName='ListInSite', Mandatory)]
93+
[Microsoft.Azure.PowerShell.Cmdlets.Migrate.Category('Path')]
94+
[System.String]
95+
# Specifies the appliance name.
96+
# This internally maps to a site.
97+
${ApplianceName}
98+
)
99+
80100
process {
81101
$parameterSet = $PSCmdlet.ParameterSetName
82102
$hasApplianceName = $PSBoundParameters.ContainsKey("ApplianceName")
83103

84104
$discoverySolutionName = "Servers-Discovery-ServerDiscovery"
85-
$discoverySolution = Az.Migrate\Get-AzMigrateSolution -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName
105+
$discoverySolution = Az.Migrate.private\Get-AzMigrateSolution_Get -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -MigrateProjectName $ProjectName -Name $discoverySolutionName
86106
if ($discoverySolution.Name -ne $discoverySolutionName)
87107
{
88108
throw "Server Discovery Solution not found."

0 commit comments

Comments
 (0)