diff --git a/src/Storage/Storage.Management/ChangeLog.md b/src/Storage/Storage.Management/ChangeLog.md index ba0d64d9733e..8721b449b1d9 100644 --- a/src/Storage/Storage.Management/ChangeLog.md +++ b/src/Storage/Storage.Management/ChangeLog.md @@ -18,6 +18,30 @@ - Additional information about change #1 --> ## Upcoming Release +* Migrated following Azure Storage File dataplane cmdlets from 'Microsoft.Azure.Storage.File 11.2.3' to 'Azure.Storage.Files.Shares 12.16.0' + - `Close-AzStorageFileHandle` + - `Get-AzStorageFile` + - `Get-AzStorageFileContent` + - `Get-AzStorageFileCopyState` + - `Get-AzStorageFileHandle` + - `Get-AzStorageShare` + - `Get-AzStorageShareStoredAccessPolicy` + - `New-AzStorageDirectory` + - `New-AzStorageShare` + - `New-AzStorageFileSASToken` + - `New-AzStorageShareSASToken` + - `New-AzStorageShareStoredAccessPolicy` + - `Remove-AzStorageDirectory` + - `Remove-AzStorageFile` + - `Remove-AzStorageShare` + - `Remove-AzStorageShareStoredAccessPolicy` + - `Rename-AzStorageDirectory` + - `Rename-AzStorageFile` + - `Set-AzStorageFileContent` + - `Set-AzStorageShareQuota` + - `Set-AzStorageShareStoredAccessPolicy` + - `Start-AzStorageFileCopy` + - `Stop-AzStorageFileCopy` * Supported local user IsNfSv3Enabled and ExtendedGroup - `Set-AzStorageLocalUser` * Supported list local user with IncludeNFSv3 diff --git a/src/Storage/Storage.Management/Models/PSShare.cs b/src/Storage/Storage.Management/Models/PSShare.cs index 6bb9dd70f5ea..6807a64890fe 100644 --- a/src/Storage/Storage.Management/Models/PSShare.cs +++ b/src/Storage/Storage.Management/Models/PSShare.cs @@ -12,21 +12,15 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.Common.Authentication.Abstractions; -using Microsoft.Azure.Management.Storage; using Microsoft.Azure.Management.Storage.Models; using Microsoft.WindowsAzure.Commands.Common.Attributes; -using Microsoft.WindowsAzure.Commands.Common.Storage; -using Microsoft.WindowsAzure.Commands.Storage.Common; -using Microsoft.Azure.Storage; -using Microsoft.Azure.Storage.File; using System; using System.Collections.Generic; using StorageModels = Microsoft.Azure.Management.Storage.Models; namespace Microsoft.Azure.Commands.Management.Storage.Models { - public class PSShare //: CloudFileShare + public class PSShare { public PSShare(StorageModels.FileShare share) { diff --git a/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md b/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md index 48d639999814..86ed126cc2eb 100644 --- a/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md +++ b/src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md @@ -15,49 +15,49 @@ Closes file handles of a file share, a file directory or a file. ### ShareNameCloseAll (Default) ``` Close-AzStorageFileHandle [-ShareName] [[-Path] ] [-Recursive] [-CloseAll] - [-Context ] [-DisAllowTrailingDot] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest ] + [-DisAllowTrailingDot] [-PassThru] [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### ShareNameCloseSingle ``` -Close-AzStorageFileHandle [-ShareName] -FileHandle [-Context ] - [-DisAllowTrailingDot] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] +Close-AzStorageFileHandle [-ShareName] -FileHandle [-DisAllowTrailingDot] [-PassThru] + [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### ShareCloseAll ``` -Close-AzStorageFileHandle [-Share] [-ShareClient ] [[-Path] ] - [-Recursive] [-CloseAll] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] +Close-AzStorageFileHandle [-ShareClient] [[-Path] ] [-Recursive] [-CloseAll] [-PassThru] + [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### ShareCloseSingle ``` -Close-AzStorageFileHandle [-Share] [-ShareClient ] -FileHandle - [-PassThru] [-AsJob] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] +Close-AzStorageFileHandle [-ShareClient] -FileHandle [-PassThru] [-AsJob] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### DirectoryCloseAll ``` -Close-AzStorageFileHandle [-Directory] [-ShareDirectoryClient ] - [[-Path] ] [-Recursive] [-CloseAll] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest ] +Close-AzStorageFileHandle [-ShareDirectoryClient] [[-Path] ] [-Recursive] + [-CloseAll] [-PassThru] [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### FileCloseAll ``` -Close-AzStorageFileHandle [-File] [-ShareFileClient ] [-CloseAll] [-PassThru] - [-AsJob] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] +Close-AzStorageFileHandle [-ShareFileClient] [-CloseAll] [-PassThru] [-AsJob] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -165,7 +165,7 @@ Azure Storage Context Object ```yaml Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext -Parameter Sets: ShareNameCloseAll, ShareNameCloseSingle +Parameter Sets: (All) Aliases: Required: False @@ -190,21 +190,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -CloudFileDirectory object indicated the base folder where the files/directories would be listed. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: DirectoryCloseAll -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -220,21 +205,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -File -CloudFile object indicated the file to close handle. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: FileCloseAll -Aliases: CloudFile - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -FileHandle The File Handle to close. @@ -280,21 +250,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Recursive List handles Recursively. Only works on File Directory. @@ -326,21 +281,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -CloudFileShare object indicated the share where the files/directories would be listed. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: ShareCloseAll, ShareCloseSingle -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient ShareClient object indicated the share which contains the files/directories to closed handle. @@ -349,8 +289,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: ShareCloseAll, ShareCloseSingle Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -364,8 +304,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: DirectoryCloseAll Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -379,8 +319,8 @@ Type: Azure.Storage.Files.Shares.ShareFileClient Parameter Sets: FileCloseAll Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -437,15 +377,19 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient + +### Azure.Storage.Files.Shares.ShareDirectoryClient + +### Azure.Storage.Files.Shares.ShareFileClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel.PSFileHandle ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext ## OUTPUTS -### Microsoft.Azure.Storage.File.CloseFileHandleResultSegment +### System.Int32 ## NOTES diff --git a/src/Storage/Storage.Management/help/Get-AzStorageFile.md b/src/Storage/Storage.Management/help/Get-AzStorageFile.md index f8c0cc119bf5..54312449bc2c 100644 --- a/src/Storage/Storage.Management/help/Get-AzStorageFile.md +++ b/src/Storage/Storage.Management/help/Get-AzStorageFile.md @@ -17,24 +17,21 @@ Lists directories and files for a path. ``` Get-AzStorageFile [-ShareName] [[-Path] ] [-ExcludeExtendedInfo] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ### Share ``` -Get-AzStorageFile [-Share] [-ShareClient ] [[-Path] ] - [-ExcludeExtendedInfo] [-Context ] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [] +Get-AzStorageFile [-ShareClient] [[-Path] ] [-ExcludeExtendedInfo] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ### Directory ``` -Get-AzStorageFile [-Directory] [-ShareDirectoryClient ] - [[-Path] ] [-ExcludeExtendedInfo] [-Context ] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [] +Get-AzStorageFile [-ShareDirectoryClient] [[-Path] ] [-ExcludeExtendedInfo] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ## DESCRIPTION @@ -130,24 +127,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -Specifies a folder as a **CloudFileDirectory** object. -This cmdlet gets the folder that this parameter specifies. -To obtain a directory, use the New-AzStorageDirectory cmdlet. -You can also use the **Get-AzStorageFile** cmdlet to obtain a directory. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: Directory -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -195,21 +174,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the service-side timeout interval, in seconds, for a request. If the specified interval elapses before the service processes the request, the Storage service returns an error. @@ -226,25 +190,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object. -This cmdlet gets a file or directory from the file share that this parameter specifies. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. -This object contains the Storage context. -If you specify this parameter, do not specify the *Context* parameter. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient ShareClient object indicated the share where the files/directories would be listed. @@ -253,8 +198,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -268,8 +213,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: Directory Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -296,9 +241,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Azure.Storage.Files.Shares.ShareDirectoryClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Management/help/Get-AzStorageFileContent.md b/src/Storage/Storage.Management/help/Get-AzStorageFileContent.md index f1303771a9e1..6aa3a53e8d7a 100644 --- a/src/Storage/Storage.Management/help/Get-AzStorageFileContent.md +++ b/src/Storage/Storage.Management/help/Get-AzStorageFileContent.md @@ -18,34 +18,33 @@ Downloads the contents of a file. Get-AzStorageFileContent [-ShareName] [-Path] [[-Destination] ] [-CheckMd5] [-PassThru] [-Force] [-AsJob] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [-PreserveSMBAttribute] [] ``` ### Share ``` -Get-AzStorageFileContent [-Share] [-ShareClient ] [-Path] - [[-Destination] ] [-CheckMd5] [-PassThru] [-Force] [-AsJob] [-Context ] - [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] +Get-AzStorageFileContent [-ShareClient] [-Path] [[-Destination] ] [-CheckMd5] + [-PassThru] [-Force] [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] + [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] ``` ### Directory ``` -Get-AzStorageFileContent [-Directory] [-ShareDirectoryClient ] - [-Path] [[-Destination] ] [-CheckMd5] [-PassThru] [-Force] [-AsJob] - [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] +Get-AzStorageFileContent [-ShareDirectoryClient] [-Path] + [[-Destination] ] [-CheckMd5] [-PassThru] [-Force] [-AsJob] [-Context ] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [-PreserveSMBAttribute] [] ``` ### File ``` -Get-AzStorageFileContent [-File] [-ShareFileClient ] [[-Destination] ] - [-CheckMd5] [-PassThru] [-Force] [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] +Get-AzStorageFileContent [-ShareFileClient] [[-Destination] ] [-CheckMd5] [-PassThru] + [-Force] [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] + [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] ``` ## DESCRIPTION @@ -187,24 +186,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -Specifies a folder as a **CloudFileDirectory** object. -This cmdlet gets content for a file in the folder that this parameter specifies. -To obtain a directory, use the New-AzStorageDirectory cmdlet. -You can also use the Get-AzStorageFile cmdlet to obtain a directory. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: Directory -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -220,23 +201,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -File -Specifies a file as a **CloudFile** object. -This cmdlet gets the file that this parameter specifies. -To obtain a **CloudFile** object, use the Get-AzStorageFile cmdlet. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: File -Aliases: CloudFile - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -Force If you specify the path of a file that does not exist, this cmdlet creates that file, and saves the contents in the new file. If you specify a path of a file that already exists and you specify the *Force* parameter, the cmdlet overwrites the file. @@ -302,21 +266,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the service side time-out interval, in seconds, for a request. If the specified interval elapses before the service processes the request, the storage service returns an error. @@ -332,25 +281,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object. -This cmdlet downloads the contents of the file in the share this parameter specifies. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. -This object contains the storage context. -If you specify this parameter, do not specify the *Context* parameter. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient CloudFileShare object indicated the share where the file would be downloaded. @@ -359,8 +289,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -374,8 +304,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: Directory Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -389,8 +319,8 @@ Type: Azure.Storage.Files.Shares.ShareFileClient Parameter Sets: File Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -448,11 +378,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Azure.Storage.Files.Shares.ShareDirectoryClient -### Microsoft.Azure.Storage.File.CloudFile +### Azure.Storage.Files.Shares.ShareFileClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Management/help/Get-AzStorageFileCopyState.md b/src/Storage/Storage.Management/help/Get-AzStorageFileCopyState.md index d10a7a60120c..e17830be09c1 100644 --- a/src/Storage/Storage.Management/help/Get-AzStorageFileCopyState.md +++ b/src/Storage/Storage.Management/help/Get-AzStorageFileCopyState.md @@ -17,16 +17,14 @@ Gets the state of a copy operation. ``` Get-AzStorageFileCopyState [-ShareName] [-FilePath] [-WaitForComplete] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ### File ``` -Get-AzStorageFileCopyState [-File] [-ShareFileClient ] [-WaitForComplete] - [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] +Get-AzStorageFileCopyState [-ShareFileClient] [-WaitForComplete] [-Context ] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ## DESCRIPTION @@ -136,22 +134,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -File -Specifies a **CloudFile** object. -You can create a cloud file or obtain one by using the Get-AzStorageFile cmdlet. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: File -Aliases: CloudFile - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -FilePath Specifies the path of the file relative to an Azure Storage share. @@ -167,21 +149,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -205,8 +172,8 @@ Type: Azure.Storage.Files.Shares.ShareFileClient Parameter Sets: File Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -248,13 +215,13 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFile +### Azure.Storage.Files.Shares.ShareFileClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext ## OUTPUTS -### Microsoft.Azure.Storage.File.CopyState +### Microsoft.WindowsAzure.Commands.Storage.Common.PSCopyState ## NOTES diff --git a/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md b/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md index 86043e84b187..f46d0ebe639d 100644 --- a/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md +++ b/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md @@ -16,33 +16,32 @@ Lists file handles of a file share, a file directory or a file. ``` Get-AzStorageFileHandle [-ShareName] [[-Path] ] [-Recursive] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-IncludeTotalCount] [-Skip ] [-First ] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-IncludeTotalCount] + [-Skip ] [-First ] [] ``` ### Share ``` -Get-AzStorageFileHandle [-Share] [-ShareClient ] [[-Path] ] [-Recursive] +Get-AzStorageFileHandle [-ShareClient] [[-Path] ] [-Recursive] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-IncludeTotalCount] [-Skip ] [-First ] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-IncludeTotalCount] + [-Skip ] [-First ] [] ``` ### Directory ``` -Get-AzStorageFileHandle [-Directory] [-ShareDirectoryClient ] - [[-Path] ] [-Recursive] [-Context ] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-IncludeTotalCount] [-Skip ] [-First ] - [] +Get-AzStorageFileHandle [-ShareDirectoryClient] [[-Path] ] [-Recursive] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-IncludeTotalCount] + [-Skip ] [-First ] [] ``` ### File ``` -Get-AzStorageFileHandle [-File] [-ShareFileClient ] [-Recursive] - [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-IncludeTotalCount] [-Skip ] [-First ] [] +Get-AzStorageFileHandle [-ShareFileClient ] [-Recursive] [-Context ] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-IncludeTotalCount] + [-Skip ] [-First ] [] ``` ## DESCRIPTION @@ -161,21 +160,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -CloudFileDirectory object indicated the base folder where the files/directories would be listed. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: Directory -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -191,21 +175,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -File -CloudFile object indicated the file to list File Handles. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: File -Aliases: CloudFile - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -Path Path to an existing file/directory. @@ -221,21 +190,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Recursive List handles Recursively. Only works on File Directory. @@ -267,21 +221,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -CloudFileShare object indicated the share where the files/directories would be listed. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient ShareClient object indicated the share where the files/directories would list File Handles @@ -290,8 +229,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -305,8 +244,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: Directory Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -393,15 +332,17 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient + +### Azure.Storage.Files.Shares.ShareDirectoryClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Azure.Storage.Files.Shares.ShareFileClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext ## OUTPUTS -### Microsoft.Azure.Storage.File.FileHandleResultSegment +### Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel.PSFileHandle ## NOTES diff --git a/src/Storage/Storage.Management/help/Get-AzStorageShare.md b/src/Storage/Storage.Management/help/Get-AzStorageShare.md index 1067b6d2a581..339d8df25ebd 100644 --- a/src/Storage/Storage.Management/help/Get-AzStorageShare.md +++ b/src/Storage/Storage.Management/help/Get-AzStorageShare.md @@ -17,16 +17,14 @@ Gets a list of file shares. ``` Get-AzStorageShare [[-Prefix] ] [-IncludeDeleted] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ### Specific ``` Get-AzStorageShare [-Name] [[-SnapshotTime] ] [-SkipGetProperty] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ## DESCRIPTION @@ -189,21 +187,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. diff --git a/src/Storage/Storage.Management/help/New-AzStorageDirectory.md b/src/Storage/Storage.Management/help/New-AzStorageDirectory.md index 5fef847ef46d..0f178ddb6cae 100644 --- a/src/Storage/Storage.Management/help/New-AzStorageDirectory.md +++ b/src/Storage/Storage.Management/help/New-AzStorageDirectory.md @@ -17,24 +17,21 @@ Creates a directory. ``` New-AzStorageDirectory [-ShareName] [-Path] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ### Share ``` -New-AzStorageDirectory [-Share] [-ShareClient ] [-Path] - [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] +New-AzStorageDirectory [-ShareClient] [-Path] [-Context ] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ### Directory ``` -New-AzStorageDirectory [-Directory] [-ShareDirectoryClient ] - [-Path] [-Context ] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [] +New-AzStorageDirectory [-ShareDirectoryClient] [-Path] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ## DESCRIPTION @@ -127,24 +124,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -Specifies a folder as a **CloudFileDirectory** object. -This cmdlet creates the folder in the location that this parameter specifies. -To obtain a directory, use the New-AzStorageDirectory cmdlet. -You can also use the Get-AzStorageFile cmdlet to obtain a directory. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: Directory -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -176,21 +155,6 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -206,25 +170,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object. -This cmdlet creates a folder in the file share that this parameter specifies. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. -This object contains the storage context. -If you specify this parameter, do not specify the *Context* parameter. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient ShareClient object indicated the share where the files/directories would be listed. @@ -233,8 +178,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -248,8 +193,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: Directory Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -276,9 +221,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Azure.Storage.Files.Shares.ShareDirectoryClient ### System.String diff --git a/src/Storage/Storage.Management/help/New-AzStorageFileSASToken.md b/src/Storage/Storage.Management/help/New-AzStorageFileSASToken.md index b69bba0336ae..8a88d0ffd951 100644 --- a/src/Storage/Storage.Management/help/New-AzStorageFileSASToken.md +++ b/src/Storage/Storage.Management/help/New-AzStorageFileSASToken.md @@ -15,32 +15,30 @@ Generates a shared access signature token for a Storage file. ### NameSasPermission ``` -New-AzStorageFileSASToken [-ShareName] [-Path] [-Permission ] - [-Protocol ] [-IPAddressOrRange ] [-StartTime ] - [-ExpiryTime ] [-FullUri] [-Context ] [-DefaultProfile ] - [-ProgressAction ] [] +New-AzStorageFileSASToken [-ShareName] [-Path] [-Permission ] [-Protocol ] + [-IPAddressOrRange ] [-StartTime ] [-ExpiryTime ] [-FullUri] + [-Context ] [-DefaultProfile ] [] ``` ### NameSasPolicy ``` -New-AzStorageFileSASToken [-ShareName] [-Path] -Policy - [-Protocol ] [-IPAddressOrRange ] [-StartTime ] - [-ExpiryTime ] [-FullUri] [-Context ] [-DefaultProfile ] - [-ProgressAction ] [] +New-AzStorageFileSASToken [-ShareName] [-Path] -Policy [-Protocol ] + [-IPAddressOrRange ] [-StartTime ] [-ExpiryTime ] [-FullUri] + [-Context ] [-DefaultProfile ] [] ``` ### FileSasPermission ``` -New-AzStorageFileSASToken -File [-Permission ] [-Protocol ] +New-AzStorageFileSASToken -ShareFileClient [-Permission ] [-Protocol ] [-IPAddressOrRange ] [-StartTime ] [-ExpiryTime ] [-FullUri] - [-DefaultProfile ] [-ProgressAction ] [] + [-Context ] [-DefaultProfile ] [] ``` ### FileSasPolicy ``` -New-AzStorageFileSASToken -File -Policy [-Protocol ] +New-AzStorageFileSASToken -ShareFileClient -Policy [-Protocol ] [-IPAddressOrRange ] [-StartTime ] [-ExpiryTime ] [-FullUri] - [-DefaultProfile ] [-ProgressAction ] [] + [-Context ] [-DefaultProfile ] [] ``` ## DESCRIPTION @@ -78,13 +76,13 @@ To obtain a context, use the New-AzStorageContext cmdlet. ```yaml Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext -Parameter Sets: NameSasPermission, NameSasPolicy +Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None -Accept pipeline input: True (ByValue) +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` @@ -118,22 +116,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -File -Specifies a **CloudFile** object. -You can create a cloud file or obtain one by using the Get-AzStorageFile cmdlet. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: FileSasPermission, FileSasPolicy -Aliases: CloudFile - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -FullUri Indicates that this cmdlet return the full blob URI and the shared access signature token. @@ -211,13 +193,18 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} +### -Protocol +Specifies the protocol permitted for a request. +The acceptable values for this parameter are: +* HttpsOnly +* HttpsOrHttp +The default value is HttpsOrHttp. ```yaml -Type: System.Management.Automation.ActionPreference +Type: System.String Parameter Sets: (All) -Aliases: proga +Aliases: +Accepted values: HttpsOnly, HttpsOrHttp Required: False Position: Named @@ -226,23 +213,18 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Protocol -Specifies the protocol permitted for a request. -The acceptable values for this parameter are: -* HttpsOnly -* HttpsOrHttp -The default value is HttpsOrHttp. +### -ShareFileClient +CloudFile instance to represent the file to get SAS token against. ```yaml -Type: System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol] -Parameter Sets: (All) +Type: Azure.Storage.Files.Shares.ShareFileClient +Parameter Sets: FileSasPermission, FileSasPolicy Aliases: -Accepted values: HttpsOnly, HttpsOrHttp -Required: False +Required: True Position: Named Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` @@ -283,7 +265,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### System.String -### Microsoft.Azure.Storage.File.CloudFile +### Azure.Storage.Files.Shares.ShareFileClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Management/help/New-AzStorageShare.md b/src/Storage/Storage.Management/help/New-AzStorageShare.md index 4a0a70366ed3..a76d953ad8b8 100644 --- a/src/Storage/Storage.Management/help/New-AzStorageShare.md +++ b/src/Storage/Storage.Management/help/New-AzStorageShare.md @@ -16,7 +16,7 @@ Creates a file share. ``` New-AzStorageShare [-Name] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [] + [] ``` ## DESCRIPTION @@ -116,21 +116,6 @@ Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. diff --git a/src/Storage/Storage.Management/help/New-AzStorageShareSASToken.md b/src/Storage/Storage.Management/help/New-AzStorageShareSASToken.md index 73daf541521a..71545b42db8c 100644 --- a/src/Storage/Storage.Management/help/New-AzStorageShareSASToken.md +++ b/src/Storage/Storage.Management/help/New-AzStorageShareSASToken.md @@ -15,18 +15,16 @@ Generate Shared Access Signature token for Azure Storage share. ### SasPolicy ``` -New-AzStorageShareSASToken [-ShareName] -Policy [-Protocol ] +New-AzStorageShareSASToken [-ShareName] -Policy [-Protocol ] [-IPAddressOrRange ] [-StartTime ] [-ExpiryTime ] [-FullUri] - [-Context ] [-DefaultProfile ] [-ProgressAction ] - [] + [-Context ] [-DefaultProfile ] [] ``` ### SasPermission ``` -New-AzStorageShareSASToken [-ShareName] [-Permission ] [-Protocol ] +New-AzStorageShareSASToken [-ShareName] [-Permission ] [-Protocol ] [-IPAddressOrRange ] [-StartTime ] [-ExpiryTime ] [-FullUri] - [-Context ] [-DefaultProfile ] [-ProgressAction ] - [] + [-Context ] [-DefaultProfile ] [] ``` ## DESCRIPTION @@ -167,21 +165,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Protocol Specifies the protocol permitted for a request. The acceptable values for this parameter are: @@ -190,7 +173,7 @@ The acceptable values for this parameter are: The default value is HttpsOrHttp. ```yaml -Type: System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol] +Type: System.String Parameter Sets: (All) Aliases: Accepted values: HttpsOnly, HttpsOrHttp diff --git a/src/Storage/Storage.Management/help/New-AzStorageShareStoredAccessPolicy.md b/src/Storage/Storage.Management/help/New-AzStorageShareStoredAccessPolicy.md index 5fb46a0608f7..8249a96c05c6 100644 --- a/src/Storage/Storage.Management/help/New-AzStorageShareStoredAccessPolicy.md +++ b/src/Storage/Storage.Management/help/New-AzStorageShareStoredAccessPolicy.md @@ -17,8 +17,7 @@ Creates a stored access policy on a Storage share. New-AzStorageShareStoredAccessPolicy [-ShareName] [-Policy] [-Permission ] [-StartTime ] [-ExpiryTime ] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ## DESCRIPTION @@ -148,21 +147,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. diff --git a/src/Storage/Storage.Management/help/Remove-AzStorageDirectory.md b/src/Storage/Storage.Management/help/Remove-AzStorageDirectory.md index a0a39a976c27..38f45267382a 100644 --- a/src/Storage/Storage.Management/help/Remove-AzStorageDirectory.md +++ b/src/Storage/Storage.Management/help/Remove-AzStorageDirectory.md @@ -17,24 +17,24 @@ Deletes a directory. ``` Remove-AzStorageDirectory [-ShareName] [-Path] [-PassThru] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### Share ``` -Remove-AzStorageDirectory [-Share] [-ShareClient ] [-Path] [-PassThru] +Remove-AzStorageDirectory [-ShareClient] [-Path] [-PassThru] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### Directory ``` -Remove-AzStorageDirectory [-Directory] [-ShareDirectoryClient ] - [[-Path] ] [-PassThru] [-Context ] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] +Remove-AzStorageDirectory [-ShareDirectoryClient] [[-Path] ] [-PassThru] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -118,24 +118,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -Specifies a folder as a **CloudFileDirectory** object. -This cmdlet removes the folder that this parameter specifies. -To obtain a directory, use the New-AzStorageDirectory cmdlet. -You can also use the **Get-AzStorageFile** cmdlet to obtain a directory. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: Directory -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -197,21 +179,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -227,25 +194,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object. -This cmdlet removes a folder under the file share that this parameter specifies. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. -This object contains the storage context. -If you specify this parameter, do not specify the *Context* parameter. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient ShareClient object indicated the share where the directory would be removed. @@ -254,8 +202,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -269,8 +217,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: Directory Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -328,9 +276,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Azure.Storage.Files.Shares.ShareDirectoryClient ### System.String diff --git a/src/Storage/Storage.Management/help/Remove-AzStorageFile.md b/src/Storage/Storage.Management/help/Remove-AzStorageFile.md index deb871f9c546..a407dc0b4eb7 100644 --- a/src/Storage/Storage.Management/help/Remove-AzStorageFile.md +++ b/src/Storage/Storage.Management/help/Remove-AzStorageFile.md @@ -17,32 +17,32 @@ Deletes a file. ``` Remove-AzStorageFile [-ShareName] [-Path] [-PassThru] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### Share ``` -Remove-AzStorageFile [-Share] [-ShareClient ] [-Path] [-PassThru] - [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] +Remove-AzStorageFile [-ShareClient] [-Path] [-PassThru] [-Context ] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### Directory ``` -Remove-AzStorageFile [-Directory] [-ShareDirectoryClient ] - [-Path] [-PassThru] [-Context ] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] +Remove-AzStorageFile [-ShareDirectoryClient] [-Path] [-PassThru] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### File ``` -Remove-AzStorageFile [-File] [-ShareFileClient ] [-PassThru] - [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] +Remove-AzStorageFile [-ShareFileClient] [-PassThru] [-Context ] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -134,22 +134,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -Specifies a folder as a **CloudFileDirectory** object. -This cmdlet removes a file in the folder that this parameter specifies. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: Directory -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -165,23 +149,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -File -Specifies a file as a **CloudFile** object. -This cmdlet removes the file that this parameter specifies. -To obtain a **CloudFile** object, use the Get-AzStorageFile cmdlet. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: File -Aliases: CloudFile - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -PassThru Indicates that this cmdlet returns a **Boolean** that reflects the success of the operation. By default, this cmdlet does not return a value. @@ -214,21 +181,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -244,25 +196,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object. -This cmdlet removes the file in the share this parameter specifies. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. -This object contains the storage context. -If you specify this parameter, do not specify the *Context* parameter. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient ShareClient object indicated the share where the file would be removed. @@ -271,8 +204,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -286,8 +219,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: Directory Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -301,8 +234,8 @@ Type: Azure.Storage.Files.Shares.ShareFileClient Parameter Sets: File Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -360,11 +293,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Azure.Storage.Files.Shares.ShareDirectoryClient -### Microsoft.Azure.Storage.File.CloudFile +### Azure.Storage.Files.Shares.ShareFileClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Management/help/Remove-AzStorageShare.md b/src/Storage/Storage.Management/help/Remove-AzStorageShare.md index a89bc618c90b..4e58b0ea930f 100644 --- a/src/Storage/Storage.Management/help/Remove-AzStorageShare.md +++ b/src/Storage/Storage.Management/help/Remove-AzStorageShare.md @@ -17,16 +17,16 @@ Deletes a file share. ``` Remove-AzStorageShare [-Name] [-IncludeAllSnapshot] [-SnapshotTime ] [-Force] [-PassThru] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### Share ``` -Remove-AzStorageShare [-Share] [[-ShareClient] ] [-IncludeAllSnapshot] [-Force] - [-PassThru] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] +Remove-AzStorageShare [-ShareClient] [-IncludeAllSnapshot] [-Force] [-PassThru] + [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -179,21 +179,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -209,25 +194,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object. -This cmdlet removes the object that this parameter specifies. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. -This object contains the storage context. -If you specify this parameter, do not specify the *Context* parameter. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient File share Client to be removed. @@ -236,7 +202,7 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False +Required: True Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) @@ -296,7 +262,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### System.String -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient + +### System.Nullable`1[[System.DateTimeOffset, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Management/help/Remove-AzStorageShareStoredAccessPolicy.md b/src/Storage/Storage.Management/help/Remove-AzStorageShareStoredAccessPolicy.md index 23432c7710cf..5929f3d1cb5f 100644 --- a/src/Storage/Storage.Management/help/Remove-AzStorageShareStoredAccessPolicy.md +++ b/src/Storage/Storage.Management/help/Remove-AzStorageShareStoredAccessPolicy.md @@ -16,8 +16,8 @@ Removes a stored access policy from a Storage share. ``` Remove-AzStorageShareStoredAccessPolicy [-ShareName] [-Policy] [-PassThru] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -132,21 +132,6 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. diff --git a/src/Storage/Storage.Management/help/Rename-AzStorageDirectory.md b/src/Storage/Storage.Management/help/Rename-AzStorageDirectory.md index d7eb4850d1a2..57ea768185ed 100644 --- a/src/Storage/Storage.Management/help/Rename-AzStorageDirectory.md +++ b/src/Storage/Storage.Management/help/Rename-AzStorageDirectory.md @@ -16,24 +16,22 @@ Renames a directory. ``` Rename-AzStorageDirectory [-ShareName] [-SourcePath] [[-DestinationPath] ] [-Permission ] [-DisAllowSourceTrailingDot] [-DisAllowDestTrailingDot] [-Force] [-AsJob] - [-Context ] [-DefaultProfile ] [-IgnoreReadonly] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-Context ] [-DefaultProfile ] [-IgnoreReadonly] [-WhatIf] [-Confirm] + [] ``` ### ShareObject ``` Rename-AzStorageDirectory [-ShareClient] [-SourcePath] [[-DestinationPath] ] [-Permission ] [-Force] [-AsJob] [-Context ] - [-DefaultProfile ] [-IgnoreReadonly] [-ProgressAction ] [-WhatIf] - [-Confirm] [] + [-DefaultProfile ] [-IgnoreReadonly] [-WhatIf] [-Confirm] [] ``` ### DirecotryObject ``` Rename-AzStorageDirectory [-ShareDirectoryClient] [[-DestinationPath] ] [-Permission ] [-Force] [-AsJob] [-Context ] - [-DefaultProfile ] [-IgnoreReadonly] [-ProgressAction ] [-WhatIf] - [-Confirm] [] + [-DefaultProfile ] [-IgnoreReadonly] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -212,21 +210,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ShareClient ShareClienr indicated the share where the directory would be listed. diff --git a/src/Storage/Storage.Management/help/Rename-AzStorageFile.md b/src/Storage/Storage.Management/help/Rename-AzStorageFile.md index ea5d69587f15..b38e6e77e977 100644 --- a/src/Storage/Storage.Management/help/Rename-AzStorageFile.md +++ b/src/Storage/Storage.Management/help/Rename-AzStorageFile.md @@ -17,31 +17,29 @@ Renames a file. Rename-AzStorageFile [-ShareName] [-SourcePath] [[-DestinationPath] ] [-ContentType ] [-Permission ] [-DisAllowSourceTrailingDot] [-DisAllowDestTrailingDot] [-Force] [-AsJob] [-Context ] [-DefaultProfile ] [-IgnoreReadonly] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### FileObject ``` Rename-AzStorageFile [-ShareFileClient] [[-DestinationPath] ] [-ContentType ] [-Permission ] [-Force] [-AsJob] [-Context ] - [-DefaultProfile ] [-IgnoreReadonly] [-ProgressAction ] [-WhatIf] - [-Confirm] [] + [-DefaultProfile ] [-IgnoreReadonly] [-WhatIf] [-Confirm] [] ``` ### ShareObject ``` Rename-AzStorageFile [-ShareClient] [-SourcePath] [[-DestinationPath] ] [-ContentType ] [-Permission ] [-Force] [-AsJob] [-Context ] - [-DefaultProfile ] [-IgnoreReadonly] [-ProgressAction ] [-WhatIf] - [-Confirm] [] + [-DefaultProfile ] [-IgnoreReadonly] [-WhatIf] [-Confirm] [] ``` ### DirecotryObject ``` Rename-AzStorageFile [-ShareDirectoryClient] [-SourcePath] [[-DestinationPath] ] [-ContentType ] [-Permission ] [-Force] [-AsJob] - [-Context ] [-DefaultProfile ] [-IgnoreReadonly] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-Context ] [-DefaultProfile ] [-IgnoreReadonly] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -236,21 +234,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ShareClient ShareClient indicated the share where the file would be listed. diff --git a/src/Storage/Storage.Management/help/Set-AzStorageFileContent.md b/src/Storage/Storage.Management/help/Set-AzStorageFileContent.md index 0768ee884615..4ca80287c725 100644 --- a/src/Storage/Storage.Management/help/Set-AzStorageFileContent.md +++ b/src/Storage/Storage.Management/help/Set-AzStorageFileContent.md @@ -18,24 +18,22 @@ Uploads the contents of a file. Set-AzStorageFileContent [-ShareName] [-Source] [[-Path] ] [-PassThru] [-Force] [-AsJob] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] + [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] ``` ### Share ``` -Set-AzStorageFileContent [-Share] [-ShareClient ] [-Source] - [[-Path] ] [-PassThru] [-Force] [-AsJob] [-Context ] - [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] +Set-AzStorageFileContent [-ShareClient] [-Source] [[-Path] ] [-PassThru] + [-Force] [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] + [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] ``` ### Directory ``` -Set-AzStorageFileContent [-Directory] [-ShareDirectoryClient ] - [-Source] [[-Path] ] [-PassThru] [-Force] [-AsJob] [-Context ] - [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] +Set-AzStorageFileContent [-ShareDirectoryClient] [-Source] [[-Path] ] + [-PassThru] [-Force] [-AsJob] [-Context ] [-ServerTimeoutPerRequest ] + [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] [-PreserveSMBAttribute] [] ``` @@ -57,7 +55,7 @@ $CurrentFolder = (Get-Item .).FullName $Container = Get-AzStorageShare -Name "ContosoShare06" Get-ChildItem -Recurse | Where-Object { $_.GetType().Name -eq "FileInfo"} | ForEach-Object { $path=$_.FullName.Substring($Currentfolder.Length+1).Replace("\","/") - Set-AzStorageFileContent -Share $Container -Source $_.FullName -Path $path -Force + Set-AzStorageFileContent -ShareClient $Container -Source $_.FullName -Path $path -Force } ``` @@ -161,24 +159,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Directory -Specifies a folder as a **CloudFileDirectory** object. -This cmdlet uploads the file to the folder that this parameter specifies. -To obtain a directory, use the New-AzStorageDirectory cmdlet. -You can also use the Get-AzStorageFile cmdlet to obtain a directory. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileDirectory -Parameter Sets: Directory -Aliases: CloudFileDirectory - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -DisAllowTrailingDot Disallow trailing dot (.) to suffix directory and file names. @@ -260,21 +240,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -290,25 +255,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object. -This cmdlet uploads to a file in the file share this parameter specifies. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. -This object contains the storage context. -If you specify this parameter, do not specify the *Context* parameter. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare -Parameter Sets: Share -Aliases: CloudFileShare - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -ShareClient ShareClient object indicated the share where the file would be uploaded to. @@ -317,8 +263,8 @@ Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -332,8 +278,8 @@ Type: Azure.Storage.Files.Shares.ShareDirectoryClient Parameter Sets: Directory Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -407,9 +353,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient -### Microsoft.Azure.Storage.File.CloudFileDirectory +### Azure.Storage.Files.Shares.ShareDirectoryClient ### System.String diff --git a/src/Storage/Storage.Management/help/Set-AzStorageShareQuota.md b/src/Storage/Storage.Management/help/Set-AzStorageShareQuota.md index 0eab52c1fd4e..96c71f8a5bba 100644 --- a/src/Storage/Storage.Management/help/Set-AzStorageShareQuota.md +++ b/src/Storage/Storage.Management/help/Set-AzStorageShareQuota.md @@ -17,16 +17,14 @@ Sets the storage capacity for a share. ``` Set-AzStorageShareQuota [-ShareName] [-Quota] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ### Share ``` -Set-AzStorageShareQuota [-Share] [-Quota] [-Context ] +Set-AzStorageShareQuota [-ShareClient] [-Quota] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [] ``` ## DESCRIPTION @@ -110,21 +108,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Quota Specifies the quota value in gigabytes (GB). See the quota limitation in https://learn.microsoft.com/azure/azure-subscription-service-limits#azure-files-limits. @@ -156,14 +139,13 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Share -Specifies a **CloudFileShare** object to represent the share for which this cmdlets sets a quota. -To obtain a **CloudFileShare** object, use the Get-AzStorageShare cmdlet. +### -ShareClient +ShareClient object indicated the share whose quota to set. ```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare +Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: Share -Aliases: CloudFileShare +Aliases: Required: True Position: 0 @@ -194,7 +176,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### System.String -### Microsoft.Azure.Storage.File.CloudFileShare +### Azure.Storage.Files.Shares.ShareClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Management/help/Set-AzStorageShareStoredAccessPolicy.md b/src/Storage/Storage.Management/help/Set-AzStorageShareStoredAccessPolicy.md index ae4e01306240..3f3f747e0d29 100644 --- a/src/Storage/Storage.Management/help/Set-AzStorageShareStoredAccessPolicy.md +++ b/src/Storage/Storage.Management/help/Set-AzStorageShareStoredAccessPolicy.md @@ -17,8 +17,8 @@ Updates a stored access policy on a Storage share. Set-AzStorageShareStoredAccessPolicy [-ShareName] [-Policy] [-Permission ] [-StartTime ] [-ExpiryTime ] [-NoStartTime] [-NoExpiryTime] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -178,21 +178,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -279,7 +264,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### System.String +### System.Management.Automation.PSObject ## NOTES diff --git a/src/Storage/Storage.Management/help/Start-AzStorageFileCopy.md b/src/Storage/Storage.Management/help/Start-AzStorageFileCopy.md index 8d86b6da8cdc..3c11e8b33eb2 100644 --- a/src/Storage/Storage.Management/help/Start-AzStorageFileCopy.md +++ b/src/Storage/Storage.Management/help/Start-AzStorageFileCopy.md @@ -18,32 +18,33 @@ Starts to copy a source file. Start-AzStorageFileCopy -SrcBlobName -SrcContainerName -DestShareName -DestFilePath [-Context ] [-DestContext ] [-DisAllowDestTrailingDot] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### ContainerInstance ``` -Start-AzStorageFileCopy -SrcBlobName -SrcContainer -DestShareName - -DestFilePath [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] +Start-AzStorageFileCopy -SrcBlobName -SrcContainer -DestShareName + -DestFilePath [-Context ] [-DestContext ] [-Force] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### BlobInstanceFilePath ``` -Start-AzStorageFileCopy -SrcBlob -DestShareName -DestFilePath - [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] +Start-AzStorageFileCopy -SrcBlob -DestShareName -DestFilePath + [-Context ] [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### BlobInstanceFileInstance ``` -Start-AzStorageFileCopy -SrcBlob [-DestFile ] [-DestShareFileClient ] - [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] +Start-AzStorageFileCopy -SrcBlob [-DestShareFileClient ] + [-Context ] [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### ShareName @@ -52,31 +53,32 @@ Start-AzStorageFileCopy -SrcFilePath -SrcShareName -DestShareN -DestFilePath [-Context ] [-DestContext ] [-DisAllowSourceTrailingDot] [-DisAllowDestTrailingDot] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### ShareInstance ``` -Start-AzStorageFileCopy -SrcFilePath -SrcShare -DestShareName - -DestFilePath [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] - [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] +Start-AzStorageFileCopy -SrcFilePath -SrcShare -DestShareName + -DestFilePath [-Context ] [-DestContext ] [-Force] + [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ### FileInstanceToFilePath ``` -Start-AzStorageFileCopy -SrcFile -DestShareName -DestFilePath - [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] +Start-AzStorageFileCopy -SrcFile -DestShareName -DestFilePath + [-Context ] [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### FileInstanceToFileInstance ``` -Start-AzStorageFileCopy -SrcFile [-DestFile ] [-DestShareFileClient ] - [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] +Start-AzStorageFileCopy -SrcFile [-DestShareFileClient ] + [-Context ] [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### UriToFilePath @@ -84,15 +86,15 @@ Start-AzStorageFileCopy -SrcFile [-DestFile ] [-DestShare Start-AzStorageFileCopy -AbsoluteUri -DestShareName -DestFilePath [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### UriToFileInstance ``` -Start-AzStorageFileCopy -AbsoluteUri [-DestFile ] [-DestShareFileClient ] +Start-AzStorageFileCopy -AbsoluteUri [-DestShareFileClient ] [-DestContext ] [-Force] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -177,7 +179,7 @@ To obtain a context, use the New-AzStorageContext cmdlet. ```yaml Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext -Parameter Sets: ContainerName, ShareName +Parameter Sets: ContainerName, ContainerInstance, BlobInstanceFilePath, BlobInstanceFileInstance, ShareName, ShareInstance, FileInstanceToFilePath, FileInstanceToFileInstance Aliases: SrcContext Required: False @@ -218,22 +220,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DestFile -Specifies a **CloudFile** object. -You can create a cloud file or obtain one by using the Get-AzStorageFile cmdlet. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: BlobInstanceFileInstance, FileInstanceToFileInstance, UriToFileInstance -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -DestFilePath Specifies the path of the destination file relative to the destination share. @@ -324,21 +310,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -359,9 +330,9 @@ Specifies a **CloudBlob** object. You can create a cloud blob or obtain one by using the Get-AzStorageBlob cmdlet. ```yaml -Type: Microsoft.Azure.Storage.Blob.CloudBlob +Type: Azure.Storage.Blobs.Specialized.BlobBaseClient Parameter Sets: BlobInstanceFilePath, BlobInstanceFileInstance -Aliases: ICloudBlob +Aliases: BlobBaseClient Required: True Position: Named @@ -390,9 +361,9 @@ Specifies a cloud blob container object. You can create cloud blob container object or use the Get-AzStorageContainer cmdlet. ```yaml -Type: Microsoft.Azure.Storage.Blob.CloudBlobContainer +Type: Azure.Storage.Blobs.BlobContainerClient Parameter Sets: ContainerInstance -Aliases: +Aliases: BlobContainerClient Required: True Position: Named @@ -421,9 +392,9 @@ Specifies a **CloudFile** object. You can create a cloud file or obtain one by using **Get-AzStorageFile**. ```yaml -Type: Microsoft.Azure.Storage.File.CloudFile +Type: Azure.Storage.Files.Shares.ShareFileClient Parameter Sets: FileInstanceToFilePath, FileInstanceToFileInstance -Aliases: CloudFile +Aliases: ShareFileClient Required: True Position: Named @@ -452,9 +423,9 @@ Specifies a cloud file share object. You can create a cloud file share or obtain one by using the Get-AzStorageShare cmdlet. ```yaml -Type: Microsoft.Azure.Storage.File.CloudFileShare +Type: Azure.Storage.Files.Shares.ShareClient Parameter Sets: ShareInstance -Aliases: CloudFileShare +Aliases: ShareClient Required: True Position: Named @@ -514,9 +485,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.Blob.CloudBlob +### Azure.Storage.Blobs.Specialized.BlobBaseClient -### Microsoft.Azure.Storage.File.CloudFile +### Azure.Storage.Files.Shares.ShareFileClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Management/help/Stop-AzStorageFileCopy.md b/src/Storage/Storage.Management/help/Stop-AzStorageFileCopy.md index adb44e488fd6..171a2b8b6844 100644 --- a/src/Storage/Storage.Management/help/Stop-AzStorageFileCopy.md +++ b/src/Storage/Storage.Management/help/Stop-AzStorageFileCopy.md @@ -18,15 +18,15 @@ Stops a copy operation to the specified destination file. Stop-AzStorageFileCopy [-ShareName] [-FilePath] [-CopyId ] [-Force] [-DisAllowTrailingDot] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] [-DefaultProfile ] [-ConcurrentTaskCount ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-WhatIf] [-Confirm] [] ``` ### File ``` -Stop-AzStorageFileCopy [-File] [-ShareFileClient ] [-CopyId ] [-Force] +Stop-AzStorageFileCopy [-ShareFileClient] [-CopyId ] [-Force] [-Context ] [-ServerTimeoutPerRequest ] [-ClientTimeoutPerRequest ] - [-DefaultProfile ] [-ConcurrentTaskCount ] [-ProgressAction ] - [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ConcurrentTaskCount ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -140,22 +140,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -File -Specifies a **CloudFile** object. -You can create a cloud file or obtain one by using the Get-AzStorageFile cmdlet. - -```yaml -Type: Microsoft.Azure.Storage.File.CloudFile -Parameter Sets: File -Aliases: CloudFile - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - ### -FilePath Specifies the path of a file. @@ -186,21 +170,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ProgressAction -{{ Fill ProgressAction Description }} - -```yaml -Type: System.Management.Automation.ActionPreference -Parameter Sets: (All) -Aliases: proga - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -ServerTimeoutPerRequest Specifies the length of the time-out period for the server part of a request. @@ -224,8 +193,8 @@ Type: Azure.Storage.Files.Shares.ShareFileClient Parameter Sets: File Aliases: -Required: False -Position: Named +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False @@ -282,7 +251,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS -### Microsoft.Azure.Storage.File.CloudFile +### Azure.Storage.Files.Shares.ShareFileClient ### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext diff --git a/src/Storage/Storage.Test/Common/AccessPolicyHelperTest.cs b/src/Storage/Storage.Test/Common/AccessPolicyHelperTest.cs index 5c32afeb82c9..084598c20a6a 100644 --- a/src/Storage/Storage.Test/Common/AccessPolicyHelperTest.cs +++ b/src/Storage/Storage.Test/Common/AccessPolicyHelperTest.cs @@ -17,7 +17,6 @@ using Microsoft.WindowsAzure.Commands.Storage.Common; using Microsoft.Azure.Storage.Blob; using Microsoft.Azure.Cosmos.Table; -using Microsoft.Azure.Storage.File; namespace Microsoft.WindowsAzure.Commands.Storage.Test.Common { @@ -45,15 +44,6 @@ public void ValidateSetupAccessPolicyPermissionTest() Assert.AreEqual(tableAccessPolicy.Permissions, SharedAccessTablePermissions.None); AccessPolicyHelper.SetupAccessPolicyPermission(tableAccessPolicy, "ar"); Assert.AreEqual(tableAccessPolicy.Permissions, SharedAccessTablePermissions.Add | SharedAccessTablePermissions.Query); - - SharedAccessFilePolicy fileAccessPolicy = new SharedAccessFilePolicy(); - AccessPolicyHelper.SetupAccessPolicyPermission(fileAccessPolicy, null); - Assert.AreEqual(fileAccessPolicy.Permissions, SharedAccessFilePermissions.None); - AccessPolicyHelper.SetupAccessPolicyPermission(fileAccessPolicy, ""); - Assert.AreEqual(fileAccessPolicy.Permissions, SharedAccessFilePermissions.None); - AccessPolicyHelper.SetupAccessPolicyPermission(fileAccessPolicy, "lwc"); - Assert.AreEqual(fileAccessPolicy.Permissions, SharedAccessFilePermissions.List | SharedAccessFilePermissions.Write | SharedAccessFilePermissions.Create); - } [TestMethod] @@ -86,12 +76,6 @@ public void SetupAccessPolicyTest() Assert.AreEqual(tableAccessPolicy.SharedAccessStartTime, null); Assert.AreEqual(tableAccessPolicy.SharedAccessExpiryTime.Value.UtcDateTime.ToString(), end.Value.ToUniversalTime().ToString()); Assert.AreEqual(tableAccessPolicy.Permissions, SharedAccessTablePermissions.Delete); - - SharedAccessFilePolicy fileAccessPolicy = new SharedAccessFilePolicy(); - AccessPolicyHelper.SetupAccessPolicy(fileAccessPolicy, null, null, "dl", true, true); - Assert.AreEqual(fileAccessPolicy.SharedAccessStartTime, null); - Assert.AreEqual(fileAccessPolicy.SharedAccessExpiryTime, null); - Assert.AreEqual(fileAccessPolicy.Permissions, SharedAccessFilePermissions.List | SharedAccessFilePermissions.Delete); } } } diff --git a/src/Storage/Storage.Test/Common/MockTransferManager.cs b/src/Storage/Storage.Test/Common/MockTransferManager.cs index 4685ae5451d6..c3461bf61dac 100644 --- a/src/Storage/Storage.Test/Common/MockTransferManager.cs +++ b/src/Storage/Storage.Test/Common/MockTransferManager.cs @@ -1,4 +1,4 @@ -// ---------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/Storage/Storage.Test/Common/PSServicePropertiesTest.cs b/src/Storage/Storage.Test/Common/PSServicePropertiesTest.cs index 41e11958ca02..e2645cb64267 100644 --- a/src/Storage/Storage.Test/Common/PSServicePropertiesTest.cs +++ b/src/Storage/Storage.Test/Common/PSServicePropertiesTest.cs @@ -15,12 +15,7 @@ using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.Common; using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; -using Microsoft.Azure.Storage.Blob; -using XTable = Microsoft.Azure.Cosmos.Table; -using Microsoft.Azure.Storage.File; -using Microsoft.Azure.Storage.Queue; using Microsoft.Azure.Storage.Shared.Protocol; namespace Microsoft.WindowsAzure.Commands.Storage.Test.Common diff --git a/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageFileContentTest.cs b/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageFileContentTest.cs deleted file mode 100644 index 458a9d6008df..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageFileContentTest.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.Common; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.WindowsAzure.Management.Storage.Test.Common; -using Microsoft.Azure.Storage.DataMovement; -using Microsoft.Azure.Storage.File; -using Microsoft.WindowsAzure.Commands.Utilities.Common; -using PSHFile = Microsoft.WindowsAzure.Commands.Storage.File; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class GetAzureStorageFileContentTest : StorageFileTestBase - { - private string destinationFilePath; - - private string destinationPath; - - [TestInitialize] - public void DownloadInitialize() - { - this.destinationFilePath = Path.GetTempFileName(); - this.destinationPath = Path.GetTempPath(); - - if (System.IO.File.Exists(this.destinationFilePath)) - { - System.IO.File.Delete(this.destinationFilePath); - } - } - - [TestCleanup] - public void DownloadCleanup() - { - if (System.IO.File.Exists(this.destinationFilePath)) - { - System.IO.File.Delete(this.destinationFilePath); - } - } - - [TestMethod] - public void DownloadFileUsingShareNameAndPathToLocalFileTest() - { - this.CmdletInstance.DisableDataCollection(); - DownloadFileInternal( - "share", - "remoteFile", - this.destinationFilePath, - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", "share"), - new KeyValuePair("Path", "remoteFile"), - new KeyValuePair("Destination", this.destinationFilePath))); - } - - [TestMethod] - public void DownloadFileUsingShareObjectAndPathToLocalFileTest() - { - this.CmdletInstance.DisableDataCollection(); - DownloadFileInternal( - "share", - "remoteFile", - this.destinationFilePath, - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.ShareParameterSetName, - new KeyValuePair("Share", this.MockChannel.GetShareReference("share")), - new KeyValuePair("Path", "remoteFile"), - new KeyValuePair("Destination", this.destinationFilePath))); - } - - [TestMethod] - public void DownloadFileUsingDirectoryAndPathToLocalFileTest() - { - this.CmdletInstance.DisableDataCollection(); - DownloadFileInternal( - "share", - "remoteFile", - this.destinationFilePath, - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference()), - new KeyValuePair("Path", "remoteFile"), - new KeyValuePair("Destination", this.destinationFilePath))); - } - - [TestMethod] - public void DownloadFileUsingFileObjectToLocalFileTest() - { - this.CmdletInstance.DisableDataCollection(); - DownloadFileInternal( - "share", - "remoteFile", - this.destinationFilePath, - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.FileParameterSetName, - new KeyValuePair("File", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetFileReference("remoteFile")), - new KeyValuePair("Destination", this.destinationFilePath))); - } - - [TestMethod] - public void DownloadFileUsingFileObjectToLocalDirectoryTest() - { - this.CmdletInstance.DisableDataCollection(); - this.destinationFilePath = Path.Combine(this.destinationPath, "remoteFile"); - DownloadFileInternal( - "share", - "remoteFile", - this.destinationFilePath, - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.FileParameterSetName, - new KeyValuePair("File", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetFileReference("remoteFile")), - new KeyValuePair("Destination", this.destinationPath))); - } - - private void DownloadFileInternal(string shareName, string fileName, string destination, Action downloadFileAction) - { - var mockupTransferManager = new DownloadTransferManager( - (sourceFile, destPath) => - { - Assert.AreEqual(destination, destPath, "Destination validation failed."); - Assert.AreEqual(shareName, sourceFile.Share.Name, "Share validation failed."); - Assert.AreEqual(fileName, sourceFile.Name, "SourceFile validation failed."); - }); - - TransferManagerFactory.SetCachedTransferManager(mockupTransferManager); - - downloadFileAction(); - - mockupTransferManager.ThrowAssertExceptionIfAvailable(); - this.MockCmdRunTime.OutputPipeline.AssertNoObject(); - } - - private sealed class DownloadTransferManager : MockTransferManager - { - private Action validateAction; - - public DownloadTransferManager(Action validate) - { - validateAction = validate; - } - - public override Task DownloadAsync(CloudFile sourceFile, string destFilePath, DownloadOptions options, SingleTransferContext context, CancellationToken cancellationToken) - { - validateAction(sourceFile, destFilePath); - return Task.FromResult(true); - } - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageFileTest.cs b/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageFileTest.cs deleted file mode 100644 index fbaf70829f29..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageFileTest.cs +++ /dev/null @@ -1,128 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.Azure.Storage.File; -using Microsoft.WindowsAzure.Commands.Utilities.Common; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class GetAzureStorageFileTest : StorageFileTestBase - { - private const string ShareName = "share"; - - [TestMethod] - public void GetFileFromRootTest_ShareNameParameterSet() - { - var share = this.MockChannel.GetShareReference(ShareName); - var listItems = Enumerable.Range(0, 10).Select(x => share.GetRootDirectoryReference().GetFileReference(string.Format("file{0}", x))).Cast() - .Concat(Enumerable.Range(0, 5).Select(x => share.GetRootDirectoryReference().GetDirectoryReference(string.Format("dir{0}", x)))).ToArray(); - - this.ListFilesAndAssertResults( - () => this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", ShareName)), - listItems); - } - - [TestMethod] - public void GetFileFromRootTest_ShareParameterSet() - { - var share = this.MockChannel.GetShareReference(ShareName); - var listItems = Enumerable.Range(0, 10).Select(x => share.GetRootDirectoryReference().GetFileReference(string.Format("file{0}", x))).Cast() - .Concat(Enumerable.Range(0, 5).Select(x => share.GetRootDirectoryReference().GetDirectoryReference(string.Format("dir{0}", x)))).ToArray(); - - this.ListFilesAndAssertResults( - () => this.CmdletInstance.RunCmdlet( - Constants.ShareParameterSetName, - new KeyValuePair("Share", share)), - listItems); - } - - [TestMethod] - public void GetFileFromSubDirectoryTest_UsingDirectoryObject() - { - var share = this.MockChannel.GetShareReference(ShareName); - var dir = share.GetRootDirectoryReference().GetDirectoryReference("dir"); - var listItems = Enumerable.Range(0, 10).Select(x => dir.GetFileReference(string.Format("file{0}", x))).Cast() - .Concat(Enumerable.Range(0, 5).Select(x => dir.GetDirectoryReference(string.Format("dir{0}", x)))).ToArray(); - - this.ListFilesAndAssertResults( - () => this.CmdletInstance.RunCmdlet( - Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", dir)), - listItems, - dir); - } - - [TestMethod] - public void GetFileFromSubDirectoryTest_UsingShareObjectWithPath() - { - var share = this.MockChannel.GetShareReference(ShareName); - var dir = share.GetRootDirectoryReference().GetDirectoryReference("dir"); - - this.MockChannel.SetsAvailableDirectories(dir.Name); - - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", ShareName), - new KeyValuePair("Path", dir.Name)); - - List fileList = new List(); - fileList.Add(dir); - this.MockCmdRunTime.OutputPipeline.AssertListFileItems(fileList); - } - - [TestMethod] - public void GetFileFromSubDirectoryTest_UsingShareNameWithPath() - { - var share = this.MockChannel.GetShareReference(ShareName); - var dir = share.GetRootDirectoryReference().GetDirectoryReference("dir"); - this.MockChannel.SetsAvailableDirectories(dir.Name); - - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", ShareName), - new KeyValuePair("Path", dir.Name)); - - List fileList = new List(); - fileList.Add(dir); - this.MockCmdRunTime.OutputPipeline.AssertListFileItems(fileList); - } - - [TestMethod] - public void GetFileFromSubDirectoryTest_GetFromNonExistingDirectory() - { - this.CmdletInstance.DisableDataCollection(); - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", ShareName), - new KeyValuePair("Path", "NonExist")); - this.MockCmdRunTime.ErrorStream.AssertMockupException("DirectoryNotFound"); - } - - private void ListFilesAndAssertResults(Action runCmdletAction, IListFileItem[] listedItems, CloudFileDirectory dir = null) - { - this.MockChannel.SetsEnumerationResults(dir == null ? string.Empty : dir.Name, listedItems); - runCmdletAction(); - this.MockCmdRunTime.OutputPipeline.AssertListFileItems(listedItems); - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageShareTest.cs b/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageShareTest.cs deleted file mode 100644 index 4b98767d440b..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/GetAzureStorageShareTest.cs +++ /dev/null @@ -1,77 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.Azure.Storage.File; -using Microsoft.WindowsAzure.Commands.Utilities.Common; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class GetAzureStorageShareTest : StorageFileTestBase - { - [TestMethod] - public void GetShareByNameTest() - { - this.MockChannel.SetsAvailableShare("share"); - - this.CmdletInstance.RunCmdlet( - Constants.SpecificParameterSetName, - new KeyValuePair("Name", "share")); - - this.MockCmdRunTime.OutputPipeline.Cast().AssertSingleObject(x => x.Name == "share"); - } - - [TestMethod] - public void GetNonExistingShareByNameTest() - { - this.CmdletInstance.DisableDataCollection(); - this.CmdletInstance.RunCmdlet( - Constants.SpecificParameterSetName, - new KeyValuePair("Name", "share")); - - this.MockCmdRunTime.ErrorStream.AssertMockupException("ShareNotExist"); - } - - [TestMethod] - public void GetShareByPrefixTest() - { - var expectedShares = Enumerable.Range(0, 10).Select(x => string.Format(CultureInfo.InvariantCulture, "share{0}", x)).ToArray(); - this.MockChannel.SetsAvailableShare(expectedShares.Concat(Enumerable.Range(0, 5).Select(x => string.Format(CultureInfo.InvariantCulture, "nonshare{0}", x))).ToArray()); - - this.CmdletInstance.RunCmdlet( - Constants.MatchingPrefixParameterSetName, - new KeyValuePair("Prefix", "share")); - - this.MockCmdRunTime.OutputPipeline.AssertShares(expectedShares); - } - - [TestMethod] - public void GetShareByPrefixTest_NoShareMatchingPrefix() - { - this.MockChannel.SetsAvailableShare(Enumerable.Range(0, 5).Select(x => string.Format(CultureInfo.InvariantCulture, "nonshare{0}", x)).ToArray()); - - this.CmdletInstance.RunCmdlet( - Constants.MatchingPrefixParameterSetName, - new KeyValuePair("Prefix", "share")); - - Assert.AreEqual(0, this.MockCmdRunTime.OutputPipeline.Count, "Should be no result returned."); - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/NewAzureStorageDirectoryTest.cs b/src/Storage/Storage.Test/File/Cmdlet/NewAzureStorageDirectoryTest.cs deleted file mode 100644 index 02e8b429f67d..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/NewAzureStorageDirectoryTest.cs +++ /dev/null @@ -1,120 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.WindowsAzure.Management.Storage.Test.Common; -using Microsoft.Azure.Storage.File; -using System.Diagnostics; -using System.Reflection; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class NewAzureStorageDirectoryTest : StorageFileTestBase - { - [TestMethod] - public void NewDirectoryUsingShareNameAndPathTest() - { - NewDirectoryAndAssert("newDirectory"); - } - - [TestMethod] - public void NewDirectoryUsingShareObjectAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.ShareParameterSetName, - new KeyValuePair("Share", this.MockChannel.GetShareReference("share")), - new KeyValuePair("Path", "newDirectory")); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Name == "newDirectory" && x.Share.Name == "share"); - } - - [TestMethod] - public void NewDirectoryUsingDirectoryObjectAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference()), - new KeyValuePair("Path", "newDirectory")); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Name == "newDirectory" && x.Share.Name == "share"); - } - - [TestMethod] - public void NewDirectoryWithTooLongNameTest() - { - NewDirectoryAndAssert(FileNamingGenerator.GenerateValidASCIIName(256), "ArgumentException"); - } - - [TestMethod] - public void NewDirectoryWithLongNameTest() - { - NewDirectoryAndAssert(FileNamingGenerator.GenerateValidASCIIName(255)); - } - - [TestMethod] - public void NewDirectoryWithInvalidCharacterTest() - { - NewDirectoryAndAssert("?*?\"\\*p:?\\/D?*?<:Z>:/l*("ShareName", "share"), - new KeyValuePair("Path", directoryName)); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Name == directoryName && x.Share.Name == "share"); - } - - private void NewDirectoryAndAssert(string directoryName, string expectedErrorId) - { - try - { - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", "share"), - new KeyValuePair("Path", directoryName)); - } - catch (TargetInvocationException exception) - { - Trace.WriteLine(string.Format("Creating a directory with name '{0}'", directoryName)); - if (exception.InnerException != null) - { - Trace.WriteLine(string.Format("Exception:")); - Trace.WriteLine(string.Format("{0}: {1}", exception.InnerException.GetType(), exception.InnerException.Message)); - if (exception.InnerException.GetType().ToString().Contains(expectedErrorId)) - { - return; - } - } - - } - - throw new InvalidOperationException("Did not receive expected exception"); - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/NewAzureStorageShareTest.cs b/src/Storage/Storage.Test/File/Cmdlet/NewAzureStorageShareTest.cs deleted file mode 100644 index 47ac3b204a92..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/NewAzureStorageShareTest.cs +++ /dev/null @@ -1,115 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Commands.Common.Authentication; -using Microsoft.Azure.Storage.File; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.WindowsAzure.Management.Storage.Test.Common; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using Constants = Microsoft.WindowsAzure.Commands.Storage.File.Constants; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class NewAzureStorageShareTest : StorageFileTestBase - { - [TestMethod] - public void NewShareBasicTest() - { - this.NewShareAndValidate("newshare"); - } - - [TestMethod] - public void NewShareWithLongName() - { - this.NewShareAndValidate(FileNamingGenerator.GenerateValidShareName(63)); - } - - [TestMethod] - public void NewShareWithInvalidShareName_DoubleDash() - { - this.NewShareAndValidate(FileNamingGenerator.GenerateInvalidShareName_DoubleDash(20), "ArgumentException"); - } - - [TestMethod] - public void NewShareWithInvalidShareName_EndsWithDash() - { - this.NewShareAndValidate(FileNamingGenerator.GenerateInvalidShareName_EndsWithDash(20), "ArgumentException"); - } - - [TestMethod] - public void NewShareWithInvalidShareName_StartsWithDash() - { - this.NewShareAndValidate(FileNamingGenerator.GenerateInvalidShareName_StartsWithDash(20), "ArgumentException"); - } - - [TestMethod] - public void NewShareWithInvalidShareName_UpperCase() - { - this.NewShareAndValidate(FileNamingGenerator.GenerateInvalidShareName_UpperCase(20), "ArgumentException"); - } - - [TestMethod] - public void NewShareWithTooLongName() - { - this.NewShareAndValidate(FileNamingGenerator.GenerateValidASCIIName(64), "ArgumentException"); - } - - [TestMethod] - public void NewShareWithInvalidCharacter() - { - this.NewShareAndValidate("&LOv=\\ji1eJgg% -SY;m", "ArgumentException"); - } - - private void NewShareAndValidate(string name) - { - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("Name", name)); - this.MockCmdRunTime.OutputPipeline.Cast().AssertSingleObject(x => x.Name == name); - } - - private void NewShareAndValidate(string name, string expectedErrorId) - { - try - { - AzureSessionInitializer.InitializeAzureSession(); - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("Name", name)); - } - catch (TargetInvocationException exception) - { - Trace.WriteLine(string.Format("Creating a share with name '{0}'", name)); - if (exception.InnerException != null) - { - Trace.WriteLine(string.Format("Exception:")); - Trace.WriteLine(string.Format("{0}: {1}", exception.InnerException.GetType(), exception.InnerException.Message)); - if (exception.InnerException.GetType().ToString().Contains(expectedErrorId)) - { - return; - } - } - - } - - throw new InvalidOperationException("Did not receive expected exception"); - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageDirectoryTest.cs b/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageDirectoryTest.cs deleted file mode 100644 index 13f78bb1d851..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageDirectoryTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.Azure.Storage.File; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class RemoveAzureStorageDirectoryTest : StorageFileTestBase - { - [TestMethod] - public void RemoveDirectoryUsingShareNameAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", "share"), - new KeyValuePair("Path", "directory"), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "directory"); - } - - [TestMethod] - public void RemoveDirectoryUsingShareObjectAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.ShareParameterSetName, - new KeyValuePair("Share", this.MockChannel.GetShareReference("share")), - new KeyValuePair("Path", "directory"), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "directory"); - } - - [TestMethod] - public void RemoveDirectoryUsingDirectoryObjectAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference()), - new KeyValuePair("Path", "directory"), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "directory"); - } - - [TestMethod] - public void RemoveDirectoryUsingDirectoryObjectOnlyTest() - { - this.CmdletInstance.RunCmdlet( - Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetDirectoryReference("directory")), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "directory"); - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageFileTest.cs b/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageFileTest.cs deleted file mode 100644 index fa513fa2e335..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageFileTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.Azure.Storage.File; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class RemoveAzureStorageFileTest : StorageFileTestBase - { - [TestMethod] - public void RemoveFileUsingShareNameAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", "share"), - new KeyValuePair("Path", "file"), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "file"); - } - - [TestMethod] - public void RemoveFileUsingShareObjectAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.ShareParameterSetName, - new KeyValuePair("Share", this.MockChannel.GetShareReference("share")), - new KeyValuePair("Path", "file"), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "file"); - } - - [TestMethod] - public void RemoveFileUsingDirectoryObjectAndPathTest() - { - this.CmdletInstance.RunCmdlet( - Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference()), - new KeyValuePair("Path", "file"), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "file"); - } - - [TestMethod] - public void RemoveFileUsingFileObjectTest() - { - this.CmdletInstance.RunCmdlet( - Constants.FileParameterSetName, - new KeyValuePair("File", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetFileReference("file")), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Share.Name == "share" && x.Name == "file"); - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageShareTest.cs b/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageShareTest.cs deleted file mode 100644 index 180ad4f34da2..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/RemoveAzureStorageShareTest.cs +++ /dev/null @@ -1,54 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.Azure.Storage.File; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class RemoveAzureStorageShareTest : StorageFileTestBase - { - [TestMethod] - public void RemoveShareUsingShareNameTest() - { - this.CmdletInstance.RunCmdlet( - Constants.ShareNameParameterSetName, - new KeyValuePair("Name", "share"), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Name == "share"); - } - - [TestMethod] - public void RemoveFileUsingShareObjectTest() - { - this.CmdletInstance.RunCmdlet( - Constants.ShareParameterSetName, - new KeyValuePair("Share", this.MockChannel.GetShareReference("share")), - new KeyValuePair("PassThru", new SwitchParameter(true))); - - this.MockCmdRunTime.OutputPipeline - .Cast() - .AssertSingleObject(x => x.Name == "share"); - } - } -} diff --git a/src/Storage/Storage.Test/File/Cmdlet/SetAzureStorageFileContentTest.cs b/src/Storage/Storage.Test/File/Cmdlet/SetAzureStorageFileContentTest.cs deleted file mode 100644 index 231f7e6dc366..000000000000 --- a/src/Storage/Storage.Test/File/Cmdlet/SetAzureStorageFileContentTest.cs +++ /dev/null @@ -1,175 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Commands.Storage.Common; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet; -using Microsoft.WindowsAzure.Management.Storage.Test.Common; -using Microsoft.Azure.Storage.DataMovement; -using Microsoft.Azure.Storage.File; -using PSHFile = Microsoft.WindowsAzure.Commands.Storage.File; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet -{ - [TestClass] - public class SetAzureStorageFileContentTest : StorageFileTestBase - { - private string sourceFilePath = Path.GetTempFileName(); - - [TestInitialize] - public void UploadInitialize() - { - using (var writer = System.IO.File.CreateText(this.sourceFilePath)) - { - writer.WriteLine("SampleContent"); - } - } - - [TestCleanup] - public void UploadCleanup() - { - if (System.IO.File.Exists(this.sourceFilePath)) - { - System.IO.File.Delete(this.sourceFilePath); - } - } - - [TestMethod] - public void UploadFileUsingShareNameAndPathTest() - { - UploadFileInternal( - "share", - this.sourceFilePath, - "remoteFile", - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", "share"), - new KeyValuePair("Source", this.sourceFilePath), - new KeyValuePair("Path", "remoteFile"))); - } - - [TestMethod] - public void UploadFileUsingShareObjectAndPathTest() - { - UploadFileInternal( - "share", - this.sourceFilePath, - "remoteFile", - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.ShareParameterSetName, - new KeyValuePair("Share", this.MockChannel.GetShareReference("share")), - new KeyValuePair("Source", this.sourceFilePath), - new KeyValuePair("Path", "remoteFile"))); - } - - [TestMethod] - public void UploadFileUsingDirectoryAndPathTest() - { - UploadFileInternal( - "share", - this.sourceFilePath, - "remoteFile", - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference()), - new KeyValuePair("Source", this.sourceFilePath), - new KeyValuePair("Path", "remoteFile"))); - } - - [TestMethod] - public void UploadFileUsingDirectoryObjectOnlyTest() - { - this.MockChannel.SetsAvailableDirectories("dir"); - - UploadFileInternal( - "share", - this.sourceFilePath, - Path.GetFileName(this.sourceFilePath), - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.DirectoryParameterSetName, - new KeyValuePair("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetDirectoryReference("dir")), - new KeyValuePair("Source", this.sourceFilePath))); - } - - [TestMethod] - public void UploadFileUsingShareObjectOnlyTest() - { - this.MockChannel.SetsAvailableDirectories(""); - - UploadFileInternal( - "share", - this.sourceFilePath, - Path.GetFileName(this.sourceFilePath), - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.ShareParameterSetName, - new KeyValuePair("Share", this.MockChannel.GetShareReference("share")), - new KeyValuePair("Source", this.sourceFilePath))); - } - - [TestMethod] - public void UploadFileUsingShareNameOnlyTest() - { - this.MockChannel.SetsAvailableDirectories(""); - - UploadFileInternal( - "share", - this.sourceFilePath, - Path.GetFileName(this.sourceFilePath), - () => this.CmdletInstance.RunCmdlet( - PSHFile.Constants.ShareNameParameterSetName, - new KeyValuePair("ShareName", "share"), - new KeyValuePair("Source", this.sourceFilePath))); - } - - private void UploadFileInternal(string shareName, string sourceFilePath, string destinationFileName, Action uploadFileAction) - { - var mockupTransferManager = new UploadTransferManager( - (sourcePath, destFile) => - { - Assert.AreEqual(destinationFileName, destFile.Name, "Destination file name validation failed."); - Assert.AreEqual(shareName, destFile.Share.Name, "Share validation failed."); - Assert.AreEqual(sourceFilePath, sourcePath, "Source file validation failed."); - }); - - TransferManagerFactory.SetCachedTransferManager(mockupTransferManager); - - uploadFileAction(); - - mockupTransferManager.ThrowAssertExceptionIfAvailable(); - this.MockCmdRunTime.OutputPipeline.AssertNoObject(); - this.MockCmdRunTime.ErrorStream.AssertNoObject(); - } - - private sealed class UploadTransferManager : MockTransferManager - { - private Action validateAction; - public UploadTransferManager(Action validate) - { - validateAction = validate; - } - - public override Task UploadAsync(string sourcePath, CloudFile destFile, UploadOptions options, SingleTransferContext context, CancellationToken cancellationToken) - { - validateAction(sourcePath, destFile); - return Task.FromResult(true); - } - } - } -} diff --git a/src/Storage/Storage.Test/File/FileAssertUtil.cs b/src/Storage/Storage.Test/File/FileAssertUtil.cs deleted file mode 100644 index e4c6cd8e490e..000000000000 --- a/src/Storage/Storage.Test/File/FileAssertUtil.cs +++ /dev/null @@ -1,90 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Management.Automation; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.WindowsAzure.Management.Storage.Test.Common; -using Microsoft.Azure.Storage.File; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File -{ - internal static class FileAssertUtil - { - public static void AssertSingleObject(this IEnumerable collection, Func assertAction) - { - var list = new List(collection); - Assert.AreEqual(1, list.Count, "The collection should contain exactly one object."); - Assert.IsTrue(assertAction(list[0])); - } - - public static void AssertMockupException(this IList errors, string errorId) - { - Assert.AreEqual(1, errors.Count, "The collection should contain exactly one object."); - Assert.IsTrue(errors[0].Exception is MockupException, "The exception in the error record should be an instance of MockupException class."); - var exception = errors[0].Exception as MockupException; - Assert.AreEqual(errorId, exception.ErrorId, "ErrorId is not expected."); - } - - public static void AssertListFileItems(this IEnumerable result, IEnumerable items) - { - var strongTypeResults = new List(result.Cast()); - var assertItems = new List(items); - Assert.AreEqual(assertItems.Count, strongTypeResults.Count, "The number of items in output is not expected."); - - var directoryItems = assertItems.Where(x => x is CloudFileDirectory).Cast().Select(x => x.Name).ToList(); - var fileItems = assertItems.Where(x => x is CloudFile).Cast().Select(x => x.Name).ToList(); - foreach (var item in strongTypeResults) - { - string name; - List expectList; - if (item is CloudFile) - { - name = ((CloudFile)item).Name; - expectList = fileItems; - } - else if (item is CloudFileDirectory) - { - name = ((CloudFileDirectory)item).Name; - expectList = directoryItems; - } - else - { - throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Unexpected list item: {0}", item)); - } - - Assert.IsTrue(expectList.Remove(name), string.Format(CultureInfo.InvariantCulture, "Item {0} does not exist in the expected list.", item)); - } - } - - public static void AssertNoObject(this IEnumerable collection) - { - Assert.AreEqual(0, collection.Count(), "There should be no object inside the given collection."); - } - - public static void AssertShares(this IEnumerable result, IEnumerable expectedShareNames) - { - List expectedShareNameList = new List(expectedShareNames); - foreach (var share in result.Cast()) - { - Assert.IsTrue(expectedShareNameList.Remove(share.Name), string.Format(CultureInfo.InvariantCulture, "Share {0} was not expected.", share.Name)); - } - - Assert.AreEqual(0, expectedShareNameList.Count, "Should not left any share name remain in expected list."); - } - } -} diff --git a/src/Storage/Storage.Test/File/PSCmdletReflectionHelper.cs b/src/Storage/Storage.Test/File/PSCmdletReflectionHelper.cs deleted file mode 100644 index 5df5b2d94242..000000000000 --- a/src/Storage/Storage.Test/File/PSCmdletReflectionHelper.cs +++ /dev/null @@ -1,109 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using Microsoft.Azure.Commands.Common.Authentication; -using Microsoft.WindowsAzure.Commands.Utilities.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Management.Automation; -using System.Management.Automation.Internal; -using System.Management.Automation.Runspaces; -using System.Reflection; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File -{ - internal static class PSCmdletReflectionHelper - { - private static readonly Type psCmdletType = typeof(PSCmdlet); - - private static readonly Type azurePsCmdletType = typeof(AzurePSCmdlet); - - private static readonly FieldInfo parameterSetFieldInfo = typeof(System.Management.Automation.Cmdlet).GetField("_parameterSetName", BindingFlags.Instance | BindingFlags.NonPublic); - - private static readonly FieldInfo sessionStateFieldInfo = typeof(InternalCommand).GetField("state", BindingFlags.Instance | BindingFlags.NonPublic); - - private static readonly FieldInfo engineFieldInfo = psCmdletType.Assembly.GetType("System.Management.Automation.Runspaces.LocalRunspace").GetField("_engine", BindingFlags.NonPublic | BindingFlags.Instance); - - -#if NETSTANDARD - private static readonly PropertyInfo executionContextInfo = psCmdletType.Assembly.GetType("System.Management.Automation.AutomationEngine").GetProperty("Context", BindingFlags.NonPublic | BindingFlags.Instance); -#else - private static readonly FieldInfo executionContextInfo = psCmdletType.Assembly.GetType("System.Management.Automation.AutomationEngine").GetField("_context", BindingFlags.NonPublic | BindingFlags.Instance); -#endif - - private static readonly PropertyInfo contextPropertyInfo = typeof(InternalCommand).GetProperty("Context", BindingFlags.Instance | BindingFlags.NonPublic); - - private static readonly MethodInfo beginProcessingMethodInfo = psCmdletType.GetMethod("BeginProcessing", BindingFlags.NonPublic | BindingFlags.Instance); - - private static readonly MethodInfo endProcessingMethodInfo = psCmdletType.GetMethod("EndProcessing", BindingFlags.NonPublic | BindingFlags.Instance); - - private static readonly MethodInfo processRecordMethodInfo = azurePsCmdletType.GetMethod("ExecuteCmdlet", BindingFlags.Public | BindingFlags.Instance); - - private static readonly object[] emptyParameters = new object[0]; - - public static IDisposable InitializeSessionState(this PSCmdlet cmdlet) - { - var ps = System.Management.Automation.PowerShell.Create(InitialSessionState.CreateDefault()); - try - { - var engine = engineFieldInfo.GetValue(ps.Runspace); - var context = executionContextInfo.GetValue(engine); - contextPropertyInfo.SetValue(cmdlet, context, emptyParameters); - return ps; - } - catch - { - if (ps != null) - { - ps.Dispose(); - } - - throw; - } - } - - public static void RunCmdlet(this PSCmdlet cmdlet, string parameterSet, params KeyValuePair[] parameters) - { - RunCmdlet(cmdlet, parameterSet, - parameters.Select(x => new KeyValuePair( - x.Key, new object[] { x.Value })).ToArray() - ); - } - - public static void RunCmdlet(this PSCmdlet cmdlet, string parameterSet, KeyValuePair[] incomingValues) - { - AzureSessionInitializer.InitializeAzureSession(); - var cmdletType = cmdlet.GetType(); - parameterSetFieldInfo.SetValue(cmdlet, parameterSet); - beginProcessingMethodInfo.Invoke(cmdlet, emptyParameters); - var parameterProperties = incomingValues.Select(x => - new Tuple( - cmdletType.GetProperty(x.Key), - x.Value)).ToArray(); - - for (int i = 0; i < incomingValues[0].Value.Length; i++) - { - foreach (var parameter in parameterProperties) - { - parameter.Item1.SetValue(cmdlet, parameter.Item2[i], null); - } - - processRecordMethodInfo.Invoke(cmdlet, emptyParameters); - } - - endProcessingMethodInfo.Invoke(cmdlet, emptyParameters); - } - } -} diff --git a/src/Storage/Storage.Test/File/StorageFileTestBase.cs b/src/Storage/Storage.Test/File/StorageFileTestBase.cs deleted file mode 100644 index db815ae88d61..000000000000 --- a/src/Storage/Storage.Test/File/StorageFileTestBase.cs +++ /dev/null @@ -1,59 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System; -using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.WindowsAzure.Commands.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage.Test; -using Microsoft.WindowsAzure.Management.Storage.Test.Service; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.File -{ - public abstract class StorageFileTestBase : StorageTestBase, IDisposable where T : AzureStorageFileCmdletBase - { - private MockStorageFileManagement channel = new MockStorageFileManagement(); - - private T cmdlet; - - private IDisposable sessionStateDisposable; - - public StorageFileTestBase() - { - this.MockCmdRunTime = new MockCommandRuntime(); - cmdlet = (T)Activator.CreateInstance(typeof(T)); - cmdlet.CommandRuntime = this.MockCmdRunTime; - cmdlet.Channel = this.channel; - cmdlet.ShareChannel = true; - this.sessionStateDisposable = cmdlet.InitializeSessionState(); - } - - protected MockStorageFileManagement MockChannel - { - get { return this.channel; } - } - - protected T CmdletInstance - { - get { return this.cmdlet; } - } - - public void Dispose() - { - if (this.sessionStateDisposable != null) - { - this.sessionStateDisposable.Dispose(); - } - } - } -} diff --git a/src/Storage/Storage.Test/Service/MockStorageFileManagement.cs b/src/Storage/Storage.Test/Service/MockStorageFileManagement.cs deleted file mode 100644 index 22a0a53052ec..000000000000 --- a/src/Storage/Storage.Test/Service/MockStorageFileManagement.cs +++ /dev/null @@ -1,202 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// ---------------------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.WindowsAzure.Commands.Storage.Common; -using Microsoft.WindowsAzure.Commands.Storage.Model.Contract; -using Microsoft.WindowsAzure.Management.Storage.Test.Common; -using Microsoft.Azure.Storage; -using Microsoft.Azure.Storage.File; -using Microsoft.WindowsAzure.Commands.Storage; - -namespace Microsoft.WindowsAzure.Management.Storage.Test.Service -{ - public sealed class MockStorageFileManagement : IStorageFileManagement - { - private const string MockupConnectionString = "DefaultEndpointsProtocol=http;AccountName=MockUp;AccountKey=FjUfNl1KiJttbXlsdkMzBTC7WagvrRM9/g6UPBuy0ypCpAbYTL6/KA+dI/7gyoWvLFYmah3IviUP1jykOHHOlA=="; - - private CloudFileClient client = CloudStorageAccount.Parse(MockupConnectionString).CreateCloudFileClient(); - - private Dictionary enumerationResults = new Dictionary(); - - private List availableShareNames = new List(); - - private List availableDirectoryNames = new List(); - - public void SetsEnumerationResults(string directoryName, IEnumerable enumerationItems) - { - this.enumerationResults[directoryName] = enumerationItems.ToArray(); - } - - public void SetsAvailableShare(params string[] shareNames) - { - availableShareNames.AddRange(shareNames); - } - - public void SetsAvailableDirectories(params string[] directoryNames) - { - this.availableDirectoryNames.AddRange(directoryNames); - } - - public CloudFileShare GetShareReference(string shareName, DateTimeOffset? snapshotTime = null) - { - return client.GetShareReference(shareName, snapshotTime); - } - - public void FetchShareAttributes(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw new NotImplementedException(); - } - - public void SetShareProperties(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw new NotImplementedException(); - } - - public Task EnumerateFilesAndDirectoriesAsync(CloudFileDirectory directory, Action enumerationAction, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - IListFileItem[] enumerationItems; - if (this.enumerationResults.TryGetValue(directory.Name, out enumerationItems)) - { - foreach (var item in enumerationItems) - { - enumerationAction(item); - } - - return Task.FromResult(true); - } - else - { - throw new MockupException("DirectoryNotFound"); - } - } - - public Task FetchShareAttributesAsync(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - if (this.availableShareNames.Contains(share.Name)) - { - return Task.FromResult(true); - } - else - { - throw new MockupException("ShareNotExist"); - } - } - - public Task EnumerateSharesAsync(string prefix, ShareListingDetails detailsIncluded, Action enumerationAction, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - foreach (var shareName in this.availableShareNames) - { - if (shareName.StartsWith(prefix)) - { - enumerationAction(this.client.GetShareReference(shareName)); - } - } - - return Task.FromResult(true); - } - - public Task CreateDirectoryAsync(CloudFileDirectory directory, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return Task.FromResult(true); - } - - public Task DirectoryExistsAsync(CloudFileDirectory directory, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return Task.FromResult(this.availableDirectoryNames.Contains(directory.Name)); - } - - public Task FileExistsAsync(CloudFile file, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return Task.FromResult(true); - } - - public Task CreateShareAsync(CloudFileShare share, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return Task.FromResult(share); - } - - public Task DeleteDirectoryAsync(CloudFileDirectory directory, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return Task.FromResult(true); - } - - public Task DeleteShareAsync(CloudFileShare share, DeleteShareSnapshotsOption deleteShareSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return Task.FromResult(true); - } - - public Task DeleteFileAsync(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return Task.FromResult(true); - } - - public AzureStorageContext StorageContext - { - get { throw new NotImplementedException(); } - } - - public Task GetSharePermissionsAsync(CloudFileShare share, AccessCondition accessCondition, - FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw new NotImplementedException(); - } - - public FileSharePermissions GetSharePermissions(CloudFileShare share, AccessCondition accessCondition = null, - FileRequestOptions options = null, OperationContext operationContext = null) - { - throw new NotImplementedException(); - } - - public void SetSharePermissions(CloudFileShare share, FileSharePermissions permissions, - AccessCondition accessCondition = null, - FileRequestOptions options = null, OperationContext operationContext = null) - { - throw new NotImplementedException(); - } - - public Task FetchFileAttributesAsync(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - if (this.availableDirectoryNames.Contains(file.Name)) - { - return Task.FromResult(true); - } - else - { - throw new MockupException("FileNotFound"); - } - } - - public Task FetchDirectoryAttributesAsync(CloudFileDirectory directory, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - if (this.availableDirectoryNames.Contains(directory.Name)) - { - return Task.FromResult(true); - } - else - { - throw new MockupException("DirectoryNotFound"); - } - } - - public Task AbortCopyAsync(CloudFile file, string copyId, AccessCondition accessCondition, FileRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/Storage/Storage/Common/AccessPolicyHelper.cs b/src/Storage/Storage/Common/AccessPolicyHelper.cs index 95c9a2225adf..4c4d017e7a75 100644 --- a/src/Storage/Storage/Common/AccessPolicyHelper.cs +++ b/src/Storage/Storage/Common/AccessPolicyHelper.cs @@ -16,7 +16,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.Common { using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.Azure.Storage.Blob; - using Microsoft.Azure.Storage.File; using Microsoft.Azure.Cosmos.Table; using System; using System.Collections.Generic; @@ -41,7 +40,6 @@ internal class AccessPolicyHelper internal static void SetupAccessPolicy(T policy, DateTime? startTime, DateTime? expiryTime, string permission, bool noStartTime = false, bool noExpiryTime = false) { if (!(typeof(T) == typeof(SharedAccessTablePolicy) || - typeof(T) == typeof(SharedAccessFilePolicy) || typeof(T) == typeof(SharedAccessBlobPolicy))) { throw new ArgumentException(Resources.InvalidAccessPolicyType); @@ -117,10 +115,6 @@ internal static void SetupAccessPolicyPermission(T policy, string permission) { ((SharedAccessTablePolicy)(Object)policy).Permissions = SharedAccessTablePermissions.None; } - else if (typeof(T) == typeof(SharedAccessFilePolicy)) - { - ((SharedAccessFilePolicy)(Object)policy).Permissions = SharedAccessFilePermissions.None; - } else if (typeof(T) == typeof(SharedAccessBlobPolicy)) { ((SharedAccessBlobPolicy)(Object)policy).Permissions = SharedAccessBlobPermissions.None; @@ -140,10 +134,6 @@ internal static void SetupAccessPolicyPermission(T policy, string permission) string convertedPermission = permission.Replace('q', 'r'); ((SharedAccessTablePolicy)(Object)policy).Permissions = SharedAccessTablePolicy.PermissionsFromString(convertedPermission); } - else if (typeof(T) == typeof(SharedAccessFilePolicy)) - { - ((SharedAccessFilePolicy)(Object)policy).Permissions = SharedAccessFilePolicy.PermissionsFromString(permission); - } else if (typeof(T) == typeof(SharedAccessBlobPolicy)) { ((SharedAccessBlobPolicy)(Object)policy).Permissions = SharedAccessBlobPolicy.PermissionsFromString(permission); @@ -162,8 +152,9 @@ internal static void SetupAccessPolicyPermission(T policy, string permission) internal static PSObject ConstructPolicyOutputPSObject(IDictionary sharedAccessPolicies, string policyName) { if (!(typeof(T) == typeof(SharedAccessTablePolicy) || - typeof(T) == typeof(SharedAccessBlobPolicy) || - (typeof(T) == typeof(SharedAccessFilePolicy)))) + typeof(T) == typeof(SharedAccessBlobPolicy))) + //|| + //(typeof(T) == typeof(SharedAccessFilePolicy)))) { throw new ArgumentException(Resources.InvalidAccessPolicyType); } diff --git a/src/Storage/Storage/Common/AzureStorageFile.cs b/src/Storage/Storage/Common/AzureStorageFile.cs index aa6a29983867..81d90d05ba6a 100644 --- a/src/Storage/Storage/Common/AzureStorageFile.cs +++ b/src/Storage/Storage/Common/AzureStorageFile.cs @@ -12,46 +12,21 @@ // limitations under the License. // --------------------------------------------------------------------------------- -using Azure.Storage.Files.Shares; -using Microsoft.Azure.Storage.File; - namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel { - using Microsoft.Azure.Storage.Blob; using System; using Microsoft.WindowsAzure.Commands.Common.Attributes; using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Storage; using global::Azure.Storage.Files.Shares; - using global::Azure.Storage; using Microsoft.WindowsAzure.Commands.Storage.Common; using global::Azure.Storage.Files.Shares.Models; using Microsoft.Azure.Storage.Auth; - using Microsoft.Azure.Commands.Common.Authentication.Abstractions; /// /// Azure storage file object /// public class AzureStorageFile : AzureStorageBase { - /// - /// File object - /// - [Ps1Xml(Label = "Share Uri", Target = ViewControl.Table, GroupByThis = true, ScriptBlock = "$_.CloudFile.Share.Uri")] - [Ps1Xml(Label = "Name", Target = ViewControl.Table, ScriptBlock = "$_.Name", Position = 0, TableColumnWidth = 20)] - public CloudFile CloudFile - { - get - { - if (privateCloudFile == null) - { - privateCloudFile = GetTrack1FileClient(ShareFileClient, ((AzureStorageContext)this.Context).StorageAccount.Credentials); - } - return privateCloudFile; - } - } - private CloudFile privateCloudFile = null; - /// /// File length /// @@ -71,10 +46,6 @@ public ShareFileClient ShareFileClient { get { - if (privateFileClient == null) - { - privateFileClient = GetTrack2FileClient(this.CloudFile, this.shareClientOptions); - } return privateFileClient; } } @@ -104,22 +75,6 @@ public ShareFileClient ShareFileClient private ShareClientOptions shareClientOptions { get; set; } - /// - /// Azure storage file constructor from track1 file object - /// - /// Cloud file object - /// - /// - public AzureStorageFile(CloudFile file, AzureStorageContext storageContext, ShareClientOptions clientOptions = null) - { - Name = file.Name; - privateCloudFile = file; - Length = file.Properties.Length; - LastModified = file.Properties.LastModified; - Context = storageContext; - shareClientOptions = clientOptions; - } - /// /// Azure storage file constructor from Track2 list file item /// @@ -131,10 +86,6 @@ public AzureStorageFile(ShareFileClient shareFileClient, AzureStorageContext sto { Name = shareFileClient.Name; this.privateFileClient = shareFileClient; - if (!storageContext.StorageAccount.Credentials.IsToken) // not oauth - { - privateCloudFile = GetTrack1FileClient(shareFileClient, storageContext.StorageAccount.Credentials); - } if (shareFileItem != null) { ListFileProperties = shareFileItem; @@ -162,10 +113,6 @@ public AzureStorageFile(ShareFileClient shareFileClient, AzureStorageContext sto { Name = shareFileClient.Name; this.privateFileClient = shareFileClient; - if (!storageContext.StorageAccount.Credentials.IsToken) // not oauth - { - privateCloudFile = GetTrack1FileClient(shareFileClient, storageContext.StorageAccount.Credentials, clientOptions); - } if (shareFileProperties != null) { privateFileProperties = shareFileProperties; @@ -202,37 +149,5 @@ public static CloudFile GetTrack1FileClient(ShareFileClient shareFileClient, Sto track1CloudFile = new CloudFile(shareFileClient.Uri, credentials); return track1CloudFile; } - - // Convert Track1 File object to Track 2 file Client - public static ShareFileClient GetTrack2FileClient(CloudFile cloudFile, ShareClientOptions clientOptions = null) - { - ShareFileClient fileClient; - if (cloudFile.ServiceClient.Credentials.IsSAS) //SAS - { - string sas = Util.GetSASStringWithoutQuestionMark(cloudFile.ServiceClient.Credentials.SASToken); - string fullUri = cloudFile.SnapshotQualifiedUri.ToString(); - if (cloudFile.Share.IsSnapshot) - { - // Since snapshot URL already has '?', need remove '?' in the first char of sas - fullUri = fullUri + "&" + sas; - } - else - { - fullUri = fullUri + "?" + sas; - } - fileClient = new ShareFileClient(new Uri(fullUri), clientOptions); - } - else if (cloudFile.ServiceClient.Credentials.IsSharedKey) //Shared Key - { - fileClient = new ShareFileClient(cloudFile.SnapshotQualifiedUri, - new StorageSharedKeyCredential(cloudFile.ServiceClient.Credentials.AccountName, cloudFile.ServiceClient.Credentials.ExportBase64EncodedKey()), clientOptions); - } - else //Anonymous - { - fileClient = new ShareFileClient(cloudFile.SnapshotQualifiedUri, clientOptions); - } - - return fileClient; - } } } diff --git a/src/Storage/Storage/Common/AzureStorageFileDirectory.cs b/src/Storage/Storage/Common/AzureStorageFileDirectory.cs index 474de1c9c014..a07602d56092 100644 --- a/src/Storage/Storage/Common/AzureStorageFileDirectory.cs +++ b/src/Storage/Storage/Common/AzureStorageFileDirectory.cs @@ -14,30 +14,19 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel { - using Microsoft.Azure.Storage.Blob; using System; using Microsoft.WindowsAzure.Commands.Common.Attributes; using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Storage; using global::Azure.Storage.Files.Shares; - using global::Azure.Storage; using Microsoft.WindowsAzure.Commands.Storage.Common; using global::Azure.Storage.Files.Shares.Models; using Microsoft.Azure.Storage.Auth; - using global::Azure.Core; /// /// Azure storage file object /// public class AzureStorageFileDirectory : AzureStorageBase { - /// - /// CloudBlob object - /// - [Ps1Xml(Label = "Share Uri", Target = ViewControl.Table, GroupByThis = true, ScriptBlock = "if (IsDirectory) {$_.CloudFileDirectory.Share.Uri} else {$_.CloudFile.Share.Uri}")] - [Ps1Xml(Label = "Name", Target = ViewControl.Table, ScriptBlock = "$_.Name", Position = 0, TableColumnWidth = 20)] - public CloudFileDirectory CloudFileDirectory { get; private set; } - /// /// file last modified time /// @@ -51,10 +40,6 @@ public ShareDirectoryClient ShareDirectoryClient { get { - if (privateFileDirClient == null) - { - privateFileDirClient = GetTrack2FileDirClient(this.CloudFileDirectory, shareClientOptions); - } return privateFileDirClient; } } @@ -83,21 +68,6 @@ public ShareDirectoryClient ShareDirectoryClient private ShareClientOptions shareClientOptions { get; set; } - /// - /// Azure storage file constructor - /// - /// Cloud file Directory object - /// - /// - public AzureStorageFileDirectory(CloudFileDirectory dir, AzureStorageContext storageContext, ShareClientOptions clientOptions = null) - { - Name = dir.Name; - CloudFileDirectory = dir; - LastModified = dir.Properties.LastModified; - Context = storageContext; - shareClientOptions = clientOptions; - } - /// /// Azure storage file constructor from Track2 list file item /// @@ -109,7 +79,6 @@ public AzureStorageFileDirectory(ShareDirectoryClient shareDirectoryClient, Azur { Name = shareDirectoryClient.Name; this.privateFileDirClient = shareDirectoryClient; - CloudFileDirectory = GetTrack1FileDirClient(shareDirectoryClient, storageContext.StorageAccount.Credentials, clientOptions); if (shareFileItem != null) { ListFileProperties = shareFileItem; @@ -133,7 +102,6 @@ public AzureStorageFileDirectory(ShareDirectoryClient shareDirectoryClient, Azur { Name = shareDirectoryClient.Name; this.privateFileDirClient = shareDirectoryClient; - CloudFileDirectory = GetTrack1FileDirClient(shareDirectoryClient, storageContext.StorageAccount.Credentials, clientOptions); if (shareDirectoryProperties != null) { privateFileDirProperties = shareDirectoryProperties; @@ -144,14 +112,14 @@ public AzureStorageFileDirectory(ShareDirectoryClient shareDirectoryClient, Azur } // Convert Track2 File Dir object to Track 1 file Dir object - public static CloudFileDirectory GetTrack1FileDirClient(ShareDirectoryClient shareFileDirClient, StorageCredentials credentials, ShareClientOptions clientOptions = null) + public static CloudFileDirectory GetTrack1FileDirClient(ShareDirectoryClient shareFileDirClient, StorageCredentials credentials, ShareClientOptions clientOptions = null, bool skipTrailingDotCheck = false) { if (credentials.IsToken) { return new InvalidCloudFileDirectory(shareFileDirClient.Uri, credentials); } // Track1 File not support Trailing Dot - if (Util.PathContainsTrailingDot(shareFileDirClient.Path) && (clientOptions != null && clientOptions.AllowTrailingDot != null && clientOptions.AllowTrailingDot.Value)) + if (!skipTrailingDotCheck && Util.PathContainsTrailingDot(shareFileDirClient.Path) && (clientOptions != null && clientOptions.AllowTrailingDot != null && clientOptions.AllowTrailingDot.Value)) { return new InvalidCloudFileDirectory(shareFileDirClient.Uri, credentials); } @@ -163,37 +131,5 @@ public static CloudFileDirectory GetTrack1FileDirClient(ShareDirectoryClient sha track1CloudFileDir = new CloudFileDirectory(shareFileDirClient.Uri, credentials); return track1CloudFileDir; } - - // Convert Track1 File Dir object to Track 2 file Dir Client - public static ShareDirectoryClient GetTrack2FileDirClient(CloudFileDirectory cloudFileDir, ShareClientOptions clientOptions = null) - { - ShareDirectoryClient fileDirClient; - if (cloudFileDir.ServiceClient.Credentials.IsSAS) //SAS - { - string sas = Util.GetSASStringWithoutQuestionMark(cloudFileDir.ServiceClient.Credentials.SASToken); - string fullUri = cloudFileDir.SnapshotQualifiedUri.ToString(); - if (cloudFileDir.Share.IsSnapshot) - { - // Since snapshot URL already has '?', need remove '?' in the first char of sas - fullUri = fullUri + "&" + sas; - } - else - { - fullUri = fullUri + "?" + sas; - } - fileDirClient = new ShareDirectoryClient(new Uri(fullUri), clientOptions); - } - else if (cloudFileDir.ServiceClient.Credentials.IsSharedKey) //Shared Key - { - fileDirClient = new ShareDirectoryClient(cloudFileDir.SnapshotQualifiedUri, - new StorageSharedKeyCredential(cloudFileDir.ServiceClient.Credentials.AccountName, cloudFileDir.ServiceClient.Credentials.ExportBase64EncodedKey()), clientOptions); - } - else //Anonymous - { - fileDirClient = new ShareDirectoryClient(cloudFileDir.SnapshotQualifiedUri, clientOptions); - } - - return fileDirClient; - } } } diff --git a/src/Storage/Storage/Common/AzureStorageFileShare.cs b/src/Storage/Storage/Common/AzureStorageFileShare.cs index df633d3f5125..c15fce2db68c 100644 --- a/src/Storage/Storage/Common/AzureStorageFileShare.cs +++ b/src/Storage/Storage/Common/AzureStorageFileShare.cs @@ -14,16 +14,12 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel { - using Microsoft.Azure.Storage.Blob; using System; using Microsoft.WindowsAzure.Commands.Common.Attributes; - using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Storage; using global::Azure.Storage.Files.Shares; using global::Azure.Storage; using Microsoft.WindowsAzure.Commands.Storage.Common; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Storage.Auth; using System.Management.Automation; /// @@ -31,13 +27,6 @@ namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel /// public class AzureStorageFileShare : AzureStorageBase { - /// - /// CloudBlob object - /// - [Ps1Xml(Label = "Share Uri", Target = ViewControl.Table, GroupByThis = true, ScriptBlock = "$_.CloudFile.Share.Uri")] - [Ps1Xml(Label = "Name", Target = ViewControl.Table, ScriptBlock = "$_.Name", Position = 0, TableColumnWidth = 20)] - public CloudFileShare CloudFileShare { get; private set; } - /// /// The Snapshot time of the share /// @@ -64,28 +53,7 @@ public class AzureStorageFileShare : AzureStorageBase /// public int? Quota { get; private set; } - /// - /// XSCL Track2 File Share Client, used to run file APIs - /// - public ShareClient ShareClient - { - get - { - if (privateShareClient == null) - { - if (this.IsDeleted == null || !this.IsDeleted.Value) - { - privateShareClient = GetTrack2FileShareClient(this.CloudFileShare, (AzureStorageContext)this.Context); - } - else - { - throw new InvalidJobStateException("This share is already deleted. Can't create ShareClient for it."); - } - } - return privateShareClient; - } - } - private ShareClient privateShareClient = null; + public ShareClient ShareClient { get; private set; } /// /// XSCL Track2 File Share properties, will retrieve the properties on server and return to user @@ -116,30 +84,13 @@ public ShareClient ShareClient private ShareClientOptions shareClientOptions { get; set; } private ShareServiceClient shareService { get; set; } - /// - /// Azure storage file constructor - /// - /// Cloud file share object - /// Storage context containing account information used to construct ShareClient. - public AzureStorageFileShare(CloudFileShare share, AzureStorageContext storageContext) - { - Name = share.Name; - CloudFileShare = share; - LastModified = share.Properties.LastModified; - IsSnapshot = share.IsSnapshot; - SnapshotTime = share.SnapshotTime; - Quota = share.Properties.Quota; - Context = storageContext; - } - /// /// Azure storage file share constructor from Track2 get file properties output /// public AzureStorageFileShare(ShareClient shareClient, AzureStorageContext storageContext, ShareProperties shareProperties = null, ShareClientOptions clientOptions = null) { Name = shareClient.Name; - this.privateShareClient = shareClient; - CloudFileShare = GetTrack1FileShareClient(shareClient, storageContext.StorageAccount.Credentials); + this.ShareClient = shareClient; if (shareProperties != null) { privateShareProperties = shareProperties; @@ -161,8 +112,7 @@ public AzureStorageFileShare(ShareClient shareClient, AzureStorageContext storag public AzureStorageFileShare(ShareClient shareClient, AzureStorageContext storageContext, ShareItem shareItem, ShareClientOptions clientOptions = null) { Name = shareClient.Name; - //this.privateShareClient = shareClient; - CloudFileShare = GetTrack1FileShareClient(shareClient, storageContext.StorageAccount.Credentials); + this.ShareClient = shareClient; if (shareItem != null) { this.ListShareProperties = shareItem; @@ -178,8 +128,7 @@ public AzureStorageFileShare(ShareClient shareClient, AzureStorageContext storag { SnapshotTime = DateTimeOffset.Parse(shareItem.Snapshot).ToUniversalTime(); IsSnapshot = true; - this.privateShareClient = GetTrack2FileShareClient(CloudFileShare, storageContext, clientOptions); - this.privateShareClient = this.privateShareClient.WithSnapshot(shareItem.Snapshot); + this.ShareClient = this.ShareClient.WithSnapshot(shareItem.Snapshot); } } Context = storageContext; @@ -226,52 +175,5 @@ public void UndeleteShare() throw new InvalidJobStateException("This share is not soft deleted, so can't undelete it."); } } - - // Convert Track2 File share object to Track 1 file share object - public static CloudFileShare GetTrack1FileShareClient(ShareClient shareClient, StorageCredentials credentials) - { - if (credentials.IsToken) - { - return new InvalidCloudFileShare(shareClient.Uri, credentials); - } - if (credentials.IsSAS) // the Uri already contains credentail. - { - credentials = null; - } - CloudFileShare track1CloudFileShare = new CloudFileShare(shareClient.Uri, credentials); - return track1CloudFileShare; - } - - // Convert Track1 File share object to Track 2 file share Client - public static ShareClient GetTrack2FileShareClient(CloudFileShare cloudFileShare, AzureStorageContext context, ShareClientOptions clientOptions = null) - { - ShareClient fileShareClient; - if (cloudFileShare.ServiceClient.Credentials.IsSAS) //SAS - { - string sas = Util.GetSASStringWithoutQuestionMark(cloudFileShare.ServiceClient.Credentials.SASToken); - string fullUri = cloudFileShare.SnapshotQualifiedUri.ToString(); - if (cloudFileShare.IsSnapshot) - { - // Since snapshot URL already has '?', need remove '?' in the first char of sas - fullUri = fullUri + "&" + sas; - } - else - { - fullUri = fullUri + "?" + sas; - } - fileShareClient = new ShareClient(new Uri(fullUri), clientOptions); - } - else if (cloudFileShare.ServiceClient.Credentials.IsSharedKey) //Shared Key - { - fileShareClient = new ShareClient(cloudFileShare.SnapshotQualifiedUri, - new StorageSharedKeyCredential(cloudFileShare.ServiceClient.Credentials.AccountName, cloudFileShare.ServiceClient.Credentials.ExportBase64EncodedKey()), clientOptions); - } - else //Anonymous - { - fileShareClient = new ShareClient(cloudFileShare.SnapshotQualifiedUri, clientOptions); - } - - return fileShareClient; - } } } diff --git a/src/Storage/Storage/Common/InvalidCloudFileShare.cs b/src/Storage/Storage/Common/InvalidCloudFileShare.cs index ee5e72f38f30..6c19b03b4ed8 100644 --- a/src/Storage/Storage/Common/InvalidCloudFileShare.cs +++ b/src/Storage/Storage/Common/InvalidCloudFileShare.cs @@ -1,546 +1,546 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// 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. -// --------------------------------------------------------------------------------- - -namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel -{ - using Microsoft.Azure.Storage; - using Microsoft.Azure.Storage.Auth; - using Microsoft.Azure.Storage.Core.Util; - using Microsoft.Azure.Storage.File; - using Microsoft.Azure.Storage.File.Protocol; - using Microsoft.Azure.Storage.Shared.Protocol; - using System; - using System.Collections.Generic; - using System.IO; - using System.Text; - using System.Threading; - using System.Threading.Tasks; - - /// - /// This class is used to handle the Azure file which can't be handle in Track1 File Object, like . - /// - public class InvalidCloudFileShare : CloudFileShare - { - public InvalidCloudFileShare(Uri objectAbsoluteUri, StorageCredentials credentials) - : base(objectAbsoluteUri, credentials.IsSAS ? null : credentials) - { - string objectUri = objectAbsoluteUri.ToString(); - if (credentials != null && credentials.IsSAS) - { - objectUri = objectUri.Replace(credentials.SASSignature, "[Sig]"); - } - exception = new InvalidOperationException(string.Format("Only support run action on this Azure file share with 'ShareClient', not support with 'CloudFileShare'. Share Uri: {0}.", objectAbsoluteUri)); - } - private InvalidOperationException exception; - - public override void Create(FileRequestOptions requestOptions = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginCreate(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginCreate(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override void EndCreate(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task CreateAsync() - { - throw exception; - } - - public override Task CreateAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task CreateAsync(FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task CreateAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override bool CreateIfNotExists(FileRequestOptions requestOptions = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginCreateIfNotExists(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginCreateIfNotExists(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override bool EndCreateIfNotExists(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task CreateIfNotExistsAsync() - { - throw exception; - } - - public override Task CreateIfNotExistsAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task CreateIfNotExistsAsync(FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - -#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously - public override async Task CreateIfNotExistsAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) -#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously - { - throw exception; - } - - public override void Delete(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override void Delete(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override ICancellableAsyncResult BeginDelete(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginDelete(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginDelete(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override void EndDelete(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task DeleteAsync() - { - throw exception; - } - - public override Task DeleteAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task DeleteAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task DeleteAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override Task DeleteAsync(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override bool DeleteIfExists(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override bool DeleteIfExists(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override ICancellableAsyncResult BeginDeleteIfExists(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginDeleteIfExists(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginDeleteIfExists(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override bool EndDeleteIfExists(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task DeleteIfExistsAsync() - { - throw exception; - } - - public override Task DeleteIfExistsAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task DeleteIfExistsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task DeleteIfExistsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - -#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously - public override async Task DeleteIfExistsAsync(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) -#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously - { - throw exception; - } - - public override bool Exists(FileRequestOptions requestOptions = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginExists(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginExists(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override bool EndExists(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task ExistsAsync() - { - throw exception; - } - - public override Task ExistsAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task ExistsAsync(FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task ExistsAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override void FetchAttributes(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginFetchAttributes(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginFetchAttributes(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override void EndFetchAttributes(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task FetchAttributesAsync() - { - throw exception; - } - - public override Task FetchAttributesAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task FetchAttributesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task FetchAttributesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override FileSharePermissions GetPermissions(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginGetPermissions(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginGetPermissions(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override FileSharePermissions EndGetPermissions(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task GetPermissionsAsync() - { - throw exception; - } - - public override Task GetPermissionsAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task GetPermissionsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task GetPermissionsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override ShareStats GetStats(FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginGetStats(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginGetStats(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override ShareStats EndGetStats(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task GetStatsAsync() - { - throw exception; - } - - public override Task GetStatsAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task GetStatsAsync(FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task GetStatsAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override void SetMetadata(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginSetMetadata(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginSetMetadata(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override void EndSetMetadata(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task SetMetadataAsync() - { - throw exception; - } - - public override Task SetMetadataAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task SetMetadataAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task SetMetadataAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override void SetPermissions(FileSharePermissions permissions, AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginSetPermissions(FileSharePermissions permissions, AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginSetPermissions(FileSharePermissions permissions, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override void EndSetPermissions(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task SetPermissionsAsync(FileSharePermissions permissions) - { - throw exception; - } - - public override Task SetPermissionsAsync(FileSharePermissions permissions, CancellationToken cancellationToken) - { - throw exception; - } - - public override Task SetPermissionsAsync(FileSharePermissions permissions, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task SetPermissionsAsync(FileSharePermissions permissions, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override void SetProperties(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override ICancellableAsyncResult BeginSetProperties(AsyncCallback callback, object state) - { - throw exception; - } - - public override ICancellableAsyncResult BeginSetProperties(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) - { - throw exception; - } - - public override void EndSetProperties(IAsyncResult asyncResult) - { - throw exception; - } - - public override Task SetPropertiesAsync() - { - throw exception; - } - - public override Task SetPropertiesAsync(CancellationToken cancellationToken) - { - throw exception; - } - - public override Task SetPropertiesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - throw exception; - } - - public override Task SetPropertiesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - throw exception; - } - - public override string CreateFilePermission(string permission, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override Task CreateFilePermissionAsync(string permission, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null) - { - throw exception; - } - - public override string GetFilePermission(string filePermissionKey, FileRequestOptions options = null, OperationContext operationContext = null) - { - throw exception; - } - - public override Task GetFilePermissionAsync(string filePermissionKey, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null) - { - throw exception; - } - - //public override CloudFileDirectory GetRootDirectoryReference() - //{ - // throw exception; - //} - } -} +//// ---------------------------------------------------------------------------------- +//// +//// Copyright Microsoft Corporation +//// 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. +//// --------------------------------------------------------------------------------- + +//namespace Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel +//{ +// using Microsoft.Azure.Storage; +// using Microsoft.Azure.Storage.Auth; +// using Microsoft.Azure.Storage.Core.Util; +// using Microsoft.Azure.Storage.File; +// using Microsoft.Azure.Storage.File.Protocol; +// using Microsoft.Azure.Storage.Shared.Protocol; +// using System; +// using System.Collections.Generic; +// using System.IO; +// using System.Text; +// using System.Threading; +// using System.Threading.Tasks; + +// /// +// /// This class is used to handle the Azure file which can't be handle in Track1 File Object, like . +// /// +// public class InvalidCloudFileShare : CloudFileShare +// { +// public InvalidCloudFileShare(Uri objectAbsoluteUri, StorageCredentials credentials) +// : base(objectAbsoluteUri, credentials.IsSAS ? null : credentials) +// { +// string objectUri = objectAbsoluteUri.ToString(); +// if (credentials != null && credentials.IsSAS) +// { +// objectUri = objectUri.Replace(credentials.SASSignature, "[Sig]"); +// } +// exception = new InvalidOperationException(string.Format("Only support run action on this Azure file share with 'ShareClient', not support with 'CloudFileShare'. Share Uri: {0}.", objectAbsoluteUri)); +// } +// private InvalidOperationException exception; + +// public override void Create(FileRequestOptions requestOptions = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginCreate(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginCreate(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override void EndCreate(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task CreateAsync() +// { +// throw exception; +// } + +// public override Task CreateAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task CreateAsync(FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task CreateAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override bool CreateIfNotExists(FileRequestOptions requestOptions = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginCreateIfNotExists(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginCreateIfNotExists(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override bool EndCreateIfNotExists(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task CreateIfNotExistsAsync() +// { +// throw exception; +// } + +// public override Task CreateIfNotExistsAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task CreateIfNotExistsAsync(FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +//#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously +// public override async Task CreateIfNotExistsAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +//#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously +// { +// throw exception; +// } + +// public override void Delete(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override void Delete(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginDelete(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginDelete(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginDelete(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override void EndDelete(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task DeleteAsync() +// { +// throw exception; +// } + +// public override Task DeleteAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task DeleteAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task DeleteAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task DeleteAsync(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override bool DeleteIfExists(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override bool DeleteIfExists(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginDeleteIfExists(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginDeleteIfExists(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginDeleteIfExists(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override bool EndDeleteIfExists(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task DeleteIfExistsAsync() +// { +// throw exception; +// } + +// public override Task DeleteIfExistsAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task DeleteIfExistsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task DeleteIfExistsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +//#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously +// public override async Task DeleteIfExistsAsync(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +//#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously +// { +// throw exception; +// } + +// public override bool Exists(FileRequestOptions requestOptions = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginExists(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginExists(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override bool EndExists(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task ExistsAsync() +// { +// throw exception; +// } + +// public override Task ExistsAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task ExistsAsync(FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task ExistsAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override void FetchAttributes(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginFetchAttributes(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginFetchAttributes(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override void EndFetchAttributes(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task FetchAttributesAsync() +// { +// throw exception; +// } + +// public override Task FetchAttributesAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task FetchAttributesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task FetchAttributesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override FileSharePermissions GetPermissions(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginGetPermissions(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginGetPermissions(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override FileSharePermissions EndGetPermissions(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task GetPermissionsAsync() +// { +// throw exception; +// } + +// public override Task GetPermissionsAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task GetPermissionsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task GetPermissionsAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override ShareStats GetStats(FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginGetStats(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginGetStats(FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ShareStats EndGetStats(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task GetStatsAsync() +// { +// throw exception; +// } + +// public override Task GetStatsAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task GetStatsAsync(FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task GetStatsAsync(FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override void SetMetadata(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginSetMetadata(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginSetMetadata(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override void EndSetMetadata(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task SetMetadataAsync() +// { +// throw exception; +// } + +// public override Task SetMetadataAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task SetMetadataAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task SetMetadataAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override void SetPermissions(FileSharePermissions permissions, AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginSetPermissions(FileSharePermissions permissions, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginSetPermissions(FileSharePermissions permissions, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override void EndSetPermissions(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task SetPermissionsAsync(FileSharePermissions permissions) +// { +// throw exception; +// } + +// public override Task SetPermissionsAsync(FileSharePermissions permissions, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task SetPermissionsAsync(FileSharePermissions permissions, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task SetPermissionsAsync(FileSharePermissions permissions, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override void SetProperties(AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginSetProperties(AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override ICancellableAsyncResult BeginSetProperties(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, AsyncCallback callback, object state) +// { +// throw exception; +// } + +// public override void EndSetProperties(IAsyncResult asyncResult) +// { +// throw exception; +// } + +// public override Task SetPropertiesAsync() +// { +// throw exception; +// } + +// public override Task SetPropertiesAsync(CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override Task SetPropertiesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) +// { +// throw exception; +// } + +// public override Task SetPropertiesAsync(AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) +// { +// throw exception; +// } + +// public override string CreateFilePermission(string permission, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override Task CreateFilePermissionAsync(string permission, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null) +// { +// throw exception; +// } + +// public override string GetFilePermission(string filePermissionKey, FileRequestOptions options = null, OperationContext operationContext = null) +// { +// throw exception; +// } + +// public override Task GetFilePermissionAsync(string filePermissionKey, FileRequestOptions options = null, OperationContext operationContext = null, CancellationToken? cancellationToken = null) +// { +// throw exception; +// } + +// //public override CloudFileDirectory GetRootDirectoryReference() +// //{ +// // throw exception; +// //} +// } +//} diff --git a/src/Storage/Storage/Common/SasTokenHelper.cs b/src/Storage/Storage/Common/SasTokenHelper.cs index ca41465d0e34..303d0267065b 100644 --- a/src/Storage/Storage/Common/SasTokenHelper.cs +++ b/src/Storage/Storage/Common/SasTokenHelper.cs @@ -17,7 +17,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.Common using Microsoft.WindowsAzure.Commands.Storage.Model.Contract; using Microsoft.Azure.Storage; using Microsoft.Azure.Storage.Blob; - using Microsoft.Azure.Storage.File; using XTable = Microsoft.Azure.Cosmos.Table; using System; using System.Collections.Generic; @@ -70,52 +69,6 @@ public static bool ValidateContainerAccessPolicy(IStorageBlobManagement channel, return !sharedAccessPolicy.SharedAccessExpiryTime.HasValue; } - /// - /// Validate the file share access policy - /// - /// IStorageFileManagement channel object - /// A string containing the name of the share. - /// The policy identifier which need to be checked. - /// - /// - /// - public static bool ValidateShareAccessPolicy(IStorageFileManagement channel, string shareName, - string policyIdentifier, bool shouldNoPermission, bool shouldNoStartTime, bool shouldNoExpiryTime) - { - if (string.IsNullOrEmpty(policyIdentifier)) return true; - CloudFileShare fileShare = channel.GetShareReference(shareName); - FileSharePermissions permission; - - try - { - permission = fileShare.GetPermissionsAsync().Result; - } - catch (AggregateException e) when (e.InnerException is StorageException) - { - throw e.InnerException; - } - - SharedAccessFilePolicy sharedAccessPolicy = - GetExistingPolicy(permission.SharedAccessPolicies, policyIdentifier); - - if (shouldNoPermission && sharedAccessPolicy.Permissions != SharedAccessFilePermissions.None) - { - throw new InvalidOperationException(Resources.SignedPermissionsMustBeOmitted); - } - - if (shouldNoStartTime && sharedAccessPolicy.SharedAccessStartTime.HasValue) - { - throw new InvalidOperationException(Resources.SignedStartTimeMustBeOmitted); - } - - if (shouldNoExpiryTime && sharedAccessPolicy.SharedAccessExpiryTime.HasValue) - { - throw new InvalidOperationException(Resources.SignedExpiryTimeMustBeOmitted); - } - - return !sharedAccessPolicy.SharedAccessExpiryTime.HasValue; - } - /// /// Validate the table access policy /// @@ -278,7 +231,7 @@ public static ShareSasBuilder SetShareSasBuilder_FromFile(ShareFileClient file, DateTime? StartTime = null, DateTime? ExpiryTime = null, string iPAddressOrRange = null, - SharedAccessProtocol? Protocol = null) + string Protocol = null) { ShareSasBuilder sasBuilder = SetShareSasBuilder(file.ShareName, file.Path, @@ -300,7 +253,7 @@ public static ShareSasBuilder SetShareSasBuilder_FromShare(ShareClient share, DateTime? StartTime = null, DateTime? ExpiryTime = null, string iPAddressOrRange = null, - SharedAccessProtocol? Protocol = null) + string Protocol = null) { ShareSasBuilder sasBuilder = SetShareSasBuilder(share.Name, null, @@ -431,7 +384,7 @@ public static ShareSasBuilder SetShareSasBuilder(string shareName, DateTime? StartTime = null, DateTime? ExpiryTime = null, string iPAddressOrRange = null, - SharedAccessProtocol? Protocol = null, + string Protocol = null, string EncryptionScope = null) { ShareSasBuilder sasBuilder; @@ -525,7 +478,7 @@ public static ShareSasBuilder SetShareSasBuilder(string shareName, } if (Protocol != null) { - if (Protocol.Value == SharedAccessProtocol.HttpsOrHttp) + if (Protocol.ToLower() == HttpsOrHttp) { sasBuilder.Protocol = SasProtocol.HttpsAndHttp; } diff --git a/src/Storage/Storage/Common/StorageExtensions.cs b/src/Storage/Storage/Common/StorageExtensions.cs index 8e7b5c2eaa07..a9cce9cfdab7 100644 --- a/src/Storage/Storage/Common/StorageExtensions.cs +++ b/src/Storage/Storage/Common/StorageExtensions.cs @@ -40,7 +40,7 @@ internal static Uri GenerateUriWithCredentials( } string sasToken = GetFileSASToken(file, disableTrailingDot); - + if (string.IsNullOrEmpty(sasToken)) { return file.SnapshotQualifiedUri; diff --git a/src/Storage/Storage/Common/Util.cs b/src/Storage/Storage/Common/Util.cs index 9b9c3078eddb..2f435c3968af 100644 --- a/src/Storage/Storage/Common/Util.cs +++ b/src/Storage/Storage/Common/Util.cs @@ -856,5 +856,20 @@ public static Uri RemoveFileUriTrailingDot(Uri fileUri) } return new Uri(noLastSegment); } + + public static string RemoveFilePathTrailingDot(string FilePath) + { + string filePathWithoutDot; + string[] segments = FilePath.Split(NamingUtil.PathSeparators); + List segmentsWithoutDot = new List(); + + foreach (string segment in segments) + { + segmentsWithoutDot.Add(segment.TrimEnd('.')); + } + filePathWithoutDot = String.Join("/", segmentsWithoutDot.ToArray()); + + return filePathWithoutDot; + } } } diff --git a/src/Storage/Storage/File/AzureStorageFileCmdletBase.cs b/src/Storage/Storage/File/AzureStorageFileCmdletBase.cs index c18fd73fe85c..fee296c470cd 100644 --- a/src/Storage/Storage/File/AzureStorageFileCmdletBase.cs +++ b/src/Storage/Storage/File/AzureStorageFileCmdletBase.cs @@ -14,7 +14,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File { - using Azure.Commands.Common.Authentication.Abstractions; using global::Azure; using global::Azure.Core; using global::Azure.Storage.Files.Shares; @@ -94,80 +93,6 @@ protected bool ShareIsEmpty(ShareClient share) } } - protected bool ShouldSetContext(IStorageContext context, CloudFileClient cloudFileClient) - { - if (context == null) - { - return true; - } - try - { - if (context.GetCloudStorageAccount().FileEndpoint.Host.Equals(cloudFileClient.BaseUri.Host, StringComparison.OrdinalIgnoreCase)) - { - return false; - } - } catch (Exception) - { - return true; - } - return true; - } - - /// - /// Write CloudFile to output using specified service channel - /// - /// Task id - /// AzureStorageContext object - /// The output CloudFile object - internal void WriteCloudFileObject(long taskId, AzureStorageContext context, CloudFile file) - { - AzureStorageFile azureFile = new AzureStorageFile(file, context); - OutputStream.WriteObject(taskId, azureFile); - } - - - /// - /// Write CloudFileDirectory to output using specified service channel - /// - /// Task id - /// AzureStorageContext object - /// The output CloudFileDirectory object - internal void WriteCloudFileDirectoryeObject(long taskId, AzureStorageContext context, CloudFileDirectory fileDir) - { - AzureStorageFileDirectory azureFileDir = new AzureStorageFileDirectory(fileDir, context); - OutputStream.WriteObject(taskId, azureFileDir); - } - - /// - /// Write CloudFileShare to output using specified service channel - /// - /// Task id - /// IStorageFileManagement channel object - /// The output CloudFileShare object - internal void WriteCloudShareObject(long taskId, IStorageFileManagement channel, CloudFileShare share) - { - AzureStorageFileShare azureshare = new AzureStorageFileShare(share, channel.StorageContext); - OutputStream.WriteObject(taskId, azureshare); - } - - /// - /// Write IListFileItem to output using specified service channel - /// - /// Task id - /// AzureStorageContext object - /// The output IListFileItem object - internal void WriteListFileItemObject(long taskId, AzureStorageContext context, IListFileItem item) - { - if ((item as CloudFile) != null) // CloudFile - { - WriteCloudFileObject(taskId, context, item as CloudFile); - } - else - { - WriteCloudFileDirectoryeObject(taskId, context, item as CloudFileDirectory); - } - } - public ShareClientOptions ClientOptions { get @@ -201,31 +126,6 @@ public ShareClientOptions createClientOptions() return clientOptions; } - public static AzureStorageContext GetStorageContextFromTrack1FileServiceClient(CloudFileClient fileServiceClient, IAzureContext DefaultContext = null) - { - Microsoft.Azure.Storage.CloudStorageAccount account = new Microsoft.Azure.Storage.CloudStorageAccount( - fileServiceClient.Credentials, - null, //blob Uri - null, //queue Uri - null, //talbe Uri - fileServiceClient.BaseUri); //file Uri - return new AzureStorageContext(account, - fileServiceClient.Credentials.AccountName, - DefaultContext); - } - public static AzureStorageContext GetStorageContextFromTrack1BlobServiceClient(CloudBlobClient blobServiceClient, IAzureContext DefaultContext = null) - { - Microsoft.Azure.Storage.CloudStorageAccount account = new Microsoft.Azure.Storage.CloudStorageAccount( - blobServiceClient.Credentials, - blobServiceClient.BaseUri, //blob Uri - null, //queue Uri - null, //talbe Uri - null); //file Uri - return new AzureStorageContext(account, - blobServiceClient.Credentials.AccountName, - DefaultContext); - } - protected bool WithOauthCredential() { if(this.Channel != null && this.Channel.StorageContext != null && this.Channel.StorageContext.StorageAccount != null && this.Channel.StorageContext.StorageAccount.Credentials.IsToken) @@ -234,5 +134,14 @@ protected bool WithOauthCredential() } return false; } + + protected void CheckContextForObjectInput(AzureStorageContext context) + { + if (context == null) + { + throw new InvalidOperationException("Could not get the storage context. Please pass in a storage context with \"-Context\" parameter (can be created with New-AzStorageContext cmdlet), " + + "or set the current storage context with Set-AzCurrentStorageAccount cmdlet."); + } + } } } diff --git a/src/Storage/Storage/File/Cmdlet/CloseAzureStorageFileHandle.cs b/src/Storage/Storage/File/Cmdlet/CloseAzureStorageFileHandle.cs index 3f5358d75f46..faaae3407228 100644 --- a/src/Storage/Storage/File/Cmdlet/CloseAzureStorageFileHandle.cs +++ b/src/Storage/Storage/File/Cmdlet/CloseAzureStorageFileHandle.cs @@ -17,9 +17,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; using Microsoft.Azure.Commands.Common.Authentication.Abstractions; - using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; - using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; using System; @@ -84,33 +81,16 @@ public class CloseAzureStorageFileHandle : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( - Position = 0, - Mandatory = true, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ShareCloseAllParameterSetName, - HelpMessage = "CloudFileShare object indicated the share which contains the files/directories to closed handle.")] - [Parameter( - Position = 0, + Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, - ParameterSetName = ShareCloseSingleParameterSetName, - HelpMessage = "CloudFileShare object indicated the share which contains the files/directories to closed handle.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, ParameterSetName = ShareCloseAllParameterSetName, HelpMessage = "ShareClient object indicated the share which contains the files/directories to closed handle.")] [Parameter( - Mandatory = false, + Position = 0, + Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ShareCloseSingleParameterSetName, @@ -118,44 +98,22 @@ public class CloseAzureStorageFileHandle : AzureStorageFileCmdletBase [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( - Position = 0, + Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = DirectoryCloseAllParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the base folder which contains the files/directories to closed handle.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = DirectoryCloseAllParameterSetName, HelpMessage = "ShareDirectoryClient object indicated the base folder which contains the files/directories to closed handle.")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("File", "13.0.0", "8.0.0", ChangeDescription = "The parameter File (alias CloudFile) will be deprecated, and ShareFileClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = FileCloseAllParameterSetName, - HelpMessage = "CloudFile object indicated the file to close handle.")] - [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile File { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = FileCloseAllParameterSetName, HelpMessage = "ShareFileClient object indicated the file to close handle.")] [ValidateNotNull] public ShareFileClient ShareFileClient { get; set; } @@ -193,18 +151,6 @@ public class CloseAzureStorageFileHandle : AzureStorageFileCmdletBase [Parameter(Mandatory = true, ParameterSetName = FileCloseAllParameterSetName, HelpMessage = "Force close all File handles.")] public SwitchParameter CloseAll { get; set; } - [Parameter( - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ShareNameCloseSingleParameterSetName, - HelpMessage = "Azure Storage Context Object")] - [Parameter( - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ShareNameCloseAllParameterSetName, - HelpMessage = "Azure Storage Context Object")] - public override IStorageContext Context { get; set; } - [Parameter(Mandatory = false, HelpMessage = "Disallow trailing dot (.) to suffix directory and file names.", ParameterSetName = ShareNameCloseAllParameterSetName)] [Parameter(Mandatory = false, HelpMessage = "Disallow trailing dot (.) to suffix directory and file names.", ParameterSetName = ShareNameCloseSingleParameterSetName)] public override SwitchParameter DisAllowTrailingDot { get; set; } @@ -224,14 +170,7 @@ public override void ExecuteCmdlet() switch (this.ParameterSetName) { case DirectoryCloseAllParameterSetName: - if (this.ShareDirectoryClient != null) - { - baseDirClient = this.ShareDirectoryClient; - } - else - { - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Directory, ClientOptions); - } + baseDirClient = this.ShareDirectoryClient; break; case ShareNameCloseSingleParameterSetName: @@ -243,25 +182,11 @@ public override void ExecuteCmdlet() case ShareCloseSingleParameterSetName: case ShareCloseAllParameterSetName: - if (this.ShareClient != null) - { - baseDirClient = this.ShareClient.GetRootDirectoryClient(); ; - } - else - { - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Share.GetRootDirectoryReference(), ClientOptions); - } + baseDirClient = this.ShareClient.GetRootDirectoryClient(); break; case FileCloseAllParameterSetName: - if (this.ShareFileClient != null) - { - targetFile = this.ShareFileClient; - } - else - { - targetFile = AzureStorageFile.GetTrack2FileClient(this.File, ClientOptions); - } + targetFile = this.ShareFileClient; break; default: @@ -276,7 +201,7 @@ public override void ExecuteCmdlet() // When not input path/File, the list handle target must be a Dir bool foundAFolder = true; ShareDirectoryClient targetDir = baseDirClient; - if (this.File != null) + if (targetFile != null) { foundAFolder = false; } diff --git a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFile.cs b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFile.cs index 33c3492ba629..eee58b4b45c0 100644 --- a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFile.cs +++ b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFile.cs @@ -17,16 +17,12 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using global::Azure; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using System.Collections.Generic; using System.Globalization; using System.Management.Automation; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFile), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFile from deprecated v11 SDK will be removed. Use child property ShareFileClient instead.")] - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileDirectory), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileDirectory from deprecated v11 SDK will be removed. Use child property ShareDirectoryClient instead.")] [Cmdlet("Get", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageFile", DefaultParameterSetName = Constants.ShareNameParameterSetName)] [OutputType(typeof(AzureStorageFile))] public class GetAzureStorageFile : AzureStorageFileCmdletBase @@ -39,44 +35,22 @@ public class GetAzureStorageFile : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the files/directories would be listed.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.ShareParameterSetName, HelpMessage = "ShareClient object indicated the share where the files/directories would be listed.")] [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the base folder where the files/directories would be listed.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.DirectoryParameterSetName, HelpMessage = "ShareDirectoryClient object indicated the base folder where the files/directories would be listed.")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } @@ -96,21 +70,8 @@ public override void ExecuteCmdlet() switch (this.ParameterSetName) { case Constants.DirectoryParameterSetName: - if (this.ShareDirectoryClient != null) - { - baseDirClient = this.ShareDirectoryClient; - } - else - { - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Directory, ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Directory.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Directory.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirClient = this.ShareDirectoryClient; break; case Constants.ShareNameParameterSetName: @@ -120,21 +81,8 @@ public override void ExecuteCmdlet() break; case Constants.ShareParameterSetName: - if (this.ShareClient != null) - { - baseDirClient = this.ShareClient.GetRootDirectoryClient(); - } - else - { - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Share.GetRootDirectoryReference(), ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirClient = this.ShareClient.GetRootDirectoryClient(); break; default: diff --git a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs index 50f67e795ad9..da7d1653eb20 100644 --- a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs +++ b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileContent.cs @@ -22,10 +22,8 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using global::Azure; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Documents.Partitioning; using Microsoft.Azure.Storage.DataMovement; using Microsoft.WindowsAzure.Commands.Common; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -35,7 +33,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using LocalDirectory = System.IO.Directory; using LocalPath = System.IO.Path; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFile), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFile from deprecated v11 SDK will be removed when -PassThru is specified. Use child property ShareFileClient instead.")] [Cmdlet("Get", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageFileContent", SupportsShouldProcess = true, DefaultParameterSetName = LocalConstants.ShareNameParameterSetName)] [OutputType(typeof(AzureStorageFile))] public class GetAzureStorageFileContent : StorageFileDataManagementCmdletBase, IDynamicParameters @@ -48,64 +45,32 @@ public class GetAzureStorageFileContent : StorageFileDataManagementCmdletBase, I [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = LocalConstants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the file would be downloaded.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = LocalConstants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the file would be downloaded.")] + HelpMessage = "ShareClient object indicated the share where the file would be downloaded.")] [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = LocalConstants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the cloud directory where the file would be downloaded.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = LocalConstants.DirectoryParameterSetName, HelpMessage = "ShareDirectoryClient object indicated the cloud directory where the file would be downloaded.")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("File", "13.0.0", "8.0.0", ChangeDescription = "The parameter File (alias CloudFile) will be deprecated, and ShareFileClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = LocalConstants.FileParameterSetName, - HelpMessage = "CloudFile object indicated the cloud file to be downloaded.")] - [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile File { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = LocalConstants.FileParameterSetName, HelpMessage = "ShareFileClient object indicated the cloud file to be downloaded.")] [ValidateNotNull] public ShareFileClient ShareFileClient { get; set; } @@ -185,67 +150,27 @@ public override void ExecuteCmdlet() string[] path = NamingUtil.ValidatePath(this.Path, true); switch (this.ParameterSetName) { - case LocalConstants.FileParameterSetName: - fileToBeDownloaded = this.File; - - if (this.ShareFileClient != null) - { - fileClientToBeDownloaded = this.ShareFileClient; - } - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.File.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.File.ServiceClient, DefaultContext); - } + case LocalConstants.FileParameterSetName: + fileClientToBeDownloaded = this.ShareFileClient; + fileToBeDownloaded = AzureStorageFile.GetTrack1FileClient(fileClientToBeDownloaded, ((AzureStorageContext)this.Context).StorageAccount.Credentials); break; case LocalConstants.ShareNameParameterSetName: var share = this.BuildFileShareObjectFromName(this.ShareName); fileToBeDownloaded = share.GetRootDirectoryReference().GetFileReferenceByPath(path); - + ShareServiceClient fileserviceClient = Util.GetTrack2FileServiceClient((AzureStorageContext)this.Context, ClientOptions); fileClientToBeDownloaded = fileserviceClient.GetShareClient(this.ShareName).GetRootDirectoryClient().GetFileClient(this.Path); break; case LocalConstants.ShareParameterSetName: - fileToBeDownloaded = this.Share.GetRootDirectoryReference().GetFileReferenceByPath(path); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } - - if (this.ShareClient != null) - { - fileClientToBeDownloaded = this.ShareClient.GetRootDirectoryClient().GetFileClient(this.Path); - } - else - { - fileClientToBeDownloaded = AzureStorageFile.GetTrack2FileClient(fileToBeDownloaded, ClientOptions); - } + fileClientToBeDownloaded = this.ShareClient.GetRootDirectoryClient().GetFileClient(this.Path); + fileToBeDownloaded = AzureStorageFile.GetTrack1FileClient(fileClientToBeDownloaded, ((AzureStorageContext)this.Context).StorageAccount.Credentials); break; case LocalConstants.DirectoryParameterSetName: - fileToBeDownloaded = this.Directory.GetFileReferenceByPath(path); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Directory.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Directory.ServiceClient, DefaultContext); - } - - if (this.ShareDirectoryClient != null) - { - fileClientToBeDownloaded = this.ShareDirectoryClient.GetFileClient(this.Path); - } - else - { - fileClientToBeDownloaded = AzureStorageFile.GetTrack2FileClient(fileToBeDownloaded, ClientOptions); - } + fileClientToBeDownloaded = this.ShareDirectoryClient.GetFileClient(this.Path); + fileToBeDownloaded = AzureStorageFile.GetTrack1FileClient(fileClientToBeDownloaded, ((AzureStorageContext)this.Context).StorageAccount.Credentials); break; default: @@ -276,7 +201,7 @@ public override void ExecuteCmdlet() { // If not Oauth, and not AllowTrailingDot , use DMlib - if ((!WithOauthCredential() && (this.DisAllowTrailingDot.IsPresent || !Util.PathContainsTrailingDot(fileToBeDownloaded.GetFullPath()))) || fileClientToBeDownloaded == null) + if (!WithOauthCredential() && (this.DisAllowTrailingDot.IsPresent || !Util.PathContainsTrailingDot(fileClientToBeDownloaded.Path))) { await fileToBeDownloaded.FetchAttributesAsync(null, this.RequestOptions, OperationContext, @@ -306,7 +231,8 @@ await DataMovementTransferHelper.DoTransfer(() => if (this.PassThru) { - WriteCloudFileObject(taskId, (AzureStorageContext)this.Context, fileToBeDownloaded); + ShareFileProperties fileProperties = await fileClientToBeDownloaded.GetPropertiesAsync(cancellationToken: this.CmdletCancellationToken).ConfigureAwait(false); + OutputStream.WriteObject(taskId, new AzureStorageFile(fileClientToBeDownloaded, (AzureStorageContext)this.Context, fileProperties, ClientOptions)); } } else // Track2 SDK diff --git a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileCopyState.cs b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileCopyState.cs index 93b0a3455dda..b382ccd95f68 100644 --- a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileCopyState.cs +++ b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileCopyState.cs @@ -12,18 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Storage; -using XFile = Microsoft.Azure.Storage.File; -using Microsoft.Azure.Storage.File; using System; using System.Collections.Concurrent; using System.Management.Automation; using System.Security.Permissions; using System.Threading; using System.Threading.Tasks; -using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Azure.Storage.Files.Shares; -using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using Azure.Storage.Files.Shares.Models; @@ -49,19 +44,9 @@ public class GetAzureStorageFileCopyStateCommand : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string FilePath { get; set; } - [CmdletParameterBreakingChangeWithVersion("File", "13.0.0", "8.0.0", ChangeDescription = "The parameter File (alias CloudFile) will be deprecated, and ShareFileClient will be mandatory.")] [Parameter( Position = 0, - HelpMessage = "Target file instance", Mandatory = true, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.FileParameterSetName)] - [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile File { get; set; } - - [Parameter( - Mandatory = false, + Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.FileParameterSetName, @@ -110,10 +95,6 @@ public override void ExecuteCmdlet() { file = this.ShareFileClient; } - else if (null != this.File) - { - file = AzureStorageFile.GetTrack2FileClient(this.File); - } else { file = Util.GetTrack2ShareReference(this.ShareName, diff --git a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileHandle.cs b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileHandle.cs index 94f8a6cbd03e..9ce754470559 100644 --- a/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileHandle.cs +++ b/src/Storage/Storage/File/Cmdlet/GetAzureStorageFileHandle.cs @@ -17,9 +17,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using global::Azure; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; - using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using Microsoft.WindowsAzure.Commands.Storage.Model.ResourceModel; using System.Collections.Generic; @@ -38,60 +35,26 @@ public class GetAzureStorageFileHandle : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the files/directories would list File Handles.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.ShareParameterSetName, HelpMessage = "ShareClient object indicated the share where the files/directories would list File Handles")] [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the base folder where the files/directories would list File Handles.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.DirectoryParameterSetName, HelpMessage = "ShareDirectoryClient object indicated the base folder where the files/directories would list File Handles")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("File", "13.0.0", "8.0.0", ChangeDescription = "The parameter File (alias CloudFile) will be deprecated, and ShareFileClient will be mandatory.")] - [Parameter( - Position = 0, - Mandatory = true, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.FileParameterSetName, - HelpMessage = "CloudFile object indicated the file to list File Handles.")] - [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile File { get; set; } - [Parameter( Mandatory = false, ValueFromPipeline = true, @@ -128,14 +91,7 @@ public override void ExecuteCmdlet() switch (this.ParameterSetName) { case Constants.DirectoryParameterSetName: - if (this.ShareDirectoryClient != null) - { - baseDirClient = this.ShareDirectoryClient; - } - else - { - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Directory, ClientOptions); - } + baseDirClient = this.ShareDirectoryClient; break; case Constants.ShareNameParameterSetName: @@ -145,26 +101,11 @@ public override void ExecuteCmdlet() break; case Constants.ShareParameterSetName: - if (this.ShareClient != null) - { - baseDirClient = this.ShareClient.GetRootDirectoryClient(); - } - else - { - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Share.GetRootDirectoryReference(), ClientOptions); - } + baseDirClient = this.ShareClient.GetRootDirectoryClient(); break; case Constants.FileParameterSetName: - if (this.ShareFileClient != null) - { - targetFile = this.ShareFileClient; - } - else - { - - targetFile = AzureStorageFile.GetTrack2FileClient(this.File, ClientOptions); - } + targetFile = this.ShareFileClient; break; default: diff --git a/src/Storage/Storage/File/Cmdlet/GetAzureStorageShare.cs b/src/Storage/Storage/File/Cmdlet/GetAzureStorageShare.cs index 1ac08868eadd..24687760b648 100644 --- a/src/Storage/Storage/File/Cmdlet/GetAzureStorageShare.cs +++ b/src/Storage/Storage/File/Cmdlet/GetAzureStorageShare.cs @@ -16,19 +16,15 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { using Azure.Commands.Common.Authentication.Abstractions; - using Microsoft.WindowsAzure.Commands.Common.Storage; - using Microsoft.Azure.Storage.File; using System; using System.Globalization; using System.Management.Automation; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using global::Azure.Storage.Files.Shares.Models; using global::Azure.Storage.Files.Shares; using global::Azure; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileShare), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileShare from deprecated v11 SDK will be removed. Use child property ShareClient instead.")] [Cmdlet("Get", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageShare", DefaultParameterSetName = Constants.MatchingPrefixParameterSetName)] [OutputType(typeof(AzureStorageFileShare))] public class GetAzureStorageShare : AzureStorageFileCmdletBase diff --git a/src/Storage/Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs b/src/Storage/Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs index 54ce45d3df6f..2ea4405b0982 100644 --- a/src/Storage/Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs +++ b/src/Storage/Storage/File/Cmdlet/GetAzureStorageShareStoredAccessPolicy.cs @@ -17,7 +17,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using Common; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Storage.File; using Model.Contract; using System; using System.Collections.Generic; diff --git a/src/Storage/Storage/File/Cmdlet/NewAzureStorageDirectory.cs b/src/Storage/Storage/File/Cmdlet/NewAzureStorageDirectory.cs index a12101a334a9..64d1a1959936 100644 --- a/src/Storage/Storage/File/Cmdlet/NewAzureStorageDirectory.cs +++ b/src/Storage/Storage/File/Cmdlet/NewAzureStorageDirectory.cs @@ -15,14 +15,11 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { using global::Azure.Storage.Files.Shares; - using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using System.Globalization; using System.Management.Automation; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileDirectory), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileDirectory from deprecated v11 SDK will be removed. Use child property ShareDirectoryClient instead.")] [Cmdlet("New", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageDirectory", DefaultParameterSetName = Constants.ShareNameParameterSetName), OutputType(typeof(AzureStorageFileDirectory))] public class NewAzureStorageDirectory : AzureStorageFileCmdletBase { @@ -34,44 +31,22 @@ public class NewAzureStorageDirectory : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the directory would be created.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.ShareParameterSetName, HelpMessage = "ShareClient object indicated the share where the files/directories would be listed.")] [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the base folder where the new directory would be created.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.DirectoryParameterSetName, HelpMessage = "ShareDirectoryClient object indicated the base folder where the files/directories would be listed.")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } @@ -92,22 +67,8 @@ public override void ExecuteCmdlet() switch (this.ParameterSetName) { case Constants.DirectoryParameterSetName: - if (this.ShareDirectoryClient != null) - { - baseDirClient = this.ShareDirectoryClient; - } - else - { - - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Directory, ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Directory.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Directory.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirClient = this.ShareDirectoryClient; break; case Constants.ShareNameParameterSetName: @@ -117,22 +78,8 @@ public override void ExecuteCmdlet() break; case Constants.ShareParameterSetName: - if (this.ShareClient != null) - { - baseDirClient = this.ShareClient.GetRootDirectoryClient(); - } - else - { - - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Share.GetRootDirectoryReference(), ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirClient = this.ShareClient.GetRootDirectoryClient(); break; default: diff --git a/src/Storage/Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs b/src/Storage/Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs index f4d627b2a8d2..4a349468101c 100644 --- a/src/Storage/Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs +++ b/src/Storage/Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs @@ -12,20 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.Common.Authentication.Abstractions; -using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Storage.Common; -using Microsoft.WindowsAzure.Commands.Storage.Model.Contract; -using Microsoft.Azure.Storage; -using Microsoft.Azure.Storage.File; using System; using System.Management.Automation; using System.Security.Permissions; using Azure.Storage.Files.Shares; using Azure.Storage.Files.Shares.Models; using Azure.Storage.Sas; -using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; -using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { @@ -42,15 +35,10 @@ public class NewAzureStorageFileSasToken : AzureStorageFileCmdletBase /// private const string NameSasPolicyParmeterSet = "NameSasPolicy"; - /// - /// Sas permission with CloudFile instance parameter set name - /// - private const string CloudFileSasPermissionParameterSet = "FileSasPermission"; + private const string FileClientSasPermissionParameterSet = "FileSasPermission"; + + private const string FileClientSasPolicyParameterSet = "FileSasPolicy"; - /// - /// Sas policy with CloudFile instance parameter set name - /// - private const string CloudFileSasPolicyParmeterSet = "FileSasPolicy"; [Parameter(Position = 0, Mandatory = true, HelpMessage = "Share Name", @@ -78,23 +66,21 @@ public class NewAzureStorageFileSasToken : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string Path { get; set; } - [CmdletParameterBreakingChangeWithVersion("File", "13.0.0", "8.0.0", ChangeDescription = "The parameter File (alias CloudFile) will be deprecated, and a new mandatory parameter ShareFileClient will be added.")] [Parameter(Mandatory = true, - HelpMessage = "CloudFile instance to represent the file to get SAS token against.", + HelpMessage = "ShareFlieClient instance to represent the file to get SAS token against.", ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, - ParameterSetName = CloudFileSasPermissionParameterSet)] + ParameterSetName = FileClientSasPermissionParameterSet)] [Parameter(Mandatory = true, - HelpMessage = "CloudFile instance to represent the file to get SAS token against.", + HelpMessage = "ShareFileClient instance to represent the file to get SAS token against.", ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, - ParameterSetName = CloudFileSasPolicyParmeterSet)] + ParameterSetName = FileClientSasPolicyParameterSet)] [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile File { get; set; } + public ShareFileClient ShareFileClient { get; set; } [Parameter(Mandatory = true, HelpMessage = "Policy Identifier", ParameterSetName = NameSasPolicyParmeterSet)] - [Parameter(Mandatory = true, HelpMessage = "Policy Identifier", ParameterSetName = CloudFileSasPolicyParmeterSet)] + [Parameter(Mandatory = true, HelpMessage = "Policy Identifier", ParameterSetName = FileClientSasPolicyParameterSet)] [ValidateNotNullOrEmpty] public string Policy { @@ -110,14 +96,13 @@ public string Policy [Parameter( Mandatory = false, HelpMessage = "Permissions for a file. Permissions can be any subset of \"rwd\".", - ParameterSetName = CloudFileSasPermissionParameterSet)] + ParameterSetName = FileClientSasPermissionParameterSet)] [ValidateNotNullOrEmpty] public string Permission { get; set; } - [CmdletParameterBreakingChangeWithVersion("Protocol", "13.0.0", "8.0.0", ChangeDescription = "The type of parameter Protocol will be changed from SharedAccessProtocol to string.")] [Parameter(Mandatory = false, HelpMessage = "Protocol can be used in the request with this SAS token.")] - [ValidateNotNull] - public SharedAccessProtocol? Protocol { get; set; } + [ValidateSet("HttpsOnly", "HttpsOrHttp", IgnoreCase = true),] + public string Protocol { get; set; } [Parameter(Mandatory = false, HelpMessage = "IP, or IP range ACL (access control list) that the request would be accepted by Azure Storage.")] [ValidateNotNullOrEmpty] @@ -134,19 +119,6 @@ public string Policy [Parameter(Mandatory = false, HelpMessage = "Display full uri with sas token")] public SwitchParameter FullUri { get; set; } - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - HelpMessage = "Azure Storage Context Object", - ParameterSetName = NameSasPermissionParameterSet)] - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - HelpMessage = "Azure Storage Context Object", - ParameterSetName = NameSasPolicyParmeterSet)] - [ValidateNotNull] - public override IStorageContext Context { get; set; } - // Overwrite the useless parameter public override int? ServerTimeoutPerRequest { get; set; } public override int? ClientTimeoutPerRequest { get; set; } @@ -161,16 +133,11 @@ public override void ExecuteCmdlet() { ShareClient shareClient; ShareFileClient fileClient; - if (null != this.File) + + if (null != this.ShareFileClient) { - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.File.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.File.ServiceClient, DefaultContext); - } - - fileClient = AzureStorageFile.GetTrack2FileClient(this.File, this.ClientOptions); + CheckContextForObjectInput((AzureStorageContext)this.Context); + fileClient = this.ShareFileClient; shareClient = Util.GetTrack2ShareReference(fileClient.ShareName, (AzureStorageContext)this.Context, snapshotTime: Util.GetSnapshotTimeStringFromUri(fileClient.Uri), @@ -188,7 +155,7 @@ public override void ExecuteCmdlet() if (this.Context != null && this.Context is AzureStorageContext && ((AzureStorageContext)this.Context).StorageAccount != null && !((AzureStorageContext)this.Context).StorageAccount.Credentials.IsSharedKey) { - throw new InvalidOperationException("Create File service SAS only supported with SharedKey credentail."); + throw new InvalidOperationException("Create File service SAS only supported with SharedKey credential."); } // Get share saved policy if any diff --git a/src/Storage/Storage/File/Cmdlet/NewAzureStorageShare.cs b/src/Storage/Storage/File/Cmdlet/NewAzureStorageShare.cs index a22c64c139ba..5812ed48a944 100644 --- a/src/Storage/Storage/File/Cmdlet/NewAzureStorageShare.cs +++ b/src/Storage/Storage/File/Cmdlet/NewAzureStorageShare.cs @@ -15,14 +15,11 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { using System.Management.Automation; - using Azure.Storage.File; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileShare), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileShare from deprecated v11 SDK will be removed. Use child property ShareClient instead.")] [Cmdlet("New", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageShare", DefaultParameterSetName = Constants.ShareNameParameterSetName), OutputType(typeof(AzureStorageFileShare))] public class NewAzureStorageShare : AzureStorageFileCmdletBase { diff --git a/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs b/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs index 34b3470ed780..cdfc9836722c 100644 --- a/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs +++ b/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs @@ -15,19 +15,13 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { using Azure.Commands.Common.Authentication.Abstractions; - using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Storage.Common; - using Microsoft.WindowsAzure.Commands.Storage.Model.Contract; - using Microsoft.Azure.Storage; - using Microsoft.Azure.Storage.File; using System; using System.Management.Automation; using System.Security.Permissions; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Sas; using global::Azure.Storage.Files.Shares.Models; - using global::Azure.Storage; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; [Cmdlet("New", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageShareSASToken"), OutputType(typeof(String))] public class NewAzureStorageShareSasToken : AzureStorageFileCmdletBase @@ -64,10 +58,9 @@ public string Policy [ValidateNotNullOrEmpty] public string Permission { get; set; } - [CmdletParameterBreakingChangeWithVersion("Protocol", "13.0.0", "8.0.0", ChangeDescription = "The type of parameter Protocol will be changed from SharedAccessProtocol to string.")] [Parameter(Mandatory = false, HelpMessage = "Protocol can be used in the request with this SAS token.")] - [ValidateNotNull] - public SharedAccessProtocol? Protocol { get; set; } + [ValidateSet("HttpsOnly", "HttpsOrHttp", IgnoreCase = true),] + public string Protocol { get; set; } [Parameter(Mandatory = false, HelpMessage = "IP, or IP range ACL (access control list) that the request would be accepted by Azure Storage.")] [ValidateNotNullOrEmpty] diff --git a/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs b/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs index d116e34d214f..940353c154b1 100644 --- a/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs +++ b/src/Storage/Storage/File/Cmdlet/NewAzureStorageShareStoredAccessPolicy.cs @@ -17,14 +17,11 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using Common; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Storage; - using Microsoft.Azure.Storage.File; using System; using System.Collections.Generic; using System.Globalization; using System.Management.Automation; using System.Security.Permissions; - using System.Threading.Tasks; /// /// create a new stored access policy to a specific azure share. diff --git a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs index fbda883ddd9a..f115dd971a7b 100644 --- a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs +++ b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageDirectory.cs @@ -15,14 +15,11 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { using global::Azure.Storage.Files.Shares; - using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using System.Globalization; using System.Management.Automation; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileDirectory), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileDirectory from deprecated v11 SDK will be removed when -PassThru is specified. Use child property ShareDirectoryClient instead.")] [Cmdlet("Remove", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageDirectory",SupportsShouldProcess = true,DefaultParameterSetName = Constants.ShareNameParameterSetName), OutputType(typeof(AzureStorageFileDirectory))] public class RemoveAzureStorageDirectory : AzureStorageFileCmdletBase { @@ -34,44 +31,22 @@ public class RemoveAzureStorageDirectory : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the directory would be removed.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.ShareParameterSetName, HelpMessage = "ShareClient object indicated the share where the directory would be removed.")] [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the base folder where the directory would be removed.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.DirectoryParameterSetName, HelpMessage = "ShareDirectoryClient object indicated the base folder where the directory would be removed.")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } @@ -103,22 +78,8 @@ public override void ExecuteCmdlet() switch (this.ParameterSetName) { case Constants.DirectoryParameterSetName: - if (this.ShareDirectoryClient != null) - { - baseDirClient = this.ShareDirectoryClient; - } - else - { - - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Directory, ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Directory.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Directory.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirClient = this.ShareDirectoryClient; break; case Constants.ShareNameParameterSetName: @@ -129,21 +90,8 @@ public override void ExecuteCmdlet() break; case Constants.ShareParameterSetName: - if (this.ShareClient != null) - { - baseDirClient = this.ShareClient.GetRootDirectoryClient(); - } - else - { - baseDirClient = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Share.GetRootDirectoryReference(), ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirClient = this.ShareClient.GetRootDirectoryClient(); break; default: diff --git a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageFile.cs b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageFile.cs index 40de2664f2d7..aeeb2437cfb0 100644 --- a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageFile.cs +++ b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageFile.cs @@ -15,14 +15,11 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { using global::Azure.Storage.Files.Shares; - using Microsoft.Azure.Storage.File; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using System.Globalization; using System.Management.Automation; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFile), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFile from deprecated v11 SDK will be removed when -PassThru is specified. Use child property ShareFileClient instead.")] [Cmdlet("Remove", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageFile",SupportsShouldProcess = true,DefaultParameterSetName = Constants.ShareNameParameterSetName), OutputType(typeof(AzureStorageFile))] public class RemoveAzureStorageFile : AzureStorageFileCmdletBase { @@ -34,65 +31,32 @@ public class RemoveAzureStorageFile : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( - Position = 0, + Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the file would be removed.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.ShareParameterSetName, HelpMessage = "ShareClient object indicated the share where the file would be removed.")] [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( - Position = 0, + Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the cloud directory where the file would be removed.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.DirectoryParameterSetName, HelpMessage = "ShareDirectoryClient object indicated the base folder where the file would be removed.")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("File", "13.0.0", "8.0.0", ChangeDescription = "The parameter File (alias CloudFile) will be deprecated, and ShareFileClient will be mandatory.")] [Parameter( - Position = 0, + Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.FileParameterSetName, - HelpMessage = "CloudFile object indicated the file to be removed.")] - [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile File { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.FileParameterSetName, HelpMessage = "ShareFileClient object indicated the file would be removed.")] [ValidateNotNull] public ShareFileClient ShareFileClient { get; set; } @@ -124,21 +88,8 @@ public override void ExecuteCmdlet() switch (this.ParameterSetName) { case Constants.FileParameterSetName: - if (this.ShareFileClient != null) - { - fileToBeRemoved = this.ShareFileClient; - } - else - { - fileToBeRemoved = AzureStorageFile.GetTrack2FileClient(this.File, ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.File.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.File.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + fileToBeRemoved = this.ShareFileClient; break; case Constants.ShareNameParameterSetName: @@ -148,39 +99,13 @@ public override void ExecuteCmdlet() break; case Constants.ShareParameterSetName: - if (this.ShareClient != null) - { - fileToBeRemoved = this.ShareClient.GetRootDirectoryClient().GetFileClient(this.Path); - } - else - { - fileToBeRemoved = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Share.GetRootDirectoryReference(), ClientOptions).GetFileClient(this.Path); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + fileToBeRemoved = this.ShareClient.GetRootDirectoryClient().GetFileClient(this.Path); break; case Constants.DirectoryParameterSetName: - if (this.ShareDirectoryClient != null) - { - fileToBeRemoved = this.ShareDirectoryClient.GetFileClient(this.Path); - } - else - { - fileToBeRemoved = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Directory, ClientOptions).GetFileClient(this.Path); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Directory.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Directory.ServiceClient, DefaultContext); - } - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + fileToBeRemoved = this.ShareDirectoryClient.GetFileClient(this.Path); break; default: diff --git a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShare.cs b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShare.cs index b6841322c491..909790dbf164 100644 --- a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShare.cs +++ b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShare.cs @@ -15,17 +15,12 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { using Microsoft.WindowsAzure.Commands.Storage.Common; - using Microsoft.Azure.Storage; - using Microsoft.Azure.Storage.File; using System.Globalization; using System.Management.Automation; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using global::Azure.Storage.Files.Shares; - using global::Azure.Storage.Files.Shares.Models; using System; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileShare), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileShare from deprecated v11 SDK will be removed when -PassThru is specified. Use child property ShareClient instead.")] [Cmdlet("Remove", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageShare",DefaultParameterSetName = Constants.ShareNameParameterSetName,SupportsShouldProcess = true), OutputType(typeof(AzureStorageFileShare))] public class RemoveAzureStorageShare : AzureStorageFileCmdletBase { @@ -39,24 +34,12 @@ public class RemoveAzureStorageShare : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string Name { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.ShareParameterSetName, - HelpMessage = "File share object to be removed.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Position = 0, - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.ShareParameterSetName, HelpMessage = "File share Client to be removed.")] [ValidateNotNull] public ShareClient ShareClient { get; set; } @@ -101,22 +84,9 @@ public override void ExecuteCmdlet() switch (this.ParameterSetName) { case Constants.ShareParameterSetName: - if (this.ShareClient != null) - { - share = this.ShareClient; - } - else - { - share = AzureStorageFileShare.GetTrack2FileShareClient(this.Share, (AzureStorageContext)this.Context, this.ClientOptions); - } - this.SnapshotTime = this.Share.SnapshotTime == null ? null : this.Share.SnapshotTime; - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + share = this.ShareClient; + this.SnapshotTime = Util.GetSnapshotTimeFromUri(share.Uri); break; case Constants.ShareNameParameterSetName: diff --git a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShareStoredAccessPolicy.cs b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShareStoredAccessPolicy.cs index 891e2147be10..ed0eafd9e1dd 100644 --- a/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShareStoredAccessPolicy.cs +++ b/src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShareStoredAccessPolicy.cs @@ -17,7 +17,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using Common; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Storage.File; using Model.Contract; using System; using System.Collections.Generic; diff --git a/src/Storage/Storage/File/Cmdlet/RenameAzureStorageDirectory.cs b/src/Storage/Storage/File/Cmdlet/RenameAzureStorageDirectory.cs index a9dd4aada4b9..71b1cfb372e6 100644 --- a/src/Storage/Storage/File/Cmdlet/RenameAzureStorageDirectory.cs +++ b/src/Storage/Storage/File/Cmdlet/RenameAzureStorageDirectory.cs @@ -15,7 +15,6 @@ using Azure.Storage.Files.Shares; using Azure.Storage.Files.Shares.Models; using Azure.Storage.Files.Shares.Specialized; -using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using System.Globalization; @@ -23,7 +22,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileDirectory), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileDirectory from deprecated v11 SDK will be removed. Use child property ShareDirectoryClient instead.")] [Cmdlet("Rename", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageDirectory", SupportsShouldProcess = true, DefaultParameterSetName = ShareNameParameterSet)] [OutputType(typeof(AzureStorageFileDirectory))] public class RenameAzureStorageDirectory : StorageFileDataManagementCmdletBase diff --git a/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs b/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs index ae4867238b72..8d05515a8df3 100644 --- a/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs +++ b/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs @@ -21,7 +21,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using Microsoft.Azure.Storage.DataMovement; using Microsoft.Azure.Storage.File; using Microsoft.WindowsAzure.Commands.Common; - using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; @@ -36,7 +35,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using System.Threading.Tasks; using LocalConstants = Microsoft.WindowsAzure.Commands.Storage.File.Constants; - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFile), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFile from deprecated v11 SDK will be removed. Use child property ShareFileClient instead.")] [Cmdlet("Set", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageFileContent", SupportsShouldProcess = true, DefaultParameterSetName = LocalConstants.ShareNameParameterSetName), OutputType(typeof(AzureStorageFile))] public class SetAzureStorageFileContent : StorageFileDataManagementCmdletBase, IDynamicParameters { @@ -48,45 +46,23 @@ public class SetAzureStorageFileContent : StorageFileDataManagementCmdletBase, I [ValidateNotNullOrEmpty] public string ShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("Share", "13.0.0", "8.0.0", ChangeDescription = "The parameter Share (alias CloudFileShare) will be deprecated, and ShareClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = LocalConstants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share where the file would be uploaded to.")] - [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = LocalConstants.ShareParameterSetName, HelpMessage = "ShareClient object indicated the share where the file would be uploaded to.")] [ValidateNotNull] public ShareClient ShareClient { get; set; } - [CmdletParameterBreakingChangeWithVersion("Directory", "13.0.0", "8.0.0", ChangeDescription = "The parameter Directory (alias CloudFileDirectory) will be deprecated, and ShareDirectoryClient will be mandatory.")] [Parameter( Position = 0, Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = LocalConstants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the cloud directory where the file would be uploaded.")] - [ValidateNotNull] - [Alias("CloudFileDirectory")] - public CloudFileDirectory Directory { get; set; } - - [Parameter( - Mandatory = false, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = LocalConstants.DirectoryParameterSetName, - HelpMessage = "CloudFileDirectory object indicated the cloud directory where the file would be uploaded.")] + HelpMessage = "ShareDirectoryClient object indicated the directory where the file would be uploaded.")] [ValidateNotNull] public ShareDirectoryClient ShareDirectoryClient { get; set; } @@ -154,14 +130,15 @@ public override void ExecuteCmdlet() bool isDirectory; string[] path = NamingUtil.ValidatePath(this.Path, out isDirectory); + var cloudFileToBeUploaded = + BuildCloudFileInstanceFromPathAsync(localFile.Name, path, isDirectory).ConfigureAwait(false).GetAwaiter().GetResult(); + var fileClientToBeUploaded = BuildShareFileClientInstanceFromPathAsync(localFile.Name, path, isDirectory).ConfigureAwait(false).GetAwaiter().GetResult(); + + this.RunTask(async taskId => { - if (fileSize <= sizeTB && !WithOauthCredential() && (this.DisAllowTrailingDot.IsPresent || !Util.PathContainsTrailingDot(this.Path))) - { - // Step 2: Build the CloudFile object which pointed to the - // destination cloud file. - var cloudFileToBeUploaded = - BuildCloudFileInstanceFromPathAsync(localFile.Name, path, isDirectory).ConfigureAwait(false).GetAwaiter().GetResult(); + if (fileSize <= sizeTB && !WithOauthCredential() && (this.DisAllowTrailingDot.IsPresent || !Util.PathContainsTrailingDot(fileClientToBeUploaded.Path))) + { if (ShouldProcess(cloudFileToBeUploaded.Name, "Set file content")) { var progressRecord = new ProgressRecord( @@ -186,14 +163,14 @@ await DataMovementTransferHelper.DoTransfer(() => if (this.PassThru) { // TODO: is get attributes necessary? - cloudFileToBeUploaded.FetchAttributes(); - WriteCloudFileObject(taskId, (AzureStorageContext)this.Context, cloudFileToBeUploaded); + ShareFileProperties fileProperties = fileClientToBeUploaded.GetProperties(this.CmdletCancellationToken).Value; + OutputStream.WriteObject(taskId, new AzureStorageFile(fileClientToBeUploaded, (AzureStorageContext)this.Context, fileProperties, ClientOptions)); } } } else // use Track2 SDK { - var fileClientToBeUploaded = BuildShareFileClientInstanceFromPathAsync(localFile.Name, path, isDirectory).ConfigureAwait(false).GetAwaiter().GetResult(); + if (ShouldProcess(fileClientToBeUploaded.Path, "Set file content")) { var progressRecord = new ProgressRecord( @@ -344,13 +321,8 @@ private async Task BuildCloudFileInstanceFromPathAsync(string default switch (this.ParameterSetName) { case LocalConstants.DirectoryParameterSetName: - baseDirectory = this.Directory; - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Directory.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Directory.ServiceClient, DefaultContext); - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirectory = AzureStorageFileDirectory.GetTrack1FileDirClient(this.ShareDirectoryClient, ((AzureStorageContext)this.Context).StorageAccount.Credentials, ClientOptions); break; case LocalConstants.ShareNameParameterSetName: @@ -359,13 +331,8 @@ private async Task BuildCloudFileInstanceFromPathAsync(string default break; case LocalConstants.ShareParameterSetName: - baseDirectory = this.Share.GetRootDirectoryReference(); - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + baseDirectory = AzureStorageFileDirectory.GetTrack1FileDirClient(this.ShareClient.GetRootDirectoryClient(), ((AzureStorageContext)this.Context).StorageAccount.Credentials, ClientOptions); break; default: @@ -435,14 +402,7 @@ private async Task BuildShareFileClientInstanceFromPathAsync(st switch (this.ParameterSetName) { case LocalConstants.DirectoryParameterSetName: - if (this.ShareDirectoryClient != null) - { - baseDirectory = this.ShareDirectoryClient; - } - else - { - baseDirectory = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Directory, ClientOptions); - } + baseDirectory = this.ShareDirectoryClient; break; case LocalConstants.ShareNameParameterSetName: @@ -455,14 +415,7 @@ private async Task BuildShareFileClientInstanceFromPathAsync(st break; case LocalConstants.ShareParameterSetName: - if (this.ShareClient != null) - { - baseDirectory = this.ShareClient.GetRootDirectoryClient(); - } - else - { - baseDirectory = AzureStorageFileDirectory.GetTrack2FileDirClient(this.Share.GetRootDirectoryReference(), ClientOptions); - } + baseDirectory = this.ShareClient.GetRootDirectoryClient(); break; default: diff --git a/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareQuota.cs b/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareQuota.cs index 20138ce45407..43299c4dfd15 100644 --- a/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareQuota.cs +++ b/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareQuota.cs @@ -13,7 +13,6 @@ // ---------------------------------------------------------------------------------- using Microsoft.WindowsAzure.Commands.Storage.Common; -using Microsoft.Azure.Storage.File; using System.Globalization; using System.Management.Automation; using System.Security.Permissions; @@ -21,10 +20,10 @@ using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Azure.Storage.Files.Shares; using Azure.Storage.Files.Shares.Models; +using System; namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFileShare), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFileShare from deprecated v11 SDK will be removed. Use child property ShareClient instead.")] [Cmdlet("Set", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageShareQuota", DefaultParameterSetName = Constants.ShareNameParameterSetName), OutputType(typeof(AzureStorageFileShare))] public class SetAzureStorageShareQuota : AzureStorageFileCmdletBase { @@ -44,10 +43,9 @@ public class SetAzureStorageShareQuota : AzureStorageFileCmdletBase ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.ShareParameterSetName, - HelpMessage = "CloudFileShare object indicated the share whose quota to set.")] + HelpMessage = "ShareClient object indicated the share whose quota to set.")] [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare Share { get; set; } + public ShareClient ShareClient { get; set; } [Alias("QuotaGiB")] [Parameter(Position = 1, Mandatory = true, @@ -76,14 +74,8 @@ public override void ExecuteCmdlet() break; case Constants.ShareParameterSetName: - share = AzureStorageFileShare.GetTrack2FileShareClient(this.Share, (AzureStorageContext)this.Context, this.ClientOptions); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.Share.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext); - } + CheckContextForObjectInput((AzureStorageContext)this.Context); + share = this.ShareClient; break; default: @@ -94,8 +86,6 @@ public override void ExecuteCmdlet() if (shareProperties.QuotaInGB != this.Quota) { - //fileShare.Properties.Quota = this.Quota; - //this.Channel.SetShareProperties(fileShare, null, this.RequestOptions, this.OperationContext); share.SetQuota(this.Quota); shareProperties = share.GetProperties(this.CmdletCancellationToken).Value; } diff --git a/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs b/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs index 3ecc2a1b176f..b9895e7fdbea 100644 --- a/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs +++ b/src/Storage/Storage/File/Cmdlet/SetAzureStorageShareStoredAccessPolicy.cs @@ -17,7 +17,6 @@ namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet using Common; using global::Azure.Storage.Files.Shares; using global::Azure.Storage.Files.Shares.Models; - using Microsoft.Azure.Storage.File; using Model.Contract; using System; using System.Collections.Generic; diff --git a/src/Storage/Storage/File/Cmdlet/StartAzureStorageFileCopy.cs b/src/Storage/Storage/File/Cmdlet/StartAzureStorageFileCopy.cs index 5426286bc450..4b9c6f7d61aa 100644 --- a/src/Storage/Storage/File/Cmdlet/StartAzureStorageFileCopy.cs +++ b/src/Storage/Storage/File/Cmdlet/StartAzureStorageFileCopy.cs @@ -13,26 +13,21 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.Common.Authentication.Abstractions; -using Microsoft.WindowsAzure.Commands.Common.Storage; using Microsoft.WindowsAzure.Commands.Storage.Common; using Microsoft.WindowsAzure.Commands.Storage.Model.Contract; -using Microsoft.Azure.Storage; -using Microsoft.Azure.Storage.Blob; -using Microsoft.Azure.Storage.File; using System; using System.Management.Automation; using System.Security.Permissions; using System.Threading.Tasks; -using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Azure.Storage.Files.Shares; using Azure; using Azure.Storage.Files.Shares.Models; -using System.Diagnostics; +using Azure.Storage.Blobs; +using Azure.Storage.Blobs.Specialized; namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { - [CmdletOutputBreakingChangeWithVersion(typeof(AzureStorageFile), "13.0.0", "8.0.0", ChangeDescription = "The child property CloudFile from deprecated v11 SDK will be removed. Use child property ShareFileClient instead.")] [Cmdlet("Start", Azure.Commands.ResourceManager.Common.AzureRMConstants.AzurePrefix + "StorageFileCopy", SupportsShouldProcess = true), OutputType(typeof(AzureStorageFile))] public class StartAzureStorageFileCopyCommand : StorageFileDataManagementCmdletBase { @@ -56,19 +51,17 @@ public class StartAzureStorageFileCopyCommand : StorageFileDataManagementCmdletB [ValidateNotNullOrEmpty] public string SrcContainerName { get; set; } - [CmdletParameterBreakingChangeWithVersion("SrcContainer", "13.0.0", "8.0.0", ChangeDescription = "The type of parameter SrcContainer will be changed from CloudBlobContainer to BlobContainerClient.")] [Parameter(HelpMessage = "Source container instance", Mandatory = true, ParameterSetName = ContainerParameterSet)] [ValidateNotNull] - public CloudBlobContainer SrcContainer { get; set; } + [Alias("BlobContainerClient")] + public BlobContainerClient SrcContainer { get; set; } - [CmdletParameterBreakingChangeWithVersion("SrcBlob", "13.0.0", "8.0.0", ChangeDescription = "The type of parameter SrcBlob will be changed from CloudBlob to BlobBaseClient. The alias ICloudBlob will be deprecated.")] - [Alias("ICloudBlob")] [Parameter(HelpMessage = "Source blob instance", Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = BlobFilePathParameterSet)] [Parameter(HelpMessage = "Source blob instance", Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = BlobFileParameterSet)] - [ValidateNotNull] - public CloudBlob SrcBlob { get; set; } + [Alias("BlobBaseClient")] + public BlobBaseClient SrcBlob { get; set; } [Parameter(HelpMessage = "Source file path", Mandatory = true, ParameterSetName = ShareNameParameterSet)] [Parameter(HelpMessage = "Source file path", Mandatory = true, ParameterSetName = ShareParameterSet)] @@ -79,26 +72,24 @@ public class StartAzureStorageFileCopyCommand : StorageFileDataManagementCmdletB [ValidateNotNullOrEmpty] public string SrcShareName { get; set; } - [CmdletParameterBreakingChangeWithVersion("SrcShare", "13.0.0", "8.0.0", ChangeDescription = "The type of parameter SrcShare will be changed from CloudFileShare to ShareClient. The alias CloudFileShare will be deprecated.")] [Parameter(HelpMessage = "Source share instance", Mandatory = true, ParameterSetName = ShareParameterSet)] [ValidateNotNull] - [Alias("CloudFileShare")] - public CloudFileShare SrcShare { get; set; } + [Alias("ShareClient")] + public ShareClient SrcShare { get; set; } - [CmdletParameterBreakingChangeWithVersion("SrcFile", "13.0.0", "8.0.0", ChangeDescription = "The type of parameter SrcFile will be changed from CloudFile to ShareFileClient. The alias CloudFile will be deprecated.")] - [Parameter(HelpMessage = "Source file instance", + [Parameter(HelpMessage = "Source file instance", Mandatory = true, ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, + ValueFromPipelineByPropertyName = true, ParameterSetName = FileFilePathParameterSet)] - [Parameter(HelpMessage = "Source file instance", + [Parameter(HelpMessage = "Source file instance", Mandatory = true, ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, + ValueFromPipelineByPropertyName = true, ParameterSetName = FileFileParameterSet)] [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile SrcFile { get; set; } + [Alias("ShareFileClient")] + public ShareFileClient SrcFile { get; set; } [Parameter(HelpMessage = "Source Uri", Mandatory = true, ParameterSetName = UriFilePathParameterSet)] [Parameter(HelpMessage = "Source Uri", Mandatory = true, ParameterSetName = UriFileParameterSet)] @@ -125,28 +116,30 @@ public class StartAzureStorageFileCopyCommand : StorageFileDataManagementCmdletB [ValidateNotNullOrEmpty] public string DestFilePath { get; set; } - [CmdletParameterBreakingChangeWithVersion("DestFile", "13.0.0", "8.0.0", ChangeDescription = "The parameter DestFile will be deprecated. To input a dest file instance, use DestShareFileClient instead.")] - [Parameter(HelpMessage = "Dest file instance", Mandatory = false, ParameterSetName = BlobFileParameterSet)] - [Parameter(HelpMessage = "Dest file instance", Mandatory = false, ParameterSetName = FileFileParameterSet)] - [Parameter(HelpMessage = "Dest file instance", Mandatory = false, ParameterSetName = UriFileParameterSet)] - [ValidateNotNull] - public CloudFile DestFile { get; set; } - [Parameter(Mandatory = false, ParameterSetName = BlobFileParameterSet, HelpMessage = "ShareFileClient object indicated the Dest file.")] [Parameter(Mandatory = false, ParameterSetName = FileFileParameterSet, HelpMessage = "ShareFileClient object indicated the Dest file.")] [Parameter(Mandatory = false, ParameterSetName = UriFileParameterSet, HelpMessage = "ShareFileClient object indicated the Dest file.")] [ValidateNotNull] + [Alias("DestFile")] public ShareFileClient DestShareFileClient { get; set; } [Alias("SrcContext")] [Parameter(HelpMessage = "Source Azure Storage Context Object", - Mandatory = false, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ContainerNameParameterSet)] + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ContainerNameParameterSet)] [Parameter(HelpMessage = "Source Azure Storage Context Object", - Mandatory = false, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ShareNameParameterSet)] + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ShareNameParameterSet)] + [Parameter(HelpMessage = "Source Azure Storage Context Object", + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ContainerParameterSet)] + [Parameter(HelpMessage = "Source Azure Storage Context Object", + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = BlobFilePathParameterSet)] + [Parameter(HelpMessage = "Source Azure Storage Context Object", + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = BlobFileParameterSet)] + [Parameter(HelpMessage = "Source Azure Storage Context Object", + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ShareParameterSet)] + [Parameter(HelpMessage = "Source Azure Storage Context Object", + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = FileFileParameterSet)] + [Parameter(HelpMessage = "Source Azure Storage Context Object", + Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = FileFilePathParameterSet)] public override IStorageContext Context { get; set; } [Parameter(HelpMessage = "Destination Storage context object", ParameterSetName = ContainerNameParameterSet)] @@ -205,7 +198,13 @@ private IStorageBlobManagement GetBlobChannel() private AzureStorageContext GetSourceContext() { if (this.ParameterSetName == ContainerNameParameterSet || - this.ParameterSetName == ShareNameParameterSet) + this.ParameterSetName == ShareNameParameterSet || + this.ParameterSetName == ContainerParameterSet || + this.ParameterSetName == BlobFilePathParameterSet || + this.ParameterSetName == BlobFileParameterSet || + this.ParameterSetName == ShareParameterSet || + this.ParameterSetName == FileFilePathParameterSet || + this.ParameterSetName == FileFileParameterSet) { return this.GetCmdletStorageContext(); } @@ -273,16 +272,6 @@ internal IStorageFileManagement GetDestinationChannel() [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] public override void ExecuteCmdlet() { - if(this.DestFile != null) - { - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.DestContext, this.DestFile.ServiceClient)) - { - this.DestContext = GetStorageContextFromTrack1FileServiceClient(this.DestFile.ServiceClient, DefaultContext); - } - } - if (this.DisAllowSourceTrailingDot) { this.ClientOptions.AllowSourceTrailingDot = false; @@ -296,7 +285,7 @@ public override void ExecuteCmdlet() destChannel = GetDestinationChannel(); IStorageFileManagement srcChannel = Channel; Action copyAction = null; - string target = this.DestShareFileClient != null ? this.DestShareFileClient.Name : (DestFile != null ? DestFile.Name : DestFilePath); + string target = this.DestShareFileClient != null ? this.DestShareFileClient.Name : DestFilePath; switch (ParameterSetName) { case ContainerNameParameterSet: @@ -325,7 +314,7 @@ public override void ExecuteCmdlet() private void StartCopyFromBlob() { - CloudBlob blob = null; + BlobBaseClient blob = null; string sourceBlobRelativeName = null; if (null != this.SrcBlob) @@ -335,7 +324,7 @@ private void StartCopyFromBlob() } else { - CloudBlobContainer srcContainer = null; + BlobContainerClient srcContainer = null; if (null != this.SrcContainer) { @@ -344,10 +333,11 @@ private void StartCopyFromBlob() else { NameUtil.ValidateContainerName(this.SrcContainerName); - srcContainer = this.blobChannel.GetContainerReference(this.SrcContainerName); + srcContainer = this.blobChannel.GetBlobContainerClient(this.SrcContainerName); + } NameUtil.ValidateBlobName(this.SrcBlobName); - blob = srcContainer.GetBlobReference(this.SrcBlobName); + blob = srcContainer.GetBlobBaseClient(this.SrcBlobName); sourceBlobRelativeName = this.SrcBlobName; } @@ -356,51 +346,52 @@ private void StartCopyFromBlob() Func taskGenerator = (taskId) => StartAsyncCopy( taskId, destFile, - () => this.ConfirmOverwrite(blob.SnapshotQualifiedUri.ToString(), Util.GetSnapshotQualifiedUri(destFile.Uri)), - () => destFile.StartCopyAsync(blob.GenerateUriWithCredentials(), cancellationToken: this.CmdletCancellationToken)); + () => this.ConfirmOverwrite(Util.GetSnapshotQualifiedUri(blob.Uri), Util.GetSnapshotQualifiedUri(destFile.Uri)), + () => destFile.StartCopyAsync(blob.GenerateUriWithCredentials((AzureStorageContext)this.Context), cancellationToken: this.CmdletCancellationToken)); this.RunTask(taskGenerator); } private void StartCopyFromFile() { - CloudFile sourceFile = null; - string filePath = null; + ShareFileClient sourceFile = null; if (null != this.SrcFile) { sourceFile = this.SrcFile; - filePath = this.SrcFile.GetFullPath(); - - // Build and set storage context for the output object when - // 1. input track1 object and storage context is missing 2. the current context doesn't match the context of the input object - if (ShouldSetContext(this.Context, this.SrcFile.ServiceClient)) - { - this.Context = GetStorageContextFromTrack1FileServiceClient(this.SrcFile.ServiceClient, DefaultContext); - } } else { - CloudFileDirectory dir = null; + ShareDirectoryClient dir = null; if (null != this.SrcShare) { - dir = this.SrcShare.GetRootDirectoryReference(); + dir = this.SrcShare.GetRootDirectoryClient(); } else { NamingUtil.ValidateShareName(this.SrcShareName, false); - dir = this.BuildFileShareObjectFromName(this.SrcShareName).GetRootDirectoryReference(); + + ShareClientOptions srcClientOptions = new ShareClientOptions(); + if (this.DisAllowSourceTrailingDot) + { + srcClientOptions.AllowTrailingDot = false; + } + dir = Util.GetTrack2FileServiceClient((AzureStorageContext)this.Context, srcClientOptions).GetShareClient(this.SrcShareName).GetRootDirectoryClient(); } - string[] path = NamingUtil.ValidatePath(this.SrcFilePath, true); - sourceFile = dir.GetFileReferenceByPath(path); - filePath = this.SrcFilePath; + // Remove trailing dots manually if DisAllowSourceTrailing dot is specified + string filepath = this.SrcFilePath; + if (this.DisAllowSourceTrailingDot) + { + filepath = Util.RemoveFilePathTrailingDot(filepath); + } + sourceFile = dir.GetFileClient(filepath); } ShareFileClient destFile = this.GetDestFile(); - if (sourceFile.ServiceClient.Credentials != null && sourceFile.ServiceClient.Credentials.IsToken + if (((AzureStorageContext)this.Context).Track2OauthToken != null && string.Compare(sourceFile.Uri.Host, destFile.Uri.Host, ignoreCase: true) != 0) { WriteWarning("The source File is on Azure AD credential, might cause cross account file copy fail. Please use source File based on SharedKey or SAS creadencial to avoid the failure."); @@ -409,8 +400,8 @@ private void StartCopyFromFile() Func taskGenerator = (taskId) => StartAsyncCopy( taskId, destFile, - () => this.ConfirmOverwrite(sourceFile.SnapshotQualifiedUri.ToString(), Util.GetSnapshotQualifiedUri(destFile.Uri)), - () => destFile.StartCopyAsync(sourceFile.GenerateUriWithCredentials(this.DisAllowSourceTrailingDot), cancellationToken: this.CmdletCancellationToken)); + () => this.ConfirmOverwrite(Util.GetSnapshotQualifiedUri(sourceFile.Uri), Util.GetSnapshotQualifiedUri(destFile.Uri)), + () => destFile.StartCopyAsync(sourceFile.GenerateUriWithCredentials(), cancellationToken: this.CmdletCancellationToken)); this.RunTask(taskGenerator); } @@ -436,10 +427,6 @@ private ShareFileClient GetDestFile() { return this.DestShareFileClient; } - else if (null != this.DestFile) - { - return AzureStorageFile.GetTrack2FileClient(this.DestFile, ClientOptions); - } else { NamingUtil.ValidateShareName(this.DestShareName, false); diff --git a/src/Storage/Storage/File/Cmdlet/StopAzureStorageFileCopy.cs b/src/Storage/Storage/File/Cmdlet/StopAzureStorageFileCopy.cs index 7c507b3c26a5..ede10ec8867a 100644 --- a/src/Storage/Storage/File/Cmdlet/StopAzureStorageFileCopy.cs +++ b/src/Storage/Storage/File/Cmdlet/StopAzureStorageFileCopy.cs @@ -1,15 +1,11 @@ using Microsoft.WindowsAzure.Commands.Storage.Model.Contract; -using Microsoft.Azure.Storage.File; -using Microsoft.Azure.Storage.RetryPolicies; using System; using System.Management.Automation; using System.Security.Permissions; using System.Threading.Tasks; using Azure.Storage.Files.Shares; -using Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel; using Microsoft.WindowsAzure.Commands.Storage.Common; using Azure.Storage.Files.Shares.Models; -using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; namespace Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet { @@ -32,19 +28,9 @@ public class StopAzureStorageFileCopyCommand : AzureStorageFileCmdletBase [ValidateNotNullOrEmpty] public string FilePath { get; set; } - [CmdletParameterBreakingChangeWithVersion("File", "13.0.0", "8.0.0", ChangeDescription = "The parameter File (alias CloudFile) will be deprecated, and ShareFileClient will be mandatory.")] [Parameter( Position = 0, - HelpMessage = "Target file instance", Mandatory = true, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - ParameterSetName = Constants.FileParameterSetName)] - [ValidateNotNull] - [Alias("CloudFile")] - public CloudFile File { get; set; } - - [Parameter( - Mandatory = false, + Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = Constants.FileParameterSetName, @@ -81,12 +67,9 @@ public override void ExecuteCmdlet() if (this.ShareFileClient != null) { + CheckContextForObjectInput((AzureStorageContext)this.Context); file = this.ShareFileClient; } - else if (null != this.File) - { - file = AzureStorageFile.GetTrack2FileClient(this.File); - } else { file = Util.GetTrack2ShareReference(this.ShareName, diff --git a/src/Storage/Storage/File/StorageClientExtensions.cs b/src/Storage/Storage/File/StorageClientExtensions.cs index f850e769a37e..657e1d24cccf 100644 --- a/src/Storage/Storage/File/StorageClientExtensions.cs +++ b/src/Storage/Storage/File/StorageClientExtensions.cs @@ -92,7 +92,7 @@ public static string GetFullPath(this IListFileItem item) } CloudFile file = item as CloudFile; - if(file != null) + if (file != null) { return shareUri.Uri.MakeRelativeUri(file.SnapshotQualifiedUri).ToString(); } diff --git a/src/Storage/Storage/Model/Contract/IStorageFileManagement.cs b/src/Storage/Storage/Model/Contract/IStorageFileManagement.cs index d82f2f270d68..3257f0e3dbcd 100644 --- a/src/Storage/Storage/Model/Contract/IStorageFileManagement.cs +++ b/src/Storage/Storage/Model/Contract/IStorageFileManagement.cs @@ -34,152 +34,6 @@ public interface IStorageFileManagement : IStorageManagement /// A reference to a share. CloudFileShare GetShareReference(string shareName, DateTimeOffset? snapshotTime = null); - /// - /// Get share permissions. - /// - /// A CloudFileShare instance. - /// Access condition - /// File request options - /// Operation context - /// The share's permission - FileSharePermissions GetSharePermissions(CloudFileShare share, AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null); - - /// - /// Set share permissions. - /// - /// A CloudFileShare object. - /// The share's permission. - /// Access condition - /// File request options - /// Operation context - void SetSharePermissions(CloudFileShare share, FileSharePermissions permissions, AccessCondition accessCondition = null, FileRequestOptions options = null, OperationContext operationContext = null); - - /// - /// Retrieve the share's attributes. - /// - /// Indicating the share. - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - void FetchShareAttributes(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext); - - /// - /// Set share attributes. - /// - /// Indicating the share. - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - void SetShareProperties(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext); - - /// - /// Enumerates the files and directories under a certain folder. - /// - /// Indicating the directory to be listed. - /// Indicating the action for enumerated items. - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// Indicating the cancellation token. - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task EnumerateFilesAndDirectoriesAsync(CloudFileDirectory directory, Action enumerationAction, FileRequestOptions options, OperationContext operationContext, CancellationToken token); - - /// - /// Returns a task that performs an asynchronous operation to retrieve the share's - /// attributes. - /// - /// Indicating the share. - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task FetchShareAttributesAsync(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token); - - /// - /// Enumerates the shares for a given prefix. - /// - /// Indicating the prefix. - /// - /// A value that indicates whether to return share metadata with the listing. - /// - /// Indicating the action for enumerated items. - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// Indicating the cancellation token. - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task EnumerateSharesAsync(string prefix, ShareListingDetails detailsIncluded, Action enumerationAction, FileRequestOptions options, OperationContext operationContext, CancellationToken token); - - /// - /// Returns a task that performs an asynchronous operation to create a directory. - /// - /// - /// Indicating the reference of the directory to be created. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task CreateDirectoryAsync(CloudFileDirectory directory, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - /// /// Returns a task that performs an asynchronous operation to determine whether a /// directory exists. @@ -203,211 +57,5 @@ public interface IStorageFileManagement : IStorageManagement /// A System.Threading.Tasks.Task object that represents the current operation. /// Task DirectoryExistsAsync(CloudFileDirectory directory, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Returns a task that performs an asynchronous operation to determine whether a - /// file exists. - /// - /// - /// Indicating the reference of the file. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task FileExistsAsync(CloudFile file, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Returns a task that performs an asynchronous operation to create a share. - /// - /// - /// Indicating the reference of the share to be created. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task CreateShareAsync(CloudFileShare share, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Returns a task that performs an asynchronous operation to delete a directory. - /// - /// - /// Indicating the reference of the directory to be deleted. - /// - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task DeleteDirectoryAsync(CloudFileDirectory directory, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Returns a task that performs an asynchronous operation to fetch attribute of a directory. - /// - /// - /// Indicating the reference of the directory whose attribute to be fetched. - /// - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task FetchDirectoryAttributesAsync(CloudFileDirectory directory, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Returns a task that performs an asynchronous operation to delete a share. - /// - /// - /// Indicating the reference of the share to be deleted. - /// - /// - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task DeleteShareAsync(CloudFileShare share, DeleteShareSnapshotsOption deleteShareSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Returns a task that performs an asynchronous operation to delete a file. - /// - /// - /// Indicating the reference of the file to be deleted. - /// - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task DeleteFileAsync(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Async get share permissions. - /// - /// A CloudFileShare instance. - /// Access condition - /// File request options - /// Operation context - /// User cancellation token - /// A task object which retrieve the permission of the specified container - Task GetSharePermissionsAsync(CloudFileShare share, AccessCondition accessCondition, - FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken); - - /// - /// Returns a task that performs an asynchronous operation to retrieve the file's - /// attributes. - /// - /// Indicating the file. - /// - /// A Microsoft.WindowsAzure.Storage.AccessCondition object that represents - /// the access conditions for the share. If null, no condition is used. - /// - /// - /// A Microsoft.Azure.Storage.File.FileRequestOptions object that specifies - /// additional options for the request. - /// - /// - /// A Microsoft.WindowsAzure.Storage.OperationContext object that represents - /// the context for the current operation. - /// - /// - /// A System.Threading.CancellationToken to observe while waiting for a task - /// to complete. - /// - /// - /// A System.Threading.Tasks.Task object that represents the current operation. - /// - Task FetchFileAttributesAsync(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token); - - /// - /// Return a task that asynchronously abort the file copy operation - /// - /// CloudFile object - /// Copy id - /// Access condition - /// File request options - /// Operation context - /// Cancellation token - /// Return a task that asynchronously abort the file copy operation - Task AbortCopyAsync(CloudFile file, string copyId, AccessCondition accessCondition, FileRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken); } } diff --git a/src/Storage/Storage/Model/Contract/StorageFileManagement.cs b/src/Storage/Storage/Model/Contract/StorageFileManagement.cs index 0d898f20c615..534d8799f740 100644 --- a/src/Storage/Storage/Model/Contract/StorageFileManagement.cs +++ b/src/Storage/Storage/Model/Contract/StorageFileManagement.cs @@ -64,150 +64,9 @@ public CloudFileShare GetShareReference(string shareName, DateTimeOffset? snapsh return this.Client.GetShareReference(shareName, snapshotTime); } - public void FetchShareAttributes(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - try - { - Task.Run(() => share.FetchAttributesAsync(accessCondition, options, operationContext)).Wait(); - } - catch (AggregateException e) when (e.InnerException is StorageException) - { - throw e.InnerException; - } - } - - public void SetShareProperties(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) - { - try - { - Task.Run(() => share.SetPropertiesAsync(accessCondition, options, operationContext)).Wait(); - } - catch (AggregateException e) when (e.InnerException is StorageException) - { - throw e.InnerException; - } - } - - public async Task EnumerateFilesAndDirectoriesAsync(CloudFileDirectory directory, Action enumerationAction, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - FileContinuationToken continuationToken = null; - do - { - var segment = await directory.ListFilesAndDirectoriesSegmentedAsync(null, continuationToken, options, operationContext, token).ConfigureAwait(false); - foreach (var item in segment.Results) - { - enumerationAction(item); - } - - continuationToken = segment.ContinuationToken; - } - while (continuationToken != null); - } - - public Task FetchShareAttributesAsync(CloudFileShare share, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - return share.FetchAttributesAsync(accessCondition, options, operationContext, token); - } - - public async Task EnumerateSharesAsync(string prefix, ShareListingDetails detailsIncluded, Action enumerationAction, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - FileContinuationToken continuationToken = null; - do - { - var segment = await this.Client.ListSharesSegmentedAsync(prefix, detailsIncluded, null, continuationToken, options, operationContext, token).ConfigureAwait(false); - foreach (var item in segment.Results) - { - enumerationAction(item); - } - - continuationToken = segment.ContinuationToken; - } - while (continuationToken != null); - } - - public Task CreateDirectoryAsync(CloudFileDirectory directory, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return directory.CreateAsync(options, operationContext, cancellationToken); - } - public Task DirectoryExistsAsync(CloudFileDirectory directory, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) { return directory.ExistsAsync(options, operationContext, cancellationToken); } - - public Task FileExistsAsync(CloudFile file, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return file.ExistsAsync(options, operationContext, cancellationToken); - } - - public Task CreateShareAsync(CloudFileShare share, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return share.CreateAsync(options, operationContext, cancellationToken); - } - - public Task DeleteDirectoryAsync(CloudFileDirectory directory, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return directory.DeleteAsync(accessCondition, options, operationContext, cancellationToken); - } - - public Task DeleteShareAsync(CloudFileShare share, DeleteShareSnapshotsOption deleteShareSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return share.DeleteAsync(deleteShareSnapshotsOption, accessCondition, options, operationContext, cancellationToken); - } - - public Task DeleteFileAsync(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return file.DeleteAsync(accessCondition, options, operationContext, cancellationToken); - } - - public Task GetSharePermissionsAsync(CloudFileShare share, AccessCondition accessCondition, - FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken) - { - return share.GetPermissionsAsync(accessCondition, options, operationContext, cancellationToken); - } - - public FileSharePermissions GetSharePermissions(CloudFileShare share, AccessCondition accessCondition = null, - FileRequestOptions options = null, OperationContext operationContext = null) - { - try - { - return share.GetPermissionsAsync(accessCondition, options, operationContext).Result; - } - catch (AggregateException e) when (e.InnerException is StorageException) - { - throw e.InnerException; - } - } - - public void SetSharePermissions(CloudFileShare share, FileSharePermissions permissions, - AccessCondition accessCondition = null, - FileRequestOptions options = null, OperationContext operationContext = null) - { - try - { - Task.Run(() => share.SetPermissionsAsync(permissions, accessCondition, options, operationContext)).Wait(); - } - catch (AggregateException e) when (e.InnerException is StorageException) - { - throw e.InnerException; - } - } - - public Task FetchFileAttributesAsync(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - return file.FetchAttributesAsync(accessCondition, options, operationContext, token); - } - - public Task FetchDirectoryAttributesAsync(CloudFileDirectory directory, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token) - { - return directory.FetchAttributesAsync(accessCondition, options, operationContext, token); - } - - public Task AbortCopyAsync(CloudFile file, string copyId, AccessCondition accessCondition, FileRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) - { - // Workaround for XSCL 8.4.0 issue: File abort copy fail with null reference. Will remove the line with the issue fixed. - CloudFileShare share = file.Share; - return file.AbortCopyAsync(copyId, accessCondition, requestOptions, operationContext, cancellationToken); - } } } diff --git a/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs b/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs index 999866df6f0b..e86825162fe1 100644 --- a/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs +++ b/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs @@ -12,12 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Storage.Shared.Protocol; -using XTable = Microsoft.Azure.Cosmos.Table; -using System.Collections.Generic; using System; -using System.Linq; -using Microsoft.Azure.Storage.File; using System.Net; using Microsoft.WindowsAzure.Commands.Common.Attributes; using Azure.Storage.Files.Shares.Models; @@ -53,19 +48,6 @@ public class PSFileHandle [Ps1Xml(Label = "SessionId", Target = ViewControl.Table, Position = 8)] public ulong SessionId { get; set; } - public PSFileHandle(FileHandle handle) - { - this.HandleId = handle.HandleId; - this.Path = handle.Path; - this.ClientIp = handle.ClientIp; - this.ClientPort = handle.ClientPort; - this.OpenTime = handle.OpenTime; - this.LastReconnectTime = handle.LastReconnectTime; - this.FileId = handle.FileId; - this.ParentId = handle.ParentId; - this.SessionId = handle.SessionId; - } - public PSFileHandle(ShareFileHandle handle) { if (!String.IsNullOrEmpty(handle.HandleId)) diff --git a/src/Storage/Storage/Storage.generated.format.ps1xml b/src/Storage/Storage/Storage.generated.format.ps1xml index 7a9c4ee431a0..3e1a424ba2c4 100644 --- a/src/Storage/Storage/Storage.generated.format.ps1xml +++ b/src/Storage/Storage/Storage.generated.format.ps1xml @@ -332,8 +332,8 @@ Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileDirectory - if ($_.CloudFile -eq $null) {$_.CloudFileDirectory.Parent.SnapshotQualifiedUri} else {$_.CloudFile.Parent.SnapshotQualifiedUri} - + if ($_.ShareFileClient -eq $null) {$_.ShareDirectoryClient.ShareName} else {$_.ShareFileClient.ShareName} + diff --git a/tools/StaticAnalysis/Exceptions/Az.Storage/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Storage/BreakingChangeIssues.csv index 776ba456c5bf..874b9f22643d 100644 --- a/tools/StaticAnalysis/Exceptions/Az.Storage/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/Az.Storage/BreakingChangeIssues.csv @@ -11,4 +11,82 @@ "Az.Storage","Microsoft.WindowsAzure.Commands.Storage.Queue.NewAzureStorageQueueCommand","New-AzStorageQueue","0","3010","The property 'EncodeMessage' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageQueue' has been removed.","Add the property 'EncodeMessage' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageQueue'." "Az.Storage","Microsoft.WindowsAzure.Commands.Storage.Queue.Cmdlet.NewAzureStorageQueueSasTokenCommand","New-AzStorageQueueSASToken","0","2020","The cmdlet 'New-AzStorageQueueSASToken' no longer supports the type 'System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol]' for parameter 'Protocol'.","Change the type for parameter 'Protocol' back to 'System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol]'." "Az.Storage","Microsoft.WindowsAzure.Commands.Storage.Queue.Cmdlet.NewAzureStorageQueueSasTokenCommand","New-AzStorageQueueSASToken","0","2050","A validate set has been added for parameter 'Protocol' for cmdlet 'New-AzStorageQueueSASToken'.","Remove the validate set from parameter 'Protocol'." -"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'." \ No newline at end of file +"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.File.Cmdlet.CloseAzureStorageFileHandle","Close-AzStorageFileHandle","0","2000","The cmdlet 'Close-AzStorageFileHandle' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Close-AzStorageFileHandle', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.CloseAzureStorageFileHandle","Close-AzStorageFileHandle","0","2000","The cmdlet 'Close-AzStorageFileHandle' no longer supports the parameter 'Directory' and no alias was found for the original parameter name.","Add the parameter 'Directory' back to the cmdlet 'Close-AzStorageFileHandle', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.CloseAzureStorageFileHandle","Close-AzStorageFileHandle","0","2000","The cmdlet 'Close-AzStorageFileHandle' no longer supports the parameter 'File' and no alias was found for the original parameter name.","Add the parameter 'File' back to the cmdlet 'Close-AzStorageFileHandle', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.CloseAzureStorageFileHandle","Close-AzStorageFileHandle","0","1050","The parameter set 'ShareCloseAll' for cmdlet 'Close-AzStorageFileHandle' has been removed.","Add parameter set 'ShareCloseAll' back to cmdlet 'Close-AzStorageFileHandle'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.CloseAzureStorageFileHandle","Close-AzStorageFileHandle","0","1050","The parameter set 'ShareCloseSingle' for cmdlet 'Close-AzStorageFileHandle' has been removed.","Add parameter set 'ShareCloseSingle' back to cmdlet 'Close-AzStorageFileHandle'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.CloseAzureStorageFileHandle","Close-AzStorageFileHandle","0","1050","The parameter set 'DirectoryCloseAll' for cmdlet 'Close-AzStorageFileHandle' has been removed.","Add parameter set 'DirectoryCloseAll' back to cmdlet 'Close-AzStorageFileHandle'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.CloseAzureStorageFileHandle","Close-AzStorageFileHandle","0","1050","The parameter set 'FileCloseAll' for cmdlet 'Close-AzStorageFileHandle' has been removed.","Add parameter set 'FileCloseAll' back to cmdlet 'Close-AzStorageFileHandle'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFile","Get-AzStorageFile","0","3010","The property 'CloudFile' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile' has been removed.","Add the property 'CloudFile' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFile","Get-AzStorageFile","0","2000","The cmdlet 'Get-AzStorageFile' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Get-AzStorageFile', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFile","Get-AzStorageFile","0","2000","The cmdlet 'Get-AzStorageFile' no longer supports the parameter 'Directory' and no alias was found for the original parameter name.","Add the parameter 'Directory' back to the cmdlet 'Get-AzStorageFile', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFile","Get-AzStorageFile","0","1050","The parameter set 'Share' for cmdlet 'Get-AzStorageFile' has been removed.","Add parameter set 'Share' back to cmdlet 'Get-AzStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFile","Get-AzStorageFile","0","1050","The parameter set 'Directory' for cmdlet 'Get-AzStorageFile' has been removed.","Add parameter set 'Directory' back to cmdlet 'Get-AzStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileContent","Get-AzStorageFileContent","0","3010","The property 'CloudFile' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile' has been removed.","Add the property 'CloudFile' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileContent","Get-AzStorageFileContent","0","2000","The cmdlet 'Get-AzStorageFileContent' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Get-AzStorageFileContent', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileContent","Get-AzStorageFileContent","0","2000","The cmdlet 'Get-AzStorageFileContent' no longer supports the parameter 'Directory' and no alias was found for the original parameter name.","Add the parameter 'Directory' back to the cmdlet 'Get-AzStorageFileContent', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileContent","Get-AzStorageFileContent","0","2000","The cmdlet 'Get-AzStorageFileContent' no longer supports the parameter 'File' and no alias was found for the original parameter name.","Add the parameter 'File' back to the cmdlet 'Get-AzStorageFileContent', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileContent","Get-AzStorageFileContent","0","1050","The parameter set 'Share' for cmdlet 'Get-AzStorageFileContent' has been removed.","Add parameter set 'Share' back to cmdlet 'Get-AzStorageFileContent'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileContent","Get-AzStorageFileContent","0","1050","The parameter set 'Directory' for cmdlet 'Get-AzStorageFileContent' has been removed.","Add parameter set 'Directory' back to cmdlet 'Get-AzStorageFileContent'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileContent","Get-AzStorageFileContent","0","1050","The parameter set 'File' for cmdlet 'Get-AzStorageFileContent' has been removed.","Add parameter set 'File' back to cmdlet 'Get-AzStorageFileContent'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileCopyStateCommand","Get-AzStorageFileCopyState","0","2000","The cmdlet 'Get-AzStorageFileCopyState' no longer supports the parameter 'File' and no alias was found for the original parameter name.","Add the parameter 'File' back to the cmdlet 'Get-AzStorageFileCopyState', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileCopyStateCommand","Get-AzStorageFileCopyState","0","1050","The parameter set 'File' for cmdlet 'Get-AzStorageFileCopyState' has been removed.","Add parameter set 'File' back to cmdlet 'Get-AzStorageFileCopyState'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle","Get-AzStorageFileHandle","0","2000","The cmdlet 'Get-AzStorageFileHandle' no longer supports the parameter 'File' and no alias was found for the original parameter name.","Add the parameter 'File' back to the cmdlet 'Get-AzStorageFileHandle', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle","Get-AzStorageFileHandle","0","1050","The parameter set 'Share' for cmdlet 'Get-AzStorageFileHandle' has been removed.","Add parameter set 'Share' back to cmdlet 'Get-AzStorageFileHandle'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle","Get-AzStorageFileHandle","0","1050","The parameter set 'Directory' for cmdlet 'Get-AzStorageFileHandle' has been removed.","Add parameter set 'Directory' back to cmdlet 'Get-AzStorageFileHandle'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle","Get-AzStorageFileHandle","0","1050","The parameter set 'File' for cmdlet 'Get-AzStorageFileHandle' has been removed.","Add parameter set 'File' back to cmdlet 'Get-AzStorageFileHandle'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageShare","Get-AzStorageShare","0","3010","The property 'CloudFileShare' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare' has been removed.","Add the property 'CloudFileShare' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageDirectory","New-AzStorageDirectory","0","3010","The property 'CloudFileDirectory' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileDirectory' has been removed.","Add the property 'CloudFileDirectory' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileDirectory'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageDirectory","New-AzStorageDirectory","0","2000","The cmdlet 'New-AzStorageDirectory' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'New-AzStorageDirectory', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageDirectory","New-AzStorageDirectory","0","2000","The cmdlet 'New-AzStorageDirectory' no longer supports the parameter 'Directory' and no alias was found for the original parameter name.","Add the parameter 'Directory' back to the cmdlet 'New-AzStorageDirectory', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageDirectory","New-AzStorageDirectory","0","1050","The parameter set 'Share' for cmdlet 'New-AzStorageDirectory' has been removed.","Add parameter set 'Share' back to cmdlet 'New-AzStorageDirectory'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageDirectory","New-AzStorageDirectory","0","1050","The parameter set 'Directory' for cmdlet 'New-AzStorageDirectory' has been removed.","Add parameter set 'Directory' back to cmdlet 'New-AzStorageDirectory'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageFileSasToken","New-AzStorageFileSASToken","0","2000","The cmdlet 'New-AzStorageFileSASToken' no longer supports the parameter 'File' and no alias was found for the original parameter name.","Add the parameter 'File' back to the cmdlet 'New-AzStorageFileSASToken', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageFileSasToken","New-AzStorageFileSASToken","0","2020","The cmdlet 'New-AzStorageFileSASToken' no longer supports the type 'System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol]' for parameter 'Protocol'.","Change the type for parameter 'Protocol' back to 'System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol]'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageFileSasToken","New-AzStorageFileSASToken","0","2050","A validate set has been added for parameter 'Protocol' for cmdlet 'New-AzStorageFileSASToken'.","Remove the validate set from parameter 'Protocol'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageFileSasToken","New-AzStorageFileSASToken","0","1050","The parameter set 'FileSasPermission' for cmdlet 'New-AzStorageFileSASToken' has been removed.","Add parameter set 'FileSasPermission' back to cmdlet 'New-AzStorageFileSASToken'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageFileSasToken","New-AzStorageFileSASToken","0","1050","The parameter set 'FileSasPolicy' for cmdlet 'New-AzStorageFileSASToken' has been removed.","Add parameter set 'FileSasPolicy' back to cmdlet 'New-AzStorageFileSASToken'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageShare","New-AzStorageShare","0","3010","The property 'CloudFileShare' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare' has been removed.","Add the property 'CloudFileShare' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageShareSasToken","New-AzStorageShareSASToken","0","2020","The cmdlet 'New-AzStorageShareSASToken' no longer supports the type 'System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol]' for parameter 'Protocol'.","Change the type for parameter 'Protocol' back to 'System.Nullable`1[Microsoft.Azure.Storage.SharedAccessProtocol]'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.NewAzureStorageShareSasToken","New-AzStorageShareSASToken","0","2050","A validate set has been added for parameter 'Protocol' for cmdlet 'New-AzStorageShareSASToken'.","Remove the validate set from parameter 'Protocol'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageDirectory","Remove-AzStorageDirectory","0","3010","The property 'CloudFileDirectory' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileDirectory' has been removed.","Add the property 'CloudFileDirectory' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileDirectory'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageDirectory","Remove-AzStorageDirectory","0","2000","The cmdlet 'Remove-AzStorageDirectory' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Remove-AzStorageDirectory', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageDirectory","Remove-AzStorageDirectory","0","2000","The cmdlet 'Remove-AzStorageDirectory' no longer supports the parameter 'Directory' and no alias was found for the original parameter name.","Add the parameter 'Directory' back to the cmdlet 'Remove-AzStorageDirectory', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageDirectory","Remove-AzStorageDirectory","0","1050","The parameter set 'Share' for cmdlet 'Remove-AzStorageDirectory' has been removed.","Add parameter set 'Share' back to cmdlet 'Remove-AzStorageDirectory'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageDirectory","Remove-AzStorageDirectory","0","1050","The parameter set 'Directory' for cmdlet 'Remove-AzStorageDirectory' has been removed.","Add parameter set 'Directory' back to cmdlet 'Remove-AzStorageDirectory'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageFile","Remove-AzStorageFile","0","3010","The property 'CloudFile' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile' has been removed.","Add the property 'CloudFile' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageFile","Remove-AzStorageFile","0","2000","The cmdlet 'Remove-AzStorageFile' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Remove-AzStorageFile', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageFile","Remove-AzStorageFile","0","2000","The cmdlet 'Remove-AzStorageFile' no longer supports the parameter 'Directory' and no alias was found for the original parameter name.","Add the parameter 'Directory' back to the cmdlet 'Remove-AzStorageFile', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageFile","Remove-AzStorageFile","0","2000","The cmdlet 'Remove-AzStorageFile' no longer supports the parameter 'File' and no alias was found for the original parameter name.","Add the parameter 'File' back to the cmdlet 'Remove-AzStorageFile', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageFile","Remove-AzStorageFile","0","1050","The parameter set 'Share' for cmdlet 'Remove-AzStorageFile' has been removed.","Add parameter set 'Share' back to cmdlet 'Remove-AzStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageFile","Remove-AzStorageFile","0","1050","The parameter set 'Directory' for cmdlet 'Remove-AzStorageFile' has been removed.","Add parameter set 'Directory' back to cmdlet 'Remove-AzStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageFile","Remove-AzStorageFile","0","1050","The parameter set 'File' for cmdlet 'Remove-AzStorageFile' has been removed.","Add parameter set 'File' back to cmdlet 'Remove-AzStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageShare","Remove-AzStorageShare","0","3010","The property 'CloudFileShare' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare' has been removed.","Add the property 'CloudFileShare' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageShare","Remove-AzStorageShare","0","2000","The cmdlet 'Remove-AzStorageShare' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Remove-AzStorageShare', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RemoveAzureStorageShare","Remove-AzStorageShare","0","1050","The parameter set 'Share' for cmdlet 'Remove-AzStorageShare' has been removed.","Add parameter set 'Share' back to cmdlet 'Remove-AzStorageShare'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RenameAzureStorageDirectory","Rename-AzStorageDirectory","0","3010","The property 'CloudFileDirectory' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileDirectory' has been removed.","Add the property 'CloudFileDirectory' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileDirectory'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.RenameAzureStorageFile","Rename-AzStorageFile","0","3010","The property 'CloudFile' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile' has been removed.","Add the property 'CloudFile' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageFileContent","Set-AzStorageFileContent","0","3010","The property 'CloudFile' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile' has been removed.","Add the property 'CloudFile' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageFileContent","Set-AzStorageFileContent","0","2000","The cmdlet 'Set-AzStorageFileContent' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Set-AzStorageFileContent', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageFileContent","Set-AzStorageFileContent","0","2000","The cmdlet 'Set-AzStorageFileContent' no longer supports the parameter 'Directory' and no alias was found for the original parameter name.","Add the parameter 'Directory' back to the cmdlet 'Set-AzStorageFileContent', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageFileContent","Set-AzStorageFileContent","0","1050","The parameter set 'Share' for cmdlet 'Set-AzStorageFileContent' has been removed.","Add parameter set 'Share' back to cmdlet 'Set-AzStorageFileContent'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageFileContent","Set-AzStorageFileContent","0","1050","The parameter set 'Directory' for cmdlet 'Set-AzStorageFileContent' has been removed.","Add parameter set 'Directory' back to cmdlet 'Set-AzStorageFileContent'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageShareQuota","Set-AzStorageShareQuota","0","3010","The property 'CloudFileShare' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare' has been removed.","Add the property 'CloudFileShare' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFileShare'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageShareQuota","Set-AzStorageShareQuota","0","2000","The cmdlet 'Set-AzStorageShareQuota' no longer supports the parameter 'Share' and no alias was found for the original parameter name.","Add the parameter 'Share' back to the cmdlet 'Set-AzStorageShareQuota', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.SetAzureStorageShareQuota","Set-AzStorageShareQuota","0","1050","The parameter set 'Share' for cmdlet 'Set-AzStorageShareQuota' has been removed.","Add parameter set 'Share' back to cmdlet 'Set-AzStorageShareQuota'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","3010","The property 'CloudFile' of type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile' has been removed.","Add the property 'CloudFile' back to type 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2020","The cmdlet 'Start-AzStorageFileCopy' no longer supports the type 'Microsoft.Azure.Storage.Blob.CloudBlobContainer' for parameter 'SrcContainer'.","Change the type for parameter 'SrcContainer' back to 'Microsoft.Azure.Storage.Blob.CloudBlobContainer'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2020","The cmdlet 'Start-AzStorageFileCopy' no longer supports the type 'Microsoft.Azure.Storage.Blob.CloudBlob' for parameter 'SrcBlob'.","Change the type for parameter 'SrcBlob' back to 'Microsoft.Azure.Storage.Blob.CloudBlob'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2010","The cmdlet 'Start-AzStorageFileCopy' no longer supports the alias 'ICloudBlob' for parameter 'SrcBlob'.","Add the alias 'ICloudBlob' back to parameter 'SrcBlob'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2020","The cmdlet 'Start-AzStorageFileCopy' no longer supports the type 'Microsoft.Azure.Storage.File.CloudFileShare' for parameter 'SrcShare'.","Change the type for parameter 'SrcShare' back to 'Microsoft.Azure.Storage.File.CloudFileShare'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2010","The cmdlet 'Start-AzStorageFileCopy' no longer supports the alias 'CloudFileShare' for parameter 'SrcShare'.","Add the alias 'CloudFileShare' back to parameter 'SrcShare'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2020","The cmdlet 'Start-AzStorageFileCopy' no longer supports the type 'Microsoft.Azure.Storage.File.CloudFile' for parameter 'SrcFile'.","Change the type for parameter 'SrcFile' back to 'Microsoft.Azure.Storage.File.CloudFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2010","The cmdlet 'Start-AzStorageFileCopy' no longer supports the alias 'CloudFile' for parameter 'SrcFile'.","Add the alias 'CloudFile' back to parameter 'SrcFile'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","2000","The cmdlet 'Start-AzStorageFileCopy' no longer supports the parameter 'DestFile' and no alias was found for the original parameter name.","Add the parameter 'DestFile' back to the cmdlet 'Start-AzStorageFileCopy', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","1050","The parameter set 'BlobInstanceFileInstance' for cmdlet 'Start-AzStorageFileCopy' has been removed.","Add parameter set 'BlobInstanceFileInstance' back to cmdlet 'Start-AzStorageFileCopy'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","1050","The parameter set 'FileInstanceToFileInstance' for cmdlet 'Start-AzStorageFileCopy' has been removed.","Add parameter set 'FileInstanceToFileInstance' back to cmdlet 'Start-AzStorageFileCopy'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StartAzureStorageFileCopyCommand","Start-AzStorageFileCopy","0","1050","The parameter set 'UriToFileInstance' for cmdlet 'Start-AzStorageFileCopy' has been removed.","Add parameter set 'UriToFileInstance' back to cmdlet 'Start-AzStorageFileCopy'." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StopAzureStorageFileCopyCommand","Stop-AzStorageFileCopy","0","2000","The cmdlet 'Stop-AzStorageFileCopy' no longer supports the parameter 'File' and no alias was found for the original parameter name.","Add the parameter 'File' back to the cmdlet 'Stop-AzStorageFileCopy', or add an alias to the original parameter name." +"Az.Storage","Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.StopAzureStorageFileCopyCommand","Stop-AzStorageFileCopy","0","1050","The parameter set 'File' for cmdlet 'Stop-AzStorageFileCopy' has been removed.","Add parameter set 'File' back to cmdlet 'Stop-AzStorageFileCopy'."