This repository has been archived by the owner on May 28, 2020. It is now read-only.
Use CredentialsProviders à la the Java API (NOT YET DOCUMENTED) #25
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.
This PR changes
Net::Amazon::S3
to useCredentialsProvider
s instead of only fixed credentials to access S3 (while maintaining backwards compatibility). The addedCredentialsProvider
implementations match the official Java SDK (minus the one using JVM properties for obvious reasons), and the default forcredentials_provider
matches as well.In practice, what this means is that if you create a new
Net::Amazon::S3
instance with no credentials, it will check theAWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
environment variables (also the less-usedAWS_SESSION_TOKEN
), and if those are not set it will look for credentials provided by instance metadata on EC2 instances with attached IAM roles. Previously-working scripts should still work: If credentials are provided to the constructor instead of aCredentialsProvider
, then we create aFixedCredentialsProvider
under the hood using the supplied creds.Note that this is my first time working with Moose and I have not yet learned how to write POD documentation, so this is as-yet undocumented and may contain obvious mistakes. I'm happy to take the time to learn to document this, but before I do so I'd like to know if this change is conceivably welcome or not.