BigQuery API - Class Google::Cloud::Bigquery::EncryptionConfiguration (v1.51.0)

Reference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::EncryptionConfiguration.

Encryption Configuration

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

Inherits

  • Object

Example

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

Methods

#kms_key

def kms_key() -> String

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.

Returns
  • (String)
Example
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

#kms_key=

def kms_key=(new_kms_key_name)

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.

Parameter
  • new_kms_key_name (String) — New Cloud KMS key name
Example
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