From be1792685dea4ee29c063783e1caaf2fb209e89b Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:05:26 +0800 Subject: [PATCH 01/10] feature storage action 20240131 --- .../StorageAction.Autorest/.gitattributes | 1 + .../StorageAction.Autorest/.gitignore | 16 + .../Az.StorageAction.psd1 | 23 ++ .../StorageAction.Autorest/README.md | 91 +++++ .../storageTasks.json | 85 ++++ .../StorageAction.Autorest/custom/README.md | 41 ++ .../docs/Az.StorageAction.md | 45 +++ .../docs/Get-AzStorageActionTask.md | 198 +++++++++ .../docs/Get-AzStorageActionTaskAssignment.md | 140 +++++++ .../docs/Get-AzStorageActionTasksReport.md | 157 +++++++ ...Invoke-AzStorageActionTaskPreviewAction.md | 317 +++++++++++++++ .../docs/New-AzStorageActionTask.md | 382 ++++++++++++++++++ .../New-AzStorageActionTaskOperationObject.md | 116 ++++++ ...geActionTaskPreviewBlobPropertiesObject.md | 125 ++++++ ...tionTaskPreviewKeyValuePropertiesObject.md | 90 +++++ .../StorageAction.Autorest/docs/README.md | 11 + .../docs/Remove-AzStorageActionTask.md | 211 ++++++++++ .../docs/Update-AzStorageActionTask.md | 380 +++++++++++++++++ .../examples/Get-AzStorageActionTask.md | 59 +++ .../Get-AzStorageActionTaskAssignment.md | 22 + .../Get-AzStorageActionTasksReport.md | 22 + ...Invoke-AzStorageActionTaskPreviewAction.md | 22 + .../examples/New-AzStorageActionTask.md | 43 ++ .../New-AzStorageActionTaskOperationObject.md | 15 + ...geActionTaskPreviewBlobPropertiesObject.md | 22 + ...tionTaskPreviewKeyValuePropertiesObject.md | 22 + .../examples/Remove-AzStorageActionTask.md | 6 + .../examples/Update-AzStorageActionTask.md | 59 +++ .../StorageAction.Autorest/how-to.md | 58 +++ .../StorageAction.Autorest/license.txt | 227 +++++++++++ .../resources/README.md | 11 + .../Get-AzStorageActionStorageTask.Tests.ps1 | 33 ++ ...orageActionStorageTaskAssignment.Tests.ps1 | 21 + ...zStorageActionStorageTasksReport.Tests.ps1 | 21 + .../test/Get-AzStorageActionTask.Tests.ps1 | 33 ++ ...et-AzStorageActionTaskAssignment.Tests.ps1 | 21 + .../Get-AzStorageActionTasksReport.Tests.ps1 | 21 + ...geActionPreviewStorageTaskAction.Tests.ps1 | 41 ++ ...AzStorageActionTaskPreviewAction.Tests.ps1 | 41 ++ .../New-AzStorageActionStorageTask.Tests.ps1 | 41 ++ ...eTaskPreviewBlobPropertiesObject.Tests.ps1 | 21 + ...kPreviewKeyValuePropertiesObject.Tests.ps1 | 21 + .../test/New-AzStorageActionTask.Tests.ps1 | 41 ++ ...StorageActionTaskOperationObject.Tests.ps1 | 21 + ...nTaskPreviewBlobPropertiesObject.Tests.ps1 | 21 + ...kPreviewKeyValuePropertiesObject.Tests.ps1 | 21 + .../StorageAction.Autorest/test/README.md | 17 + ...emove-AzStorageActionStorageTask.Tests.ps1 | 25 ++ .../test/Remove-AzStorageActionTask.Tests.ps1 | 25 ++ ...pdate-AzStorageActionStorageTask.Tests.ps1 | 41 ++ .../test/Update-AzStorageActionTask.Tests.ps1 | 41 ++ .../StorageAction.Autorest/test/loadEnv.ps1 | 29 ++ .../StorageAction.Autorest/test/utils.ps1 | 56 +++ .../utils/Unprotect-SecureString.ps1 | 16 + 54 files changed, 3686 insertions(+) create mode 100644 src/StorageAction/StorageAction.Autorest/.gitattributes create mode 100644 src/StorageAction/StorageAction.Autorest/.gitignore create mode 100644 src/StorageAction/StorageAction.Autorest/Az.StorageAction.psd1 create mode 100644 src/StorageAction/StorageAction.Autorest/README.md create mode 100644 src/StorageAction/StorageAction.Autorest/UX/Microsoft.StorageActions/storageTasks.json create mode 100644 src/StorageAction/StorageAction.Autorest/custom/README.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/README.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskOperationObject.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md create mode 100644 src/StorageAction/StorageAction.Autorest/how-to.md create mode 100644 src/StorageAction/StorageAction.Autorest/license.txt create mode 100644 src/StorageAction/StorageAction.Autorest/resources/README.md create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/README.md create mode 100644 src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/test/utils.ps1 create mode 100644 src/StorageAction/StorageAction.Autorest/utils/Unprotect-SecureString.ps1 diff --git a/src/StorageAction/StorageAction.Autorest/.gitattributes b/src/StorageAction/StorageAction.Autorest/.gitattributes new file mode 100644 index 000000000000..2125666142eb --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/.gitignore b/src/StorageAction/StorageAction.Autorest/.gitignore new file mode 100644 index 000000000000..3c3d57339c8b --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/.gitignore @@ -0,0 +1,16 @@ +bin +obj +.vs +generated +internal +exports +tools +custom/*.psm1 +custom/autogen-model-cmdlets +test/*-TestResults.xml +/*.ps1 +/*.ps1xml +/*.psm1 +/*.snk +/*.csproj +/*.nuspec \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/Az.StorageAction.psd1 b/src/StorageAction/StorageAction.Autorest/Az.StorageAction.psd1 new file mode 100644 index 000000000000..8459f6f070b9 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/Az.StorageAction.psd1 @@ -0,0 +1,23 @@ +@{ + GUID = 'cc1d1de1-1601-4440-82c6-76c6673d8aba' + RootModule = './Az.StorageAction.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: StorageAction cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.StorageAction.private.dll' + FormatsToProcess = './Az.StorageAction.format.ps1xml' + FunctionsToExport = 'Get-AzStorageActionTask', 'Get-AzStorageActionTaskAssignment', 'Get-AzStorageActionTasksReport', 'Invoke-AzStorageActionTaskPreviewAction', 'New-AzStorageActionTask', 'New-AzStorageActionTaskOperationObject', 'New-AzStorageActionTaskPreviewBlobPropertiesObject', 'New-AzStorageActionTaskPreviewKeyValuePropertiesObject', 'Remove-AzStorageActionTask', 'Update-AzStorageActionTask' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'StorageAction' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/StorageAction/StorageAction.Autorest/README.md b/src/StorageAction/StorageAction.Autorest/README.md new file mode 100644 index 000000000000..30077b3105a9 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/README.md @@ -0,0 +1,91 @@ + +# Az.StorageAction +This directory contains the PowerShell module for the StorageAction service. + +--- +## Status +[![Az.StorageAction](https://img.shields.io/powershellgallery/v/Az.StorageAction.svg?style=flat-square&label=Az.StorageAction "Az.StorageAction")](https://www.powershellgallery.com/packages/Az.StorageAction/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.StorageAction`, see [how-to.md](how-to.md). + + +### AutoRest Configuration +> see https://aka.ms/autorest + +```yaml +# pin the swagger version by using the commit id instead of branch name +commit: 13f09225c7d1cf42c55536e41c090bb8438cebd7 +require: +# readme.azure.noprofile.md is the common configuration file + - $(this-folder)/../../readme.azure.noprofile.md + - $(repo)/specification/storageactions/resource-manager/readme.md +# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally +# - (this-folder)/relative-path-to-your-local-readme.md + +try-require: + - $(repo)/specification/storageactions/resource-manager/readme.powershell.md + +# For new RP, the version is 0.1.0 +module-version: 0.1.0 +# Normally, title is the service name +title: StorageAction +subject-prefix: $(service-name) + +directive: +# # Following are common directives which are normally required in all the RPs +# # 1. Remove the unexpanded parameter set +# # 2. For New-* cmdlets, ViaIdentity is not required +# # Following two directives are v4 specific + - where: + variant: ^(Create|Update)(?!.*?Expanded|JsonFilePath|JsonString) + remove: true + - where: + subject: StorageTask + set: + subject: Task + - where: + verb: Invoke + subject: PreviewStorageTaskAction + set: + subject: TaskPreviewAction + - where: + subject: StorageTaskAssignment + set: + subject: TaskAssignment + - where: + subject: StorageTasksReport + set: + subject: TasksReport + - where: + verb: Invoke + subject: PreviewStorageTaskAction + variant: Preview|PreviewViaIdentity + - model-cmdlet: + - model-name: StorageTaskOperation + cmdlet-name: New-AzStorageActionTaskOperationObject + - model-name: StorageTaskPreviewBlobProperties + cmdlet-name: New-AzStorageActionTaskPreviewBlobPropertiesObject + - model-name: StorageTaskPreviewKeyValueProperties + cmdlet-name: New-AzStorageActionTaskPreviewKeyValuePropertiesObject + - where: + parameter-name: IdentityUserAssignedIdentity + set: + parameter-name: UserAssignedIdentity +``` diff --git a/src/StorageAction/StorageAction.Autorest/UX/Microsoft.StorageActions/storageTasks.json b/src/StorageAction/StorageAction.Autorest/UX/Microsoft.StorageActions/storageTasks.json new file mode 100644 index 000000000000..4ed7eec5697e --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/UX/Microsoft.StorageActions/storageTasks.json @@ -0,0 +1,85 @@ +{ + "resourceType": "storageTasks", + "apiVersion": "2023-01-01", + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.storageaction" + }, + "commands": [ + { + "name": "Get-AzStorageActionTask", + "description": "Get the storage task properties", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.storageaction/get-azstorageactiontask" + }, + "parameterSets": [ + { + "parameters": [ + "-Name ", + "-ResourceGroupName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Get the storage task properties", + "parameters": [ + { + "name": "-Name", + "value": "[Path.storageTaskName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + }, + { + "name": "Remove-AzStorageActionTask", + "description": "Delete the storage task resource.", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + "help": { + "learnMore": { + "url": "https://learn.microsoft.com/powershell/module/az.storageaction/remove-azstorageactiontask" + }, + "parameterSets": [ + { + "parameters": [ + "-Name ", + "-ResourceGroupName ", + "[-SubscriptionId ]" + ] + } + ] + }, + "examples": [ + { + "description": "Delete the storage task resource.", + "parameters": [ + { + "name": "-Name", + "value": "[Path.storageTaskName]" + }, + { + "name": "-ResourceGroupName", + "value": "[Path.resourceGroupName]" + }, + { + "name": "-SubscriptionId", + "value": "[Path.subscriptionId]" + } + ] + } + ] + } + ] +} diff --git a/src/StorageAction/StorageAction.Autorest/custom/README.md b/src/StorageAction/StorageAction.Autorest/custom/README.md new file mode 100644 index 000000000000..6e1d18d92e6e --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/custom/README.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.StorageAction` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.StorageAction.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.StorageAction` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.StorageAction.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.StorageAction.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.StorageAction`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.StorageAction.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.StorageAction.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.StorageAction`. +- `Microsoft.Azure.PowerShell.Cmdlets.StorageAction.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.StorageAction`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.StorageAction.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md b/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md new file mode 100644 index 000000000000..6e2fa1ff1bc5 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md @@ -0,0 +1,45 @@ +--- +Module Name: Az.StorageAction +Module Guid: cc1d1de1-1601-4440-82c6-76c6673d8aba +Download Help Link: https://learn.microsoft.com/powershell/module/az.storageaction +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.StorageAction Module +## Description +Microsoft Azure PowerShell: StorageAction cmdlets + +## Az.StorageAction Cmdlets +### [Get-AzStorageActionTask](Get-AzStorageActionTask.md) +Get the storage task properties + +### [Get-AzStorageActionTaskAssignment](Get-AzStorageActionTaskAssignment.md) +Lists all the storage tasks available under the given resource group. + +### [Get-AzStorageActionTasksReport](Get-AzStorageActionTasksReport.md) +Fetch the storage tasks run report summary for each assignment. + +### [Invoke-AzStorageActionTaskPreviewAction](Invoke-AzStorageActionTaskPreviewAction.md) +Runs the input conditions against input object metadata properties and designates matched objects in response. + +### [New-AzStorageActionTask](New-AzStorageActionTask.md) +Asynchronously creates a new storage task resource with the specified parameters. +If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. +If a storage task is already created and a subsequent Create request is issued with the exact same set of properties, the request will succeed. + +### [New-AzStorageActionTaskOperationObject](New-AzStorageActionTaskOperationObject.md) +Create an in-memory object for StorageTaskOperation. + +### [New-AzStorageActionTaskPreviewBlobPropertiesObject](New-AzStorageActionTaskPreviewBlobPropertiesObject.md) +Create an in-memory object for StorageTaskPreviewBlobProperties. + +### [New-AzStorageActionTaskPreviewKeyValuePropertiesObject](New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md) +Create an in-memory object for StorageTaskPreviewKeyValueProperties. + +### [Remove-AzStorageActionTask](Remove-AzStorageActionTask.md) +Delete the storage task resource. + +### [Update-AzStorageActionTask](Update-AzStorageActionTask.md) +Update storage task properties + diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md new file mode 100644 index 000000000000..9fa7d76e1d07 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md @@ -0,0 +1,198 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/az.storageaction/get-azstorageactiontask +schema: 2.0.0 +--- + +# Get-AzStorageActionTask + +## SYNOPSIS +Get the storage task properties + +## SYNTAX + +### List (Default) +``` +Get-AzStorageActionTask [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzStorageActionTask -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzStorageActionTask -InputObject [-DefaultProfile ] + [] +``` + +### List1 +``` +Get-AzStorageActionTask -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get the storage task properties + +## EXAMPLES + +### Example 1: Get specific storage action task with specified resource group +```powershell +Get-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +``` + +```output +CreationTimeInUtc : 1/23/2024 6:47:43 AM +Description : my storage task +ElseOperation : +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +IdentityPrincipalId : +IdentityTenantId : +IdentityType : None +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : ps1-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command gets specific storage action task with specified resource group + +### Example 2: List storage action task by subscription +```powershell +Get-AzStorageActionTask +``` + +```output +Location Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType Resour + ceGrou + pName +-------- ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- ------ +canadacentral task1 test-… +eastus2euap mytask1 ps1-t… +``` + +This command gets list of storage action task by subscription. + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the storage task within the specified resource group. +Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: StorageTaskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Get, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. +The value must be an UUID. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTask + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md new file mode 100644 index 000000000000..b306c01076d0 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md @@ -0,0 +1,140 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/az.storageaction/get-azstorageactiontaskassignment +schema: 2.0.0 +--- + +# Get-AzStorageActionTaskAssignment + +## SYNOPSIS +Lists all the storage tasks available under the given resource group. + +## SYNTAX + +``` +Get-AzStorageActionTaskAssignment -ResourceGroupName -StorageTaskName + [-SubscriptionId ] [-Maxpagesize ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists all the storage tasks available under the given resource group. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Maxpagesize +Optional, specifies the maximum number of storage task assignment Ids to be included in the list response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageTaskName +The name of the storage task within the specified resource group. +Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. +The value must be an UUID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskAssignment + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md new file mode 100644 index 000000000000..374399cdce01 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md @@ -0,0 +1,157 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/az.storageaction/get-azstorageactiontasksreport +schema: 2.0.0 +--- + +# Get-AzStorageActionTasksReport + +## SYNOPSIS +Fetch the storage tasks run report summary for each assignment. + +## SYNTAX + +``` +Get-AzStorageActionTasksReport -ResourceGroupName -StorageTaskName + [-SubscriptionId ] [-Filter ] [-Maxpagesize ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Fetch the storage tasks run report summary for each assignment. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +Optional. +When specified, it can be used to query using reporting properties. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Maxpagesize +Optional, specifies the maximum number of storage task assignment Ids to be included in the list response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageTaskName +The name of the storage task within the specified resource group. +Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. +The value must be an UUID. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskReportInstance + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md new file mode 100644 index 000000000000..d5d632218ce4 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md @@ -0,0 +1,317 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/az.storageaction/invoke-azstorageactiontaskpreviewaction +schema: 2.0.0 +--- + +# Invoke-AzStorageActionTaskPreviewAction + +## SYNOPSIS +Runs the input conditions against input object metadata properties and designates matched objects in response. + +## SYNTAX + +### Preview (Default) +``` +Invoke-AzStorageActionTaskPreviewAction -Location -Parameter + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### PreviewExpanded +``` +Invoke-AzStorageActionTaskPreviewAction -Location -ActionElseBlockExist + -Blob [-SubscriptionId ] + [-ContainerMetadata ] [-ContainerName ] + [-IfCondition ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### PreviewViaIdentity +``` +Invoke-AzStorageActionTaskPreviewAction -InputObject + -Parameter [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### PreviewViaIdentityExpanded +``` +Invoke-AzStorageActionTaskPreviewAction -InputObject -ActionElseBlockExist + -Blob [-ContainerMetadata ] + [-ContainerName ] [-IfCondition ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### PreviewViaJsonFilePath +``` +Invoke-AzStorageActionTaskPreviewAction -Location -JsonFilePath [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### PreviewViaJsonString +``` +Invoke-AzStorageActionTaskPreviewAction -Location -JsonString [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Runs the input conditions against input object metadata properties and designates matched objects in response. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -ActionElseBlockExist +Specify whether the else block is present in the condition. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: PreviewExpanded, PreviewViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Blob +Preview action container properties to be tested for a match with the provided condition. +To construct, see NOTES section for BLOB properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewBlobProperties[] +Parameter Sets: PreviewExpanded, PreviewViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContainerMetadata +metadata key value pairs to be tested for a match against the provided condition. +To construct, see NOTES section for CONTAINERMETADATA properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] +Parameter Sets: PreviewExpanded, PreviewViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ContainerName +property for the container name. + +```yaml +Type: System.String +Parameter Sets: PreviewExpanded, PreviewViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IfCondition +Storage task condition to bes tested for a match. + +```yaml +Type: System.String +Parameter Sets: PreviewExpanded, PreviewViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity +Parameter Sets: PreviewViaIdentity, PreviewViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -JsonFilePath +Path of Json file supplied to the Preview operation + +```yaml +Type: System.String +Parameter Sets: PreviewViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Preview operation + +```yaml +Type: System.String +Parameter Sets: PreviewViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The location to perform preview of the actions. + +```yaml +Type: System.String +Parameter Sets: Preview, PreviewExpanded, PreviewViaJsonFilePath, PreviewViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Parameter +Storage Task Preview Action. +To construct, see NOTES section for PARAMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewAction +Parameter Sets: Preview, PreviewViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. +The value must be an UUID. + +```yaml +Type: System.String +Parameter Sets: Preview, PreviewExpanded, PreviewViaJsonFilePath, PreviewViaJsonString +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewAction + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewAction + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md new file mode 100644 index 000000000000..5ef9bf4c6807 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -0,0 +1,382 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/az.storageaction/new-azstorageactiontask +schema: 2.0.0 +--- + +# New-AzStorageActionTask + +## SYNOPSIS +Asynchronously creates a new storage task resource with the specified parameters. +If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. +If a storage task is already created and a subsequent Create request is issued with the exact same set of properties, the request will succeed. + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzStorageActionTask -Name -ResourceGroupName -Location + [-SubscriptionId ] [-Description ] [-ElseOperation ] [-Enabled] + [-IdentityType ] [-IfCondition ] [-IfOperation ] [-Tag ] + [-UserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### CreateViaIdentityExpanded +``` +New-AzStorageActionTask -InputObject -Location [-Description ] + [-ElseOperation ] [-Enabled] [-IdentityType ] [-IfCondition ] + [-IfOperation ] [-Tag ] [-UserAssignedIdentity ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Asynchronously creates a new storage task resource with the specified parameters. +If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. +If a storage task is already created and a subsequent Create request is issued with the exact same set of properties, the request will succeed. + +## EXAMPLES + +### Example 1: Create storage task with if operation +```powershell +$ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue +New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None +``` + +```output +CreationTimeInUtc : 1/23/2024 6:47:43 AM +Description : my storage task +ElseOperation : +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +IdentityPrincipalId : +IdentityTenantId : +IdentityType : None +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : ps1-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +The first command creates a if operation object. +The second command creates a storage task. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description +Text that describes the purpose of the storage task + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ElseOperation +List of operations to execute in the else block +To construct, see NOTES section for ELSEOPERATION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Enabled +Storage Task is enabled when set to true and disabled when set to false + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IdentityType +Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IfCondition +The condition predicate which is composed of object properties, eg: blob and container properties. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IfOperation +List of operations to execute when the condition predicate satisfies. +To construct, see NOTES section for IFOPERATION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity +Parameter Sets: CreateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Location +The geo-location where the resource lives + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the storage task within the specified resource group. +Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded +Aliases: StorageTaskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. +The value must be an UUID. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserAssignedIdentity +The set of user assigned identities associated with the resource. +The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. +The dictionary values can be empty objects ({}) in requests. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTask + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md new file mode 100644 index 000000000000..9c9fabc53650 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md @@ -0,0 +1,116 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/Az.StorageAction/new-azstorageactiontaskoperationobject +schema: 2.0.0 +--- + +# New-AzStorageActionTaskOperationObject + +## SYNOPSIS +Create an in-memory object for StorageTaskOperation. + +## SYNTAX + +``` +New-AzStorageActionTaskOperationObject -Name [-OnFailure ] [-OnSuccess ] + [-Parameter ] [] +``` + +## DESCRIPTION +Create an in-memory object for StorageTaskOperation. + +## EXAMPLES + +### Example 1: Create a operation object +```powershell +New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue | Format-List +``` + +```output +Name : SetBlobTier +OnFailure : break +OnSuccess : continue +Parameter : { + "tier": "Hot" + } +``` + +This command creates a operation object. + +## PARAMETERS + +### -Name +The operation to be performed on the object. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OnFailure +Action to be taken when the operation fails for a object. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OnSuccess +Action to be taken when the operation is successful for a object. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Parameter +Key-value parameters for the operation. +To construct, see NOTES section for PARAMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperationParameters +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.StorageTaskOperation + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md new file mode 100644 index 000000000000..57229dac1f2e --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md @@ -0,0 +1,125 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/Az.StorageAction/new-azstorageactiontaskpreviewblobpropertiesobject +schema: 2.0.0 +--- + +# New-AzStorageActionTaskPreviewBlobPropertiesObject + +## SYNOPSIS +Create an in-memory object for StorageTaskPreviewBlobProperties. + +## SYNTAX + +``` +New-AzStorageActionTaskPreviewBlobPropertiesObject [-Metadata ] + [-Name ] [-Property ] + [-Tag ] [] +``` + +## DESCRIPTION +Create an in-memory object for StorageTaskPreviewBlobProperties. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -Metadata +metadata key value pairs to be tested for a match against the provided condition. +To construct, see NOTES section for METADATA properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +property for the container name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Property +properties key value pairs to be tested for a match against the provided condition. +To construct, see NOTES section for PROPERTY properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +tags key value pairs to be tested for a match against the provided condition. +To construct, see NOTES section for TAG properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.StorageTaskPreviewBlobProperties + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md new file mode 100644 index 000000000000..1d6a2063e8c7 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md @@ -0,0 +1,90 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/Az.StorageAction/new-azstorageactiontaskpreviewkeyvaluepropertiesobject +schema: 2.0.0 +--- + +# New-AzStorageActionTaskPreviewKeyValuePropertiesObject + +## SYNOPSIS +Create an in-memory object for StorageTaskPreviewKeyValueProperties. + +## SYNTAX + +``` +New-AzStorageActionTaskPreviewKeyValuePropertiesObject [-Key ] [-Value ] [] +``` + +## DESCRIPTION +Create an in-memory object for StorageTaskPreviewKeyValueProperties. + +## EXAMPLES + +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -Key +Represents the key property of the pair. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Value +Represents the value property of the pair. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.StorageTaskPreviewKeyValueProperties + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/README.md b/src/StorageAction/StorageAction.Autorest/docs/README.md new file mode 100644 index 000000000000..799bb7ed5111 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.StorageAction` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.StorageAction` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md new file mode 100644 index 000000000000..c7b4e4357469 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md @@ -0,0 +1,211 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/az.storageaction/remove-azstorageactiontask +schema: 2.0.0 +--- + +# Remove-AzStorageActionTask + +## SYNOPSIS +Delete the storage task resource. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzStorageActionTask -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzStorageActionTask -InputObject [-DefaultProfile ] [-AsJob] + [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete the storage task resource. + +## EXAMPLES + +### Example 1: Delete specific storage action task with specified resource group +```powershell +Remove-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +``` + +This command delete specific storage action task with specified resource group + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the storage task within the specified resource group. +Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: StorageTaskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. +The value must be an UUID. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md new file mode 100644 index 000000000000..aa10cbd308e9 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md @@ -0,0 +1,380 @@ +--- +external help file: +Module Name: Az.StorageAction +online version: https://learn.microsoft.com/powershell/module/az.storageaction/update-azstorageactiontask +schema: 2.0.0 +--- + +# Update-AzStorageActionTask + +## SYNOPSIS +Update storage task properties + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzStorageActionTask -Name -ResourceGroupName [-SubscriptionId ] + [-Description ] [-ElseOperation ] [-Enabled] [-IdentityType ] + [-IfCondition ] [-IfOperation ] [-Tag ] + [-UserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzStorageActionTask -InputObject [-Description ] + [-ElseOperation ] [-Enabled] [-IdentityType ] [-IfCondition ] + [-IfOperation ] [-Tag ] [-UserAssignedIdentity ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Update storage task properties + +## EXAMPLES + +### Example 1: Update storage action task with conditions +```powershell +$elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation +``` + +```output +CreationTimeInUtc : 1/23/2024 6:47:43 AM +Description : my storage task +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : False +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +IdentityPrincipalId : +IdentityTenantId : +IdentityType : None +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : ps1-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command updates storage action task. + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description +Text that describes the purpose of the storage task + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ElseOperation +List of operations to execute in the else block +To construct, see NOTES section for ELSEOPERATION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Enabled +Storage Task is enabled when set to true and disabled when set to false + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IdentityType +Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IfCondition +The condition predicate which is composed of object properties, eg: blob and container properties. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IfOperation +List of operations to execute when the condition predicate satisfies. +To construct, see NOTES section for IFOPERATION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the storage task within the specified resource group. +Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: StorageTaskName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. +The value must be an UUID. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Gets or sets a list of key value pairs that describe the resource. +These tags can be used in viewing and grouping this resource (across resource groups). +A maximum of 15 tags can be provided for a resource. +Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserAssignedIdentity +The set of user assigned identities associated with the resource. +The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. +The dictionary values can be empty objects ({}) in requests. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTask + +## NOTES + +## RELATED LINKS + diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md new file mode 100644 index 000000000000..222af2690515 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md @@ -0,0 +1,59 @@ +### Example 1: Get specific storage action task with specified resource group +```powershell +Get-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +``` + +```output +CreationTimeInUtc : 1/23/2024 6:47:43 AM +Description : my storage task +ElseOperation : +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +IdentityPrincipalId : +IdentityTenantId : +IdentityType : None +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : ps1-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command gets specific storage action task with specified resource group + +### Example 2: List storage action task by subscription +```powershell +Get-AzStorageActionTask +``` + +```output +Location Name SystemDataCreatedAt SystemDataCreatedBy SystemDataCreatedByType SystemDataLastModifiedAt SystemDataLastModifiedBy SystemDataLastModifiedByType Resour + ceGrou + pName +-------- ---- ------------------- ------------------- ----------------------- ------------------------ ------------------------ ---------------------------- ------ +canadacentral task1 test-… +eastus2euap mytask1 ps1-t… +``` + +This command gets list of storage action task by subscription. + diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md new file mode 100644 index 000000000000..0371f56c36d2 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md new file mode 100644 index 000000000000..0371f56c36d2 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + diff --git a/src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md b/src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md new file mode 100644 index 000000000000..0371f56c36d2 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md new file mode 100644 index 000000000000..ecbe573dc7d6 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md @@ -0,0 +1,43 @@ +### Example 1: Create storage task with if operation +```powershell +$ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue +New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None +``` + +```output +CreationTimeInUtc : 1/23/2024 6:47:43 AM +Description : my storage task +ElseOperation : +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +IdentityPrincipalId : +IdentityTenantId : +IdentityType : None +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : ps1-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +The first command creates a if operation object. The second command creates a storage task. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskOperationObject.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskOperationObject.md new file mode 100644 index 000000000000..ced99c2ca51a --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskOperationObject.md @@ -0,0 +1,15 @@ +### Example 1: Create a operation object +```powershell +New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue | Format-List +``` + +```output +Name : SetBlobTier +OnFailure : break +OnSuccess : continue +Parameter : { + "tier": "Hot" + } +``` + +This command creates a operation object. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md new file mode 100644 index 000000000000..0371f56c36d2 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md new file mode 100644 index 000000000000..0371f56c36d2 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md @@ -0,0 +1,22 @@ +### Example 1: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + diff --git a/src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md new file mode 100644 index 000000000000..d88b03f9dc02 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md @@ -0,0 +1,6 @@ +### Example 1: Delete specific storage action task with specified resource group +```powershell +Remove-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +``` + +This command delete specific storage action task with specified resource group \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md new file mode 100644 index 000000000000..d84f09c23300 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md @@ -0,0 +1,59 @@ +### Example 1: Update storage action task with conditions +```powershell +$elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation +``` + +```output +CreationTimeInUtc : 1/23/2024 6:47:43 AM +Description : my storage task +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : False +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +IdentityPrincipalId : +IdentityTenantId : +IdentityType : None +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : ps1-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command updates storage action task. + +### Example 2: {{ Add title here }} +```powershell +{{ Add code here }} +``` + +```output +{{ Add output here (remove the output block if the example doesn't have an output) }} +``` + +{{ Add description here }} + diff --git a/src/StorageAction/StorageAction.Autorest/how-to.md b/src/StorageAction/StorageAction.Autorest/how-to.md new file mode 100644 index 000000000000..d6beca36f168 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.StorageAction`. + +## Building `Az.StorageAction` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.StorageAction` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. + +## Packing `Az.StorageAction` +To pack `Az.StorageAction` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.StorageAction`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.StorageAction.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.StorageAction.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.StorageAction`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.StorageAction` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/license.txt b/src/StorageAction/StorageAction.Autorest/license.txt new file mode 100644 index 000000000000..b9f3180fb9af --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/license.txt @@ -0,0 +1,227 @@ +MICROSOFT SOFTWARE LICENSE TERMS + +MICROSOFT AZURE POWERSHELL + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +-----------------START OF LICENSE-------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +-------------------END OF LICENSE------------------------------------------ + + +----------------START OF THIRD PARTY NOTICE-------------------------------- + + +The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Provided for Informational Purposes Only + +AutoMapper + +The MIT License (MIT) +Copyright (c) 2010 Jimmy Bogard + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + + + +*************** + +The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Newtonsoft.Json + +The MIT License (MIT) +Copyright (c) 2007 James Newton-King +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------END OF THIRD PARTY NOTICE---------------------------------------- + diff --git a/src/StorageAction/StorageAction.Autorest/resources/README.md b/src/StorageAction/StorageAction.Autorest/resources/README.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 new file mode 100644 index 000000000000..769526323dbe --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionStorageTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionStorageTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzStorageActionStorageTask' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 new file mode 100644 index 000000000000..888b4a32f174 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionStorageTaskAssignment')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionStorageTaskAssignment.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzStorageActionStorageTaskAssignment' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 new file mode 100644 index 000000000000..029fa11da83f --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionStorageTasksReport')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionStorageTasksReport.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzStorageActionStorageTasksReport' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 new file mode 100644 index 000000000000..27a1e334e17e --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 @@ -0,0 +1,33 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzStorageActionTask' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'List1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 new file mode 100644 index 000000000000..58def343ece8 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTaskAssignment')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionTaskAssignment.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzStorageActionTaskAssignment' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 new file mode 100644 index 000000000000..e32a9c1bbba7 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTasksReport')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionTasksReport.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzStorageActionTasksReport' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 new file mode 100644 index 000000000000..75ff8b8d95cb --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzStorageActionPreviewStorageTaskAction')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzStorageActionPreviewStorageTaskAction.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzStorageActionPreviewStorageTaskAction' { + It 'PreviewExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaJsonString' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaJsonFilePath' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Preview' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 new file mode 100644 index 000000000000..2870a3f6314d --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzStorageActionTaskPreviewAction')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzStorageActionTaskPreviewAction.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Invoke-AzStorageActionTaskPreviewAction' { + It 'PreviewExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaJsonString' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaJsonFilePath' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Preview' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'PreviewViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 new file mode 100644 index 000000000000..42c88780f86b --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionStorageTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionStorageTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzStorageActionStorageTask' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaJsonString' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaJsonFilePath' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Create' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 new file mode 100644 index 000000000000..b8c86e765cb3 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionStorageTaskPreviewBlobPropertiesObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzStorageActionStorageTaskPreviewBlobPropertiesObject' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 new file mode 100644 index 000000000000..0a9ea8ed4475 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 new file mode 100644 index 000000000000..e24d26e797ce --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzStorageActionTask' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaJsonString' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaJsonFilePath' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Create' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'CreateViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 new file mode 100644 index 000000000000..d0fe1dcffca1 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTaskOperationObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionTaskOperationObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzStorageActionTaskOperationObject' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 new file mode 100644 index 000000000000..a9623592dbe7 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTaskPreviewBlobPropertiesObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionTaskPreviewBlobPropertiesObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzStorageActionTaskPreviewBlobPropertiesObject' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 new file mode 100644 index 000000000000..58a30ab1e327 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTaskPreviewKeyValuePropertiesObject')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzStorageActionTaskPreviewKeyValuePropertiesObject' { + It '__AllParameterSets' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/README.md b/src/StorageAction/StorageAction.Autorest/test/README.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 new file mode 100644 index 000000000000..0f6e3a518eee --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzStorageActionStorageTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStorageActionStorageTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzStorageActionStorageTask' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 new file mode 100644 index 000000000000..8e5027d2af76 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzStorageActionTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStorageActionTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzStorageActionTask' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 new file mode 100644 index 000000000000..2e5a0c40cfc0 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzStorageActionStorageTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStorageActionStorageTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzStorageActionStorageTask' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaJsonString' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaJsonFilePath' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Update' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 new file mode 100644 index 000000000000..7ac6e782e864 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzStorageActionTask')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStorageActionTask.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzStorageActionTask' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaJsonString' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaJsonFilePath' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Update' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 b/src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 new file mode 100644 index 000000000000..5f079e89615e --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/utils.ps1 b/src/StorageAction/StorageAction.Autorest/test/utils.ps1 new file mode 100644 index 000000000000..f8497fbd7da0 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/utils.ps1 @@ -0,0 +1,56 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +function Start-TestSleep { + [CmdletBinding(DefaultParameterSetName = 'SleepBySeconds')] + param( + [parameter(Mandatory = $true, Position = 0, ParameterSetName = 'SleepBySeconds')] + [ValidateRange(0.0, 2147483.0)] + [double] $Seconds, + + [parameter(Mandatory = $true, ParameterSetName = 'SleepByMilliseconds')] + [ValidateRange('NonNegative')] + [Alias('ms')] + [int] $Milliseconds + ) + + if ($TestMode -ne 'playback') { + switch ($PSCmdlet.ParameterSetName) { + 'SleepBySeconds' { + Start-Sleep -Seconds $Seconds + } + 'SleepByMilliseconds' { + Start-Sleep -Milliseconds $Milliseconds + } + } + } +} + +$env = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} + diff --git a/src/StorageAction/StorageAction.Autorest/utils/Unprotect-SecureString.ps1 b/src/StorageAction/StorageAction.Autorest/utils/Unprotect-SecureString.ps1 new file mode 100644 index 000000000000..cb05b51a6220 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/utils/Unprotect-SecureString.ps1 @@ -0,0 +1,16 @@ +#This script converts securestring to plaintext + +param( + [Parameter(Mandatory, ValueFromPipeline)] + [System.Security.SecureString] + ${SecureString} +) + +$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) +try { + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) +} finally { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) +} + +return $plaintext \ No newline at end of file From a06e69bc8e8b8a6c31541ef348130458ec9a0aa2 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Thu, 14 Mar 2024 17:14:33 +0800 Subject: [PATCH 02/10] Storage Action feature test cases and examples --- .../StorageAction.Autorest/README.md | 11 +- .../docs/Get-AzStorageActionTaskAssignment.md | 19 +- .../docs/Get-AzStorageActionTasksReport.md | 65 ++++-- ...Invoke-AzStorageActionTaskPreviewAction.md | 211 ++++++++++++++---- .../docs/New-AzStorageActionTask.md | 68 +++++- ...geActionTaskPreviewBlobPropertiesObject.md | 35 +-- ...tionTaskPreviewKeyValuePropertiesObject.md | 21 +- .../docs/Update-AzStorageActionTask.md | 77 +++++-- .../Get-AzStorageActionTaskAssignment.md | 19 +- .../Get-AzStorageActionTasksReport.md | 63 ++++-- ...Invoke-AzStorageActionTaskPreviewAction.md | 171 ++++++++++++-- ...geActionTaskPreviewBlobPropertiesObject.md | 35 +-- ...tionTaskPreviewKeyValuePropertiesObject.md | 21 +- .../examples/Update-AzStorageActionTask.md | 11 - .../Get-AzStorageActionStorageTask.Tests.ps1 | 33 --- ...orageActionStorageTaskAssignment.Tests.ps1 | 21 -- ...zStorageActionStorageTasksReport.Tests.ps1 | 21 -- .../test/Get-AzStorageActionTask.Tests.ps1 | 21 +- ...et-AzStorageActionTaskAssignment.Tests.ps1 | 7 +- .../Get-AzStorageActionTasksReport.Tests.ps1 | 7 +- ...geActionPreviewStorageTaskAction.Tests.ps1 | 41 ---- ...AzStorageActionTaskPreviewAction.Tests.ps1 | 42 +++- .../New-AzStorageActionStorageTask.Tests.ps1 | 41 ---- ...eTaskPreviewBlobPropertiesObject.Tests.ps1 | 21 -- ...kPreviewKeyValuePropertiesObject.Tests.ps1 | 21 -- .../test/New-AzStorageActionTask.Tests.ps1 | 5 +- ...StorageActionTaskOperationObject.Tests.ps1 | 6 +- ...nTaskPreviewBlobPropertiesObject.Tests.ps1 | 9 +- ...kPreviewKeyValuePropertiesObject.Tests.ps1 | 6 +- ...emove-AzStorageActionStorageTask.Tests.ps1 | 25 --- .../test/Remove-AzStorageActionTask.Tests.ps1 | 6 +- ...pdate-AzStorageActionStorageTask.Tests.ps1 | 41 ---- .../test/Update-AzStorageActionTask.Tests.ps1 | 15 +- .../StorageAction.Autorest/test/utils.ps1 | 4 + 34 files changed, 687 insertions(+), 533 deletions(-) delete mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 delete mode 100644 src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 diff --git a/src/StorageAction/StorageAction.Autorest/README.md b/src/StorageAction/StorageAction.Autorest/README.md index 30077b3105a9..626a1f702a6b 100644 --- a/src/StorageAction/StorageAction.Autorest/README.md +++ b/src/StorageAction/StorageAction.Autorest/README.md @@ -42,6 +42,11 @@ require: try-require: - $(repo)/specification/storageactions/resource-manager/readme.powershell.md +# The next three configurations are activated by default. +# identity-correction-for-post: true +# resourcegroup-append: true +# nested-object-to-string: true + # For new RP, the version is 0.1.0 module-version: 0.1.0 # Normally, title is the service name @@ -54,7 +59,7 @@ directive: # # 2. For New-* cmdlets, ViaIdentity is not required # # Following two directives are v4 specific - where: - variant: ^(Create|Update)(?!.*?Expanded|JsonFilePath|JsonString) + variant: ^(Create|Update|Preview)(?!.*?(Expanded|JsonFilePath|JsonString)) remove: true - where: subject: StorageTask @@ -73,10 +78,6 @@ directive: subject: StorageTasksReport set: subject: TasksReport - - where: - verb: Invoke - subject: PreviewStorageTaskAction - variant: Preview|PreviewViaIdentity - model-cmdlet: - model-name: StorageTaskOperation cmdlet-name: New-AzStorageActionTaskOperationObject diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md index b306c01076d0..a64dba663c65 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md @@ -22,27 +22,18 @@ Lists all the storage tasks available under the given resource group. ## EXAMPLES -### Example 1: {{ Add title here }} +### Example 1: Lists all the storage tasks ```powershell -{{ Add code here }} +Get-AzStorageActionTaskAssignment -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` +Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign1 -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign2 ``` -{{ Add description here }} +This command lists all the storage task assignments. ## PARAMETERS diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md index 374399cdce01..81951402cfdd 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md @@ -23,27 +23,62 @@ Fetch the storage tasks run report summary for each assignment. ## EXAMPLES -### Example 1: {{ Add title here }} +### Example 1: Get report ```powershell -{{ Add code here }} +Get-AzStorageActionTasksReport -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +FinishTime : 2024-02-28T10:16:58.9261483Z +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance1 +Name : instance1 +ObjectFailedCount : 0 +ObjectsOperatedOnCount : 0 +ObjectsSucceededCount : 0 +ObjectsTargetedCount : 1 +RunResult : Succeeded +RunStatusEnum : Finished +RunStatusError : 0x0 +StartTime : 2024-02-28T10:07:53.0000000Z +StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 +SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign1/2024-02-28T10:08:00/SummaryReport.json +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign1 +TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks/reports + +FinishTime : 2024-02-28T10:31:54.7848950Z +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance2 +Name : instance2 +ObjectFailedCount : 0 +ObjectsOperatedOnCount : 0 +ObjectsSucceededCount : 0 +ObjectsTargetedCount : 1 +RunResult : Succeeded +RunStatusEnum : Finished +RunStatusError : 0x0 +StartTime : 2024-02-28T10:21:53.0000000Z +StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 +SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign2/2024-02-28T10:22:05/SummaryReport.json +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign2 +TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks/reports ``` -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} +This command get assignments report. ## PARAMETERS diff --git a/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md index d5d632218ce4..0e39a136331d 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md @@ -12,13 +12,7 @@ Runs the input conditions against input object metadata properties and designate ## SYNTAX -### Preview (Default) -``` -Invoke-AzStorageActionTaskPreviewAction -Location -Parameter - [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] -``` - -### PreviewExpanded +### PreviewExpanded (Default) ``` Invoke-AzStorageActionTaskPreviewAction -Location -ActionElseBlockExist -Blob [-SubscriptionId ] @@ -26,12 +20,6 @@ Invoke-AzStorageActionTaskPreviewAction -Location -ActionElseBlockExist [-IfCondition ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] ``` -### PreviewViaIdentity -``` -Invoke-AzStorageActionTaskPreviewAction -InputObject - -Parameter [-DefaultProfile ] [-Confirm] [-WhatIf] [] -``` - ### PreviewViaIdentityExpanded ``` Invoke-AzStorageActionTaskPreviewAction -InputObject -ActionElseBlockExist @@ -57,27 +45,170 @@ Runs the input conditions against input object metadata properties and designate ## EXAMPLES -### Example 1: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} - -### Example 2: {{ Add title here }} +### Example 1: Run the input conditions against input object metadata properties and designates matched objects ```powershell -{{ Add code here }} +#create first blob +$creationTime = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" +$lastModified = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Last-Modified" -Value "Wed, 07 Jun 2023 05:23:29 GMT" +$etag = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Etag" -Value "0x8DB67175454D36D" +$contentLength = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Length" -Value "38619" +$contentType = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Type" -Value "text/xml" +$contentEncoding = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Encoding" -Value "" +$contentLanguage = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Language" -Value "" +$contentCRC64 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-CRC64" -Value "" +$contentMD5 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-MD5" -Value "njr6iDrmU9+FC89WMK22EA==" +$cacheControl = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Cache-Control" -Value "" +$contentDisposition = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Disposition" -Value "" +$blobType = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "BlobType" -Value "BlockBlob" +$accessTier = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "AccessTier" -Value "Hot" +$accessTierInferred = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "AccessTierInferred" -Value "true" +$leaseStatus = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "LeaseStatus" -Value "unlocked" +$leaseState = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "LeaseState" -Value "available" +$serverEncrypted = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "ServerEncrypted" -Value "true" +$tagCount = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "TagCount" -Value "1" +$metadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey1" -Value "mValue1" +$tags = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey1" -Value "tValue1" +$blob1 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Property $creationTime -Tag $tags +#create second blob +$creationTime2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 06 Jun 2023 05:23:29 GMT" +$metadata2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey2" -Value "mValue2" +$tags2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey2" -Value "tValue2" +$blob2 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder2/file1.txt' -Metadata $metadata2 -Property $creationTime2 -Tag $tags2 + +$conmetadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mContainerKey1" -Value "mContainerValue1" +Invoke-AzStorageActionTaskPreviewAction -Location eastus2euap -ActionElseBlockExist -Blob $blob1,$blob2 -ContainerMetadata $conmetadata -ContainerName firstContainer -IfCondition "[[equals(AccessTier, 'Hot')]]" ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +ActionElseBlockExist : True +Blob : {{ + "name": "folder1/file1.txt", + "properties": [ + { + "key": "Creation-Time", + "value": "Wed, 07 Jun 2023 05:23:29 GMT" + }, + { + "key": "Last-Modified", + "value": "Wed, 07 Jun 2023 05:23:29 GMT" + }, + { + "key": "Etag", + "value": "0x8DB67175454D36D" + }, + { + "key": "Content-Length", + "value": "38619" + }, + { + "key": "Content-Type", + "value": "text/xml" + }, + { + "key": "Content-Encoding", + "value": "" + }, + { + "key": "Content-Language", + "value": "" + }, + { + "key": "Content-CRC64", + "value": "" + }, + { + "key": "Content-MD5", + "value": "njr6iDrmU9+FC89WMK22EA==" + }, + { + "key": "Cache-Control", + "value": "" + }, + { + "key": "Content-Disposition", + "value": "" + }, + { + "key": "BlobType", + "value": "BlockBlob" + }, + { + "key": "AccessTier", + "value": "Hot" + }, + { + "key": "AccessTierInferred", + "value": "true" + }, + { + "key": "LeaseStatus", + "value": "unlocked" + }, + { + "key": "LeaseState", + "value": "available" + }, + { + "key": "ServerEncrypted", + "value": "true" + }, + { + "key": "TagCount", + "value": "1" + } + ], + "metadata": [ + { + "key": "mKey1", + "value": "mValue1" + } + ], + "tags": [ + { + "key": "tKey1", + "value": "tValue1" + } + ], + "matchedBlock": "If" + }, { + "name": "folder2/file1.txt", + "properties": [ + { + "key": "Creation-Time", + "value": "Wed, 06 Jun 2023 05:23:29 GMT" + }, + { + "key": "Last-Modified", + "value": "Wed, 06 Jun 2023 05:23:29 GMT" + }, + { + "key": "Etag", + "value": "0x6FB67175454D36D" + } + ], + "metadata": [ + { + "key": "mKey2", + "value": "mValue2" + } + ], + "tags": [ + { + "key": "tKey2", + "value": "tValue2" + } + ], + "matchedBlock": "Else" + }} +ContainerMetadata : {{ + "key": "mContainerKey1", + "value": "mContainerValue1" + }} +ContainerName : firstContainer +IfCondition : [[equals(AccessTier, 'Hot')]] ``` -{{ Add description here }} +This command runs the input conditions against input object metadata properties and designates matched objects. ## PARAMETERS @@ -180,7 +311,7 @@ To construct, see NOTES section for INPUTOBJECT properties and create a hash tab ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity -Parameter Sets: PreviewViaIdentity, PreviewViaIdentityExpanded +Parameter Sets: PreviewViaIdentityExpanded Aliases: Required: True @@ -225,7 +356,7 @@ The location to perform preview of the actions. ```yaml Type: System.String -Parameter Sets: Preview, PreviewExpanded, PreviewViaJsonFilePath, PreviewViaJsonString +Parameter Sets: PreviewExpanded, PreviewViaJsonFilePath, PreviewViaJsonString Aliases: Required: True @@ -235,29 +366,13 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Parameter -Storage Task Preview Action. -To construct, see NOTES section for PARAMETER properties and create a hash table. - -```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewAction -Parameter Sets: Preview, PreviewViaIdentity -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - ### -SubscriptionId The ID of the target subscription. The value must be an UUID. ```yaml Type: System.String -Parameter Sets: Preview, PreviewExpanded, PreviewViaJsonFilePath, PreviewViaJsonString +Parameter Sets: PreviewExpanded, PreviewViaJsonFilePath, PreviewViaJsonString Aliases: Required: False @@ -305,8 +420,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity -### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewAction - ## OUTPUTS ### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewAction diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md index 5ef9bf4c6807..e77b02ef0785 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -31,6 +31,20 @@ New-AzStorageActionTask -InputObject -Location [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` +### CreateViaJsonFilePath +``` +New-AzStorageActionTask -Name -ResourceGroupName -JsonFilePath + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### CreateViaJsonString +``` +New-AzStorageActionTask -Name -ResourceGroupName -JsonString + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + ## DESCRIPTION Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. @@ -121,7 +135,7 @@ Text that describes the purpose of the storage task ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False @@ -137,7 +151,7 @@ To construct, see NOTES section for ELSEOPERATION properties and create a hash t ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False @@ -152,7 +166,7 @@ Storage Task is enabled when set to true and disabled when set to false ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False @@ -167,7 +181,7 @@ Type of managed service identity (where both SystemAssigned and UserAssigned typ ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False @@ -182,7 +196,7 @@ The condition predicate which is composed of object properties, eg: blob and con ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False @@ -198,7 +212,7 @@ To construct, see NOTES section for IFOPERATION properties and create a hash tab ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False @@ -224,12 +238,42 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Create operation + +```yaml +Type: System.String +Parameter Sets: CreateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Location The geo-location where the resource lives ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: True @@ -245,7 +289,7 @@ Storage task names must be between 3 and 18 characters in length and use numbers ```yaml Type: System.String -Parameter Sets: CreateExpanded +Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString Aliases: StorageTaskName Required: True @@ -276,7 +320,7 @@ The name is case insensitive. ```yaml Type: System.String -Parameter Sets: CreateExpanded +Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString Aliases: Required: True @@ -292,7 +336,7 @@ The value must be an UUID. ```yaml Type: System.String -Parameter Sets: CreateExpanded +Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString Aliases: Required: False @@ -307,7 +351,7 @@ Resource tags. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False @@ -324,7 +368,7 @@ The dictionary values can be empty objects ({}) in requests. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded Aliases: Required: False diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md index 57229dac1f2e..329df6ba8886 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md @@ -23,27 +23,32 @@ Create an in-memory object for StorageTaskPreviewBlobProperties. ## EXAMPLES -### Example 1: {{ Add title here }} +### Example 1: Create blob property object ```powershell -{{ Add code here }} +$creationTime = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" +$metadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey1" -Value "mValue1" +$tags = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey1" -Value "tValue1" +New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Property $creationTime -Tag $tags ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +MatchedBlock : +Metadata : {{ + "key": "mKey1", + "value": "mValue1" + }} +Name : folder1/file1.txt +Property : {{ + "key": "Creation-Time", + "value": "Wed, 07 Jun 2023 05:23:29 GMT" + }} +Tag : {{ + "key": "tKey1", + "value": "tValue1" + }} ``` -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} +This command create a blob property object. ## PARAMETERS diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md index 1d6a2063e8c7..976442212da7 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md @@ -21,27 +21,18 @@ Create an in-memory object for StorageTaskPreviewKeyValueProperties. ## EXAMPLES -### Example 1: {{ Add title here }} +### Example 1: Create key and value property ```powershell -{{ Add code here }} +New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +Key Value +--- ----- +Creation-Time Wed, 07 Jun 2023 05:23:29 GMT ``` -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} +This command create a key-value property object. ## PARAMETERS diff --git a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md index aa10cbd308e9..99bf6445877c 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md @@ -29,6 +29,20 @@ Update-AzStorageActionTask -InputObject [-Description < [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` +### UpdateViaJsonFilePath +``` +Update-AzStorageActionTask -Name -ResourceGroupName -JsonFilePath + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + +### UpdateViaJsonString +``` +Update-AzStorageActionTask -Name -ResourceGroupName -JsonString + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [] +``` + ## DESCRIPTION Update storage task properties @@ -82,17 +96,6 @@ Type : Microsoft.StorageActions/storageTasks This command updates storage action task. -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} - ## PARAMETERS ### -AsJob @@ -131,7 +134,7 @@ Text that describes the purpose of the storage task ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False @@ -147,7 +150,7 @@ To construct, see NOTES section for ELSEOPERATION properties and create a hash t ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False @@ -162,7 +165,7 @@ Storage Task is enabled when set to true and disabled when set to false ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False @@ -177,7 +180,7 @@ Type of managed service identity (where both SystemAssigned and UserAssigned typ ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False @@ -192,7 +195,7 @@ The condition predicate which is composed of object properties, eg: blob and con ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False @@ -208,7 +211,7 @@ To construct, see NOTES section for IFOPERATION properties and create a hash tab ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False @@ -234,13 +237,43 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -JsonFilePath +Path of Json file supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonFilePath +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JsonString +Json string supplied to the Update operation + +```yaml +Type: System.String +Parameter Sets: UpdateViaJsonString +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Name The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. ```yaml Type: System.String -Parameter Sets: UpdateExpanded +Parameter Sets: UpdateExpanded, UpdateViaJsonFilePath, UpdateViaJsonString Aliases: StorageTaskName Required: True @@ -271,7 +304,7 @@ The name is case insensitive. ```yaml Type: System.String -Parameter Sets: UpdateExpanded +Parameter Sets: UpdateExpanded, UpdateViaJsonFilePath, UpdateViaJsonString Aliases: Required: True @@ -287,7 +320,7 @@ The value must be an UUID. ```yaml Type: System.String -Parameter Sets: UpdateExpanded +Parameter Sets: UpdateExpanded, UpdateViaJsonFilePath, UpdateViaJsonString Aliases: Required: False @@ -305,7 +338,7 @@ Each tag must have a key no greater in length than 128 characters and a value no ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False @@ -322,7 +355,7 @@ The dictionary values can be empty objects ({}) in requests. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded Aliases: Required: False diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md index 0371f56c36d2..c35a7703b503 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md @@ -1,22 +1,13 @@ -### Example 1: {{ Add title here }} +### Example 1: Lists all the storage tasks ```powershell -{{ Add code here }} +Get-AzStorageActionTaskAssignment -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` +Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign1 -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign2 ``` -{{ Add description here }} +This command lists all the storage task assignments. diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md index 0371f56c36d2..5742965af5e4 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md @@ -1,22 +1,57 @@ -### Example 1: {{ Add title here }} +### Example 1: Get report ```powershell -{{ Add code here }} +Get-AzStorageActionTasksReport -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` +FinishTime : 2024-02-28T10:16:58.9261483Z +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance1 +Name : instance1 +ObjectFailedCount : 0 +ObjectsOperatedOnCount : 0 +ObjectsSucceededCount : 0 +ObjectsTargetedCount : 1 +RunResult : Succeeded +RunStatusEnum : Finished +RunStatusError : 0x0 +StartTime : 2024-02-28T10:07:53.0000000Z +StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 +SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign1/2024-02-28T10:08:00/SummaryReport.json +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign1 +TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks/reports -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +FinishTime : 2024-02-28T10:31:54.7848950Z +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance2 +Name : instance2 +ObjectFailedCount : 0 +ObjectsOperatedOnCount : 0 +ObjectsSucceededCount : 0 +ObjectsTargetedCount : 1 +RunResult : Succeeded +RunStatusEnum : Finished +RunStatusError : 0x0 +StartTime : 2024-02-28T10:21:53.0000000Z +StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 +SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign2/2024-02-28T10:22:05/SummaryReport.json +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign2 +TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks/reports ``` -{{ Add description here }} +This command get assignments report. diff --git a/src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md b/src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md index 0371f56c36d2..a26aa8f6c0c9 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Invoke-AzStorageActionTaskPreviewAction.md @@ -1,22 +1,165 @@ -### Example 1: {{ Add title here }} +### Example 1: Run the input conditions against input object metadata properties and designates matched objects ```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} +#create first blob +$creationTime = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" +$lastModified = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Last-Modified" -Value "Wed, 07 Jun 2023 05:23:29 GMT" +$etag = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Etag" -Value "0x8DB67175454D36D" +$contentLength = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Length" -Value "38619" +$contentType = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Type" -Value "text/xml" +$contentEncoding = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Encoding" -Value "" +$contentLanguage = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Language" -Value "" +$contentCRC64 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-CRC64" -Value "" +$contentMD5 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-MD5" -Value "njr6iDrmU9+FC89WMK22EA==" +$cacheControl = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Cache-Control" -Value "" +$contentDisposition = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Disposition" -Value "" +$blobType = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "BlobType" -Value "BlockBlob" +$accessTier = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "AccessTier" -Value "Hot" +$accessTierInferred = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "AccessTierInferred" -Value "true" +$leaseStatus = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "LeaseStatus" -Value "unlocked" +$leaseState = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "LeaseState" -Value "available" +$serverEncrypted = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "ServerEncrypted" -Value "true" +$tagCount = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "TagCount" -Value "1" +$metadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey1" -Value "mValue1" +$tags = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey1" -Value "tValue1" +$blob1 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Property $creationTime -Tag $tags +#create second blob +$creationTime2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 06 Jun 2023 05:23:29 GMT" +$metadata2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey2" -Value "mValue2" +$tags2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey2" -Value "tValue2" +$blob2 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder2/file1.txt' -Metadata $metadata2 -Property $creationTime2 -Tag $tags2 -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} +$conmetadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mContainerKey1" -Value "mContainerValue1" +Invoke-AzStorageActionTaskPreviewAction -Location eastus2euap -ActionElseBlockExist -Blob $blob1,$blob2 -ContainerMetadata $conmetadata -ContainerName firstContainer -IfCondition "[[equals(AccessTier, 'Hot')]]" ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +ActionElseBlockExist : True +Blob : {{ + "name": "folder1/file1.txt", + "properties": [ + { + "key": "Creation-Time", + "value": "Wed, 07 Jun 2023 05:23:29 GMT" + }, + { + "key": "Last-Modified", + "value": "Wed, 07 Jun 2023 05:23:29 GMT" + }, + { + "key": "Etag", + "value": "0x8DB67175454D36D" + }, + { + "key": "Content-Length", + "value": "38619" + }, + { + "key": "Content-Type", + "value": "text/xml" + }, + { + "key": "Content-Encoding", + "value": "" + }, + { + "key": "Content-Language", + "value": "" + }, + { + "key": "Content-CRC64", + "value": "" + }, + { + "key": "Content-MD5", + "value": "njr6iDrmU9+FC89WMK22EA==" + }, + { + "key": "Cache-Control", + "value": "" + }, + { + "key": "Content-Disposition", + "value": "" + }, + { + "key": "BlobType", + "value": "BlockBlob" + }, + { + "key": "AccessTier", + "value": "Hot" + }, + { + "key": "AccessTierInferred", + "value": "true" + }, + { + "key": "LeaseStatus", + "value": "unlocked" + }, + { + "key": "LeaseState", + "value": "available" + }, + { + "key": "ServerEncrypted", + "value": "true" + }, + { + "key": "TagCount", + "value": "1" + } + ], + "metadata": [ + { + "key": "mKey1", + "value": "mValue1" + } + ], + "tags": [ + { + "key": "tKey1", + "value": "tValue1" + } + ], + "matchedBlock": "If" + }, { + "name": "folder2/file1.txt", + "properties": [ + { + "key": "Creation-Time", + "value": "Wed, 06 Jun 2023 05:23:29 GMT" + }, + { + "key": "Last-Modified", + "value": "Wed, 06 Jun 2023 05:23:29 GMT" + }, + { + "key": "Etag", + "value": "0x6FB67175454D36D" + } + ], + "metadata": [ + { + "key": "mKey2", + "value": "mValue2" + } + ], + "tags": [ + { + "key": "tKey2", + "value": "tValue2" + } + ], + "matchedBlock": "Else" + }} +ContainerMetadata : {{ + "key": "mContainerKey1", + "value": "mContainerValue1" + }} +ContainerName : firstContainer +IfCondition : [[equals(AccessTier, 'Hot')]] ``` -{{ Add description here }} +This command runs the input conditions against input object metadata properties and designates matched objects. diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md index 0371f56c36d2..45a61b4e1a35 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewBlobPropertiesObject.md @@ -1,22 +1,27 @@ -### Example 1: {{ Add title here }} +### Example 1: Create blob property object ```powershell -{{ Add code here }} +$creationTime = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" +$metadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey1" -Value "mValue1" +$tags = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey1" -Value "tValue1" +New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Property $creationTime -Tag $tags ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +MatchedBlock : +Metadata : {{ + "key": "mKey1", + "value": "mValue1" + }} +Name : folder1/file1.txt +Property : {{ + "key": "Creation-Time", + "value": "Wed, 07 Jun 2023 05:23:29 GMT" + }} +Tag : {{ + "key": "tKey1", + "value": "tValue1" + }} ``` -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} +This command create a blob property object. diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md index 0371f56c36d2..64ea749477e1 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.md @@ -1,22 +1,13 @@ -### Example 1: {{ Add title here }} +### Example 1: Create key and value property ```powershell -{{ Add code here }} +New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" ``` ```output -{{ Add output here (remove the output block if the example doesn't have an output) }} +Key Value +--- ----- +Creation-Time Wed, 07 Jun 2023 05:23:29 GMT ``` -{{ Add description here }} - -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} +This command create a key-value property object. diff --git a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md index d84f09c23300..fede44e9b24f 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md @@ -46,14 +46,3 @@ Type : Microsoft.StorageActions/storageTasks This command updates storage action task. -### Example 2: {{ Add title here }} -```powershell -{{ Add code here }} -``` - -```output -{{ Add output here (remove the output block if the example doesn't have an output) }} -``` - -{{ Add description here }} - diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 deleted file mode 100644 index 769526323dbe..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTask.Tests.ps1 +++ /dev/null @@ -1,33 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionStorageTask')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionStorageTask.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'Get-AzStorageActionStorageTask' { - It 'List' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'Get' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'List1' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'GetViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 deleted file mode 100644 index 888b4a32f174..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTaskAssignment.Tests.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionStorageTaskAssignment')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionStorageTaskAssignment.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'Get-AzStorageActionStorageTaskAssignment' { - It 'List' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 deleted file mode 100644 index 029fa11da83f..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionStorageTasksReport.Tests.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionStorageTasksReport')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzStorageActionStorageTasksReport.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'Get-AzStorageActionStorageTasksReport' { - It 'List' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 index 27a1e334e17e..b93002f7d74c 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 @@ -15,16 +15,25 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTask')) } Describe 'Get-AzStorageActionTask' { - It 'List' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'List' { + { + $list_sub = Get-AzStorageActionTask + $list_sub | Should -BeGreaterThan 1 + } | Should -Not -Throw } - It 'Get' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'Get' { + { + $task = Get-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test + $task.Name | Should -Be mytask1 + } | Should -Not -Throw } - It 'List1' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'List1' { + { + $list_group = Get-AzStorageActionTask -ResourceGroupName ps1-test + $list_group | Should -BeGreaterThan 1 + } | Should -Not -Throw } It 'GetViaIdentity' -skip { diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 index 58def343ece8..1873470620b8 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 @@ -15,7 +15,10 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTaskAssign } Describe 'Get-AzStorageActionTaskAssignment' { - It 'List' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'List' { + { + $assignment = Get-AzStorageActionTaskAssignment -ResourceGroupName joyer-test -StorageTaskName mytask1 + $assignment.count | Should -BeGreaterThan 1 + } | Should -Not -Throw } } diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 index e32a9c1bbba7..22fe5aa8a0cc 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 @@ -15,7 +15,10 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTasksRepor } Describe 'Get-AzStorageActionTasksReport' { - It 'List' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'List' { + { + $report = Get-AzStorageActionTasksReport -ResourceGroupName joyer-test -StorageTaskName mytask1 + $report.count | Should -BeGreaterThan 1 + } | Should -Not -Throw } } diff --git a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 deleted file mode 100644 index 75ff8b8d95cb..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionPreviewStorageTaskAction.Tests.ps1 +++ /dev/null @@ -1,41 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzStorageActionPreviewStorageTaskAction')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Invoke-AzStorageActionPreviewStorageTaskAction.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'Invoke-AzStorageActionPreviewStorageTaskAction' { - It 'PreviewExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'PreviewViaJsonString' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'PreviewViaJsonFilePath' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'Preview' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'PreviewViaIdentityExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'PreviewViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 index 2870a3f6314d..efa26ca336eb 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 @@ -16,7 +16,39 @@ if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzStorageActionTaskPre Describe 'Invoke-AzStorageActionTaskPreviewAction' { It 'PreviewExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + { + $creationTime = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" + $lastModified = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Last-Modified" -Value "Wed, 07 Jun 2023 05:23:29 GMT" + $etag = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Etag" -Value "0x8DB67175454D36D" + $contentLength = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Length" -Value "38619" + $contentType = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Type" -Value "text/xml" + $contentEncoding = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Encoding" -Value "" + $contentLanguage = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Language" -Value "" + $contentCRC64 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-CRC64" -Value "" + $contentMD5 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-MD5" -Value "njr6iDrmU9+FC89WMK22EA==" + $cacheControl = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Cache-Control" -Value "" + $contentDisposition = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Content-Disposition" -Value "" + $blobType = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "BlobType" -Value "BlockBlob" + $accessTier = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "AccessTier" -Value "Hot" + $accessTierInferred = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "AccessTierInferred" -Value "true" + $leaseStatus = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "LeaseStatus" -Value "unlocked" + $leaseState = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "LeaseState" -Value "available" + $serverEncrypted = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "ServerEncrypted" -Value "true" + $tagCount = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "TagCount" -Value "1" + $metadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey1" -Value "mValue1" + $tags = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey1" -Value "tValue1" + $blob1 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Property $creationTime,$lastModified,$etag,$contentLength,$contentType,$contentEncoding,$contentLanguage,$contentCRC64,$contentMD5,$cacheControl,$contentDisposition,$blobType,$accessTier,$accessTierInferred,$leaseStatus,$leaseState,$serverEncrypted,$tagCount -Tag $tags + + $creationTime2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 06 Jun 2023 05:23:29 GMT" + $lastModified2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Last-Modified" -Value "Wed, 06 Jun 2023 05:23:29 GMT" + $etag2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Etag" -Value "0x6FB67175454D36D" + $metadata2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey2" -Value "mValue2" + $tags2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey2" -Value "tValue2" + $blob2 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder2/file1.txt' -Metadata $metadata2 -Property $creationTime2,$lastModified2,$etag2 -Tag $tags2 + + $conmetadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mContainerKey1" -Value "mContainerValue1" + Invoke-AzStorageActionTaskPreviewAction -Location eastus2euap -ActionElseBlockExist -Blob $blob1,$blob2 -ContainerMetadata $conmetadata -ContainerName firstContainer -IfCondition "[[equals(AccessTier, 'Hot')]]" + } | Should -Not -Throw } It 'PreviewViaJsonString' -skip { @@ -27,15 +59,7 @@ Describe 'Invoke-AzStorageActionTaskPreviewAction' { { throw [System.NotImplementedException] } | Should -Not -Throw } - It 'Preview' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - It 'PreviewViaIdentityExpanded' -skip { { throw [System.NotImplementedException] } | Should -Not -Throw } - - It 'PreviewViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } } diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 deleted file mode 100644 index 42c88780f86b..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTask.Tests.ps1 +++ /dev/null @@ -1,41 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionStorageTask')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionStorageTask.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'New-AzStorageActionStorageTask' { - It 'CreateExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'CreateViaJsonString' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'CreateViaJsonFilePath' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'Create' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'CreateViaIdentityExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'CreateViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 deleted file mode 100644 index b8c86e765cb3..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Tests.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionStorageTaskPreviewBlobPropertiesObject')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionStorageTaskPreviewBlobPropertiesObject.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'New-AzStorageActionStorageTaskPreviewBlobPropertiesObject' { - It '__AllParameterSets' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 deleted file mode 100644 index 0a9ea8ed4475..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Tests.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'New-AzStorageActionStorageTaskPreviewKeyValuePropertiesObject' { - It '__AllParameterSets' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 index e24d26e797ce..244e34939f46 100644 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 @@ -16,7 +16,10 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTask')) Describe 'New-AzStorageActionTask' { It 'CreateExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + { + $ifOperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue + New-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None + } | Should -Not -Throw } It 'CreateViaJsonString' -skip { diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 index d0fe1dcffca1..0d212ccb514d 100644 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskOperationObject.Tests.ps1 @@ -15,7 +15,9 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTaskOperat } Describe 'New-AzStorageActionTaskOperationObject' { - It '__AllParameterSets' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It '__AllParameterSets' { + { + New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue + } | Should -Not -Throw } } diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 index a9623592dbe7..e39e6c80ad20 100644 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewBlobPropertiesObject.Tests.ps1 @@ -15,7 +15,12 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTaskPrevie } Describe 'New-AzStorageActionTaskPreviewBlobPropertiesObject' { - It '__AllParameterSets' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It '__AllParameterSets' { + { + $creationTime = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" + $metadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey1" -Value "mValue1" + $tags = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey1" -Value "tValue1" + New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Property $creationTime -Tag $tags + } | Should -Not -Throw } } diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 index 58a30ab1e327..9e73d1730a6f 100644 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTaskPreviewKeyValuePropertiesObject.Tests.ps1 @@ -15,7 +15,9 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTaskPrevie } Describe 'New-AzStorageActionTaskPreviewKeyValuePropertiesObject' { - It '__AllParameterSets' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It '__AllParameterSets' { + { + New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Etag" -Value "0x6FB67175454D36D" + } | Should -Not -Throw } } diff --git a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 deleted file mode 100644 index 0f6e3a518eee..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionStorageTask.Tests.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzStorageActionStorageTask')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzStorageActionStorageTask.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'Remove-AzStorageActionStorageTask' { - It 'Delete' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'DeleteViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 index 8e5027d2af76..454791a6f44a 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 @@ -15,8 +15,10 @@ if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzStorageActionTask')) } Describe 'Remove-AzStorageActionTask' { - It 'Delete' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'Delete' { + { + Remove-AzStorageActionTask -Name mytask2 -ResourceGroupName joyer-test + } | Should -Not -Throw } It 'DeleteViaIdentity' -skip { diff --git a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 deleted file mode 100644 index 2e5a0c40cfc0..000000000000 --- a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionStorageTask.Tests.ps1 +++ /dev/null @@ -1,41 +0,0 @@ -if(($null -eq $TestName) -or ($TestName -contains 'Update-AzStorageActionStorageTask')) -{ - $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' - if (-Not (Test-Path -Path $loadEnvPath)) { - $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' - } - . ($loadEnvPath) - $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzStorageActionStorageTask.Recording.json' - $currentPath = $PSScriptRoot - while(-not $mockingPath) { - $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File - $currentPath = Split-Path -Path $currentPath -Parent - } - . ($mockingPath | Select-Object -First 1).FullName -} - -Describe 'Update-AzStorageActionStorageTask' { - It 'UpdateExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'UpdateViaJsonString' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'UpdateViaJsonFilePath' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'Update' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'UpdateViaIdentityExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - - It 'UpdateViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } -} diff --git a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 index 7ac6e782e864..be1f0ff61b5a 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 @@ -15,8 +15,11 @@ if(($null -eq $TestName) -or ($TestName -contains 'Update-AzStorageActionTask')) } Describe 'Update-AzStorageActionTask' { - It 'UpdateExpanded' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw + It 'UpdateExpanded' { + { + $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue + Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation + } | Should -Not -Throw } It 'UpdateViaJsonString' -skip { @@ -27,15 +30,7 @@ Describe 'Update-AzStorageActionTask' { { throw [System.NotImplementedException] } | Should -Not -Throw } - It 'Update' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - It 'UpdateViaIdentityExpanded' -skip { { throw [System.NotImplementedException] } | Should -Not -Throw } - - It 'UpdateViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } } diff --git a/src/StorageAction/StorageAction.Autorest/test/utils.ps1 b/src/StorageAction/StorageAction.Autorest/test/utils.ps1 index f8497fbd7da0..6cda0bb897de 100644 --- a/src/StorageAction/StorageAction.Autorest/test/utils.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/utils.ps1 @@ -44,6 +44,10 @@ function setupEnv() { $env.SubscriptionId = (Get-AzContext).Subscription.Id $env.Tenant = (Get-AzContext).Tenant.Id # For any resources you created for test, you should add it to $env here. + + $ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue + New-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None + $envFile = 'env.json' if ($TestMode -eq 'live') { $envFile = 'localEnv.json' From 2e915a482411b6340dbd8f51bf3eab6f3df13aea Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 7 May 2024 14:31:12 +0800 Subject: [PATCH 03/10] Storage Action test added --- .../StorageAction.Autorest/README.md | 16 +- .../docs/Az.StorageAction.md | 6 +- .../docs/Get-AzStorageActionTask.md | 1 - ...Invoke-AzStorageActionTaskPreviewAction.md | 3 - .../docs/New-AzStorageActionTask.md | 139 +++++++----- .../New-AzStorageActionTaskOperationObject.md | 1 - ...geActionTaskPreviewBlobPropertiesObject.md | 3 - .../docs/Remove-AzStorageActionTask.md | 1 - .../docs/Update-AzStorageActionTask.md | 203 +++++++++++------- .../examples/New-AzStorageActionTask.md | 110 +++++++++- .../examples/Update-AzStorageActionTask.md | 96 ++++++++- .../Get-AzStorageActionTask.Recording.json | 131 +++++++++++ .../test/Get-AzStorageActionTask.Tests.ps1 | 10 +- ...StorageActionTaskAssignment.Recording.json | 45 ++++ ...et-AzStorageActionTaskAssignment.Tests.ps1 | 2 +- ...-AzStorageActionTasksReport.Recording.json | 45 ++++ .../Get-AzStorageActionTasksReport.Tests.ps1 | 2 +- ...rageActionTaskPreviewAction.Recording.json | 40 ++++ ...AzStorageActionTaskPreviewAction.Tests.ps1 | 6 +- .../New-AzStorageActionTask.Recording.json | 129 +++++++++++ .../test/New-AzStorageActionTask.Tests.ps1 | 15 +- .../Remove-AzStorageActionTask.Recording.json | 132 ++++++++++++ .../test/Remove-AzStorageActionTask.Tests.ps1 | 2 +- .../Update-AzStorageActionTask.Recording.json | 172 +++++++++++++++ .../test/Update-AzStorageActionTask.Tests.ps1 | 4 +- .../StorageAction.Autorest/test/env.json | 9 + .../StorageAction.Autorest/test/loadEnv.ps1 | 2 +- .../StorageAction.Autorest/test/utils.ps1 | 33 ++- .../utils/Get-SubscriptionIdTestSafe.ps1 | 7 + 29 files changed, 1180 insertions(+), 185 deletions(-) create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Recording.json create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Recording.json create mode 100644 src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Recording.json create mode 100644 src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Recording.json create mode 100644 src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Recording.json create mode 100644 src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Recording.json create mode 100644 src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Recording.json create mode 100644 src/StorageAction/StorageAction.Autorest/test/env.json create mode 100644 src/StorageAction/StorageAction.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 diff --git a/src/StorageAction/StorageAction.Autorest/README.md b/src/StorageAction/StorageAction.Autorest/README.md index 626a1f702a6b..4fd4104b014f 100644 --- a/src/StorageAction/StorageAction.Autorest/README.md +++ b/src/StorageAction/StorageAction.Autorest/README.md @@ -3,9 +3,6 @@ This directory contains the PowerShell module for the StorageAction service. --- -## Status -[![Az.StorageAction](https://img.shields.io/powershellgallery/v/Az.StorageAction.svg?style=flat-square&label=Az.StorageAction "Az.StorageAction")](https://www.powershellgallery.com/packages/Az.StorageAction/) - ## Info - Modifiable: yes - Generated: all @@ -32,6 +29,7 @@ For information on how to develop for `Az.StorageAction`, see [how-to.md](how-to ```yaml # pin the swagger version by using the commit id instead of branch name commit: 13f09225c7d1cf42c55536e41c090bb8438cebd7 +tag: package-2023-01-01 require: # readme.azure.noprofile.md is the common configuration file - $(this-folder)/../../readme.azure.noprofile.md @@ -54,6 +52,9 @@ title: StorageAction subject-prefix: $(service-name) directive: + - from: swagger-document + where: $.definitions.StorageTask + transform: $['required'] = ['identity','properties'] # # Following are common directives which are normally required in all the RPs # # 1. Remove the unexpanded parameter set # # 2. For New-* cmdlets, ViaIdentity is not required @@ -61,6 +62,10 @@ directive: - where: variant: ^(Create|Update|Preview)(?!.*?(Expanded|JsonFilePath|JsonString)) remove: true + - where: + variant: ^CreateViaIdentity.*$ + remove: true + # Rename commands - where: subject: StorageTask set: @@ -78,6 +83,7 @@ directive: subject: StorageTasksReport set: subject: TasksReport + # Add model - model-cmdlet: - model-name: StorageTaskOperation cmdlet-name: New-AzStorageActionTaskOperationObject @@ -85,8 +91,4 @@ directive: cmdlet-name: New-AzStorageActionTaskPreviewBlobPropertiesObject - model-name: StorageTaskPreviewKeyValueProperties cmdlet-name: New-AzStorageActionTaskPreviewKeyValuePropertiesObject - - where: - parameter-name: IdentityUserAssignedIdentity - set: - parameter-name: UserAssignedIdentity ``` diff --git a/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md b/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md index 6e2fa1ff1bc5..f135f654b23a 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md @@ -26,7 +26,7 @@ Runs the input conditions against input object metadata properties and designate ### [New-AzStorageActionTask](New-AzStorageActionTask.md) Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. -If a storage task is already created and a subsequent Create request is issued with the exact same set of properties, the request will succeed. +If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. ### [New-AzStorageActionTaskOperationObject](New-AzStorageActionTaskOperationObject.md) Create an in-memory object for StorageTaskOperation. @@ -41,5 +41,7 @@ Create an in-memory object for StorageTaskPreviewKeyValueProperties. Delete the storage task resource. ### [Update-AzStorageActionTask](Update-AzStorageActionTask.md) -Update storage task properties +Asynchronously creates a new storage task resource with the specified parameters. +If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. +If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md index 9fa7d76e1d07..3384a00b4c8f 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md @@ -119,7 +119,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity diff --git a/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md index 0e39a136331d..74a57245516b 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md @@ -229,7 +229,6 @@ Accept wildcard characters: False ### -Blob Preview action container properties to be tested for a match with the provided condition. -To construct, see NOTES section for BLOB properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewBlobProperties[] @@ -245,7 +244,6 @@ Accept wildcard characters: False ### -ContainerMetadata metadata key value pairs to be tested for a match against the provided condition. -To construct, see NOTES section for CONTAINERMETADATA properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] @@ -307,7 +305,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md index e77b02ef0785..f60db59f91e1 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -10,27 +10,19 @@ schema: 2.0.0 ## SYNOPSIS Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. -If a storage task is already created and a subsequent Create request is issued with the exact same set of properties, the request will succeed. +If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. ## SYNTAX ### CreateExpanded (Default) ``` -New-AzStorageActionTask -Name -ResourceGroupName -Location - [-SubscriptionId ] [-Description ] [-ElseOperation ] [-Enabled] - [-IdentityType ] [-IfCondition ] [-IfOperation ] [-Tag ] - [-UserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] +New-AzStorageActionTask -Name -ResourceGroupName -Description -Enabled + -IfCondition -IfOperation -Location [-SubscriptionId ] + [-ElseOperation ] [-EnableSystemAssignedIdentity] [-Tag ] + [-UserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` -### CreateViaIdentityExpanded -``` -New-AzStorageActionTask -InputObject -Location [-Description ] - [-ElseOperation ] [-Enabled] [-IdentityType ] [-IfCondition ] - [-IfOperation ] [-Tag ] [-UserAssignedIdentity ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] -``` - ### CreateViaJsonFilePath ``` New-AzStorageActionTask -Name -ResourceGroupName -JsonFilePath @@ -48,14 +40,14 @@ New-AzStorageActionTask -Name -ResourceGroupName -JsonString < ## DESCRIPTION Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. -If a storage task is already created and a subsequent Create request is issued with the exact same set of properties, the request will succeed. +If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. ## EXAMPLES ### Example 1: Create storage task with if operation ```powershell $ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue -New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None +New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation ``` ```output @@ -97,6 +89,58 @@ Type : Microsoft.StorageActions/storageTasks The first command creates a if operation object. The second command creates a storage task. +### Example 2: Create storage task with if and else operation +```powershell +$ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Cool"} -OnFailure break -OnSuccess continue +$elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue +New-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 3' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -EnableSystemAssignedIdentity +``` + +```output +CreationTimeInUtc : 4/12/2024 9:56:05 AM +Description : my storage task 3 +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk3 +IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : SystemAssigned +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Cool" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask3 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +The first command creates a if operation object. +The second command creates a else operation object. +This third command creates a storage task. + ## PARAMETERS ### -AsJob @@ -135,10 +179,10 @@ Text that describes the purpose of the storage task ```yaml Type: System.String -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Parameter Sets: CreateExpanded Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -147,11 +191,10 @@ Accept wildcard characters: False ### -ElseOperation List of operations to execute in the else block -To construct, see NOTES section for ELSEOPERATION properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Parameter Sets: CreateExpanded Aliases: Required: False @@ -166,22 +209,22 @@ Storage Task is enabled when set to true and disabled when set to false ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Parameter Sets: CreateExpanded Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -IdentityType -Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +### -EnableSystemAssignedIdentity +Decides if enable a system assigned identity for the resource. ```yaml -Type: System.String -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Type: System.Management.Automation.SwitchParameter +Parameter Sets: CreateExpanded Aliases: Required: False @@ -196,10 +239,10 @@ The condition predicate which is composed of object properties, eg: blob and con ```yaml Type: System.String -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Parameter Sets: CreateExpanded Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -208,33 +251,16 @@ Accept wildcard characters: False ### -IfOperation List of operations to execute when the condition predicate satisfies. -To construct, see NOTES section for IFOPERATION properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -InputObject -Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. - -```yaml -Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity -Parameter Sets: CreateViaIdentityExpanded +Parameter Sets: CreateExpanded Aliases: Required: True Position: Named Default value: None -Accept pipeline input: True (ByValue) +Accept pipeline input: False Accept wildcard characters: False ``` @@ -273,7 +299,7 @@ The geo-location where the resource lives ```yaml Type: System.String -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Parameter Sets: CreateExpanded Aliases: Required: True @@ -289,7 +315,7 @@ Storage task names must be between 3 and 18 characters in length and use numbers ```yaml Type: System.String -Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString +Parameter Sets: (All) Aliases: StorageTaskName Required: True @@ -320,7 +346,7 @@ The name is case insensitive. ```yaml Type: System.String -Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString +Parameter Sets: (All) Aliases: Required: True @@ -336,7 +362,7 @@ The value must be an UUID. ```yaml Type: System.String -Parameter Sets: CreateExpanded, CreateViaJsonFilePath, CreateViaJsonString +Parameter Sets: (All) Aliases: Required: False @@ -351,7 +377,7 @@ Resource tags. ```yaml Type: System.Collections.Hashtable -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Parameter Sets: CreateExpanded Aliases: Required: False @@ -362,13 +388,12 @@ Accept wildcard characters: False ``` ### -UserAssignedIdentity -The set of user assigned identities associated with the resource. -The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. -The dictionary values can be empty objects ({}) in requests. +The array of user assigned identities associated with the resource. +The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' ```yaml -Type: System.Collections.Hashtable -Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Type: System.String[] +Parameter Sets: CreateExpanded Aliases: Required: False @@ -414,8 +439,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity - ## OUTPUTS ### Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTask diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md index 9c9fabc53650..55094f02af82 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskOperationObject.md @@ -87,7 +87,6 @@ Accept wildcard characters: False ### -Parameter Key-value parameters for the operation. -To construct, see NOTES section for PARAMETER properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperationParameters diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md index 329df6ba8886..4153c6d040ed 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md @@ -54,7 +54,6 @@ This command create a blob property object. ### -Metadata metadata key value pairs to be tested for a match against the provided condition. -To construct, see NOTES section for METADATA properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] @@ -85,7 +84,6 @@ Accept wildcard characters: False ### -Property properties key value pairs to be tested for a match against the provided condition. -To construct, see NOTES section for PROPERTY properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] @@ -101,7 +99,6 @@ Accept wildcard characters: False ### -Tag tags key value pairs to be tested for a match against the provided condition. -To construct, see NOTES section for TAG properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewKeyValueProperties[] diff --git a/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md index c7b4e4357469..16c43119d2e7 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md @@ -71,7 +71,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity diff --git a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md index 99bf6445877c..f5e91e200422 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md @@ -8,50 +8,41 @@ schema: 2.0.0 # Update-AzStorageActionTask ## SYNOPSIS -Update storage task properties +Asynchronously creates a new storage task resource with the specified parameters. +If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. +If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. ## SYNTAX ### UpdateExpanded (Default) ``` Update-AzStorageActionTask -Name -ResourceGroupName [-SubscriptionId ] - [-Description ] [-ElseOperation ] [-Enabled] [-IdentityType ] - [-IfCondition ] [-IfOperation ] [-Tag ] - [-UserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] - [] + [-Description ] [-ElseOperation ] [-Enabled] + [-EnableSystemAssignedIdentity ] [-IfCondition ] [-IfOperation ] + [-Tag ] [-UserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] ``` ### UpdateViaIdentityExpanded ``` Update-AzStorageActionTask -InputObject [-Description ] - [-ElseOperation ] [-Enabled] [-IdentityType ] [-IfCondition ] - [-IfOperation ] [-Tag ] [-UserAssignedIdentity ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] -``` - -### UpdateViaJsonFilePath -``` -Update-AzStorageActionTask -Name -ResourceGroupName -JsonFilePath - [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] - [] -``` - -### UpdateViaJsonString -``` -Update-AzStorageActionTask -Name -ResourceGroupName -JsonString - [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] + [-ElseOperation ] [-Enabled] [-EnableSystemAssignedIdentity ] + [-IfCondition ] [-IfOperation ] [-Tag ] + [-UserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` ## DESCRIPTION -Update storage task properties +Asynchronously creates a new storage task resource with the specified parameters. +If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. +If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. ## EXAMPLES ### Example 1: Update storage action task with conditions ```powershell $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -ElseOperation $elseoperation ``` ```output @@ -96,6 +87,99 @@ Type : Microsoft.StorageActions/storageTasks This command updates storage action task. +### Example 2: Update storage action task with conditions +```powershell +$ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue +Update-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation +``` + +```output +CreationTimeInUtc : 4/12/2024 9:56:05 AM +Description : my storage task 3 +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk3 +IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : SystemAssigned +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Hot')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask3 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command updates storage action task. + +### Example 3: Update storage action task with system assigned +```powershell +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -EnableSystemAssignedIdentity 1 +``` + +```output +CreationTimeInUtc : 2/27/2024 6:48:18 AM +Description : my storage task +ElseOperation : +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk1 +IdentityPrincipalId : 66aefa04-060e-4eeb-9342-7228e31d1596 +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : SystemAssigned +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command updates storage action task. + ## PARAMETERS ### -AsJob @@ -134,7 +218,7 @@ Text that describes the purpose of the storage task ```yaml Type: System.String -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Parameter Sets: (All) Aliases: Required: False @@ -146,11 +230,10 @@ Accept wildcard characters: False ### -ElseOperation List of operations to execute in the else block -To construct, see NOTES section for ELSEOPERATION properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Parameter Sets: (All) Aliases: Required: False @@ -165,7 +248,7 @@ Storage Task is enabled when set to true and disabled when set to false ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Parameter Sets: (All) Aliases: Required: False @@ -175,12 +258,12 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -IdentityType -Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +### -EnableSystemAssignedIdentity +Decides if enable a system assigned identity for the resource. ```yaml -Type: System.String -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Type: System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] +Parameter Sets: (All) Aliases: Required: False @@ -195,7 +278,7 @@ The condition predicate which is composed of object properties, eg: blob and con ```yaml Type: System.String -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Parameter Sets: (All) Aliases: Required: False @@ -207,11 +290,10 @@ Accept wildcard characters: False ### -IfOperation List of operations to execute when the condition predicate satisfies. -To construct, see NOTES section for IFOPERATION properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskOperation[] -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Parameter Sets: (All) Aliases: Required: False @@ -223,7 +305,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageActionIdentity @@ -237,43 +318,13 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -JsonFilePath -Path of Json file supplied to the Update operation - -```yaml -Type: System.String -Parameter Sets: UpdateViaJsonFilePath -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -JsonString -Json string supplied to the Update operation - -```yaml -Type: System.String -Parameter Sets: UpdateViaJsonString -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Name The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. ```yaml Type: System.String -Parameter Sets: UpdateExpanded, UpdateViaJsonFilePath, UpdateViaJsonString +Parameter Sets: UpdateExpanded Aliases: StorageTaskName Required: True @@ -304,7 +355,7 @@ The name is case insensitive. ```yaml Type: System.String -Parameter Sets: UpdateExpanded, UpdateViaJsonFilePath, UpdateViaJsonString +Parameter Sets: UpdateExpanded Aliases: Required: True @@ -320,7 +371,7 @@ The value must be an UUID. ```yaml Type: System.String -Parameter Sets: UpdateExpanded, UpdateViaJsonFilePath, UpdateViaJsonString +Parameter Sets: UpdateExpanded Aliases: Required: False @@ -331,14 +382,11 @@ Accept wildcard characters: False ``` ### -Tag -Gets or sets a list of key value pairs that describe the resource. -These tags can be used in viewing and grouping this resource (across resource groups). -A maximum of 15 tags can be provided for a resource. -Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. +Resource tags. ```yaml Type: System.Collections.Hashtable -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Parameter Sets: (All) Aliases: Required: False @@ -349,13 +397,12 @@ Accept wildcard characters: False ``` ### -UserAssignedIdentity -The set of user assigned identities associated with the resource. -The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. -The dictionary values can be empty objects ({}) in requests. +The array of user assigned identities associated with the resource. +The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.' ```yaml -Type: System.Collections.Hashtable -Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded +Type: System.String[] +Parameter Sets: (All) Aliases: Required: False diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md index ecbe573dc7d6..f6d42a3115cc 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md @@ -1,7 +1,7 @@ ### Example 1: Create storage task with if operation ```powershell $ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue -New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None +New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation ``` ```output @@ -40,4 +40,110 @@ TaskVersion : 1 Type : Microsoft.StorageActions/storageTasks ``` -The first command creates a if operation object. The second command creates a storage task. \ No newline at end of file +The first command creates a if operation object. The second command creates a storage task. + +### Example 2: Create storage task with user assign identity +```powershell +$ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue +$elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue +$mi = New-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName joyer-test -Location eastus2euap +New-AzStorageActionTask -Name mytask2 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 2' -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -UserAssignedIdentity $mi.Id +``` + +```output +CreationTimeInUtc : 5/6/2024 9:41:50 AM +Description : my storage task 2 +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk2 +IdentityPrincipalId : +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : UserAssigned +IdentityUserAssignedIdentity : { + "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/Microsoft.ManagedIdentity/userAssignedI + dentities/testUserAssignedMI": { + } + } +IfCondition : [[equals(AccessTier, 'Hot')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask2 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +The first command creates a if operation object. The second command creates a else operation object. This third command creates a storage task. + + +### Example 3: Create storage task with if and else operation +```powershell +$ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Cool"} -OnFailure break -OnSuccess continue +$elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue +New-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 3' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -EnableSystemAssignedIdentity +``` + +```output +CreationTimeInUtc : 4/12/2024 9:56:05 AM +Description : my storage task 3 +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk3 +IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : SystemAssigned +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Cool" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask3 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +The first command creates a if operation object. The second command creates a else operation object. This third command creates a storage task. + diff --git a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md index fede44e9b24f..ab649efb5fb9 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md @@ -1,7 +1,7 @@ ### Example 1: Update storage action task with conditions ```powershell $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -ElseOperation $elseoperation ``` ```output @@ -46,3 +46,97 @@ Type : Microsoft.StorageActions/storageTasks This command updates storage action task. + +### Example 2: Update storage action task with conditions +```powershell +$ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue +Update-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation +``` + +```output +CreationTimeInUtc : 4/12/2024 9:56:05 AM +Description : my storage task 3 +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk3 +IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : SystemAssigned +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Hot')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask3 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command updates storage action task. + + +### Example 3: Update storage action task with system assigned +```powershell +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -EnableSystemAssignedIdentity 1 +``` + +```output +CreationTimeInUtc : 2/27/2024 6:48:18 AM +Description : my storage task +ElseOperation : +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk1 +IdentityPrincipalId : 66aefa04-060e-4eeb-9342-7228e31d1596 +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : SystemAssigned +IdentityUserAssignedIdentity : { + } +IfCondition : [[equals(AccessTier, 'Cool')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask1 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +This command updates storage action task. \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Recording.json b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Recording.json new file mode 100644 index 000000000000..f38c13519a2d --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Recording.json @@ -0,0 +1,131 @@ +{ + "Get-AzStorageActionTask+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/storageTasks?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/storageTasks?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "66d4a541-de3a-467c-bb96-516d40694800" ], + "CommandName": [ "Get-AzStorageActionTask" ], + "FullCommandName": [ "Get-AzStorageActionTask_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "434f2e65-6dd5-474e-b46a-acc4b7f551f1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "f0d749c8-83b2-415d-b441-39356a6a7036" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083704Z:f0d749c8-83b2-415d-b441-39356a6a7036" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 028B0C8F873A4E1F9886D64B1781A553 Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:04Z" ], + "Date": [ "Mon, 06 May 2024 08:37:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1334" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1\",\"name\":\"mytask1\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"principalId\":\"66aefa04-060e-4eeb-9342-7228e31d1596\",\"tenantId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\",\"type\":\"SystemAssigned\"},\"properties\":{\"enabled\":true,\"description\":\"my storage task\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-02-27T06:48:18.8550828Z\"}},{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1\",\"name\":\"storageactiontest1\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"type\":\"None\"},\"properties\":{\"enabled\":true,\"description\":\"test storage task 1\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-05-06T08:36:44.1658106Z\"}}]}", + "isContentBase64": false + } + }, + "Get-AzStorageActionTask+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "828fbd6f-1b64-45bc-9782-fa0708082f6b" ], + "CommandName": [ "Get-AzStorageActionTask" ], + "FullCommandName": [ "Get-AzStorageActionTask_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "8b0f2906-9295-43fa-a501-0536faf1db20" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "9c4e3622-1a04-4ae9-a538-b214cd37c77c" ], + "x-ms-routing-request-id": [ "MALAYSIASOUTH:20240506T083706Z:9c4e3622-1a04-4ae9-a538-b214cd37c77c" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: BACB4B7679DD42FA83EA5575E1E751FE Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:05Z" ], + "Date": [ "Mon, 06 May 2024 08:37:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "617" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1\",\"name\":\"storageactiontest1\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"type\":\"None\"},\"properties\":{\"enabled\":true,\"description\":\"test storage task 1\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-05-06T08:36:44.1658106Z\"}}", + "isContentBase64": false + } + }, + "Get-AzStorageActionTask+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "e2fd7aec-d456-48a2-b24b-bc1a07cec259" ], + "CommandName": [ "Get-AzStorageActionTask" ], + "FullCommandName": [ "Get-AzStorageActionTask_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "9c6593a6-8f70-44d8-9338-0d7e58c50d8c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "268ad373-ced0-4e30-9a4e-fe01695f141a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083707Z:268ad373-ced0-4e30-9a4e-fe01695f141a" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 03288B1E00504290B855F861A53368EE Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:06Z" ], + "Date": [ "Mon, 06 May 2024 08:37:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1334" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1\",\"name\":\"mytask1\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"principalId\":\"66aefa04-060e-4eeb-9342-7228e31d1596\",\"tenantId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\",\"type\":\"SystemAssigned\"},\"properties\":{\"enabled\":true,\"description\":\"my storage task\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-02-27T06:48:18.8550828Z\"}},{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1\",\"name\":\"storageactiontest1\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"type\":\"None\"},\"properties\":{\"enabled\":true,\"description\":\"test storage task 1\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-05-06T08:36:44.1658106Z\"}}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 index b93002f7d74c..b126dc36f9f5 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTask.Tests.ps1 @@ -18,21 +18,21 @@ Describe 'Get-AzStorageActionTask' { It 'List' { { $list_sub = Get-AzStorageActionTask - $list_sub | Should -BeGreaterThan 1 + $list_sub.count | Should -BeGreaterThan 1 } | Should -Not -Throw } It 'Get' { { - $task = Get-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test - $task.Name | Should -Be mytask1 + $task = Get-AzStorageActionTask -Name $env.testTaskName1 -ResourceGroupName $env.resourceGroup + $task.Name | Should -Be $env.testTaskName1 } | Should -Not -Throw } It 'List1' { { - $list_group = Get-AzStorageActionTask -ResourceGroupName ps1-test - $list_group | Should -BeGreaterThan 1 + $list_group = Get-AzStorageActionTask -ResourceGroupName $env.resourceGroup + $list_group.count | Should -BeGreaterThan 1 } | Should -Not -Throw } diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Recording.json b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Recording.json new file mode 100644 index 000000000000..37916d97b9c6 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Recording.json @@ -0,0 +1,45 @@ +{ + "Get-AzStorageActionTaskAssignment+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/storageTaskAssignments?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/storageTaskAssignments?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "488f7a38-9c56-4287-8996-e233c589bb02" ], + "CommandName": [ "Get-AzStorageActionTaskAssignment" ], + "FullCommandName": [ "Get-AzStorageActionTaskAssignment_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "e77e5bde-e091-41f0-b461-f4ad671a0d91" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "f1283ae9-d1ab-4882-8d7c-238d2533758e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083709Z:f1283ae9-d1ab-4882-8d7c-238d2533758e" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F95C1331CA09450C86CBC1506889EE1F Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:07Z" ], + "Date": [ "Mon, 06 May 2024 08:37:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "391" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign1\"},{\"id\":\"subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign2\"}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 index 1873470620b8..76a50d1f6bf1 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTaskAssignment.Tests.ps1 @@ -17,7 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTaskAssign Describe 'Get-AzStorageActionTaskAssignment' { It 'List' { { - $assignment = Get-AzStorageActionTaskAssignment -ResourceGroupName joyer-test -StorageTaskName mytask1 + $assignment = Get-AzStorageActionTaskAssignment -ResourceGroupName $env.resourceGroup -StorageTaskName $env.assignmentTask $assignment.count | Should -BeGreaterThan 1 } | Should -Not -Throw } diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Recording.json b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Recording.json new file mode 100644 index 000000000000..a6861859bdf6 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Recording.json @@ -0,0 +1,45 @@ +{ + "Get-AzStorageActionTasksReport+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "97aafd75-a0e0-495b-9c2a-79ea6650079c" ], + "CommandName": [ "Get-AzStorageActionTasksReport" ], + "FullCommandName": [ "Get-AzStorageActionTasksReport_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "41eac612-7254-45f3-8007-b8ee11793330" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "edf9b87d-0574-48e3-90ae-41a65b6e9895" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083711Z:edf9b87d-0574-48e3-90ae-41a65b6e9895" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 60763A0B02994D08BB4624088241657C Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:09Z" ], + "Date": [ "Mon, 06 May 2024 08:37:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2399" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance1\",\"name\":\"instance1\",\"type\":\"Microsoft.StorageActions/storageTasks/reports\",\"properties\":{\"taskAssignmentId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign1\",\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281\",\"startTime\":\"2024-02-28T10:07:53.0000000Z\",\"finishTime\":\"2024-02-28T10:16:58.9261483Z\",\"objectsTargetedCount\":\"1\",\"objectsOperatedOnCount\":\"0\",\"objectFailedCount\":\"0\",\"objectsSucceededCount\":\"0\",\"runStatusError\":\"0x0\",\"runStatusEnum\":\"Finished\",\"summaryReportPath\":\"https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign1/2024-02-28T10:08:00/SummaryReport.json\",\"taskId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1\",\"taskVersion\":\"1\",\"runResult\":\"Succeeded\"}},{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance2\",\"name\":\"instance2\",\"type\":\"Microsoft.StorageActions/storageTasks/reports\",\"properties\":{\"taskAssignmentId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign2\",\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281\",\"startTime\":\"2024-02-28T10:21:53.0000000Z\",\"finishTime\":\"2024-02-28T10:31:54.7848950Z\",\"objectsTargetedCount\":\"1\",\"objectsOperatedOnCount\":\"0\",\"objectFailedCount\":\"0\",\"objectsSucceededCount\":\"0\",\"runStatusError\":\"0x0\",\"runStatusEnum\":\"Finished\",\"summaryReportPath\":\"https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign2/2024-02-28T10:22:05/SummaryReport.json\",\"taskId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1\",\"taskVersion\":\"1\",\"runResult\":\"Succeeded\"}}]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 index 22fe5aa8a0cc..5137b9e83998 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Get-AzStorageActionTasksReport.Tests.ps1 @@ -17,7 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzStorageActionTasksRepor Describe 'Get-AzStorageActionTasksReport' { It 'List' { { - $report = Get-AzStorageActionTasksReport -ResourceGroupName joyer-test -StorageTaskName mytask1 + $report = Get-AzStorageActionTasksReport -ResourceGroupName $env.resourceGroup -StorageTaskName $env.assignmentTask $report.count | Should -BeGreaterThan 1 } | Should -Not -Throw } diff --git a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Recording.json b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Recording.json new file mode 100644 index 000000000000..b677be3cbe4b --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Recording.json @@ -0,0 +1,40 @@ +{ + "Invoke-AzStorageActionTaskPreviewAction+[NoContext]+PreviewExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/previewActions?api-version=2023-01-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/previewActions?api-version=2023-01-01", + "Content": "{\r\n \"properties\": {\r\n \"container\": {\r\n \"name\": \"firstContainer\",\r\n \"metadata\": [\r\n {\r\n \"key\": \"mContainerKey1\",\r\n \"value\": \"mContainerValue1\"\r\n }\r\n ]\r\n },\r\n \"action\": {\r\n \"if\": {\r\n \"condition\": \"[[equals(AccessTier, \\u0027Hot\\u0027)]]\"\r\n },\r\n \"elseBlockExists\": true\r\n },\r\n \"blobs\": [\r\n {\r\n \"name\": \"folder1/file1.txt\",\r\n \"properties\": [\r\n {\r\n \"key\": \"Creation-Time\",\r\n \"value\": \"Wed, 07 Jun 2023 05:23:29 GMT\"\r\n },\r\n {\r\n \"key\": \"Last-Modified\",\r\n \"value\": \"Wed, 07 Jun 2023 05:23:29 GMT\"\r\n },\r\n {\r\n \"key\": \"Etag\",\r\n \"value\": \"0x8DB67175454D36D\"\r\n },\r\n {\r\n \"key\": \"Content-Length\",\r\n \"value\": \"38619\"\r\n },\r\n {\r\n \"key\": \"Content-Type\",\r\n \"value\": \"text/xml\"\r\n },\r\n {\r\n \"key\": \"Content-Encoding\",\r\n \"value\": \"\"\r\n },\r\n {\r\n \"key\": \"Content-Language\",\r\n \"value\": \"\"\r\n },\r\n {\r\n \"key\": \"Content-CRC64\",\r\n \"value\": \"\"\r\n },\r\n {\r\n \"key\": \"Content-MD5\",\r\n \"value\": \"njr6iDrmU9+FC89WMK22EA==\"\r\n },\r\n {\r\n \"key\": \"Cache-Control\",\r\n \"value\": \"\"\r\n },\r\n {\r\n \"key\": \"Content-Disposition\",\r\n \"value\": \"\"\r\n },\r\n {\r\n \"key\": \"BlobType\",\r\n \"value\": \"BlockBlob\"\r\n },\r\n {\r\n \"key\": \"AccessTier\",\r\n \"value\": \"Hot\"\r\n },\r\n {\r\n \"key\": \"AccessTierInferred\",\r\n \"value\": \"true\"\r\n },\r\n {\r\n \"key\": \"LeaseStatus\",\r\n \"value\": \"unlocked\"\r\n },\r\n {\r\n \"key\": \"LeaseState\",\r\n \"value\": \"available\"\r\n },\r\n {\r\n \"key\": \"ServerEncrypted\",\r\n \"value\": \"true\"\r\n },\r\n {\r\n \"key\": \"TagCount\",\r\n \"value\": \"1\"\r\n }\r\n ],\r\n \"metadata\": [\r\n {\r\n \"key\": \"mKey1\",\r\n \"value\": \"mValue1\"\r\n }\r\n ],\r\n \"tags\": [\r\n {\r\n \"key\": \"tKey1\",\r\n \"value\": \"tValue1\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"folder2/file1.txt\",\r\n \"properties\": [\r\n {\r\n \"key\": \"Creation-Time\",\r\n \"value\": \"Wed, 06 Jun 2023 05:23:29 GMT\"\r\n },\r\n {\r\n \"key\": \"Last-Modified\",\r\n \"value\": \"Wed, 06 Jun 2023 05:23:29 GMT\"\r\n },\r\n {\r\n \"key\": \"Etag\",\r\n \"value\": \"0x6FB67175454D36D\"\r\n }\r\n ],\r\n \"metadata\": [\r\n {\r\n \"key\": \"mKey2\",\r\n \"value\": \"mValue2\"\r\n }\r\n ],\r\n \"tags\": [\r\n {\r\n \"key\": \"tKey2\",\r\n \"value\": \"tValue2\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "3122" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "a834f2c5-dca5-4aca-82e6-7cb8ca9064dd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "d9d440b9-6245-4f23-9de4-5f794dc04b47" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083713Z:d9d440b9-6245-4f23-9de4-5f794dc04b47" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 82B2DA3FB4554A9E9CBA2960F9083FC6 Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:12Z" ], + "Date": [ "Mon, 06 May 2024 08:37:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1492" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"container\":{\"name\":\"firstContainer\",\"metadata\":[{\"key\":\"mContainerKey1\",\"value\":\"mContainerValue1\"}]},\"blobs\":[{\"matchedBlock\":\"If\",\"properties\":[{\"key\":\"Creation-Time\",\"value\":\"Wed, 07 Jun 2023 05:23:29 GMT\"},{\"key\":\"Last-Modified\",\"value\":\"Wed, 07 Jun 2023 05:23:29 GMT\"},{\"key\":\"Etag\",\"value\":\"0x8DB67175454D36D\"},{\"key\":\"Content-Length\",\"value\":\"38619\"},{\"key\":\"Content-Type\",\"value\":\"text/xml\"},{\"key\":\"Content-Encoding\",\"value\":\"\"},{\"key\":\"Content-Language\",\"value\":\"\"},{\"key\":\"Content-CRC64\",\"value\":\"\"},{\"key\":\"Content-MD5\",\"value\":\"njr6iDrmU9+FC89WMK22EA==\"},{\"key\":\"Cache-Control\",\"value\":\"\"},{\"key\":\"Content-Disposition\",\"value\":\"\"},{\"key\":\"BlobType\",\"value\":\"BlockBlob\"},{\"key\":\"AccessTier\",\"value\":\"Hot\"},{\"key\":\"AccessTierInferred\",\"value\":\"true\"},{\"key\":\"LeaseStatus\",\"value\":\"unlocked\"},{\"key\":\"LeaseState\",\"value\":\"available\"},{\"key\":\"ServerEncrypted\",\"value\":\"true\"},{\"key\":\"TagCount\",\"value\":\"1\"}],\"tags\":[{\"key\":\"tKey1\",\"value\":\"tValue1\"}],\"name\":\"folder1/file1.txt\",\"metadata\":[{\"key\":\"mKey1\",\"value\":\"mValue1\"}]},{\"matchedBlock\":\"Else\",\"properties\":[{\"key\":\"Creation-Time\",\"value\":\"Wed, 06 Jun 2023 05:23:29 GMT\"},{\"key\":\"Last-Modified\",\"value\":\"Wed, 06 Jun 2023 05:23:29 GMT\"},{\"key\":\"Etag\",\"value\":\"0x6FB67175454D36D\"}],\"tags\":[{\"key\":\"tKey2\",\"value\":\"tValue2\"}],\"name\":\"folder2/file1.txt\",\"metadata\":[{\"key\":\"mKey2\",\"value\":\"mValue2\"}]}],\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Hot\u0027)]]\"},\"elseBlockExists\":true}},\"isValid\":true,\"errors\":[]}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 index efa26ca336eb..67be4a70b22c 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Invoke-AzStorageActionTaskPreviewAction.Tests.ps1 @@ -15,7 +15,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Invoke-AzStorageActionTaskPre } Describe 'Invoke-AzStorageActionTaskPreviewAction' { - It 'PreviewExpanded' -skip { + It 'PreviewExpanded' { { $creationTime = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 07 Jun 2023 05:23:29 GMT" $lastModified = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Last-Modified" -Value "Wed, 07 Jun 2023 05:23:29 GMT" @@ -37,7 +37,7 @@ Describe 'Invoke-AzStorageActionTaskPreviewAction' { $tagCount = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "TagCount" -Value "1" $metadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mKey1" -Value "mValue1" $tags = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "tKey1" -Value "tValue1" - $blob1 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Property $creationTime,$lastModified,$etag,$contentLength,$contentType,$contentEncoding,$contentLanguage,$contentCRC64,$contentMD5,$cacheControl,$contentDisposition,$blobType,$accessTier,$accessTierInferred,$leaseStatus,$leaseState,$serverEncrypted,$tagCount -Tag $tags + $blob1 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder1/file1.txt' -Metadata $metadata -Tag $tags -Property $creationTime,$lastModified,$etag,$contentLength,$contentType,$contentEncoding,$contentLanguage,$contentCRC64,$contentMD5,$cacheControl,$contentDisposition,$blobType,$accessTier,$accessTierInferred,$leaseStatus,$leaseState,$serverEncrypted,$tagCount $creationTime2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Creation-Time" -Value "Wed, 06 Jun 2023 05:23:29 GMT" $lastModified2 = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "Last-Modified" -Value "Wed, 06 Jun 2023 05:23:29 GMT" @@ -47,7 +47,7 @@ Describe 'Invoke-AzStorageActionTaskPreviewAction' { $blob2 = New-AzStorageActionTaskPreviewBlobPropertiesObject -Name 'folder2/file1.txt' -Metadata $metadata2 -Property $creationTime2,$lastModified2,$etag2 -Tag $tags2 $conmetadata = New-AzStorageActionTaskPreviewKeyValuePropertiesObject -Key "mContainerKey1" -Value "mContainerValue1" - Invoke-AzStorageActionTaskPreviewAction -Location eastus2euap -ActionElseBlockExist -Blob $blob1,$blob2 -ContainerMetadata $conmetadata -ContainerName firstContainer -IfCondition "[[equals(AccessTier, 'Hot')]]" + Invoke-AzStorageActionTaskPreviewAction -Location $env.region -ActionElseBlockExist -Blob $blob1,$blob2 -ContainerMetadata $conmetadata -ContainerName firstContainer -IfCondition "[[equals(AccessTier, 'Hot')]]" } | Should -Not -Throw } diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Recording.json b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Recording.json new file mode 100644 index 000000000000..9b03a85a2c55 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Recording.json @@ -0,0 +1,129 @@ +{ + "New-AzStorageActionTask+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest2?api-version=2023-01-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest2?api-version=2023-01-01", + "Content": "{\r\n \"location\": \"eastus2euap\",\r\n \"identity\": {\r\n \"type\": \"None\"\r\n },\r\n \"properties\": {\r\n \"action\": {\r\n \"if\": {\r\n \"condition\": \"[[equals(AccessTier, \\u0027Cool\\u0027)]]\",\r\n \"operations\": [\r\n {\r\n \"name\": \"SetBlobTier\",\r\n \"parameters\": {\r\n \"tier\": \"Hot\"\r\n },\r\n \"onSuccess\": \"continue\",\r\n \"onFailure\": \"break\"\r\n }\r\n ]\r\n }\r\n },\r\n \"enabled\": true,\r\n \"description\": \"test storage task 2\"\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "524" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/443c9ec5-6d6d-44f5-903b-2df4bfb5f3c7?monitor=true\u0026api-version=2023-01-01" ], + "Retry-After": [ "17" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/443c9ec5-6d6d-44f5-903b-2df4bfb5f3c7?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true" ], + "x-ms-request-id": [ "443c9ec5-6d6d-44f5-903b-2df4bfb5f3c7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "99cb339c-9d50-4c92-9c93-f7238380ed79" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083716Z:99cb339c-9d50-4c92-9c93-f7238380ed79" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D5F092A3DD984E17907DC67B1F85770F Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:13Z" ], + "Date": [ "Mon, 06 May 2024 08:37:15 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "text/plain; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "New-AzStorageActionTask+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/443c9ec5-6d6d-44f5-903b-2df4bfb5f3c7?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/443c9ec5-6d6d-44f5-903b-2df4bfb5f3c7?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "49b73d91-dfc4-4e92-96dd-9c58ef0c7736" ], + "CommandName": [ "New-AzStorageActionTask" ], + "FullCommandName": [ "New-AzStorageActionTask_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "ab0a447d-34a3-47a0-8b57-fca4c07f1a6f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "036493fb-451e-423f-8fec-90b60066f476" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083734Z:036493fb-451e-423f-8fec-90b60066f476" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: D45BD8C041D541DD910956D78E80EFDD Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:33Z" ], + "Date": [ "Mon, 06 May 2024 08:37:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "106" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"status\":\"Succeeded\",\"startTime\":\"2024-05-06T08:37:16.1661055Z\",\"endTime\":\"2024-05-06T08:37:16.3536076Z\"}", + "isContentBase64": false + } + }, + "New-AzStorageActionTask+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/443c9ec5-6d6d-44f5-903b-2df4bfb5f3c7?monitor=true\u0026api-version=2023-01-01+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/443c9ec5-6d6d-44f5-903b-2df4bfb5f3c7?monitor=true\u0026api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "49b73d91-dfc4-4e92-96dd-9c58ef0c7736" ], + "CommandName": [ "New-AzStorageActionTask" ], + "FullCommandName": [ "New-AzStorageActionTask_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "8d7aa4c1-39a1-43ee-be6c-4e1fd3809303" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "93908777-036f-405f-bcaa-870bf42e7a0b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083735Z:93908777-036f-405f-bcaa-870bf42e7a0b" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: C39C8B1DC5E0413CB335A47E2AE10560 Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:34Z" ], + "Date": [ "Mon, 06 May 2024 08:37:35 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "617" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest2\",\"name\":\"storageactiontest2\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"type\":\"None\"},\"properties\":{\"enabled\":true,\"description\":\"test storage task 2\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-05-06T08:37:16.1661055Z\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 index 244e34939f46..329a56efc74d 100644 --- a/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/New-AzStorageActionTask.Tests.ps1 @@ -15,10 +15,10 @@ if(($null -eq $TestName) -or ($TestName -contains 'New-AzStorageActionTask')) } Describe 'New-AzStorageActionTask' { - It 'CreateExpanded' -skip { + It 'CreateExpanded' { { - $ifOperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue - New-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None + $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue + New-AzStorageActionTask -Name $env.testTaskName2 -ResourceGroupName $env.resourceGroup -Location $env.region -Enabled -Description 'test storage task 2' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation } | Should -Not -Throw } @@ -29,16 +29,7 @@ Describe 'New-AzStorageActionTask' { It 'CreateViaJsonFilePath' -skip { { throw [System.NotImplementedException] } | Should -Not -Throw } - - It 'Create' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } - It 'CreateViaIdentityExpanded' -skip { { throw [System.NotImplementedException] } | Should -Not -Throw } - - It 'CreateViaIdentity' -skip { - { throw [System.NotImplementedException] } | Should -Not -Throw - } } diff --git a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Recording.json b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Recording.json new file mode 100644 index 000000000000..cb6b914a1714 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Recording.json @@ -0,0 +1,132 @@ +{ + "Remove-AzStorageActionTask+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest2?api-version=2023-01-01+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest2?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "086e000d-94dc-42a0-8cb8-8459e311a43e" ], + "CommandName": [ "Remove-AzStorageActionTask" ], + "FullCommandName": [ "Remove-AzStorageActionTask_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/82eb5c80-2a6d-4252-9db3-c4d76f2caa29?monitor=true\u0026api-version=2023-01-01" ], + "Retry-After": [ "17" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/82eb5c80-2a6d-4252-9db3-c4d76f2caa29?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true" ], + "x-ms-request-id": [ "82eb5c80-2a6d-4252-9db3-c4d76f2caa29" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-correlation-request-id": [ "baf6474e-9191-4143-b604-fc82112a938c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083738Z:baf6474e-9191-4143-b604-fc82112a938c" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 4493867FEC0944D5980522F26A7DC10A Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:36Z" ], + "Date": [ "Mon, 06 May 2024 08:37:37 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "text/plain; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzStorageActionTask+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/82eb5c80-2a6d-4252-9db3-c4d76f2caa29?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/82eb5c80-2a6d-4252-9db3-c4d76f2caa29?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "086e000d-94dc-42a0-8cb8-8459e311a43e" ], + "CommandName": [ "Remove-AzStorageActionTask" ], + "FullCommandName": [ "Remove-AzStorageActionTask_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "844b0711-a196-4553-bc35-d02ed7e152b1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "d7e8fec8-0d6b-4045-a466-cf1f281f7417" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083756Z:d7e8fec8-0d6b-4045-a466-cf1f281f7417" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 1B863240D5AA4CF48AB9A84181F0BF6C Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:55Z" ], + "Date": [ "Mon, 06 May 2024 08:37:55 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzStorageActionTask+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/82eb5c80-2a6d-4252-9db3-c4d76f2caa29?monitor=true\u0026api-version=2023-01-01+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/82eb5c80-2a6d-4252-9db3-c4d76f2caa29?monitor=true\u0026api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "086e000d-94dc-42a0-8cb8-8459e311a43e" ], + "CommandName": [ "Remove-AzStorageActionTask" ], + "FullCommandName": [ "Remove-AzStorageActionTask_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "ef4377f8-7a7d-4564-b1c0-0b3a1abf320f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "2998bbdd-5ba3-4850-9488-4e0b66490e96" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083757Z:2998bbdd-5ba3-4850-9488-4e0b66490e96" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: FA9F8CB21909427D926523FB05CDB507 Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:56Z" ], + "Date": [ "Mon, 06 May 2024 08:37:57 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "text/plain; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 index 454791a6f44a..13b3f66097cc 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Remove-AzStorageActionTask.Tests.ps1 @@ -17,7 +17,7 @@ if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzStorageActionTask')) Describe 'Remove-AzStorageActionTask' { It 'Delete' { { - Remove-AzStorageActionTask -Name mytask2 -ResourceGroupName joyer-test + Remove-AzStorageActionTask -Name $env.testTaskName2 -ResourceGroupName $env.resourceGroup } | Should -Not -Throw } diff --git a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Recording.json b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Recording.json new file mode 100644 index 000000000000..288ad1fe4fd6 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Recording.json @@ -0,0 +1,172 @@ +{ + "Update-AzStorageActionTask+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1?api-version=2023-01-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1?api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "18" ], + "x-ms-client-request-id": [ "f32250b2-dd7d-4190-96d7-6f3396bb2903" ], + "CommandName": [ "Update-AzStorageActionTask" ], + "FullCommandName": [ "Update-AzStorageActionTask_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "192422f4-ea8a-4f85-91a0-3ec12ff3f28d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "0524ffe9-b191-49cf-8ea2-d71da5661f7e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083759Z:0524ffe9-b191-49cf-8ea2-d71da5661f7e" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: 8A71EC010DE14A008B85225EAA555A2D Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:58Z" ], + "Date": [ "Mon, 06 May 2024 08:37:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "617" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1\",\"name\":\"storageactiontest1\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"type\":\"None\"},\"properties\":{\"enabled\":true,\"description\":\"test storage task 1\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-05-06T08:36:44.1658106Z\"}}", + "isContentBase64": false + } + }, + "Update-AzStorageActionTask+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1?api-version=2023-01-01+2": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1?api-version=2023-01-01", + "Content": "{\r\n \"location\": \"eastus2euap\",\r\n \"identity\": {\r\n \"type\": \"None\"\r\n },\r\n \"properties\": {\r\n \"action\": {\r\n \"if\": {\r\n \"condition\": \"[[equals(AccessTier, \\u0027Cool\\u0027)]]\",\r\n \"operations\": [\r\n {\r\n \"name\": \"SetBlobTier\",\r\n \"parameters\": {\r\n \"tier\": \"Hot\"\r\n },\r\n \"onSuccess\": \"continue\",\r\n \"onFailure\": \"break\"\r\n }\r\n ]\r\n },\r\n \"else\": {\r\n \"operations\": [\r\n {\r\n \"name\": \"SetBlobTier\",\r\n \"parameters\": {\r\n \"tier\": \"Hot\"\r\n },\r\n \"onSuccess\": \"continue\",\r\n \"onFailure\": \"break\"\r\n }\r\n ]\r\n }\r\n },\r\n \"enabled\": true,\r\n \"description\": \"test storage task 1\"\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "795" ] + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/a68f4949-526c-4104-bc80-73618f3162ea?monitor=true\u0026api-version=2023-01-01" ], + "Retry-After": [ "17" ], + "Azure-AsyncOperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/a68f4949-526c-4104-bc80-73618f3162ea?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true" ], + "x-ms-request-id": [ "a68f4949-526c-4104-bc80-73618f3162ea" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "5e8a0380-450d-47c9-9b4d-8d236ba7755a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083801Z:5e8a0380-450d-47c9-9b4d-8d236ba7755a" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: EBD9CE74280245288955466E51FCA18B Ref B: MAA201060513051 Ref C: 2024-05-06T08:37:59Z" ], + "Date": [ "Mon, 06 May 2024 08:38:00 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "text/plain; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Update-AzStorageActionTask+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/a68f4949-526c-4104-bc80-73618f3162ea?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/a68f4949-526c-4104-bc80-73618f3162ea?monitor=true\u0026api-version=2023-01-01\u0026asynclink=true", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "20" ], + "x-ms-client-request-id": [ "f32250b2-dd7d-4190-96d7-6f3396bb2903" ], + "CommandName": [ "Update-AzStorageActionTask" ], + "FullCommandName": [ "Update-AzStorageActionTask_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "416b7227-cc78-4a25-a9d7-4c9f3ba044e4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "9f6725f7-a8aa-43e4-8c3b-396d19b9febc" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083819Z:9f6725f7-a8aa-43e4-8c3b-396d19b9febc" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: E6201FB07FCF4691B5B6256D1579DF14 Ref B: MAA201060513051 Ref C: 2024-05-06T08:38:18Z" ], + "Date": [ "Mon, 06 May 2024 08:38:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "63" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"status\":\"Succeeded\",\"endTime\":\"2024-05-06T08:38:00.9009228Z\"}", + "isContentBase64": false + } + }, + "Update-AzStorageActionTask+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/a68f4949-526c-4104-bc80-73618f3162ea?monitor=true\u0026api-version=2023-01-01+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.StorageActions/locations/eastus2euap/asyncoperations/a68f4949-526c-4104-bc80-73618f3162ea?monitor=true\u0026api-version=2023-01-01", + "Content": null, + "isContentBase64": false, + "Headers": { + "Authorization": [ "[Filtered]" ], + "x-ms-unique-id": [ "21" ], + "x-ms-client-request-id": [ "f32250b2-dd7d-4190-96d7-6f3396bb2903" ], + "CommandName": [ "Update-AzStorageActionTask" ], + "FullCommandName": [ "Update-AzStorageActionTask_UpdateExpanded" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v0.0.0", "PSVersion/v7.4.2", "Az.StorageAction/0.1.0" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "9d6dad01-d405-4953-80fa-fed571704621" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "x-ms-throttling-version": [ "v1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "x-ms-correlation-request-id": [ "6916427c-5be0-476c-be96-a2854ed2f495" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20240506T083820Z:6916427c-5be0-476c-be96-a2854ed2f495" ], + "X-Content-Type-Options": [ "nosniff" ], + "X-Cache": [ "CONFIG_NOCACHE" ], + "X-MSEdge-Ref": [ "Ref A: F7DC353EC0954009BBEA336E0FC23577 Ref B: MAA201060513051 Ref C: 2024-05-06T08:38:19Z" ], + "Date": [ "Mon, 06 May 2024 08:38:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "735" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/storageactiontest1\",\"name\":\"storageactiontest1\",\"type\":\"Microsoft.StorageActions/storageTasks\",\"location\":\"eastus2euap\",\"identity\":{\"type\":\"None\"},\"properties\":{\"enabled\":true,\"description\":\"test storage task 1\",\"action\":{\"if\":{\"condition\":\"[[equals(AccessTier, \u0027Cool\u0027)]]\",\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]},\"else\":{\"operations\":[{\"name\":\"SetBlobTier\",\"parameters\":{\"tier\":\"Hot\"},\"onSuccess\":\"continue\",\"onFailure\":\"break\"}]}},\"taskVersion\":1,\"provisioningState\":\"Succeeded\",\"creationTimeInUtc\":\"2024-05-06T08:36:44.1658106Z\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 index be1f0ff61b5a..7b1b0d6e74d9 100644 --- a/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/Update-AzStorageActionTask.Tests.ps1 @@ -17,8 +17,8 @@ if(($null -eq $TestName) -or ($TestName -contains 'Update-AzStorageActionTask')) Describe 'Update-AzStorageActionTask' { It 'UpdateExpanded' { { - $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue - Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation + $elseoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -OnFailure break -OnSuccess continue -Parameter @{"tier"= "Hot"} + Update-AzStorageActionTask -Name $env.testTaskName1 -ResourceGroupName $env.resourceGroup -ElseOperation $elseoperation } | Should -Not -Throw } diff --git a/src/StorageAction/StorageAction.Autorest/test/env.json b/src/StorageAction/StorageAction.Autorest/test/env.json new file mode 100644 index 000000000000..6a68bda0f89a --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/test/env.json @@ -0,0 +1,9 @@ +{ + "assignmentTask": "mytask1", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTaskName2": "storageactiontest2", + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f", + "region": "eastus2euap", + "resourceGroup": "joyer-test", + "testTaskName1": "storageactiontest1" +} diff --git a/src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 b/src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 index 5f079e89615e..6a7c385c6b7d 100644 --- a/src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/loadEnv.ps1 @@ -25,5 +25,5 @@ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { $env = @{} if (Test-Path -Path $envFilePath) { $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json - $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} + $PSDefaultParameterValues=@{"*:Tenant"=$env.Tenant} } \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/test/utils.ps1 b/src/StorageAction/StorageAction.Autorest/test/utils.ps1 index 6cda0bb897de..658f693a8037 100644 --- a/src/StorageAction/StorageAction.Autorest/test/utils.ps1 +++ b/src/StorageAction/StorageAction.Autorest/test/utils.ps1 @@ -45,8 +45,36 @@ function setupEnv() { $env.Tenant = (Get-AzContext).Tenant.Id # For any resources you created for test, you should add it to $env here. - $ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue - New-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -IdentityType None + $env.resourceGroup = 'joyer-test' + $env.region = 'eastus2euap' + $env.testTaskName1 = 'storageactiontest1' + $env.testTaskName2 = 'storageactiontest2' + $env.assignmentTask = 'mytask1' + + Write-Host 'Start to create test resource group' $env.resourceGroup + try { + Get-AzResourceGroup -Name $env.resourceGroup -ErrorAction Stop + Write-Host 'Get created group' + } catch { + New-AzResourceGroup -Name $env.resourceGroup -Location $env.region + } + + # Make sure the user assigned identity is registered + # Get-AzProviderFeature -ProviderNamespace "Microsoft.StorageActions" -ListAvailable + # FeatureName ProviderName RegistrationState + # ----------- ------------ ----------------- + # UserAssignedIdentity Microsoft.StorageActions NotRegistered + # AzureStorageTask Microsoft.StorageActions Registered + # Register-AzProviderFeature -ProviderNamespace "Microsoft.StorageActions" -FeatureName "UserAssignedIdentity" + + try { + $null = Get-AzStorageActionTask -Name $env.testTaskName1 -ResourceGroupName $env.resourceGroup -ErrorAction Stop + } + catch { + $ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue + $null = New-AzStorageActionTask -Name $env.testTaskName1 -ResourceGroupName $env.resourceGroup -Location $env.region -Enabled -Description 'test storage task 1' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation + } + #Add assignment and report without command $envFile = 'env.json' if ($TestMode -eq 'live') { @@ -56,5 +84,6 @@ function setupEnv() { } function cleanupEnv() { # Clean resources you create for testing + Remove-AzStorageActionTask -Name $env.testTaskName1 -ResourceGroupName $env.resourceGroup } diff --git a/src/StorageAction/StorageAction.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 b/src/StorageAction/StorageAction.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 new file mode 100644 index 000000000000..5319862d3372 --- /dev/null +++ b/src/StorageAction/StorageAction.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 @@ -0,0 +1,7 @@ +param() +if ($env:AzPSAutorestTestPlaybackMode) { + $loadEnvPath = Join-Path $PSScriptRoot '..' 'test' 'loadEnv.ps1' + . ($loadEnvPath) + return $env.SubscriptionId +} +return (Get-AzContext).Subscription.Id \ No newline at end of file From c346289201fa1f2fa6b8ea94f5025cb802efa955 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 7 May 2024 15:19:33 +0800 Subject: [PATCH 04/10] Added swagger fix --- .../StorageAction.Autorest/README.md | 5 +- .../docs/Az.StorageAction.md | 2 +- .../docs/Get-AzStorageActionTaskAssignment.md | 6 +- .../docs/Get-AzStorageActionTasksReport.md | 2 +- ...Invoke-AzStorageActionTaskPreviewAction.md | 4 +- .../docs/New-AzStorageActionTask.md | 61 ++++++++++++++++++- ...geActionTaskPreviewBlobPropertiesObject.md | 2 +- .../docs/Update-AzStorageActionTask.md | 3 +- 8 files changed, 70 insertions(+), 15 deletions(-) diff --git a/src/StorageAction/StorageAction.Autorest/README.md b/src/StorageAction/StorageAction.Autorest/README.md index 4fd4104b014f..ed29d2e2e547 100644 --- a/src/StorageAction/StorageAction.Autorest/README.md +++ b/src/StorageAction/StorageAction.Autorest/README.md @@ -28,7 +28,7 @@ For information on how to develop for `Az.StorageAction`, see [how-to.md](how-to ```yaml # pin the swagger version by using the commit id instead of branch name -commit: 13f09225c7d1cf42c55536e41c090bb8438cebd7 +commit: c156dc16f347511c702f815af35b3ae4cc9372e0 tag: package-2023-01-01 require: # readme.azure.noprofile.md is the common configuration file @@ -52,9 +52,6 @@ title: StorageAction subject-prefix: $(service-name) directive: - - from: swagger-document - where: $.definitions.StorageTask - transform: $['required'] = ['identity','properties'] # # Following are common directives which are normally required in all the RPs # # 1. Remove the unexpanded parameter set # # 2. For New-* cmdlets, ViaIdentity is not required diff --git a/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md b/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md index f135f654b23a..db3002676d55 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Az.StorageAction.md @@ -15,7 +15,7 @@ Microsoft Azure PowerShell: StorageAction cmdlets Get the storage task properties ### [Get-AzStorageActionTaskAssignment](Get-AzStorageActionTaskAssignment.md) -Lists all the storage tasks available under the given resource group. +Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. ### [Get-AzStorageActionTasksReport](Get-AzStorageActionTasksReport.md) Fetch the storage tasks run report summary for each assignment. diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md index a64dba663c65..e92956e8c7d8 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md @@ -8,7 +8,7 @@ schema: 2.0.0 # Get-AzStorageActionTaskAssignment ## SYNOPSIS -Lists all the storage tasks available under the given resource group. +Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. ## SYNTAX @@ -18,7 +18,7 @@ Get-AzStorageActionTaskAssignment -ResourceGroupName -StorageTaskName < ``` ## DESCRIPTION -Lists all the storage tasks available under the given resource group. +Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. ## EXAMPLES @@ -54,7 +54,7 @@ Accept wildcard characters: False ``` ### -Maxpagesize -Optional, specifies the maximum number of storage task assignment Ids to be included in the list response. +Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. ```yaml Type: System.String diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md index 81951402cfdd..7dbcd766d3c7 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md @@ -115,7 +115,7 @@ Accept wildcard characters: False ``` ### -Maxpagesize -Optional, specifies the maximum number of storage task assignment Ids to be included in the list response. +Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. ```yaml Type: System.String diff --git a/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md index 74a57245516b..e370d979d861 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Invoke-AzStorageActionTaskPreviewAction.md @@ -228,7 +228,7 @@ Accept wildcard characters: False ``` ### -Blob -Preview action container properties to be tested for a match with the provided condition. +Properties of some sample blobs in the container to test for matches with the preview action. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.StorageAction.Models.IStorageTaskPreviewBlobProperties[] @@ -258,7 +258,7 @@ Accept wildcard characters: False ``` ### -ContainerName -property for the container name. +Name of test container ```yaml Type: System.String diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md index f60db59f91e1..9b34edf9ba0f 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -89,7 +89,63 @@ Type : Microsoft.StorageActions/storageTasks The first command creates a if operation object. The second command creates a storage task. -### Example 2: Create storage task with if and else operation +### Example 2: Create storage task with user assign identity +```powershell +$ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue +$elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue +$mi = New-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName joyer-test -Location eastus2euap +New-AzStorageActionTask -Name mytask2 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 2' -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -UserAssignedIdentity $mi.Id +``` + +```output +CreationTimeInUtc : 5/6/2024 9:41:50 AM +Description : my storage task 2 +ElseOperation : {{ + "name": "DeleteBlob", + "onSuccess": "continue", + "onFailure": "break" + }} +Enabled : True +Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta + sk2 +IdentityPrincipalId : +IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityType : UserAssigned +IdentityUserAssignedIdentity : { + "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/Microsoft.ManagedIdentity/userAssignedI + dentities/testUserAssignedMI": { + } + } +IfCondition : [[equals(AccessTier, 'Hot')]] +IfOperation : {{ + "name": "SetBlobTier", + "parameters": { + "tier": "Hot" + }, + "onSuccess": "continue", + "onFailure": "break" + }} +Location : eastus2euap +Name : mytask2 +ProvisioningState : Succeeded +ResourceGroupName : joyer-test +SystemDataCreatedAt : +SystemDataCreatedBy : +SystemDataCreatedByType : +SystemDataLastModifiedAt : +SystemDataLastModifiedBy : +SystemDataLastModifiedByType : +Tag : { + } +TaskVersion : 1 +Type : Microsoft.StorageActions/storageTasks +``` + +The first command creates a if operation object. +The second command creates a else operation object. +This third command creates a storage task. + +### Example 3: Create storage task with if and else operation ```powershell $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Cool"} -OnFailure break -OnSuccess continue $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue @@ -235,7 +291,8 @@ Accept wildcard characters: False ``` ### -IfCondition -The condition predicate which is composed of object properties, eg: blob and container properties. +Condition predicate to evaluate each object. +See https://aka.ms/storagetaskconditions for valid properties and operators. ```yaml Type: System.String diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md index 4153c6d040ed..1bda6241a9a8 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTaskPreviewBlobPropertiesObject.md @@ -68,7 +68,7 @@ Accept wildcard characters: False ``` ### -Name -property for the container name. +Name of test blob. ```yaml Type: System.String diff --git a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md index f5e91e200422..05b7fbacbf09 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md @@ -274,7 +274,8 @@ Accept wildcard characters: False ``` ### -IfCondition -The condition predicate which is composed of object properties, eg: blob and container properties. +Condition predicate to evaluate each object. +See https://aka.ms/storagetaskconditions for valid properties and operators. ```yaml Type: System.String From 12e5fec18b6b0d78bc073b919fa3ff5b2a54a58d Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 10 May 2024 13:55:14 +0800 Subject: [PATCH 05/10] Update commit id from swagger main --- src/StorageAction/StorageAction.Autorest/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StorageAction/StorageAction.Autorest/README.md b/src/StorageAction/StorageAction.Autorest/README.md index ed29d2e2e547..a7d72bdab42e 100644 --- a/src/StorageAction/StorageAction.Autorest/README.md +++ b/src/StorageAction/StorageAction.Autorest/README.md @@ -28,7 +28,7 @@ For information on how to develop for `Az.StorageAction`, see [how-to.md](how-to ```yaml # pin the swagger version by using the commit id instead of branch name -commit: c156dc16f347511c702f815af35b3ae4cc9372e0 +commit: bdd7c051fa9867d79536281638c84cbc87a4014b tag: package-2023-01-01 require: # readme.azure.noprofile.md is the common configuration file From 55ed767d52511eb0288d3db7f34e97aaf16826e9 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 10 May 2024 13:59:31 +0800 Subject: [PATCH 06/10] Update commit --- src/StorageAction/StorageAction.Autorest/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StorageAction/StorageAction.Autorest/README.md b/src/StorageAction/StorageAction.Autorest/README.md index a7d72bdab42e..0e49271b278c 100644 --- a/src/StorageAction/StorageAction.Autorest/README.md +++ b/src/StorageAction/StorageAction.Autorest/README.md @@ -28,7 +28,7 @@ For information on how to develop for `Az.StorageAction`, see [how-to.md](how-to ```yaml # pin the swagger version by using the commit id instead of branch name -commit: bdd7c051fa9867d79536281638c84cbc87a4014b +commit: 8f196886782fc5b48b75322944dc60d1cafaf7fa tag: package-2023-01-01 require: # readme.azure.noprofile.md is the common configuration file From 8f6002f2f3010038bcb391b0afbeab97f0a07f3c Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 10 May 2024 16:53:42 +0800 Subject: [PATCH 07/10] Update example --- .../docs/Get-AzStorageActionTask.md | 6 ++--- .../docs/Get-AzStorageActionTaskAssignment.md | 6 ++--- .../docs/Get-AzStorageActionTasksReport.md | 22 ++++++++--------- .../docs/New-AzStorageActionTask.md | 24 +++++++++---------- .../docs/Remove-AzStorageActionTask.md | 2 +- .../docs/Update-AzStorageActionTask.md | 23 +++++++++--------- .../examples/Get-AzStorageActionTask.md | 6 ++--- .../Get-AzStorageActionTaskAssignment.md | 6 ++--- .../Get-AzStorageActionTasksReport.md | 22 ++++++++--------- .../examples/New-AzStorageActionTask.md | 24 +++++++++---------- .../examples/Remove-AzStorageActionTask.md | 2 +- .../examples/Update-AzStorageActionTask.md | 23 +++++++++--------- 12 files changed, 80 insertions(+), 86 deletions(-) diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md index 3384a00b4c8f..cc44d4f3bd8b 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTask.md @@ -42,7 +42,7 @@ Get the storage task properties ### Example 1: Get specific storage action task with specified resource group ```powershell -Get-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +Get-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 ``` ```output @@ -50,7 +50,7 @@ CreationTimeInUtc : 1/23/2024 6:47:43 AM Description : my storage task ElseOperation : Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 IdentityPrincipalId : IdentityTenantId : IdentityType : None @@ -68,7 +68,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : ps1-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md index e92956e8c7d8..65da946876c2 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTaskAssignment.md @@ -24,13 +24,13 @@ Lists Resource IDs of the Storage Task Assignments associated with this Storage ### Example 1: Lists all the storage tasks ```powershell -Get-AzStorageActionTaskAssignment -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List +Get-AzStorageActionTaskAssignment -ResourceGroupName group001 -StorageTaskName mytask1 | Format-List ``` ```output -Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign1 +Id : subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/microsoft.storage/storageaccounts/account001/storagetaskassignments/testassign1 -Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign2 +Id : subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/microsoft.storage/storageaccounts/account001/storagetaskassignments/testassign2 ``` This command lists all the storage task assignments. diff --git a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md index 7dbcd766d3c7..a00415024420 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Get-AzStorageActionTasksReport.md @@ -25,12 +25,12 @@ Fetch the storage tasks run report summary for each assignment. ### Example 1: Get report ```powershell -Get-AzStorageActionTasksReport -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List +Get-AzStorageActionTasksReport -ResourceGroupName group001 -StorageTaskName mytask1 | Format-List ``` ```output FinishTime : 2024-02-28T10:16:58.9261483Z -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance1 Name : instance1 ObjectFailedCount : 0 ObjectsOperatedOnCount : 0 @@ -40,21 +40,21 @@ RunResult : Succeeded RunStatusEnum : Finished RunStatusError : 0x0 StartTime : 2024-02-28T10:07:53.0000000Z -StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 -SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign1/2024-02-28T10:08:00/SummaryReport.json +StorageAccountId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001 +SummaryReportPath : https://account001.blob.core.windows.net/rrrr/mytask1/testassign1/2024-02-28T10:08:00/SummaryReport.json SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : SystemDataLastModifiedAt : SystemDataLastModifiedBy : SystemDataLastModifiedByType : -TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign1 -TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskAssignmentId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001/storageTaskAssignments/testassign1 +TaskId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 TaskVersion : 1 Type : Microsoft.StorageActions/storageTasks/reports FinishTime : 2024-02-28T10:31:54.7848950Z -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance2 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance2 Name : instance2 ObjectFailedCount : 0 ObjectsOperatedOnCount : 0 @@ -64,16 +64,16 @@ RunResult : Succeeded RunStatusEnum : Finished RunStatusError : 0x0 StartTime : 2024-02-28T10:21:53.0000000Z -StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 -SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign2/2024-02-28T10:22:05/SummaryReport.json +StorageAccountId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001 +SummaryReportPath : https://account001.blob.core.windows.net/rrrr/mytask1/testassign2/2024-02-28T10:22:05/SummaryReport.json SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : SystemDataLastModifiedAt : SystemDataLastModifiedBy : SystemDataLastModifiedByType : -TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign2 -TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskAssignmentId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001/storageTaskAssignments/testassign2 +TaskId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 TaskVersion : 1 Type : Microsoft.StorageActions/storageTasks/reports ``` diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md index 9b34edf9ba0f..51555fd74554 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -47,7 +47,7 @@ If a storage task is already created and a subsequent create or update request i ### Example 1: Create storage task with if operation ```powershell $ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue -New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation +New-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation ``` ```output @@ -55,7 +55,7 @@ CreationTimeInUtc : 1/23/2024 6:47:43 AM Description : my storage task ElseOperation : Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 IdentityPrincipalId : IdentityTenantId : IdentityType : None @@ -73,7 +73,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : ps1-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -93,8 +93,8 @@ The second command creates a storage task. ```powershell $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -$mi = New-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName joyer-test -Location eastus2euap -New-AzStorageActionTask -Name mytask2 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 2' -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -UserAssignedIdentity $mi.Id +$mi = New-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName group001 -Location eastus2euap +New-AzStorageActionTask -Name mytask2 -ResourceGroupName group001 -Location eastus2euap -Enabled -Description 'my storage task 2' -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -UserAssignedIdentity $mi.Id ``` ```output @@ -106,13 +106,12 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta - sk2 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask2 IdentityPrincipalId : IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 IdentityType : UserAssigned IdentityUserAssignedIdentity : { - "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/Microsoft.ManagedIdentity/userAssignedI + "/subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/Microsoft.ManagedIdentity/userAssignedI dentities/testUserAssignedMI": { } } @@ -128,7 +127,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask2 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -149,7 +148,7 @@ This third command creates a storage task. ```powershell $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Cool"} -OnFailure break -OnSuccess continue $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -New-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 3' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -EnableSystemAssignedIdentity +New-AzStorageActionTask -Name mytask3 -ResourceGroupName group001 -Location eastus2euap -Enabled -Description 'my storage task 3' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -EnableSystemAssignedIdentity ``` ```output @@ -161,8 +160,7 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta - sk3 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 IdentityType : SystemAssigned @@ -180,7 +178,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask3 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : diff --git a/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md index 16c43119d2e7..c4c9e461e6d5 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Remove-AzStorageActionTask.md @@ -31,7 +31,7 @@ Delete the storage task resource. ### Example 1: Delete specific storage action task with specified resource group ```powershell -Remove-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +Remove-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 ``` This command delete specific storage action task with specified resource group diff --git a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md index 05b7fbacbf09..1da6d44ed24d 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md @@ -42,7 +42,7 @@ If a storage task is already created and a subsequent create or update request i ### Example 1: Update storage action task with conditions ```powershell $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -ElseOperation $elseoperation +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 -ElseOperation $elseoperation ``` ```output @@ -54,7 +54,7 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : False -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 IdentityPrincipalId : IdentityTenantId : IdentityType : None @@ -72,7 +72,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : ps1-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -90,7 +90,7 @@ This command updates storage action task. ### Example 2: Update storage action task with conditions ```powershell $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue -Update-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation +Update-AzStorageActionTask -Name mytask3 -ResourceGroupName group001 -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation ``` ```output @@ -102,10 +102,9 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta - sk3 -IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c -IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 +IdentityPrincipalId : 11111111-2222-3333-4444-123456789101 +IdentityTenantId : 11111111-2222-3333-4444-987654321012 IdentityType : SystemAssigned IdentityUserAssignedIdentity : { } @@ -121,7 +120,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask3 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -138,7 +137,7 @@ This command updates storage action task. ### Example 3: Update storage action task with system assigned ```powershell -Update-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -EnableSystemAssignedIdentity 1 +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 -EnableSystemAssignedIdentity 1 ``` ```output @@ -146,7 +145,7 @@ CreationTimeInUtc : 2/27/2024 6:48:18 AM Description : my storage task ElseOperation : Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/myta sk1 IdentityPrincipalId : 66aefa04-060e-4eeb-9342-7228e31d1596 IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 @@ -165,7 +164,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md index 222af2690515..f7acfa0f3ea7 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTask.md @@ -1,6 +1,6 @@ ### Example 1: Get specific storage action task with specified resource group ```powershell -Get-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +Get-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 ``` ```output @@ -8,7 +8,7 @@ CreationTimeInUtc : 1/23/2024 6:47:43 AM Description : my storage task ElseOperation : Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 IdentityPrincipalId : IdentityTenantId : IdentityType : None @@ -26,7 +26,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : ps1-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md index c35a7703b503..400a571948f4 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTaskAssignment.md @@ -1,12 +1,12 @@ ### Example 1: Lists all the storage tasks ```powershell -Get-AzStorageActionTaskAssignment -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List +Get-AzStorageActionTaskAssignment -ResourceGroupName group001 -StorageTaskName mytask1 | Format-List ``` ```output -Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign1 +Id : subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/microsoft.storage/storageaccounts/account001/storagetaskassignments/testassign1 -Id : subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/microsoft.storage/storageaccounts/storagetasktest202402281/storagetaskassignments/testassign2 +Id : subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/microsoft.storage/storageaccounts/account001/storagetaskassignments/testassign2 ``` This command lists all the storage task assignments. diff --git a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md index 5742965af5e4..8ad6844d0ace 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Get-AzStorageActionTasksReport.md @@ -1,11 +1,11 @@ ### Example 1: Get report ```powershell -Get-AzStorageActionTasksReport -ResourceGroupName joyer-test -StorageTaskName mytask1 | Format-List +Get-AzStorageActionTasksReport -ResourceGroupName group001 -StorageTaskName mytask1 | Format-List ``` ```output FinishTime : 2024-02-28T10:16:58.9261483Z -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance1 Name : instance1 ObjectFailedCount : 0 ObjectsOperatedOnCount : 0 @@ -15,21 +15,21 @@ RunResult : Succeeded RunStatusEnum : Finished RunStatusError : 0x0 StartTime : 2024-02-28T10:07:53.0000000Z -StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 -SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign1/2024-02-28T10:08:00/SummaryReport.json +StorageAccountId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001 +SummaryReportPath : https://account001.blob.core.windows.net/rrrr/mytask1/testassign1/2024-02-28T10:08:00/SummaryReport.json SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : SystemDataLastModifiedAt : SystemDataLastModifiedBy : SystemDataLastModifiedByType : -TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign1 -TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskAssignmentId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001/storageTaskAssignments/testassign1 +TaskId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 TaskVersion : 1 Type : Microsoft.StorageActions/storageTasks/reports FinishTime : 2024-02-28T10:31:54.7848950Z -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance2 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1/reports/instance2 Name : instance2 ObjectFailedCount : 0 ObjectsOperatedOnCount : 0 @@ -39,16 +39,16 @@ RunResult : Succeeded RunStatusEnum : Finished RunStatusError : 0x0 StartTime : 2024-02-28T10:21:53.0000000Z -StorageAccountId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281 -SummaryReportPath : https://storagetasktest202402281.blob.core.windows.net/rrrr/mytask1/testassign2/2024-02-28T10:22:05/SummaryReport.json +StorageAccountId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001 +SummaryReportPath : https://account001.blob.core.windows.net/rrrr/mytask1/testassign2/2024-02-28T10:22:05/SummaryReport.json SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : SystemDataLastModifiedAt : SystemDataLastModifiedBy : SystemDataLastModifiedByType : -TaskAssignmentId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.Storage/storageAccounts/storagetasktest202402281/storageTaskAssignments/testassign2 -TaskId : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +TaskAssignmentId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.Storage/storageAccounts/account001/storageTaskAssignments/testassign2 +TaskId : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 TaskVersion : 1 Type : Microsoft.StorageActions/storageTasks/reports ``` diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md index f6d42a3115cc..53ffb63e343c 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md @@ -1,7 +1,7 @@ ### Example 1: Create storage task with if operation ```powershell $ifoperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue -New-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation +New-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 -Location eastus2euap -Enabled -Description 'my storage task' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation ``` ```output @@ -9,7 +9,7 @@ CreationTimeInUtc : 1/23/2024 6:47:43 AM Description : my storage task ElseOperation : Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 IdentityPrincipalId : IdentityTenantId : IdentityType : None @@ -27,7 +27,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : ps1-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -46,8 +46,8 @@ The first command creates a if operation object. The second command creates a st ```powershell $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -$mi = New-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName joyer-test -Location eastus2euap -New-AzStorageActionTask -Name mytask2 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 2' -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -UserAssignedIdentity $mi.Id +$mi = New-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName group001 -Location eastus2euap +New-AzStorageActionTask -Name mytask2 -ResourceGroupName group001 -Location eastus2euap -Enabled -Description 'my storage task 2' -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -UserAssignedIdentity $mi.Id ``` ```output @@ -59,13 +59,12 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta - sk2 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask2 IdentityPrincipalId : IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 IdentityType : UserAssigned IdentityUserAssignedIdentity : { - "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/Microsoft.ManagedIdentity/userAssignedI + "/subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/Microsoft.ManagedIdentity/userAssignedI dentities/testUserAssignedMI": { } } @@ -81,7 +80,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask2 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -101,7 +100,7 @@ The first command creates a if operation object. The second command creates a el ```powershell $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Cool"} -OnFailure break -OnSuccess continue $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -New-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -Location eastus2euap -Enabled -Description 'my storage task 3' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -EnableSystemAssignedIdentity +New-AzStorageActionTask -Name mytask3 -ResourceGroupName group001 -Location eastus2euap -Enabled -Description 'my storage task 3' -IfCondition "[[equals(AccessTier, 'Cool')]]" -IfOperation $ifoperation -ElseOperation $elseoperation -EnableSystemAssignedIdentity ``` ```output @@ -113,8 +112,7 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta - sk3 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 IdentityType : SystemAssigned @@ -132,7 +130,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask3 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : diff --git a/src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md index d88b03f9dc02..785f0b04a350 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Remove-AzStorageActionTask.md @@ -1,6 +1,6 @@ ### Example 1: Delete specific storage action task with specified resource group ```powershell -Remove-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test +Remove-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 ``` This command delete specific storage action task with specified resource group \ No newline at end of file diff --git a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md index ab649efb5fb9..4379d46dd749 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md @@ -1,7 +1,7 @@ ### Example 1: Update storage action task with conditions ```powershell $elseoperation = New-AzStorageActionTaskOperationObject -Name DeleteBlob -OnFailure break -OnSuccess continue -Update-AzStorageActionTask -Name mytask1 -ResourceGroupName ps1-test -ElseOperation $elseoperation +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 -ElseOperation $elseoperation ``` ```output @@ -13,7 +13,7 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : False -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.StorageActions/storageTasks/mytask1 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask1 IdentityPrincipalId : IdentityTenantId : IdentityType : None @@ -31,7 +31,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : ps1-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -50,7 +50,7 @@ This command updates storage action task. ### Example 2: Update storage action task with conditions ```powershell $ifOperation = New-AzStorageActionTaskOperationObject -Name SetBlobTier -Parameter @{"tier"= "Hot"} -OnFailure break -OnSuccess continue -Update-AzStorageActionTask -Name mytask3 -ResourceGroupName joyer-test -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation +Update-AzStorageActionTask -Name mytask3 -ResourceGroupName group001 -IfCondition "[[equals(AccessTier, 'Hot')]]" -IfOperation $ifoperation ``` ```output @@ -62,10 +62,9 @@ ElseOperation : {{ "onFailure": "break" }} Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta - sk3 -IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c -IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 +IdentityPrincipalId : 11111111-2222-3333-4444-123456789101 +IdentityTenantId : 11111111-2222-3333-4444-987654321012 IdentityType : SystemAssigned IdentityUserAssignedIdentity : { } @@ -81,7 +80,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask3 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : @@ -99,7 +98,7 @@ This command updates storage action task. ### Example 3: Update storage action task with system assigned ```powershell -Update-AzStorageActionTask -Name mytask1 -ResourceGroupName joyer-test -EnableSystemAssignedIdentity 1 +Update-AzStorageActionTask -Name mytask1 -ResourceGroupName group001 -EnableSystemAssignedIdentity 1 ``` ```output @@ -107,7 +106,7 @@ CreationTimeInUtc : 2/27/2024 6:48:18 AM Description : my storage task ElseOperation : Enabled : True -Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.StorageActions/storageTasks/myta +Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/myta sk1 IdentityPrincipalId : 66aefa04-060e-4eeb-9342-7228e31d1596 IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 @@ -126,7 +125,7 @@ IfOperation : {{ Location : eastus2euap Name : mytask1 ProvisioningState : Succeeded -ResourceGroupName : joyer-test +ResourceGroupName : group001 SystemDataCreatedAt : SystemDataCreatedBy : SystemDataCreatedByType : From 3ac63e7564006bf37cce7dca64e21a37560f8c32 Mon Sep 17 00:00:00 2001 From: Yan Xu Date: Fri, 10 May 2024 17:40:20 +0800 Subject: [PATCH 08/10] Update src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md --- .../StorageAction.Autorest/docs/New-AzStorageActionTask.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md index 51555fd74554..5144aedb847c 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -161,7 +161,7 @@ ElseOperation : {{ }} Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 -IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c +IdentityPrincipalId : 11111111-2222-3333-4444-123456789101 IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 IdentityType : SystemAssigned IdentityUserAssignedIdentity : { From e0a254541f229fb990bd9d3a5242304997b4cf25 Mon Sep 17 00:00:00 2001 From: Yan Xu Date: Fri, 10 May 2024 17:40:34 +0800 Subject: [PATCH 09/10] Update src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md --- .../StorageAction.Autorest/docs/New-AzStorageActionTask.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md index 5144aedb847c..09e5cfcc7fc0 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -162,7 +162,7 @@ ElseOperation : {{ Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 IdentityPrincipalId : 11111111-2222-3333-4444-123456789101 -IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityTenantId :11111111-2222-3333-4444-123456789101 IdentityType : SystemAssigned IdentityUserAssignedIdentity : { } From 5fd5af237cbc2d43d5fff734b36cbd6a8f1e905c Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 10 May 2024 17:48:24 +0800 Subject: [PATCH 10/10] Update example --- .../StorageAction.Autorest/docs/New-AzStorageActionTask.md | 6 +++--- .../docs/Update-AzStorageActionTask.md | 2 +- .../examples/New-AzStorageActionTask.md | 6 +++--- .../examples/Update-AzStorageActionTask.md | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md index 09e5cfcc7fc0..a1cefd78dac3 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/New-AzStorageActionTask.md @@ -108,7 +108,7 @@ ElseOperation : {{ Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask2 IdentityPrincipalId : -IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityTenantId : 11111111-2222-3333-4444-123456789101 IdentityType : UserAssigned IdentityUserAssignedIdentity : { "/subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/Microsoft.ManagedIdentity/userAssignedI @@ -161,8 +161,8 @@ ElseOperation : {{ }} Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 -IdentityPrincipalId : 11111111-2222-3333-4444-123456789101 -IdentityTenantId :11111111-2222-3333-4444-123456789101 +IdentityPrincipalId : 11111111-2222-3333-4444-123456789123 +IdentityTenantId : 11111111-2222-3333-4444-123456789101 IdentityType : SystemAssigned IdentityUserAssignedIdentity : { } diff --git a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md index 1da6d44ed24d..f3fafa983a3d 100644 --- a/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/docs/Update-AzStorageActionTask.md @@ -103,7 +103,7 @@ ElseOperation : {{ }} Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 -IdentityPrincipalId : 11111111-2222-3333-4444-123456789101 +IdentityPrincipalId : 11111111-2222-3333-4444-123456789123 IdentityTenantId : 11111111-2222-3333-4444-987654321012 IdentityType : SystemAssigned IdentityUserAssignedIdentity : { diff --git a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md index 53ffb63e343c..f63af82283fb 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/New-AzStorageActionTask.md @@ -61,7 +61,7 @@ ElseOperation : {{ Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask2 IdentityPrincipalId : -IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityTenantId : 11111111-2222-3333-4444-123456789101 IdentityType : UserAssigned IdentityUserAssignedIdentity : { "/subscriptions/11111111-2222-3333-4444-123456789101/resourcegroups/group001/providers/Microsoft.ManagedIdentity/userAssignedI @@ -113,8 +113,8 @@ ElseOperation : {{ }} Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 -IdentityPrincipalId : ea96114b-ac3c-4350-87f5-4db5a91c656c -IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47 +IdentityPrincipalId : 11111111-2222-3333-4444-123456789123 +IdentityTenantId : 11111111-2222-3333-4444-123456789101 IdentityType : SystemAssigned IdentityUserAssignedIdentity : { } diff --git a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md index 4379d46dd749..bc3ad69cfa3b 100644 --- a/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md +++ b/src/StorageAction/StorageAction.Autorest/examples/Update-AzStorageActionTask.md @@ -63,7 +63,7 @@ ElseOperation : {{ }} Enabled : True Id : /subscriptions/11111111-2222-3333-4444-123456789101/resourceGroups/group001/providers/Microsoft.StorageActions/storageTasks/mytask3 -IdentityPrincipalId : 11111111-2222-3333-4444-123456789101 +IdentityPrincipalId : 11111111-2222-3333-4444-123456789123 IdentityTenantId : 11111111-2222-3333-4444-987654321012 IdentityType : SystemAssigned IdentityUserAssignedIdentity : {