Skip to content

feat: Add AppConfig parameter provider #559

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

Conversation

amirkaws
Copy link
Contributor

@amirkaws amirkaws commented Mar 1, 2024

Issue number: #558

Summary

This PR enhanced the parameters utility functionality and adds support for AppConfig and FeatureFlags

Changes

Parameters utility has been modified to add support for AppConfig

User experience

// Get AppConfig Provider instance
IAppConfigProvider appConfigProvider = ParametersManager.AppConfigProvider
    .DefaultApplication("MyApplicationId")
    .DefaultEnvironment("MyEnvironmentId")
    .DefaultConfigProfile("MyConfigProfileId");

// Retrieve a single configuration, latest version
IDictionary<string, string?> value = await appConfigProvider
    .GetAsync()
    .ConfigureAwait(false);
    
// Check if feature flag is enabled
var isFeatureFlagEnabled = await appConfigProvider
    .IsFeatureFlagEnabledAsync("MyFeatureFlag")
    .ConfigureAwait(false);

if (isFeatureFlagEnabled)
{
    // Retrieve an attribute value of the feature flag
    var strAttValue = await appConfigProvider
        .GetFeatureFlagAttributeValueAsync<string>("MyFeatureFlag", "StringAttribute")
        .ConfigureAwait(false);
    
    // Retrieve another attribute value of the feature flag
    var numberAttValue = await appConfigProvider
        .GetFeatureFlagAttributeValueAsync<int>("MyFeatureFlag", "NumberAttribute")
        .ConfigureAwait(false);
}

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@auto-assign auto-assign bot requested review from hjgraca and sliedig March 1, 2024 15:44
@boring-cyborg boring-cyborg bot added area/parameters documentation Improvements or additions to documentation tests labels Mar 1, 2024
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 1, 2024
Copy link

sonarqubecloud bot commented Mar 1, 2024

Quality Gate Passed Quality Gate passed

Issues
5 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
2.6% Duplication on New Code

See analysis details on SonarCloud

@github-actions github-actions bot added the feature New features or minor changes label Mar 1, 2024
Copy link
Contributor

@hjgraca hjgraca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!!!

@hjgraca
Copy link
Contributor

hjgraca commented Mar 4, 2024

cc @aviv-akhansari. AppConfig provider work

@aviv-akhansari
Copy link

This is awesome. Thank you.

@hjgraca hjgraca merged commit fa76593 into aws-powertools:develop Mar 5, 2024
@amirkaws amirkaws deleted the add-configuration-parameter-provider branch March 8, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/parameters documentation Improvements or additions to documentation feature New features or minor changes size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants