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}.
@see cloud.google.com/bigquery/docs/customer-managed-encryption
Protecting Data with Cloud KMS Keys
@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
Attributes
@private The Google
API Client object.
Public Class Methods
@private Google
API Client object.
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 102 def self.from_gapi gapi new_config = new new_config.instance_variable_set :@gapi, gapi new_config end
@private Create an empty EncryptionConfiguration
object.
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 47 def initialize @gapi = Google::Apis::BigqueryV2::EncryptionConfiguration.new end
Public Instance Methods
@private
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 109 def == other return false unless other.is_a? EncryptionConfiguration to_gapi.to_json == other.to_gapi.to_json end
@private
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 89 def changed? return false if frozen? @original_json != @gapi.to_json end
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.
@return [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
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 65 def kms_key @gapi.kms_key_name end
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.
@param [String] new_kms_key_name 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
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 83 def kms_key= new_kms_key_name frozen_check! @gapi.kms_key_name = new_kms_key_name end
@private Google
API Client object.
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 96 def to_gapi @gapi end
Protected Instance Methods
# File lib/google/cloud/bigquery/encryption_configuration.rb, line 116 def frozen_check! return unless frozen? raise ArgumentError, "Cannot modify a frozen encryption configuration" end