Skip to content

Commit fbf98d7

Browse files
busunkim96dandhlee
authored andcommitted
fix: use crypto_key_path instead of crypto_key_path_path [(#3319)](#3319)
`crypto_key_path_path` was added to the library in error and will be removed in a future version of the library
1 parent 29c4c83 commit fbf98d7

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

kms/snippets/snippets.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ def encrypt_symmetric(project_id, location_id, key_ring_id, crypto_key_id,
7474
client = kms_v1.KeyManagementServiceClient()
7575

7676
# The resource name of the CryptoKey.
77-
name = client.crypto_key_path_path(project_id, location_id, key_ring_id,
78-
crypto_key_id)
77+
name = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id)
7978

8079
# Use the KMS API to encrypt the data.
8180
response = client.encrypt(name, plaintext)
@@ -94,8 +93,7 @@ def decrypt_symmetric(project_id, location_id, key_ring_id, crypto_key_id,
9493
client = kms_v1.KeyManagementServiceClient()
9594

9695
# The resource name of the CryptoKey.
97-
name = client.crypto_key_path_path(project_id, location_id, key_ring_id,
98-
crypto_key_id)
96+
name = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id)
9997
# Use the KMS API to decrypt the data.
10098
response = client.decrypt(name, ciphertext)
10199
return response.plaintext
@@ -219,8 +217,7 @@ def add_member_to_crypto_key_policy(
219217
client = kms_v1.KeyManagementServiceClient()
220218

221219
# The resource name of the CryptoKey.
222-
resource = client.crypto_key_path_path(project_id, location_id,
223-
key_ring_id, crypto_key_id)
220+
resource = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id)
224221
# Get the current IAM policy.
225222
policy = client.get_iam_policy(resource)
226223

@@ -282,8 +279,8 @@ def remove_member_from_crypto_key_policy(
282279
client = kms_v1.KeyManagementServiceClient()
283280

284281
# The resource name of the CryptoKey.
285-
resource = client.crypto_key_path_path(project_id, location_id,
286-
key_ring_id, crypto_key_id)
282+
resource = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id)
283+
287284
# Get the current IAM policy.
288285
policy = client.get_iam_policy(resource)
289286

@@ -365,8 +362,7 @@ def get_crypto_key_policy(project_id, location_id, key_ring_id, crypto_key_id):
365362
client = kms_v1.KeyManagementServiceClient()
366363

367364
# The resource name of the CryptoKey.
368-
resource = client.crypto_key_path_path(project_id, location_id,
369-
key_ring_id, crypto_key_id)
365+
resource = client.crypto_key_path(project_id, location_id, key_ring_id, crypto_key_id)
370366

371367
# Get the current IAM policy.
372368
policy = client.get_iam_policy(resource)

0 commit comments

Comments
 (0)