in lambda-functions/kfpLambdaCustomMSKConfig.py [0:0]
def send(event, context, response_status, response_data, physical_resource_id=None):
response_url = event['ResponseURL']
response_body = {
'Status': response_status,
'Reason': "See the details in CloudWatch Log Stream: {}".format(context.log_stream_name),
'PhysicalResourceId': physical_resource_id,
'StackId': event['StackId'],
'RequestId': event['RequestId'],
'LogicalResourceId': event['LogicalResourceId'],
'NoEcho': False,
'Data': response_data
}
json_response_body = json.dumps(response_body)
headers = {
'content-type': '',
'content-length': str(len(json_response_body))
}
try:
response = http.request('PUT', response_url, headers=headers, body=json_response_body)
print("Status code:", response.status)
except Exception as e:
print("send(..) failed executing http.request(..):", e)