Class: Aws::S3::ExpressCredentialsProvider

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-s3/lib/aws-sdk-s3/express_credentials_provider.rb

Overview

Returns Credentials class for S3 Express. Accepts CreateSession params as options. See Client#create_session for details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ExpressCredentialsProvider

Returns a new instance of ExpressCredentialsProvider.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :client (Client)

    The S3 client used to create the session.

  • :session_mode (String) — default: see: {Client#create_session}
  • :caching (Boolean) — default: true

    When true, credentials will be cached.

  • :before_refresh (Callable)

    Proc called before credentials are refreshed.



21
22
23
24
25
26
27
28
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/express_credentials_provider.rb', line 21

def initialize(options = {})
  @client = options.delete(:client)
  @caching = options.delete(:caching) != false
  @options = options
  return unless @caching

  @cache = Aws::S3.express_credentials_cache
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



38
39
40
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/express_credentials_provider.rb', line 38

def client
  @client
end

Instance Method Details

#express_credentials_for(bucket) ⇒ Object



30
31
32
33
34
35
36
# File 'gems/aws-sdk-s3/lib/aws-sdk-s3/express_credentials_provider.rb', line 30

def express_credentials_for(bucket)
  if @caching
    cached_credentials_for(bucket)
  else
    new_credentials_for(bucket)
  end
end