Method: Mongo::Crypt::KMS::GCP::MasterKeyDocument#initialize

Defined in:
lib/mongo/crypt/kms/gcp/master_document.rb

#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.

Parameters:

  • opts (Hash)

    A hash that contains master key options for the GCP KMS provider.

Options Hash (opts):

  • :project_id (String)

    GCP project id.

  • :location (String)

    GCP location.

  • :key_ring (String)

    GCP KMS key ring.

  • :key_name (String)

    GCP KMS key name.

  • :key_version (String | nil)

    GCP KMS key version, optional.

  • :endpoint (String | nil)

    GCP KMS key endpoint, optional.

Raises:

  • (ArgumentError)

    If required options are missing or incorrectly.



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