pfig/net-amazon-s3 — pull request #25 by shlevy (2013-08-29 11:20:36+00:00)
Title: Use CredentialsProviders à la the Java API (NOT YET DOCUMENTED)

This PR changes `Net::Amazon::S3` to use `CredentialsProvider`s instead of only fixed credentials to access S3 (while maintaining backwards compatibility). The added `CredentialsProvider` implementations match the official Java SDK (minus the one using JVM properties for obvious reasons), and the default for `credentials_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 the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables (also the less-used `AWS_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 a `CredentialsProvider`, then we create a `FixedCredentialsProvider` 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.