in aws/solutions/lambda-backed-cloudformation-custom-resources/update_endpoint_policy/lambda_function.py [0:0]
def validate_inputs(event, context):
"""Evaluate our inputs and error if they are incorrect."""
if DEBUG_MODE is True:
print("Received event: \n%s" % json.dumps(event, indent=2))
if 'StackId' not in event or 'ResourceProperties' not in event:
custom_raise_exception(event, context, 'Malformed CloudFormation request, missing StackId or ResourceProperties.')
# Check our CloudFormation parameters
for parameter in ['vpc-endpoint-id', 'bucket-arn', 'region']:
if parameter not in event['ResourceProperties']:
custom_raise_exception(event, context, 'Malformed CloudFormation request, missing one or more ResourceProperties.')
if event['StackId'] == '012345678910/fake-stack-id':
print("Skipping CloudFormation role validation due to local testing.")
else:
validate_role_on_create(event, context)
if DEBUG_MODE is True:
print("Stack ID : %s" % event['StackId'])
print("Stack Name : %s" % str(event['StackId']).split('/')[1])