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 4 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
26 changes: 26 additions & 0 deletions src/StorageMover/StorageMover.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - StorageMover")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.5.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.5.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
32 changes: 6 additions & 26 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,18 +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');
# 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
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-AzStorageMoverAzStorageContainerEndpoint -Name myEndpointName -ResourceGroupName myResourceGroupName -StorageMoverName myStorageMover -Description "Update Description"

.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-azstoragemoverazstoragecontainerendpoint
#>
function Update-AzStorageMoverAzStorageContainerEndpoint {
[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')]
param(
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
Expand Down Expand Up @@ -146,7 +146,7 @@ function Update-AzStorageMoverAzStorageContainerEndpoint {
)

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

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