Class: Mongo::Crypt::KMS::KMIP::MasterKeyDocument Private
- Inherits:
-
Object
- Object
- Mongo::Crypt::KMS::KMIP::MasterKeyDocument
- Includes:
- Validations
- Defined in:
- build/ruby-driver-master/lib/mongo/crypt/kms/kmip.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.
84 85 86 87 88 89 90 91 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/kmip.rb', line 84 def initialize(opts) @key_id = validate_param( :key_id, opts, FORMAT_HINT, required: false ) || SecureRandom.alphanumeric(96) @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.
68 69 70 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/kmip.rb', line 68 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.
65 66 67 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/kmip.rb', line 65 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.
96 97 98 99 100 101 102 103 104 105 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/kmip.rb', line 96 def to_document BSON::Document.new({ provider: 'kmip', keyId: key_id }).tap do |bson| unless endpoint.nil? bson.update({ endpoint: endpoint }) end end end |