diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/README.md b/sdk/appconfiguration/Azure.Data.AppConfiguration/README.md index 0ee8894920d8..c1438e5fc87e 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/README.md +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/README.md @@ -160,26 +160,26 @@ client.DeleteConfigurationSetting("some_key"); ### Create a Snapshot -To create a snapshot, you need to instantiate the `ConfigurationSettingsSnapshot` 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. +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(new SnapshotSettingFilter[] { new SnapshotSettingFilter("some_key") }); -var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); +var snapshotFilter = new List { new SnapshotSettingFilter("some_key") }; +var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot); var createdSnapshot = operation.Value; -Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); +Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); ``` ### Retrieve a Snapshot -Once a configuration setting snapshot is created, you can retrieve it using the `GetSnapshot` method. +Once a configuration snapshot is created, you can retrieve it using the `GetSnapshot` method. ```C# Snippet:AzConfigSample11_GetSnapshot var snapshotName = "some_snapshot"; -ConfigurationSettingsSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); -Console.WriteLine($"Retrieved configuration setting snapshot: {retrievedSnapshot.Name}, status: {retrievedSnapshot.Status}"); +ConfigurationSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); +Console.WriteLine($"Retrieved configuration snapshot: {retrievedSnapshot.Name}, status: {retrievedSnapshot.Status}"); ``` ### Archive a Snapshot @@ -188,8 +188,8 @@ To archive a snapshot, you can utilize the `ArchiveSnapshot` method. This operat ```C# Snippet:AzConfigSample11_ArchiveSnapshot var snapshotName = "some_snapshot"; -ConfigurationSettingsSnapshot archivedSnapshot = client.ArchiveSnapshot(snapshotName); -Console.WriteLine($"Archived configuration setting snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); +ConfigurationSnapshot archivedSnapshot = client.ArchiveSnapshot(snapshotName); +Console.WriteLine($"Archived configuration snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); ``` ### Recover a snapshot @@ -198,8 +198,8 @@ You can recover an archived snapshot by using the `RecoverSnapshot` method. This ```C# Snippet:AzConfigSample11_RecoverSnapshot var snapshotName = "some_snapshot"; -ConfigurationSettingsSnapshot recoveredSnapshot = client.RecoverSnapshot(snapshotName); -Console.WriteLine($"Recovered configuration setting snapshot: {recoveredSnapshot.Name}, status: {recoveredSnapshot.Status}"); +ConfigurationSnapshot recoveredSnapshot = client.RecoverSnapshot(snapshotName); +Console.WriteLine($"Recovered configuration snapshot: {recoveredSnapshot.Name}, status: {recoveredSnapshot.Status}"); ``` ### Retrieve all Snapshots @@ -208,10 +208,10 @@ To retrieve all snapshots, you can use the `GetSnapshots` method. ```C# Snippet:AzConfigSample11_GetSnapshots var count = 0; -foreach (var item in client.GetSnapshots()) +foreach (var item in client.GetSnapshots(new SnapshotSelector())) { count++; - Console.WriteLine($"Retrieved configuration setting snapshot: {item.Name}, status {item.Status}"); + Console.WriteLine($"Retrieved configuration snapshot: {item.Name}, status {item.Status}"); } Console.WriteLine($"Total number of snapshots retrieved: {count}"); ``` diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/api/Azure.Data.AppConfiguration.netstandard2.0.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/api/Azure.Data.AppConfiguration.netstandard2.0.cs index b08fb395f051..aba93aa1e5e3 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/api/Azure.Data.AppConfiguration.netstandard2.0.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/api/Azure.Data.AppConfiguration.netstandard2.0.cs @@ -1,23 +1,5 @@ namespace Azure.Data.AppConfiguration { - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct CompositionType : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public CompositionType(string value) { throw null; } - public static Azure.Data.AppConfiguration.CompositionType Key { get { throw null; } } - public static Azure.Data.AppConfiguration.CompositionType KeyLabel { get { throw null; } } - public bool Equals(Azure.Data.AppConfiguration.CompositionType other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Data.AppConfiguration.CompositionType left, Azure.Data.AppConfiguration.CompositionType right) { throw null; } - public static implicit operator Azure.Data.AppConfiguration.CompositionType (string value) { throw null; } - public static bool operator !=(Azure.Data.AppConfiguration.CompositionType left, Azure.Data.AppConfiguration.CompositionType right) { throw null; } - public override string ToString() { throw null; } - } public partial class ConfigurationClient { protected ConfigurationClient() { } @@ -30,12 +12,12 @@ public ConfigurationClient(System.Uri endpoint, Azure.Core.TokenCredential crede public virtual Azure.Response AddConfigurationSetting(string key, string value, string label = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AddConfigurationSettingAsync(Azure.Data.AppConfiguration.ConfigurationSetting setting, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AddConfigurationSettingAsync(string key, string value, string label = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ArchiveSnapshot(Azure.Data.AppConfiguration.ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ArchiveSnapshot(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ArchiveSnapshotAsync(Azure.Data.AppConfiguration.ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ArchiveSnapshotAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Data.AppConfiguration.CreateSnapshotOperation CreateSnapshot(Azure.WaitUntil wait, string name, Azure.Data.AppConfiguration.ConfigurationSettingsSnapshot snapshot, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateSnapshotAsync(Azure.WaitUntil wait, string name, Azure.Data.AppConfiguration.ConfigurationSettingsSnapshot snapshot, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ArchiveSnapshot(Azure.Data.AppConfiguration.ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ArchiveSnapshot(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ArchiveSnapshotAsync(Azure.Data.AppConfiguration.ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ArchiveSnapshotAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Data.AppConfiguration.CreateSnapshotOperation CreateSnapshot(Azure.WaitUntil wait, string name, Azure.Data.AppConfiguration.ConfigurationSnapshot snapshot, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateSnapshotAsync(Azure.WaitUntil wait, string name, Azure.Data.AppConfiguration.ConfigurationSnapshot snapshot, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeleteConfigurationSetting(Azure.Data.AppConfiguration.ConfigurationSetting setting, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeleteConfigurationSetting(string key, string label = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteConfigurationSettingAsync(Azure.Data.AppConfiguration.ConfigurationSetting setting, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -60,14 +42,14 @@ public ConfigurationClient(System.Uri endpoint, Azure.Core.TokenCredential crede public virtual Azure.Pageable GetRevisions(string keyFilter, string labelFilter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetRevisionsAsync(Azure.Data.AppConfiguration.SettingSelector selector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetRevisionsAsync(string keyFilter, string labelFilter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetSnapshot(string name, System.Collections.Generic.IEnumerable fields = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetSnapshotAsync(string name, System.Collections.Generic.IEnumerable fields = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetSnapshots(string name = null, System.Collections.Generic.IEnumerable fields = null, System.Collections.Generic.IEnumerable status = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetSnapshotsAsync(string name = null, System.Collections.Generic.IEnumerable fields = null, System.Collections.Generic.IEnumerable status = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response RecoverSnapshot(Azure.Data.AppConfiguration.ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response RecoverSnapshot(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> RecoverSnapshotAsync(Azure.Data.AppConfiguration.ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> RecoverSnapshotAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSnapshot(string name, System.Collections.Generic.IEnumerable fields = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSnapshotAsync(string name, System.Collections.Generic.IEnumerable fields = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSnapshots(Azure.Data.AppConfiguration.SnapshotSelector selector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSnapshotsAsync(Azure.Data.AppConfiguration.SnapshotSelector selector, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RecoverSnapshot(Azure.Data.AppConfiguration.ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RecoverSnapshot(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RecoverSnapshotAsync(Azure.Data.AppConfiguration.ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RecoverSnapshotAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetConfigurationSetting(Azure.Data.AppConfiguration.ConfigurationSetting setting, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetConfigurationSetting(string key, string value, string label = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SetConfigurationSettingAsync(Azure.Data.AppConfiguration.ConfigurationSetting setting, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -116,10 +98,10 @@ 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 ConfigurationSettingsSnapshot + public partial class ConfigurationSnapshot { - public ConfigurationSettingsSnapshot(System.Collections.Generic.IEnumerable filters) { } - public Azure.Data.AppConfiguration.CompositionType? CompositionType { get { throw null; } set { } } + public ConfigurationSnapshot(System.Collections.Generic.IEnumerable filters) { } + public Azure.Data.AppConfiguration.SnapshotComposition? CompositionType { get { throw null; } set { } } public System.DateTimeOffset? CreatedOn { get { throw null; } } public Azure.ETag ETag { get { throw null; } } public System.DateTimeOffset? ExpiresOn { get { throw null; } } @@ -127,22 +109,42 @@ public ConfigurationSettingsSnapshot(System.Collections.Generic.IEnumerable Tags { get { throw null; } } } - public partial class CreateSnapshotOperation : Azure.Operation + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ConfigurationSnapshotStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ConfigurationSnapshotStatus(string value) { throw null; } + public static Azure.Data.AppConfiguration.ConfigurationSnapshotStatus Archived { get { throw null; } } + public static Azure.Data.AppConfiguration.ConfigurationSnapshotStatus Failed { get { throw null; } } + public static Azure.Data.AppConfiguration.ConfigurationSnapshotStatus Provisioning { get { throw null; } } + public static Azure.Data.AppConfiguration.ConfigurationSnapshotStatus Ready { get { throw null; } } + public bool Equals(Azure.Data.AppConfiguration.ConfigurationSnapshotStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Data.AppConfiguration.ConfigurationSnapshotStatus left, Azure.Data.AppConfiguration.ConfigurationSnapshotStatus right) { throw null; } + public static implicit operator Azure.Data.AppConfiguration.ConfigurationSnapshotStatus (string value) { throw null; } + public static bool operator !=(Azure.Data.AppConfiguration.ConfigurationSnapshotStatus left, Azure.Data.AppConfiguration.ConfigurationSnapshotStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CreateSnapshotOperation : Azure.Operation { protected CreateSnapshotOperation() { } public override bool HasCompleted { get { throw null; } } public override bool HasValue { get { throw null; } } public override string Id { get { throw null; } } - public override Azure.Data.AppConfiguration.ConfigurationSettingsSnapshot Value { get { throw null; } } + public override Azure.Data.AppConfiguration.ConfigurationSnapshot Value { get { throw null; } } public override Azure.Response GetRawResponse() { throw null; } public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken) { throw null; } } public partial class FeatureFlagConfigurationSetting : Azure.Data.AppConfiguration.ConfigurationSetting { @@ -197,6 +199,24 @@ public SettingSelector() { } public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SnapshotComposition : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SnapshotComposition(string value) { throw null; } + public static Azure.Data.AppConfiguration.SnapshotComposition Key { get { throw null; } } + public static Azure.Data.AppConfiguration.SnapshotComposition KeyLabel { get { throw null; } } + public bool Equals(Azure.Data.AppConfiguration.SnapshotComposition other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Data.AppConfiguration.SnapshotComposition left, Azure.Data.AppConfiguration.SnapshotComposition right) { throw null; } + public static implicit operator Azure.Data.AppConfiguration.SnapshotComposition (string value) { throw null; } + public static bool operator !=(Azure.Data.AppConfiguration.SnapshotComposition left, Azure.Data.AppConfiguration.SnapshotComposition right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct SnapshotFields : System.IEquatable { private readonly object _dummy; @@ -210,7 +230,7 @@ public SettingSelector() { } public static Azure.Data.AppConfiguration.SnapshotFields ItemCount { get { throw null; } } public static Azure.Data.AppConfiguration.SnapshotFields Name { get { throw null; } } public static Azure.Data.AppConfiguration.SnapshotFields RetentionPeriod { get { throw null; } } - public static Azure.Data.AppConfiguration.SnapshotFields Size { get { throw null; } } + public static Azure.Data.AppConfiguration.SnapshotFields SizeInBytes { get { throw null; } } public static Azure.Data.AppConfiguration.SnapshotFields Status { get { throw null; } } public static Azure.Data.AppConfiguration.SnapshotFields Tags { get { throw null; } } public bool Equals(Azure.Data.AppConfiguration.SnapshotFields other) { throw null; } @@ -223,32 +243,19 @@ public SettingSelector() { } public static bool operator !=(Azure.Data.AppConfiguration.SnapshotFields left, Azure.Data.AppConfiguration.SnapshotFields right) { throw null; } public override string ToString() { throw null; } } + public partial class SnapshotSelector + { + public SnapshotSelector() { } + public System.Collections.Generic.IList Fields { get { throw null; } } + public string Name { get { throw null; } set { } } + public System.Collections.Generic.IList 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 { } } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct SnapshotStatus : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public SnapshotStatus(string value) { throw null; } - public static Azure.Data.AppConfiguration.SnapshotStatus Archived { get { throw null; } } - public static Azure.Data.AppConfiguration.SnapshotStatus Failed { get { throw null; } } - public static Azure.Data.AppConfiguration.SnapshotStatus Provisioning { get { throw null; } } - public static Azure.Data.AppConfiguration.SnapshotStatus Ready { get { throw null; } } - public bool Equals(Azure.Data.AppConfiguration.SnapshotStatus other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Data.AppConfiguration.SnapshotStatus left, Azure.Data.AppConfiguration.SnapshotStatus right) { throw null; } - public static implicit operator Azure.Data.AppConfiguration.SnapshotStatus (string value) { throw null; } - public static bool operator !=(Azure.Data.AppConfiguration.SnapshotStatus left, Azure.Data.AppConfiguration.SnapshotStatus right) { throw null; } - public override string ToString() { throw null; } - } } namespace Microsoft.Extensions.Azure { diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/assets.json b/sdk/appconfiguration/Azure.Data.AppConfiguration/assets.json index b0514d7bdc68..6be2f9404c2b 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/assets.json +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/appconfiguration/Azure.Data.AppConfiguration", - "Tag": "net/appconfiguration/Azure.Data.AppConfiguration_9577bdfe93" + "Tag": "net/appconfiguration/Azure.Data.AppConfiguration_c13e90b6f4" } diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample11_SettingsSnapshot.md b/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample11_SettingsSnapshot.md index 57fc94539a62..710af03dac9e 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample11_SettingsSnapshot.md +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample11_SettingsSnapshot.md @@ -2,45 +2,45 @@ Azure App Configuration allows users to create a point-in-time snapshot of their configuration store, providing them with the ability to treat settings as one consistent version. This feature enables applications to hold a consistent view of configuration, ensuring that there are no version mismatches to individual settings due to reading as updates were made. Snapshots are immutable, ensuring that configuration can confidently be rolled back to a last-known-good configuration in the event of a problem. -This sample illustrates how to create, retrieve, and modify the status of a `ConfigurationSettingSnapshot`. +This sample illustrates how to create, retrieve, and modify the status of a `ConfigurationSnapshot`. To get started, you'll need to instantiate the `ConfigurationClient` class. In order to do so, you have two options: provide the connection string of the Configuration Store or authenticate with Azure Active Directory. For detailed instructions, please refer to the [README](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/appconfiguration/Azure.Data.AppConfiguration/README.md#authenticate-the-client). ## Create a Snapshot -To create a snapshot, you need to create an instance of `ConfigurationSettingsSnapshot` and add filters to determine which configuration settings are included in the snapshot. The creation of a snapshot is an LRO (Long-Running Operation) method, and there are three ways to call the `CreateSnapshot` method: +To create a snapshot, you need to create an instance of `ConfigurationSnapshot` and add filters to determine which configuration settings are included in the snapshot. The creation of a snapshot is an LRO (Long-Running Operation) method, and there are three ways to call the `CreateSnapshot` method: ### Automatic Polling ```C# Snippet:AzConfigSample11_CreateSnapshot_AutomaticPolling -var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter("some_key") }); -var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); +var snapshotFilter = new List { new SnapshotSettingFilter("some_key") }; +var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot); var createdSnapshot = operation.Value; -Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); +Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); ``` ### Automatic Polling with `WaitForCompletion` ```C# Snippet:AzConfigSample11_CreateSnapshot_AutomaticPollingLater -var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter("some_key") }); -var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); +var snapshotFilter = new List { new SnapshotSettingFilter("some_key") }; +var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; var operation = client.CreateSnapshot(WaitUntil.Started, snapshotName, settingsSnapshot); operation.WaitForCompletion(); var createdSnapshot = operation.Value; -Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); +Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); ``` ### Manual Polling ```C# Snippet:AzConfigSample11_CreateSnapshot_ManualPolling -var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter("some_key") }); -var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); +var snapshotFilter = new List { new SnapshotSettingFilter("some_key") }; +var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; var operation = client.CreateSnapshot(WaitUntil.Started, snapshotName, settingsSnapshot); @@ -53,7 +53,7 @@ while (true) } var createdSnapshot = operation.Value; -Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); +Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); ``` ## Retrieve a Snapshot @@ -62,8 +62,8 @@ After creating a configuration setting snapshot, you can retrieve it using the ` ```C# Snippet:AzConfigSample11_GetSnapshot var snapshotName = "some_snapshot"; -ConfigurationSettingsSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); -Console.WriteLine($"Retrieved configuration setting snapshot: {retrievedSnapshot.Name}, status: {retrievedSnapshot.Status}"); +ConfigurationSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); +Console.WriteLine($"Retrieved configuration snapshot: {retrievedSnapshot.Name}, status: {retrievedSnapshot.Status}"); ``` ## Archive a Snapshot @@ -72,8 +72,8 @@ To archive a snapshot, you can use the `ArchiveSnapshot` method. This operation ```C# Snippet:AzConfigSample11_ArchiveSnapshot var snapshotName = "some_snapshot"; -ConfigurationSettingsSnapshot archivedSnapshot = client.ArchiveSnapshot(snapshotName); -Console.WriteLine($"Archived configuration setting snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); +ConfigurationSnapshot archivedSnapshot = client.ArchiveSnapshot(snapshotName); +Console.WriteLine($"Archived configuration snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); ``` ## Recover a snapshot @@ -82,8 +82,8 @@ To recover an archived snapshot, you can use the `RecoverSnapshot` method. This ```C# Snippet:AzConfigSample11_RecoverSnapshot var snapshotName = "some_snapshot"; -ConfigurationSettingsSnapshot recoveredSnapshot = client.RecoverSnapshot(snapshotName); -Console.WriteLine($"Recovered configuration setting snapshot: {recoveredSnapshot.Name}, status: {recoveredSnapshot.Status}"); +ConfigurationSnapshot recoveredSnapshot = client.RecoverSnapshot(snapshotName); +Console.WriteLine($"Recovered configuration snapshot: {recoveredSnapshot.Name}, status: {recoveredSnapshot.Status}"); ``` ## Retrieve all Snapshots @@ -92,10 +92,10 @@ To retrieve all snapshots, you can use the `GetSnapshots` method. ```C# Snippet:AzConfigSample11_GetSnapshots var count = 0; -foreach (var item in client.GetSnapshots()) +foreach (var item in client.GetSnapshots(new SnapshotSelector())) { count++; - Console.WriteLine($"Retrieved configuration setting snapshot: {item.Name}, status {item.Status}"); + Console.WriteLine($"Retrieved configuration snapshot: {item.Name}, status {item.Status}"); } Console.WriteLine($"Total number of snapshots retrieved: {count}"); ``` @@ -111,13 +111,13 @@ client.AddConfigurationSetting(firstSetting); var secondSetting = new ConfigurationSetting("second_key", "second_value"); client.AddConfigurationSetting(secondSetting); -var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(firstSetting.Key), new SnapshotSettingFilter(secondSetting.Key) }); -var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); +var snapshotFilter = new List { new SnapshotSettingFilter(firstSetting.Key), new SnapshotSettingFilter(secondSetting.Key) }; +var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot); var createdSnapshot = operation.Value; -Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); +Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); var count = 0; foreach (var item in client.GetConfigurationSettingsForSnapshot(snapshotName)) diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/ConfigurationClient.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/ConfigurationClient.cs index 3e1cf755ded5..cdf1c3e100bd 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/ConfigurationClient.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/ConfigurationClient.cs @@ -726,11 +726,11 @@ public virtual Pageable GetConfigurationSettingsForSnapsho return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConfigurationServiceSerializer.ReadSetting, ClientDiagnostics, _pipeline, "ConfigurationClient.GetConfigurationSettingsForSnapshot", "items", "@nextLink", context); } - /// Gets a single configuration setting snapshot. - /// The name of the configuration setting snapshot to retrieve. + /// Gets a single configuration snapshot. + /// The name of the configuration snapshot to retrieve. /// Used to select what fields are present in the returned resource(s). /// The cancellation token to use. - public virtual async Task> GetSnapshotAsync(string name, IEnumerable fields = null, CancellationToken cancellationToken = default) + public virtual async Task> GetSnapshotAsync(string name, IEnumerable fields = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -750,7 +750,7 @@ public virtual async Task> GetSnapshotAs } Response response = await GetSnapshotAsync(name, snapshotFields, new MatchConditions(), context).ConfigureAwait(false); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -760,11 +760,11 @@ public virtual async Task> GetSnapshotAs } } - /// Gets a single configuration setting snapshot. - /// The name of the configuration setting snapshot to retrieve. + /// Gets a single configuration snapshot. + /// The name of the configuration snapshot to retrieve. /// Used to select what fields are present in the returned resource(s). /// The cancellation token to use. - public virtual Response GetSnapshot(string name, IEnumerable fields = null, CancellationToken cancellationToken = default) + public virtual Response GetSnapshot(string name, IEnumerable fields = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -784,7 +784,7 @@ public virtual Response GetSnapshot(string name, } Response response = GetSnapshot(name, snapshotFields, new MatchConditions(), context); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -794,15 +794,15 @@ public virtual Response GetSnapshot(string name, } } - /// Creates a configuration setting snapshot. + /// Creates a configuration snapshot. /// /// if the method should wait to return until the long-running operation has completed on the service; /// if it should return after starting the operation /// - /// The name of the configuration setting snapshot to create. - /// The configuration setting snapshot to create. + /// The name of the configuration snapshot to create. + /// The configuration snapshot to create. /// The cancellation token to use. - public virtual async Task CreateSnapshotAsync(WaitUntil wait, string name, ConfigurationSettingsSnapshot snapshot, CancellationToken cancellationToken = default) + public virtual async Task CreateSnapshotAsync(WaitUntil wait, string name, ConfigurationSnapshot snapshot, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(snapshot, nameof(snapshot)); @@ -812,7 +812,7 @@ public virtual async Task CreateSnapshotAsync(WaitUntil try { RequestContext context = CreateRequestContext(ErrorOptions.Default, cancellationToken); - using RequestContent content = ConfigurationSettingsSnapshot.ToRequestContent(snapshot); + using RequestContent content = ConfigurationSnapshot.ToRequestContent(snapshot); ContentType contentType = new(HttpHeader.Common.JsonContentType.Value.ToString()); // Start the operation @@ -834,15 +834,15 @@ public virtual async Task CreateSnapshotAsync(WaitUntil } } - /// Creates a configuration setting snapshot. + /// Creates a configuration snapshot. /// /// if the method should wait to return until the long-running operation has completed on the service; /// if it should return after starting the operation. /// - /// The name of the configuration setting snapshot to create. - /// The configuration setting snapshot to create. + /// The name of the configuration snapshot to create. + /// The configuration snapshot to create. /// The cancellation token to use. - public virtual CreateSnapshotOperation CreateSnapshot(WaitUntil wait, string name, ConfigurationSettingsSnapshot snapshot, CancellationToken cancellationToken = default) + public virtual CreateSnapshotOperation CreateSnapshot(WaitUntil wait, string name, ConfigurationSnapshot snapshot, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(snapshot, nameof(snapshot)); @@ -852,7 +852,7 @@ public virtual CreateSnapshotOperation CreateSnapshot(WaitUntil wait, string nam try { RequestContext context = CreateRequestContext(ErrorOptions.Default, cancellationToken); - using RequestContent content = ConfigurationSettingsSnapshot.ToRequestContent(snapshot); + using RequestContent content = ConfigurationSnapshot.ToRequestContent(snapshot); ContentType contentType = new(HttpHeader.Common.JsonContentType.Value.ToString()); // Start the operation @@ -874,10 +874,10 @@ public virtual CreateSnapshotOperation CreateSnapshot(WaitUntil wait, string nam } } - /// Updates the state of a configuration setting snapshot to archive. - /// The name of the configuration setting snapshot to delete. + /// Updates the state of a configuration snapshot to archive. + /// The name of the configuration snapshot to delete. /// The cancellation token to use. - public virtual async Task> ArchiveSnapshotAsync(string name, CancellationToken cancellationToken = default) + public virtual async Task> ArchiveSnapshotAsync(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -889,12 +889,12 @@ public virtual async Task> ArchiveSnapsh SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Archived + Status = ConfigurationSnapshotStatus.Archived }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); Response response = await UpdateSnapshotStatusAsync(name, content, new MatchConditions(), context).ConfigureAwait(false); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -904,10 +904,10 @@ public virtual async Task> ArchiveSnapsh } } - /// Updates the state of a configuration setting snapshot to archive. - /// The name of the configuration setting snapshot to delete. + /// Updates the state of a configuration snapshot to archive. + /// The name of the configuration snapshot to delete. /// The cancellation token to use. - public virtual Response ArchiveSnapshot(string name, CancellationToken cancellationToken = default) + public virtual Response ArchiveSnapshot(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -919,12 +919,12 @@ public virtual Response ArchiveSnapshot(string na SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Archived + Status = ConfigurationSnapshotStatus.Archived }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); Response response = UpdateSnapshotStatus(name, content, new MatchConditions(), context); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -934,14 +934,14 @@ public virtual Response ArchiveSnapshot(string na } } - /// Updates the state of a configuration setting snapshot to archive. - /// The snapshot object of the configuration setting snapshot to archive. + /// Updates the state of a configuration snapshot to archive. + /// The snapshot object of the configuration snapshot to archive. /// If set to true and the configuration settings snapshot exists in the configuration store, update the snapshot - /// status if the passed-in has the same status as the one in the configuration store. The status + /// status if the passed-in has the same status as the one in the configuration store. The status /// is the same if their ETag fields match. If the two snapshots have a different status, this method will throw an exception to indicate /// that the snapshot in the configuration store was modified since it was last obtained by the client. /// The cancellation token to use. - public virtual async Task> ArchiveSnapshotAsync(ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) + public virtual async Task> ArchiveSnapshotAsync(ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) { Argument.AssertNotNull(snapshot, nameof(snapshot)); @@ -953,7 +953,7 @@ public virtual async Task> ArchiveSnapsh SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Archived + Status = ConfigurationSnapshotStatus.Archived }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); @@ -962,7 +962,7 @@ public virtual async Task> ArchiveSnapsh MatchConditions requestOptions = onlyIfUnchanged ? new MatchConditions { IfMatch = snapshot.ETag } : default; Response response = await UpdateSnapshotStatusAsync(snapshot.Name, content, requestOptions, context).ConfigureAwait(false); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -972,14 +972,14 @@ public virtual async Task> ArchiveSnapsh } } - /// Updates the state of a configuration setting snapshot to archive. - /// The snapshot object of the configuration setting snapshot to archive. + /// Updates the state of a configuration snapshot to archive. + /// The snapshot object of the configuration snapshot to archive. /// If set to true and the configuration settings snapshot exists in the configuration store, update the snapshot - /// status if the passed-in has the same status as the one in the configuration store. The status + /// status if the passed-in has the same status as the one in the configuration store. The status /// is the same if their ETag fields match. If the two snapshots have a different status, this method will throw an exception to indicate /// that the snapshot in the configuration store was modified since it was last obtained by the client. /// The cancellation token to use. - public virtual Response ArchiveSnapshot(ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) + public virtual Response ArchiveSnapshot(ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) { Argument.AssertNotNull(snapshot, nameof(snapshot)); @@ -991,14 +991,14 @@ public virtual Response ArchiveSnapshot(Configura SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Archived + Status = ConfigurationSnapshotStatus.Archived }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); MatchConditions requestOptions = onlyIfUnchanged ? new MatchConditions { IfMatch = snapshot.ETag } : default; Response response = UpdateSnapshotStatus(snapshot.Name, content, requestOptions, context); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -1008,10 +1008,10 @@ public virtual Response ArchiveSnapshot(Configura } } - /// Updates the state of a configuration setting snapshot to ready. - /// The name of the configuration setting snapshot to recover. + /// Updates the state of a configuration snapshot to ready. + /// The name of the configuration snapshot to recover. /// The cancellation token to use. - public virtual async Task> RecoverSnapshotAsync(string name, CancellationToken cancellationToken = default) + public virtual async Task> RecoverSnapshotAsync(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -1023,12 +1023,12 @@ public virtual async Task> RecoverSnapsh SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Ready + Status = ConfigurationSnapshotStatus.Ready }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); Response response = await UpdateSnapshotStatusAsync(name, content, new MatchConditions(), context).ConfigureAwait(false); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -1038,10 +1038,10 @@ public virtual async Task> RecoverSnapsh } } - /// Updates the state of a configuration setting snapshot to ready. - /// The name of the configuration setting snapshot to recover. + /// Updates the state of a configuration snapshot to ready. + /// The name of the configuration snapshot to recover. /// The cancellation token to use. - public virtual Response RecoverSnapshot(string name, CancellationToken cancellationToken = default) + public virtual Response RecoverSnapshot(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -1053,12 +1053,12 @@ public virtual Response RecoverSnapshot(string na SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Ready + Status = ConfigurationSnapshotStatus.Ready }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); Response response = UpdateSnapshotStatus(name, content, new MatchConditions(), context); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -1068,14 +1068,14 @@ public virtual Response RecoverSnapshot(string na } } - /// Updates the state of a configuration setting snapshot to ready. - /// The name of the configuration setting snapshot to recover. - /// If set to true and the configuration settings snapshot exists in the configuration store, update the snapshot - /// status if the passed-in has the same status as the one in the configuration store. The status + /// Updates the state of a configuration snapshot to ready. + /// The name of the configuration snapshot to recover. + /// If set to true and the configuration snapshot exists in the configuration store, update the snapshot + /// status if the passed-in has the same status as the one in the configuration store. The status /// is the same if their ETag fields match. If the two snapshots have a different status, this method will throw an exception to indicate /// that the snapshot in the configuration store was modified since it was last obtained by the client. /// The cancellation token to use. - public virtual async Task> RecoverSnapshotAsync(ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) + public virtual async Task> RecoverSnapshotAsync(ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) { Argument.AssertNotNull(snapshot, nameof(snapshot)); @@ -1087,14 +1087,14 @@ public virtual async Task> RecoverSnapsh SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Ready + Status = ConfigurationSnapshotStatus.Ready }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); MatchConditions requestOptions = onlyIfUnchanged ? new MatchConditions { IfMatch = snapshot.ETag } : default; Response response = await UpdateSnapshotStatusAsync(snapshot.Name, content, requestOptions, context).ConfigureAwait(false); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -1104,14 +1104,14 @@ public virtual async Task> RecoverSnapsh } } - /// Updates the state of a configuration setting snapshot to ready. - /// The name of the configuration setting snapshot to recover. - /// If set to true and the configuration settings snapshot exists in the configuration store, update the snapshot - /// status if the passed-in has the same status as the one in the configuration store. The status + /// Updates the state of a configuration snapshot to ready. + /// The name of the configuration snapshot to recover. + /// If set to true and the configuration snapshot exists in the configuration store, update the snapshot + /// status if the passed-in has the same status as the one in the configuration store. The status /// is the same if their ETag fields match. If the two snapshots have a different status, this method will throw an exception to indicate /// that the snapshot in the configuration store was modified since it was last obtained by the client. /// The cancellation token to use. - public virtual Response RecoverSnapshot(ConfigurationSettingsSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) + public virtual Response RecoverSnapshot(ConfigurationSnapshot snapshot, bool onlyIfUnchanged = false, CancellationToken cancellationToken = default) { Argument.AssertNotNull(snapshot, nameof(snapshot)); @@ -1123,14 +1123,14 @@ public virtual Response RecoverSnapshot(Configura SnapshotUpdateParameters snapshotUpdateParameters = new() { - Status = SnapshotStatus.Ready + Status = ConfigurationSnapshotStatus.Ready }; using RequestContent content = SnapshotUpdateParameters.ToRequestContent(snapshotUpdateParameters); MatchConditions requestOptions = onlyIfUnchanged ? new MatchConditions { IfMatch = snapshot.ETag } : default; Response response = UpdateSnapshotStatus(snapshot.Name, content, requestOptions, context); - ConfigurationSettingsSnapshot value = ConfigurationSettingsSnapshot.FromResponse(response); + ConfigurationSnapshot value = ConfigurationSnapshot.FromResponse(response); return Response.FromValue(value, response); } catch (Exception e) @@ -1140,70 +1140,62 @@ public virtual Response RecoverSnapshot(Configura } } - /// Gets a list of configuration setting snapshots. - /// A filter for the name of the returned snapshots. - /// Used to select what fields are present in the returned resource(s). - /// Used to filter returned snapshots by their status property. + /// Gets a list of configuration snapshots. + /// Set of options for selecting . /// The cancellation token to use. - public virtual AsyncPageable GetSnapshotsAsync(string name = null, IEnumerable fields = null, IEnumerable status = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetSnapshotsAsync(SnapshotSelector selector, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(selector, nameof(selector)); + var name = selector.Name; + var fields = selector.Fields; + var status = selector.Status; + RequestContext context = CreateRequestContext(ErrorOptions.Default, cancellationToken); - List snapshotFields = null; - if (fields != null) + + var snapshotFields = new ChangeTrackingList(); + foreach (SnapshotFields field in fields) { - snapshotFields = new(); - foreach (SnapshotFields field in fields) - { - snapshotFields.Add(field.ToString()); - } + snapshotFields.Add(field.ToString()); } - List snapshotStatus = null; - if (status != null) + var snapshotStatus = new ChangeTrackingList(); + foreach (ConfigurationSnapshotStatus st in status) { - snapshotStatus = new(); - foreach (SnapshotStatus st in status) - { - snapshotStatus.Add(st.ToString()); - } + snapshotStatus.Add(st.ToString()); } HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSnapshotsRequest(name, null, snapshotFields, snapshotStatus, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSnapshotsNextPageRequest(nextLink, name, null, snapshotFields, snapshotStatus, context); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConfigurationSettingsSnapshot.DeserializeSnapshot, ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ConfigurationSnapshot.DeserializeSnapshot, ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", cancellationToken); } - /// Gets a list of configuration setting snapshots. - /// A filter for the name of the returned snapshots. - /// Used to select what fields are present in the returned resource(s). - /// Used to filter returned snapshots by their status property. + /// Gets a list of configuration snapshots. + /// Set of options for selecting . /// The cancellation token to use. - public virtual Pageable GetSnapshots(string name = null, IEnumerable fields = null, IEnumerable status = null, CancellationToken cancellationToken = default) + public virtual Pageable GetSnapshots(SnapshotSelector selector, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(selector, nameof(selector)); + var name = selector.Name; + var fields = selector.Fields; + var status = selector.Status; + RequestContext context = CreateRequestContext(ErrorOptions.Default, cancellationToken); - List snapshotFields = null; - if (fields != null) + + var snapshotFields = new ChangeTrackingList(); + foreach (SnapshotFields field in fields) { - snapshotFields = new(); - foreach (SnapshotFields field in fields) - { - snapshotFields.Add(field.ToString()); - } + snapshotFields.Add(field.ToString()); } - List snapshotStatus = null; - if (status != null) + var snapshotStatus = new ChangeTrackingList(); + foreach (ConfigurationSnapshotStatus st in status) { - snapshotStatus = new(); - foreach (SnapshotStatus st in status) - { - snapshotStatus.Add(st.ToString()); - } + snapshotStatus.Add(st.ToString()); } HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSnapshotsRequest(name, null, snapshotFields, snapshotStatus, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSnapshotsNextPageRequest(nextLink, name, null, snapshotFields, snapshotStatus, context); - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConfigurationSettingsSnapshot.DeserializeSnapshot, ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", cancellationToken); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ConfigurationSnapshot.DeserializeSnapshot, ClientDiagnostics, _pipeline, "ConfigurationClient.GetSnapshots", "items", "@nextLink", cancellationToken); } /// diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/CreateSnapshotOperation.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/CreateSnapshotOperation.cs index 35c4da22ebd4..4d80a65ac5c8 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/CreateSnapshotOperation.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/CreateSnapshotOperation.cs @@ -14,10 +14,10 @@ namespace Azure.Data.AppConfiguration { /// - /// A long-running operation for - /// or . + /// A long-running operation for + /// or . /// - public class CreateSnapshotOperation : Operation + public class CreateSnapshotOperation : Operation { private readonly ClientDiagnostics _diagnostics; private Operation _operation; @@ -25,10 +25,10 @@ public class CreateSnapshotOperation : Operation private static readonly TimeSpan s_defaultPollingInterval = TimeSpan.FromSeconds(5); /// - /// Gets the . This snapshot will have a status of - /// until the operation has completed. + /// Gets the . This snapshot will have a status of + /// until the operation has completed. /// - public override ConfigurationSettingsSnapshot Value => ConfigurationSettingsSnapshot.FromResponse(_operation.GetRawResponse()); + public override ConfigurationSnapshot Value => ConfigurationSnapshot.FromResponse(_operation.GetRawResponse()); /// public override bool HasValue => _operation.HasValue; @@ -69,11 +69,11 @@ public override Response GetRawResponse() public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => await UpdateStatusAsync(true, cancellationToken).ConfigureAwait(false); /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => this.DefaultWaitForCompletionAsync(s_defaultPollingInterval, cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) => this.DefaultWaitForCompletionAsync(pollingInterval, cancellationToken); private async ValueTask UpdateStatusAsync(bool async, CancellationToken cancellationToken) diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSettingsSnapshot.Serialization.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshot.Serialization.cs similarity index 87% rename from sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSettingsSnapshot.Serialization.cs rename to sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshot.Serialization.cs index bc5c350465de..cb34821c992c 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSettingsSnapshot.Serialization.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshot.Serialization.cs @@ -8,7 +8,7 @@ namespace Azure.Data.AppConfiguration { - public partial class ConfigurationSettingsSnapshot : IUtf8JsonSerializable + public partial class ConfigurationSnapshot : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -44,12 +44,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ConfigurationSettingsSnapshot DeserializeSnapshot(JsonElement element) + internal static ConfigurationSnapshot DeserializeSnapshot(JsonElement element) { Optional name = default; - Optional status = default; + Optional status = default; IList filters = default; - Optional compositionType = default; + Optional compositionType = default; Optional created = default; Optional expires = default; Optional retentionPeriod = default; @@ -71,7 +71,7 @@ internal static ConfigurationSettingsSnapshot DeserializeSnapshot(JsonElement el property.ThrowNonNullablePropertyIsNull(); continue; } - status = new SnapshotStatus(property.Value.GetString()); + status = new ConfigurationSnapshotStatus(property.Value.GetString()); continue; } if (property.NameEquals("filters")) @@ -91,7 +91,7 @@ internal static ConfigurationSettingsSnapshot DeserializeSnapshot(JsonElement el property.ThrowNonNullablePropertyIsNull(); continue; } - compositionType = new CompositionType(property.Value.GetString()); + compositionType = new SnapshotComposition(property.Value.GetString()); continue; } if (property.NameEquals("created")) @@ -165,18 +165,18 @@ internal static ConfigurationSettingsSnapshot DeserializeSnapshot(JsonElement el continue; } } - return new ConfigurationSettingsSnapshot(name.Value, Optional.ToNullable(status), filters, Optional.ToNullable(compositionType), Optional.ToNullable(created), Optional.ToNullable(expires), Optional.ToNullable(retentionPeriod), Optional.ToNullable(size), Optional.ToNullable(itemsCount), Optional.ToDictionary(tags), new ETag(etag.Value)); + return new ConfigurationSnapshot(name.Value, Optional.ToNullable(status), filters, Optional.ToNullable(compositionType), Optional.ToNullable(created), Optional.ToNullable(expires), Optional.ToNullable(retentionPeriod), Optional.ToNullable(size), Optional.ToNullable(itemsCount), Optional.ToDictionary(tags), new ETag(etag.Value)); } // Mapping raw response to model - internal static ConfigurationSettingsSnapshot FromResponse(Response response) + internal static ConfigurationSnapshot FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeSnapshot(document.RootElement); } // Mapping model to raw request - internal static RequestContent ToRequestContent(ConfigurationSettingsSnapshot snapshot) + internal static RequestContent ToRequestContent(ConfigurationSnapshot snapshot) { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(snapshot); diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSettingsSnapshot.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshot.cs similarity index 86% rename from sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSettingsSnapshot.cs rename to sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshot.cs index ec5f9efba024..544e3088abb8 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSettingsSnapshot.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshot.cs @@ -9,12 +9,12 @@ namespace Azure.Data.AppConfiguration { /// The Snapshot. - public partial class ConfigurationSettingsSnapshot + public partial class ConfigurationSnapshot { /// Initializes a new instance of Snapshot. /// A list of filters used to filter the key-values included in the snapshot. /// is null. - public ConfigurationSettingsSnapshot(IEnumerable filters) + public ConfigurationSnapshot(IEnumerable filters) { Argument.AssertNotNull(filters, nameof(filters)); @@ -30,11 +30,11 @@ public ConfigurationSettingsSnapshot(IEnumerable filters) /// The time that the snapshot was created. /// The time that the snapshot will expire. /// The amount of time, in seconds, that a snapshot will remain in the archived state before expiring. This property is only writable during the creation of a snapshot. If not specified, the default lifetime of key-value revisions will be used. - /// The size in bytes of the snapshot. + /// The size in bytes of the snapshot. /// The amount of key-values in the snapshot. /// The tags of the snapshot. /// A value representing the current state of the snapshot. - internal ConfigurationSettingsSnapshot(string name, SnapshotStatus? status, IList filters, CompositionType? compositionType, DateTimeOffset? createdOn, DateTimeOffset? expiresOn, long? retentionPeriod, long? size, long? itemCount, IDictionary tags, ETag eTag) + internal ConfigurationSnapshot(string name, ConfigurationSnapshotStatus? status, IList filters, SnapshotComposition? compositionType, DateTimeOffset? createdOn, DateTimeOffset? expiresOn, long? retentionPeriod, long? sizeInBytes, long? itemCount, IDictionary tags, ETag eTag) { Name = name; Status = status; @@ -43,7 +43,7 @@ internal ConfigurationSettingsSnapshot(string name, SnapshotStatus? status, ILis CreatedOn = createdOn; ExpiresOn = expiresOn; _retentionPeriod = retentionPeriod; - Size = size; + SizeInBytes = sizeInBytes; ItemCount = itemCount; Tags = tags; ETag = eTag; @@ -52,11 +52,11 @@ internal ConfigurationSettingsSnapshot(string name, SnapshotStatus? status, ILis /// The name of the snapshot. public string Name { get; } /// The current status of the snapshot. - public SnapshotStatus? Status { get; } + public ConfigurationSnapshotStatus? Status { get; } /// A list of filters used to filter the key-values included in the snapshot. public IList Filters { get; } /// 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. - public CompositionType? CompositionType { get; set; } + public SnapshotComposition? CompositionType { get; set; } /// The time that the snapshot was created. public DateTimeOffset? CreatedOn { get; } /// The time that the snapshot will expire. @@ -85,7 +85,7 @@ public TimeSpan? RetentionPeriod { } } /// The size in bytes of the snapshot. - public long? Size { get; } + public long? SizeInBytes { get; } /// The amount of key-values in the snapshot. public long? ItemCount { get; } /// The tags of the snapshot. diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshotStatus.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshotStatus.cs new file mode 100644 index 000000000000..2f1e9d8d73f0 --- /dev/null +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/ConfigurationSnapshotStatus.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; + +namespace Azure.Data.AppConfiguration +{ + /// The current status of the snapshot. + public readonly partial struct ConfigurationSnapshotStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConfigurationSnapshotStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ProvisioningValue = "provisioning"; + private const string ReadyValue = "ready"; + private const string ArchivedValue = "archived"; + private const string FailedValue = "failed"; + + /// provisioning. + public static ConfigurationSnapshotStatus Provisioning { get; } = new ConfigurationSnapshotStatus(ProvisioningValue); + /// ready. + public static ConfigurationSnapshotStatus Ready { get; } = new ConfigurationSnapshotStatus(ReadyValue); + /// archived. + public static ConfigurationSnapshotStatus Archived { get; } = new ConfigurationSnapshotStatus(ArchivedValue); + /// failed. + public static ConfigurationSnapshotStatus Failed { get; } = new ConfigurationSnapshotStatus(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(ConfigurationSnapshotStatus left, ConfigurationSnapshotStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConfigurationSnapshotStatus left, ConfigurationSnapshotStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConfigurationSnapshotStatus(string value) => new ConfigurationSnapshotStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConfigurationSnapshotStatus other && Equals(other); + /// + public bool Equals(ConfigurationSnapshotStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/CompositionType.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotComposition.cs similarity index 52% rename from sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/CompositionType.cs rename to sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotComposition.cs index c686ddc47565..9997717ba729 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/CompositionType.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotComposition.cs @@ -7,13 +7,13 @@ namespace Azure.Data.AppConfiguration { /// 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. - public readonly partial struct CompositionType : IEquatable + public readonly partial struct SnapshotComposition : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public CompositionType(string value) + public SnapshotComposition(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -22,21 +22,21 @@ public CompositionType(string value) private const string KeyLabelValue = "key_label"; /// The 'key' composition type ensures there are no two key-values containing the same key. - public static CompositionType Key { get; } = new CompositionType(KeyValue); + public static SnapshotComposition Key { get; } = new SnapshotComposition(KeyValue); /// The 'key_label' composition type ensures there are no two key-values containing the same key and label. - public static CompositionType KeyLabel { get; } = new CompositionType(KeyLabelValue); - /// Determines if two values are the same. - public static bool operator ==(CompositionType left, CompositionType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(CompositionType left, CompositionType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator CompositionType(string value) => new CompositionType(value); + public static SnapshotComposition KeyLabel { get; } = new SnapshotComposition(KeyLabelValue); + /// Determines if two values are the same. + public static bool operator ==(SnapshotComposition left, SnapshotComposition right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SnapshotComposition left, SnapshotComposition right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SnapshotComposition(string value) => new SnapshotComposition(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is CompositionType other && Equals(other); + public override bool Equals(object obj) => obj is SnapshotComposition other && Equals(other); /// - public bool Equals(CompositionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(SnapshotComposition other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotFields.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotFields.cs index c0b21e8607cd..8f1f7a14e0c9 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotFields.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotFields.cs @@ -27,7 +27,7 @@ public SnapshotFields(string value) private const string CreatedOnValue = "created"; private const string ExpiresOnValue = "expires"; private const string RetentionPeriodValue = "retention_period"; - private const string SizeValue = "size"; + private const string SizeInBytesValue = "size"; private const string ItemCountValue = "items_count"; private const string TagsValue = "tags"; private const string ETagValue = "etag"; @@ -47,7 +47,7 @@ public SnapshotFields(string value) /// retention_period. public static SnapshotFields RetentionPeriod { get; } = new SnapshotFields(RetentionPeriodValue); /// size. - public static SnapshotFields Size { get; } = new SnapshotFields(SizeValue); + public static SnapshotFields SizeInBytes { get; } = new SnapshotFields(SizeInBytesValue); /// items_count. public static SnapshotFields ItemCount { get; } = new SnapshotFields(ItemCountValue); /// tags. diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotSelector.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotSelector.cs new file mode 100644 index 000000000000..b74a125c6739 --- /dev/null +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotSelector.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.Data.AppConfiguration +{ + /// + /// is a set of options that allows selecting a filtered set of entities. + /// + public class SnapshotSelector + { + /// + /// Initializes a new instance of . + /// + public SnapshotSelector() + { + Fields = new ChangeTrackingList(); + Status = new ChangeTrackingList(); + } + + /// + /// A filter for the name of the returned snapshots. + /// + public string Name { get; set; } + + /// + /// A list of fields used to specify which fields are included in the returned resource(s). + /// + public IList Fields { get; } + + /// + /// A list of snapshot status used to filter the returned snapshots based on their status property. + /// + public IList Status { get; } + } +} diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotStatus.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotStatus.cs deleted file mode 100644 index fc914a33fd52..000000000000 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotStatus.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.ComponentModel; - -namespace Azure.Data.AppConfiguration -{ - /// The current status of the snapshot. - public readonly partial struct SnapshotStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public SnapshotStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ProvisioningValue = "provisioning"; - private const string ReadyValue = "ready"; - private const string ArchivedValue = "archived"; - private const string FailedValue = "failed"; - - /// provisioning. - public static SnapshotStatus Provisioning { get; } = new SnapshotStatus(ProvisioningValue); - /// ready. - public static SnapshotStatus Ready { get; } = new SnapshotStatus(ReadyValue); - /// archived. - public static SnapshotStatus Archived { get; } = new SnapshotStatus(ArchivedValue); - /// failed. - public static SnapshotStatus Failed { get; } = new SnapshotStatus(FailedValue); - /// Determines if two values are the same. - public static bool operator ==(SnapshotStatus left, SnapshotStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(SnapshotStatus left, SnapshotStatus right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator SnapshotStatus(string value) => new SnapshotStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SnapshotStatus other && Equals(other); - /// - public bool Equals(SnapshotStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotUpdateParameters.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotUpdateParameters.cs index 7d9b97329e2b..f95673698aaf 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotUpdateParameters.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/SnapshotUpdateParameters.cs @@ -12,6 +12,6 @@ public SnapshotUpdateParameters() } /// The desired status of the snapshot. - public SnapshotStatus? Status { get; set; } + public ConfigurationSnapshotStatus? Status { get; set; } } } diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationLiveTests.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationLiveTests.cs index f50b656e30fe..b6f6d9fa1982 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationLiveTests.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationLiveTests.cs @@ -1662,7 +1662,7 @@ public async Task CreateSnapshotUsingAutomaticPolling() await service.AddConfigurationSettingAsync(testSetting); var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(testSetting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = GenerateSnapshotName(); var operation = await service.CreateSnapshotAsync(WaitUntil.Completed, snapshotName, settingsSnapshot); @@ -1689,7 +1689,7 @@ public async Task CreateSnapshotUsingWaitForCompletion() await service.AddConfigurationSettingAsync(testSetting); var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(testSetting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = GenerateSnapshotName(); var operation = await service.CreateSnapshotAsync(WaitUntil.Started, snapshotName, settingsSnapshot); @@ -1717,7 +1717,7 @@ public async Task CreateSnapshotUsingManualPolling() await service.AddConfigurationSettingAsync(testSetting); var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(testSetting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = GenerateSnapshotName(); var operation = await service.CreateSnapshotAsync(WaitUntil.Started, snapshotName, settingsSnapshot); @@ -1753,7 +1753,7 @@ public async Task ArchiveSnapshotStatus() await service.AddConfigurationSettingAsync(testSetting); var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(testSetting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = GenerateSnapshotName(); var operation = await service.CreateSnapshotAsync(WaitUntil.Completed, snapshotName, settingsSnapshot); @@ -1763,9 +1763,9 @@ public async Task ArchiveSnapshotStatus() var retrievedSnapshot = await service.GetSnapshotAsync(snapshotName); ValidateCreatedSnapshot(createdSnapshot, retrievedSnapshot, snapshotName); - ConfigurationSettingsSnapshot archivedSnapshot = await service.ArchiveSnapshotAsync(snapshotName); + ConfigurationSnapshot archivedSnapshot = await service.ArchiveSnapshotAsync(snapshotName); Assert.NotNull(archivedSnapshot); - Assert.AreEqual(SnapshotStatus.Archived, archivedSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Archived, archivedSnapshot.Status); } finally { @@ -1784,7 +1784,7 @@ public async Task RecoverSnapshotStatus() await service.AddConfigurationSettingAsync(testSetting); var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(testSetting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = GenerateSnapshotName(); var operation = await service.CreateSnapshotAsync(WaitUntil.Completed, snapshotName, settingsSnapshot); @@ -1794,13 +1794,13 @@ public async Task RecoverSnapshotStatus() var retrievedSnapshot = await service.GetSnapshotAsync(snapshotName); ValidateCreatedSnapshot(createdSnapshot, retrievedSnapshot, snapshotName); - ConfigurationSettingsSnapshot archivedSnapshot = await service.ArchiveSnapshotAsync(snapshotName); + ConfigurationSnapshot archivedSnapshot = await service.ArchiveSnapshotAsync(snapshotName); Assert.NotNull(archivedSnapshot); - Assert.AreEqual(SnapshotStatus.Archived, archivedSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Archived, archivedSnapshot.Status); - ConfigurationSettingsSnapshot recoveredSnapshot = await service.RecoverSnapshotAsync(snapshotName); + ConfigurationSnapshot recoveredSnapshot = await service.RecoverSnapshotAsync(snapshotName); Assert.NotNull(recoveredSnapshot); - Assert.AreEqual(SnapshotStatus.Ready, recoveredSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Ready, recoveredSnapshot.Status); } finally { @@ -1822,15 +1822,16 @@ public async Task GetSnapshots() var firstSnapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(firstSetting.Key) }); var firstSnapshotName = GenerateSnapshotName("first_snapshot"); - var firstOperation = await service.CreateSnapshotAsync(WaitUntil.Completed, firstSnapshotName, new ConfigurationSettingsSnapshot(firstSnapshotFilter)); + var firstOperation = await service.CreateSnapshotAsync(WaitUntil.Completed, firstSnapshotName, new ConfigurationSnapshot(firstSnapshotFilter)); ValidateCompletedOperation(firstOperation); var secondSnapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(secondSetting.Key) }); var secondSnapshotName = GenerateSnapshotName("second_snapshot"); - var secondOperation = await service.CreateSnapshotAsync(WaitUntil.Completed, secondSnapshotName, new ConfigurationSettingsSnapshot(secondSnapshotFilter)); + var secondOperation = await service.CreateSnapshotAsync(WaitUntil.Completed, secondSnapshotName, new ConfigurationSnapshot(secondSnapshotFilter)); ValidateCompletedOperation(secondOperation); - var snapshots = service.GetSnapshotsAsync(cancellationToken: CancellationToken.None); + var selector = new SnapshotSelector(); + var snapshots = service.GetSnapshotsAsync(selector); var resultsReturned = (await snapshots.ToEnumerableAsync()).Count; Assert.GreaterOrEqual(resultsReturned, 2); } @@ -1841,6 +1842,45 @@ public async Task GetSnapshots() } } + [RecordedTest] + public async Task GetSnapshotsUsingNameFilter() + { + var service = GetClient(); + var firstSetting = new ConfigurationSetting("first_key", "first_value"); + var secondSetting = new ConfigurationSetting("second_key", "second_value"); + + try + { + await service.AddConfigurationSettingAsync(firstSetting); + await service.AddConfigurationSettingAsync(secondSetting); + + var firstSnapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(firstSetting.Key) }); + var firstSnapshotName = GenerateSnapshotName("first_snapshot"); + var firstOperation = await service.CreateSnapshotAsync(WaitUntil.Completed, firstSnapshotName, new ConfigurationSnapshot(firstSnapshotFilter)); + ValidateCompletedOperation(firstOperation); + + var secondSnapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(secondSetting.Key) }); + var secondSnapshotName = GenerateSnapshotName("second_snapshot"); + var secondOperation = await service.CreateSnapshotAsync(WaitUntil.Completed, secondSnapshotName, new ConfigurationSnapshot(secondSnapshotFilter)); + ValidateCompletedOperation(secondOperation); + + var selector = new SnapshotSelector() + { + Name = firstSnapshotName + }; + + ConfigurationSnapshot[] batch = (await service.GetSnapshotsAsync(selector).ToEnumerableAsync()).ToArray(); + + Assert.AreEqual(1, batch.Length); + Assert.AreEqual(firstSnapshotName, batch[0].Name); + } + finally + { + AssertStatus200(await service.DeleteConfigurationSettingAsync(firstSetting.Key, firstSetting.Label)); + AssertStatus200(await service.DeleteConfigurationSettingAsync(secondSetting.Key, secondSetting.Label)); + } + } + [RecordedTest] public async Task GetConfigurationSettingsForSnapshot() { @@ -1853,7 +1893,7 @@ public async Task GetConfigurationSettingsForSnapshot() var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(setting.Key) }); var snapshotName = GenerateSnapshotName(); - var operation = await service.CreateSnapshotAsync(WaitUntil.Completed, snapshotName, new ConfigurationSettingsSnapshot(snapshotFilter)); + var operation = await service.CreateSnapshotAsync(WaitUntil.Completed, snapshotName, new ConfigurationSnapshot(snapshotFilter)); ValidateCompletedOperation(operation); var settingsForSnapshot = service.GetConfigurationSettingsForSnapshotAsync(snapshotName); @@ -1878,7 +1918,7 @@ public async Task UnchangedSnapshotAfterSettingsUpdate() var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(createdSetting.Key) }); var snapshotName = GenerateSnapshotName(); - var operation = await service.CreateSnapshotAsync(WaitUntil.Completed, snapshotName, new ConfigurationSettingsSnapshot(snapshotFilter)); + var operation = await service.CreateSnapshotAsync(WaitUntil.Completed, snapshotName, new ConfigurationSnapshot(snapshotFilter)); ValidateCompletedOperation(operation); setting.Value = "Updated_Value"; @@ -1897,7 +1937,7 @@ public async Task UnchangedSnapshotAfterSettingsUpdate() } } - private void ValidateCreatedSnapshot(ConfigurationSettingsSnapshot createdSnapshot, ConfigurationSettingsSnapshot retrievedSnapshot, string expectedName) + private void ValidateCreatedSnapshot(ConfigurationSnapshot createdSnapshot, ConfigurationSnapshot retrievedSnapshot, string expectedName) { Assert.NotNull(createdSnapshot); Assert.AreEqual(expectedName, createdSnapshot.Name); diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationSettingsSnapshotTest.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationSettingsSnapshotTest.cs index 44a0d111f13f..8cea67110c07 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationSettingsSnapshotTest.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/ConfigurationSettingsSnapshotTest.cs @@ -12,11 +12,11 @@ public class ConfigurationSettingsSnapshotTest [Test] public void SetRetentionPeriodUsingConstructor() { - var settingSnapshot = new ConfigurationSettingsSnapshot( + var settingSnapshot = new ConfigurationSnapshot( "name", - SnapshotStatus.Ready, + ConfigurationSnapshotStatus.Ready, new List(), - new CompositionType(), + new SnapshotComposition(), DateTime.UtcNow, DateTime.UtcNow, 10675199, // retention period @@ -34,7 +34,7 @@ public void SetRetentionPeriodUsingSetter() { List filters = new() { new SnapshotSettingFilter("key", "val") }; - var settingSnapshot = new ConfigurationSettingsSnapshot(filters); + var settingSnapshot = new ConfigurationSnapshot(filters); settingSnapshot.RetentionPeriod = TimeSpan.FromSeconds(10675199); Assert.AreEqual(settingSnapshot.RetentionPeriod, TimeSpan.FromSeconds(10675199)); diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/samples/Sample11_SettingsSnapshot.cs b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/samples/Sample11_SettingsSnapshot.cs index d71cb3d57c86..5c901208294f 100644 --- a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/samples/Sample11_SettingsSnapshot.cs +++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/samples/Sample11_SettingsSnapshot.cs @@ -23,8 +23,8 @@ public void CreateSnapshotAutomaticPolling() client.AddConfigurationSetting(setting); #region Snippet:AzConfigSample11_CreateSnapshot_AutomaticPolling - var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter("some_key") }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var snapshotFilter = new List { new SnapshotSettingFilter("some_key") }; + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; #if !SNIPPET @@ -32,11 +32,11 @@ public void CreateSnapshotAutomaticPolling() #endif var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot); var createdSnapshot = operation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); #endregion - ConfigurationSettingsSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); - Console.WriteLine($"Retrieved configuration setting snapshot: {retrievedSnapshot.Name}, status: {createdSnapshot.Status}"); + ConfigurationSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); + Console.WriteLine($"Retrieved configuration snapshot: {retrievedSnapshot.Name}, status: {createdSnapshot.Status}"); Assert.NotNull(retrievedSnapshot); Assert.AreEqual(createdSnapshot.Name, retrievedSnapshot.Name); @@ -59,8 +59,8 @@ public void CreateSnapshotAutomaticPollingLater() client.AddConfigurationSetting(setting); #region Snippet:AzConfigSample11_CreateSnapshot_AutomaticPollingLater - var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter("some_key") }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var snapshotFilter = new List { new SnapshotSettingFilter("some_key") }; + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; #if !SNIPPET @@ -70,11 +70,11 @@ public void CreateSnapshotAutomaticPollingLater() operation.WaitForCompletion(); var createdSnapshot = operation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); #endregion - ConfigurationSettingsSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); - Console.WriteLine($"Retrieved configuration setting snapshot: {retrievedSnapshot.Name}, status: {createdSnapshot.Status}"); + ConfigurationSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); + Console.WriteLine($"Retrieved configuration snapshot: {retrievedSnapshot.Name}, status: {createdSnapshot.Status}"); Assert.NotNull(retrievedSnapshot); Assert.AreEqual(createdSnapshot.Name, retrievedSnapshot.Name); @@ -97,8 +97,8 @@ public async Task CreateSnapshotManualPolling() client.AddConfigurationSetting(setting); #region Snippet:AzConfigSample11_CreateSnapshot_ManualPolling - var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter("some_key") }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var snapshotFilter = new List { new SnapshotSettingFilter("some_key") }; + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; #if !SNIPPET @@ -114,11 +114,11 @@ public async Task CreateSnapshotManualPolling() } var createdSnapshot = operation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); #endregion - ConfigurationSettingsSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); - Console.WriteLine($"Retrieved configuration setting snapshot: {retrievedSnapshot.Name}, status: {createdSnapshot.Status}"); + ConfigurationSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); + Console.WriteLine($"Retrieved configuration snapshot: {retrievedSnapshot.Name}, status: {createdSnapshot.Status}"); Assert.NotNull(retrievedSnapshot); Assert.AreEqual(createdSnapshot.Name, retrievedSnapshot.Name); @@ -140,21 +140,21 @@ public void GetSnapshot() { client.AddConfigurationSetting(setting); - var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(setting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var snapshotFilter = new List { new SnapshotSettingFilter(setting.Key) }; + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var configSnapshotName = GenerateSnapshotName(); var operation = client.CreateSnapshot(WaitUntil.Completed, configSnapshotName, settingsSnapshot); var createdSnapshot = operation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); #region Snippet:AzConfigSample11_GetSnapshot var snapshotName = "some_snapshot"; #if !SNIPPET snapshotName = configSnapshotName; #endif - ConfigurationSettingsSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); - Console.WriteLine($"Retrieved configuration setting snapshot: {retrievedSnapshot.Name}, status: {retrievedSnapshot.Status}"); + ConfigurationSnapshot retrievedSnapshot = client.GetSnapshot(snapshotName); + Console.WriteLine($"Retrieved configuration snapshot: {retrievedSnapshot.Name}, status: {retrievedSnapshot.Status}"); #endregion Assert.NotNull(retrievedSnapshot); @@ -177,30 +177,30 @@ public void ArchiveSnapshot() { client.AddConfigurationSetting(setting); - var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(setting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var snapshotFilter = new List { new SnapshotSettingFilter(setting.Key) }; + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var configSnapshotName = GenerateSnapshotName(); var operation = client.CreateSnapshot(WaitUntil.Completed, configSnapshotName, settingsSnapshot); var createdSnapshot = operation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); Assert.NotNull(createdSnapshot); Assert.AreEqual(configSnapshotName, createdSnapshot.Name); - Assert.AreEqual(SnapshotStatus.Ready, createdSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Ready, createdSnapshot.Status); #region Snippet:AzConfigSample11_ArchiveSnapshot var snapshotName = "some_snapshot"; #if !SNIPPET snapshotName = configSnapshotName; #endif - ConfigurationSettingsSnapshot archivedSnapshot = client.ArchiveSnapshot(snapshotName); - Console.WriteLine($"Archived configuration setting snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); + ConfigurationSnapshot archivedSnapshot = client.ArchiveSnapshot(snapshotName); + Console.WriteLine($"Archived configuration snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); #endregion Assert.NotNull(archivedSnapshot); - Assert.AreEqual(SnapshotStatus.Archived, archivedSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Archived, archivedSnapshot.Status); } finally { @@ -219,35 +219,35 @@ public void RecoverSnapshot() { client.AddConfigurationSetting(setting); - var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(setting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var snapshotFilter = new List { new SnapshotSettingFilter(setting.Key) }; + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var configSnapshotName = GenerateSnapshotName(); var operation = client.CreateSnapshot(WaitUntil.Completed, configSnapshotName, settingsSnapshot); var createdSnapshot = operation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, status: {createdSnapshot.Status}"); Assert.NotNull(createdSnapshot); Assert.AreEqual(configSnapshotName, createdSnapshot.Name); - Assert.AreEqual(SnapshotStatus.Ready, createdSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Ready, createdSnapshot.Status); - ConfigurationSettingsSnapshot archivedSnapshot = client.ArchiveSnapshot(configSnapshotName); - Console.WriteLine($"Archived configuration setting snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); + ConfigurationSnapshot archivedSnapshot = client.ArchiveSnapshot(configSnapshotName); + Console.WriteLine($"Archived configuration snapshot: {archivedSnapshot.Name}, status: {archivedSnapshot.Status}"); - Assert.AreEqual(SnapshotStatus.Archived, archivedSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Archived, archivedSnapshot.Status); #region Snippet:AzConfigSample11_RecoverSnapshot var snapshotName = "some_snapshot"; #if !SNIPPET snapshotName = configSnapshotName; #endif - ConfigurationSettingsSnapshot recoveredSnapshot = client.RecoverSnapshot(snapshotName); - Console.WriteLine($"Recovered configuration setting snapshot: {recoveredSnapshot.Name}, status: {recoveredSnapshot.Status}"); + ConfigurationSnapshot recoveredSnapshot = client.RecoverSnapshot(snapshotName); + Console.WriteLine($"Recovered configuration snapshot: {recoveredSnapshot.Name}, status: {recoveredSnapshot.Status}"); #endregion Assert.NotNull(recoveredSnapshot); - Assert.AreEqual(SnapshotStatus.Ready, recoveredSnapshot.Status); + Assert.AreEqual(ConfigurationSnapshotStatus.Ready, recoveredSnapshot.Status); } finally { @@ -269,30 +269,30 @@ public void GetSnapshots() client.AddConfigurationSetting(firstSetting); client.AddConfigurationSetting(secondSetting); - var firstSnapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(firstSetting.Key) }); + var firstSnapshotFilter = new List { new SnapshotSettingFilter(firstSetting.Key) }; var firstSnapshotName = GenerateSnapshotName("first_snapshot"); - var firstOperation = client.CreateSnapshot(WaitUntil.Completed, firstSnapshotName, new ConfigurationSettingsSnapshot(firstSnapshotFilter)); + var firstOperation = client.CreateSnapshot(WaitUntil.Completed, firstSnapshotName, new ConfigurationSnapshot(firstSnapshotFilter)); var createdFirstSnapshot = firstOperation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdFirstSnapshot.Name}, status: {createdFirstSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdFirstSnapshot.Name}, status: {createdFirstSnapshot.Status}"); Assert.NotNull(createdFirstSnapshot); Assert.AreEqual(firstSnapshotName, createdFirstSnapshot.Name); - var secondSnapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(secondSetting.Key) }); + var secondSnapshotFilter = new List { new SnapshotSettingFilter(secondSetting.Key) }; var secondSnapshotName = GenerateSnapshotName("second_snapshot"); - var secondOperation = client.CreateSnapshot(WaitUntil.Completed, secondSnapshotName, new ConfigurationSettingsSnapshot(secondSnapshotFilter)); + var secondOperation = client.CreateSnapshot(WaitUntil.Completed, secondSnapshotName, new ConfigurationSnapshot(secondSnapshotFilter)); var createdSecondSnapshot = secondOperation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSecondSnapshot.Name}, status: {createdFirstSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSecondSnapshot.Name}, status: {createdFirstSnapshot.Status}"); Assert.NotNull(createdSecondSnapshot); Assert.AreEqual(secondSnapshotName, createdSecondSnapshot.Name); #region Snippet:AzConfigSample11_GetSnapshots var count = 0; - foreach (var item in client.GetSnapshots()) + foreach (var item in client.GetSnapshots(new SnapshotSelector())) { count++; - Console.WriteLine($"Retrieved configuration setting snapshot: {item.Name}, status {item.Status}"); + Console.WriteLine($"Retrieved configuration snapshot: {item.Name}, status {item.Status}"); } Console.WriteLine($"Total number of snapshots retrieved: {count}"); #endregion @@ -321,8 +321,8 @@ public void GetConfigurationSettingsForSnapshot() var secondSetting = new ConfigurationSetting("second_key", "second_value"); client.AddConfigurationSetting(secondSetting); - var snapshotFilter = new List(new SnapshotSettingFilter[] { new SnapshotSettingFilter(firstSetting.Key), new SnapshotSettingFilter(secondSetting.Key) }); - var settingsSnapshot = new ConfigurationSettingsSnapshot(snapshotFilter); + var snapshotFilter = new List { new SnapshotSettingFilter(firstSetting.Key), new SnapshotSettingFilter(secondSetting.Key) }; + var settingsSnapshot = new ConfigurationSnapshot(snapshotFilter); var snapshotName = "some_snapshot"; #if !SNIPPET @@ -330,7 +330,7 @@ public void GetConfigurationSettingsForSnapshot() #endif var operation = client.CreateSnapshot(WaitUntil.Completed, snapshotName, settingsSnapshot); var createdSnapshot = operation.Value; - Console.WriteLine($"Created configuration setting snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); + Console.WriteLine($"Created configuration snapshot: {createdSnapshot.Name}, Status: {createdSnapshot.Status}"); var count = 0; foreach (var item in client.GetConfigurationSettingsForSnapshot(snapshotName))