Skip to content

Commit 8c92a20

Browse files
Gurov Ilyatswast
authored andcommitted
refactor(bigquery): use multi-regional key path for CMEK in snippets (googleapis#9523)
* refactor(bigquery): use multi-regional key path for CMEK in snippets * black reformat
1 parent bde08e9 commit 8c92a20

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

bigquery/docs/snippets.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_create_table_cmek(client, to_delete):
179179
# Set the encryption key to use for the table.
180180
# TODO: Replace this key with a key you have created in Cloud KMS.
181181
kms_key_name = "projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}".format(
182-
"cloud-samples-tests", "us-central1", "test", "test"
182+
"cloud-samples-tests", "us", "test", "test"
183183
)
184184
table.encryption_configuration = bigquery.EncryptionConfiguration(
185185
kms_key_name=kms_key_name
@@ -500,7 +500,7 @@ def test_update_table_cmek(client, to_delete):
500500

501501
table = bigquery.Table(dataset.table(table_id))
502502
original_kms_key_name = "projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}".format(
503-
"cloud-samples-tests", "us-central1", "test", "test"
503+
"cloud-samples-tests", "us", "test", "test"
504504
)
505505
table.encryption_configuration = bigquery.EncryptionConfiguration(
506506
kms_key_name=original_kms_key_name
@@ -516,8 +516,7 @@ def test_update_table_cmek(client, to_delete):
516516
# Set a new encryption key to use for the destination.
517517
# TODO: Replace this key with a key you have created in KMS.
518518
updated_kms_key_name = (
519-
"projects/cloud-samples-tests/locations/us-central1/"
520-
"keyRings/test/cryptoKeys/otherkey"
519+
"projects/cloud-samples-tests/locations/us/keyRings/test/cryptoKeys/otherkey"
521520
)
522521
table.encryption_configuration = bigquery.EncryptionConfiguration(
523522
kms_key_name=updated_kms_key_name
@@ -831,7 +830,7 @@ def test_load_table_from_uri_cmek(client, to_delete):
831830
# Set the encryption key to use for the destination.
832831
# TODO: Replace this key with a key you have created in KMS.
833832
kms_key_name = "projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}".format(
834-
"cloud-samples-tests", "us-central1", "test", "test"
833+
"cloud-samples-tests", "us", "test", "test"
835834
)
836835
encryption_config = bigquery.EncryptionConfiguration(kms_key_name=kms_key_name)
837836
job_config.destination_encryption_configuration = encryption_config
@@ -1305,7 +1304,7 @@ def test_copy_table_cmek(client, to_delete):
13051304
# Set the encryption key to use for the destination.
13061305
# TODO: Replace this key with a key you have created in KMS.
13071306
kms_key_name = "projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}".format(
1308-
"cloud-samples-tests", "us-central1", "test", "test"
1307+
"cloud-samples-tests", "us", "test", "test"
13091308
)
13101309
encryption_config = bigquery.EncryptionConfiguration(kms_key_name=kms_key_name)
13111310
job_config = bigquery.CopyJobConfig()
@@ -1685,7 +1684,7 @@ def test_client_query_destination_table_cmek(client, to_delete):
16851684
# Set the encryption key to use for the destination.
16861685
# TODO: Replace this key with a key you have created in KMS.
16871686
kms_key_name = "projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}".format(
1688-
"cloud-samples-tests", "us-central1", "test", "test"
1687+
"cloud-samples-tests", "us", "test", "test"
16891688
)
16901689
encryption_config = bigquery.EncryptionConfiguration(kms_key_name=kms_key_name)
16911690
job_config.destination_encryption_configuration = encryption_config

0 commit comments

Comments
 (0)