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.
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
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# BigQuery API - Class Google::Cloud::Bigquery::EncryptionConfiguration (v1.56.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.56.0 (latest)](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.55.0](/ruby/docs/reference/google-cloud-bigquery/1.55.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.54.0](/ruby/docs/reference/google-cloud-bigquery/1.54.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.53.0](/ruby/docs/reference/google-cloud-bigquery/1.53.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.52.1](/ruby/docs/reference/google-cloud-bigquery/1.52.1/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.51.1](/ruby/docs/reference/google-cloud-bigquery/1.51.1/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.50.0](/ruby/docs/reference/google-cloud-bigquery/1.50.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.49.1](/ruby/docs/reference/google-cloud-bigquery/1.49.1/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.48.1](/ruby/docs/reference/google-cloud-bigquery/1.48.1/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.47.0](/ruby/docs/reference/google-cloud-bigquery/1.47.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.46.1](/ruby/docs/reference/google-cloud-bigquery/1.46.1/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.45.0](/ruby/docs/reference/google-cloud-bigquery/1.45.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.44.2](/ruby/docs/reference/google-cloud-bigquery/1.44.2/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.43.1](/ruby/docs/reference/google-cloud-bigquery/1.43.1/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.42.0](/ruby/docs/reference/google-cloud-bigquery/1.42.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.41.0](/ruby/docs/reference/google-cloud-bigquery/1.41.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.40.0](/ruby/docs/reference/google-cloud-bigquery/1.40.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.39.0](/ruby/docs/reference/google-cloud-bigquery/1.39.0/Google-Cloud-Bigquery-EncryptionConfiguration)\n- [1.38.1](/ruby/docs/reference/google-cloud-bigquery/1.38.1/Google-Cloud-Bigquery-EncryptionConfiguration) \nReference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::EncryptionConfiguration.\n\nEncryption Configuration\n------------------------\n\nA builder for BigQuery table encryption configurations, passed to block\narguments to [Dataset#create_table](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Dataset#Google__Cloud__Bigquery__Dataset_create_table_instance_ \"Google::Cloud::Bigquery::Dataset#create_table (method)\") and [Table#encryption](/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery-Table#Google__Cloud__Bigquery__Table_encryption_instance_ \"Google::Cloud::Bigquery::Table#encryption (method)\"). \n\nInherits\n--------\n\n- Object\n\nExample\n-------\n\n```ruby\nrequire \"google/cloud/bigquery\"\n\nbigquery = Google::Cloud::Bigquery.new\ndataset = bigquery.dataset \"my_dataset\"\nkey_name = \"projects/a/locations/b/keyRings/c/cryptoKeys/d\"\nencrypt_config = bigquery.encryption kms_key: key_name\ntable = dataset.create_table \"my_table\" do |updater|\n updater.encryption = encrypt_config\nend\n```\n\nMethods\n-------\n\n### #kms_key\n\n def kms_key() -\u003e String\n\nThe Cloud KMS encryption key that will be used to protect the table.\nFor example: `projects/a/locations/b/keyRings/c/cryptoKeys/d`\nThe default value is `nil`, which means default encryption is used. \n**Returns**\n\n- (String)\n**Example** \n\n```ruby\nrequire \"google/cloud/bigquery\"\n\nconfig = Google::Cloud::Bigquery::EncryptionConfiguration.new\nkey_name = \"projects/a/locations/b/keyRings/c/cryptoKeys/d\"\nconfig.kms_key = key_name\n```\n\n### #kms_key=\n\n def kms_key=(new_kms_key_name)\n\nSet the Cloud KMS encryption key that will be used to protect the\ntable. For example: `projects/a/locations/b/keyRings/c/cryptoKeys/d`\nThe default value is `nil`, which means default encryption is used. \n**Parameter**\n\n- **new_kms_key_name** (String) --- New Cloud KMS key name\n**Example** \n\n```ruby\nrequire \"google/cloud/bigquery\"\n\nconfig = Google::Cloud::Bigquery::EncryptionConfiguration.new\nkey_name = \"projects/a/locations/b/keyRings/c/cryptoKeys/d\"\nconfig.kms_key = key_name\n```"]]