Skip to content

[PS] Migrate StorageMover module to autorest v4 #28333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 6 additions & 100 deletions src/StorageMover/StorageMover.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ module-version: 1.2.0
# Normally, title is the service name
title: StorageMover
subject-prefix: $(service-name)
nested-object-to-string: true
identity-correction-for-post: true

# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
use-extension:
"@autorest/powershell": "3.x"

directive:
- from: swagger-document
Expand All @@ -61,6 +55,9 @@ directive:
],
"default": 0
}
- where:
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))|^CreateViaIdentityExpanded$
remove: true
- where:
verb: Set
remove: true
Expand All @@ -70,7 +67,6 @@ directive:
suppress-format: true
- no-inline:
- EndpointBaseProperties
- no-inline:
- EndpointBaseUpdateProperties
# Rename Start-AzDataMoverJobDefinitionJob -> Start-AzDataMoverJobDefinition
- where:
Expand Down Expand Up @@ -101,18 +97,6 @@ directive:
verb: Remove
subject: Agent
hide: true
# Remove parameter sets Create and CreateViaIdentity
- where:
verb: New
subject: Endpoint
variant: ^Create$|^CreateViaIdentity$
remove: true
# Remove parameter set Update and UpdateViaIdentity
- where:
verb: Update
subject: Endpoint
variant: ^Update$|^UpdateViaIdentity$
remove: true
# Hide New-AzStorageMoverEndpoint
- where:
verb: New
Expand Down Expand Up @@ -150,92 +134,14 @@ directive:
property-name: Message
set:
property-name: ErrorMessage
- where:
verb: New
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
remove: true
# Delete the original ShouldProcess as a ShouldProcess and ShouldContinue are added in the custom cmdlets
- from: source-file-csharp
where: $
transform: $ = $.replace('ShouldProcess($\"Call remote \'StorageMoversDelete\' operation\")', 'true');
- from: source-file-csharp
where: $
transform: $ = $.replace('ShouldProcess($\"Call remote \'AgentsDelete\' operation\")', 'true');
- from: source-file-csharp
where: $
transform: $ = $.replace('public Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api30.ISystemData', 'private Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api30.ISystemData');

- where:
verb: Get|Update
subject: Agent
set:
breaking-change:
deprecated-output-properties:
- UploadLimitScheduleWeeklyRecurrence
new-output-properties:
- UploadLimitScheduleWeeklyRecurrence
change-description: The type of the property UploadLimitScheduleWeeklyRecurrence will be changed from fixed array to 'List'.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 15.0.0
change-effective-date: 2025/11/03
- where:
verb: New
subject: JobDefinition
variant: Create
set:
breaking-change:
change-description: The parameter set Create will be removed. Suggest to use CreateExpanded and CreateViaJsonString instead.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 15.0.0
change-effective-date: 2025/11/03
- where:
verb: New
subject: Project
variant: Create
set:
breaking-change:
change-description: The parameter set Create will be removed. Suggest to use CreateExpanded and CreateViaJsonString instead.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 15.0.0
change-effective-date: 2025/11/03
- where:
verb: Update
subject: StorageMover
variant: Update$|UpdateViaIdentity$
set:
breaking-change:
change-description: The parameter set Update and UpdateViaIdentity will be removed. Suggest to use UpdateExpanded, UpdateViaIdentityExpanded and UpdateViaJsonString instead.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 15.0.0
change-effective-date: 2025/11/03
- where:
verb: Update
subject: Agent
variant: Update$|UpdateViaIdentity$
set:
breaking-change:
change-description: The parameter set Update and UpdateViaIdentity will be removed. Suggest to use UpdateExpanded, UpdateViaIdentityExpanded and UpdateViaJsonString instead.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 15.0.0
change-effective-date: 2025/11/03
- where:
verb: Update
subject: JobDefinition
variant: Update$|UpdateViaIdentity$
set:
breaking-change:
change-description: The parameter set Update and UpdateViaIdentity will be removed. Suggest to use UpdateExpanded, UpdateViaIdentityExpanded and UpdateViaJsonString instead.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 15.0.0
change-effective-date: 2025/11/03
- where:
verb: Update
subject: Project
variant: Update$|UpdateViaIdentity$
set:
breaking-change:
change-description: The parameter set Update and UpdateViaIdentity will be removed. Suggest to use UpdateExpanded, UpdateViaIdentityExpanded and UpdateViaJsonString instead.
deprecated-by-version: 2.0.0
deprecated-by-azversion: 15.0.0
change-effective-date: 2025/11/03
# Customize add validate
# - model-cmdlet:
# - model-name: UploadLimitWeeklyRecurrence
```
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
},
{
"name": "Start-AzStorageMoverJobDefinition",
"description": "Creates a new Job Run resource for the specified Job Definition and passes it to the Agent for execution.",
"description": "Start a new Job Run resource for the specified Job Definition and passes it to the Agent for execution.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/startJob",
"help": {
"learnMore": {
Expand All @@ -123,7 +123,7 @@
},
"examples": [
{
"description": "Creates a new Job Run resource for the specified Job Definition and passes it to the Agent for execution.",
"description": "start a new Job Run resource for the specified Job Definition and passes it to the Agent for execution.",
"parameters": [
{
"name": "-JobDefinitionName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Creates a Smb file share endpoint resource, which represents a data transfer sou
New-AzStorageMoverAzSmbFileShareEndpoint -Name $endpointName -ResourceGroupName $rgname -StorageMoverName $storagemovername -StorageAccountResourceId $accountresourceid -FileShareName $fileshareName -Description "Description"

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IStorageMoverIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -37,7 +37,7 @@ To create the parameters described below, construct a hash table containing the
https://learn.microsoft.com/powershell/module/az.storagemover/new-azstoragemoverazsmbfileshareendpoint
#>
function New-AzStorageMoverAzSmbFileShareEndpoint {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding =$false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
[Alias("New-AzStorageMoverSmbFileShareEndpoint")]
param(
Expand Down Expand Up @@ -132,7 +132,7 @@ function New-AzStorageMoverAzSmbFileShareEndpoint {
)

process {
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.AzureStorageSmbFileShareEndpointProperties]::New()
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.AzureStorageSmbFileShareEndpointProperties]::New()

if ($PSBoundParameters.ContainsKey('FileShareName')) {
$Properties.FileShareName = $FileShareName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Creates an AzStorageContainer endpoint resource, which represents a data transfe
New-AzStorageMoverAzStorageContainerEndpoint -Name myendpointName -ResourceGroupName myResourceGroup -BlobContainerName myContainer -StorageMoverName myStorageMover -StorageAccountResourceId myAccountResourceId

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IStorageMoverIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -37,7 +37,7 @@ To create the parameters described below, construct a hash table containing the
https://learn.microsoft.com/powershell/module/az.storagemover/new-azstoragemoverazstoragecontainerendpoint
#>
function New-AzStorageMoverAzStorageContainerEndpoint {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding =$false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
Expand Down Expand Up @@ -131,7 +131,7 @@ function New-AzStorageMoverAzStorageContainerEndpoint {
)

process {
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.AzureStorageBlobContainerEndpointProperties]::New()
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.AzureStorageBlobContainerEndpointProperties]::New()

if ($PSBoundParameters.ContainsKey('BlobContainerName')) {
$Properties.BlobContainerName = $BlobContainerName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Creates a Nfs endpoint resource, which represents a data transfer source or dest
New-AzStorageMoverNfsEndpoint -Name myEndpoint -ResourceGroupName myResourceGroup -StorageMoverName myStorageMover -Host "x.x.x.x" -Export "/" -NfsVersion NFSv3 -Description "Description"

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IStorageMoverIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -37,7 +37,7 @@ To create the parameters described below, construct a hash table containing the
https://learn.microsoft.com/powershell/module/az.storagemover/new-azstoragemovernfsendpoint
#>
function New-AzStorageMoverNfsEndpoint {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding =$false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
Expand Down Expand Up @@ -67,8 +67,8 @@ function New-AzStorageMoverNfsEndpoint {

[Parameter(ParameterSetName = 'CreateExpanded')]
[Parameter(HelpMessage="The NFS protocol version.")]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Support.NfsVersion])]
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Support.NfsVersion]
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.PSArgumentCompleterAttribute("NFSauto", "NFSv3", "NFSv4")]
[System.String]
${NfsVersion},

[Parameter(ParameterSetName = 'CreateExpanded')]
Expand Down Expand Up @@ -137,7 +137,7 @@ function New-AzStorageMoverNfsEndpoint {
)

process {
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.NfsMountEndpointProperties]::New()
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.NfsMountEndpointProperties]::New()
if ($PSBoundParameters.ContainsKey('Host')) {
$Properties.Host = $Host
$null = $PSBoundParameters.Remove("Host")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Creates an SMB endpoint resource, which represents a data transfer source or des
.Example
New-AzStorageMoverSmbEndpoint -Name $endpointName -ResourceGroupName $rgname -StorageMoverName $storagemovername -Host $host -ShareName $shareName -CredentialsUsernameUri "https://examples-azureKeyVault.vault.azure.net/secrets/examples-username" -CredentialsPasswordUri "https://examples-azureKeyVault.vault.azure.net/secrets/examples-password" -Description "Description"
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IStorageMoverIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -36,7 +36,7 @@ To create the parameters described below, construct a hash table containing the
https://learn.microsoft.com/powershell/module/az.storagemover/new-azstoragemoversmbendpoint
#>
function New-AzStorageMoverSmbEndpoint {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint])]
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding =$false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
param(
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
Expand Down Expand Up @@ -140,7 +140,7 @@ function New-AzStorageMoverSmbEndpoint {
)

process {
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.SmbMountEndpointProperties]::New()
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.SmbMountEndpointProperties]::New()

if ($PSBoundParameters.ContainsKey('Host')) {
$Properties.Host = $Host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ Create an in-memory object for UploadLimitWeeklyRecurrence.
Create an in-memory object for UploadLimitWeeklyRecurrence.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.UploadLimitWeeklyRecurrence
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.UploadLimitWeeklyRecurrence
.Link
https://learn.microsoft.com/powershell/module/Az.StorageMover/new-AzStorageMoverUploadLimitWeeklyRecurrenceObject
#>
function New-AzStorageMoverUploadLimitWeeklyRecurrenceObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.UploadLimitWeeklyRecurrence')]
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.UploadLimitWeeklyRecurrence')]
[CmdletBinding(PositionalBinding=$false)]
Param(

[Parameter(Mandatory, HelpMessage="The set of days of week for the schedule recurrence. A day must not be specified more than once in a recurrence.")]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Support.DayOfWeek])]
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Support.DayOfWeek[]]
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.PSArgumentCompleterAttribute("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")]
[string[]]
[ValidateSet("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", IgnoreCase = $true)]
$Day,
[Parameter(Mandatory, HelpMessage="The WAN-link upload bandwidth (maximum data transfer rate) in megabits per second. Value of 0 indicates no throughput is allowed and any running migration job is effectively paused for the duration of this recurrence. Only data plane operations are governed by this limit. Control plane operations ensure seamless functionality. The agent may exceed this limit with control messages, if necessary.")]
Expand Down Expand Up @@ -60,7 +61,7 @@ function New-AzStorageMoverUploadLimitWeeklyRecurrenceObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.UploadLimitWeeklyRecurrence]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.UploadLimitWeeklyRecurrence]::New()

if ($PSBoundParameters.ContainsKey('Day')) {
$Object.Day = $Day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Properties not specified in the request body will be unchanged.
Update-AzStorageMoverAzSmbFileShareEndpoint -Name "myendpoint" -ResourceGroupName "myresourcegroup" -StorageMoverName "mystoragemover" -Description "updated endpoint"

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpointBaseUpdateParameters
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpointBaseUpdateParameters
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IStorageMoverIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -54,7 +54,7 @@ INPUTOBJECT<IStorageMoverIdentity>: Identity Parameter
https://learn.microsoft.com/powershell/module/az.storagemover/update-azstoragemoverazsmbfileshareendpoint
#>
function Update-AzStorageMoverAzSmbFileShareEndpoint {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.IEndpoint])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IEndpoint])]
[CmdletBinding(DefaultParameterSetName = 'UpdateExpanded', PositionalBinding =$false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
[Alias("Update-AzStorageMoverSmbFileShareEndpoint")]
param(
Expand Down Expand Up @@ -147,7 +147,7 @@ function Update-AzStorageMoverAzSmbFileShareEndpoint {
)

process {
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20240701.AzureStorageSmbFileShareEndpointUpdateProperties]::New()
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.AzureStorageSmbFileShareEndpointUpdateProperties]::New()
$Properties.EndpointType = 'AzureStorageSmbFileShare'

if ($PSBoundParameters.ContainsKey('Description')) {
Expand Down
Loading