Sha256: fd7d26c217ecde859fc32ee8bb64484fb4ee24ab0efbcb62aaf0266770356063
Contents?: true
Size: 1.11 KB
Versions: 43
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true require_relative "abstract_action" require_relative "../../store/shared_config_with_keyring" class AwsAssumeRole::Cli::Actions::ConfigureProfile < AwsAssumeRole::Cli::Actions::AbstractAction CommandSchema = proc do required(:profile) optional(:region) { filled? > format?(REGION_REGEX) } optional(:mfa_serial) optional(:profile_name) optional(:yubikey_oath_name) end 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 end
Version data entries
43 entries across 43 versions & 1 rubygems