Class: Mongo::Crypt::KMS::GCP::Credentials Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Forwardable
|
|
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/mongo/crypt/kms/gcp/credentials.rb |
Overview
::Mongo::Crypt::KMS::GCP
Cloud Key Management Credentials
object contains credentials for using ::Mongo::Crypt::KMS::GCP
KMS provider.
Constant Summary
-
FORMAT_HINT =
# File 'lib/mongo/crypt/kms/gcp/credentials.rb', line 45"GCP KMS provider options must be in the format: " + "{ email: 'EMAIL', private_key: 'PRIVATE-KEY' }"
Class Method Summary
-
.new(opts) ⇒ Credentials
constructor
Internal use only
Creates an
::Mongo::Crypt::KMS::GCP
KMS credentials object form a parameters hash.
Instance Attribute Summary
- #access_token ⇒ String | nil readonly Internal use only
- #email ⇒ String readonly Internal use only
- #endpoint ⇒ String | nil readonly Internal use only
- #private_key ⇒ String readonly Internal use only
Instance Method Summary
-
#to_document ⇒ BSON::Document
Internal use only
Convert credentials 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
#access_token ⇒ String
| nil
(readonly)
# File 'lib/mongo/crypt/kms/gcp/credentials.rb', line 40
attr_reader :access_token
#email ⇒ String
(readonly)
# File 'lib/mongo/crypt/kms/gcp/credentials.rb', line 31
attr_reader :email
#endpoint ⇒ String
| nil
(readonly)
# File 'lib/mongo/crypt/kms/gcp/credentials.rb', line 37
attr_reader :endpoint
#private_key ⇒ String
(readonly)
# File 'lib/mongo/crypt/kms/gcp/credentials.rb', line 34
attr_reader :private_key
Instance Method Details
#to_document ⇒ BSON::Document
Convert credentials object to a BSON document in libmongocrypt format.
# File 'lib/mongo/crypt/kms/gcp/credentials.rb', line 108
def to_document return BSON::Document.new if empty? if access_token BSON::Document.new({ accessToken: access_token }) else BSON::Document.new({ email: email, privateKey: BSON::Binary.new(private_key, :generic), }).tap do |bson| unless endpoint.nil? bson.update({ endpoint: endpoint }) end end end end