Method: Mongo::Crypt::KMS::AWS::Credentials#initialize

Defined in:
lib/mongo/crypt/kms/aws/credentials.rb

#initialize(opts) ⇒ 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.

Creates an AWS KMS credentials object form a parameters hash.

Parameters:

  • opts (Hash)

    A hash that contains credentials for AWS KMS provider

Options Hash (opts):

  • :access_key_id (String)

    AWS access key id.

  • :secret_access_key (String)

    AWS secret access key.

  • :session_token (String | nil)

    AWS session token, optional.

Raises:

  • (ArgumentError)

    If required options are missing or incorrectly formatted.



55
56
57
58
59
60
61
62
# File 'lib/mongo/crypt/kms/aws/credentials.rb', line 55

def initialize(opts)
  @opts = opts
  unless empty?
    @access_key_id = validate_param(:access_key_id, opts, FORMAT_HINT)
    @secret_access_key = validate_param(:secret_access_key, opts, FORMAT_HINT)
    @session_token = validate_param(:session_token, opts, FORMAT_HINT, required: false)
  end
end