=begin pod

=head1 NAME

AWS::Credentials::Provider::FromEnv - Load credentials from environment variables

=head1 SYNOPSIS

    use AWS::Credentials;

    my $creds = load-credentials();

=head1 DESCRIPTION

There are some standard environment variables which are typically expected to
contain AWS credentials. These include:

    AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY
    AWS_SECURITY_TOKEN
    AWS_SESSION_TOKEN
    AWS_CREDENTIAL_EXPIRATION

These environment variables will be used to load credentials if one is set for
the C<access-key>.

=head1 ATTRIBUTES

Some developers like to provide alternate environment variables and this class
can be modified to support this. Four attributes are provided to select which
environment variables are used.

For example, if you prefer to load your access key and secret key from
C<AWS_ACCESS_KEY> and C<AWS_SECRET_KEY> instead of the usual environment names,
you could:

    my $resolver = AWS::Credentials::Provider::Resolver.DEFAULT;
    $resolver.providers.unshift(
        AWS::Credentials::Provider::FromEnv.new(
            access-key => 'AWS_ACCESS_KEY',
            secret-key => 'AWS_SECRET_KEY',
        )
    );

    my $creds = load-credentials(:$resolver);

This code adds a new provider to the resolver that prefers the credentials in
the named environment variables.

=head2 access-key

The list of environment variables to use to find the access key. Defaults to
just searching C<AWS_ACCESS_KEY_ID>.

=head2 secret-key

The list of environment variables to use to find the secret key. Defaults to
just searching C<AWS_SECRET_ACESS_KEY>.

=head2 token

The list of environment variables to use to find the session token.
Defaults to searching C<AWS_SECURITY_TOKEN> and then
C<AWS_SESSION_TOKEN>.

=head2 expiry-time

The list of environment variables to use to find the expiry time. Defaults to
just searching C<AWS_CREDENTIAL_EXPIRATION>.

If an expiry-time is found, the object returned is a
C<AWS::Credentials::Refreshable> with the expiry-time set to the parsed
L<DateTime>.

=end pod
