Class: Mongo::Crypt::KMS::AWS::MasterKeyDocument Private
- Inherits:
-
Object
- Object
- Mongo::Crypt::KMS::AWS::MasterKeyDocument
- Includes:
- Validations
- Defined in:
- build/ruby-driver-master/lib/mongo/crypt/kms/aws.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.
AWS 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.
"AWS key document must be in the format: " + "{ region: 'REGION', key: 'KEY' }"
Instance Attribute Summary collapse
-
#endpoint ⇒ String | nil
readonly
private
AWS KMS endpoint.
-
#key ⇒ String
readonly
private
AWS KMS key.
-
#region ⇒ String
readonly
private
AWS region.
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.
99 100 101 102 103 104 105 106 107 108 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 99 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 @region = validate_param(:region, opts, FORMAT_HINT) @key = validate_param(:key, opts, FORMAT_HINT) @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 AWS KMS endpoint.
85 86 87 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 85 def endpoint @endpoint end |
#key ⇒ 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 AWS KMS key.
82 83 84 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 82 def key @key end |
#region ⇒ 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 AWS region.
79 80 81 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 79 def region @region 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.
113 114 115 116 117 118 119 120 121 122 123 |
# File 'build/ruby-driver-master/lib/mongo/crypt/kms/aws.rb', line 113 def to_document BSON::Document.new({ provider: 'aws', region: region, key: key, }).tap do |bson| unless endpoint.nil? bson.update({ endpoint: endpoint }) end end end |