def sendResponse()

in initial-pipeline/initial-commit/initial-commit.py [0:0]


def sendResponse(event, context, responseStatus, responseData):
    responseBody = json.dumps({
        "Status": responseStatus,
        "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name,
        "PhysicalResourceId": context.log_stream_name,
        "StackId": event['StackId'],
        "RequestId": event['RequestId'],
        "LogicalResourceId": event['LogicalResourceId'],
        "Data": responseData
    })
    encoded_data = responseBody.encode('utf-8')
    hdr = {'Content-Type': ''}
    http = urllib3.PoolManager()
    response= http.urlopen('PUT', event['ResponseURL'],body=encoded_data, headers=hdr)
    resp_body = response.data.decode('utf-8')
    print("Status code: {}".format(response.status))
    print("Status message: {}".format(resp_body))
    return responseBody