Class: Mongo::Crypt::KMS::KMIP::MasterKeyDocument Private
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
|
|
| Inherits: | Object |
| Defined in: | lib/mongo/crypt/kms/kmip/master_document.rb |
Overview
::Mongo::Crypt::KMS::KMIP KMS master key document object contains ::Mongo::Crypt::KMS master key parameters.
Constant Summary
-
FORMAT_HINT =
# File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 38'KMIP KMS key document must be in the format: ' + "{ key_id: 'KEY-ID', endpoint: 'ENDPOINT', delegated: true|false }"
Class Method Summary
-
.new(opts = {}) ⇒ MasterKeyDocument
constructor
Internal use only
Creates a master key document object form a parameters hash.
Instance Attribute Summary
- #delegated ⇒ true | false | nil readonly Internal use only
- #endpoint ⇒ String | nil readonly Internal use only
- #key_id ⇒ String | nil readonly Internal use only
Instance Method Summary
-
#to_document ⇒ BSON::Document
Internal use only
Convert master key document object to a BSON document in libmongocrypt format.
-
#validate_delegated(opts) ⇒ true | false | nil
private
Internal use only
Validate the optional
:delegated::Mongo::Crypt::KMS::KMIPmaster key option.
::Mongo::Crypt::KMS::Validations - Included
| #validate_param | Validate if a |
| #validate_tls_options | Validate KMS TLS options. |
Instance Attribute Details
#delegated ⇒ true | false | nil (readonly)
# File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 36
attr_reader :delegated
#endpoint ⇒ String | nil (readonly)
# File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 32
attr_reader :endpoint
#key_id ⇒ String | nil (readonly)
# File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 29
attr_reader :key_id
Instance Method Details
#to_document ⇒ BSON::Document
Convert master key document object to a BSON document in libmongocrypt format.
# File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 68
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? bson.update({ delegated: delegated }) unless delegated.nil? end end
#validate_delegated(opts) ⇒ true | false | nil (private)
Validate the optional :delegated ::Mongo::Crypt::KMS::KMIP master key option.
# File 'lib/mongo/crypt/kms/kmip/master_document.rb', line 87
def validate_delegated(opts) return nil unless opts.key?(:delegated) value = opts[:delegated] return value if value == true || value == false || value.nil? raise ArgumentError.new( "The delegated option must be a boolean; currently have #{value}" ) end