Skip to content

Commit d884b61

Browse files
authored
Fixup sample for list_hmac_keys (GoogleCloudPlatform#2404)
Correct printed metadata to match canonical samples.
1 parent dc59864 commit d884b61

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

storage/cloud-client/hmac.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,9 @@ def list_keys(project_id):
2929
hmac_keys = storage_client.list_hmac_keys(project_id=project_id)
3030
print('HMAC Keys:')
3131
for hmac_key in hmac_keys:
32-
print('The HMAC key metadata is:')
33-
print('Key ID: {}'.format(hmac_key.id))
32+
print('Service Account Email: {}'.format(
33+
hmac_key.service_account_email))
3434
print('Access ID: {}'.format(hmac_key.access_id))
35-
print('Project ID: {}'.format(hmac_key.project))
36-
print('State: {}'.format(hmac_key.state))
37-
print('Created At: {}'.format(hmac_key.time_created))
38-
print('Updated At: {}'.format(hmac_key.updated))
39-
print('Etag: {}'.format(hmac_key.etag))
4035
# [END storage_list_hmac_keys]
4136
return hmac_keys
4237

@@ -55,6 +50,7 @@ def create_key(project_id, service_account_email):
5550
print('The base64 encoded secret is {}'.format(secret))
5651
print('Do not miss that secret, there is no API to recover it.')
5752
print('The HMAC key metadata is:')
53+
print('Service Account Email: {}'.format(hmac_key.service_account_email))
5854
print('Key ID: {}'.format(hmac_key.id))
5955
print('Access ID: {}'.format(hmac_key.access_id))
6056
print('Project ID: {}'.format(hmac_key.project))
@@ -78,6 +74,7 @@ def get_key(access_id, project_id):
7874
access_id,
7975
project_id=project_id)
8076
print('The HMAC key metadata is:')
77+
print('Service Account Email: {}'.format(hmac_key.service_account_email))
8178
print('Key ID: {}'.format(hmac_key.id))
8279
print('Access ID: {}'.format(hmac_key.access_id))
8380
print('Project ID: {}'.format(hmac_key.project))
@@ -103,6 +100,7 @@ def activate_key(access_id, project_id):
103100
hmac_key.state = 'ACTIVE'
104101
hmac_key.update()
105102
print('The HMAC key metadata is:')
103+
print('Service Account Email: {}'.format(hmac_key.service_account_email))
106104
print('Key ID: {}'.format(hmac_key.id))
107105
print('Access ID: {}'.format(hmac_key.access_id))
108106
print('Project ID: {}'.format(hmac_key.project))
@@ -129,6 +127,7 @@ def deactivate_key(access_id, project_id):
129127
hmac_key.update()
130128
print('The HMAC key is now inactive.')
131129
print('The HMAC key metadata is:')
130+
print('Service Account Email: {}'.format(hmac_key.service_account_email))
132131
print('Key ID: {}'.format(hmac_key.id))
133132
print('Access ID: {}'.format(hmac_key.access_id))
134133
print('Project ID: {}'.format(hmac_key.project))

0 commit comments

Comments
 (0)