From 93a0b6ea37ee49e2615f106bd16b2bcaf5a2e42d Mon Sep 17 00:00:00 2001 From: Ryan Matsumoto Date: Tue, 7 Feb 2017 15:01:49 -0800 Subject: [PATCH 1/2] random generation of keyring / cryptokey names --- kms/api-client/snippets_test.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kms/api-client/snippets_test.py b/kms/api-client/snippets_test.py index e4deda1c128..78296f3b2ce 100644 --- a/kms/api-client/snippets_test.py +++ b/kms/api-client/snippets_test.py @@ -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 @@ -22,10 +25,14 @@ LOCATION = 'global' # Your Google Cloud Platform KeyRing name -KEYRING = 'sample-keyring-43' +KEYRING = '' +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 From 2a371cd8d86fb26238fe3d1b9c4e2785d610b99a Mon Sep 17 00:00:00 2001 From: Ryan Matsumoto Date: Wed, 8 Feb 2017 14:38:23 -0800 Subject: [PATCH 2/2] Fixed formatting of keyring name and cryptokey name --- kms/api-client/snippets_test.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kms/api-client/snippets_test.py b/kms/api-client/snippets_test.py index 78296f3b2ce..2ea0b12c3a5 100644 --- a/kms/api-client/snippets_test.py +++ b/kms/api-client/snippets_test.py @@ -25,14 +25,12 @@ LOCATION = 'global' # Your Google Cloud Platform KeyRing name -KEYRING = '' -for _ in range(12): - KEYRING += random.choice(string.ascii_lowercase + string.digits) +KEYRING = ''.join( + random.choice(string.ascii_lowercase + string.digits) for _ in range(12)) # Your Google Cloud Platform CryptoKey name -CRYPTOKEY = '' -for _ in range(12): - CRYPTOKEY += random.choice(string.ascii_lowercase + string.digits) +CRYPTOKEY = ''.join( + random.choice(string.ascii_lowercase + string.digits) for _ in range(12)) # Your Google Cloud Platform CryptoKeyVersion name VERSION = 1