Class: Aws::Credentials

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_key_id, secret_access_key, session_token = nil) ⇒ Credentials

Returns a new instance of Credentials.

Parameters:

  • access_key_id (String)
  • secret_access_key (String)
  • session_token (String) (defaults to: nil)

    (nil)


9
10
11
12
13
# File 'lib/aws-sdk-core/credentials.rb', line 9

def initialize(access_key_id, secret_access_key, session_token = nil)
  @access_key_id = access_key_id
  @secret_access_key = secret_access_key
  @session_token = session_token
end

Instance Attribute Details

#access_key_idString? (readonly)

Returns:

  • (String, nil)

16
17
18
# File 'lib/aws-sdk-core/credentials.rb', line 16

def access_key_id
  @access_key_id
end

#secret_access_keyString? (readonly)

Returns:

  • (String, nil)

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

def secret_access_key
  @secret_access_key
end

#session_tokenString? (readonly)

Returns:

  • (String, nil)

22
23
24
# File 'lib/aws-sdk-core/credentials.rb', line 22

def session_token
  @session_token
end

Instance Method Details

#credentialsCredentials

Returns:


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

def credentials
  self
end

#inspectObject

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.

Removing the secret access key from the default inspect string.


40
41
42
# File 'lib/aws-sdk-core/credentials.rb', line 40

def inspect
  "#<#{self.class.name} access_key_id=#{access_key_id.inspect}>"
end

#set?Boolean

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.


31
32
33
34
35
36
# File 'lib/aws-sdk-core/credentials.rb', line 31

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