Class: Mongo::Crypt::KMS::GCP::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/gcp/master_document.rb |
Overview
::Mongo::Crypt::KMS::GCP
KMS master key document object contains ::Mongo::Crypt::KMS
master key parameters.
Constant Summary
-
FORMAT_HINT =
# File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 46"GCP key document must be in the format: " + "{ project_id: 'PROJECT_ID', location: 'LOCATION', " + "key_ring: 'KEY-RING', 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
- #endpoint ⇒ String | nil readonly Internal use only
- #key_name ⇒ String readonly Internal use only
- #key_ring ⇒ String readonly Internal use only
- #key_version ⇒ String | nil readonly Internal use only
- #location ⇒ String readonly Internal use only
- #project_id ⇒ String 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. |
Instance Attribute Details
#endpoint ⇒ String
| nil
(readonly)
# File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 44
attr_reader :endpoint
#key_name ⇒ String
(readonly)
# File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 38
attr_reader :key_name
#key_ring ⇒ String
(readonly)
# File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 35
attr_reader :key_ring
#key_version ⇒ String
| nil
(readonly)
# File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 41
attr_reader :key_version
#location ⇒ String
(readonly)
# File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 32
attr_reader :location
#project_id ⇒ String
(readonly)
# File 'lib/mongo/crypt/kms/gcp/master_document.rb', line 29
attr_reader :project_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/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