Class: Mongo::Crypt::KMS::Azure::MasterKeyDocument Private
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
|
|
| Inherits: | Object |
| Defined in: | lib/mongo/crypt/kms/azure/master_document.rb |
Overview
::Mongo::Crypt::KMS::Azure KMS master key document object contains ::Mongo::Crypt::KMS master key parameters.
Constant Summary
-
FORMAT_HINT =
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 36'Azure key document must be in the format: ' + "{ key_vault_endpoint: 'KEY_VAULT_ENDPOINT', key_name: 'KEY_NAME' }"
Class Method Summary
-
.new(opts) ⇒ MasterKeyDocument
constructor
Internal use only
Creates a master key document object form a parameters hash.
Instance Attribute Summary
- #key_name ⇒ String readonly Internal use only
- #key_vault_endpoint ⇒ String readonly Internal use only
- #key_version ⇒ 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.
::Mongo::Crypt::KMS::Validations - Included
| #validate_param | Validate if a |
| #validate_tls_options | Validate KMS TLS options. |
Constructor Details
.new(opts) ⇒ MasterKeyDocument
Creates a master key document object form a parameters hash.
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 48
def initialize(opts) unless opts.is_a?(Hash) raise ArgumentError.new( 'Key document options must contain a key named :master_key with a Hash value' ) end @key_vault_endpoint = validate_param(:key_vault_endpoint, opts, FORMAT_HINT) @key_name = validate_param(:key_name, opts, FORMAT_HINT) @key_version = validate_param(:key_version, opts, FORMAT_HINT, required: false) end
Instance Attribute Details
#key_name ⇒ String (readonly)
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 31
attr_reader :key_name
#key_vault_endpoint ⇒ String (readonly)
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 28
attr_reader :key_vault_endpoint
#key_version ⇒ String | nil (readonly)
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 34
attr_reader :key_version
Instance Method Details
#to_document ⇒ BSON::Document
Convert master key document object to a BSON document in libmongocrypt format.
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 62
def to_document BSON::Document.new({ provider: 'azure', keyVaultEndpoint: key_vault_endpoint, keyName: key_name, }).tap do |bson| bson.update({ keyVersion: key_version }) unless key_version.nil? end end