This module is mixed into the various credential provider classes. It provides a unified interface for getting credentials and refreshing them.
The list of possible keys in the hash returned by {#credentials}.
@return [String] Returns the AWS access key id. @raise (see credentials)
# File lib/aws/core/credential_providers.rb, line 52 def access_key_id credentials[:access_key_id] end
@return [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+.
@raise [Errors::MissingCredentialsError] Raised when the
+:access_key_id+ or the +:secret_access_key+ can not be found.
# File lib/aws/core/credential_providers.rb, line 39 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
Clears out cached/memoized credentials. Causes the provider to refetch credentials from the source. @return [nil]
# File lib/aws/core/credential_providers.rb, line 72 def refresh @cached_credentials = nil end
@return [String] Returns the AWS secret access key. @raise (see credentials)
# File lib/aws/core/credential_providers.rb, line 58 def secret_access_key credentials[:secret_access_key] end
@return [String,nil] Returns the AWS session token or nil if these
are not session credentials.
@raise (see credentials)
# File lib/aws/core/credential_providers.rb, line 65 def session_token credentials[:session_token] end
This method is called on a credential provider to fetch credentials. The credentials hash returned from this method will be cashed until the client calls {#refresh}. @return [Hash]
# File lib/aws/core/credential_providers.rb, line 82 def get_credentials # should be defined in provider classes. raise NotImplementedError end