Skip to content

Commit

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

* update

* add breaking change exceptions

* update breaking change exceptions

* update changelog

* update help files

* update example

* update upload file exception when context is missing

* force to input -Context for Track2 object inputs

* remove context check from close/get file handle cmdlets
  • Loading branch information
yifanz7 authored Sep 9, 2024
1 parent 61b57bf commit 6a72411
Show file tree
Hide file tree
Showing 77 changed files with 1,127 additions and 4,780 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 @@ -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
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
126 changes: 35 additions & 91 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>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

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

### FileCloseAll
```
Close-AzStorageFileHandle [-File] <CloudFile> [-ShareFileClient <ShareFileClient>] [-CloseAll] [-PassThru]
[-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-ProgressAction <ActionPreference>]
[-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 @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 6a72411

Please sign in to comment.