Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
fix: use crypto_key_path instead of crypto_key_path_path [(#3319)](
Browse files Browse the repository at this point in the history
…GoogleCloudPlatform/python-docs-samples#3319)

`crypto_key_path_path` was added to the library in error and will be removed in a future version of the library
  • Loading branch information
busunkim96 committed Jun 4, 2020
1 parent 58a3c4c commit 8068e87
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions samples/snippets/snippets.py
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8068e87

Please sign in to comment.