Sha256: 106e184e768994c9b3fdb60e37b4cc21c77ef775912aa433a8ef4ba0fe3069dd
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require_relative "includes" require_relative "../../runner" require_relative "../../credentials/factories/default_chain_provider" class AwsAssumeRole::Cli::Actions::Run < AwsAssumeRole::Cli::Actions::AbstractAction include AwsAssumeRole::Ui CommandSchema = proc do required(:profile).maybe optional(:region) { filled? > format?(REGION_REGEX) } optional(:serial_number) { filled? > format?(MFA_REGEX) } required(:role_arn).maybe required(:role_session_name).maybe required(:duration_seconds).maybe rule(role_specification: [:profile, :role_arn, :role_session_name, :duration_seconds]) do |p, r, s, d| (p.filled? | p.empty? & r.filled?) & (r.filled? > s.filled? & d.filled?) end end def act_on(config) credentials = try_for_credentials config.to_h unless config.args.empty? Runner.new(command: config.args, environment: { "AWS_DEFAULT_REGION" => resolved_region }, credentials: credentials) end rescue KeyError, Aws::Errors::NoSuchProfileError error format(t("errors.NoSuchProfileError"), config.profile) raise rescue Aws::Errors::MissingCredentialsError error t("errors.MissingCredentialsError") raise end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aws_assume_role-0.2.0 | lib/aws_assume_role/cli/actions/run.rb |
aws_assume_role-0.1.2 | lib/aws_assume_role/cli/actions/run.rb |