diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index 8dc0c8a85..8bd090a3b 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/storage", - "Tag": "cpp/storage_ee4c1bee4d" + "Tag": "cpp/storage_74987cb191" } diff --git a/sdk/storage/azure-storage-files-shares/CHANGELOG.md b/sdk/storage/azure-storage-files-shares/CHANGELOG.md index c01d32b85..cfad36bc3 100644 --- a/sdk/storage/azure-storage-files-shares/CHANGELOG.md +++ b/sdk/storage/azure-storage-files-shares/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- Fixed a bug where `ShareServiceClient::SetProperties` and `ShareServiceClient::GetProperties` threw exception if property `Protocol` is not null. + ### Other Changes ## 12.7.0-beta.1 (2023-08-12) 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 865cb0eb6..e61fd580b 100644 --- a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp @@ -293,8 +293,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { writer.Write(_internal::XmlNode{_internal::XmlNodeType::EndTag}); if (options.ShareServiceProperties.Protocol.HasValue()) { - writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Protocol"}); - writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Settings"}); + writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "ProtocolSettings"}); + writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "SMB"}); writer.Write(_internal::XmlNode{_internal::XmlNodeType::StartTag, "Multichannel"}); writer.Write(_internal::XmlNode{ _internal::XmlNodeType::StartTag, @@ -368,8 +368,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { kAllowedHeaders, kExposedHeaders, kMaxAgeInSeconds, - kProtocol, - kSettings, + kProtocolSettings, + kSMB, kMultichannel, }; const std::unordered_map XmlTagEnumMap{ @@ -388,8 +388,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { {"AllowedHeaders", XmlTagEnum::kAllowedHeaders}, {"ExposedHeaders", XmlTagEnum::kExposedHeaders}, {"MaxAgeInSeconds", XmlTagEnum::kMaxAgeInSeconds}, - {"Protocol", XmlTagEnum::kProtocol}, - {"Settings", XmlTagEnum::kSettings}, + {"ProtocolSettings", XmlTagEnum::kProtocolSettings}, + {"SMB", XmlTagEnum::kSMB}, {"Multichannel", XmlTagEnum::kMultichannel}, }; std::vector xmlPath; @@ -406,7 +406,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { auto ite = XmlTagEnumMap.find(node.Name); xmlPath.push_back(ite == XmlTagEnumMap.end() ? XmlTagEnum::kUnknown : ite->second); if (xmlPath.size() == 2 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties - && xmlPath[1] == XmlTagEnum::kProtocol) + && xmlPath[1] == XmlTagEnum::kProtocolSettings) { response.Protocol = Models::ProtocolSettings(); } @@ -514,7 +514,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { } else if ( xmlPath.size() == 5 && xmlPath[0] == XmlTagEnum::kStorageServiceProperties - && xmlPath[1] == XmlTagEnum::kProtocol && xmlPath[2] == XmlTagEnum::kSettings + && xmlPath[1] == XmlTagEnum::kProtocolSettings && xmlPath[2] == XmlTagEnum::kSMB && xmlPath[3] == XmlTagEnum::kMultichannel && xmlPath[4] == XmlTagEnum::kEnabled) { response.Protocol.Value().Settings.Multichannel.Enabled diff --git a/sdk/storage/azure-storage-files-shares/swagger/README.md b/sdk/storage/azure-storage-files-shares/swagger/README.md index f0c306e88..b50b220f3 100644 --- a/sdk/storage/azure-storage-files-shares/swagger/README.md +++ b/sdk/storage/azure-storage-files-shares/swagger/README.md @@ -347,10 +347,12 @@ directive: delete $.ShareSmbSettings; $.ShareProtocolSettings.properties["Smb"]["$ref"] = "#/definitions/SmbSettings"; $.ShareProtocolSettings.properties["Settings"] = $.ShareProtocolSettings.properties["Smb"]; + $.ShareProtocolSettings.properties["Settings"]["x-ms-xml"] = { "name": "SMB" }; delete $.ShareProtocolSettings.properties["Smb"]; $.ProtocolSettings = $.ShareProtocolSettings; delete $.ShareProtocolSettings; $.StorageServiceProperties.properties["Protocol"]["$ref"] = "#/definitions/ProtocolSettings"; + $.StorageServiceProperties.properties["Protocol"]["x-ms-xml"] = { "name": "ProtocolSettings" }; $.ShareServiceProperties = $.StorageServiceProperties; delete $.StorageServiceProperties; $.ShareServiceProperties.xml = { "name": "StorageServiceProperties" }; diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp index 32627bbee..8def59819 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_service_client_test.cpp @@ -126,6 +126,7 @@ namespace Azure { namespace Storage { namespace Test { TEST_F(FileShareServiceClientTest, SetProperties) { auto properties = m_shareServiceClient->GetProperties().Value; + properties.Protocol.Reset(); auto originalProperties = properties; properties.HourMetrics.Enabled = true; @@ -212,11 +213,12 @@ namespace Azure { namespace Storage { namespace Test { m_shareServiceClient->SetProperties(originalProperties); } - TEST_F(FileShareServiceClientTest, DISABLED_SetPremiumFileProperties) + TEST_F(FileShareServiceClientTest, SetPremiumFileProperties) { auto premiumFileShareServiceClient = std::make_shared( Files::Shares::ShareServiceClient::CreateFromConnectionString( - PremiumFileConnectionString())); + PremiumFileConnectionString(), + InitStorageClientOptions())); auto properties = premiumFileShareServiceClient->GetProperties().Value; auto originalProperties = properties;