You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Credentials

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-core/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)



7
8
9
10
11
# File 'gems/aws-sdk-core/lib/aws-sdk-core/credentials.rb', line 7

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)


14
15
16
# File 'gems/aws-sdk-core/lib/aws-sdk-core/credentials.rb', line 14

def access_key_id
  @access_key_id
end

#secret_access_keyString? (readonly)

Returns:

  • (String, nil)


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

def secret_access_key
  @secret_access_key
end

#session_tokenString? (readonly)

Returns:

  • (String, nil)


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

def session_token
  @session_token
end

Instance Method Details

#credentialsCredentials

Returns:



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

def credentials
  self
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.



29
30
31
32
33
34
# File 'gems/aws-sdk-core/lib/aws-sdk-core/credentials.rb', line 29

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