aws_assume_role 1.1.0-universal-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +57 -0
- data/.ruby-version +1 -0
- data/.simplecov +22 -0
- data/.travis.yml +24 -0
- data/CHANGELOG.md +61 -0
- data/Gemfile +18 -0
- data/LICENSE.md +201 -0
- data/README.md +303 -0
- data/Rakefile +63 -0
- data/aws_assume_role.gemspec +56 -0
- data/bin/aws-assume-role +4 -0
- data/i18n/en.yml +109 -0
- data/lib/aws_assume_role.rb +4 -0
- data/lib/aws_assume_role/cli.rb +20 -0
- data/lib/aws_assume_role/cli/actions/abstract_action.rb +61 -0
- data/lib/aws_assume_role/cli/actions/configure_profile.rb +24 -0
- data/lib/aws_assume_role/cli/actions/configure_role_assumption.rb +22 -0
- data/lib/aws_assume_role/cli/actions/console.rb +70 -0
- data/lib/aws_assume_role/cli/actions/delete_profile.rb +22 -0
- data/lib/aws_assume_role/cli/actions/includes.rb +12 -0
- data/lib/aws_assume_role/cli/actions/list_profiles.rb +12 -0
- data/lib/aws_assume_role/cli/actions/migrate_profile.rb +20 -0
- data/lib/aws_assume_role/cli/actions/reset_environment.rb +50 -0
- data/lib/aws_assume_role/cli/actions/run.rb +36 -0
- data/lib/aws_assume_role/cli/actions/set_environment.rb +62 -0
- data/lib/aws_assume_role/cli/actions/test.rb +35 -0
- data/lib/aws_assume_role/cli/commands/configure.rb +32 -0
- data/lib/aws_assume_role/cli/commands/console.rb +19 -0
- data/lib/aws_assume_role/cli/commands/delete.rb +13 -0
- data/lib/aws_assume_role/cli/commands/environment.rb +34 -0
- data/lib/aws_assume_role/cli/commands/list.rb +12 -0
- data/lib/aws_assume_role/cli/commands/migrate.rb +13 -0
- data/lib/aws_assume_role/cli/commands/run.rb +19 -0
- data/lib/aws_assume_role/cli/commands/test.rb +20 -0
- data/lib/aws_assume_role/cli/includes.rb +3 -0
- data/lib/aws_assume_role/configuration.rb +30 -0
- data/lib/aws_assume_role/core_ext/aws-sdk/credential_provider_chain.rb +4 -0
- data/lib/aws_assume_role/core_ext/aws-sdk/includes.rb +9 -0
- data/lib/aws_assume_role/credentials/factories.rb +11 -0
- data/lib/aws_assume_role/credentials/factories/abstract_factory.rb +33 -0
- data/lib/aws_assume_role/credentials/factories/assume_role.rb +39 -0
- data/lib/aws_assume_role/credentials/factories/default_chain_provider.rb +113 -0
- data/lib/aws_assume_role/credentials/factories/environment.rb +26 -0
- data/lib/aws_assume_role/credentials/factories/includes.rb +15 -0
- data/lib/aws_assume_role/credentials/factories/instance_profile.rb +19 -0
- data/lib/aws_assume_role/credentials/factories/repository.rb +37 -0
- data/lib/aws_assume_role/credentials/factories/shared.rb +19 -0
- data/lib/aws_assume_role/credentials/factories/static.rb +18 -0
- data/lib/aws_assume_role/credentials/includes.rb +6 -0
- data/lib/aws_assume_role/credentials/providers/assume_role_credentials.rb +60 -0
- data/lib/aws_assume_role/credentials/providers/includes.rb +9 -0
- data/lib/aws_assume_role/credentials/providers/mfa_session_credentials.rb +119 -0
- data/lib/aws_assume_role/credentials/providers/shared_keyring_credentials.rb +41 -0
- data/lib/aws_assume_role/includes.rb +38 -0
- data/lib/aws_assume_role/logging.rb +27 -0
- data/lib/aws_assume_role/profile_configuration.rb +73 -0
- data/lib/aws_assume_role/runner.rb +40 -0
- data/lib/aws_assume_role/store/includes.rb +8 -0
- data/lib/aws_assume_role/store/keyring.rb +61 -0
- data/lib/aws_assume_role/store/serialization.rb +20 -0
- data/lib/aws_assume_role/store/shared_config_with_keyring.rb +250 -0
- data/lib/aws_assume_role/types.rb +31 -0
- data/lib/aws_assume_role/ui.rb +57 -0
- data/lib/aws_assume_role/vendored/aws.rb +4 -0
- data/lib/aws_assume_role/vendored/aws/README.md +2 -0
- data/lib/aws_assume_role/vendored/aws/assume_role_credentials.rb +67 -0
- data/lib/aws_assume_role/vendored/aws/includes.rb +9 -0
- data/lib/aws_assume_role/vendored/aws/refreshing_credentials.rb +58 -0
- data/lib/aws_assume_role/vendored/aws/shared_config.rb +223 -0
- data/lib/aws_assume_role/version.rb +5 -0
- metadata +438 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "includes"
|
4
|
+
require_relative "../../store/shared_config_with_keyring"
|
5
|
+
|
6
|
+
class AwsAssumeRole::Cli::Actions::DeleteProfile < AwsAssumeRole::Cli::Actions::AbstractAction
|
7
|
+
CommandSchema = proc do
|
8
|
+
required(:profile).value(:filled?)
|
9
|
+
end
|
10
|
+
|
11
|
+
def act_on(config)
|
12
|
+
prompt_for_option(:name_to_delete, "Name", proc { eql? config.profile }, fmt: config.profile)
|
13
|
+
AwsAssumeRole.shared_config.delete_profile config.profile
|
14
|
+
out format t("commands.delete.completed"), config.profile
|
15
|
+
rescue KeyError, Aws::Errors::NoSuchProfileError
|
16
|
+
error format(t("errors.NoSuchProfileError"), config.profile)
|
17
|
+
raise
|
18
|
+
rescue Aws::Errors::MissingCredentialsError
|
19
|
+
error t("errors.MissingCredentialsError")
|
20
|
+
raise
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "includes"
|
4
|
+
|
5
|
+
class AwsAssumeRole::Cli::Actions::ListProfiles < AwsAssumeRole::Cli::Actions::AbstractAction
|
6
|
+
CommandSchema = proc do
|
7
|
+
end
|
8
|
+
|
9
|
+
def act_on(_options)
|
10
|
+
AwsAssumeRole.shared_config.profiles.each { |p| puts p }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "includes"
|
4
|
+
|
5
|
+
class AwsAssumeRole::Cli::Actions::MigrateProfile < AwsAssumeRole::Cli::Actions::AbstractAction
|
6
|
+
CommandSchema = proc do
|
7
|
+
required(:profile).value(:filled?)
|
8
|
+
end
|
9
|
+
|
10
|
+
def act_on(config)
|
11
|
+
AwsAssumeRole.shared_config.migrate_profile config.profile
|
12
|
+
out format(t("commands.configure.saved"), config[:profile], AwsAssumeRole.shared_config.config_path)
|
13
|
+
rescue KeyError, Aws::Errors::NoSuchProfileError
|
14
|
+
error format(t("errors.NoSuchProfileError"), config.profile)
|
15
|
+
raise
|
16
|
+
rescue Aws::Errors::MissingCredentialsError
|
17
|
+
error t("errors.MissingCredentialsError")
|
18
|
+
raise
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "includes"
|
4
|
+
|
5
|
+
class AwsAssumeRole::Cli::Actions::ResetEnvironment < AwsAssumeRole::Cli::Actions::AbstractAction
|
6
|
+
include AwsAssumeRole::Ui
|
7
|
+
|
8
|
+
SHELL_STRINGS = {
|
9
|
+
sh: {
|
10
|
+
env_command: "unset %<key>s; ",
|
11
|
+
},
|
12
|
+
csh: {
|
13
|
+
env_command: "unset %<key>s; ",
|
14
|
+
},
|
15
|
+
fish: {
|
16
|
+
env_command: "set -ex %<key>s; ",
|
17
|
+
footer: "commands.reset_environment.shells.fish",
|
18
|
+
},
|
19
|
+
powershell: {
|
20
|
+
env_command: "remove-item ENV:%<key>s; ",
|
21
|
+
footer: "commands.reset_environment.shells.powershell",
|
22
|
+
},
|
23
|
+
}.freeze
|
24
|
+
|
25
|
+
CommandSchema = proc do
|
26
|
+
required(:shell_type).value(included_in?: SHELL_STRINGS.stringify_keys.keys)
|
27
|
+
end
|
28
|
+
|
29
|
+
def act_on(config)
|
30
|
+
shell_strings = SHELL_STRINGS[config.shell_type.to_sym]
|
31
|
+
str = String.new("")
|
32
|
+
%w[AWS_ACCESS_KEY_ID
|
33
|
+
AWS_SECRET_ACCESS_KEY
|
34
|
+
AWS_SESSION_TOKEN
|
35
|
+
AWS_PROFILE
|
36
|
+
AWS_ASSUME_ROLE_LOG_LEVEL
|
37
|
+
GLI_DEBUG
|
38
|
+
AWS_ASSUME_ROLE_KEYRING_BACKEND].each do |key|
|
39
|
+
str << format(shell_strings[:env_command], key: key) if ENV.fetch(key, false)
|
40
|
+
end
|
41
|
+
str << "# #{pastel.yellow t(shell_strings.fetch(:footer, 'commands.set_environment.shells.others'))}"
|
42
|
+
puts str
|
43
|
+
rescue KeyError, Aws::Errors::NoSuchProfileError
|
44
|
+
error format(t("errors.NoSuchProfileError"), config.profile)
|
45
|
+
raise
|
46
|
+
rescue Aws::Errors::MissingCredentialsError
|
47
|
+
error t("errors.MissingCredentialsError")
|
48
|
+
raise
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "includes"
|
4
|
+
require_relative "../../runner"
|
5
|
+
require_relative "../../credentials/factories/default_chain_provider"
|
6
|
+
|
7
|
+
class AwsAssumeRole::Cli::Actions::Run < AwsAssumeRole::Cli::Actions::AbstractAction
|
8
|
+
include AwsAssumeRole::Ui
|
9
|
+
|
10
|
+
CommandSchema = proc do
|
11
|
+
required(:profile).maybe
|
12
|
+
optional(:region) { filled? > format?(REGION_REGEX) }
|
13
|
+
optional(:serial_number) { filled? > format?(MFA_REGEX) }
|
14
|
+
required(:role_arn).maybe
|
15
|
+
required(:role_session_name).maybe
|
16
|
+
required(:duration_seconds).maybe
|
17
|
+
rule(role_specification: %i[profile role_arn role_session_name duration_seconds]) do |p, r, s, d|
|
18
|
+
(p.filled? | p.empty? & r.filled?) & (r.filled? > s.filled? & d.filled?)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def act_on(config)
|
23
|
+
credentials = try_for_credentials config.to_h
|
24
|
+
unless config.args.empty?
|
25
|
+
Runner.new(command: config.args,
|
26
|
+
environment: { "AWS_DEFAULT_REGION" => resolved_region },
|
27
|
+
credentials: credentials)
|
28
|
+
end
|
29
|
+
rescue KeyError, Aws::Errors::NoSuchProfileError
|
30
|
+
error format(t("errors.NoSuchProfileError"), config.profile)
|
31
|
+
raise
|
32
|
+
rescue Aws::Errors::MissingCredentialsError
|
33
|
+
error t("errors.MissingCredentialsError")
|
34
|
+
raise
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "includes"
|
4
|
+
require_relative "../../credentials/factories/default_chain_provider"
|
5
|
+
|
6
|
+
class AwsAssumeRole::Cli::Actions::SetEnvironment < AwsAssumeRole::Cli::Actions::AbstractAction
|
7
|
+
include AwsAssumeRole::Ui
|
8
|
+
|
9
|
+
SHELL_STRINGS = {
|
10
|
+
sh: {
|
11
|
+
env_command: "%<key>s=%<value>s; export %<key>s; ",
|
12
|
+
},
|
13
|
+
csh: {
|
14
|
+
env_command: "setenv %<key>s %<value>s; ",
|
15
|
+
},
|
16
|
+
fish: {
|
17
|
+
env_command: "set -x %<key>s %<value>s; ",
|
18
|
+
footer: "commands.set_environment.shells.fish",
|
19
|
+
},
|
20
|
+
powershell: {
|
21
|
+
env_command: "set-item ENV:%<key>s %<value>s; ",
|
22
|
+
footer: "commands.set_environment.shells.powershell",
|
23
|
+
},
|
24
|
+
}.freeze
|
25
|
+
|
26
|
+
CommandSchema = proc do
|
27
|
+
optional(:profile).filled?
|
28
|
+
optional(:region) { filled? > format?(REGION_REGEX) }
|
29
|
+
optional(:serial_number) { filled? > format?(MFA_REGEX) }
|
30
|
+
optional(:external_id) { filled? > format?(EXTERNAL_ID_REGEX) }
|
31
|
+
required(:shell_type).value(included_in?: SHELL_STRINGS.stringify_keys.keys)
|
32
|
+
required(:role_arn).maybe { filled? > format?(ROLE_REGEX) }
|
33
|
+
required(:role_session_name).maybe { filled? > format?(ROLE_SESSION_NAME_REGEX) }
|
34
|
+
required(:duration_seconds).maybe
|
35
|
+
rule(role_specification: %i[profile role_arn role_session_name duration_seconds]) do |p, r, s, d|
|
36
|
+
(p.filled? | p.empty? & r.filled?) & (r.filled? > s.filled? & d.filled?)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def act_on(config)
|
41
|
+
credentials = try_for_credentials config.to_h
|
42
|
+
shell_strings = SHELL_STRINGS[config.shell_type.to_sym]
|
43
|
+
str = String.new("")
|
44
|
+
[
|
45
|
+
[:access_key_id, "AWS_ACCESS_KEY_ID"],
|
46
|
+
[:secret_access_key, "AWS_SECRET_ACCESS_KEY"],
|
47
|
+
[:session_token, "AWS_SESSION_TOKEN"],
|
48
|
+
].each do |key|
|
49
|
+
value = credentials.credentials.send key[0]
|
50
|
+
next if value.blank?
|
51
|
+
str << format(shell_strings[:env_command], key: key[1], value: value)
|
52
|
+
end
|
53
|
+
str << "# #{pastel.yellow t(shell_strings.fetch(:footer, 'commands.set_environment.shells.others'))}"
|
54
|
+
puts str
|
55
|
+
rescue KeyError, Aws::Errors::NoSuchProfileError
|
56
|
+
error format(t("errors.NoSuchProfileError"), config.profile)
|
57
|
+
raise
|
58
|
+
rescue Aws::Errors::MissingCredentialsError
|
59
|
+
error t("errors.MissingCredentialsError")
|
60
|
+
raise
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "includes"
|
4
|
+
require_relative "../../credentials/factories/default_chain_provider"
|
5
|
+
|
6
|
+
class AwsAssumeRole::Cli::Actions::Test < AwsAssumeRole::Cli::Actions::AbstractAction
|
7
|
+
include AwsAssumeRole::Ui
|
8
|
+
|
9
|
+
CommandSchema = proc do
|
10
|
+
required(:profile).maybe
|
11
|
+
optional(:region) { filled? > format?(REGION_REGEX) }
|
12
|
+
optional(:serial_number) { filled? > format?(MFA_REGEX) }
|
13
|
+
required(:role_arn).maybe
|
14
|
+
required(:role_session_name).maybe
|
15
|
+
required(:duration_seconds).maybe
|
16
|
+
rule(role_specification: %i[profile role_arn role_session_name duration_seconds]) do |p, r, s, d|
|
17
|
+
(p.filled? | p.empty? & r.filled?) & (r.filled? > s.filled? & d.filled?)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def act_on(config)
|
22
|
+
logger.debug "Will try for credentials"
|
23
|
+
credentials = try_for_credentials config
|
24
|
+
logger.debug "Got credentials #{credentials}"
|
25
|
+
client = Aws::STS::Client.new(credentials: credentials, region: resolved_region)
|
26
|
+
identity = client.get_caller_identity
|
27
|
+
out format(t("commands.test.output"), identity.account, identity.arn, identity.user_id)
|
28
|
+
rescue KeyError, Aws::Errors::NoSuchProfileError
|
29
|
+
error format(t("errors.NoSuchProfileError"), config.profile)
|
30
|
+
raise
|
31
|
+
rescue Aws::Errors::MissingCredentialsError
|
32
|
+
error t("errors.MissingCredentialsError")
|
33
|
+
raise
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/configure_profile"
|
4
|
+
require_relative "../actions/configure_role_assumption"
|
5
|
+
|
6
|
+
module AwsAssumeRole::Cli
|
7
|
+
desc t "commands.configure.desc"
|
8
|
+
long_desc t "commands.configure.long_desc"
|
9
|
+
command :configure do |c|
|
10
|
+
c.flag [:p, "profile"], desc: t("options.profile_name")
|
11
|
+
c.action do |global_options, options, args|
|
12
|
+
AwsAssumeRole::Cli::Actions::ConfigureProfile.new(global_options, options, args)
|
13
|
+
end
|
14
|
+
|
15
|
+
c.desc t "commands.configure.desc"
|
16
|
+
c.long_desc t "commands.configure.long_desc"
|
17
|
+
c.command :role do |r|
|
18
|
+
r.flag ["source-profile"], desc: t("options.source_profile")
|
19
|
+
r.flag ["role-session-name"], desc: t("options.role_session_name")
|
20
|
+
r.flag ["role-arn"], desc: t("options.role_arn")
|
21
|
+
r.flag ["mfa-serial"], desc: t("options.mfa_serial")
|
22
|
+
r.flag ["region"], desc: t("options.region")
|
23
|
+
r.flag ["external-id"], desc: t("options.external_id")
|
24
|
+
r.flag ["duration-seconds"], desc: t("options.duration_seconds"), default_value: 3600
|
25
|
+
r.flag ["yubikey-oath-name"], desc: t("options.yubikey_oath_name")
|
26
|
+
|
27
|
+
r.action do |global_options, options, args|
|
28
|
+
AwsAssumeRole::Cli::Actions::ConfigureRoleAssumption.new(global_options, options, args)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/console"
|
4
|
+
|
5
|
+
module AwsAssumeRole::Cli
|
6
|
+
desc t "commands.console.desc"
|
7
|
+
command :console do |c|
|
8
|
+
c.flag [:p, "profile"], desc: t("options.profile_name")
|
9
|
+
c.flag ["role-session-name"], desc: t("options.role_session_name")
|
10
|
+
c.flag ["role-arn"], desc: t("options.role_arn")
|
11
|
+
c.flag ["mfa-serial"], desc: t("options.mfa_serial")
|
12
|
+
c.flag ["region"], desc: t("options.region")
|
13
|
+
c.flag ["external-id"], desc: t("options.external_id")
|
14
|
+
c.flag ["duration-seconds"], desc: t("options.duration_seconds"), default_value: 3600
|
15
|
+
c.action do |global_options, options, args|
|
16
|
+
AwsAssumeRole::Cli::Actions::Console.new(global_options, options, args)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/delete_profile"
|
4
|
+
|
5
|
+
module AwsAssumeRole::Cli
|
6
|
+
desc t "commands.delete.desc"
|
7
|
+
command :delete do |c|
|
8
|
+
c.flag [:p, "profile"], desc: t("options.profile_name")
|
9
|
+
c.action do |global_options, options, args|
|
10
|
+
AwsAssumeRole::Cli::Actions::DeleteProfile.new(global_options, options, args)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/set_environment"
|
4
|
+
require_relative "../actions/reset_environment"
|
5
|
+
|
6
|
+
module AwsAssumeRole::Cli
|
7
|
+
desc t "commands.set_environment.desc"
|
8
|
+
long_desc t "commands.set_environment.long_desc"
|
9
|
+
command :environment do |c|
|
10
|
+
desc t "commands.set_environment.desc"
|
11
|
+
long_desc t "commands.set_environment.long_desc"
|
12
|
+
c.command :set do |s|
|
13
|
+
s.flag [:p, "profile"], desc: t("options.profile_name")
|
14
|
+
s.flag [:s, "shell-type"], desc: t("options.shell_type"), default_value: "sh"
|
15
|
+
s.flag ["role-session-name"], desc: t("options.role_session_name")
|
16
|
+
s.flag ["role-arn"], desc: t("options.role_arn")
|
17
|
+
s.flag ["mfa-serial"], desc: t("options.mfa_serial")
|
18
|
+
s.flag ["region"], desc: t("options.region")
|
19
|
+
s.flag ["external-id"], desc: t("options.external_id")
|
20
|
+
s.flag ["duration-seconds"], desc: t("options.duration_seconds"), default_value: 3600
|
21
|
+
s.action do |global_options, options, args|
|
22
|
+
AwsAssumeRole::Cli::Actions::SetEnvironment.new(global_options, options, args)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc t "commands.reset_environment.desc"
|
27
|
+
long_desc t "commands.reset_environment.long_desc"
|
28
|
+
c.command :reset do |s|
|
29
|
+
s.action do |global_options, options, args|
|
30
|
+
AwsAssumeRole::Cli::Actions::ResetEnvironment.new(global_options, options, args)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/list_profiles"
|
4
|
+
|
5
|
+
module AwsAssumeRole::Cli
|
6
|
+
desc t "commands.list.desc"
|
7
|
+
command :list do |c|
|
8
|
+
c.action do |global_options, options, args|
|
9
|
+
AwsAssumeRole::Cli::Actions::ListProfiles.new(global_options, options, args)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/migrate_profile"
|
4
|
+
|
5
|
+
module AwsAssumeRole::Cli
|
6
|
+
desc t "commands.migrate.desc"
|
7
|
+
command :migrate do |c|
|
8
|
+
c.flag [:p, "profile"], desc: t("options.profile_name")
|
9
|
+
c.action do |global_options, options, args|
|
10
|
+
AwsAssumeRole::Cli::Actions::MigrateProfile.new(global_options, options, args)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/run"
|
4
|
+
|
5
|
+
module AwsAssumeRole::Cli
|
6
|
+
desc t "commands.run.desc"
|
7
|
+
command :run do |c|
|
8
|
+
c.flag [:p, "profile"], desc: t("options.profile_name")
|
9
|
+
c.flag ["role-session-name"], desc: t("options.role_session_name")
|
10
|
+
c.flag ["role-arn"], desc: t("options.role_arn")
|
11
|
+
c.flag ["mfa-serial"], desc: t("options.mfa_serial")
|
12
|
+
c.flag ["region"], desc: t("options.region")
|
13
|
+
c.flag ["external-id"], desc: t("options.external_id")
|
14
|
+
c.flag ["duration-seconds"], desc: t("options.duration_seconds"), default_value: 3600
|
15
|
+
c.action do |global_options, options, args|
|
16
|
+
AwsAssumeRole::Cli::Actions::Run.new(global_options, options, args)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../actions/test"
|
4
|
+
|
5
|
+
module AwsAssumeRole::Cli
|
6
|
+
desc t "commands.test.desc"
|
7
|
+
command :test do |c|
|
8
|
+
c.flag [:p, "profile"], desc: t("options.profile_name")
|
9
|
+
c.flag ["role-session-name"], desc: t("options.role_session_name")
|
10
|
+
c.flag ["role-arn"], desc: t("options.role_arn")
|
11
|
+
c.flag ["mfa-serial"], desc: t("options.mfa_serial")
|
12
|
+
c.flag ["region"], desc: t("options.region")
|
13
|
+
c.flag ["external-id"], desc: t("options.external_id")
|
14
|
+
c.flag ["duration-seconds"], desc: t("options.duration_seconds"), default_value: 3600
|
15
|
+
c.switch ["no-profile"], desc: t("options.duration_seconds"), default_value: false
|
16
|
+
c.action do |global_options, options, args|
|
17
|
+
AwsAssumeRole::Cli::Actions::Test.new(global_options, options, args)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|