Class: AwsAssumeRole::Cli::Actions::ConfigureRoleAssumption

Inherits:
AbstractAction
  • Object
show all
Defined in:
lib/aws_assume_role/cli/actions/configure_role_assumption.rb

Constant Summary collapse

CommandSchema =
proc do
    required(:profile)
    required(:source_profile) { str? }
    optional(:region) { filled? > format?(REGION_REGEX) }
    optional(:serial_number) { filled? > format?(MFA_REGEX) }
    required(:role_session_name).filled?
    required(:role_arn) { filled? & format?(ROLE_REGEX) }
    required(:external_id).filled?
    required(:duration_seconds).filled?
    optional(:yubikey_oath_name)
end

Constants included from AwsAssumeRole

AwsAssumeRole::Config, DefaultProvider, VERSION

Constants included from Types

Types::ACCESS_KEY_REGEX, Types::ACCESS_KEY_VALIDATOR, Types::ARN_REGEX, Types::Credentials, Types::Dry, Types::EXTERNAL_ID_REGEX, Types::MFA_REGEX, Types::MfaSerial, Types::REGION_REGEX, Types::REGION_VALIDATOR, Types::ROLE_REGEX, Types::ROLE_SESSION_NAME_REGEX, Types::Region, Types::SECRET_ACCESS_KEY_REGEX, Types::SECRET_ACCESS_KEY_VALIDATOR

Instance Method Summary collapse

Methods inherited from AbstractAction

#initialize

Methods included from Logging

included

Methods included from Ui

ask_with_validation, error, input, out, pastel, show_validation_errors, t, validation_errors_to_s

Methods included from AwsAssumeRole

shared_config

Constructor Details

This class inherits a constructor from AwsAssumeRole::Cli::Actions::AbstractAction

Instance Method Details

#act_on(config) ⇒ Object



18
19
20
21
# File 'lib/aws_assume_role/cli/actions/configure_role_assumption.rb', line 18

def act_on(config)
    AwsAssumeRole.shared_config.save_profile(config.profile, config.to_h.compact)
    out format(t("commands.configure.saved"), config.profile, AwsAssumeRole.shared_config.config_path)
end