class Aws::SharedCredentials
Constants
- KEY_MAP
@api private
Attributes
credentials[R]
@return [Credentials]
path[R]
@return [String]
profile_name[R]
@return [String]
Public Class Methods
new(options = {})
click to toggle source
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.
@option [String] :path Path to the shared file. Defaults
to "#{Dir.home}/.aws/credentials".
@option [String] :profile_name Defaults to 'default' or
`ENV['AWS_PROFILE']`.
# File lib/aws-sdk-core/shared_credentials.rb, line 24 def initialize(options = {}) shared_config = Aws.shared_config @path = options[:path] @path ||= shared_config.credentials_path @profile_name = options[:profile_name] @profile_name ||= ENV['AWS_PROFILE'] @profile_name ||= shared_config.profile_name if @path && @path == shared_config.credentials_path @credentials = shared_config.credentials(profile: @profile_name) else config = SharedConfig.new( credentials_path: @path, profile_name: @profile_name ) @credentials = config.credentials(profile: @profile_name) end end
Public Instance Methods
inspect()
click to toggle source
@api private
# File lib/aws-sdk-core/shared_credentials.rb, line 52 def inspect parts = [ self.class.name, "profile_name=#{profile_name.inspect}", "path=#{path.inspect}", ] "#<#{parts.join(' ')}>" end
loadable?()
click to toggle source
@deprecated This method is no longer used. @return [Boolean] Returns `true` if a credential file
exists and has appropriate read permissions at {#path}.
@note This method does not indicate if the file found at {#path}
will be parsable, only if it can be read.
# File lib/aws-sdk-core/shared_credentials.rb, line 66 def loadable? !path.nil? && File.exist?(path) && File.readable?(path) end