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

Defined in:
lib/mongo/crypt/kms/gcp.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.



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/mongo/crypt/kms/gcp.rb', line 99

def to_document
  return BSON::Document.new if empty?
  BSON::Document.new({
    email: email,
    privateKey: BSON::Binary.new(private_key, :generic),
  }).tap do |bson|
    unless endpoint.nil?
      bson.update({ endpoint: endpoint })
    end
  end
end