aws-lambda#CloudFormationCustomResourceSuccessResponse TypeScript Examples
The following examples show how to use
aws-lambda#CloudFormationCustomResourceSuccessResponse.
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 |
public async handleEvent() {
try {
const { physicalResourceId, data } = await this.consumeEvent();
console.log(`Notifying success response...`); // tslint:disable-line
const response: CloudFormationCustomResourceSuccessResponse = {
Status: "SUCCESS",
PhysicalResourceId: physicalResourceId,
StackId: this.event.StackId,
RequestId: this.event.RequestId,
LogicalResourceId: this.event.LogicalResourceId,
Data: data,
};
await this.notify(response);
return response;
} catch (e) {
console.error("Failed to provision resource!", e.stack); // tslint:disable-line
const response: CloudFormationCustomResourceFailedResponse = {
Status: "FAILED",
Reason: e.message,
PhysicalResourceId: this.event.PhysicalResourceId ?? "Unknown",
StackId: this.event.StackId,
RequestId: this.event.RequestId,
LogicalResourceId: this.event.LogicalResourceId,
Data: {},
};
await this.notify(response);
return response;
}
}