Skip to content

Commit

Permalink
[Storage] Mirgate Storage file cmdlets to Track2 SDK (#26575) (#26594)
Browse files Browse the repository at this point in the history
* [Storage] Mirgate Storage file cmdlets to Track2 SDK  (#26575)

* REsolve merge conflicts

* Resolve merge conflicts

* remove breaking change warnings

* Update changelog

* Add breaking change exception

* Remove unused file InvalidCLoudFileShare.cs

* Update RemoveFilePathTrailingDot helper function per comments

---------

Co-authored-by: yifanz7 <[email protected]>
Co-authored-by: Yifan Zhang <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent 8dce41c commit 27ab661
Show file tree
Hide file tree
Showing 78 changed files with 547 additions and 4,431 deletions.
24 changes: 24 additions & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@
## Upcoming Release
* When download blob with parameter AbsoluteUri (alias Uri, BlobUri), not allow input parameter Context together.
- `Get-AzStorageBlobContent`
* Migrated following Azure Storage File dataplane cmdlets from 'Microsoft.Azure.Storage.File' to 'Azure.Storage.Files.Shares'
- `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`

## Version 7.5.0
* Added a warning for an upcoming breaking change for download blob will block input parameter -AbsoluteUri and -Context together.
Expand Down
8 changes: 1 addition & 7 deletions src/Storage/Storage.Management/Models/PSShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
107 changes: 33 additions & 74 deletions src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,49 @@ Closes file handles of a file share, a file directory or a file.
### ShareNameCloseAll (Default)
```
Close-AzStorageFileHandle [-ShareName] <String> [[-Path] <String>] [-Recursive] [-CloseAll]
[-Context <IStorageContext>] [-DisAllowTrailingDot] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>]
[-DisAllowTrailingDot] [-PassThru] [-AsJob] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### ShareNameCloseSingle
```
Close-AzStorageFileHandle [-ShareName] <String> -FileHandle <PSFileHandle> [-Context <IStorageContext>]
[-DisAllowTrailingDot] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Close-AzStorageFileHandle [-ShareName] <String> -FileHandle <PSFileHandle> [-DisAllowTrailingDot] [-PassThru]
[-AsJob] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### ShareCloseAll
```
Close-AzStorageFileHandle [-Share] <CloudFileShare> [-ShareClient <ShareClient>] [[-Path] <String>]
[-Recursive] [-CloseAll] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Close-AzStorageFileHandle [-ShareClient] <ShareClient> [[-Path] <String>] [-Recursive] [-CloseAll] [-PassThru]
[-AsJob] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### ShareCloseSingle
```
Close-AzStorageFileHandle [-Share] <CloudFileShare> [-ShareClient <ShareClient>] -FileHandle <PSFileHandle>
[-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Close-AzStorageFileHandle [-ShareClient] <ShareClient> -FileHandle <PSFileHandle> [-PassThru] [-AsJob]
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### DirectoryCloseAll
```
Close-AzStorageFileHandle [-Directory] <CloudFileDirectory> [-ShareDirectoryClient <ShareDirectoryClient>]
[[-Path] <String>] [-Recursive] [-CloseAll] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>]
Close-AzStorageFileHandle [-ShareDirectoryClient] <ShareDirectoryClient> [[-Path] <String>] [-Recursive]
[-CloseAll] [-PassThru] [-AsJob] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### FileCloseAll
```
Close-AzStorageFileHandle [-File] <CloudFile> [-ShareFileClient <ShareFileClient>] [-CloseAll] [-PassThru]
[-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Close-AzStorageFileHandle [-ShareFileClient] <ShareFileClient> [-CloseAll] [-PassThru] [-AsJob]
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -311,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.
Expand All @@ -334,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
Expand All @@ -349,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
Expand All @@ -364,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
Expand Down Expand Up @@ -422,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
Expand Down
66 changes: 13 additions & 53 deletions src/Storage/Storage.Management/help/Get-AzStorageFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,21 @@ Lists directories and files for a path.
```
Get-AzStorageFile [-ShareName] <String> [[-Path] <String>] [-ExcludeExtendedInfo] [-DisAllowTrailingDot]
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[<CommonParameters>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>]
```

### Share
```
Get-AzStorageFile [-Share] <CloudFileShare> [-ShareClient <ShareClient>] [[-Path] <String>]
[-ExcludeExtendedInfo] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[<CommonParameters>]
Get-AzStorageFile [-ShareClient] <ShareClient> [[-Path] <String>] [-ExcludeExtendedInfo]
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>]
```

### Directory
```
Get-AzStorageFile [-Directory] <CloudFileDirectory> [-ShareDirectoryClient <ShareDirectoryClient>]
[[-Path] <String>] [-ExcludeExtendedInfo] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
[<CommonParameters>]
Get-AzStorageFile [-ShareDirectoryClient] <ShareDirectoryClient> [[-Path] <String>] [-ExcludeExtendedInfo]
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -211,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.
Expand All @@ -238,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
Expand All @@ -253,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
Expand All @@ -281,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
Expand Down
Loading

0 comments on commit 27ab661

Please sign in to comment.