Module: Aws::RefreshingCredentials Private

Included in:
AssumeRoleCredentials, InstanceProfileCredentials
Defined in:
lib/aws-sdk-core/refreshing_credentials.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Base class used credential classes that can be refreshed. This provides basic refresh logic in a thread-safe manor. Classes mixing in this module are expected to implement a #refresh method that populates the following instance variables:

  • ‘@access_key_id`

  • ‘@secret_access_key`

  • ‘@session_token`

  • ‘@expiration`

Instance Method Summary collapse

Instance Method Details

#access_key_idString?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String, nil)


24
25
26
27
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 24

def access_key_id
  refresh_if_near_expiration
  @access_key_id
end

#expirationTime?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Time, nil)


42
43
44
45
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 42

def expiration
  refresh_if_near_expiration
  @expiration
end

#initialize(options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 18

def initialize(options = {})
  @mutex = Mutex.new
  refresh
end

#refresh!void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Refresh credentials.



49
50
51
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 49

def refresh!
  @mutex.synchronize { refresh }
end

#secret_access_keyString?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String, nil)


30
31
32
33
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 30

def secret_access_key
  refresh_if_near_expiration
  @secret_access_key
end

#session_tokenString?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String, nil)


36
37
38
39
# File 'lib/aws-sdk-core/refreshing_credentials.rb', line 36

def session_token
  refresh_if_near_expiration
  @session_token
end