[Storage] When download blob with parameter AbsoluteUri, not allow in… (#26599)

* [Storage] When download blob with parameter AbsoluteUri, not allow input parameter Context (#26585)

* [Storage] fix #26316: When download blob with parameter AbsoluteUri (alias Uri, BlobUri), not allow input parameter Context together.

* Add static exception

* revise change log

* resolve merge

---------

Co-authored-by: Wei Wei <weiwei@microsoft.com>
Co-authored-by: Vincent Dai <23257217+vidai-msft@users.noreply.github.com>
This commit is contained in:
Yabo Hu 2024-11-07 16:35:55 +08:00 коммит произвёл GitHub
Родитель c40ab7c0bd
Коммит 1653719439
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 32 добавлений и 14 удалений

Просмотреть файл

@ -18,6 +18,8 @@
- Additional information about change #1
-->
## Upcoming Release
* When download blob with parameter AbsoluteUri (alias Uri, BlobUri), not allow input parameter Context together.
- `Get-AzStorageBlobContent`
## Version 7.5.0
* Added a warning for an upcoming breaking change for download blob will block input parameter -AbsoluteUri and -Context together.

Просмотреть файл

@ -15,8 +15,8 @@ Downloads a storage blob.
### ReceiveManual (Default)
```
Get-AzStorageBlobContent [-Blob] <String> [-Container] <String> [-Destination <String>] [-CheckMd5] [-Force]
[-AsJob] [-TagCondition <String>] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
Get-AzStorageBlobContent [-Blob] <String> [-Container] <String> [-Destination <String>] [-CheckMd5]
[-Context <IStorageContext>] [-Force] [-AsJob] [-TagCondition <String>] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```
@ -24,27 +24,27 @@ Get-AzStorageBlobContent [-Blob] <String> [-Container] <String> [-Destination <S
### BlobPipeline
```
Get-AzStorageBlobContent -CloudBlob <CloudBlob> [-BlobBaseClient <BlobBaseClient>] [-Destination <String>]
[-CheckMd5] [-Force] [-AsJob] [-TagCondition <String>] [-Context <IStorageContext>]
[-CheckMd5] [-Context <IStorageContext>] [-Force] [-AsJob] [-TagCondition <String>]
[-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
### ContainerPipeline
```
Get-AzStorageBlobContent -CloudBlobContainer <CloudBlobContainer> [-Blob] <String> [-Destination <String>]
[-CheckMd5] [-Force] [-AsJob] [-TagCondition <String>] [-Context <IStorageContext>]
[-CheckMd5] [-Context <IStorageContext>] [-Force] [-AsJob] [-TagCondition <String>]
[-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
### UriPipeline
```
Get-AzStorageBlobContent [-Destination <String>] -AbsoluteUri <String> [-Force] [-AsJob]
[-TagCondition <String>] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
[-TagCondition <String>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
@ -256,7 +256,7 @@ You can use the New-AzStorageContext cmdlet to create a storage context.
```yaml
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext
Parameter Sets: (All)
Parameter Sets: ReceiveManual, BlobPipeline, ContainerPipeline
Aliases:
Required: False

Просмотреть файл

@ -31,6 +31,7 @@ using Track2Models = global::Azure.Storage.Blobs.Models;
using Azure.Storage.Blobs;
using Azure.Storage;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
namespace Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet
{
@ -113,12 +114,25 @@ namespace Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet
private bool checkMd5;
[CmdletParameterBreakingChangeWithVersion("AbsoluteUri", "13.0.0", "8.0.0", ChangeDescription = "When download blob with parameter AbsoluteUri (alias Uri, BlobUri), parameter Context will not be allowed to input together.")]
[Alias("Uri", "BlobUri")]
[Parameter(HelpMessage = "Blob uri to download from.", Mandatory = true,
ValueFromPipelineByPropertyName = true, ParameterSetName = UriParameterSet)]
public string AbsoluteUri { get; set; }
[Parameter(HelpMessage = "Azure Storage Context Object",
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = ManualParameterSet)]
[Parameter(HelpMessage = "Azure Storage Context Object",
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = BlobParameterSet)]
[Parameter(HelpMessage = "Azure Storage Context Object",
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = ContainerParameterSet)]
public override IStorageContext Context { get; set; }
private BlobToFileSystemNameResolver fileNameResolver;
private bool skipSourceChannelInit;

Просмотреть файл

@ -1,2 +1,4 @@
"Module","ClassName","Target","Severity","ProblemId","Description","Remediation"
"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet.NewAzureStorageContext","New-AzStorageContext","0","1020","The cmdlet 'New-AzStorageContext' no longer has output type 'Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext'.","Make cmdlet 'New-AzStorageContext' return type 'Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext'."
"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet.NewAzureStorageContext","New-AzStorageContext","0","1020","The cmdlet 'New-AzStorageContext' no longer has output type 'Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext'.","Make cmdlet 'New-AzStorageContext' return type 'Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext'."
"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobContentCommand","Get-AzStorageBlobContent","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Get-AzStorageBlobContent' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Get-AzStorageBlobContent'."
"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobContentCommand","Get-AzStorageBlobContent","0","1050","The parameter set 'UriPipeline' for cmdlet 'Get-AzStorageBlobContent' has been removed.","Add parameter set 'UriPipeline' back to cmdlet 'Get-AzStorageBlobContent'."
1 Module ClassName Target Severity ProblemId Description Remediation
2 Az.Storage Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet.NewAzureStorageContext New-AzStorageContext 0 1020 The cmdlet 'New-AzStorageContext' no longer has output type 'Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext'. Make cmdlet 'New-AzStorageContext' return type 'Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext'.
3 Az.Storage Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobContentCommand Get-AzStorageBlobContent 0 1050 The parameter set '__AllParameterSets' for cmdlet 'Get-AzStorageBlobContent' has been removed. Add parameter set '__AllParameterSets' back to cmdlet 'Get-AzStorageBlobContent'.
4 Az.Storage Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobContentCommand Get-AzStorageBlobContent 0 1050 The parameter set 'UriPipeline' for cmdlet 'Get-AzStorageBlobContent' has been removed. Add parameter set 'UriPipeline' back to cmdlet 'Get-AzStorageBlobContent'.