Method: Mongo::Crypt::KMS::Azure::Credentials#to_document

Defined in:
lib/mongo/crypt/kms/azure.rb

#to_documentBSON::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.

Returns:

  • (BSON::Document)

    Azure KMS credentials in libmongocrypt format.



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/mongo/crypt/kms/azure.rb', line 74

def to_document
  return BSON::Document.new if empty?
  BSON::Document.new({
    tenantId: @tenant_id,
    clientId: @client_id,
    clientSecret: @client_secret,
  }).tap do |bson|
    unless identity_platform_endpoint.nil?
      bson.update({ identityPlatformEndpoint: identity_platform_endpoint })
    end
  end
end