Class: Mongo::Crypt::KMS::AWS::Credentials Private
- Inherits:
-
Object
- Object
- Mongo::Crypt::KMS::AWS::Credentials
- Includes:
- Validations
- Defined in:
- build/ruby-driver-master/lib/mongo/crypt/kms/aws.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.
AWS KMS Credentials object contains credentials for using AWS KMS provider.
Constant Summary collapse
- FORMAT_HINT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"AWS KMS provider options must be in the format: " + "{ access_key_id: 'YOUR-ACCESS-KEY-ID', secret_access_key: 'SECRET-ACCESS-KEY' }"
Instance Attribute Summary collapse
-
#access_key_id ⇒ String
readonly
private
AWS access key.
-
#secret_access_key ⇒ String
readonly
private
AWS secret access key.
-
#session_token ⇒ String | nil
readonly
private
AWS session token.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Credentials
constructor
private
Creates an AWS KMS credentials object form a parameters hash.
-
#to_document ⇒ BSON::Document
private
Convert credentials object to a BSON document in libmongocrypt format.
Methods included from Validations
#validate_param, validate_tls_options
Constructor Details
#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.
51 52 53 54 55 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 51 def initialize(opts) @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 |
Instance Attribute Details
#access_key_id ⇒ String (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 AWS access key.
30 31 32 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 30 def access_key_id @access_key_id end |
#secret_access_key ⇒ String (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 AWS secret access key.
33 34 35 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 33 def secret_access_key @secret_access_key end |
#session_token ⇒ String | nil (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 AWS session token.
36 37 38 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 36 def session_token @session_token end |
Instance Method Details
#to_document ⇒ BSON::Document
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.
Convert credentials object to a BSON document in libmongocrypt format.
60 61 62 63 64 65 66 67 68 69 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 60 def to_document BSON::Document.new({ accessKeyId: access_key_id, secretAccessKey: secret_access_key, }).tap do |bson| unless session_token.nil? bson.update({ sessionToken: session_token }) end end end |