APIGateway - Generate API key value when no value provided (#1713)

This commit is contained in:
Aidan Fewster 2018-07-13 12:53:00 +01:00 committed by Terry Cain
commit c20e8568e0
2 changed files with 2 additions and 6 deletions

View file

@ -300,11 +300,7 @@ class ApiKey(BaseModel, dict):
generateDistinctId=False, value=None, stageKeys=None, customerId=None):
super(ApiKey, self).__init__()
self['id'] = create_id()
if generateDistinctId:
# Best guess of what AWS does internally
self['value'] = ''.join(random.sample(string.ascii_letters + string.digits, 40))
else:
self['value'] = value
self['value'] = value if value else ''.join(random.sample(string.ascii_letters + string.digits, 40))
self['name'] = name
self['customerId'] = customerId
self['description'] = description