From 9ada66c3e6d790674b2774663582bea3daa76bf6 Mon Sep 17 00:00:00 2001 From: microzchang <110015819+microzchang@users.noreply.github.com> Date: Mon, 8 May 2023 13:11:05 +0800 Subject: [PATCH] fix ListFileHandles return empty list. (#4617) --- .../src/rest_client.cpp | 48 +++++++++---------- .../swagger/README.md | 2 + 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp index 397d88fb6..dc1b8c0f1 100644 --- a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp @@ -2433,7 +2433,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { kUnknown, kEnumerationResults, - kHandleList, + kEntries, kHandle, kHandleId, kPath, @@ -2447,7 +2447,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { }; const std::unordered_map XmlTagEnumMap{ {"EnumerationResults", XmlTagEnum::kEnumerationResults}, - {"HandleList", XmlTagEnum::kHandleList}, + {"Entries", XmlTagEnum::kEntries}, {"Handle", XmlTagEnum::kHandle}, {"HandleId", XmlTagEnum::kHandleId}, {"Path", XmlTagEnum::kPath}, @@ -2476,49 +2476,49 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { else if (node.Type == _internal::XmlNodeType::Text) { if (xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kHandleId) { vectorElement1.HandleId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kPath) { vectorElement1.Path.Content = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kFileId) { vectorElement1.FileId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kParentId) { vectorElement1.ParentId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kSessionId) { vectorElement1.SessionId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kClientIp) { vectorElement1.ClientIp = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kOpenTime) { vectorElement1.OpenedOn @@ -2526,7 +2526,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kLastReconnectTime) { vectorElement1.LastReconnectedOn @@ -2542,7 +2542,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { else if (node.Type == _internal::XmlNodeType::Attribute) { if (xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kPath && node.Name == "Encoded") { vectorElement1.Path.Encoded = node.Value == std::string("true"); @@ -2551,7 +2551,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { else if (node.Type == _internal::XmlNodeType::EndTag) { if (xmlPath.size() == 3 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle) + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle) { response.HandleList.push_back(std::move(vectorElement1)); vectorElement1 = Models::_detail::HandleItem(); @@ -3990,7 +3990,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { kUnknown, kEnumerationResults, - kHandleList, + kEntries, kHandle, kHandleId, kPath, @@ -4004,7 +4004,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { }; const std::unordered_map XmlTagEnumMap{ {"EnumerationResults", XmlTagEnum::kEnumerationResults}, - {"HandleList", XmlTagEnum::kHandleList}, + {"Entries", XmlTagEnum::kEntries}, {"Handle", XmlTagEnum::kHandle}, {"HandleId", XmlTagEnum::kHandleId}, {"Path", XmlTagEnum::kPath}, @@ -4033,49 +4033,49 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { else if (node.Type == _internal::XmlNodeType::Text) { if (xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kHandleId) { vectorElement1.HandleId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kPath) { vectorElement1.Path.Content = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kFileId) { vectorElement1.FileId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kParentId) { vectorElement1.ParentId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kSessionId) { vectorElement1.SessionId = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kClientIp) { vectorElement1.ClientIp = node.Value; } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kOpenTime) { vectorElement1.OpenedOn @@ -4083,7 +4083,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { } else if ( xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kLastReconnectTime) { vectorElement1.LastReconnectedOn @@ -4099,7 +4099,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { else if (node.Type == _internal::XmlNodeType::Attribute) { if (xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle && xmlPath[3] == XmlTagEnum::kPath && node.Name == "Encoded") { vectorElement1.Path.Encoded = node.Value == std::string("true"); @@ -4108,7 +4108,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { else if (node.Type == _internal::XmlNodeType::EndTag) { if (xmlPath.size() == 3 && xmlPath[0] == XmlTagEnum::kEnumerationResults - && xmlPath[1] == XmlTagEnum::kHandleList && xmlPath[2] == XmlTagEnum::kHandle) + && xmlPath[1] == XmlTagEnum::kEntries && xmlPath[2] == XmlTagEnum::kHandle) { response.HandleList.push_back(std::move(vectorElement1)); vectorElement1 = Models::_detail::HandleItem(); diff --git a/sdk/storage/azure-storage-files-shares/swagger/README.md b/sdk/storage/azure-storage-files-shares/swagger/README.md index 8e11b6ee7..533bf749d 100644 --- a/sdk/storage/azure-storage-files-shares/swagger/README.md +++ b/sdk/storage/azure-storage-files-shares/swagger/README.md @@ -590,6 +590,8 @@ directive: $.HandleItem.properties["LastReconnectTime"]["x-ms-client-name"] = "LastReconnectedOn"; $.HandleItem.properties["Path"]["description"] = "File or directory name including full path starting from share root."; $.HandleItem["x-namespace"] = "_detail"; + delete $.ListHandlesResponse.properties.HandleList["xml"]; + $.ListHandlesResponse.properties.HandleList["x-ms-xml"] = {"name": "Entries", "wrapped": true}; ``` ### ForceCloseFileHandles