Sha256: b06590656c37fe03f2beb723234ab3a9bb502c5a2c2a4134141f2e4382306600
Contents?: true
Size: 1.32 KB
Versions: 43
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true 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: %i[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
43 entries across 43 versions & 1 rubygems