aws-lambda#CloudFormationCustomResourceResponse TypeScript Examples
The following examples show how to use
aws-lambda#CloudFormationCustomResourceResponse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: base.ts From aws-cdk-ses-domain-identity with MIT License | 6 votes |
private notify(response: CloudFormationCustomResourceResponse) {
return new Promise<void>((resolve, reject) => {
const bufBody = Buffer.from(JSON.stringify(response), "utf8");
const req = https.request(this.event.ResponseURL, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Content-Length": bufBody.length,
},
});
function onError(e: Error) {
req.removeListener("response", onResponse);
reject(e);
}
function onResponse() {
req.removeListener("error", onError)
.destroy();
resolve();
}
req.once("error", onError)
.once("response", onResponse)
.end(bufBody);
});
}