Class: Aws::Crt::Auth::StaticCredentialsProviderOptions

Inherits:
Object
  • Object
show all
Includes:
ManagedNative
Defined in:
lib/aws-crt/auth/static_credentials_provider.rb

Overview

CRT CredentialOptions

Instance Method Summary collapse

Methods included from ManagedNative

included, #manage_native, #native, #native_set?, #release

Constructor Details

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

Returns a new instance of StaticCredentialsProviderOptions.

Parameters:

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

    (nil)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/aws-crt/auth/static_credentials_provider.rb', line 14

def initialize(access_key_id, secret_access_key,
               session_token = nil)
  if !access_key_id || access_key_id.empty?
    raise ArgumentError, 'access_key_id  must be set'
  end

  if !secret_access_key || secret_access_key.empty?
    raise ArgumentError, 'secret_access_key  must be set'
  end

  manage_native do
    Aws::Crt::Native.credentials_provider_static_options_new
  end

  Aws::Crt::Native.credentials_provider_static_options_set_access_key_id(
    native, access_key_id, access_key_id.length
  )

  Aws::Crt::Native.credentials_provider_static_options_set_secret_access_key(
    native, secret_access_key, secret_access_key.length
  )

  if session_token && !session_token.empty?
    Aws::Crt::Native.credentials_provider_static_options_set_session_token(
      native, session_token, session_token.length
    )
  end
end