MasterKeyDocument — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::Crypt::KMS::KMIP::MasterKeyDocumentPrivate

Inherits:

Object

Includes:

Validations

Defined in:

lib/mongo/crypt/kms/kmip/master_document.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.

KMIP KMS master key document object contains KMS master key parameters.

Constant Summarycollapse

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.

"KMIP KMS key document must be in the format: " + "{ key_id: 'KEY-ID', endpoint: 'ENDPOINT' }"

Instance Attribute Summary collapse

Instance Method Summarycollapse

Methods included from Validations

#validate_param, validate_tls_options

Constructor Details

#initialize(opts = {}) ⇒ MasterKeyDocument

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 a master key document object form a parameters hash.

49 50 51 52 53 54 55 56 # File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 49 def initialize(opts = {}) @key_id = validate_param( :key_id, opts, FORMAT_HINT, required: false ) @endpoint = validate_param( :endpoint, opts, FORMAT_HINT, required: false ) end

Instance Attribute Details

#endpoint ⇒ String | nil

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 KMIP KMS endpoint with optional port.

33 34 35 # File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 33 def endpoint @endpoint end

#key_id ⇒ String | nil

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 The KMIP Unique Identifier to a 96 byte KMIP Secret Data managed object.

30 31 32 # File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 30 def key_id @key_id 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 master key document object to a BSON document in libmongocrypt format.

| 61 62 63 64 65 66 67 68 | # File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 61 def to_document BSON::Document.new({ provider: 'kmip', }).tap do |bson| bson.update({ endpoint: endpoint }) unless endpoint.nil? bson.update({ keyId: key_id }) unless key_id.nil? end end | | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |