class AwsAssumeRole::Credentials::Factories::AssumeRole
Public Class Methods
new(options)
click to toggle source
# File lib/aws_assume_role/credentials/factories/assume_role.rb, line 12 def initialize(options) logger.debug "AwsAssumeRole::Credentials::Factories::AssumeRole initiated with #{options}" return unless options[:profile] || options[:role_arn] if options[:profile] logger.debug "AwsAssumeRole: #{options[:profile]} found. Trying with profile" try_with_profile(options) else if options[:use_mfa] options[:credentials] = AwsAssumeRole::Credentials::Providers::MfaSessionCredentials.new(options).credentials end @credentials = AwsAssumeRole::Credentials::Providers::AssumeRoleCredentials.new(options) end end
Public Instance Methods
assume_role_with_profile(options)
click to toggle source
# File lib/aws_assume_role/credentials/factories/assume_role.rb, line 36 def assume_role_with_profile(options) AwsAssumeRole.shared_config.assume_role_credentials_from_config(options) end
try_with_profile(options)
click to toggle source
# File lib/aws_assume_role/credentials/factories/assume_role.rb, line 26 def try_with_profile(options) return unless AwsAssumeRole.shared_config.config_enabled? logger.debug "AwsAssumeRole: Shared Config enabled" @profile = options[:profile] @region = options[:region] @credentials = assume_role_with_profile(options) @region ||= AwsAssumeRole.shared_config.profile_region(@profile) @role_arn ||= AwsAssumeRole.shared_config.profile_role(@profile) end