Class: AwsMfaSecure::Credentials
- Includes:
- Singleton
- Defined in:
- lib/aws_mfa_secure/credentials.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize ⇒ Credentials
constructor
A new instance of Credentials.
- #set? ⇒ Boolean
- #setup ⇒ Object
Methods inherited from Base
#aws_cli_installed?, #aws_cli_setup?, #aws_config, #aws_mfa_env_set?, #aws_profile, #credentials, #fetch_creds?, #get_session_token, #good_session_creds?, #iam_mfa?, #mfa_prompt, #mfa_serial, #save_creds, #session_creds_path, #shell_get_session_token, #sts
Constructor Details
#initialize ⇒ Credentials
Returns a new instance of Credentials.
11 12 13 14 |
# File 'lib/aws_mfa_secure/credentials.rb', line 11 def initialize @aws_profile = aws_profile setup end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/aws_mfa_secure/credentials.rb', line 10 def data @data end |
Instance Method Details
#set? ⇒ Boolean
27 28 29 |
# File 'lib/aws_mfa_secure/credentials.rb', line 27 def set? !!@data end |
#setup ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/aws_mfa_secure/credentials.rb', line 16 def setup return unless iam_mfa? if fetch_creds? resp = get_session_token(shell: true) save_creds(resp.credentials.to_h) end @data = credentials end |