Skip to content

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

Merged
merged 1 commit into from
Jan 11, 2017
Merged

Add KMS quickstart #753

merged 1 commit into from
Jan 11, 2017

Conversation

jmdobry
Copy link
Member

@jmdobry jmdobry commented Jan 11, 2017

No description provided.

@jmdobry jmdobry self-assigned this Jan 11, 2017
@jmdobry jmdobry requested a review from theacodes January 11, 2017 18:16
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 11, 2017
# [START kms_quickstart]
# Imports the Google APIs client library
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
Copy link
Contributor

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.

Copy link
Member Author

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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here.

Copy link
Member Author

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))
Copy link
Contributor

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.

Copy link
Member Author

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(
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@theacodes theacodes merged commit fa8bc81 into master Jan 11, 2017
@theacodes theacodes deleted the kms branch January 11, 2017 18:57
@theacodes
Copy link
Contributor

Thank you, @jmdobry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants