Module: AWS::Core::CredentialProviders::Provider
- Included in:
- DefaultProvider, EC2Provider, ENVProvider, SessionProvider
- Defined in:
- lib/aws/core/credential_providers.rb
Overview
This module is mixed into the various credential provider classes. It provides a unified interface for getting credentials and refreshing them.
Constant Summary collapse
- KEYS =
The list of possible keys in the hash returned by #credentials.
Set[:access_key_id, :secret_access_key, :session_token]
Instance Method Summary collapse
-
#access_key_id ⇒ String
Returns the AWS access key id.
-
#credentials ⇒ Hash
Returns a hash of credentials containg at least the
:access_key_id
and:secret_access_key
. -
#refresh ⇒ nil
Clears out cached/memoized credentials.
-
#secret_access_key ⇒ String
Returns the AWS secret access key.
-
#session_token ⇒ String?
Returns the AWS session token or nil if these are not session credentials.
Instance Method Details
#access_key_id ⇒ String
Returns the AWS access key id.
51 52 53 |
# File 'lib/aws/core/credential_providers.rb', line 51 def access_key_id credentials[:access_key_id] end |
#credentials ⇒ Hash
Returns a hash of credentials containg at least the :access_key_id
and :secret_access_key
. The hash may also contain a :session_token
.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/aws/core/credential_providers.rb', line 38 def credentials @cached_credentials ||= begin creds = get_credentials unless creds[:access_key_id] and creds[:secret_access_key] raise Errors::MissingCredentialsError end creds end @cached_credentials.dup end |
#refresh ⇒ nil
Clears out cached/memoized credentials. Causes the provider to refetch credentials from the source.
71 72 73 |
# File 'lib/aws/core/credential_providers.rb', line 71 def refresh @cached_credentials = nil end |
#secret_access_key ⇒ String
Returns the AWS secret access key.
57 58 59 |
# File 'lib/aws/core/credential_providers.rb', line 57 def secret_access_key credentials[:secret_access_key] end |
#session_token ⇒ String?
Returns the AWS session token or nil if these are not session credentials.
64 65 66 |
# File 'lib/aws/core/credential_providers.rb', line 64 def session_token credentials[:session_token] end |