Skip to content

random generation of keyring / cryptokey names #786

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 2 commits into from
Feb 8, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions kms/api-client/snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

import random
import string

from googleapiclient import discovery

import snippets
Expand All @@ -22,10 +25,14 @@
LOCATION = 'global'

# Your Google Cloud Platform KeyRing name
KEYRING = 'sample-keyring-43'
KEYRING = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Here's a one-liner for you

KEYRING = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(12))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

for _ in range(12):
KEYRING += random.choice(string.ascii_lowercase + string.digits)

# Your Google Cloud Platform CryptoKey name
CRYPTOKEY = 'sample-key-43'
CRYPTOKEY = ''
for _ in range(12):
CRYPTOKEY += random.choice(string.ascii_lowercase + string.digits)

# Your Google Cloud Platform CryptoKeyVersion name
VERSION = 1
Expand Down