Class: Aws::Sigv4::Credentials Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sigv4/credentials.rb

Overview

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

Users that wish to configure static credentials can use the ‘:access_key_id` and `:secret_access_key` constructor options.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Credentials

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 a new instance of Credentials.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :access_key_id (required, String)
  • :secret_access_key (required, String)
  • :session_token (String, nil) — default: nil


13
14
15
16
17
18
19
20
21
22
# File 'lib/aws-sigv4/credentials.rb', line 13

def initialize(options = {})
  if options[:access_key_id] && options[:secret_access_key]
    @access_key_id = options[:access_key_id]
    @secret_access_key = options[:secret_access_key]
    @session_token = options[:session_token]
  else
    msg = "expected both :access_key_id and :secret_access_key options"
    raise ArgumentError, msg
  end
end

Instance Attribute Details

#access_key_idString (readonly)

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)


25
26
27
# File 'lib/aws-sigv4/credentials.rb', line 25

def access_key_id
  @access_key_id
end

#secret_access_keyString (readonly)

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)


28
29
30
# File 'lib/aws-sigv4/credentials.rb', line 28

def secret_access_key
  @secret_access_key
end

#session_tokenString? (readonly)

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)


31
32
33
# File 'lib/aws-sigv4/credentials.rb', line 31

def session_token
  @session_token
end

Instance Method Details

#set?Boolean

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 ‘true` if the access key id and secret access key are both set.

Returns:

  • (Boolean)

    Returns ‘true` if the access key id and secret access key are both set.



35
36
37
38
39
40
# File 'lib/aws-sigv4/credentials.rb', line 35

def set?
  !access_key_id.nil? &&
    !access_key_id.empty? &&
    !secret_access_key.nil? &&
    !secret_access_key.empty?
end