-
Notifications
You must be signed in to change notification settings - Fork 45
Loading feature flags from new endpoint #738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
linglingye001
wants to merge
24
commits into
preview
Choose a base branch
from
linglingye/exclude-classic-ff
base: preview
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e26aa07
rebase
linglingye001 7dc2d28
update
linglingye001 c838dae
update
linglingye001 63b2350
wip
linglingye001 ad9bb52
map SDK feature flags to the internal model and share the adapter's e…
linglingye001 d3b6013
update
linglingye001 3abc98d
use dedicated FeatureFlagClient
linglingye001 38cb4be
update
linglingye001 0817cbb
update
linglingye001 d1bafd4
resolve comments, separate classic ff and new ff, introduce IAppConfi…
linglingye001 20da894
update
linglingye001 8fdcde3
update
linglingye001 b847fba
resolve comments
linglingye001 21c4b63
resolve comments
linglingye001 168e6af
resovle comments, new ff index start from class ff count
linglingye001 2735cea
rename clientmanager
linglingye001 5114392
resolve comments
linglingye001 e2b5a0c
fix test
linglingye001 a389686
update
linglingye001 0eecf30
add tests
linglingye001 a1e6d92
update
linglingye001 1c96700
remove ExcludeClassicFeatureFlags property in FeatureFlagOptions
linglingye001 4edb07d
add tracing for enhanced feature flags
linglingye001 354dde3
rename new feature flag to 'enhanced feature flag' and drop 'classic'…
linglingye001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/Microsoft.Extensions.Configuration.AzureAppConfiguration/Afd/AfdClientManager.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
| // | ||
| using Azure.Data.AppConfiguration; | ||
| using Microsoft.Extensions.Azure; | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Afd | ||
| { | ||
| internal class AfdClientManager : IAppConfigurationClientManager | ||
| { | ||
| private readonly AppConfigurationClient _clientWrapper; | ||
|
|
||
| public AfdClientManager( | ||
| IAzureClientFactory<ConfigurationClient> configurationClientFactory, | ||
| IAzureClientFactory<FeatureFlagClient> featureFlagClientFactory, | ||
| Uri endpoint) | ||
| { | ||
| if (configurationClientFactory == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(configurationClientFactory)); | ||
| } | ||
|
|
||
| if (featureFlagClientFactory == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(featureFlagClientFactory)); | ||
| } | ||
|
|
||
| if (endpoint == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(endpoint)); | ||
| } | ||
|
|
||
| _clientWrapper = new AppConfigurationClient( | ||
| endpoint, | ||
| configurationClientFactory.CreateClient(endpoint.AbsoluteUri), | ||
| featureFlagClientFactory.CreateClient(endpoint.AbsoluteUri)); | ||
| } | ||
|
|
||
| public IEnumerable<IAppConfigurationClient> GetClients() | ||
| { | ||
| return new List<IAppConfigurationClient> { _clientWrapper }; | ||
| } | ||
|
|
||
| public void RefreshClients() | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| public bool UpdateSyncToken(Uri endpoint, string syncToken) | ||
| { | ||
| return false; | ||
| } | ||
| } | ||
| } |
57 changes: 0 additions & 57 deletions
57
...osoft.Extensions.Configuration.AzureAppConfiguration/Afd/AfdConfigurationClientManager.cs
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AppConfigurationClient.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
| // | ||
| using Azure; | ||
| using Azure.Data.AppConfiguration; | ||
| using System; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Microsoft.Extensions.Configuration.AzureAppConfiguration | ||
| { | ||
| /// <summary> | ||
| /// The default <see cref="IAppConfigurationClient"/> implementation. It holds a | ||
| /// <see cref="ConfigurationClient"/> for key-values (including feature flags) and a | ||
| /// <see cref="FeatureFlagClient"/> for enhanced feature flags served by the dedicated feature-flag endpoint, | ||
| /// both targeting the same <see cref="Endpoint"/>. | ||
| /// </summary> | ||
| internal class AppConfigurationClient : IAppConfigurationClient | ||
| { | ||
| private readonly ConfigurationClient _configurationClient; | ||
| private readonly FeatureFlagClient _featureFlagClient; | ||
|
|
||
| public AppConfigurationClient(Uri endpoint, ConfigurationClient configurationClient, FeatureFlagClient featureFlagClient) | ||
| { | ||
| Endpoint = endpoint; | ||
| _configurationClient = configurationClient ?? throw new ArgumentNullException(nameof(configurationClient)); | ||
| _featureFlagClient = featureFlagClient ?? throw new ArgumentNullException(nameof(featureFlagClient)); | ||
| } | ||
|
|
||
| public Uri Endpoint { get; } | ||
|
|
||
| public AsyncPageable<ConfigurationSetting> GetConfigurationSettingsAsync(SettingSelector selector, CancellationToken cancellationToken) | ||
| { | ||
| return _configurationClient.GetConfigurationSettingsAsync(selector, cancellationToken); | ||
| } | ||
|
|
||
| public AsyncPageable<ConfigurationSetting> CheckConfigurationSettingsAsync(SettingSelector selector, CancellationToken cancellationToken) | ||
| { | ||
| return _configurationClient.CheckConfigurationSettingsAsync(selector, cancellationToken); | ||
| } | ||
|
|
||
| public Task<Response<ConfigurationSetting>> GetConfigurationSettingAsync(string key, string label, CancellationToken cancellationToken) | ||
| { | ||
| return _configurationClient.GetConfigurationSettingAsync(key, label, cancellationToken); | ||
| } | ||
|
|
||
| public Task<Response<ConfigurationSetting>> GetConfigurationSettingAsync(ConfigurationSetting setting, bool onlyIfChanged, CancellationToken cancellationToken) | ||
| { | ||
| return _configurationClient.GetConfigurationSettingAsync(setting, onlyIfChanged, cancellationToken); | ||
| } | ||
|
|
||
| public Task<Response<ConfigurationSnapshot>> GetSnapshotAsync(string snapshotName, CancellationToken cancellationToken) | ||
| { | ||
| return _configurationClient.GetSnapshotAsync(snapshotName, cancellationToken: cancellationToken); | ||
| } | ||
|
|
||
| public AsyncPageable<ConfigurationSetting> GetConfigurationSettingsForSnapshotAsync(string snapshotName, CancellationToken cancellationToken) | ||
| { | ||
| return _configurationClient.GetConfigurationSettingsForSnapshotAsync(snapshotName, cancellationToken); | ||
| } | ||
|
|
||
| public AsyncPageable<FeatureFlag> GetFeatureFlagsAsync(FeatureFlagSelector selector, CancellationToken cancellationToken) | ||
| { | ||
| return _featureFlagClient.GetFeatureFlagsAsync(selector, cancellationToken); | ||
| } | ||
|
|
||
| public void UpdateSyncToken(string syncToken) | ||
| { | ||
| _configurationClient.UpdateSyncToken(syncToken); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.