Class: Google::Cloud::Bigquery::EncryptionConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/bigquery/encryption_configuration.rb

Overview

Encryption Configuration

A builder for BigQuery table encryption configurations, passed to block arguments to Dataset#create_table and Table#encryption_configuration.

Examples:

require "google/cloud/bigquery"

bigquery = Google::Cloud::Bigquery.new
dataset = bigquery.dataset "my_dataset"
key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
encrypt_config = bigquery.encryption kms_key: key_name
table = dataset.create_table "my_table" do |updater|
  updater.encryption = encrypt_config
end

See Also:

Instance Method Summary collapse

Instance Method Details

#kms_keyString

The Cloud KMS encryption key that will be used to protect the table. For example: projects/a/locations/b/keyRings/c/cryptoKeys/d The default value is nil, which means default encryption is used.

Examples:

require "google/cloud/bigquery"

config = Google::Cloud::Bigquery::EncryptionConfiguration.new
key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
config.kms_key = key_name

Returns:

  • (String)


66
67
68
# File 'lib/google/cloud/bigquery/encryption_configuration.rb', line 66

def kms_key
  @gapi.kms_key_name
end

#kms_key=(new_kms_key_name) ⇒ Object

Set the Cloud KMS encryption key that will be used to protect the table. For example: projects/a/locations/b/keyRings/c/cryptoKeys/d The default value is nil, which means default encryption is used.

Examples:

require "google/cloud/bigquery"

config = Google::Cloud::Bigquery::EncryptionConfiguration.new
key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
config.kms_key = key_name

Parameters:

  • new_kms_key_name (String)

    New Cloud KMS key name



84
85
86
87
# File 'lib/google/cloud/bigquery/encryption_configuration.rb', line 84

def kms_key= new_kms_key_name
  frozen_check!
  @gapi.kms_key_name = new_kms_key_name
end