Class: Aws::SharedCredentials
- Inherits:
-
Credentials
- Object
- Credentials
- Aws::SharedCredentials
- Defined in:
- lib/aws-sdk-core/shared_credentials.rb
Constant Summary collapse
- KEY_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 'aws_access_key_id' => 'access_key_id', 'aws_secret_access_key' => 'secret_access_key', 'aws_session_token' => 'session_token', }
Instance Attribute Summary collapse
- #path ⇒ String readonly
- #profile_name ⇒ String readonly
Attributes inherited from Credentials
#access_key_id, #secret_access_key, #session_token
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SharedCredentials
constructor
Constructs a new SharedCredentials object.
- #inspect ⇒ Object private
-
#loadable? ⇒ Boolean
Returns ‘true` if a credential file exists and has appropriate read permissions at #path.
Methods inherited from Credentials
Constructor Details
#initialize(options = {}) ⇒ SharedCredentials
Constructs a new SharedCredentials object. This will load AWS access credentials from an ini file, which supports profiles. The default profile name is ‘default’. You can specify the profile name with the ‘ENV` or with the `:profile_name` option.
22 23 24 25 26 27 28 |
# File 'lib/aws-sdk-core/shared_credentials.rb', line 22 def initialize( = {}) @path = [:path] || default_path @profile_name = [:profile_name] @profile_name ||= ENV['AWS_PROFILE'] @profile_name ||= 'default' load_from_path if loadable? end |
Instance Attribute Details
#path ⇒ String (readonly)
31 32 33 |
# File 'lib/aws-sdk-core/shared_credentials.rb', line 31 def path @path end |
#profile_name ⇒ String (readonly)
34 35 36 |
# File 'lib/aws-sdk-core/shared_credentials.rb', line 34 def profile_name @profile_name end |
Instance Method Details
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 43 44 |
# File 'lib/aws-sdk-core/shared_credentials.rb', line 37 def inspect parts = [ self.class.name, "profile_name=#{profile_name.inspect}", "path=#{path.inspect}", ] "#<#{parts.join(' ')}>" end |
#loadable? ⇒ Boolean
50 51 52 |
# File 'lib/aws-sdk-core/shared_credentials.rb', line 50 def loadable? !path.nil? && File.exists?(path) && File.readable?(path) end |