Class: Aws::Session::Credentials::CredentialFile
- Inherits:
-
Object
- Object
- Aws::Session::Credentials::CredentialFile
- Includes:
- FileProvider::IniFileProvider, ProfileStorage
- Defined in:
- lib/aws/session/credentials/credential_file.rb
Overview
Holds credentials that are read by AWS SDKs
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #default_path ⇒ Object
-
#initialize(options = {}) ⇒ CredentialFile
constructor
A new instance of CredentialFile.
- #profiles_hash ⇒ Hash<String,Hash>
- #profiles_hash=(hsh) ⇒ Object
Methods included from ProfileStorage
#print_profiles, #profile, #profiles, #profiles=, #set_profile
Methods included from FileProvider::IniFileProvider
Constructor Details
#initialize(options = {}) ⇒ CredentialFile
Returns a new instance of CredentialFile.
11 12 13 |
# File 'lib/aws/session/credentials/credential_file.rb', line 11 def initialize( = {}) @path = File.([:path] || default_path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/aws/session/credentials/credential_file.rb', line 9 def path @path end |
Instance Method Details
#default_path ⇒ Object
15 16 17 |
# File 'lib/aws/session/credentials/credential_file.rb', line 15 def default_path File.join(%w(~ .aws credentials)) end |
#profiles_hash ⇒ Hash<String,Hash>
20 21 22 |
# File 'lib/aws/session/credentials/credential_file.rb', line 20 def profiles_hash read.to_h end |
#profiles_hash=(hsh) ⇒ Object
25 26 27 |
# File 'lib/aws/session/credentials/credential_file.rb', line 25 def profiles_hash=(hsh) hsh.each { |key, value| self[key] = value } end |