From 40f07ae330d074cfa7861e24a0427da7ec427f68 Mon Sep 17 00:00:00 2001 From: Kazuho Cryer-Shinozuka Date: Fri, 25 Oct 2024 09:24:55 +0900 Subject: [PATCH] feat(redshift-alpha): query execution timeout setting during table creation (#31818) ### Issue # (if applicable) Closes #31329. ### Reason for this change The timeout setting for the custom resource that executes the query is fixed at 1 minute, causing a timeout when attempting to run heavy operations. Detail example is describe in [the original issue](https://github.com/aws/aws-cdk/issues/31329#issuecomment-2353613773). ### Description of changes - Add timeout prop to `DatabaseQueryProps` and `TableProps` ### Description of how you validated changes Added both unit and integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../@aws-cdk/aws-redshift-alpha/README.md | 18 ++ .../lib/private/database-query.ts | 18 +- .../@aws-cdk/aws-redshift-alpha/lib/table.ts | 9 + .../test/database-query.test.ts | 32 +++ .../cfn-response.js | 88 --------- .../framework.js | 164 ---------------- .../privileges.js | 65 ------ .../user.js | 70 ------- .../handler-name.js | 0 .../index.js | 0 .../privileges.js | 69 +++++++ .../redshift-data.js | 0 .../table.js | 4 +- .../types.js | 0 .../user.js | 70 +++++++ .../util.js | 0 .../cfn-response.js | 106 ++++++++++ .../consts.js | 0 .../framework.js | 185 ++++++++++++++++++ .../outbound.js | 0 .../util.js | 0 ...-cdk-redshift-cluster-database.assets.json | 18 +- ...dk-redshift-cluster-database.template.json | 6 +- .../cdk.out | 2 +- .../integ.json | 2 +- .../manifest.json | 6 +- ...efaultTestDeployAssert4339FB48.assets.json | 2 +- .../tree.json | 6 +- .../test/integ.database-columnid.ts | 1 + .../aws-redshift-alpha/test/table.test.ts | 35 ++++ 30 files changed, 567 insertions(+), 409 deletions(-) delete mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/cfn-response.js delete mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/framework.js delete mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/privileges.js delete mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/user.js rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2 => asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510}/handler-name.js (100%) rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2 => asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510}/index.js (100%) create mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/privileges.js rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2 => asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510}/redshift-data.js (100%) rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2 => asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510}/table.js (58%) rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2 => asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510}/types.js (100%) create mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/user.js rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2 => asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510}/util.js (100%) create mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/cfn-response.js rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5 => asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4}/consts.js (100%) create mode 100644 packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/framework.js rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5 => asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4}/outbound.js (100%) rename packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/{asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5 => asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4}/util.js (100%) diff --git a/packages/@aws-cdk/aws-redshift-alpha/README.md b/packages/@aws-cdk/aws-redshift-alpha/README.md index 04b0d911c963d..247061f2378a5 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/README.md +++ b/packages/@aws-cdk/aws-redshift-alpha/README.md @@ -274,6 +274,24 @@ new Table(this, 'Table', { }); ``` +Query execution duration is limited to 1 minute by default. You can change this by setting the `timeout` property. + +Valid timeout values are between 1 seconds and 15 minutes. + +```ts fixture=cluster +import { Duration } from 'aws-cdk-lib'; + +new Table(this, 'Table', { + tableColumns: [ + { id: 'col1', name: 'col1', dataType: 'varchar(4)' }, + { id: 'col2', name: 'col2', dataType: 'float' } + ], + cluster: cluster, + databaseName: 'databaseName', + timeout: Duration.minutes(15), +}); +``` + ### Granting Privileges You can give a user privileges to perform certain actions on a table by using the diff --git a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts index dd6404fae905c..c5bcd30333362 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/lib/private/database-query.ts @@ -18,6 +18,13 @@ export interface DatabaseQueryProps extends DatabaseOptions { * @default cdk.RemovalPolicy.Destroy */ readonly removalPolicy?: cdk.RemovalPolicy; + + /** + * The handler timeout duration + * + * @default cdk.Duration.minutes(1) + */ + readonly timeout?: cdk.Duration; } export class DatabaseQuery extends Construct implements iam.IGrantable { @@ -29,6 +36,15 @@ export class DatabaseQuery extends Construct implements iam.IGrant constructor(scope: Construct, id: string, props: DatabaseQueryProps) { super(scope, id); + if (props.timeout && !cdk.Token.isUnresolved(props.timeout)) { + if (props.timeout.toMilliseconds() < cdk.Duration.seconds(1).toMilliseconds()) { + throw new Error(`The timeout for the handler must be BETWEEN 1 second and 15 minutes, got ${props.timeout.toMilliseconds()} milliseconds.`); + } + if (props.timeout.toSeconds() > cdk.Duration.minutes(15).toSeconds()) { + throw new Error(`The timeout for the handler must be between 1 second and 15 minutes, got ${props.timeout.toSeconds()} seconds.`); + } + } + const adminUser = this.getAdminUser(props); const handler = new lambda.SingletonFunction(this, 'Handler', { code: lambda.Code.fromAsset(path.join(__dirname, 'database-query-provider'), { @@ -36,7 +52,7 @@ export class DatabaseQuery extends Construct implements iam.IGrant }), runtime: lambda.determineLatestNodeRuntime(this), handler: 'index.handler', - timeout: cdk.Duration.minutes(1), + timeout: props.timeout ?? cdk.Duration.minutes(1), uuid: '3de5bea7-27da-4796-8662-5efb56431b5f', lambdaPurpose: 'Query Redshift Database', }); diff --git a/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts b/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts index efa6d2d32e5f0..3220b2dc2ceb5 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts @@ -149,6 +149,15 @@ export interface TableProps extends DatabaseOptions { * @default - no comment */ readonly tableComment?: string; + + /** + * Handler timeout duration. + * + * Valid values are between 1 second and 15 minutes. + * + * @default - 1 minute + */ + readonly timeout?: cdk.Duration; } /** diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/database-query.test.ts b/packages/@aws-cdk/aws-redshift-alpha/test/database-query.test.ts index 226aaa0a77c7e..736f13eaaa46f 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/database-query.test.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/test/database-query.test.ts @@ -166,6 +166,38 @@ describe('database query', () => { }); }); + describe('timeout', () => { + it('passes timeout', () => { + new DatabaseQuery(stack, 'Query', { + ...minimalProps, + timeout: cdk.Duration.minutes(5), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Timeout: 300, + Role: { 'Fn::GetAtt': ['QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717', 'Arn'] }, + Handler: 'index.handler', + Code: { + S3Bucket: { 'Fn::Sub': 'cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}' }, + }, + }); + }); + + it('throw error for timeout being too short', () => { + expect(() => new DatabaseQuery(stack, 'Query', { + ...minimalProps, + timeout: cdk.Duration.millis(999), + })).toThrow('The timeout for the handler must be BETWEEN 1 second and 15 minutes, got 999 milliseconds.'); + }); + + it('throw error for timeout being too long', () => { + expect(() => new DatabaseQuery(stack, 'Query', { + ...minimalProps, + timeout: cdk.Duration.minutes(16), + })).toThrow('The timeout for the handler must be between 1 second and 15 minutes, got 960 seconds.'); + }); + }); + it('passes removal policy through', () => { new DatabaseQuery(stack, 'Query', { ...minimalProps, diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/cfn-response.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/cfn-response.js deleted file mode 100644 index 817fd458250de..0000000000000 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/cfn-response.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Retry = exports.safeHandler = exports.includeStackTraces = exports.submitResponse = exports.MISSING_PHYSICAL_ID_MARKER = exports.CREATE_FAILED_PHYSICAL_ID_MARKER = void 0; -/* eslint-disable max-len */ -/* eslint-disable no-console */ -const url = require("url"); -const outbound_1 = require("./outbound"); -const util_1 = require("./util"); -exports.CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -exports.MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function submitResponse(status, event, options = {}) { - const json = { - Status: status, - Reason: options.reason || status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || exports.MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: options.noEcho, - Data: event.Data, - }; - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; - (0, util_1.log)('submit response to cloudformation', loggingSafeUrl, json); - const retryOptions = { - attempts: 5, - sleep: 1000, - }; - await (0, util_1.withRetries)(retryOptions, outbound_1.httpRequest)({ - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { - 'content-type': '', - 'content-length': Buffer.byteLength(responseBody, 'utf8'), - }, - }, responseBody); -} -exports.submitResponse = submitResponse; -exports.includeStackTraces = true; // for unit tests -function safeHandler(block) { - return async (event) => { - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === exports.CREATE_FAILED_PHYSICAL_ID_MARKER) { - (0, util_1.log)('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - await block(event); - } - catch (e) { - // tell waiter state machine to retry - if (e instanceof Retry) { - (0, util_1.log)('retry requested by handler'); - throw e; - } - if (!event.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - (0, util_1.log)('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - event.PhysicalResourceId = exports.CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - (0, util_1.log)(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify({ ...event, ResponseURL: '...' })}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', event, { - reason: exports.includeStackTraces ? e.stack : e.message, - }); - } - }; -} -exports.safeHandler = safeHandler; -class Retry extends Error { -} -exports.Retry = Retry; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZuLXJlc3BvbnNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2ZuLXJlc3BvbnNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDRCQUE0QjtBQUM1QiwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBQzNCLHlDQUF5QztBQUN6QyxpQ0FBMEM7QUFFN0IsUUFBQSxnQ0FBZ0MsR0FBRyx3REFBd0QsQ0FBQztBQUM1RixRQUFBLDBCQUEwQixHQUFHLDhEQUE4RCxDQUFDO0FBZ0JsRyxLQUFLLFVBQVUsY0FBYyxDQUFDLE1BQTRCLEVBQUUsS0FBaUMsRUFBRSxVQUF5QyxFQUFHO0lBQ2hKLE1BQU0sSUFBSSxHQUFtRDtRQUMzRCxNQUFNLEVBQUUsTUFBTTtRQUNkLE1BQU0sRUFBRSxPQUFPLENBQUMsTUFBTSxJQUFJLE1BQU07UUFDaEMsT0FBTyxFQUFFLEtBQUssQ0FBQyxPQUFPO1FBQ3RCLFNBQVMsRUFBRSxLQUFLLENBQUMsU0FBUztRQUMxQixrQkFBa0IsRUFBRSxLQUFLLENBQUMsa0JBQWtCLElBQUksa0NBQTBCO1FBQzFFLGlCQUFpQixFQUFFLEtBQUssQ0FBQyxpQkFBaUI7UUFDMUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNO1FBQ3RCLElBQUksRUFBRSxLQUFLLENBQUMsSUFBSTtLQUNqQixDQUFDO0lBRUYsTUFBTSxZQUFZLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUUxQyxNQUFNLFNBQVMsR0FBRyxHQUFHLENBQUMsS0FB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0ZW5kcyBFcnJvciB7IH1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/framework.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/framework.js deleted file mode 100644 index cd79e607eefe7..0000000000000 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/framework.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -/* eslint-disable max-len */ -/* eslint-disable no-console */ -const cfnResponse = require("./cfn-response"); -const consts = require("./consts"); -const outbound_1 = require("./outbound"); -const util_1 = require("./util"); -/** - * The main runtime entrypoint of the async custom resource lambda function. - * - * Any lifecycle event changes to the custom resources will invoke this handler, which will, in turn, - * interact with the user-defined `onEvent` and `isComplete` handlers. - * - * This function will always succeed. If an error occurs, it is logged but an error is not thrown. - * - * @param cfnRequest The cloudformation custom resource event. - */ -async function onEvent(cfnRequest) { - const sanitizedRequest = { ...cfnRequest, ResponseURL: '...' }; - (0, util_1.log)('onEventHandler', sanitizedRequest); - cfnRequest.ResourceProperties = cfnRequest.ResourceProperties || {}; - const onEventResult = await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV, sanitizedRequest, cfnRequest.ResponseURL); - (0, util_1.log)('onEvent returned:', onEventResult); - // merge the request and the result from onEvent to form the complete resource event - // this also performs validation. - const resourceEvent = createResponseEvent(cfnRequest, onEventResult); - (0, util_1.log)('event:', onEventResult); - // determine if this is an async provider based on whether we have an isComplete handler defined. - // if it is not defined, then we are basically ready to return a positive response. - if (!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV]) { - return cfnResponse.submitResponse('SUCCESS', resourceEvent, { noEcho: resourceEvent.NoEcho }); - } - // ok, we are not complete, so kick off the waiter workflow - const waiter = { - stateMachineArn: (0, util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV), - name: resourceEvent.RequestId, - input: JSON.stringify(resourceEvent), - }; - (0, util_1.log)('starting waiter', { - stateMachineArn: (0, util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV), - name: resourceEvent.RequestId, - }); - // kick off waiter state machine - await (0, outbound_1.startExecution)(waiter); -} -// invoked a few times until `complete` is true or until it times out. -async function isComplete(event) { - const sanitizedRequest = { ...event, ResponseURL: '...' }; - (0, util_1.log)('isComplete', sanitizedRequest); - const isCompleteResult = await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV, sanitizedRequest, event.ResponseURL); - (0, util_1.log)('user isComplete returned:', isCompleteResult); - // if we are not complete, return false, and don't send a response back. - if (!isCompleteResult.IsComplete) { - if (isCompleteResult.Data && Object.keys(isCompleteResult.Data).length > 0) { - throw new Error('"Data" is not allowed if "IsComplete" is "False"'); - } - // This must be the full event, it will be deserialized in `onTimeout` to send the response to CloudFormation - throw new cfnResponse.Retry(JSON.stringify(event)); - } - const response = { - ...event, - ...isCompleteResult, - Data: { - ...event.Data, - ...isCompleteResult.Data, - }, - }; - await cfnResponse.submitResponse('SUCCESS', response, { noEcho: event.NoEcho }); -} -// invoked when completion retries are exhaused. -async function onTimeout(timeoutEvent) { - (0, util_1.log)('timeoutHandler', timeoutEvent); - const isCompleteRequest = JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage); - await cfnResponse.submitResponse('FAILED', isCompleteRequest, { - reason: 'Operation timed out', - }); -} -async function invokeUserFunction(functionArnEnv, sanitizedPayload, responseUrl) { - const functionArn = (0, util_1.getEnv)(functionArnEnv); - (0, util_1.log)(`executing user function ${functionArn} with payload`, sanitizedPayload); - // transient errors such as timeouts, throttling errors (429), and other - // errors that aren't caused by a bad request (500 series) are retried - // automatically by the JavaScript SDK. - const resp = await (0, outbound_1.invokeFunction)({ - FunctionName: functionArn, - // Cannot strip 'ResponseURL' here as this would be a breaking change even though the downstream CR doesn't need it - Payload: JSON.stringify({ ...sanitizedPayload, ResponseURL: responseUrl }), - }); - (0, util_1.log)('user function response:', resp, typeof (resp)); - // ParseJsonPayload is very defensive. It should not be possible for `Payload` - // to be anything other than a JSON encoded string (or intarray). Something weird is - // going on if that happens. Still, we should do our best to survive it. - const jsonPayload = (0, util_1.parseJsonPayload)(resp.Payload); - if (resp.FunctionError) { - (0, util_1.log)('user function threw an error:', resp.FunctionError); - const errorMessage = jsonPayload.errorMessage || 'error'; - // parse function name from arn - // arn:${Partition}:lambda:${Region}:${Account}:function:${FunctionName} - const arn = functionArn.split(':'); - const functionName = arn[arn.length - 1]; - // append a reference to the log group. - const message = [ - errorMessage, - '', - `Logs: /aws/lambda/${functionName}`, // cloudwatch log group - '', - ].join('\n'); - const e = new Error(message); - // the output that goes to CFN is what's in `stack`, not the error message. - // if we have a remote trace, construct a nice message with log group information - if (jsonPayload.trace) { - // skip first trace line because it's the message - e.stack = [message, ...jsonPayload.trace.slice(1)].join('\n'); - } - throw e; - } - return jsonPayload; -} -function createResponseEvent(cfnRequest, onEventResult) { - // - // validate that onEventResult always includes a PhysicalResourceId - onEventResult = onEventResult || {}; - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = onEventResult.PhysicalResourceId || defaultPhysicalResourceId(cfnRequest); - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`); - } - // if we are in UPDATE and physical ID was changed, it's a replacement (just log) - if (cfnRequest.RequestType === 'Update' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - (0, util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...onEventResult, - PhysicalResourceId: physicalResourceId, - }; -} -/** - * Calculates the default physical resource ID based in case user handler did - * not return a PhysicalResourceId. - * - * For "CREATE", it uses the RequestId. - * For "UPDATE" and "DELETE" and returns the current PhysicalResourceId (the one provided in `event`). - */ -function defaultPhysicalResourceId(req) { - switch (req.RequestType) { - case 'Create': - return req.RequestId; - case 'Update': - case 'Delete': - return req.PhysicalResourceId; - default: - throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`); - } -} -module.exports = { - [consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]: cfnResponse.safeHandler(onEvent), - [consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]: cfnResponse.safeHandler(isComplete), - [consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]: onTimeout, -}; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWV3b3JrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZnJhbWV3b3JrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0QkFBNEI7QUFDNUIsK0JBQStCO0FBQy9CLDhDQUE4QztBQUM5QyxtQ0FBbUM7QUFDbkMseUNBQTREO0FBQzVELGlDQUF1RDtBQVV2RDs7Ozs7Ozs7O0dBU0c7QUFDSCxLQUFLLFVBQVUsT0FBTyxDQUFDLFVBQXVEO0lBQzVFLE1BQU0sZ0JBQWdCLEdBQUcsRUFBRSxHQUFHLFVBQVUsRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFXLENBQUM7SUFDeEUsSUFBQSxVQUFHLEVBQUMsZ0JBQWdCLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztJQUV4QyxVQUFVLENBQUMsa0JBQWtCLEdBQUcsVUFBVSxDQUFDLGtCQUFrQixJQUFJLEVBQUcsQ0FBQztJQUVyRSxNQUFNLGFBQWEsR0FBRyxNQUFNL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saWQgXCJSZXF1ZXN0VHlwZVwiIGluIHJlcXVlc3QgXCIke0pTT04uc3RyaW5naWZ5KHJlcSl9XCJgKTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/privileges.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/privileges.js deleted file mode 100644 index 52cedf5b30e2c..0000000000000 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/privileges.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -const redshift_data_1 = require("./redshift-data"); -const util_1 = require("./util"); -async function handler(props, event) { - const username = props.username; - const tablePrivileges = props.tablePrivileges; - const clusterProps = props; - if (event.RequestType === 'Create') { - await grantPrivileges(username, tablePrivileges, clusterProps); - return { PhysicalResourceId: (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId) }; - } - else if (event.RequestType === 'Delete') { - await revokePrivileges(username, tablePrivileges, clusterProps); - return; - } - else if (event.RequestType === 'Update') { - const { replace } = await updatePrivileges(username, tablePrivileges, clusterProps, event.OldResourceProperties); - const physicalId = replace ? (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId) : event.PhysicalResourceId; - return { PhysicalResourceId: physicalId }; - } - else { - /* eslint-disable-next-line dot-notation */ - throw new Error(`Unrecognized event type: ${event['RequestType']}`); - } -} -exports.handler = handler; -async function revokePrivileges(username, tablePrivileges, clusterProps) { - await Promise.all(tablePrivileges.map(({ tableName, actions }) => { - return (0, redshift_data_1.executeStatement)(`REVOKE ${actions.join(', ')} ON ${tableName} FROM ${username}`, clusterProps); - })); -} -async function grantPrivileges(username, tablePrivileges, clusterProps) { - await Promise.all(tablePrivileges.map(({ tableName, actions }) => { - return (0, redshift_data_1.executeStatement)(`GRANT ${actions.join(', ')} ON ${tableName} TO ${username}`, clusterProps); - })); -} -async function updatePrivileges(username, tablePrivileges, clusterProps, oldResourceProperties) { - const oldClusterProps = oldResourceProperties; - if (clusterProps.clusterName !== oldClusterProps.clusterName || clusterProps.databaseName !== oldClusterProps.databaseName) { - await grantPrivileges(username, tablePrivileges, clusterProps); - return { replace: true }; - } - const oldUsername = oldResourceProperties.username; - if (oldUsername !== username) { - await grantPrivileges(username, tablePrivileges, clusterProps); - return { replace: true }; - } - const oldTablePrivileges = oldResourceProperties.tablePrivileges; - const tablesToRevoke = oldTablePrivileges.filter(({ tableId, actions }) => (tablePrivileges.find(({ tableId: otherTableId, actions: otherActions }) => (tableId === otherTableId && actions.some(action => !otherActions.includes(action)))))); - if (tablesToRevoke.length > 0) { - await revokePrivileges(username, tablesToRevoke, clusterProps); - } - const tablesToGrant = tablePrivileges.filter(({ tableId, tableName, actions }) => { - const tableAdded = !oldTablePrivileges.find(({ tableId: otherTableId, tableName: otherTableName }) => (tableId === otherTableId && tableName === otherTableName)); - const actionsAdded = oldTablePrivileges.find(({ tableId: otherTableId, actions: otherActions }) => (tableId === otherTableId && otherActions.some(action => !actions.includes(action)))); - return tableAdded || actionsAdded; - }); - if (tablesToGrant.length > 0) { - await grantPrivileges(username, tablesToGrant, clusterProps); - } - return { replace: false }; -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmlsZWdlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInByaXZpbGVnZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBR0EsbURBQW1EO0FBRW5ELGlDQUF3QztBQUVqQyxLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQXFELEVBQUUsS0FBa0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CA+IDApIHtcbiAgICBhd2FpdCByZXZva2VQcml2aWxlZ2VzKHVzZXJuYW1lLCB0YWJsZXNUb1Jldm9rZSwgY2x1c3RlclByb3BzKTtcbiAgfVxuXG4gIGNvbnN0IHRhYmxlc1RvR3JhbnQgPSB0YWJsZVByaXZpbGVnZXMuZmlsdGVyKCh7IHRhYmxlSWQsIHRhYmxlTmFtZSwgYWN0aW9ucyB9KSA9PiB7XG4gICAgY29uc3QgdGFibGVBZGRlZCA9ICFvbGRUYWJsZVByaXZpbGVnZXMuZmluZCgoeyB0YWJsZUlkOiBvdGhlclRhYmxlSWQsIHRhYmxlTmFtZTogb3RoZXJUYWJsZU5hbWUgfSkgPT4gKFxuICAgICAgdGFibGVJZCA9PT0gb3RoZXJUYWJsZUlkICYmIHRhYmxlTmFtZSA9PT0gb3RoZXJUYWJsZU5hbWVcbiAgICApKTtcbiAgICBjb25zdCBhY3Rpb25zQWRkZWQgPSBvbGRUYWJsZVByaXZpbGVnZXMuZmluZCgoeyB0YWJsZUlkOiBvdGhlclRhYmxlSWQsIGFjdGlvbnM6IG90aGVyQWN0aW9ucyB9KSA9PiAoXG4gICAgICB0YWJsZUlkID09PSBvdGhlclRhYmxlSWQgJiYgb3RoZXJBY3Rpb25zLnNvbWUoYWN0aW9uID0+ICFhY3Rpb25zLmluY2x1ZGVzKGFjdGlvbikpXG4gICAgKSk7XG4gICAgcmV0dXJuIHRhYmxlQWRkZWQgfHwgYWN0aW9uc0FkZGVkO1xuICB9KTtcbiAgaWYgKHRhYmxlc1RvR3JhbnQubGVuZ3RoID4gMCkge1xuICAgIGF3YWl0IGdyYW50UHJpdmlsZWdlcyh1c2VybmFtZSwgdGFibGVzVG9HcmFudCwgY2x1c3RlclByb3BzKTtcbiAgfVxuXG4gIHJldHVybiB7IHJlcGxhY2U6IGZhbHNlIH07XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/user.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/user.js deleted file mode 100644 index 9b098f270c396..0000000000000 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/user.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -/* eslint-disable-next-line import/no-extraneous-dependencies */ -const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager"); -const redshift_data_1 = require("./redshift-data"); -const util_1 = require("./util"); -const secretsManager = new client_secrets_manager_1.SecretsManager({}); -async function handler(props, event) { - const username = props.username; - const passwordSecretArn = props.passwordSecretArn; - const clusterProps = props; - if (event.RequestType === 'Create') { - await createUser(username, passwordSecretArn, clusterProps); - return { PhysicalResourceId: (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId), Data: { username: username } }; - } - else if (event.RequestType === 'Delete') { - await dropUser(username, clusterProps); - return; - } - else if (event.RequestType === 'Update') { - const { replace } = await updateUser(username, passwordSecretArn, clusterProps, event.OldResourceProperties); - const physicalId = replace ? (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId) : event.PhysicalResourceId; - return { PhysicalResourceId: physicalId, Data: { username: username } }; - } - else { - /* eslint-disable-next-line dot-notation */ - throw new Error(`Unrecognized event type: ${event['RequestType']}`); - } -} -exports.handler = handler; -async function dropUser(username, clusterProps) { - await (0, redshift_data_1.executeStatement)(`DROP USER ${username}`, clusterProps); -} -async function createUser(username, passwordSecretArn, clusterProps) { - const password = await getPasswordFromSecret(passwordSecretArn); - await (0, redshift_data_1.executeStatement)(`CREATE USER ${username} PASSWORD '${password}'`, clusterProps); -} -async function updateUser(username, passwordSecretArn, clusterProps, oldResourceProperties) { - const oldClusterProps = oldResourceProperties; - if (clusterProps.clusterName !== oldClusterProps.clusterName || clusterProps.databaseName !== oldClusterProps.databaseName) { - await createUser(username, passwordSecretArn, clusterProps); - return { replace: true }; - } - const oldUsername = oldResourceProperties.username; - const oldPasswordSecretArn = oldResourceProperties.passwordSecretArn; - const oldPassword = await getPasswordFromSecret(oldPasswordSecretArn); - const password = await getPasswordFromSecret(passwordSecretArn); - if (username !== oldUsername) { - await createUser(username, passwordSecretArn, clusterProps); - return { replace: true }; - } - if (password !== oldPassword) { - await (0, redshift_data_1.executeStatement)(`ALTER USER ${username} PASSWORD '${password}'`, clusterProps); - return { replace: false }; - } - return { replace: false }; -} -async function getPasswordFromSecret(passwordSecretArn) { - const secretValue = await secretsManager.getSecretValue({ - SecretId: passwordSecretArn, - }); - const secretString = secretValue.SecretString; - if (!secretString) { - throw new Error(`Secret string for ${passwordSecretArn} was empty`); - } - const { password } = JSON.parse(secretString); - return password; -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInVzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsZ0VBQWdFO0FBQ2hFLDRFQUFpRTtBQUNqRSxtREFBbUQ7QUFFbkQsaUNBQXdDO0FBR3hDLE1BQU0sY0FBYyxHQUFHLElBQUksdUNBQWMsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUV2QyxLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQXNDLEVBQUUsS0FBa0Q7SUFDdEgsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQztJQUNoQyxNQUFNLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztJQUNsRCxNQUFNLFlBQVksR0FBRyxLQUFLLENBQUM7SUFFM0IsSUFBSSxLQUFLLENBQUMsV0FBVyxLQ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zZTxzdHJpbmc+IHtcbiAgY29uc3Qgc2VjcmV0VmFsdWUgPSBhd2FpdCBzZWNyZXRzTWFuYWdlci5nZXRTZWNyZXRWYWx1ZSh7XG4gICAgU2VjcmV0SWQ6IHBhc3N3b3JkU2VjcmV0QXJuLFxuICB9KTtcbiAgY29uc3Qgc2VjcmV0U3RyaW5nID0gc2VjcmV0VmFsdWUuU2VjcmV0U3RyaW5nO1xuICBpZiAoIXNlY3JldFN0cmluZykge1xuICAgIHRocm93IG5ldyBFcnJvcihgU2VjcmV0IHN0cmluZyBmb3IgJHtwYXNzd29yZFNlY3JldEFybn0gd2FzIGVtcHR5YCk7XG4gIH1cbiAgY29uc3QgeyBwYXNzd29yZCB9ID0gSlNPTi5wYXJzZShzZWNyZXRTdHJpbmcpO1xuXG4gIHJldHVybiBwYXNzd29yZDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/handler-name.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/handler-name.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/handler-name.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/handler-name.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/index.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/index.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/index.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/index.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/privileges.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/privileges.js new file mode 100644 index 0000000000000..4231764d8b062 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/privileges.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +const redshift_data_1 = require("./redshift-data"); +const util_1 = require("./util"); +async function handler(props, event) { + const username = props.username; + const tablePrivileges = props.tablePrivileges; + const clusterProps = props; + if (event.RequestType === 'Create') { + await grantPrivileges(username, tablePrivileges, clusterProps); + return { PhysicalResourceId: (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId) }; + } + else if (event.RequestType === 'Delete') { + await revokePrivileges(username, tablePrivileges, clusterProps); + return; + } + else if (event.RequestType === 'Update') { + const { replace } = await updatePrivileges(username, tablePrivileges, clusterProps, event.OldResourceProperties); + const physicalId = replace ? (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId) : event.PhysicalResourceId; + return { PhysicalResourceId: physicalId }; + } + else { + /* eslint-disable-next-line dot-notation */ + throw new Error(`Unrecognized event type: ${event['RequestType']}`); + } +} +exports.handler = handler; +async function revokePrivileges(username, tablePrivileges, clusterProps) { + // Limited by human input + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism + await Promise.all(tablePrivileges.map(({ tableName, actions }) => { + return (0, redshift_data_1.executeStatement)(`REVOKE ${actions.join(', ')} ON ${tableName} FROM ${username}`, clusterProps); + })); +} +async function grantPrivileges(username, tablePrivileges, clusterProps) { + // Limited by human input + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism + await Promise.all(tablePrivileges.map(({ tableName, actions }) => { + return (0, redshift_data_1.executeStatement)(`GRANT ${actions.join(', ')} ON ${tableName} TO ${username}`, clusterProps); + })); +} +async function updatePrivileges(username, tablePrivileges, clusterProps, oldResourceProperties) { + const oldClusterProps = oldResourceProperties; + if (clusterProps.clusterName !== oldClusterProps.clusterName || clusterProps.databaseName !== oldClusterProps.databaseName) { + await grantPrivileges(username, tablePrivileges, clusterProps); + return { replace: true }; + } + const oldUsername = oldResourceProperties.username; + if (oldUsername !== username) { + await grantPrivileges(username, tablePrivileges, clusterProps); + return { replace: true }; + } + const oldTablePrivileges = oldResourceProperties.tablePrivileges; + const tablesToRevoke = oldTablePrivileges.filter(({ tableId, actions }) => (tablePrivileges.find(({ tableId: otherTableId, actions: otherActions }) => (tableId === otherTableId && actions.some(action => !otherActions.includes(action)))))); + if (tablesToRevoke.length > 0) { + await revokePrivileges(username, tablesToRevoke, clusterProps); + } + const tablesToGrant = tablePrivileges.filter(({ tableId, tableName, actions }) => { + const tableAdded = !oldTablePrivileges.find(({ tableId: otherTableId, tableName: otherTableName }) => (tableId === otherTableId && tableName === otherTableName)); + const actionsAdded = oldTablePrivileges.find(({ tableId: otherTableId, actions: otherActions }) => (tableId === otherTableId && otherActions.some(action => !actions.includes(action)))); + return tableAdded || actionsAdded; + }); + if (tablesToGrant.length > 0) { + await grantPrivileges(username, tablesToGrant, clusterProps); + } + return { replace: false }; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmlsZWdlcy5qcyIsInNvdXJjZVJvb3QiOiIi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hlclRhYmxlSWQsIGFjdGlvbnM6IG90aGVyQWN0aW9ucyB9KSA9PiAoXG4gICAgICB0YWJsZUlkID09PSBvdGhlclRhYmxlSWQgJiYgb3RoZXJBY3Rpb25zLnNvbWUoYWN0aW9uID0+ICFhY3Rpb25zLmluY2x1ZGVzKGFjdGlvbikpXG4gICAgKSk7XG4gICAgcmV0dXJuIHRhYmxlQWRkZWQgfHwgYWN0aW9uc0FkZGVkO1xuICB9KTtcbiAgaWYgKHRhYmxlc1RvR3JhbnQubGVuZ3RoID4gMCkge1xuICAgIGF3YWl0IGdyYW50UHJpdmlsZWdlcyh1c2VybmFtZSwgdGFibGVzVG9HcmFudCwgY2x1c3RlclByb3BzKTtcbiAgfVxuXG4gIHJldHVybiB7IHJlcGxhY2U6IGZhbHNlIH07XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/redshift-data.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/redshift-data.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/redshift-data.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/redshift-data.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/table.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/table.js similarity index 58% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/table.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/table.js index b3328f228a848..faeae3e925ab0 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/table.js +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/table.js @@ -162,6 +162,8 @@ async function updateTable(tableName, tableNamePrefix, tableNameSuffix, tableCol if (oldComment !== newComment) { alterationStatements.push(`COMMENT ON TABLE ${tableName} IS ${newComment ? `'${newComment}'` : 'NULL'}`); } + // Limited by human input + // eslint-disable-next-line @cdklabs/promiseall-no-unbounded-parallelism await Promise.all(alterationStatements.map(statement => (0, redshift_data_1.executeStatement)(statement, tableAndClusterProps))); if (isTableV2) { const oldTableNamePrefix = oldResourceProperties.tableName.prefix; @@ -181,4 +183,4 @@ function getEncodingColumnString(column) { } return ''; } -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFibGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0YWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSxtREFBbUQ7QUFDbkQsbUNBQTZFO0FBQzdFLGlDQUE4RjtBQUV2RixLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQTJCLEVBQUUsS0FBa0Q7SUFDM0csTUFBTSxlQUFlLEdBQUcsS0FBSyxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUM7SUFDL0MsTUFBTSxrQkFBa0IsR0FBRyxDQUFDL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UucHJlZml4O1xuICAgIGlmICh0YWJsZU5hbWVQcmVmaXggIT09IG9sZFRhYmxlTmFtZVByZWZpeCkge1xuICAgICAgYXdhaXQgZXhlY3V0ZVN0YXRlbWVudChgQUxURVIgVEFCTEUgJHt0YWJsZU5hbWV9IFJFTkFNRSBUTyAke25ld1RhYmxlTmFtZX1gLCB0YWJsZUFuZENsdXN0ZXJQcm9wcyk7XG4gICAgICByZXR1cm4gdGFibGVOYW1lUHJlZml4ICsgdGFibGVOYW1lU3VmZml4O1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiB0YWJsZU5hbWU7XG59XG5cbmZ1bmN0aW9uIGdldFNvcnRLZXlDb2x1bW5zU3RyaW5nKHNvcnRLZXlDb2x1bW5zOiBDb2x1bW5bXSkge1xuICByZXR1cm4gc29ydEtleUNvbHVtbnMubWFwKGNvbHVtbiA9PiBjb2x1bW4ubmFtZSkuam9pbigpO1xufVxuXG5mdW5jdGlvbiBnZXRFbmNvZGluZ0NvbHVtblN0cmluZyhjb2x1bW46IENvbHVtbik6IHN0cmluZyB7XG4gIGlmIChjb2x1bW4uZW5jb2RpbmcpIHtcbiAgICByZXR1cm4gYCBFTkNPREUgJHtjb2x1bW4uZW5jb2Rpbmd9YDtcbiAgfVxuICByZXR1cm4gJyc7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/types.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/types.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/types.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/types.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/user.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/user.js new file mode 100644 index 0000000000000..84ba3ba9d5c34 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/user.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +/* eslint-disable-next-line import/no-extraneous-dependencies */ +const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager"); +const redshift_data_1 = require("./redshift-data"); +const util_1 = require("./util"); +const secretsManager = new client_secrets_manager_1.SecretsManager({}); +async function handler(props, event) { + const username = props.username; + const passwordSecretArn = props.passwordSecretArn; + const clusterProps = props; + if (event.RequestType === 'Create') { + await createUser(username, passwordSecretArn, clusterProps); + return { PhysicalResourceId: (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId), Data: { username: username } }; + } + else if (event.RequestType === 'Delete') { + await dropUser(username, clusterProps); + return; + } + else if (event.RequestType === 'Update') { + const { replace } = await updateUser(username, passwordSecretArn, clusterProps, event.OldResourceProperties); + const physicalId = replace ? (0, util_1.makePhysicalId)(username, clusterProps, event.RequestId) : event.PhysicalResourceId; + return { PhysicalResourceId: physicalId, Data: { username: username } }; + } + else { + /* eslint-disable-next-line dot-notation */ + throw new Error(`Unrecognized event type: ${event['RequestType']}`); + } +} +exports.handler = handler; +async function dropUser(username, clusterProps) { + await (0, redshift_data_1.executeStatement)(`DROP USER ${username}`, clusterProps); +} +async function createUser(username, passwordSecretArn, clusterProps) { + const password = await getPasswordFromSecret(passwordSecretArn); + await (0, redshift_data_1.executeStatement)(`CREATE USER ${username} PASSWORD '${password}'`, clusterProps); +} +async function updateUser(username, passwordSecretArn, clusterProps, oldResourceProperties) { + const oldClusterProps = oldResourceProperties; + if (clusterProps.clusterName !== oldClusterProps.clusterName || clusterProps.databaseName !== oldClusterProps.databaseName) { + await createUser(username, passwordSecretArn, clusterProps); + return { replace: true }; + } + const oldUsername = oldResourceProperties.username; + const oldPasswordSecretArn = oldResourceProperties.passwordSecretArn; + const oldPassword = await getPasswordFromSecret(oldPasswordSecretArn); + const password = await getPasswordFromSecret(passwordSecretArn); + if (username !== oldUsername) { + await createUser(username, passwordSecretArn, clusterProps); + return { replace: true }; + } + if (password !== oldPassword) { + await (0, redshift_data_1.executeStatement)(`ALTER USER ${username} PASSWORD '${password}'`, clusterProps); + return { replace: false }; + } + return { replace: false }; +} +async function getPasswordFromSecret(passwordSecretArn) { + const secretValue = await secretsManager.getSecretValue({ + SecretId: passwordSecretArn, + }); + const secretString = secretValue.SecretString; + if (!secretString) { + throw new Error(`Secret string for ${passwordSecretArn} was empty`); + } + const { password } = JSON.parse(secretString); + return password; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInVzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsZ0VBQWdFO0FBQ2hFLDRFQUFpRTtBQUNqRSxtREFBbUQ7QUFFbkQsaUNBQXdDO0FBR3hDLE1BQU0sY0FBYyxHQUFHLElBQUksdUNBQWMsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUV2QyxLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQXNDLEVBQUUsS0FBa0Q7SUFDdEgsTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQztJQUNoQyxNQUFNLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0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jZTogZmFsc2UgfTtcbiAgfVxuXG4gIHJldHVybiB7IHJlcGxhY2U6IGZhbHNlIH07XG59XG5cbmFzeW5jIGZ1bmN0aW9uIGdldFBhc3N3b3JkRnJvbVNlY3JldChwYXNzd29yZFNlY3JldEFybjogc3RyaW5nKTogUHJvbWlzZTxzdHJpbmc+IHtcbiAgY29uc3Qgc2VjcmV0VmFsdWUgPSBhd2FpdCBzZWNyZXRzTWFuYWdlci5nZXRTZWNyZXRWYWx1ZSh7XG4gICAgU2VjcmV0SWQ6IHBhc3N3b3JkU2VjcmV0QXJuLFxuICB9KTtcbiAgY29uc3Qgc2VjcmV0U3RyaW5nID0gc2VjcmV0VmFsdWUuU2VjcmV0U3RyaW5nO1xuICBpZiAoIXNlY3JldFN0cmluZykge1xuICAgIHRocm93IG5ldyBFcnJvcihgU2VjcmV0IHN0cmluZyBmb3IgJHtwYXNzd29yZFNlY3JldEFybn0gd2FzIGVtcHR5YCk7XG4gIH1cbiAgY29uc3QgeyBwYXNzd29yZCB9ID0gSlNPTi5wYXJzZShzZWNyZXRTdHJpbmcpO1xuXG4gIHJldHVybiBwYXNzd29yZDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/util.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/util.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2/util.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510/util.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/cfn-response.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/cfn-response.js new file mode 100644 index 0000000000000..a8c8eff4a5a61 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/cfn-response.js @@ -0,0 +1,106 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Retry = exports.redactDataFromPayload = exports.safeHandler = exports.includeStackTraces = exports.submitResponse = exports.MISSING_PHYSICAL_ID_MARKER = exports.CREATE_FAILED_PHYSICAL_ID_MARKER = void 0; +/* eslint-disable max-len */ +/* eslint-disable no-console */ +const url = require("url"); +const outbound_1 = require("./outbound"); +const util_1 = require("./util"); +exports.CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +exports.MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function submitResponse(status, event, options = {}) { + const json = { + Status: status, + Reason: options.reason || status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || exports.MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: options.noEcho, + Data: event.Data, + }; + const responseBody = JSON.stringify(json); + const parsedUrl = url.parse(event.ResponseURL); + const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; + if (options?.noEcho) { + (0, util_1.log)('submit redacted response to cloudformation', loggingSafeUrl, redactDataFromPayload(json)); + } + else { + (0, util_1.log)('submit response to cloudformation', loggingSafeUrl, json); + } + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await (0, util_1.withRetries)(retryOptions, outbound_1.httpRequest)({ + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }, responseBody); +} +exports.submitResponse = submitResponse; +exports.includeStackTraces = true; // for unit tests +function safeHandler(block) { + return async (event) => { + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === exports.CREATE_FAILED_PHYSICAL_ID_MARKER) { + (0, util_1.log)('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + await block(event); + } + catch (e) { + // tell waiter state machine to retry + if (e instanceof Retry) { + (0, util_1.log)('retry requested by handler'); + throw e; + } + if (!event.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + (0, util_1.log)('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + event.PhysicalResourceId = exports.CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + (0, util_1.log)(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify({ ...event, ResponseURL: '...' })}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', event, { + reason: exports.includeStackTraces ? e.stack : e.message, + }); + } + }; +} +exports.safeHandler = safeHandler; +function redactDataFromPayload(payload) { + // Create a deep copy of the payload object + const redactedPayload = JSON.parse(JSON.stringify(payload)); + // Redact the data in the copied payload object + if (redactedPayload.Data) { + const keys = Object.keys(redactedPayload.Data); + for (const key of keys) { + redactedPayload.Data[key] = '*****'; + } + } + return redactedPayload; +} +exports.redactDataFromPayload = redactDataFromPayload; +class Retry ext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3BvbnNlID0gSlNPTi5wYXJzZShKU09OLnN0cmluZ2lmeShwYXlsb2FkKSk7XG5cbiAgLy8gUmVkYWN0IHRoZSBkYXRhIGluIHRoZSBjb3BpZWQgcGF5bG9hZCBvYmplY3RcbiAgaWYgKHJlZGFjdGVkUGF5bG9hZC5EYXRhKSB7XG4gICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHJlZGFjdGVkUGF5bG9hZC5EYXRhKTtcbiAgICBmb3IgKGNvbnN0IGtleSBvZiBrZXlzKSB7XG4gICAgICByZWRhY3RlZFBheWxvYWQuRGF0YVtrZXldID0gJyoqKioqJztcbiAgICB9XG4gIH1cbiAgcmV0dXJuIHJlZGFjdGVkUGF5bG9hZDtcbn1cblxuZXhwb3J0IGNsYXNzIFJldHJ5IGV4dGVuZHMgRXJyb3IgeyB9XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/consts.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/consts.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/consts.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/consts.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/framework.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/framework.js new file mode 100644 index 0000000000000..d381e7833f0b7 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/framework.js @@ -0,0 +1,185 @@ +"use strict"; +/* eslint-disable max-len */ +/* eslint-disable no-console */ +const cfnResponse = require("./cfn-response"); +const consts = require("./consts"); +const outbound_1 = require("./outbound"); +const util_1 = require("./util"); +/** + * The main runtime entrypoint of the async custom resource lambda function. + * + * Any lifecycle event changes to the custom resources will invoke this handler, which will, in turn, + * interact with the user-defined `onEvent` and `isComplete` handlers. + * + * This function will always succeed. If an error occurs, it is logged but an error is not thrown. + * + * @param cfnRequest The cloudformation custom resource event. + */ +async function onEvent(cfnRequest) { + const sanitizedRequest = { ...cfnRequest, ResponseURL: '...' }; + (0, util_1.log)('onEventHandler', sanitizedRequest); + cfnRequest.ResourceProperties = cfnRequest.ResourceProperties || {}; + const onEventResult = await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV, sanitizedRequest, cfnRequest.ResponseURL); + if (onEventResult?.NoEcho) { + (0, util_1.log)('redacted onEvent returned:', cfnResponse.redactDataFromPayload(onEventResult)); + } + else { + (0, util_1.log)('onEvent returned:', onEventResult); + } + // merge the request and the result from onEvent to form the complete resource event + // this also performs validation. + const resourceEvent = createResponseEvent(cfnRequest, onEventResult); + const sanitizedEvent = { ...resourceEvent, ResponseURL: '...' }; + if (onEventResult?.NoEcho) { + (0, util_1.log)('readacted event:', cfnResponse.redactDataFromPayload(sanitizedEvent)); + } + else { + (0, util_1.log)('event:', sanitizedEvent); + } + // determine if this is an async provider based on whether we have an isComplete handler defined. + // if it is not defined, then we are basically ready to return a positive response. + if (!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV]) { + return cfnResponse.submitResponse('SUCCESS', resourceEvent, { noEcho: resourceEvent.NoEcho }); + } + // ok, we are not complete, so kick off the waiter workflow + const waiter = { + stateMachineArn: (0, util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV), + name: resourceEvent.RequestId, + input: JSON.stringify(resourceEvent), + }; + (0, util_1.log)('starting waiter', { + stateMachineArn: (0, util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV), + name: resourceEvent.RequestId, + }); + // kick off waiter state machine + await (0, outbound_1.startExecution)(waiter); +} +// invoked a few times until `complete` is true or until it times out. +async function isComplete(event) { + const sanitizedRequest = { ...event, ResponseURL: '...' }; + if (event?.NoEcho) { + (0, util_1.log)('redacted isComplete request', cfnResponse.redactDataFromPayload(sanitizedRequest)); + } + else { + (0, util_1.log)('isComplete', sanitizedRequest); + } + const isCompleteResult = await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV, sanitizedRequest, event.ResponseURL); + if (event?.NoEcho) { + (0, util_1.log)('redacted user isComplete returned:', cfnResponse.redactDataFromPayload(isCompleteResult)); + } + else { + (0, util_1.log)('user isComplete returned:', isCompleteResult); + } + // if we are not complete, return false, and don't send a response back. + if (!isCompleteResult.IsComplete) { + if (isCompleteResult.Data && Object.keys(isCompleteResult.Data).length > 0) { + throw new Error('"Data" is not allowed if "IsComplete" is "False"'); + } + // This must be the full event, it will be deserialized in `onTimeout` to send the response to CloudFormation + throw new cfnResponse.Retry(JSON.stringify(event)); + } + const response = { + ...event, + ...isCompleteResult, + Data: { + ...event.Data, + ...isCompleteResult.Data, + }, + }; + await cfnResponse.submitResponse('SUCCESS', response, { noEcho: event.NoEcho }); +} +// invoked when completion retries are exhaused. +async function onTimeout(timeoutEvent) { + (0, util_1.log)('timeoutHandler', timeoutEvent); + const isCompleteRequest = JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage); + await cfnResponse.submitResponse('FAILED', isCompleteRequest, { + reason: 'Operation timed out', + }); +} +async function invokeUserFunction(functionArnEnv, sanitizedPayload, responseUrl) { + const functionArn = (0, util_1.getEnv)(functionArnEnv); + (0, util_1.log)(`executing user function ${functionArn} with payload`, sanitizedPayload); + // transient errors such as timeouts, throttling errors (429), and other + // errors that aren't caused by a bad request (500 series) are retried + // automatically by the JavaScript SDK. + const resp = await (0, outbound_1.invokeFunction)({ + FunctionName: functionArn, + // Cannot strip 'ResponseURL' here as this would be a breaking change even though the downstream CR doesn't need it + Payload: JSON.stringify({ ...sanitizedPayload, ResponseURL: responseUrl }), + }); + (0, util_1.log)('user function response:', resp, typeof (resp)); + // ParseJsonPayload is very defensive. It should not be possible for `Payload` + // to be anything other than a JSON encoded string (or intarray). Something weird is + // going on if that happens. Still, we should do our best to survive it. + const jsonPayload = (0, util_1.parseJsonPayload)(resp.Payload); + if (resp.FunctionError) { + (0, util_1.log)('user function threw an error:', resp.FunctionError); + const errorMessage = jsonPayload.errorMessage || 'error'; + // parse function name from arn + // arn:${Partition}:lambda:${Region}:${Account}:function:${FunctionName} + const arn = functionArn.split(':'); + const functionName = arn[arn.length - 1]; + // append a reference to the log group. + const message = [ + errorMessage, + '', + `Logs: /aws/lambda/${functionName}`, // cloudwatch log group + '', + ].join('\n'); + const e = new Error(message); + // the output that goes to CFN is what's in `stack`, not the error message. + // if we have a remote trace, construct a nice message with log group information + if (jsonPayload.trace) { + // skip first trace line because it's the message + e.stack = [message, ...jsonPayload.trace.slice(1)].join('\n'); + } + throw e; + } + return jsonPayload; +} +function createResponseEvent(cfnRequest, onEventResult) { + // + // validate that onEventResult always includes a PhysicalResourceId + onEventResult = onEventResult || {}; + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = onEventResult.PhysicalResourceId || defaultPhysicalResourceId(cfnRequest); + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`); + } + // if we are in UPDATE and physical ID was changed, it's a replacement (just log) + if (cfnRequest.RequestType === 'Update' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + (0, util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...onEventResult, + PhysicalResourceId: physicalResourceId, + }; +} +/** + * Calculates the default physical resource ID based in case user handler did + * not return a PhysicalResourceId. + * + * For "CREATE", it uses the RequestId. + * For "UPDATE" and "DELETE" and returns the current PhysicalResourceId (the one provided in `event`). + */ +function defaultPhysicalResourceId(req) { + switch (req.RequestType) { + case 'Create': + return req.RequestId; + case 'Update': + case 'Delete': + return req.PhysicalResourceId; + default: + throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`); + } +} +module.exports = { + [consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]: cfnResponse.safeHandler(onEvent), + [consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]: cfnResponse.safeHandler(isComplete), + [consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]: onTimeout, +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWV3b3JrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZnJhbWV3b3JrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0QkFBNEI7QUFDNUIsK0JBQStCO0FBQy9CLDhDQUE4QztBQUM5QyxtQ0FBbUM7QUFDbkMseUNBQTREO0FBQzVELGlDQUF1RDtBQVV2RDs7Ozs7Ozs7O0dBU0c7QUFDSCxLQUFLLFVBQVUsT0FBTyxDQUFDLFVBQXVEO0lBQzVFLE1BQU0sZ0JBQWdCLEdBQUcsRUFBRSxHQUFHLFVBQVUsRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFXLENBQUM7SUFDeEUsSUFBQSxVQUFHLEVBQUMsZ0JBQWdCLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztJQUV4QyxVQUFVLENBQUMsa0JBQWtCLEdBQUcsVUFBVSxDQUFDL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SB1c2VyIGhhbmRsZXIgZGlkXG4gKiBub3QgcmV0dXJuIGEgUGh5c2ljYWxSZXNvdXJjZUlkLlxuICpcbiAqIEZvciBcIkNSRUFURVwiLCBpdCB1c2VzIHRoZSBSZXF1ZXN0SWQuXG4gKiBGb3IgXCJVUERBVEVcIiBhbmQgXCJERUxFVEVcIiBhbmQgcmV0dXJucyB0aGUgY3VycmVudCBQaHlzaWNhbFJlc291cmNlSWQgKHRoZSBvbmUgcHJvdmlkZWQgaW4gYGV2ZW50YCkuXG4gKi9cbmZ1bmN0aW9uIGRlZmF1bHRQaHlzaWNhbFJlc291cmNlSWQocmVxOiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KTogc3RyaW5nIHtcbiAgc3dpdGNoIChyZXEuUmVxdWVzdFR5cGUpIHtcbiAgICBjYXNlICdDcmVhdGUnOlxuICAgICAgcmV0dXJuIHJlcS5SZXF1ZXN0SWQ7XG5cbiAgICBjYXNlICdVcGRhdGUnOlxuICAgIGNhc2UgJ0RlbGV0ZSc6XG4gICAgICByZXR1cm4gcmVxLlBoeXNpY2FsUmVzb3VyY2VJZDtcblxuICAgIGRlZmF1bHQ6XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoYEludmFsaWQgXCJSZXF1ZXN0VHlwZVwiIGluIHJlcXVlc3QgXCIke0pTT04uc3RyaW5naWZ5KHJlcSl9XCJgKTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/outbound.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/outbound.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/outbound.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/util.js b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/util.js similarity index 100% rename from packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5/util.js rename to packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4/util.js diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json index 5c7a35b48f5da..f8ab68dfd5d25 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.assets.json @@ -1,33 +1,33 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { - "6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2": { + "998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510": { "source": { - "path": "asset.6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2", + "path": "asset.998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2.zip", + "objectKey": "998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5": { + "d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4": { "source": { - "path": "asset.15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5", + "path": "asset.d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5.zip", + "objectKey": "d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "8e6be009866b8a2003386ed60642ac24947735f4ba3cfda8754bd688275d2363": { + "fbf86e8c2344c422659f7f4aec57cd9854bb0a5125994cf19dc3010515943ad2": { "source": { "path": "aws-cdk-redshift-cluster-database.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8e6be009866b8a2003386ed60642ac24947735f4ba3cfda8754bd688275d2363.json", + "objectKey": "fbf86e8c2344c422659f7f4aec57cd9854bb0a5125994cf19dc3010515943ad2.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json index 6101f39357c2b..937cb50e406eb 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/aws-cdk-redshift-cluster-database.template.json @@ -670,7 +670,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5.zip" + "S3Key": "d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4.zip" }, "Description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/Table/Resource/Provider)", "Environment": { @@ -828,7 +828,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2.zip" + "S3Key": "998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510.zip" }, "Handler": "index.handler", "Role": { @@ -846,7 +846,7 @@ "value" ] }, - "Timeout": 60 + "Timeout": 300 }, "DependsOn": [ "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D", diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/cdk.out b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/cdk.out index 1f0068d32659a..c6e612584e352 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/integ.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/integ.json index a3850bcbcb773..7799949e59aff 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "redshift-cluster-database-integ/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json index bc74fa59b1ddd..0ba42be5765f0 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "aws-cdk-redshift-cluster-database.assets": { "type": "cdk:asset-manifest", @@ -16,9 +16,10 @@ "templateFile": "aws-cdk-redshift-cluster-database.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8e6be009866b8a2003386ed60642ac24947735f4ba3cfda8754bd688275d2363.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fbf86e8c2344c422659f7f4aec57cd9854bb0a5125994cf19dc3010515943ad2.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -286,6 +287,7 @@ "templateFile": "redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json index a8b939c8d14f0..61164e35fdbca 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json index a1a6f5806793d..75d03ab6265c6 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.js.snapshot/tree.json @@ -1073,7 +1073,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "15197a5512179542fe2cff74af89bb047793c9c4e0b4395f114641a81cd52ae5.zip" + "s3Key": "d320874294f5d626406d5f86087c2a2c8e6efc0aab690c5105572555dc445fd4.zip" }, "description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/Table/Resource/Provider)", "environment": { @@ -1309,7 +1309,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "6bdd909f81c84ffe7d00cf4d6a2dbac8606429bcc05b0db3da842c1941a532f2.zip" + "s3Key": "998794c16638bbdb208ede6f9c4e015006d1dc31e32d0793a1780d83511c4510.zip" }, "handler": "index.handler", "role": { @@ -1327,7 +1327,7 @@ "value" ] }, - "timeout": 60 + "timeout": 300 } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.ts b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.ts index a881c93b4cf4e..107c8c28006e6 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/test/integ.database-columnid.ts @@ -50,6 +50,7 @@ new redshift.Table(stack, 'Table', { { id: 'col2', name: 'col2', dataType: 'float' }, { name: 'col3', dataType: 'float' }, ], + timeout: cdk.Duration.minutes(5), }); new integ.IntegTest(app, 'redshift-cluster-database-integ', { diff --git a/packages/@aws-cdk/aws-redshift-alpha/test/table.test.ts b/packages/@aws-cdk/aws-redshift-alpha/test/table.test.ts index 334157016cd99..abcf80d6536ef 100644 --- a/packages/@aws-cdk/aws-redshift-alpha/test/table.test.ts +++ b/packages/@aws-cdk/aws-redshift-alpha/test/table.test.ts @@ -322,4 +322,39 @@ describe('cluster table', () => { ).toThrow(`sortStyle of '${redshift.TableSortStyle.AUTO}' cannot be configured when sortKey is also configured.`); }); }); + + describe('timeout', () => { + test('specify timeout', () => { + new redshift.Table(stack, 'Table', { + ...databaseOptions, + tableColumns, + timeout: cdk.Duration.minutes(5), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Timeout: 300, + Role: { 'Fn::GetAtt': ['QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717', 'Arn'] }, + Handler: 'index.handler', + Code: { + S3Bucket: { 'Fn::Sub': 'cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}' }, + }, + }); + }); + + test('throw error for timeout being too short', () => { + expect(() => new redshift.Table(stack, 'Table', { + ...databaseOptions, + tableColumns, + timeout: cdk.Duration.millis(999), + })).toThrow('The timeout for the handler must be BETWEEN 1 second and 15 minutes, got 999 milliseconds.'); + }); + + test('throw error for timeout being too long', () => { + expect(() => new redshift.Table(stack, 'Table', { + ...databaseOptions, + tableColumns, + timeout: cdk.Duration.minutes(16), + })).toThrow('The timeout for the handler must be between 1 second and 15 minutes, got 960 seconds.'); + }); + }); });