Module: Aws::RefreshingCredentials Private

Included in:
AssumeRoleCredentials, ECSCredentials, InstanceProfileCredentials, ProcessCredentials
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 manner. 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

#credentialsCredentials

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:



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

def credentials
  refresh_if_near_expiration
  @credentials
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)


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

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.



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

def refresh!
  @mutex.synchronize { refresh }
end