Class: AwsAssumeRole::Cli::Actions::ConfigureProfile
- Inherits:
-
AbstractAction
- Object
- AbstractAction
- AwsAssumeRole::Cli::Actions::ConfigureProfile
- Defined in:
- lib/aws_assume_role/cli/actions/configure_profile.rb
Constant Summary collapse
- CommandSchema =
proc do required(:profile) optional(:region) { filled? > format?(REGION_REGEX) } optional(:mfa_serial) optional(:profile_name) 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
Methods included from Logging
Methods included from Ui
ask_with_validation, error, input, out, pastel, show_validation_errors, t, validation_errors_to_s
Methods included from AwsAssumeRole
Constructor Details
This class inherits a constructor from AwsAssumeRole::Cli::Actions::AbstractAction
Instance Method Details
#act_on(config) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/aws_assume_role/cli/actions/configure_profile.rb', line 15 def act_on(config) new_hash = config.to_h profile = config.profile || prompt_for_option(:profile_name, "profile", proc { filled? }) new_hash[:region] = prompt_for_option(:region, "region", proc { filled? > format?(REGION_REGEX) }) new_hash[:aws_access_key_id] = prompt_for_option(:aws_access_key_id, "aws_access_key_id", ACCESS_KEY_VALIDATOR) new_hash[:aws_secret_access_key] = prompt_for_option(:aws_secret_access_key, "aws_secret_access_key", proc { filled? }) AwsAssumeRole.shared_config.save_profile(profile, new_hash) out format(t("commands.configure.saved"), profile, AwsAssumeRole.shared_config.config_path) end |