Class: AwsAssumeRole::Credentials::Providers::SharedKeyringCredentials

Inherits:
Aws::SharedCredentials
  • Object
show all
Includes:
Logging
Defined in:
lib/aws_assume_role/credentials/providers/shared_keyring_credentials.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

included

Constructor Details

#initialize(options = {}) ⇒ SharedKeyringCredentials

Returns a new instance of SharedKeyringCredentials.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/aws_assume_role/credentials/providers/shared_keyring_credentials.rb', line 10

def initialize(options = {})
    logger.debug "SharedKeyringCredentials initiated with #{options}"
    @path = options[:path]
    @path ||= AwsAssumeRole.shared_config.credentials_path
    @profile_name = options[:profile_name] ||= options[:profile]
    @profile_name ||= ENV["AWS_PROFILE"]
    @profile_name ||= AwsAssumeRole.shared_config.profile_name
    logger.debug "SharedKeyringCredentials resolved profile name #{@profile_name}"
    config = determine_config(@path, @profile_name)
    @role_arn = config.profile_hash(@profile_name)
    @region = config.profile_region(@profile_name)
    @role_arn = config.profile_role(@profile_name)
    attempted_credential = config.credentials(options)
    return unless attempted_credential && attempted_credential.set?
    @credentials = attempted_credential
end

Instance Attribute Details

#regionObject (readonly)

Returns the value of attribute region.



8
9
10
# File 'lib/aws_assume_role/credentials/providers/shared_keyring_credentials.rb', line 8

def region
  @region
end

#role_arnObject (readonly)

Returns the value of attribute role_arn.



8
9
10
# File 'lib/aws_assume_role/credentials/providers/shared_keyring_credentials.rb', line 8

def role_arn
  @role_arn
end