Module: Aws::Session::Credentials::RoleStorage
- Included in:
- Config
- Defined in:
- lib/aws/session/credentials/role_storage.rb
Overview
Mixin to store roles
Instance Method Summary collapse
- #print_roles(shell) ⇒ Object
- #role(name) ⇒ Role
- #roles ⇒ Hash<String,Role>
- #roles=(rls) ⇒ Object
- #set_role(name, rl) ⇒ Object
Instance Method Details
#print_roles(shell) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/aws/session/credentials/role_storage.rb', line 7 def print_roles(shell) roles_table = roles.map do |name, prof| cols = [name] cols << prof.role_arn cols end shell.print_table(roles_table.unshift(['Alias', 'Role ARN'])) end |
#role(name) ⇒ Role
36 37 38 |
# File 'lib/aws/session/credentials/role_storage.rb', line 36 def role(name) roles[name] end |
#roles ⇒ Hash<String,Role>
17 18 19 20 21 22 23 |
# File 'lib/aws/session/credentials/role_storage.rb', line 17 def roles rls = {} roles_hash.each do |name, | rls[name] = Role.new() end rls end |
#roles=(rls) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/aws/session/credentials/role_storage.rb', line 26 def roles=(rls) hash = {} rls.each do |name, rl| hash[name] = rl.to_h end self.roles_hash = hash end |
#set_role(name, rl) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/aws/session/credentials/role_storage.rb', line 42 def set_role(name, rl) rls = roles.dup rls[name] = rl self.roles = rls rl end |