From a74d0e43a8f37eda012feb23d70150412a287581 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Wed, 22 Apr 2020 09:16:04 -0700 Subject: [PATCH] fix: use `crypto_key_path` instead of `crypto_key_path_path` [(#3319)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/3319) `crypto_key_path_path` was added to the library in error and will be removed in a future version of the library --- .../samples/snippets/snippets.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/google-cloud-kms/samples/snippets/snippets.py b/packages/google-cloud-kms/samples/snippets/snippets.py index d4209e6b18fb..e09a3a799ace 100644 --- a/packages/google-cloud-kms/samples/snippets/snippets.py +++ b/packages/google-cloud-kms/samples/snippets/snippets.py @@ -74,8 +74,7 @@ def encrypt_symmetric(project_id, location_id, key_ring_id, crypto_key_id, client = kms_v1.KeyManagementServiceClient() # The resource name of the CryptoKey. - name = client.crypto_key_path_path(project_id, location_id, key_ring_id, - crypto_key_id) + name = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id) # Use the KMS API to encrypt the data. response = client.encrypt(name, plaintext) @@ -94,8 +93,7 @@ def decrypt_symmetric(project_id, location_id, key_ring_id, crypto_key_id, client = kms_v1.KeyManagementServiceClient() # The resource name of the CryptoKey. - name = client.crypto_key_path_path(project_id, location_id, key_ring_id, - crypto_key_id) + name = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id) # Use the KMS API to decrypt the data. response = client.decrypt(name, ciphertext) return response.plaintext @@ -219,8 +217,7 @@ def add_member_to_crypto_key_policy( client = kms_v1.KeyManagementServiceClient() # The resource name of the CryptoKey. - resource = client.crypto_key_path_path(project_id, location_id, - key_ring_id, crypto_key_id) + resource = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id) # Get the current IAM policy. policy = client.get_iam_policy(resource) @@ -282,8 +279,8 @@ def remove_member_from_crypto_key_policy( client = kms_v1.KeyManagementServiceClient() # The resource name of the CryptoKey. - resource = client.crypto_key_path_path(project_id, location_id, - key_ring_id, crypto_key_id) + resource = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id) + # Get the current IAM policy. policy = client.get_iam_policy(resource) @@ -365,8 +362,7 @@ def get_crypto_key_policy(project_id, location_id, key_ring_id, crypto_key_id): client = kms_v1.KeyManagementServiceClient() # The resource name of the CryptoKey. - resource = client.crypto_key_path_path(project_id, location_id, - key_ring_id, crypto_key_id) + resource = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id) # Get the current IAM policy. policy = client.get_iam_policy(resource)