Skip to content
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

Migrate Storage from generation-Storage-preview to Az.Storage-preview #25494

Merged
merged 2 commits into from
Jul 10, 2024
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
458 changes: 458 additions & 0 deletions src/Storage/Storage.Autorest/Az.Storage.format.ps1xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Storage/Storage.Autorest/Az.Storage.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Storage.private.dll'
FormatsToProcess = './Az.Storage.format.ps1xml'
FunctionsToExport = 'Get-AzStorageAccountMigration', 'Start-AzStorageAccountMigration'
FunctionsToExport = 'Get-AzStorageAccountMigration', 'Get-AzStorageTaskAssignment', 'Get-AzStorageTaskAssignmentInstancesReport', 'New-AzStorageTaskAssignment', 'Remove-AzStorageTaskAssignment', 'Start-AzStorageAccountMigration', 'Update-AzStorageTaskAssignment'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Storage'
Expand Down
68 changes: 66 additions & 2 deletions src/Storage/Storage.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ For information on how to develop for `Az.Storage`, see [how-to.md](how-to.md).

``` yaml
# Please specify the commit id that includes your features to make sure generated codes stable.
commit: 3e6b4ddca225530c27273d0f816466a905c0151b
commit: db377f47cf7bf53bf077aa42967112a9783980d5
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
input-file:
- $(repo)/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/storage.json
- $(repo)/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/storage.json
- $(repo)/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/storageTaskAssignments.json

# For new RP, the version is 0.1.0
module-version: 5.9.1
Expand All @@ -44,6 +45,12 @@ nested-object-to-string: true
identity-correction-for-post: true

directive:
- where:
variant: ^(Create|Update)(?!.*?Expanded|JsonFilePath|JsonString)
remove: true
- where:
variant: ^CreateViaIdentity.*$
remove: true
- where:
subject: ^StorageAccountCustomerInitiatedMigration$
set:
Expand All @@ -64,4 +71,61 @@ directive:
- where:
subject: ^StorageAccount$|^StorageAccountKey$|^StorageAccountProperty$|^StorageAccountSas$|^StorageAccountServiceSas$|BlobInventoryPolicy$|^DeletedAccount$|^EncryptionScope$|^LocalUser$|^LocalUserKey$|^ManagementPolicy$|^ObjectReplicationPolicy$|^Sku$|^Usage$|^LocalUserPassword$|^AccountUserDelegationKey$|^AbortStorageAccountHierarchicalNamespaceMigration$|^HierarchicalStorageAccountNamespaceMigration$|^StorageAccountBlobRange$|^StorageAccountUserDelegationKey$|^StorageAccountNameAvailability$
remove: true
- where:
parameter-name: ParameterEndBy
set:
parameter-name: EndBy
- where:
parameter-name: ParameterInterval
set:
parameter-name: Interval
- where:
parameter-name: ParameterIntervalUnit
set:
parameter-name: IntervalUnit
- where:
parameter-name: ParameterStartFrom
set:
parameter-name: StartFrom
- where:
parameter-name: ParameterStartOn
set:
parameter-name: StartOn
- where:
property-name: ParameterEndBy
set:
property-name: EndBy
- where:
property-name: ParameterInterval
set:
property-name: Interval
- where:
property-name: ParameterIntervalUnit
set:
property-name: IntervalUnit
- where:
property-name: ParameterStartFrom
set:
property-name: StartFrom
- where:
property-name: ParameterStartOn
set:
property-name: StartOn
- from: storageTaskAssignments.json
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/reports"].get
transform: >
$["operationId"] = "StorageTaskAssignmentInstancesReport_List"
# Renaming the operationId to StorageTaskAssignmentInstancesReport_Get, but the operation actually lists all the reports under a specific storage task assignment.
- from: storageTaskAssignments.json
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/storageTaskAssignments/{storageTaskAssignmentName}/reports"].get
transform: >
$["operationId"] = "StorageTaskAssignmentInstancesReport_Get"
- from: storageTaskAssignments.json
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/storageTaskAssignments/{storageTaskAssignmentName}/reports"].get
transform: >
$["operationId"] = "StorageTaskAssignmentInstancesReport_Get"
- where:
model-name: StorageTaskReportInstance
set:
suppress-format: true
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resourceType": "storageAccounts/accountMigrations",
"apiVersion": "2023-01-01",
"apiVersion": "2023-05-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.storage"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"resourceType": "storageAccounts/storageTaskAssignments",
"apiVersion": "2023-05-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.storage"
},
"commands": [
{
"name": "Get-AzStorageTaskAssignment",
"description": "Get the storage task assignment properties",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/storageTaskAssignments/{storageTaskAssignmentName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.storage/get-azstoragetaskassignment"
},
"parameterSets": [
{
"parameters": [
"-AccountName <String>",
"-Name <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String[]>]"
]
}
]
},
"examples": [
{
"description": "Get the storage task assignment properties",
"parameters": [
{
"name": "-AccountName",
"value": "[Path.accountName]"
},
{
"name": "-Name",
"value": "[Path.storageTaskAssignmentName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
},
{
"name": "Remove-AzStorageTaskAssignment",
"description": "Delete the storage task assignment sub-resource",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/storageTaskAssignments/{storageTaskAssignmentName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.storage/remove-azstoragetaskassignment"
},
"parameterSets": [
{
"parameters": [
"-AccountName <String>",
"-Name <String>",
"-ResourceGroupName <String>",
"[-SubscriptionId <String>]"
]
}
]
},
"examples": [
{
"description": "Delete the storage task assignment sub-resource",
"parameters": [
{
"name": "-AccountName",
"value": "[Path.accountName]"
},
{
"name": "-Name",
"value": "[Path.storageTaskAssignmentName]"
},
{
"name": "-ResourceGroupName",
"value": "[Path.resourceGroupName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
}
]
}
12 changes: 11 additions & 1 deletion src/Storage/Storage.Autorest/build-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
# is regenerated.
# ----------------------------------------------------------------------------------
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX)
param([switch]$NotIsolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs, [switch]$UX, [Switch]$DisableAfterBuildTasks)
$ErrorActionPreference = 'Stop'

if($PSEdition -ne 'Core') {
Expand Down Expand Up @@ -177,4 +177,14 @@ if (Test-Path (Join-Path $PSScriptRoot 'generate-portal-ux.ps1'))
. (Join-Path $PSScriptRoot 'generate-portal-ux.ps1')
}

if (-not $DisableAfterBuildTasks){
$afterBuildTasksPath = Join-Path $PSScriptRoot ''
$afterBuildTasksArgs = ConvertFrom-Json 'true' -AsHashtable
if(Test-Path -Path $afterBuildTasksPath -PathType leaf){
Write-Host -ForegroundColor Green 'Running after build tasks...'
. $afterBuildTasksPath @afterBuildTasksArgs
}
}


Write-Host -ForegroundColor Green '-------------Done-------------'
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
### Example 1: Get a task assignment
```powershell
Get-AzStorageTaskAssignment -ResourceGroupName myresourcegroup -AccountName myaccount -Name myassignment
```

```output
Description : This is a task assignment
Enabled : True
EndBy : 7/2/2025 6:17:38 AM
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/storageTaskAssignments/myassignment
Interval : 1
IntervalUnit : days
Name : myassignment
ProvisioningState : Succeeded
ReportPrefix : testc1
ResourceGroupName : myresourcegroup
RunStatusEnum :
RunStatusError :
RunStatusFinishTime :
RunStatusObjectFailedCount :
RunStatusObjectsOperatedOnCount :
RunStatusObjectsSucceededCount :
RunStatusObjectsTargetedCount :
RunStatusRunResult :
RunStatusStartTime :
RunStatusStorageAccountId :
RunStatusSummaryReportPath :
RunStatusTaskAssignmentId :
RunStatusTaskId :
RunStatusTaskVersion :
StartFrom : 7/2/2024 6:17:38 AM
StartOn :
TargetExcludePrefix : {}
TargetPrefix : {test}
TaskId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.StorageActions/storageTasks/mystoragetask1
TriggerType : OnSchedule
Type : Microsoft.Storage/storageAccounts/storageTaskAssignments
```

This command gets the task assignment "myassignment" under storage account "myaccount".

### Example 2: List task assignments under a storage account
```powershell
Get-AzStorageTaskAssignment -ResourceGroupName myresourcegroup -AccountName myaccount
```

```output
Name ResourceGroupName
---- -----------------
assignment1 myresourcegroup
assignment2 myresourcegroup
assignment3 myresourcegroup
```

This command lists task assignments under the storage account "myaccount".

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
### Example 1: List the reports of a task assignment in an account
```powershell
Get-AzStorageTaskAssignmentInstancesReport -AccountName myaccount -ResourceGroupName myresourcegroup -StorageTaskAssignmentName mytaskassignment
```

```output
FinishTime : 2024-07-02T08:19:51.9238839Z
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/storageTaskAssignments/mytaskassignment/reports/instance1
Name : instance1
ObjectFailedCount : 0
ObjectsOperatedOnCount : 0
ObjectsSucceededCount : 0
ObjectsTargetedCount : 0
RunResult : Succeeded
RunStatusEnum : Finished
RunStatusError : 0x0
StartTime : 2024-07-02T08:10:55.0000000Z
StorageAccountId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount
SummaryReportPath : https://myaccount.blob.core.windows.net/testc2/mytask/assignment1/2024-07-02T08:11:20/SummaryReport.json
TaskAssignmentId : /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/storageTaskAssignments/mytaskassignment
TaskId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.StorageActions/storageTasks/mytask
TaskVersion : 1
Type : Microsoft.Storage/storageAccounts/storageTaskAssignments/reports
```

This command lists the reports of task assignment "mytaskassignment".

### Example 2: List the reports of all storage task assignments and instances in an account
```powershell
Get-AzStorageTaskAssignmentInstancesReport -AccountName myaccount -ResourceGroupName myresourcegroup
```

```output
FinishTime : 2024-07-03T08:19:23.1774164Z
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/reports/instance1
Name : instance1
ObjectFailedCount : 0
ObjectsOperatedOnCount : 0
ObjectsSucceededCount : 0
ObjectsTargetedCount : 0
RunResult : Succeeded
RunStatusEnum : Finished
RunStatusError : 0x0
StartTime : 2024-07-03T08:10:11.0000000Z
StorageAccountId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount
SummaryReportPath : https://myaccount.blob.core.windows.net/testc2/mytask/mytaskassignment/2024-07-03T08:10:41/SummaryReport.json
TaskAssignmentId : /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/storageTaskAssignments/mytaskassignment
TaskId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.StorageActions/storageTasks/mytask
TaskVersion : 1
Type : Microsoft.Storage/storageAccounts/reports

FinishTime : 2024-07-02T08:19:51.9238839Z
Id : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/reports/instance2
Name : instance2
ObjectFailedCount : 0
ObjectsOperatedOnCount : 0
ObjectsSucceededCount : 0
ObjectsTargetedCount : 0
RunResult : Succeeded
RunStatusEnum : Finished
RunStatusError : 0x0
StartTime : 2024-07-02T08:10:55.0000000Z
StorageAccountId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount
SummaryReportPath : https://myaccount.blob.core.windows.net/testc2/mytaskassignment2/assignment1/2024-07-02T08:11:20/SummaryReport.json
TaskAssignmentId : /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount/storageTaskAssignments/mytaskassignment2
TaskId : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.StorageActions/storageTasks/mytask
TaskVersion : 1
Type : Microsoft.Storage/storageAccounts/reports
```

This command lists the reports of all storage task assignments and instances under storage account "myaccount".

Loading
Loading