Module: Aws::Session::Credentials::ProfileStorage
- Included in:
- Cache, Config, CredentialFile
- Defined in:
- lib/aws/session/credentials/profile_storage.rb
Overview
Mixin to store profiles
Instance Method Summary collapse
- #print_profiles(shell) ⇒ Object
- #profile(name) ⇒ Profile
- #profiles ⇒ Hash<String,Profile>
- #profiles=(prfs) ⇒ Object
- #set_profile(name, prof) ⇒ Object
Instance Method Details
#print_profiles(shell) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/aws/session/credentials/profile_storage.rb', line 7 def print_profiles(shell) profiles_table = profiles.map do |name, prof| cols = [name] cols << Time.at(prof['expiry']) if prof['expiry'] cols end shell.print_table(profiles_table.unshift(%w(Name Expiry))) end |
#profile(name) ⇒ Profile
36 37 38 |
# File 'lib/aws/session/credentials/profile_storage.rb', line 36 def profile(name) profiles[name] end |
#profiles ⇒ Hash<String,Profile>
17 18 19 20 21 22 23 |
# File 'lib/aws/session/credentials/profile_storage.rb', line 17 def profiles prfs = {} profiles_hash.each do |name, | prfs[name] = Profile.new() end prfs end |
#profiles=(prfs) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/aws/session/credentials/profile_storage.rb', line 26 def profiles=(prfs) hash = {} prfs.each do |name, prof| hash[name] = prof.to_h end self.profiles_hash = hash end |
#set_profile(name, prof) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/aws/session/credentials/profile_storage.rb', line 42 def set_profile(name, prof) profs = profiles.dup profs[name] = prof self.profiles = profs prof end |