-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Add KMS quickstart #753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add KMS quickstart #753
Conversation
# [START kms_quickstart] | ||
# Imports the Google APIs client library | ||
from googleapiclient import discovery | ||
from oauth2client.client import GoogleCredentials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed, googleapiclient can figure out application default credentials on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
zone = 'global'; | ||
|
||
# Acquires credentials | ||
credentials = GoogleCredentials.get_application_default().create_scoped( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
# Lists key rings | ||
req = kms_client.projects().locations().keyRings().list( | ||
parent='projects/{}/locations/{}'.format(project_id, zone)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make parent its own variable, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
kms_client = discovery.build('cloudkms', 'v1beta1', credentials=credentials) | ||
|
||
# Lists key rings | ||
req = kms_client.projects().locations().keyRings().list( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request
and response
, we don't get charged by the letter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Thank you, @jmdobry! |
No description provided.