Skip to content

Implement configuration resolution#656

Draft
ubaskota wants to merge 6 commits intodevelopfrom
config_resolution_main
Draft

Implement configuration resolution#656
ubaskota wants to merge 6 commits intodevelopfrom
config_resolution_main

Conversation

@ubaskota
Copy link

Issue #, if available:

Description of changes:
This PR implements the following:

  • Config source interface and environment variable source
  • Config resolver that resolves config values from sources
  • Config property descriptor along with a custom resolver and validators
  • Updates codegen files that generate config.py to support config resolution for newly added config variables:
    • retry_strategy, region and sdk_ua_app_id (in progress)
  • Unit tests covering all newly implemented features

Tests

  • Manual tests verifying config resolution for the added config variables
  • End-to-end tests from the generated client confirming expected resolution behavior
  • All existing tests pass

Note: There are 2 minor PRs yet to be merged.

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

…g resolution (#640)

* Add config source interface and environment variable source
* Add a ConfigResolver that goes through the list of sources to resolve config value
…idators (#642)

* Add a config property descriptor along with a custom resolver and validators
…solution. (#646)

* Update the codegen files that generate config.py to support config resolution.
* Replace raw source strings with typed SourceInfo dataclasses
* Add support for sdk_ua_app_id
.nullable(false)
.initialize(writer -> writer.write("self.interceptors = interceptors or []"))
.build(),
ConfigProperty.builder()
Copy link
Contributor

Choose a reason for hiding this comment

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

This diff is a little odd; I would expect no diff in this directory at all (or the parent one). Can you reset this to what's in develop?

I don't think there are any changes here?

}

/**
* @return Returns the validator symbol for this property, if any.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't these changes be in the AWS file directory and be added as a hook or similar? I'd expect this code to live alongside AWSConfiguration, etc. since this is AWS specific?

For instance, you can't use defaultValue for a generic SDK, or a descriptor, or anything and expect it to work.

This descriptor handles:
- Lazy resolution from sources (only on first access)
- Custom resolution for variables requiring complex resolution
- Caching of resolved values
Copy link
Contributor

Choose a reason for hiding this comment

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

It only handles the cache key and retrieval of the cached value, right? It doesn't store the cached values itself (though maybe it should?)

{"retry_mode": "environment", "max_attempts": "default"}
"""

retry_mode, mode_source = resolver.get("retry_mode")
Copy link
Contributor

Choose a reason for hiding this comment

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

For a future PR, I think I may want to see some of this restructured. How would you feel about (in the future) having the resolver accept a ConfigProperty object. The ConfigProperty could hold its own overrides, so it would know how to fetch itself from each source when non-default.

There's a lot of complex tradeoffs here that cause conflicting requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants