Class: Mongo::Crypt::KMS::KMIP::MasterKeyDocument Private
- Inherits:
-
Object
- Object
- Mongo::Crypt::KMS::KMIP::MasterKeyDocument
- 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 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.
"KMIP KMS key document must be in the format: " + "{ key_id: 'KEY-ID', endpoint: 'ENDPOINT' }"
Instance Attribute Summary collapse
-
#endpoint ⇒ String | nil
readonly
private
KMIP KMS endpoint with optional port.
-
#key_id ⇒ String | nil
readonly
private
The KMIP Unique Identifier to a 96 byte KMIP Secret Data managed object.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ MasterKeyDocument
constructor
private
Creates a master key document object form a parameters hash.
-
#to_document ⇒ BSON::Document
private
Convert master key document object to a BSON document in libmongocrypt format.
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 (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 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 (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 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 |