Storage/Fix Files Shares ShareServiceClient::SetProperties 400 Error (#4887)
* fix bug * update record * udpate record * test * update test record
This commit is contained in:
parent
7c10104461
commit
0a4d7009f4
@ -2,5 +2,5 @@
|
||||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "cpp",
|
||||
"TagPrefix": "cpp/storage",
|
||||
"Tag": "cpp/storage_ee4c1bee4d"
|
||||
"Tag": "cpp/storage_74987cb191"
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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<std::string, XmlTagEnum> 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<XmlTagEnum> 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
|
||||
|
||||
@ -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" };
|
||||
|
||||
@ -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>(
|
||||
Files::Shares::ShareServiceClient::CreateFromConnectionString(
|
||||
PremiumFileConnectionString()));
|
||||
PremiumFileConnectionString(),
|
||||
InitStorageClientOptions<Files::Shares::ShareClientOptions>()));
|
||||
auto properties = premiumFileShareServiceClient->GetProperties().Value;
|
||||
auto originalProperties = properties;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user