|
1 | 1 | import { CloudFormationCustomResourceEvent, Context } from "aws-lambda"; |
2 | 2 |
|
| 3 | +/** |
| 4 | + * Response status indicating the custom resource operation succeeded. |
| 5 | + */ |
3 | 6 | export const SUCCESS: "SUCCESS"; |
| 7 | + |
| 8 | +/** |
| 9 | + * Response status indicating the custom resource operation failed. |
| 10 | + * CloudFormation will roll back the stack if FAILED is returned during create or update. |
| 11 | + */ |
4 | 12 | export const FAILED: "FAILED"; |
5 | 13 |
|
| 14 | +/** |
| 15 | + * Sends a response to the CloudFormation pre-signed S3 URL to signal the result |
| 16 | + * of a custom resource operation. Must be called in every code path of a Lambda-backed |
| 17 | + * custom resource — if not called, the CloudFormation stack will hang until it times out. |
| 18 | + * |
| 19 | + * @param event - The CloudFormation custom resource event containing the ResponseURL, |
| 20 | + * StackId, RequestId, and LogicalResourceId. |
| 21 | + * @param context - The Lambda context object, used for the log stream name and signaling completion. |
| 22 | + * @param responseStatus - Whether the operation succeeded or failed. Use `SUCCESS` or `FAILED`. |
| 23 | + * @param responseData - Optional key-value data to return to CloudFormation, |
| 24 | + * accessible via `Fn::GetAtt` in the template. |
| 25 | + * @param physicalResourceId - The unique identifier of the custom resource. |
| 26 | + * Defaults to the Lambda log stream name if not provided. |
| 27 | + * WARNING: changing this value on an update will cause CloudFormation to delete the old resource. |
| 28 | + * @param noEcho - If `true`, masks the response data from being displayed in CloudFormation outputs. |
| 29 | + * Defaults to `false`. |
| 30 | + */ |
6 | 31 | export function send( |
7 | 32 | event: CloudFormationCustomResourceEvent, |
8 | 33 | context: Context, |
9 | 34 | responseStatus: "SUCCESS" | "FAILED", |
10 | | - responseData?: object, |
| 35 | + responseData?: Record<string, unknown>, |
11 | 36 | physicalResourceId?: string, |
12 | 37 | noEcho?: boolean, |
13 | 38 | ): Promise<void>; |
0 commit comments