Skip to content

[Default Configuration Part 3]: add defaults from defaults mode to the configuration resolution chain #2803

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
merged 4 commits into from
Nov 2, 2021

Conversation

zoewangg
Copy link
Contributor

@zoewangg zoewangg commented Oct 28, 2021

Motivation and Context

Description

  • adding codegen change for DefaultConfigurationConfiguration which contains the default settings for each mode
  • adding defaults from defaults mode to the configuration resolution chain

Testing

added unit tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

Comment on lines +171 to 173
.build();

return configuration.toBuilder()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we save a reference to the builder, rather than repeatedly calling toBuilder()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some of the methods requires certain option to be available in the configuration itself, e.g., resolveCredentials requires config.option(AwsClientOption.AWS_REGION). If we don't call .build(), it'll be null. The Builder class doesn't expose attributes. Not sure if it is intentional, so I didn't change it.

Comment on lines 260 to 261
DefaultsMode finalDefaultsMode = defaultsMode;
log.debug(() -> "The resolved defaults mode is: " + finalDefaultsMode);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a ugly workaround forVariable used in lambda expression should be final or effectively final rule. LMK if you can think of a cleaner workaround.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, not a fan of that limitation. Let us do what we know is safe. :)

Nit: How about adjusting the wording to something like this:

Resolved {serviceName} client's AUTO configuration mode to {result}

Copy link
Contributor

Choose a reason for hiding this comment

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

On second thought, should we try to refer to the precise client name, e.g., S3Client vs S3AsyncClient?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if it's necessary because I don't think most customers use both sync and async clients for the same service.

@zoewangg zoewangg force-pushed the zoewang/defaults-mode-3 branch from cc0d247 to 5dbb31b Compare October 28, 2021 23:10
@zoewangg zoewangg force-pushed the zoewang/defaults-mode-3 branch from 5dbb31b to b749805 Compare October 28, 2021 23:27
Comment on lines 260 to 261
DefaultsMode finalDefaultsMode = defaultsMode;
log.debug(() -> "The resolved defaults mode is: " + finalDefaultsMode);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, not a fan of that limitation. Let us do what we know is safe. :)

Nit: How about adjusting the wording to something like this:

Resolved {serviceName} client's AUTO configuration mode to {result}

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 1, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

95.6% 95.6% Coverage
0.0% 0.0% Duplication

@zoewangg zoewangg merged commit 4abe11e into feature/master/defaults-mode Nov 2, 2021
@zoewangg zoewangg deleted the zoewang/defaults-mode-3 branch November 2, 2021 02:04
zoewangg added a commit that referenced this pull request Dec 17, 2021
* Add support to generate DefaultsMode and implement configuration resolution (#2781)

* [Default Configuration Part 2]:Implement auto mode discovery (#2786)

* Implement auto mode discovery

* Fix tests on CodeBuild

* Address feedback

* Add comment and rename misnamed constant

* [Default Configuration Part 3]: add defaults from defaults mode to the configuration resolution chain (#2803)

* Wiring up configuration

* Address comments

* Add test

* Update debug statement and add singleton for AttributeMap

* Add tlsNegotiationTimeout (#2814)

* [Default Configuration Part 5]: Move default configuration related classes to aws-core (#2816)

* Move default configuration related classes to aws-core

* Remove extra space and fix build

* [Default Configuration Part 6]: apply default s3 us-east-1 regional setting (#2825)

* Add s3 regional setting

* Rename option name

* Fix checkstyle

* Update sdk-default-configuraiton.json

* Add changelog entry
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