def send()

in src/securityhub_enabler.py [0:0]


def send(
  event, context, response_status, response_data,
  physical_resource_id=None, no_echo=False):
    response_url = event['ResponseURL']

    print(response_url)
    ls = context.log_stream_name
    response_body = {}
    response_body['Status'] = response_status
    response_body['Reason'] = 'See the details in CloudWatch Log Stream: ' + ls
    response_body['PhysicalResourceId'] = physical_resource_id or ls
    response_body['StackId'] = event['StackId']
    response_body['RequestId'] = event['RequestId']
    response_body['LogicalResourceId'] = event['LogicalResourceId']
    response_body['NoEcho'] = no_echo
    response_body['Data'] = response_data

    json_response_body = json.dumps(response_body)

    print("Response body:\n" + json_response_body)

    headers = {
        'content-type': '',
        'content-length': str(len(json_response_body))
    }
    http = urllib3.PoolManager()
    try:
        response = http.request('PUT',
                                response_url,
                                body=json_response_body,
                                headers=headers)
        print("Status code: " + response.reason)
    except Exception as e:
        print("send(..) failed executing requests.put(..): " + str(e))