aws-session-credentials 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mjk2MmNjOTU3YTczYTY3MjIxNWY4NzM3MDA2MDI1OTQ1MjEzMjllMg==
4
+ NzZhNzNkM2RkOGQyNTRjMDQyMTk4ZDE0YzJjNDg0OTgxZGVlZWY1MA==
5
5
  data.tar.gz: !binary |-
6
- MzMxZDgyYmY5YzBhMTZlMDU4NzE5MGFjNDc4NDk3NzE3OGQ1NmI1Nw==
6
+ OGZkZmZjNTFlNWRjMDQxNTIwMGQzZGI5ZjBjMzA1MGYzMzZlN2FjNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzhjNDI4ZjFlZGE4N2QxNjc2MTYxOWI1Mzg4NWI0NWNiMzM1MDI5ZWQ1MTM0
10
- NDYyYzQzN2YxNjEwNmI0YTM1NmExN2RkZjU1MjI2ZjBmZDZiOTg3N2ZlNDMy
11
- MTExOWE5NWZhNzk5ZGMwOTY2ZWY3NzQ0NjZlYTlkNDgzNmIzNWQ=
9
+ OWEwZDdhNTE2NDZhMTJlMWE1YTE3OTliNzQ5NTI3MzFhNzY5ZGVkMmU3MDlm
10
+ ZTJlNGM4MTA2MjZiMGViNTk1NmEzYjAwNzM5MjA1ODZlMmRhZTUzMDI1ZTYz
11
+ MzZjYzZjZTllNzFkNDVkZTZlMmZhOTc3ZTBmMjBhNjNjNjIzYjQ=
12
12
  data.tar.gz: !binary |-
13
- MzgyNTcxN2Q4YTU2YTRlMTVlZjZhYjgwOTZhNzc4ODk2YzJiYWY3MjA4OGE1
14
- MTYyNjk2NTI0YzllYmQ3Y2FlNTM1NWY2MjRlMTJlNzM0ZTMzZThhNzc0MzNm
15
- MDRlNzRmZjI4NzdhOGE5NDFjODhiNGEwZjA0ZTE1OGUzYWI1MTA=
13
+ MmQ2Y2ZiM2Y3Mjg3MzZlYjBmOGVhMzM3MGMxZDAzOWJlODlkZDVlZDI0Nzk1
14
+ MjFiODgwMGU2Yjk2Mjc5NzdkODc2MDBlYTk5N2Q5MjQ2Mjg4N2Y4ODYyYmUz
15
+ OTY3ODJhYjdmZDI4MzQ2YzNkYmIyNGMzMzg4NDExZTFkMTIzYzg=
@@ -248,7 +248,7 @@ module Aws
248
248
  cli_opts['role_session_name'] = ask('Role session name:')
249
249
  else
250
250
  account, role_name = split_role_arn(cli_opts['role_arn'])
251
- cli_opts['role_session_name'] = "#{role_name} @ #{account}"
251
+ cli_opts['role_session_name'] = "#{role_name}@#{account}"
252
252
  end
253
253
  end
254
254
 
@@ -266,8 +266,8 @@ module Aws
266
266
  def list_profiles
267
267
  store = CredentialFile.new
268
268
 
269
- puts "Available profiles in #{store.path}:"
270
- store.profiles.each { |name, _| puts " * #{name}" }
269
+ puts "Profiles located in #{store.path}:"
270
+ store.print_profiles(self)
271
271
  end
272
272
 
273
273
  method_option 'config-file',
@@ -278,8 +278,8 @@ module Aws
278
278
  def list_roles
279
279
  store = Config.new(path: options['config-file'])
280
280
 
281
- puts "Stored roles in #{store.path}:"
282
- store.roles.each { |name, _| puts " * #{name}" }
281
+ puts "Profiles located in #{store.path}:"
282
+ store.print_roles(self)
283
283
  end
284
284
 
285
285
  method_option 'config-file',
@@ -290,8 +290,8 @@ module Aws
290
290
  def list_source_profiles
291
291
  store = Config.new(path: options['config-file'])
292
292
 
293
- puts "Available source profiles in #{store.path}:"
294
- store.profiles.each { |name, _| puts " * #{name}" }
293
+ puts "Profiles located in #{store.path}:"
294
+ store.print_profiles(self)
295
295
  end
296
296
 
297
297
  desc 'version', 'Prints the current version'
@@ -3,6 +3,16 @@ module Aws
3
3
  module Credentials
4
4
  # Mixin to store profiles
5
5
  module ProfileStorage
6
+ # @param [Thor::Shell] shell
7
+ def print_profiles(shell)
8
+ profiles_table = profiles.map do |name, prof|
9
+ cols = [name]
10
+ cols << Time.at(prof['expiry']) if prof['expiry']
11
+ cols
12
+ end
13
+ shell.print_table(profiles_table.unshift(%w(Name Expiry)))
14
+ end
15
+
6
16
  # @return [Hash<String,Profile>]
7
17
  def profiles
8
18
  prfs = {}
@@ -3,6 +3,16 @@ module Aws
3
3
  module Credentials
4
4
  # Mixin to store roles
5
5
  module RoleStorage
6
+ # @param [Thor::Shell] shell
7
+ def print_roles(shell)
8
+ roles_table = roles.map do |name, prof|
9
+ cols = [name]
10
+ cols << prof.role_arn
11
+ cols
12
+ end
13
+ shell.print_table(roles_table.unshift(['Alias', 'Role ARN']))
14
+ end
15
+
6
16
  # @return [Hash<String,Role>]
7
17
  def roles
8
18
  rls = {}
@@ -27,7 +27,8 @@ module Aws
27
27
  aws_access_key_id: resp.credentials['access_key_id'],
28
28
  aws_secret_access_key: resp.credentials['secret_access_key'],
29
29
  aws_session_token: resp.credentials['session_token'],
30
- aws_region: @source_profile.aws_region
30
+ aws_region: @source_profile.aws_region,
31
+ expiry: resp.credentials['expiration'].to_i
31
32
  ) if resp
32
33
  end
33
34
 
@@ -42,7 +43,8 @@ module Aws
42
43
  aws_access_key_id: resp.credentials['access_key_id'],
43
44
  aws_secret_access_key: resp.credentials['secret_access_key'],
44
45
  aws_session_token: resp.credentials['session_token'],
45
- aws_region: @source_profile.aws_region
46
+ aws_region: @source_profile.aws_region,
47
+ expiry: resp.credentials['expiration'].to_i
46
48
  ) if resp
47
49
  end
48
50
 
@@ -1,7 +1,7 @@
1
1
  module Aws
2
2
  module Session
3
3
  module Credentials
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-session-credentials
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Vidulich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler