Class: Mongo::Crypt::KMS::Azure::MasterKeyDocument Private
- Inherits:
-
Object
- Object
- Mongo::Crypt::KMS::Azure::MasterKeyDocument
- Includes:
- Validations
- Defined in:
- lib/mongo/crypt/kms/azure/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.
Azure 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.
"Azure key document must be in the format: " + "{ key_vault_endpoint: 'KEY_VAULT_ENDPOINT', key_name: 'KEY_NAME' }"
Instance Attribute Summary collapse
-
#key_name ⇒ String
readonly
private
Azure KMS key name.
-
#key_vault_endpoint ⇒ String
readonly
private
Azure key vault endpoint.
-
#key_version ⇒ String | nil
readonly
private
Azure KMS key version.
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 57 58 |
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 49 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)
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 Azure KMS key name.
32 33 34 |
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 32 def key_name @key_name end |
#key_vault_endpoint ⇒ String (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 Azure key vault endpoint.
29 30 31 |
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 29 def key_vault_endpoint @key_vault_endpoint end |
#key_version ⇒ 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 Azure KMS key version.
35 36 37 |
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 35 def key_version @key_version 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.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/mongo/crypt/kms/azure/master_document.rb', line 63 def to_document BSON::Document.new({ provider: 'azure', keyVaultEndpoint: key_vault_endpoint, keyName: key_name, }).tap do |bson| unless key_version.nil? bson.update({ keyVersion: key_version }) end end end |