Skip to content

Commit 29069a4

Browse files
yifanz0BethanyZhou
andauthored
[StorageMover] Add new module Az.StorageMover (#18962)
* [StorageMover] Add new module Az.StorageMover * Add in local swagger file temporarily * Update cmdlets per swagger change * Update src/StorageMover/README.md * Update src/StorageMover/README.md * Update src/StorageMover/README.md * Fix post cmdlet issue. Create new agent for testing * temp save * update swagger to public repo file * Delete temp swagger folder. Fix tests * Fix issues per comments and bugs * update swagger branch and remove-* cmdlets tests * Update Stop-JobDefinition and Unregister-Agent tests * Update examples. Format Agent output * Update test utils * update per comments Co-authored-by: Beisi Zhou <[email protected]>
1 parent da0bc4d commit 29069a4

File tree

118 files changed

+11508
-0
lines changed

Some content is hidden

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

118 files changed

+11508
-0
lines changed

src/StorageMover/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

src/StorageMover/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
bin
2+
obj
3+
.vs
4+
generated
5+
internal
6+
exports
7+
tools
8+
custom/*.psm1
9+
custom/autogen-model-cmdlets
10+
test/*-TestResults.xml
11+
/*.ps1
12+
/*.ps1xml
13+
/*.psm1
14+
/*.snk
15+
/*.csproj
16+
/*.nuspec

src/StorageMover/Az.StorageMover.psd1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@{
2+
GUID = 'd6053d97-1a9b-4fc6-9bd2-09c5b23b34db'
3+
RootModule = './Az.StorageMover.psm1'
4+
ModuleVersion = '0.1.0'
5+
CompatiblePSEditions = 'Core', 'Desktop'
6+
Author = 'Microsoft Corporation'
7+
CompanyName = 'Microsoft Corporation'
8+
Copyright = 'Microsoft Corporation. All rights reserved.'
9+
Description = 'Microsoft Azure PowerShell: StorageMover cmdlets'
10+
PowerShellVersion = '5.1'
11+
DotNetFrameworkVersion = '4.7.2'
12+
RequiredAssemblies = './bin/Az.StorageMover.private.dll'
13+
FormatsToProcess = './Az.StorageMover.format.ps1xml'
14+
FunctionsToExport = 'Get-AzStorageMover', 'Get-AzStorageMoverAgent', 'Get-AzStorageMoverEndpoint', 'Get-AzStorageMoverJobDefinition', 'Get-AzStorageMoverJobRun', 'Get-AzStorageMoverProject', 'New-AzStorageMover', 'New-AzStorageMoverAzStorageContainerEndpoint', 'New-AzStorageMoverJobDefinition', 'New-AzStorageMoverNfsEndpoint', 'New-AzStorageMoverProject', 'Remove-AzStorageMover', 'Remove-AzStorageMoverEndpoint', 'Remove-AzStorageMoverJobDefinition', 'Remove-AzStorageMoverProject', 'Start-AzStorageMoverJobDefinition', 'Stop-AzStorageMoverJobDefinition', 'Unregister-AzStorageMoverAgent', 'Update-AzStorageMover', 'Update-AzStorageMoverAgent', 'Update-AzStorageMoverAzStorageContainerEndpoint', 'Update-AzStorageMoverJobDefinition', 'Update-AzStorageMoverNfsEndpoint', 'Update-AzStorageMoverProject', '*'
15+
AliasesToExport = '*'
16+
PrivateData = @{
17+
PSData = @{
18+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'StorageMover'
19+
LicenseUri = 'https://aka.ms/azps-license'
20+
ProjectUri = 'https://github.com/Azure/azure-powershell'
21+
ReleaseNotes = ''
22+
}
23+
}
24+
}

src/StorageMover/README.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<!-- region Generated -->
2+
# Az.StorageMover
3+
This directory contains the PowerShell module for the StorageMover service.
4+
5+
---
6+
## Status
7+
[![Az.StorageMover](https://img.shields.io/powershellgallery/v/Az.StorageMover.svg?style=flat-square&label=Az.StorageMover "Az.StorageMover")](https://www.powershellgallery.com/packages/Az.StorageMover/)
8+
9+
## Info
10+
- Modifiable: yes
11+
- Generated: all
12+
- Committed: yes
13+
- Packaged: yes
14+
15+
---
16+
## Detail
17+
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.
18+
19+
## Module Requirements
20+
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater
21+
22+
## Authentication
23+
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
24+
25+
## Development
26+
For information on how to develop for `Az.StorageMover`, see [how-to.md](how-to.md).
27+
<!-- endregion -->
28+
29+
### AutoRest Configuration
30+
> see https://aka.ms/autorest
31+
32+
``` yaml
33+
# Please specify the commit id that includes your features to make sure generated codes stable.
34+
brach: 913f1e8aa0bfc773c5f236f03d56f379d9d3d012
35+
require:
36+
# readme.azure.noprofile.md is the common configuration file
37+
- $(this-folder)/../readme.azure.noprofile.md
38+
input-file:
39+
- $(repo)/specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/storagemover.json
40+
41+
# For new RP, the version is 0.1.0
42+
module-version: 0.1.0
43+
# Normally, title is the service name
44+
title: StorageMover
45+
subject-prefix: $(service-name)
46+
nested-object-to-string: true
47+
identity-correction-for-post: true
48+
49+
directive:
50+
- where:
51+
verb: Set
52+
remove: true
53+
- where:
54+
model-name: StorageMover|JobDefinition|Project|Endpoint|Agent
55+
set:
56+
suppress-format: true
57+
- no-inline:
58+
- EndpointBaseProperties
59+
- no-inline:
60+
- EndpointBaseUpdateProperties
61+
# Rename Start-AzDataMoverJobDefinitionJob -> Start-AzDataMoverJobDefinition
62+
- where:
63+
verb: Start
64+
subject: JobDefinitionJob
65+
set:
66+
verb: Start
67+
subject: JobDefinition
68+
# Rename Stop-AzDataMoverJobDefinitionJob -> Stop-AzDataMoverJobDefinition
69+
- where:
70+
verb: Stop
71+
subject: JobDefinitionJob
72+
set:
73+
verb: Stop
74+
subject: JobDefinition
75+
# Remove New-AzStorageMoverAgent
76+
- where:
77+
verb: New
78+
subject: Agent
79+
remove: true
80+
# Hide Remove-AzStorageMover
81+
- where:
82+
verb: Remove
83+
subject: StorageMover
84+
hide: true
85+
# Hide Remove-AzStorageMoverAgent
86+
- where:
87+
verb: Remove
88+
subject: Agent
89+
hide: true
90+
# Remove paramater sets Create and CreateViaIdentity
91+
- where:
92+
verb: New
93+
subject: Endpoint
94+
variant: ^Create$|^CreateViaIdentity$
95+
remove: true
96+
# Remove paramater set Update and UpdateViaIdentity
97+
- where:
98+
verb: Update
99+
subject: Endpoint
100+
variant: ^Update$|^UpdateViaIdentity$
101+
remove: true
102+
# Hide New-AzStorageMoverEndpoint
103+
- where:
104+
verb: New
105+
subject: Endpoint
106+
hide: true
107+
# Hide Update-AzStorageMoverEndpoint
108+
- where:
109+
verb: Update
110+
subject: Endpoint
111+
hide: true
112+
- where:
113+
model-name: Agent
114+
property-name: NumberOfCore
115+
set:
116+
property-name: NumberOfCores
117+
- where:
118+
model-name: Agent
119+
property-name: UptimeInSecond
120+
set:
121+
property-name: UptimeInSeconds
122+
- where:
123+
model-name: Agent
124+
property-name: Status
125+
set:
126+
property-name: AgentStatus
127+
# Rename property Code to ErrorCode in JobRun model
128+
- where:
129+
model-name: JobRun
130+
property-name: Code
131+
set:
132+
property-name: ErrorCode
133+
# Rename property Message to ErrorMessage in JobRun model
134+
- where:
135+
model-name: JobRun
136+
property-name: Message
137+
set:
138+
property-name: ErrorMessage
139+
- where:
140+
verb: New
141+
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
142+
remove: true
143+
# Delete the original ShouldProcess as a ShouldProcess and ShouldContinue are added in the custom cmdlets
144+
- from: source-file-csharp
145+
where: $
146+
transform: $ = $.replace('ShouldProcess($\"Call remote \'StorageMoversDelete\' operation\")', 'true');
147+
- from: source-file-csharp
148+
where: $
149+
transform: $ = $.replace('ShouldProcess($\"Call remote \'AgentsDelete\' operation\")', 'true');
150+
```
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# 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.
15+
# ----------------------------------------------------------------------------------
16+
17+
<#
18+
.Synopsis
19+
Creates an AzStorageContainer endpoint resource, which represents a data transfer source or destination.
20+
.Description
21+
Creates an AzStorageContainer endpoint resource, which represents a data transfer source or destination.
22+
.Example
23+
New-AzStorageMoverAzStorageContainerEndpoint -Name myendpointName -ResourceGroupName myResourceGroup -BlobContainerName myContainer -StorageMoverName myStorageMover -StorageAccountResourceId myAccountResourceId
24+
25+
.Inputs
26+
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20220701Preview.IEndpoint
27+
.Inputs
28+
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.IStorageMoverIdentity
29+
.Outputs
30+
Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20220701Preview.IEndpoint
31+
.Notes
32+
COMPLEX PARAMETER PROPERTIES
33+
34+
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.
35+
36+
.Link
37+
https://docs.microsoft.com/powershell/module/az.storagemover/new-azstoragemoverendpoint
38+
#>
39+
function New-AzStorageMoverAzStorageContainerEndpoint {
40+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20220701Preview.IEndpoint])]
41+
[CmdletBinding(DefaultParameterSetName = 'CreateExpanded', PositionalBinding =$false, SupportsShouldProcess, ConfirmImpact = 'Medium')]
42+
param(
43+
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
44+
[Alias('EndpointName')]
45+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Path')]
46+
[System.String]
47+
# The name of the endpoint resource.
48+
${Name},
49+
50+
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
51+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Path')]
52+
[System.String]
53+
# The name of the resource group.
54+
# The name is case insensitive.
55+
${ResourceGroupName},
56+
57+
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
58+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Path')]
59+
[System.String]
60+
# The name of the Storage Mover resource.
61+
${StorageMoverName},
62+
63+
[Parameter(ParameterSetName = 'CreateExpanded')]
64+
[Parameter(Mandatory, HelpMessage="The name of the Storage blob container that is the target destination.")]
65+
[string]
66+
${BlobContainerName},
67+
68+
[Parameter(ParameterSetName = 'CreateExpanded')]
69+
[Parameter(Mandatory, HelpMessage="The Azure Resource ID of the storage account that is the target destination.")]
70+
[string]
71+
${StorageAccountResourceId},
72+
73+
[Parameter(ParameterSetName = 'CreateExpanded')]
74+
[Parameter(HelpMessage="A description for the endpoint.")]
75+
[string]
76+
${Description},
77+
78+
[Parameter(ParameterSetName='CreateExpanded')]
79+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Path')]
80+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
81+
[System.String]
82+
# The ID of the target subscription.
83+
${SubscriptionId},
84+
85+
[Parameter()]
86+
[Alias('AzureRMContext', 'AzureCredential')]
87+
[ValidateNotNull()]
88+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Azure')]
89+
[System.Management.Automation.PSObject]
90+
# The credentials, account, tenant, and subscription used for communication with Azure.
91+
${DefaultProfile},
92+
93+
[Parameter(DontShow)]
94+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Runtime')]
95+
[System.Management.Automation.SwitchParameter]
96+
# Wait for .NET debugger to attach
97+
${Break},
98+
99+
[Parameter(DontShow)]
100+
[ValidateNotNull()]
101+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Runtime')]
102+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Runtime.SendAsyncStep[]]
103+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
104+
${HttpPipelineAppend},
105+
106+
[Parameter(DontShow)]
107+
[ValidateNotNull()]
108+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Runtime')]
109+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Runtime.SendAsyncStep[]]
110+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
111+
${HttpPipelinePrepend},
112+
113+
[Parameter(DontShow)]
114+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Runtime')]
115+
[System.Uri]
116+
# The URI for the proxy server to use
117+
${Proxy},
118+
119+
[Parameter(DontShow)]
120+
[ValidateNotNull()]
121+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Runtime')]
122+
[System.Management.Automation.PSCredential]
123+
# Credentials for a proxy server to use for the remote call
124+
${ProxyCredential},
125+
126+
[Parameter(DontShow)]
127+
[Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Category('Runtime')]
128+
[System.Management.Automation.SwitchParameter]
129+
# Use the default credentials for the proxy
130+
${ProxyUseDefaultCredentials}
131+
)
132+
133+
process {
134+
$Properties = [Microsoft.Azure.PowerShell.Cmdlets.StorageMover.Models.Api20220701Preview.AzureStorageBlobContainerEndpointProperties]::New()
135+
136+
if ($PSBoundParameters.ContainsKey('BlobContainerName')) {
137+
$Properties.BlobContainerName = $BlobContainerName
138+
$null = $PSBoundParameters.Remove("BlobContainerName")
139+
}
140+
if ($PSBoundParameters.ContainsKey('StorageAccountResourceId')) {
141+
$Properties.StorageAccountResourceId = $StorageAccountResourceId
142+
$null = $PSBoundParameters.Remove("StorageAccountResourceId")
143+
}
144+
if ($PSBoundParameters.ContainsKey('Description')) {
145+
$Properties.Description = $Description
146+
$null = $PSBoundParameters.Remove("Description")
147+
}
148+
149+
$Properties.EndpointType = "AzureStorageBlobContainer"
150+
$PSBoundParameters.Add("Property", $Properties)
151+
152+
Az.StorageMover.internal\New-AzStorageMoverEndpoint @PSBoundParameters
153+
}
154+
}

0 commit comments

Comments
 (0)