-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AppConfiguration] Fix: GetConfigurationSettings does not set the Con…
…tentType property (#38917)
- Loading branch information
Showing
8 changed files
with
169 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SettingFieldsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Azure.Data.AppConfiguration | ||
{ | ||
internal static class SettingFieldsExtensions | ||
{ | ||
/// <summary> | ||
/// Maps a SettingFields member to its corresponding service name in accordance with the REST API specification. | ||
/// </summary> | ||
private static readonly IReadOnlyDictionary<SettingFields, string> s_serviceNameMap = new Dictionary<SettingFields, string>() | ||
{ | ||
{ SettingFields.Key , "key" }, | ||
{ SettingFields.Label , "label" }, | ||
{ SettingFields.Value , "value" }, | ||
{ SettingFields.ContentType , "content_type" }, | ||
{ SettingFields.ETag , "etag" }, | ||
{ SettingFields.LastModified, "last_modified" }, | ||
{ SettingFields.IsReadOnly , "locked" }, | ||
{ SettingFields.Tags , "tags" } | ||
}; | ||
|
||
/// <summary> | ||
/// Splits <see cref="SettingFields"/> flags into their corresponding service names. | ||
/// </summary> | ||
/// <param name="fields">The flags to split.</param> | ||
/// <returns>An enumerable containing the names of the flags. The method returns <c>null</c> for <see cref="SettingFields.All"/>.</returns> | ||
public static IEnumerable<string> Split(this SettingFields fields) | ||
{ | ||
if (fields == SettingFields.All) | ||
{ | ||
return null; | ||
} | ||
|
||
var splitFields = new List<string>(); | ||
|
||
foreach (SettingFields currentField in s_serviceNameMap.Keys) | ||
{ | ||
if ((fields & currentField) == currentField) | ||
{ | ||
splitFields.Add(s_serviceNameMap[currentField]); | ||
} | ||
} | ||
|
||
return splitFields; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.