Class: Aws::Session::Credentials::SessionManager
- Inherits:
-
Object
- Object
- Aws::Session::Credentials::SessionManager
- Defined in:
- lib/aws/session/credentials/session_manager.rb
Overview
Manages sessions
Instance Method Summary collapse
-
#assume_role(options) ⇒ Object
Assumes a role from provided options.
-
#new_session(options) ⇒ Object
Creates a new session from provided options.
Instance Method Details
#assume_role(options) ⇒ Object
Assumes a role from provided options
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/aws/session/credentials/session_manager.rb', line 11 def assume_role() [:profile] = [:profile].to_sym session_prof = Cache.new.profile([:profile]) = session_prof.to_h.deep_merge().deep_symbolize_keys sb = SessionBuilder.new( mfa_device: mfa_device(), role_duration_seconds: [:duration], role_arn: [:role_arn], role_session_name: [:role_session_name], source_profile: session_prof ) role_profile = sb.role_profile CredentialFile.new.set_profile([:profile], role_profile) end |
#new_session(options) ⇒ Object
Creates a new session from provided options
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/aws/session/credentials/session_manager.rb', line 43 def new_session() [:source_profile] = [:source_profile].to_sym [:profile] = [:profile].to_sym user_prof = user_profile([:source_profile], [:config_file]) = user_prof.to_h.deep_merge().deep_symbolize_keys sb = SessionBuilder.new( mfa_device: mfa_device(), session_duration_seconds: [:duration], source_profile: user_prof ) set_user_session_profile([:profile], sb.session_profile) end |