Skip to content

Conversation

@dave-fn
Copy link
Contributor

@dave-fn dave-fn commented Dec 22, 2022

Motivation and Context

Continue updating the API to pass Supplier<ProfileFile> to classes.

Modifications

Updated services/s3 classes using ProfileFile internally.

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 added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • 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

@dave-fn dave-fn requested a review from a team as a code owner December 22, 2022 00:42
Comment on lines -84 to +88
this.useArnRegionEnabled = FieldWithDefault.createLazy(builder.useArnRegionEnabled, this::resolveUseArnRegionEnabled);
this.multiRegionEnabled = FieldWithDefault.createLazy(builder.multiRegionEnabled, this::resolveMultiRegionEnabled);
this.useArnRegionEnabled = builder.useArnRegionEnabled;
this.multiRegionEnabled = builder.multiRegionEnabled;
Copy link
Contributor Author

@dave-fn dave-fn Dec 22, 2022

Choose a reason for hiding this comment

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

Changed so that these values are resolved per invocation, based on the active ProfileFile.

/**
* The supplier of profile file instances that should be consulted to determine the default value of
* {@link #useArnRegionEnabled(Boolean)} or {@link #multiRegionEnabled(Boolean)}.
* This is not used, if those parameters are configured.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: "configured on the builder"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.


System.clearProperty(AWS_CONFIG_FILE.property());
String falseConfigFile = getClass().getResource("ProfileFile_false").getFile();
System.setProperty(AWS_CONFIG_FILE.property(), falseConfigFile);
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: can you reset these in an @After method instead? Slightly safer to do in case this statement doesn't get reached during the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split test into two methods.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug B 3 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 273 Code Smells

78.3% 78.3% Coverage
4.5% 4.5% Duplication

@dave-fn dave-fn merged commit b88ea40 into feature/master/credentials-reload Jan 6, 2023
@dave-fn dave-fn deleted the davidfn/credentials-reload branch January 6, 2023 18:31
dave-fn added a commit that referenced this pull request Feb 6, 2023
* ProfileCredentialsProvider can now reload credentials when profile files change (#3487)

* ProfileFile can update if disk changed, reload as new instance

* ProfileCredentialsProvider reloads credentials if profile file has changes

* Created class ProfileFileRefresher

* Created ReloadingProfileCredentialsProvider; moved new logic in ProfileFile to ProfileFileRefresher

* Fix ReloadingProfileCredentialsBehavior when missing ProfileFile Supplier or Predicate, and dealing with defaults

* Consolidated ReloadingProfileCredentialsProvider functionality into ProfileCredentialsProvider

* Fix behavior when dealing with defaults

* Created ProfileFileSupplier interface; refactored

* Misc fixes

* Created package-private ProfileFileSupplierBuilder; ProfileFileSupplier now extends Supplier; Fixed Javadoc

* Fixed unit tests for default credentials file

* Removed ProfileFileSupplier.Builder interface

* Code cleanup

* ProfileFileSupplier API changes, aggregating (#3558)

* Added methods for aggregating ProfileFile objects

* Removed redundant logic, changelog entry

* Removed redundant methods

* Use compare and set to make thread safe

* DefaultCredentialsProvider reload profile (#3580)

* Misc fixes

* Reload credentials by DefaultCredentialsProvider; pass supplier to InstanceProfileCredentialsProvider

* Fix code alignment

* Update public APIs to Supplier<ProfileFile> instead of ProfileFileSupplier (#3607)

* ProfileTokenProvider Reload ProfileFile (#3608)

* Updated ProfileTokenProvider

* Updated tests, do not explicitly swallow exceptions

* ProfileTokenProviderLoader can use Supplier<Profilefile> internally

* Simplified ProfileTokenProviderLoader API; implemented synchronized block

* Use synchronized block (#3646)

* S3 support classes take Supplier<ProfileFile> (#3653)

* S3 support classes take Supplier<ProfileFile>

* Review comments

* Presigners, other Support classes take Supplier<ProfileFile> (#3677)

* Presigners, other Support classes take Supplier<ProfileFile>

* Split new ProfileFile tests from existing parameterized tests

* Improved tests readability

* ProfileFile updates to BaseClientBuilderClass, other S3 classes (#3685)

* Leverage SdkClientOption and SdkExecutionAttributes; fallback to simp… (#3692)

* Leverage SdkClientOption and SdkExecutionAttributes; fallback to simple ProfileFile

* Addressed review comments

* Updated changelog entry (#3699)

* Fixed review comments

* Removed unnecessary logic

* Deprecated SdkClientOption PROFILE_FILE

* Deprecated SdkExecutionAttribute PROFILE_FILE

* Updated changelog entry
aws-sdk-java-automation added a commit that referenced this pull request Feb 11, 2025
…2a9b8460d

Pull request: release <- staging/91f2699f-90d3-414d-8bbe-4c62a9b8460d
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