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

[App Config] Update snapshot API and changelog for "1.3.0-beta.3" release #39116

Merged
merged 5 commits into from
Oct 5, 2023
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
11 changes: 2 additions & 9 deletions sdk/appconfiguration/Azure.Data.AppConfiguration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
# Release History

## 1.3.0-beta.3 (Unreleased)
## 1.3.0-beta.3 (2023-10-09)

### Features Added

### Breaking Changes
- Added a new type, `SnapshotSelector`, to encapsulate parameters like `name`, `fields`, and `status` within the `GetSnapshots` method.

### Bugs Fixed

- Fixed `GetConfigurationSettings(SettingSelector)` not setting `ContentType` and `LastModified` properties [(#38524)](https://github.com/Azure/azure-sdk-for-net/issues/38524).

- `FeatureFlagConfigurationSetting` will now allow custom attributes under the `conditions` element in the setting value. Previously, only `client_filters` was recognized and other data would be discarded.

### Other Changes

## 1.2.1 (2023-09-13)

### Bugs Fixed

- `FeatureFlagConfigurationSetting` and `SecretReferenceConfigurationSetting` will now retain custom attributes in the setting value. Previously, only attributes that were defined in the associated JSON schema were allowed and unknown attributes were discarded.

- Added the ability to create `FeatureFlagConfigurationSetting` and `SecretReferenceConfigurationSetting` instances with an ETag, matching `ConfigurationSetting`. This allows all setting types to use the [GetConfigurationSettingAsync](https://learn.microsoft.com/dotnet/api/azure.data.appconfiguration.configurationclient.getconfigurationsettingasync?view=azure-dotnet#azure-data-appconfiguration-configurationclient-getconfigurationsettingasync(azure-data-appconfiguration-configurationsetting-system-boolean-system-threading-cancellationtoken)) overload that accepts `onlyIfUnchanged.` Previously, this was not possible for specialized settings types.

- Added the ability to create `FeatureFlagConfigurationSetting` and `SecretReferenceConfigurationSetting` instances for testing purposes using the `ConfigurationModelFactory`. It was previously not possible to populate service-owned fields when testing.

- Marked a constructor overload of `ConfigurationSetting` that was intended for testing purposes as non-visible, as the `ConfigurationModelFactory` should instead be used.

- Fixed a bug where a disposed content stream was used to attempt deserialization in some scenarios, such as using a custom `HttpMessageHandler` that returns `StringContent`.

## 1.3.0-beta.2 (2023-07-11)
Expand Down
4 changes: 2 additions & 2 deletions sdk/appconfiguration/Azure.Data.AppConfiguration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ client.DeleteConfigurationSetting("some_key");
To create a snapshot, you need to instantiate the `ConfigurationSnapshot` class and specify filters to determine which configuration settings should be included. The creation process is a Long-Running Operation (LRO) and can be achieved by calling the `CreateSnapshot` method.

```C# Snippet:AzConfigSample11_CreateSnapshot_AutomaticPolling
var snapshotFilter = new List<SnapshotSettingFilter> { new SnapshotSettingFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter);
var settingsFilter = new List<ConfigurationSettingsFilter> { new ConfigurationSettingsFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(settingsFilter);

var snapshotName = "some_snapshot";
var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,19 @@ public ConfigurationSetting(string key, string value, string label, Azure.ETag e
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override string ToString() { throw null; }
}
public partial class ConfigurationSettingsFilter
{
public ConfigurationSettingsFilter(string key) { }
public string Key { get { throw null; } set { } }
public string Label { get { throw null; } set { } }
}
public partial class ConfigurationSnapshot
{
public ConfigurationSnapshot(System.Collections.Generic.IEnumerable<Azure.Data.AppConfiguration.SnapshotSettingFilter> filters) { }
public ConfigurationSnapshot(System.Collections.Generic.IEnumerable<Azure.Data.AppConfiguration.ConfigurationSettingsFilter> filters) { }
public System.DateTimeOffset? CreatedOn { get { throw null; } }
public Azure.ETag ETag { get { throw null; } }
public System.DateTimeOffset? ExpiresOn { get { throw null; } }
public System.Collections.Generic.IList<Azure.Data.AppConfiguration.SnapshotSettingFilter> Filters { get { throw null; } }
public System.Collections.Generic.IList<Azure.Data.AppConfiguration.ConfigurationSettingsFilter> Filters { get { throw null; } }
public long? ItemCount { get { throw null; } }
public string Name { get { throw null; } }
public System.TimeSpan? RetentionPeriod { get { throw null; } set { } }
Expand Down Expand Up @@ -250,12 +256,6 @@ public SnapshotSelector() { }
public string NameFilter { get { throw null; } set { } }
public System.Collections.Generic.IList<Azure.Data.AppConfiguration.ConfigurationSnapshotStatus> Status { get { throw null; } }
}
public partial class SnapshotSettingFilter
{
public SnapshotSettingFilter(string key) { }
public string Key { get { throw null; } set { } }
public string Label { get { throw null; } set { } }
}
}
namespace Microsoft.Extensions.Azure
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/appconfiguration/Azure.Data.AppConfiguration",
"Tag": "net/appconfiguration/Azure.Data.AppConfiguration_bebb69bca2"
"Tag": "net/appconfiguration/Azure.Data.AppConfiguration_48bd1bc562"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ To create a snapshot, you need to create an instance of `ConfigurationSnapshot`
### Automatic Polling

```C# Snippet:AzConfigSample11_CreateSnapshot_AutomaticPolling
var snapshotFilter = new List<SnapshotSettingFilter> { new SnapshotSettingFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter);
var settingsFilter = new List<ConfigurationSettingsFilter> { new ConfigurationSettingsFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(settingsFilter);

var snapshotName = "some_snapshot";
var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot);
Expand All @@ -25,8 +25,8 @@ Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, Stat
### Automatic Polling with `WaitForCompletion`

```C# Snippet:AzConfigSample11_CreateSnapshot_AutomaticPollingLater
var snapshotFilter = new List<SnapshotSettingFilter> { new SnapshotSettingFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter);
var settingsFilter = new List<ConfigurationSettingsFilter> { new ConfigurationSettingsFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(settingsFilter);

var snapshotName = "some_snapshot";
var operation = client.CreateSnapshot(WaitUntil.Started, snapshotName, settingsSnapshot);
Expand All @@ -39,8 +39,8 @@ Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, stat
### Manual Polling

```C# Snippet:AzConfigSample11_CreateSnapshot_ManualPolling
var snapshotFilter = new List<SnapshotSettingFilter> { new SnapshotSettingFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter);
var settingsFilter = new List<ConfigurationSettingsFilter> { new ConfigurationSettingsFilter("some_key") };
var settingsSnapshot = new ConfigurationSnapshot(settingsFilter);

var snapshotName = "some_snapshot";
var operation = client.CreateSnapshot(WaitUntil.Started, snapshotName, settingsSnapshot);
Expand Down Expand Up @@ -111,8 +111,8 @@ client.AddConfigurationSetting(firstSetting);
var secondSetting = new ConfigurationSetting("second_key", "second_value");
client.AddConfigurationSetting(secondSetting);

var snapshotFilter = new List<SnapshotSettingFilter> { new SnapshotSettingFilter(firstSetting.Key), new SnapshotSettingFilter(secondSetting.Key) };
var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter);
var settingsFilter = new List<ConfigurationSettingsFilter> { new ConfigurationSettingsFilter(firstSetting.Key), new ConfigurationSettingsFilter(secondSetting.Key) };
var settingsSnapshot = new ConfigurationSnapshot(settingsFilter);

var snapshotName = "some_snapshot";
var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Azure.Data.AppConfiguration
{
public partial class SnapshotSettingFilter : IUtf8JsonSerializable
public partial class ConfigurationSettingsFilter : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
{
Expand All @@ -21,7 +21,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
writer.WriteEndObject();
}

internal static SnapshotSettingFilter DeserializeKeyValueFilter(JsonElement element)
internal static ConfigurationSettingsFilter DeserializeKeyValueFilter(JsonElement element)
{
string key = default;
Optional<string> label = default;
Expand All @@ -38,7 +38,7 @@ internal static SnapshotSettingFilter DeserializeKeyValueFilter(JsonElement elem
continue;
}
}
return new SnapshotSettingFilter(key, label.Value);
return new ConfigurationSettingsFilter(key, label.Value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
namespace Azure.Data.AppConfiguration
{
/// <summary> Enables filtering of key-values. </summary>
public partial class SnapshotSettingFilter
public partial class ConfigurationSettingsFilter
{
/// <summary> Initializes a new instance of KeyValueFilter. </summary>
/// <param name="key"> Filters key-values by their key field. </param>
/// <exception cref="ArgumentNullException"> <paramref name="key"/> is null. </exception>
public SnapshotSettingFilter(string key)
public ConfigurationSettingsFilter(string key)
{
Argument.AssertNotNull(key, nameof(key));

Expand All @@ -22,7 +22,7 @@ public SnapshotSettingFilter(string key)
/// <summary> Initializes a new instance of KeyValueFilter. </summary>
/// <param name="key"> Filters key-values by their key field. </param>
/// <param name="label"> Filters key-values by their label field. </param>
internal SnapshotSettingFilter(string key, string label)
internal ConfigurationSettingsFilter(string key, string label)
{
Key = key;
Label = label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal static ConfigurationSnapshot DeserializeSnapshot(JsonElement element)
{
Optional<string> name = default;
Optional<ConfigurationSnapshotStatus> status = default;
IList<SnapshotSettingFilter> filters = default;
IList<ConfigurationSettingsFilter> filters = default;
Optional<SnapshotComposition> snapshotComposition = default;
Optional<DateTimeOffset> created = default;
Optional<DateTimeOffset?> expires = default;
Expand Down Expand Up @@ -76,10 +76,10 @@ internal static ConfigurationSnapshot DeserializeSnapshot(JsonElement element)
}
if (property.NameEquals("filters"))
{
List<SnapshotSettingFilter> array = new List<SnapshotSettingFilter>();
List<ConfigurationSettingsFilter> array = new List<ConfigurationSettingsFilter>();
foreach (var item in property.Value.EnumerateArray())
{
array.Add(SnapshotSettingFilter.DeserializeKeyValueFilter(item));
array.Add(ConfigurationSettingsFilter.DeserializeKeyValueFilter(item));
}
filters = array;
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class ConfigurationSnapshot
/// <summary> Initializes a new instance of Snapshot. </summary>
/// <param name="filters"> A list of filters used to filter the key-values included in the snapshot. </param>
/// <exception cref="ArgumentNullException"> <paramref name="filters"/> is null. </exception>
public ConfigurationSnapshot(IEnumerable<SnapshotSettingFilter> filters)
public ConfigurationSnapshot(IEnumerable<ConfigurationSettingsFilter> filters)
{
Argument.AssertNotNull(filters, nameof(filters));

Expand All @@ -34,7 +34,7 @@ public ConfigurationSnapshot(IEnumerable<SnapshotSettingFilter> filters)
/// <param name="itemCount"> The amount of key-values in the snapshot. </param>
/// <param name="tags"> The tags of the snapshot. </param>
/// <param name="eTag"> A value representing the current state of the snapshot. </param>
internal ConfigurationSnapshot(string name, ConfigurationSnapshotStatus? status, IList<SnapshotSettingFilter> filters, SnapshotComposition? snapshotComposition, DateTimeOffset? createdOn, DateTimeOffset? expiresOn, long? retentionPeriod, long? sizeInBytes, long? itemCount, IDictionary<string, string> tags, ETag eTag)
internal ConfigurationSnapshot(string name, ConfigurationSnapshotStatus? status, IList<ConfigurationSettingsFilter> filters, SnapshotComposition? snapshotComposition, DateTimeOffset? createdOn, DateTimeOffset? expiresOn, long? retentionPeriod, long? sizeInBytes, long? itemCount, IDictionary<string, string> tags, ETag eTag)
{
Name = name;
Status = status;
Expand All @@ -54,7 +54,7 @@ internal ConfigurationSnapshot(string name, ConfigurationSnapshotStatus? status,
/// <summary> The current status of the snapshot. </summary>
public ConfigurationSnapshotStatus? Status { get; }
/// <summary> A list of filters used to filter the key-values included in the snapshot. </summary>
public IList<SnapshotSettingFilter> Filters { get; }
public IList<ConfigurationSettingsFilter> Filters { get; }
/// <summary> The composition type describes how the key-values within the snapshot are composed. The 'key' composition type ensures there are no two key-values containing the same key. The 'key_label' composition type ensures there are no two key-values containing the same key and label. </summary>
public SnapshotComposition? SnapshotComposition { get; set; }
/// <summary> The time that the snapshot was created. </summary>
Expand Down
Loading