Module: Awssume
- Defined in:
- lib/awssume.rb,
lib/awssume/version.rb,
lib/awssume/configuration.rb,
lib/awssume/command_decorator.rb,
lib/awssume/adapter/aws_client.rb
Defined Under Namespace
Modules: Adapter
Classes: CommandDecorator, Configuration
Constant Summary
collapse
- VERSION =
"1.0.1"
Class Method Summary
collapse
Class Method Details
.handle_exit(&block) ⇒ Object
27
28
29
|
# File 'lib/awssume.rb', line 27
def self.handle_exit(&block)
block.call ? true : exit(1)
end
|
.run ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/awssume.rb', line 8
def self.run
config = Awssume::Configuration.new
adapter = Awssume::Adapter::AwsClient.new(
region: config.region,
role_arn: config.role_arn,
role_session_name: config.role_session_name,
external_id: config.external_id,
duration_seconds: config.duration_seconds,
)
aws_env = {
'AWS_REGION' => config.region,
'AWS_DEFAULT_REGION' => config.region
}
creds_hash = adapter.assume
fmt_cmd = Awssume::CommandDecorator.format_cmd(ARGV[0..-1], creds_hash)
handle_exit { system(aws_env, fmt_cmd) }
end
|