Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1be3bfc

Browse filesBrowse files
philcoakleyJon Wayne Parrott
authored andcommitted
Updates Could-KMS sample code to use V1 libraries. (GoogleCloudPlatform#856)
1 parent 215ee17 commit 1be3bfc
Copy full SHA for 1be3bfc

File tree

Expand file treeCollapse file tree

3 files changed

+10
-10
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-10
lines changed

‎kms/api-client/quickstart.py

Copy file name to clipboardExpand all lines: kms/api-client/quickstart.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def run_quickstart():
2626
location = 'global'
2727

2828
# Creates an API client for the KMS API.
29-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
29+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
3030

3131
# The resource name of the location associated with the key rings.
3232
parent = 'projects/{}/locations/{}'.format(project_id, location)

‎kms/api-client/snippets.py

Copy file name to clipboardExpand all lines: kms/api-client/snippets.py
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def create_keyring(project_id, location, keyring):
2525
"""Creates a KeyRing in the given location (e.g. global)."""
2626

2727
# Creates an API client for the KMS API.
28-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
28+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
2929

3030
# The resource name of the location associated with the KeyRing.
3131
parent = 'projects/{}/locations/{}'.format(project_id, location)
@@ -44,7 +44,7 @@ def create_cryptokey(project_id, location, keyring, cryptokey):
4444
"""Creates a CryptoKey within a KeyRing in the given location."""
4545

4646
# Creates an API client for the KMS API.
47-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
47+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
4848

4949
# The resource name of the KeyRing associated with the CryptoKey.
5050
parent = 'projects/{}/locations/{}/keyRings/{}'.format(
@@ -68,7 +68,7 @@ def encrypt(project_id, location, keyring, cryptokey, plaintext_file_name,
6868
call to decrypt."""
6969

7070
# Creates an API client for the KMS API.
71-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
71+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
7272

7373
# The resource name of the CryptoKey.
7474
name = 'projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}'.format(
@@ -101,7 +101,7 @@ def decrypt(project_id, location, keyring, cryptokey, encrypted_file_name,
101101
decrpyted_file_name."""
102102

103103
# Creates an API client for the KMS API.
104-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
104+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
105105

106106
# The resource name of the CryptoKey.
107107
name = 'projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}'.format(
@@ -134,7 +134,7 @@ def disable_cryptokey_version(project_id, location, keyring, cryptokey,
134134
KeyRing."""
135135

136136
# Creates an API client for the KMS API.
137-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
137+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
138138

139139
# Construct the resource name of the CryptoKeyVersion.
140140
name = (
@@ -160,7 +160,7 @@ def destroy_cryptokey_version(
160160
KeyRing for destruction 24 hours in the future."""
161161

162162
# Creates an API client for the KMS API.
163-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
163+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
164164

165165
# Construct the resource name of the CryptoKeyVersion.
166166
name = (
@@ -185,7 +185,7 @@ def add_member_to_cryptokey_policy(
185185
(IAM) policy for a given CryptoKey associated with a KeyRing."""
186186

187187
# Creates an API client for the KMS API.
188-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
188+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
189189

190190
# The resource name of the CryptoKey.
191191
parent = 'projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}'.format(
@@ -225,7 +225,7 @@ def get_keyring_policy(project_id, location, keyring):
225225
and prints out roles and the members assigned to those roles."""
226226

227227
# Creates an API client for the KMS API.
228-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
228+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
229229

230230
# The resource name of the KeyRing.
231231
parent = 'projects/{}/locations/{}/keyRings/{}'.format(

‎kms/api-client/snippets_test.py

Copy file name to clipboardExpand all lines: kms/api-client/snippets_test.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_add_member_to_cryptokey_policy(capsys, cloud_config):
122122
.format(MEMBER, ROLE, CRYPTOKEY, KEYRING))
123123
assert expected in out
124124

125-
kms_client = googleapiclient.discovery.build('cloudkms', 'v1beta1')
125+
kms_client = googleapiclient.discovery.build('cloudkms', 'v1')
126126
parent = 'projects/{}/locations/{}/keyRings/{}/cryptoKeys/{}'.format(
127127
cloud_config.project, LOCATION, KEYRING, CRYPTOKEY)
128128
cryptokeys = kms_client.projects().locations().keyRings().cryptoKeys()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.