Class: AwsMfa

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_mfa.rb,
lib/aws_mfa/errors.rb,
lib/aws_mfa/shell_command.rb,
lib/aws_mfa/profile_config.rb,
lib/aws_mfa/credentials_loader.rb,
lib/aws_mfa/shell_command_result.rb

Defined Under Namespace

Classes: CredentialsLoader, Errors, ProfileConfig, ShellCommand, ShellCommandResult

Constant Summary collapse

ARN_CONFIG_FILE_PATH =
".aws/config"
MYDRIVE_CREDENTIALS_FILE_PATH =
'.mydrive-aws'

Instance Method Summary collapse

Constructor Details

#initializeAwsMfa

Returns a new instance of AwsMfa.



14
15
16
17
18
# File 'lib/aws_mfa.rb', line 14

def initialize
  verify_aws_installed
  @aws_config_file = find_aws_config_file
  @mydrive_credentials_cache_dir = set_mydrive_credentials_cache_dir
end

Instance Method Details

#execute(execution_output = :set_env, profile = nil) ⇒ Object



20
21
22
23
24
25
# File 'lib/aws_mfa.rb', line 20

def execute(execution_output = :set_env, profile = nil)
  aws_profile = profile || ENV['AWS_PROFILE'] || 'default'
  profile_config = load_profile_config(aws_profile)
  credentials = load_credentials(profile_config)
  execute_output(execution_output, credentials)
end