-
Notifications
You must be signed in to change notification settings - Fork 10
Load feature flags from new endpoint #190
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
Merged
linglingye001
merged 6 commits into
release/v2.7.0-preview
from
linglingye/load-new-flags
Sep 1, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2ae626b
Load feature flags from new endpoint
linglingye001 40e4201
update conditional request
linglingye001 a5b0af1
resolve comments
linglingye001 a49ecdf
update enhanced ff filter parameter/variant value handling
linglingye001 3092b89
dependency update
linglingye001 2e4d3f6
dependency upgrade
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,92 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package loader | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/Azure/azure-sdk-for-go/sdk/azcore" | ||
| "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" | ||
| azappconfig "github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig/v2" | ||
| ) | ||
|
|
||
| // AppConfigurationClient abstracts the Azure App Configuration operations used by the provider. | ||
| type AppConfigurationClient interface { | ||
| // Key-value configuration operations. | ||
| NewListSettingsPager(selector azappconfig.SettingSelector, options *azappconfig.ListSettingsOptions) *runtime.Pager[azappconfig.ListSettingsPageResponse] | ||
| GetSetting(ctx context.Context, key string, options *azappconfig.GetSettingOptions) (azappconfig.GetSettingResponse, error) | ||
| GetSnapshot(ctx context.Context, snapshotName string, options *azappconfig.GetSnapshotOptions) (azappconfig.GetSnapshotResponse, error) | ||
| NewListSettingsForSnapshotPager(snapshotName string, options *azappconfig.ListSettingsForSnapshotOptions) *runtime.Pager[azappconfig.ListSettingsForSnapshotResponse] | ||
|
|
||
| // Feature flag operations served by the enhanced feature flag endpoint. | ||
| NewListFeatureFlagsPager(selector azappconfig.FeatureFlagSelector, options *azappconfig.ListFeatureFlagsOptions) *runtime.Pager[azappconfig.ListFeatureFlagsPageResponse] | ||
| } | ||
|
|
||
| type appConfigurationClient struct { | ||
| configurationClient *azappconfig.Client | ||
| featureFlagClient *azappconfig.FeatureFlagClient | ||
| } | ||
|
|
||
| func NewAppConfigurationClient(endpoint string, credential azcore.TokenCredential, options *azappconfig.ClientOptions) (AppConfigurationClient, error) { | ||
| configurationClient, err := azappconfig.NewClient(endpoint, credential, options) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| featureFlagClient, err := azappconfig.NewFeatureFlagClient(endpoint, credential, featureFlagClientOptions(options)) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return &appConfigurationClient{ | ||
| configurationClient: configurationClient, | ||
| featureFlagClient: featureFlagClient, | ||
| }, nil | ||
| } | ||
|
|
||
| func NewAppConfigurationClientFromConnectionString(connectionString string, options *azappconfig.ClientOptions) (AppConfigurationClient, error) { | ||
| configurationClient, err := azappconfig.NewClientFromConnectionString(connectionString, options) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| featureFlagClient, err := azappconfig.NewFeatureFlagClientFromConnectionString(connectionString, featureFlagClientOptions(options)) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return &appConfigurationClient{ | ||
| configurationClient: configurationClient, | ||
| featureFlagClient: featureFlagClient, | ||
| }, nil | ||
| } | ||
|
|
||
| // featureFlagClientOptions mirrors the configuration client options onto feature flag client options | ||
| func featureFlagClientOptions(options *azappconfig.ClientOptions) *azappconfig.FeatureFlagClientOptions { | ||
| if options == nil { | ||
| return nil | ||
| } | ||
|
|
||
| return &azappconfig.FeatureFlagClientOptions{ClientOptions: options.ClientOptions} | ||
| } | ||
|
|
||
| func (c *appConfigurationClient) NewListSettingsPager(selector azappconfig.SettingSelector, options *azappconfig.ListSettingsOptions) *runtime.Pager[azappconfig.ListSettingsPageResponse] { | ||
| return c.configurationClient.NewListSettingsPager(selector, options) | ||
| } | ||
|
|
||
| func (c *appConfigurationClient) GetSetting(ctx context.Context, key string, options *azappconfig.GetSettingOptions) (azappconfig.GetSettingResponse, error) { | ||
| return c.configurationClient.GetSetting(ctx, key, options) | ||
| } | ||
|
|
||
| func (c *appConfigurationClient) GetSnapshot(ctx context.Context, snapshotName string, options *azappconfig.GetSnapshotOptions) (azappconfig.GetSnapshotResponse, error) { | ||
| return c.configurationClient.GetSnapshot(ctx, snapshotName, options) | ||
| } | ||
|
|
||
| func (c *appConfigurationClient) NewListSettingsForSnapshotPager(snapshotName string, options *azappconfig.ListSettingsForSnapshotOptions) *runtime.Pager[azappconfig.ListSettingsForSnapshotResponse] { | ||
| return c.configurationClient.NewListSettingsForSnapshotPager(snapshotName, options) | ||
| } | ||
|
|
||
| func (c *appConfigurationClient) NewListFeatureFlagsPager(selector azappconfig.FeatureFlagSelector, options *azappconfig.ListFeatureFlagsOptions) *runtime.Pager[azappconfig.ListFeatureFlagsPageResponse] { | ||
| return c.featureFlagClient.NewListFeatureFlagsPager(selector, options) | ||
| } |
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.