MasterKeyDocument — Documentation by YARD 0.9.37 (original) (raw)
Class: Mongo::Crypt::KMS::GCP::MasterKeyDocumentPrivate
Inherits:
Object
- Object
- Mongo::Crypt::KMS::GCP::MasterKeyDocument show all
Includes:
Defined in:
lib/mongo/crypt/kms/gcp/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.
GCP KMS master key document object contains KMS master key parameters.
Constant Summarycollapse
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.
"GCP key document must be in the format: " + "{ project_id: 'PROJECT_ID', location: 'LOCATION', " + "key_ring: 'KEY-RING', key_name: 'KEY-NAME' }"
Instance Attribute Summary collapse
- #endpoint ⇒ String | nil readonly private
GCP KMS endpoint. - #key_name ⇒ String readonly private
GCP KMS key name. - #key_ring ⇒ String readonly private
GCP KMS key ring. - #key_version ⇒ String | nil readonly private
GCP KMS key version. - #location ⇒ String readonly private
GCP location. - #project_id ⇒ String readonly private
GCP project id.
Instance Method Summarycollapse
- #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.
62 63 64 65 66 67 68 69 70 71 72 73 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 62 def initialize(opts) if opts.empty? @empty = true return end @project_id = validate_param(:project_id, opts, FORMAT_HINT) @location = validate_param(:location, opts, FORMAT_HINT) @key_ring = validate_param(:key_ring, opts, FORMAT_HINT) @key_name = validate_param(:key_name, opts, FORMAT_HINT) @key_version = validate_param(:key_version, opts, FORMAT_HINT, required: false) @endpoint = validate_param(:endpoint, opts, FORMAT_HINT, required: false) end |
---|
Instance Attribute Details
#endpoint ⇒ String | nil
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 GCP KMS endpoint.
44 45 46 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 44 def endpoint @endpoint end |
---|
#key_name ⇒ String
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 GCP KMS key name.
38 39 40 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 38 def key_name @key_name end |
---|
#key_ring ⇒ String
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 GCP KMS key ring.
35 36 37 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 35 def key_ring @key_ring end |
---|
#key_version ⇒ String | nil
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 GCP KMS key version.
41 42 43 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 41 def key_version @key_version end |
---|
#location ⇒ String
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 GCP location.
32 33 34 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 32 def location @location end |
---|
#project_id ⇒ String
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 GCP project id.
29 30 31 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 29 def project_id @project_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.
| 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | # File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 78 def to_document return BSON::Document.new({}) if @empty BSON::Document.new({ provider: 'gcp', projectId: project_id, location: location, keyRing: key_ring, keyName: key_name }).tap do |bson| unless key_version.nil? bson.update({ keyVersion: key_version }) end unless endpoint.nil? bson.update({ endpoint: endpoint }) end end end | | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |