diff --git a/packages/@aws-cdk/aws-redshift/README.md b/packages/@aws-cdk/aws-redshift/README.md index 9eb79a46b8b7a..ba8680aaade4d 100644 --- a/packages/@aws-cdk/aws-redshift/README.md +++ b/packages/@aws-cdk/aws-redshift/README.md @@ -200,17 +200,32 @@ new Table(this, 'Table', { }); ``` -Tables can also be configured with a comment: +Tables and their respective columns can be configured to contain comments: ```ts fixture=cluster new Table(this, 'Table', { tableColumns: [ - { name: 'col1', dataType: 'varchar(4)' }, - { name: 'col2', dataType: 'float' } + { name: 'col1', dataType: 'varchar(4)', comment: 'This is a column comment' }, + { name: 'col2', dataType: 'float', comment: 'This is a another column comment' } + ], + cluster: cluster, + databaseName: 'databaseName', + tableComment: 'This is a table comment', +}); +``` + +Table columns can be configured to use a specific compression encoding: + +```ts fixture=cluster +import { ColumnEncoding } from '@aws-cdk/aws-redshift'; + +new Table(this, 'Table', { + tableColumns: [ + { name: 'col1', dataType: 'varchar(4)', encoding: ColumnEncoding.TEXT32K }, + { name: 'col2', dataType: 'float', encoding: ColumnEncoding.DELTA32K }, ], cluster: cluster, databaseName: 'databaseName', - comment: 'This is a comment', }); ``` @@ -369,6 +384,8 @@ cluster.addToParameterGroup('enable_user_activity_logging', 'true'); In most cases, existing clusters [must be manually rebooted](https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html) to apply parameter changes. You can automate parameter related reboots by setting the cluster's `rebootForParameterChanges` property to `true` , or by using `Cluster.enableRebootForParameterChanges()`. ```ts +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as cdk from '@aws-cdk/core'; declare const vpc: ec2.Vpc; const cluster = new Cluster(this, 'Cluster', { @@ -451,6 +468,8 @@ Some Amazon Redshift features require Amazon Redshift to access other AWS servic When you create an IAM role and set it as the default for the cluster using console, you don't have to provide the IAM role's Amazon Resource Name (ARN) to perform authentication and authorization. ```ts +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as iam from '@aws-cdk/aws-iam'; declare const vpc: ec2.Vpc; const defaultRole = new iam.Role(this, 'DefaultRole', { @@ -458,7 +477,7 @@ const defaultRole = new iam.Role(this, 'DefaultRole', { }, ); -new Cluster(stack, 'Redshift', { +new Cluster(this, 'Redshift', { masterUser: { masterUsername: 'admin', }, @@ -471,6 +490,8 @@ new Cluster(stack, 'Redshift', { A default role can also be added to a cluster using the `addDefaultIamRole` method. ```ts +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as iam from '@aws-cdk/aws-iam'; declare const vpc: ec2.Vpc; const defaultRole = new iam.Role(this, 'DefaultRole', { @@ -478,7 +499,7 @@ const defaultRole = new iam.Role(this, 'DefaultRole', { }, ); -const redshiftCluster = new Cluster(stack, 'Redshift', { +const redshiftCluster = new Cluster(this, 'Redshift', { masterUser: { masterUsername: 'admin', }, @@ -494,6 +515,8 @@ redshiftCluster.addDefaultIamRole(defaultRole); Attaching IAM roles to a Redshift Cluster grants permissions to the Redshift service to perform actions on your behalf. ```ts +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as iam from '@aws-cdk/aws-iam'; declare const vpc: ec2.Vpc const role = new iam.Role(this, 'Role', { @@ -511,6 +534,8 @@ const cluster = new Cluster(this, 'Redshift', { Additional IAM roles can be attached to a cluster using the `addIamRole` method. ```ts +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as iam from '@aws-cdk/aws-iam'; declare const vpc: ec2.Vpc const role = new iam.Role(this, 'Role', { diff --git a/packages/@aws-cdk/aws-redshift/lib/private/database-query-provider/table.ts b/packages/@aws-cdk/aws-redshift/lib/private/database-query-provider/table.ts index bb6274f107681..ba4e71aeca843 100644 --- a/packages/@aws-cdk/aws-redshift/lib/private/database-query-provider/table.ts +++ b/packages/@aws-cdk/aws-redshift/lib/private/database-query-provider/table.ts @@ -42,7 +42,7 @@ async function createTable( tableAndClusterProps: TableAndClusterProps, ): Promise { const tableName = tableNamePrefix + tableNameSuffix; - const tableColumnsString = tableColumns.map(column => `${column.name} ${column.dataType}`).join(); + const tableColumnsString = tableColumns.map(column => `${column.name} ${column.dataType}${getEncodingColumnString(column)}`).join(); let statement = `CREATE TABLE ${tableName} (${tableColumnsString})`; @@ -63,6 +63,11 @@ async function createTable( await executeStatement(statement, tableAndClusterProps); + for (const column of tableColumns) { + if (column.comment) { + await executeStatement(`COMMENT ON COLUMN ${tableName}.${column.name} IS '${column.comment}'`, tableAndClusterProps); + } + } if (tableAndClusterProps.tableComment) { await executeStatement(`COMMENT ON TABLE ${tableName} IS '${tableAndClusterProps.tableComment}'`, tableAndClusterProps); } @@ -120,6 +125,20 @@ async function updateTable( alterationStatements.push(...columnAdditions.map(addition => `ALTER TABLE ${tableName} ${addition}`)); } + const columnEncoding = tableColumns.filter(column => { + return oldTableColumns.some(oldColumn => column.name === oldColumn.name && column.encoding !== oldColumn.encoding); + }).map(column => `ALTER COLUMN ${column.name} ENCODE ${column.encoding || 'AUTO'}`); + if (columnEncoding.length > 0) { + alterationStatements.push(`ALTER TABLE ${tableName} ${columnEncoding.join(', ')}`); + } + + const columnComments = tableColumns.filter(column => { + return oldTableColumns.some(oldColumn => column.name === oldColumn.name && column.comment !== oldColumn.comment); + }).map(column => `COMMENT ON COLUMN ${tableName}.${column.name} IS ${column.comment ? `'${column.comment}'` : 'NULL'}`); + if (columnComments.length > 0) { + alterationStatements.push(...columnComments); + } + if (useColumnIds) { const columnNameUpdates = tableColumns.reduce((updates, column) => { const oldColumn = oldTableColumns.find(oldCol => oldCol.id && oldCol.id === column.id); @@ -190,3 +209,10 @@ async function updateTable( function getSortKeyColumnsString(sortKeyColumns: Column[]) { return sortKeyColumns.map(column => column.name).join(); } + +function getEncodingColumnString(column: Column): string { + if (column.encoding) { + return ` ENCODE ${column.encoding}`; + } + return ''; +} diff --git a/packages/@aws-cdk/aws-redshift/lib/table.ts b/packages/@aws-cdk/aws-redshift/lib/table.ts index 2f3f095a39110..92587ca745efa 100644 --- a/packages/@aws-cdk/aws-redshift/lib/table.ts +++ b/packages/@aws-cdk/aws-redshift/lib/table.ts @@ -90,6 +90,20 @@ export interface Column { * @default - column is not a SORTKEY */ readonly sortKey?: boolean; + + /** + * The encoding to use for the column. + * + * @default - Amazon Redshift determines the encoding based on the data type. + */ + readonly encoding?: ColumnEncoding; + + /** + * A comment to attach to the column. + * + * @default - no comment + */ + readonly comment?: string; } /** @@ -371,3 +385,112 @@ export enum TableSortStyle { */ INTERLEAVED = 'INTERLEAVED', } + +/** + * The compression encoding of a column. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Compression_encodings.html + */ +export enum ColumnEncoding { + /** + * Amazon Redshift assigns an optimal encoding based on the column data. + * This is the default. + */ + AUTO = 'AUTO', + + /** + * The column is not compressed. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Raw_encoding.html + */ + RAW = 'RAW', + + /** + * The column is compressed using the AZ64 algorithm. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/az64-encoding.html + */ + AZ64 = 'AZ64', + + /** + * The column is compressed using a separate dictionary for each block column value on disk. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Byte_dictionary_encoding.html + */ + BYTEDICT = 'BYTEDICT', + + /** + * The column is compressed based on the difference between values in the column. + * This records differences as 1-byte values. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Delta_encoding.html + */ + DELTA = 'DELTA', + + /** + * The column is compressed based on the difference between values in the column. + * This records differences as 2-byte values. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Delta_encoding.html + */ + DELTA32K = 'DELTA32K', + + /** + * The column is compressed using the LZO algorithm. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/lzo-encoding.html + */ + LZO = 'LZO', + + /** + * The column is compressed to a smaller storage size than the original data type. + * The compressed storage size is 1 byte. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_MostlyN_encoding.html + */ + MOSTLY8 = 'MOSTLY8', + + /** + * The column is compressed to a smaller storage size than the original data type. + * The compressed storage size is 2 bytes. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_MostlyN_encoding.html + */ + MOSTLY16 = 'MOSTLY16', + + /** + * The column is compressed to a smaller storage size than the original data type. + * The compressed storage size is 4 bytes. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_MostlyN_encoding.html + */ + MOSTLY32 = 'MOSTLY32', + + /** + * The column is compressed by recording the number of occurrences of each value in the column. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Runlength_encoding.html + */ + RUNLENGTH = 'RUNLENGTH', + + /** + * The column is compressed by recording the first 245 unique words and then using a 1-byte index to represent each word. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Text255_encoding.html + */ + TEXT255 = 'TEXT255', + + /** + * The column is compressed by recording the first 32K unique words and then using a 2-byte index to represent each word. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Text255_encoding.html + */ + TEXT32K = 'TEXT32K', + + /** + * The column is compressed using the ZSTD algorithm. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/zstd-encoding.html + */ + ZSTD = 'ZSTD', +} diff --git a/packages/@aws-cdk/aws-redshift/test/database-query-provider/table.test.ts b/packages/@aws-cdk/aws-redshift/test/database-query-provider/table.test.ts index 0999f20826fd7..94981b23692eb 100644 --- a/packages/@aws-cdk/aws-redshift/test/database-query-provider/table.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/database-query-provider/table.test.ts @@ -6,7 +6,7 @@ jest.mock('aws-sdk/clients/redshiftdata', () => class { executeStatement = mockExecuteStatement; describeStatement = () => ({ promise: jest.fn(() => ({ Status: 'FINISHED' })) }); }); -import { Column, TableDistStyle, TableSortStyle } from '../../lib'; +import { Column, ColumnEncoding, TableDistStyle, TableSortStyle } from '../../lib'; import { handler as manageTable } from '../../lib/private/database-query-provider/table'; import { TableAndClusterProps } from '../../lib/private/database-query-provider/types'; @@ -477,7 +477,7 @@ describe('update', () => { })); }); - test('replaces when differnt sortStyle: INTERLEAVED', async () => { + test('replaces when different sortStyle: INTERLEAVED', async () => { const newEvent: AWSLambda.CloudFormationCustomResourceEvent = { ...event, OldResourceProperties: { @@ -523,7 +523,7 @@ describe('update', () => { })); }); - test('does not replace when differnt sortStyle: COMPOUND', async () => { + test('does not replace when different sortStyle: COMPOUND', async () => { const newEvent: AWSLambda.CloudFormationCustomResourceEvent = { ...event, OldResourceProperties: { @@ -546,7 +546,7 @@ describe('update', () => { })); }); - test('does not replace when differnt sortStyle: AUTO', async () => { + test('does not replace when different sortStyle: AUTO', async () => { const newEvent: AWSLambda.CloudFormationCustomResourceEvent = { ...event, OldResourceProperties: { @@ -606,4 +606,96 @@ describe('update', () => { })); }); }); + + describe('column comment', () => { + test('does not replace if comment added on column', async () => { + const newComment = 'newComment'; + const newResourceProperties = { + ...resourceProperties, + tableColumns: [{ name: 'col1', dataType: 'varchar(1)', comment: newComment }], + }; + + await expect(manageTable(newResourceProperties, event)).resolves.toMatchObject({ + PhysicalResourceId: physicalResourceId, + }); + expect(mockExecuteStatement).toHaveBeenCalledWith(expect.objectContaining({ + Sql: `COMMENT ON COLUMN ${physicalResourceId}.col1 IS '${newComment}'`, + })); + }); + + test('does not replace if comment removed on column', async () => { + const newEvent = { + ...event, + OldResourceProperties: { + ...event.OldResourceProperties, + tableColumns: [{ name: 'col1', dataType: 'varchar(1)', comment: 'oldComment' }], + }, + }; + + await expect(manageTable(resourceProperties, newEvent)).resolves.toMatchObject({ + PhysicalResourceId: physicalResourceId, + }); + expect(mockExecuteStatement).toHaveBeenCalledWith(expect.objectContaining({ + Sql: `COMMENT ON COLUMN ${physicalResourceId}.col1 IS NULL`, + })); + }); + }); + + describe('column encoding', () => { + test('does not replace if encoding added on column', async () => { + const newResourceProperties = { + ...resourceProperties, + tableColumns: [{ name: 'col1', dataType: 'varchar(1)', encoding: ColumnEncoding.RAW }], + }; + + await expect(manageTable(newResourceProperties, event)).resolves.toMatchObject({ + PhysicalResourceId: physicalResourceId, + }); + expect(mockExecuteStatement).toHaveBeenCalledWith(expect.objectContaining({ + Sql: `ALTER TABLE ${physicalResourceId} ALTER COLUMN col1 ENCODE RAW`, + })); + }); + + test('does not replace if encoding removed on column', async () => { + const newEvent = { + ...event, + OldResourceProperties: { + ...event.OldResourceProperties, + tableColumns: [{ name: 'col1', dataType: 'varchar(1)', encoding: ColumnEncoding.RAW }], + }, + }; + const newResourceProperties = { + ...resourceProperties, + }; + + await expect(manageTable(newResourceProperties, newEvent)).resolves.toMatchObject({ + PhysicalResourceId: physicalResourceId, + }); + expect(mockExecuteStatement).toHaveBeenCalledWith(expect.objectContaining({ + Sql: `ALTER TABLE ${physicalResourceId} ALTER COLUMN col1 ENCODE AUTO`, + })); + }); + + test('adds a comma between multiple statements', async () => { + const newEvent = { + ...event, + OldResourceProperties: { + ...event.OldResourceProperties, + tableColumns: [{ name: 'col1', dataType: 'varchar(1)' }, { name: 'col2', dataType: 'varchar(1)' }], + }, + }; + + const newResourceProperties = { + ...resourceProperties, + tableColumns: [{ name: 'col1', dataType: 'varchar(1)', encoding: ColumnEncoding.RAW }, { name: 'col2', dataType: 'varchar(1)', encoding: ColumnEncoding.RAW }], + }; + + await expect(manageTable(newResourceProperties, newEvent)).resolves.toMatchObject({ + PhysicalResourceId: physicalResourceId, + }); + expect(mockExecuteStatement).toHaveBeenCalledWith(expect.objectContaining({ + Sql: `ALTER TABLE ${physicalResourceId} ALTER COLUMN col1 ENCODE RAW, ALTER COLUMN col2 ENCODE RAW`, + })); + }); + }); }); diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.js.snapshot/tree.json index 8f43d13c0da06..fc2f90bd8896c 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.js.snapshot/tree.json @@ -1442,7 +1442,7 @@ "path": "DefaultIamRoleInteg/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.209" + "version": "10.1.235" } }, "DeployAssert": { @@ -1488,7 +1488,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.209" + "version": "10.1.235" } } }, diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/aws-cdk-redshift-cluster-database.assets.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/aws-cdk-redshift-cluster-database.assets.json index caaeb45bb105b..10aa2697f70f7 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/aws-cdk-redshift-cluster-database.assets.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/aws-cdk-redshift-cluster-database.assets.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "29.0.0", "files": { "df6d8dd1b5d25c8d69910f850500b42f43ae98b5dfe06f5f0d1843148539d7f3": { "source": { diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.assets.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.assets.json index 064832a9333cf..a3b98377b3ccb 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.assets.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798.assets.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "29.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/cdk.out b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/cdk.out index 8ecc185e9dbee..d8b441d447f8a 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"21.0.0"} \ No newline at end of file +{"version":"29.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/integ.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/integ.json index 880550223b63c..3a506f7fa9f7b 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/integ.json @@ -1,11 +1,12 @@ { - "version": "20.0.0", + "version": "29.0.0", "testCases": { "aws-cdk-redshift-elastic-ip-test/DefaultTest": { "stacks": [ "aws-cdk-redshift-cluster-database" ], - "assertionStack": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert" + "assertionStack": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert", + "assertionStackName": "awscdkredshiftelasticiptestDefaultTestDeployAssertEAC4B798" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/manifest.json index ff7f0c20bd19b..f34589ba81960 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/manifest.json @@ -1,12 +1,6 @@ { - "version": "20.0.0", + "version": "29.0.0", "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, "aws-cdk-redshift-cluster-database.assets": { "type": "cdk:asset-manifest", "properties": { @@ -274,6 +268,12 @@ ] }, "displayName": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/tree.json index 5705868482891..64d523ec1e681 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.js.snapshot/tree.json @@ -4,14 +4,6 @@ "id": "App", "path": "", "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" - } - }, "aws-cdk-redshift-cluster-database": { "id": "aws-cdk-redshift-cluster-database", "path": "aws-cdk-redshift-cluster-database", @@ -103,8 +95,8 @@ "id": "Acl", "path": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -270,8 +262,8 @@ "id": "Acl", "path": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -437,8 +429,8 @@ "id": "Acl", "path": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -556,8 +548,8 @@ "id": "Acl", "path": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -864,11 +856,27 @@ "fqn": "@aws-cdk/aws-redshift.Cluster", "version": "0.0.0" } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-redshift-cluster-database/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-redshift-cluster-database/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" } }, "aws-cdk-redshift-elastic-ip-test": { @@ -884,15 +892,33 @@ "path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.1.235" } }, "DeployAssert": { "id": "DeployAssert", "path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-redshift-elastic-ip-test/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" } } }, @@ -906,11 +932,19 @@ "fqn": "@aws-cdk/integ-tests.IntegTest", "version": "0.0.0" } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.235" + } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json index 00fd66f1b4bc2..dba684834eca7 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json @@ -1,5 +1,5 @@ { - "version": "21.0.0", + "version": "29.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/cdk.out b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/cdk.out index 8ecc185e9dbee..d8b441d447f8a 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"21.0.0"} \ No newline at end of file +{"version":"29.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/integ.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/integ.json index dd54e06e8a6f1..28ad1346532c3 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "21.0.0", + "version": "29.0.0", "testCases": { "EnhancedVpcRouting/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/manifest.json index 88ff20370e7aa..a0fb6e711b75e 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/manifest.json @@ -1,12 +1,6 @@ { - "version": "21.0.0", + "version": "29.0.0", "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, "redshift-enhancedvpcrouting-integ.assets": { "type": "cdk:asset-manifest", "properties": { @@ -268,6 +262,12 @@ ] }, "displayName": "EnhancedVpcRouting/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/redshift-enhancedvpcrouting-integ.assets.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/redshift-enhancedvpcrouting-integ.assets.json index 02aab1b89f83b..f281b06ac61ea 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/redshift-enhancedvpcrouting-integ.assets.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/redshift-enhancedvpcrouting-integ.assets.json @@ -1,5 +1,5 @@ { - "version": "21.0.0", + "version": "29.0.0", "files": { "88e2010a08d484eca3203f7e1bcffce43eaa10faedbd092b56c3d70967765b7a": { "source": { diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/tree.json index ebc0d8772046a..7997ed915c513 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.js.snapshot/tree.json @@ -4,14 +4,6 @@ "id": "App", "path": "", "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.129" - } - }, "redshift-enhancedvpcrouting-integ": { "id": "redshift-enhancedvpcrouting-integ", "path": "redshift-enhancedvpcrouting-integ", @@ -850,6 +842,22 @@ "fqn": "@aws-cdk/aws-redshift.Cluster", "version": "0.0.0" } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "redshift-enhancedvpcrouting-integ/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "redshift-enhancedvpcrouting-integ/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } } }, "constructInfo": { @@ -870,12 +878,30 @@ "path": "EnhancedVpcRouting/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.129" + "version": "10.1.235" } }, "DeployAssert": { "id": "DeployAssert", "path": "EnhancedVpcRouting/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "EnhancedVpcRouting/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "EnhancedVpcRouting/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, "constructInfo": { "fqn": "@aws-cdk/core.Stack", "version": "0.0.0" @@ -892,6 +918,14 @@ "fqn": "@aws-cdk/integ-tests.IntegTest", "version": "0.0.0" } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.235" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.js.snapshot/asset.169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338/index.js b/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.js.snapshot/asset.169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338/index.js index d7a8b52f2944c..d91935764b9bf 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.js.snapshot/asset.169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338/index.js +++ b/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.js.snapshot/asset.169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338/index.js @@ -18,4 +18,6 @@ async function handler(event) { return subHandler(event.ResourceProperties, event); } exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxpREFBNkM7QUFDN0MsNkNBQTJEO0FBQzNELG1DQUFpRDtBQUNqRCxpQ0FBK0M7QUFFL0MsTUFBTSxRQUFRLEdBQWlIO0lBQzdILENBQUMsMEJBQVcsQ0FBQyxLQUFLLENBQUMsRUFBRSxlQUFXO0lBQ2hDLENBQUMsMEJBQVcsQ0FBQyxJQUFJLENBQUMsRUFBRSxjQUFVO0lBQzlCLENBQUMsMEJBQVcsQ0FBQyxtQkFBbUIsQ0FBQyxFQUFFLG9CQUFnQjtDQUNwRCxDQUFDO0FBRUssS0FBSyxVQUFVLE9BQU8sQ0FBQyxLQUFrRDtJQUM5RSxNQUFNLFVBQVUsR0FBRyxRQUFRLENBQUMsS0FBSyxDQUFDLGtC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ZXIsXG4gIFtIYW5kbGVyTmFtZS5Vc2VyVGFibGVQcml2aWxlZ2VzXTogbWFuYWdlUHJpdmlsZWdlcyxcbn07XG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBoYW5kbGVyKGV2ZW50OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIGNvbnN0IHN1YkhhbmRsZXIgPSBIQU5ETEVSU1tldmVudC5SZXNvdXJjZVByb3BlcnRpZXMuaGFuZGxlciBhcyBIYW5kbGVyTmFtZV07XG4gIGlmICghc3ViSGFuZGxlcikge1xuICAgIHRocm93IG5ldyBFcnJvcihgUmVxdWVzdGVkIGhhbmRsZXIgJHtldmVudC5SZXNvdXJjZVByb3BlcnRpZXMuaGFuZGxlcn0gaXMgbm90IGluIHN1cHBvcnRlZCBzZXQ6ICR7SlNPTi5zdHJpbmdpZnkoT2JqZWN0LmtleXMoSEFORExFUlMpKX1gKTtcbiAgfVxuICByZXR1cm4gc3ViSGFuZGxlcihldmVudC5SZXNvdXJjZVByb3BlcnRpZXMsIGV2ZW50KTtcbn1cbiJdfQ== \ No newline at end of file +var types_1 = require("./types"); +Object.defineProperty(exports, "ColumnEncoding", { enumerable: true, get: function () { return types_1.ColumnEncoding; } }); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxpREFBNkM7QUFDN0MsNkNBQTJEO0FBQzNELG1DQUFpRDtBQUNqRCxpQ0FBK0M7QUFFL0MsTUFBTSxRQUFRLEdBQWlIO0lBQzdILENBQUMsMEJBQVcsQ0FBQyxLQUFLLENBQUMsRUFBRSxlQUFXO0lBQ2hDLENBQUMsMEJBQVcsQ0FBQyxJQUFJLENBQUMsRUFBRSxjQUFVO0lBQzlCLEN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XTogKChwcm9wczogYW55LCBldmVudDogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudCkgPT4gUHJvbWlzZTxhbnk+KSB9ID0ge1xuICBbSGFuZGxlck5hbWUuVGFibGVdOiBtYW5hZ2VUYWJsZSxcbiAgW0hhbmRsZXJOYW1lLlVzZXJdOiBtYW5hZ2VVc2VyLFxuICBbSGFuZGxlck5hbWUuVXNlclRhYmxlUHJpdmlsZWdlc106IG1hbmFnZVByaXZpbGVnZXMsXG59O1xuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gaGFuZGxlcihldmVudDogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudCkge1xuICBjb25zdCBzdWJIYW5kbGVyID0gSEFORExFUlNbZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLmhhbmRsZXIgYXMgSGFuZGxlck5hbWVdO1xuICBpZiAoIXN1YkhhbmRsZXIpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYFJlcXVlc3RlZCBoYW5kbGVyICR7ZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLmhhbmRsZXJ9IGlzIG5vdCBpbiBzdXBwb3J0ZWQgc2V0OiAke0pTT04uc3RyaW5naWZ5KE9iamVjdC5rZXlzKEhBTkRMRVJTKSl9YCk7XG4gIH1cbiAgcmV0dXJuIHN1YkhhbmRsZXIoZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLCBldmVudCk7XG59XG5cbmV4cG9ydCB7IENvbHVtbkVuY29kaW5nIH0gZnJvbSAnLi90eXBlcyc7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.js.snapshot/asset.169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338/types.js b/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.js.snapshot/asset.169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338/types.js deleted file mode 100644 index 070bb11c1600e..0000000000000 --- a/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.js.snapshot/asset.169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338/types.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TableSortStyle = void 0; -/** - * The sort style of a table. - * This has been duplicated here to exporting private types. - */ -var TableSortStyle; -(function (TableSortStyle) { - /** - * Amazon Redshift assigns an optimal sort key based on the table data. - */ - TableSortStyle["AUTO"] = "AUTO"; - /** - * Specifies that the data is sorted using a compound key made up of all of the listed columns, - * in the order they are listed. - */ - TableSortStyle["COMPOUND"] = "COMPOUND"; - /** - * Specifies that the data is sorted using an interleaved sort key. - */ - TableSortStyle["INTERLEAVED"] = "INTERLEAVED"; -})(TableSortStyle = exports.TableSortStyle || (exports.TableSortStyle = {})); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFLQTs7O0dBR0c7QUFDSCxJQUFZLGNBZ0JYO0FBaEJELFdBQVksY0FBYztJQUN4Qjs7T0FFRztJQUNILCtCQUFhLENBQUE7SUFFYjs7O09BR0c7SUFDSCx1Q0FBcUIsQ0FBQTtJQUVyQjs7T0FFRztJQUNILDZDQUEyQixDQUFBO0FBQzdCLENBQUMsRUFoQlcsY0FBYyxHQUFkLHNCQUFjLEtBQWQsc0JBQWMsUUFnQnpCIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgRGF0YWJhc2VRdWVyeUhhbmRsZXJQcm9wcywgVGFibGVIYW5kbGVyUHJvcHMgfSBmcm9tICcuLi9oYW5kbGVyLXByb3BzJztcblxuZXhwb3J0IHR5cGUgQ2x1c3RlclByb3BzID0gT21pdDxEYXRhYmFzZVF1ZXJ5SGFuZGxlclByb3BzLCAnaGFuZGxlcic+O1xuZXhwb3J0IHR5cGUgVGFibGVBbmRDbHVzdGVyUHJvcHMgPSBUYWJsZUhhbmRsZXJQcm9wcyAmIENsdXN0ZXJQcm9wcztcblxuLyoqXG4gKiBUaGUgc29ydCBzdHlsZSBvZiBhIHRhYmxlLlxuICogVGhpcyBoYXMgYmVlbiBkdXBsaWNhdGVkIGhlcmUgdG8gZXhwb3J0aW5nIHByaXZhdGUgdHlwZXMuXG4gKi9cbmV4cG9ydCBlbnVtIFRhYmxlU29ydFN0eWxlIHtcbiAgLyoqXG4gICAqIEFtYXpvbiBSZWRzaGlmdCBhc3NpZ25zIGFuIG9wdGltYWwgc29ydCBrZXkgYmFzZWQgb24gdGhlIHRhYmxlIGRhdGEuXG4gICAqL1xuICBBVVRPID0gJ0FVVE8nLFxuXG4gIC8qKlxuICAgKiBTcGVjaWZpZXMgdGhhdCB0aGUgZGF0YSBpcyBzb3J0ZWQgdXNpbmcgYSBjb21wb3VuZCBrZXkgbWFkZSB1cCBvZiBhbGwgb2YgdGhlIGxpc3RlZCBjb2x1bW5zLFxuICAgKiBpbiB0aGUgb3JkZXIgdGhleSBhcmUgbGlzdGVkLlxuICAgKi9cbiAgQ09NUE9VTkQgPSAnQ09NUE9VTkQnLFxuXG4gIC8qKlxuICAgKiBTcGVjaWZpZXMgdGhhdCB0aGUgZGF0YSBpcyBzb3J0ZWQgdXNpbmcgYW4gaW50ZXJsZWF2ZWQgc29ydCBrZXkuXG4gICAqL1xuICBJTlRFUkxFQVZFRCA9ICdJTlRFUkxFQVZFRCcsXG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/handler-name.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/handler-name.js new file mode 100644 index 0000000000000..4983115a93834 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/handler-name.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HandlerName = void 0; +var HandlerName; +(function (HandlerName) { + HandlerName["User"] = "user"; + HandlerName["Table"] = "table"; + HandlerName["UserTablePrivileges"] = "user-table-privileges"; +})(HandlerName = exports.HandlerName || (exports.HandlerName = {})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFuZGxlci1uYW1lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaGFuZGxlci1uYW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLElBQVksV0FJWDtBQUpELFdBQVksV0FBVztJQUNyQiw0QkFBYSxDQUFBO0lBQ2IsOEJBQWUsQ0FBQTtJQUNmLDREQUE2QyxDQUFBO0FBQy9DLENBQUMsRUFKVyxXQUFXLEdBQVgsbUJBQVcsS0FBWCxtQkFBVyxRQUl0QiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBlbnVtIEhhbmRsZXJOYW1lIHtcbiAgVXNlciA9ICd1c2VyJyxcbiAgVGFibGUgPSAndGFibGUnLFxuICBVc2VyVGFibGVQcml2aWxlZ2VzID0gJ3VzZXItdGFibGUtcHJpdmlsZWdlcycsXG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/index.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/index.js new file mode 100644 index 0000000000000..d91935764b9bf --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/index.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +const handler_name_1 = require("./handler-name"); +const privileges_1 = require("./privileges"); +const table_1 = require("./table"); +const user_1 = require("./user"); +const HANDLERS = { + [handler_name_1.HandlerName.Table]: table_1.handler, + [handler_name_1.HandlerName.User]: user_1.handler, + [handler_name_1.HandlerName.UserTablePrivileges]: privileges_1.handler, +}; +async function handler(event) { + const subHandler = HANDLERS[event.ResourceProperties.handler]; + if (!subHandler) { + throw new Error(`Requested handler ${event.ResourceProperties.handler} is not in supported set: ${JSON.stringify(Object.keys(HANDLERS))}`); + } + return subHandler(event.ResourceProperties, event); +} +exports.handler = handler; +var types_1 = require("./types"); +Object.defineProperty(exports, "ColumnEncoding", { enumerable: true, get: function () { return types_1.ColumnEncoding; } }); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxpREFBNkM7QUFDN0MsNkNBQTJEO0FBQzNELG1DQUFpRDtBQUNqRCxpQ0FBK0M7QUFFL0MsTUFBTSxRQUFRLEdBQWlIO0lBQzdILENBQUMsMEJBQVcsQ0FBQyxLQUFLLENBQUMsRUFBRSxlQUFXO0lBQ2hDLENBQUMsMEJBQVcsQ0FBQyxJQUFJLENBQUMsRUFBRSxjQUFVO0lBQzlCLENBQUMsMEJBQVcsQ0FBQyxtQkFBbUIsQ0FBQyxFQUFFLG9CQUFnQjtDQUNwRCxDQUFDO0FBRUssS0FBSyxVQUFVLE9BQU8sQ0FBQyxLQUFrRDtJQUM5RSxNQUFNLFVBQVUsR0FBRy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ibGVdOiBtYW5hZ2VUYWJsZSxcbiAgW0hhbmRsZXJOYW1lLlVzZXJdOiBtYW5hZ2VVc2VyLFxuICBbSGFuZGxlck5hbWUuVXNlclRhYmxlUHJpdmlsZWdlc106IG1hbmFnZVByaXZpbGVnZXMsXG59O1xuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gaGFuZGxlcihldmVudDogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudCkge1xuICBjb25zdCBzdWJIYW5kbGVyID0gSEFORExFUlNbZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLmhhbmRsZXIgYXMgSGFuZGxlck5hbWVdO1xuICBpZiAoIXN1YkhhbmRsZXIpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYFJlcXVlc3RlZCBoYW5kbGVyICR7ZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLmhhbmRsZXJ9IGlzIG5vdCBpbiBzdXBwb3J0ZWQgc2V0OiAke0pTT04uc3RyaW5naWZ5KE9iamVjdC5rZXlzKEhBTkRMRVJTKSl9YCk7XG4gIH1cbiAgcmV0dXJuIHN1YkhhbmRsZXIoZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLCBldmVudCk7XG59XG5cbmV4cG9ydCB7IENvbHVtbkVuY29kaW5nIH0gZnJvbSAnLi90eXBlcyc7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/privileges.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/privileges.js new file mode 100644 index 0000000000000..8770142deb498 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/privileges.js @@ -0,0 +1,58 @@ +"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: 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 ? 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 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 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; + if (oldTablePrivileges !== tablePrivileges) { + await revokePrivileges(username, oldTablePrivileges, clusterProps); + await grantPrivileges(username, tablePrivileges, clusterProps); + return { replace: false }; + } + return { replace: false }; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmlsZWdlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInByaXZpbGVnZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsbURBQW1EO0FBRW5ELGlDQUF3QztBQUdqQyxLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQXFELEVBQUUsS0FBa0Q7SUFDckksTUFBTSxRQUFRLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQztJQUNoQyxNQUFNLGVBQWUsR0FBRyxLQUFLLENBQUMsZUFBZSxDQUFDO0lBQzlDLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQztJQUUzQixJQUFJLEtBQUssQ0FBQyxXQUFXLEtBQUssUUFBUSxFQUFFO1FBQ2xDLE1BQU0sZUFBZSxDQUFDLFFBQVEsRUFBRSxlQUFlLEVBQUUsWUFBWSxDQUFDLENBQUM7UUFDL0QsT0FBTyxFQUFFLGtCQUFrQixFQUFFLHFCQUFjLENBQUMsUUFBUSxFQUFFLFlBQVksRUFBRSxLQUFLLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQztLQUN4RjtTQUFNLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLEVBQUU7UUFDekMsTUFBTSxnQkFBZ0IsQ0FBQyxRQUFRLEVBQUUsZUFBZSxFQUFFLFlBQVksQ0FBQyxDQUFDO1FBQ2hFLE9BQU87S0FDUjtTQUFNLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLEVBQUU7UUFDekMsTUFBTSxFQUFFLE9BQU8sRUFBRSxHQUFHLE1BQU0sZ0JBQWdCLENBQ3hDLFFBQVEsRUFDUixlQUFlLEVBQ2YsWUFBWSxFQUNaLEtBQUssQ0FBQyxxQkFBdUUsQ0FDOUUsQ0FBQ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H07XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/redshift-data.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/redshift-data.js new file mode 100644 index 0000000000000..e65374f4ab7e0 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/redshift-data.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.executeStatement = void 0; +/* eslint-disable-next-line import/no-extraneous-dependencies */ +const RedshiftData = require("aws-sdk/clients/redshiftdata"); +const redshiftData = new RedshiftData(); +async function executeStatement(statement, clusterProps) { + const executeStatementProps = { + ClusterIdentifier: clusterProps.clusterName, + Database: clusterProps.databaseName, + SecretArn: clusterProps.adminUserArn, + Sql: statement, + }; + const executedStatement = await redshiftData.executeStatement(executeStatementProps).promise(); + if (!executedStatement.Id) { + throw new Error('Service error: Statement execution did not return a statement ID'); + } + await waitForStatementComplete(executedStatement.Id); +} +exports.executeStatement = executeStatement; +const waitTimeout = 100; +async function waitForStatementComplete(statementId) { + await new Promise((resolve) => { + setTimeout(() => resolve(), waitTimeout); + }); + const statement = await redshiftData.describeStatement({ Id: statementId }).promise(); + if (statement.Status !== 'FINISHED' && statement.Status !== 'FAILED' && statement.Status !== 'ABORTED') { + return waitForStatementComplete(statementId); + } + else if (statement.Status === 'FINISHED') { + return; + } + else { + throw new Error(`Statement status was ${statement.Status}: ${statement.Error}`); + } +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVkc2hpZnQtZGF0YS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInJlZHNoaWZ0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ICAgcmV0dXJuIHdhaXRGb3JTdGF0ZW1lbnRDb21wbGV0ZShzdGF0ZW1lbnRJZCk7XG4gIH0gZWxzZSBpZiAoc3RhdGVtZW50LlN0YXR1cyA9PT0gJ0ZJTklTSEVEJykge1xuICAgIHJldHVybjtcbiAgfSBlbHNlIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYFN0YXRlbWVudCBzdGF0dXMgd2FzICR7c3RhdGVtZW50LlN0YXR1c306ICR7c3RhdGVtZW50LkVycm9yfWApO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/table.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/table.js new file mode 100644 index 0000000000000..1294ed3cd80c4 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/table.js @@ -0,0 +1,148 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +const redshift_data_1 = require("./redshift-data"); +const types_1 = require("./types"); +const util_1 = require("./util"); +async function handler(props, event) { + const tableNamePrefix = props.tableName.prefix; + const tableNameSuffix = props.tableName.generateSuffix === 'true' ? `${event.RequestId.substring(0, 8)}` : ''; + const tableColumns = props.tableColumns; + const tableAndClusterProps = props; + if (event.RequestType === 'Create') { + const tableName = await createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps); + return { PhysicalResourceId: tableName }; + } + else if (event.RequestType === 'Delete') { + await dropTable(event.PhysicalResourceId, tableAndClusterProps); + return; + } + else if (event.RequestType === 'Update') { + const tableName = await updateTable(event.PhysicalResourceId, tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps, event.OldResourceProperties); + return { PhysicalResourceId: tableName }; + } + else { + /* eslint-disable-next-line dot-notation */ + throw new Error(`Unrecognized event type: ${event['RequestType']}`); + } +} +exports.handler = handler; +async function createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps) { + const tableName = tableNamePrefix + tableNameSuffix; + const tableColumnsString = tableColumns.map(column => `${column.name} ${column.dataType}${getEncodingColumnString(column)}`).join(); + let statement = `CREATE TABLE ${tableName} (${tableColumnsString})`; + if (tableAndClusterProps.distStyle) { + statement += ` DISTSTYLE ${tableAndClusterProps.distStyle}`; + } + const distKeyColumn = util_1.getDistKeyColumn(tableColumns); + if (distKeyColumn) { + statement += ` DISTKEY(${distKeyColumn.name})`; + } + const sortKeyColumns = util_1.getSortKeyColumns(tableColumns); + if (sortKeyColumns.length > 0) { + const sortKeyColumnsString = getSortKeyColumnsString(sortKeyColumns); + statement += ` ${tableAndClusterProps.sortStyle} SORTKEY(${sortKeyColumnsString})`; + } + await redshift_data_1.executeStatement(statement, tableAndClusterProps); + for (const column of tableColumns) { + if (column.comment) { + await redshift_data_1.executeStatement(`COMMENT ON COLUMN ${tableName}.${column.name} IS '${column.comment}'`, tableAndClusterProps); + } + } + if (tableAndClusterProps.tableComment) { + await redshift_data_1.executeStatement(`COMMENT ON TABLE ${tableName} IS '${tableAndClusterProps.tableComment}'`, tableAndClusterProps); + } + return tableName; +} +async function dropTable(tableName, clusterProps) { + await redshift_data_1.executeStatement(`DROP TABLE ${tableName}`, clusterProps); +} +async function updateTable(tableName, tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps, oldResourceProperties) { + const alterationStatements = []; + const oldClusterProps = oldResourceProperties; + if (tableAndClusterProps.clusterName !== oldClusterProps.clusterName || tableAndClusterProps.databaseName !== oldClusterProps.databaseName) { + return createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps); + } + const oldTableNamePrefix = oldResourceProperties.tableName.prefix; + if (tableNamePrefix !== oldTableNamePrefix) { + return createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps); + } + const oldTableColumns = oldResourceProperties.tableColumns; + const columnDeletions = oldTableColumns.filter(oldColumn => (tableColumns.every(column => oldColumn.name !== column.name))); + if (columnDeletions.length > 0) { + alterationStatements.push(...columnDeletions.map(column => `ALTER TABLE ${tableName} DROP COLUMN ${column.name}`)); + } + const columnAdditions = tableColumns.filter(column => { + return !oldTableColumns.some(oldColumn => column.name === oldColumn.name && column.dataType === oldColumn.dataType); + }).map(column => `ADD ${column.name} ${column.dataType}`); + if (columnAdditions.length > 0) { + alterationStatements.push(...columnAdditions.map(addition => `ALTER TABLE ${tableName} ${addition}`)); + } + const columnEncoding = tableColumns.filter(column => { + return oldTableColumns.some(oldColumn => column.name === oldColumn.name && column.encoding !== oldColumn.encoding); + }).map(column => `ALTER COLUMN ${column.name} ENCODE ${column.encoding || types_1.ColumnEncoding.AUTO}`); + if (columnEncoding.length > 0) { + alterationStatements.push(`ALTER TABLE ${tableName} ${columnEncoding.join(', ')}`); + } + const columnComments = tableColumns.filter(column => { + return oldTableColumns.some(oldColumn => column.name === oldColumn.name && column.comment !== oldColumn.comment); + }).map(column => `COMMENT ON COLUMN ${tableName}.${column.name} IS ${column.comment ? `'${column.comment}'` : 'NULL'}`); + if (columnComments.length > 0) { + alterationStatements.push(...columnComments); + } + const oldDistStyle = oldResourceProperties.distStyle; + if ((!oldDistStyle && tableAndClusterProps.distStyle) || + (oldDistStyle && !tableAndClusterProps.distStyle)) { + return createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps); + } + else if (oldDistStyle !== tableAndClusterProps.distStyle) { + alterationStatements.push(`ALTER TABLE ${tableName} ALTER DISTSTYLE ${tableAndClusterProps.distStyle}`); + } + const oldDistKey = util_1.getDistKeyColumn(oldTableColumns)?.name; + const newDistKey = util_1.getDistKeyColumn(tableColumns)?.name; + if ((!oldDistKey && newDistKey) || (oldDistKey && !newDistKey)) { + return createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps); + } + else if (oldDistKey !== newDistKey) { + alterationStatements.push(`ALTER TABLE ${tableName} ALTER DISTKEY ${newDistKey}`); + } + const oldSortKeyColumns = util_1.getSortKeyColumns(oldTableColumns); + const newSortKeyColumns = util_1.getSortKeyColumns(tableColumns); + const oldSortStyle = oldResourceProperties.sortStyle; + const newSortStyle = tableAndClusterProps.sortStyle; + if ((oldSortStyle === newSortStyle && !util_1.areColumnsEqual(oldSortKeyColumns, newSortKeyColumns)) + || (oldSortStyle !== newSortStyle)) { + switch (newSortStyle) { + case types_1.TableSortStyle.INTERLEAVED: + // INTERLEAVED sort key addition requires replacement. + // https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html + return createTable(tableNamePrefix, tableNameSuffix, tableColumns, tableAndClusterProps); + case types_1.TableSortStyle.COMPOUND: { + const sortKeyColumnsString = getSortKeyColumnsString(newSortKeyColumns); + alterationStatements.push(`ALTER TABLE ${tableName} ALTER ${newSortStyle} SORTKEY(${sortKeyColumnsString})`); + break; + } + case types_1.TableSortStyle.AUTO: { + alterationStatements.push(`ALTER TABLE ${tableName} ALTER SORTKEY ${newSortStyle}`); + break; + } + } + } + const oldComment = oldResourceProperties.tableComment; + const newComment = tableAndClusterProps.tableComment; + if (oldComment !== newComment) { + alterationStatements.push(`COMMENT ON TABLE ${tableName} IS ${newComment ? `'${newComment}'` : 'NULL'}`); + } + await Promise.all(alterationStatements.map(statement => redshift_data_1.executeStatement(statement, tableAndClusterProps))); + return tableName; +} +function getSortKeyColumnsString(sortKeyColumns) { + return sortKeyColumns.map(column => column.name).join(); +} +function getEncodingColumnString(column) { + if (column.encoding) { + return ` ENCODE ${column.encoding}`; + } + return ''; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFibGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0YWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxtREFBbUQ7QU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7bmV3Q29tbWVudCA/IGAnJHtuZXdDb21tZW50fSdgIDogJ05VTEwnfWApO1xuICB9XG5cbiAgYXdhaXQgUHJvbWlzZS5hbGwoYWx0ZXJhdGlvblN0YXRlbWVudHMubWFwKHN0YXRlbWVudCA9PiBleGVjdXRlU3RhdGVtZW50KHN0YXRlbWVudCwgdGFibGVBbmRDbHVzdGVyUHJvcHMpKSk7XG5cbiAgcmV0dXJuIHRhYmxlTmFtZTtcbn1cblxuZnVuY3Rpb24gZ2V0U29ydEtleUNvbHVtbnNTdHJpbmcoc29ydEtleUNvbHVtbnM6IENvbHVtbltdKSB7XG4gIHJldHVybiBzb3J0S2V5Q29sdW1ucy5tYXAoY29sdW1uID0+IGNvbHVtbi5uYW1lKS5qb2luKCk7XG59XG5cbmZ1bmN0aW9uIGdldEVuY29kaW5nQ29sdW1uU3RyaW5nKGNvbHVtbjogQ29sdW1uKTogc3RyaW5nIHtcbiAgaWYgKGNvbHVtbi5lbmNvZGluZykge1xuICAgIHJldHVybiBgIEVOQ09ERSAke2NvbHVtbi5lbmNvZGluZ31gO1xuICB9XG4gIHJldHVybiAnJztcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/types.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/types.js new file mode 100644 index 0000000000000..c19cbf576b891 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/types.js @@ -0,0 +1,120 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ColumnEncoding = exports.TableSortStyle = void 0; +/** + * The sort style of a table. + * This has been duplicated here to exporting private types. + */ +var TableSortStyle; +(function (TableSortStyle) { + /** + * Amazon Redshift assigns an optimal sort key based on the table data. + */ + TableSortStyle["AUTO"] = "AUTO"; + /** + * Specifies that the data is sorted using a compound key made up of all of the listed columns, + * in the order they are listed. + */ + TableSortStyle["COMPOUND"] = "COMPOUND"; + /** + * Specifies that the data is sorted using an interleaved sort key. + */ + TableSortStyle["INTERLEAVED"] = "INTERLEAVED"; +})(TableSortStyle = exports.TableSortStyle || (exports.TableSortStyle = {})); +/** + * The compression encoding of a column. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Compression_encodings.html + */ +var ColumnEncoding; +(function (ColumnEncoding) { + /** + * Amazon Redshift assigns an optimal encoding based on the column data. + * This is the default. + */ + ColumnEncoding["AUTO"] = "AUTO"; + /** + * The column is not compressed. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Raw_encoding.html + */ + ColumnEncoding["RAW"] = "RAW"; + /** + * The column is compressed using the AZ64 algorithm. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/az64-encoding.html + */ + ColumnEncoding["AZ64"] = "AZ64"; + /** + * The column is compressed using a separate dictionary for each block column value on disk. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Byte_dictionary_encoding.html + */ + ColumnEncoding["BYTEDICT"] = "BYTEDICT"; + /** + * The column is compressed based on the difference between values in the column. + * This records differences as 1-byte values. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Delta_encoding.html + */ + ColumnEncoding["DELTA"] = "DELTA"; + /** + * The column is compressed based on the difference between values in the column. + * This records differences as 2-byte values. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Delta_encoding.html + */ + ColumnEncoding["DELTA32K"] = "DELTA32K"; + /** + * The column is compressed using the LZO algorithm. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/lzo-encoding.html + */ + ColumnEncoding["LZO"] = "LZO"; + /** + * The column is compressed to a smaller storage size than the original data type. + * The compressed storage size is 1 byte. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_MostlyN_encoding.html + */ + ColumnEncoding["MOSTLY8"] = "MOSTLY8"; + /** + * The column is compressed to a smaller storage size than the original data type. + * The compressed storage size is 2 bytes. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_MostlyN_encoding.html + */ + ColumnEncoding["MOSTLY16"] = "MOSTLY16"; + /** + * The column is compressed to a smaller storage size than the original data type. + * The compressed storage size is 4 bytes. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_MostlyN_encoding.html + */ + ColumnEncoding["MOSTLY32"] = "MOSTLY32"; + /** + * The column is compressed by recording the number of occurrences of each value in the column. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Runlength_encoding.html + */ + ColumnEncoding["RUNLENGTH"] = "RUNLENGTH"; + /** + * The column is compressed by recording the first 245 unique words and then using a 1-byte index to represent each word. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Text255_encoding.html + */ + ColumnEncoding["TEXT255"] = "TEXT255"; + /** + * The column is compressed by recording the first 32K unique words and then using a 2-byte index to represent each word. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/c_Text255_encoding.html + */ + ColumnEncoding["TEXT32K"] = "TEXT32K"; + /** + * The column is compressed using the ZSTD algorithm. + * + * @see https://docs.aws.amazon.com/redshift/latest/dg/zstd-encoding.html + */ + ColumnEncoding["ZSTD"] = "ZSTD"; +})(ColumnEncoding = exports.ColumnEncoding || (exports.ColumnEncoding = {})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFLQTs7O0dBR0c7QUFDSCxJQUFZLGNBZ0JYO0FBaEJELFdBQVksY0FBYztJQUN4Qjs7T0FFRztJQUNILCtCQUFhLENBQUE7SUFFYjs7O09BR0c7SUFDSCx1Q0FBcUIsQ0FBQTtJQUVyQjs7T0FFRztJQUNILDZDQ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maXJzdCAyNDUgdW5pcXVlIHdvcmRzIGFuZCB0aGVuIHVzaW5nIGEgMS1ieXRlIGluZGV4IHRvIHJlcHJlc2VudCBlYWNoIHdvcmQuXG4gICAqXG4gICAqIEBzZWUgaHR0cHM6Ly9kb2NzLmF3cy5hbWF6b24uY29tL3JlZHNoaWZ0L2xhdGVzdC9kZy9jX1RleHQyNTVfZW5jb2RpbmcuaHRtbFxuICAgKi9cbiAgVEVYVDI1NSA9ICdURVhUMjU1JyxcblxuICAvKipcbiAgICogVGhlIGNvbHVtbiBpcyBjb21wcmVzc2VkIGJ5IHJlY29yZGluZyB0aGUgZmlyc3QgMzJLIHVuaXF1ZSB3b3JkcyBhbmQgdGhlbiB1c2luZyBhIDItYnl0ZSBpbmRleCB0byByZXByZXNlbnQgZWFjaCB3b3JkLlxuICAgKlxuICAgKiBAc2VlIGh0dHBzOi8vZG9jcy5hd3MuYW1hem9uLmNvbS9yZWRzaGlmdC9sYXRlc3QvZGcvY19UZXh0MjU1X2VuY29kaW5nLmh0bWxcbiAgICovXG4gIFRFWFQzMksgPSAnVEVYVDMySycsXG5cbiAgLyoqXG4gICAqIFRoZSBjb2x1bW4gaXMgY29tcHJlc3NlZCB1c2luZyB0aGUgWlNURCBhbGdvcml0aG0uXG4gICAqXG4gICAqIEBzZWUgaHR0cHM6Ly9kb2NzLmF3cy5hbWF6b24uY29tL3JlZHNoaWZ0L2xhdGVzdC9kZy96c3RkLWVuY29kaW5nLmh0bWxcbiAgICovXG4gIFpTVEQgPSAnWlNURCcsXG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/user.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/user.js new file mode 100644 index 0000000000000..f097ae1836462 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/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 SecretsManager = require("aws-sdk/clients/secretsmanager"); +const redshift_data_1 = require("./redshift-data"); +const util_1 = require("./util"); +const secretsManager = new 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: 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 ? 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 redshift_data_1.executeStatement(`DROP USER ${username}`, clusterProps); +} +async function createUser(username, passwordSecretArn, clusterProps) { + const password = await getPasswordFromSecret(passwordSecretArn); + await 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 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, + }).promise(); + 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInVzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsZ0VBQWdFO0FBQ2hFLGlFQUFpRTtBQUNqRSxtREFBbUQ7QUFFbkQsaUNBQXdDO0FBR3hDLE1BQU0sY0FBYyxHQUFHLElBQUksY0FBYyxFQUFFLENBQUM7QUFFckMsS0FBSyxVQUFVLE9BQU8sQ0FBQyxLQUFzQyxFQUFFLEtBQWtEO0lBQ3RILE1BQU0sUUFBUSxHQUFHLEtBQUssQ0FBQyxRQUFRLENBQUM7SUFDaEMsTUFBTSxpQkFBaUIsR0FBRyxLQUFLLENBQUMsaUJBQWlCLENBQUM7SUFDbEQsTUFBTSxZQUFZLEdBQUcsS0FBSyxDQUFDO0lBRTNCLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLEVBQUU7UUFDbEMsTUFBTSxVQUFVLENBQUMsUUFBUSxFQUFFLGlCQUFpQixFQUFFLFlBQVksQ0FBQyxDQUFDO1FBQzVELE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxxQkFBYyxDQUFDLFFBQVEsRUFBRSxZQUFZLEVBQUUsS0FBSyxDQUFDLFNBQVMsQ0FBQyxFQUFFLElBQUksRUFBRSxFQUFFLFFBQVEsRUFBRSx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0gSlNPTi5wYXJzZShzZWNyZXRTdHJpbmcpO1xuXG4gIHJldHVybiBwYXNzd29yZDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/util.js b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/util.js new file mode 100644 index 0000000000000..d8dc8cad799c9 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/asset.847e15feeb180b356ab9a8094d8b9459ea8ec26fc27957794d583ed9eb3a79d8/util.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.areColumnsEqual = exports.getSortKeyColumns = exports.getDistKeyColumn = exports.makePhysicalId = void 0; +function makePhysicalId(resourceName, clusterProps, requestId) { + return `${clusterProps.clusterName}:${clusterProps.databaseName}:${resourceName}:${requestId}`; +} +exports.makePhysicalId = makePhysicalId; +function getDistKeyColumn(columns) { + // string comparison is required for custom resource since everything is passed as string + const distKeyColumns = columns.filter(column => column.distKey === true || column.distKey === 'true'); + if (distKeyColumns.length === 0) { + return undefined; + } + else if (distKeyColumns.length > 1) { + throw new Error('Multiple dist key columns found'); + } + return distKeyColumns[0]; +} +exports.getDistKeyColumn = getDistKeyColumn; +function getSortKeyColumns(columns) { + // string comparison is required for custom resource since everything is passed as string + return columns.filter(column => column.sortKey === true || column.sortKey === 'true'); +} +exports.getSortKeyColumns = getSortKeyColumns; +function areColumnsEqual(columnsA, columnsB) { + if (columnsA.length !== columnsB.length) { + return false; + } + return columnsA.every(columnA => { + return columnsB.find(column => column.name === columnA.name && column.dataType === columnA.dataType); + }); +} +exports.areColumnsEqual = areColumnsEqual; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIs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1uc0EuZXZlcnkoY29sdW1uQSA9PiB7XG4gICAgcmV0dXJuIGNvbHVtbnNCLmZpbmQoY29sdW1uID0+IGNvbHVtbi5uYW1lID09PSBjb2x1bW5BLm5hbWUgJiYgY29sdW1uLmRhdGFUeXBlID09PSBjb2x1bW5BLmRhdGFUeXBlKTtcbiAgfSk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json index 863fe6c1960ce..ae34a00d79aa9 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.assets.json @@ -42,4 +42,4 @@ } }, "dockerImages": {} -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json index c3a7bfa330492..4e234633a945a 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/aws-cdk-redshift-cluster-database.template.json @@ -1,1221 +1,1193 @@ { - "Resources": { - "customkmskey377C6F9A": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" + "Resources": { + "customkmskey377C6F9A": { + "Type": "AWS::KMS::Key", + "Properties": { + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "Vpc8378EB38": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet1Subnet5C2D37C4": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } ] - ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet1RouteTable6C95E38E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet1RouteTableAssociation97140677": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "Vpc8378EB38": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet1Subnet5C2D37C4": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.0.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet1RouteTable6C95E38E": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet1RouteTableAssociation97140677": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "SubnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet1DefaultRoute3DA9E72A": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VpcIGWD7BA715C" - } - }, - "DependsOn": [ - "VpcVPCGWBF912B6E" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet1EIPD7E02669": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet1NATGateway4D7517AA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, - "AllocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet1EIPD7E02669", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "VpcPublicSubnet1DefaultRoute3DA9E72A", - "VpcPublicSubnet1RouteTableAssociation97140677" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet2Subnet691E08A3": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.64.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet2RouteTable94F7E489": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet2RouteTableAssociationDD5762D8": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "SubnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet2DefaultRoute97F91067": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VpcIGWD7BA715C" - } - }, - "DependsOn": [ - "VpcVPCGWBF912B6E" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet2EIP3C605A87": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPublicSubnet2NATGateway9182C01D": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - }, - "AllocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet2EIP3C605A87", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "VpcPublicSubnet2DefaultRoute97F91067", - "VpcPublicSubnet2RouteTableAssociationDD5762D8" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet1Subnet536B997A": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.128.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet1" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet1RouteTableB2C5B500": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet1" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "SubnetId": { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet1DefaultRouteBE02A9ED": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "VpcPublicSubnet1NATGateway4D7517AA" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet2Subnet3788AAA1": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.192.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet2" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet2RouteTableA678073B": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet2" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "SubnetId": { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcPrivateSubnet2DefaultRoute060D2087": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "VpcPublicSubnet2NATGateway9182C01D" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcIGWD7BA715C": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-cdk-redshift-cluster-database/Vpc" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "VpcVPCGWBF912B6E": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "InternetGatewayId": { - "Ref": "VpcIGWD7BA715C" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ClusterSubnetsDCFA5CB7": { - "Type": "AWS::Redshift::ClusterSubnetGroup", - "Properties": { - "Description": "Subnets for Cluster Redshift cluster", - "SubnetIds": [ - { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, - { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ClusterSecurityGroup0921994B": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Redshift security group", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ClusterSecret6368BD0F": { - "Type": "AWS::SecretsManager::Secret", - "Properties": { - "GenerateSecretString": { - "ExcludeCharacters": "\"@/\\ '", - "GenerateStringKey": "password", - "PasswordLength": 30, - "SecretStringTemplate": "{\"username\":\"admin\"}" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ClusterSecretAttachment769E6258": { - "Type": "AWS::SecretsManager::SecretTargetAttachment", - "Properties": { - "SecretId": { - "Ref": "ClusterSecret6368BD0F" - }, - "TargetId": { - "Ref": "ClusterEB0386A7" - }, - "TargetType": "AWS::Redshift::Cluster" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ClusterEB0386A7": { - "Type": "AWS::Redshift::Cluster", - "Properties": { - "ClusterType": "multi-node", - "DBName": "my_db", - "MasterUsername": { - "Fn::Join": [ - "", - [ - "{{resolve:secretsmanager:", - { - "Ref": "ClusterSecret6368BD0F" - }, - ":SecretString:username::}}" - ] - ] - }, - "MasterUserPassword": { - "Fn::Join": [ - "", - [ - "{{resolve:secretsmanager:", - { - "Ref": "ClusterSecret6368BD0F" - }, - ":SecretString:password::}}" - ] - ] - }, - "NodeType": "dc2.large", - "AllowVersionUpgrade": true, - "AutomatedSnapshotRetentionPeriod": 1, - "ClusterParameterGroupName": { - "Ref": "ClusterParameterGroup879806FD" - }, - "ClusterSubnetGroupName": { - "Ref": "ClusterSubnetsDCFA5CB7" - }, - "Encrypted": true, - "KmsKeyId": { - "Ref": "customkmskey377C6F9A" - }, - "NumberOfNodes": 2, - "PubliclyAccessible": true, - "VpcSecurityGroupIds": [ - { - "Fn::GetAtt": [ - "ClusterSecurityGroup0921994B", - "GroupId" - ] - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ClusterParameterGroup879806FD": { - "Type": "AWS::Redshift::ClusterParameterGroup", - "Properties": { - "Description": "Cluster parameter group for family redshift-1.0", - "ParameterGroupFamily": "redshift-1.0", - "Parameters": [ - { - "ParameterName": "enable_user_activity_logging", - "ParameterValue": "true" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserSecretE2C04A69": { - "Type": "AWS::SecretsManager::Secret", - "Properties": { - "GenerateSecretString": { - "ExcludeCharacters": "\"@/\\ '", - "GenerateStringKey": "password", - "PasswordLength": 30, - "SecretStringTemplate": "{\"username\":\"awscdkredshiftclusterdatabaseuserc17d5ebd\"}" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserSecretAttachment02022609": { - "Type": "AWS::SecretsManager::SecretTargetAttachment", - "Properties": { - "SecretId": { - "Ref": "UserSecretE2C04A69" - }, - "TargetId": { - "Ref": "ClusterEB0386A7" - }, - "TargetType": "AWS::Redshift::Cluster" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserProviderframeworkonEventServiceRole8FBA2FBD": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet1DefaultRoute3DA9E72A": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + } + }, + "DependsOn": ["VpcVPCGWBF912B6E"], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet1EIPD7E02669": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet1NATGateway4D7517AA": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" + "AllocationId": { + "Fn::GetAtt": ["VpcPublicSubnet1EIPD7E02669", "AllocationId"] + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet1DefaultRoute3DA9E72A", + "VpcPublicSubnet1RouteTableAssociation97140677" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet2Subnet691E08A3": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } ] - ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet2RouteTable94F7E489": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet2RouteTableAssociationDD5762D8": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", - "Roles": [ - { - "Ref": "UserProviderframeworkonEventServiceRole8FBA2FBD" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserProviderframeworkonEvent4EC32885": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585.zip" - }, - "Role": { - "Fn::GetAtt": [ - "UserProviderframeworkonEventServiceRole8FBA2FBD", - "Arn" - ] - }, - "Description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/User/Resource/Provider)", - "Environment": { - "Variables": { - "USER_ON_EVENT_FUNCTION_ARN": { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - } - } - }, - "Handler": "framework.onEvent", - "Runtime": "nodejs14.x", - "Timeout": 900 - }, - "DependsOn": [ - "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", - "UserProviderframeworkonEventServiceRole8FBA2FBD" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserFDDCDD17": { - "Type": "Custom::RedshiftDatabaseQuery", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "UserProviderframeworkonEvent4EC32885", - "Arn" - ] - }, - "handler": "user", - "clusterName": { - "Ref": "ClusterEB0386A7" - }, - "adminUserArn": { - "Ref": "ClusterSecretAttachment769E6258" - }, - "databaseName": "my_db", - "username": "awscdkredshiftclusterdatabaseuserc17d5ebd", - "passwordSecretArn": { - "Ref": "UserSecretAttachment02022609" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet2DefaultRoute97F91067": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + } + }, + "DependsOn": ["VpcVPCGWBF912B6E"], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet2EIP3C605A87": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPublicSubnet2NATGateway9182C01D": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - }, - ":*" + "AllocationId": { + "Fn::GetAtt": ["VpcPublicSubnet2EIP3C605A87", "AllocationId"] + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet2DefaultRoute97F91067", + "VpcPublicSubnet2RouteTableAssociationDD5762D8" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet1Subnet536B997A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet1" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet1RouteTableB2C5B500": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet1" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet1DefaultRouteBE02A9ED": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet2Subnet3788AAA1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } ] - ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet2" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet2RouteTableA678073B": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc/PrivateSubnet2" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", - "Roles": [ - { - "Ref": "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserTablePrivilegesProviderframeworkonEvent3F5C1851": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585.zip" - }, - "Role": { - "Fn::GetAtt": [ - "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A", - "Arn" - ] - }, - "Description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider)", - "Environment": { - "Variables": { - "USER_ON_EVENT_FUNCTION_ARN": { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - } - } - }, - "Handler": "framework.onEvent", - "Runtime": "nodejs14.x", - "Timeout": 900 - }, - "DependsOn": [ - "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", - "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "UserTablePrivileges3829D614": { - "Type": "Custom::RedshiftDatabaseQuery", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "UserTablePrivilegesProviderframeworkonEvent3F5C1851", - "Arn" - ] - }, - "handler": "user-table-privileges", - "clusterName": { - "Ref": "ClusterEB0386A7" - }, - "adminUserArn": { - "Ref": "ClusterSecretAttachment769E6258" - }, - "databaseName": "my_db", - "username": { - "Fn::GetAtt": [ - "UserFDDCDD17", - "username" - ] - }, - "tablePrivileges": [ - { - "tableName": { - "Ref": "Table7ABB320E" }, - "actions": [ - "INSERT", - "DELETE", - "SELECT" - ] - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcPrivateSubnet2DefaultRoute060D2087": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "redshift-data:DescribeStatement", - "redshift-data:ExecuteStatement" - ], - "Effect": "Allow", - "Resource": "*" + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet2NATGateway9182C01D" + } }, - { - "Action": [ - "secretsmanager:DescribeSecret", - "secretsmanager:GetSecretValue" - ], - "Effect": "Allow", - "Resource": [ - { - "Ref": "ClusterSecretAttachment769E6258" + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcIGWD7BA715C": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-redshift-cluster-database/Vpc" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "VpcVPCGWBF912B6E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" }, - { - "Ref": "UserSecretAttachment02022609" + "InternetGatewayId": { + "Ref": "VpcIGWD7BA715C" } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D", - "Roles": [ - { - "Ref": "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338.zip" - }, - "Role": { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717", - "Arn" - ] - }, - "Handler": "index.handler", - "Runtime": "nodejs14.x", - "Timeout": 60 - }, - "DependsOn": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D", - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "TableProviderframeworkonEventServiceRoleC3128F67": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ClusterSubnetsDCFA5CB7": { + "Type": "AWS::Redshift::ClusterSubnetGroup", + "Properties": { + "Description": "Subnets for Cluster Redshift cluster", + "SubnetIds": [ + { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ClusterSecurityGroup0921994B": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Redshift security group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ClusterSecret6368BD0F": { + "Type": "AWS::SecretsManager::Secret", + "Properties": { + "GenerateSecretString": { + "ExcludeCharacters": "\"@/\\ '", + "GenerateStringKey": "password", + "PasswordLength": 30, + "SecretStringTemplate": "{\"username\":\"admin\"}" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ClusterSecretAttachment769E6258": { + "Type": "AWS::SecretsManager::SecretTargetAttachment", + "Properties": { + "SecretId": { + "Ref": "ClusterSecret6368BD0F" }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] + "TargetId": { + "Ref": "ClusterEB0386A7" }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" + "TargetType": "AWS::Redshift::Cluster" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ClusterEB0386A7": { + "Type": "AWS::Redshift::Cluster", + "Properties": { + "ClusterType": "multi-node", + "DBName": "my_db", + "MasterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "ClusterSecret6368BD0F" + }, + ":SecretString:username::}}" ] - }, - ":*" ] - ] + }, + "MasterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "ClusterSecret6368BD0F" + }, + ":SecretString:password::}}" + ] + ] + }, + "NodeType": "dc2.large", + "AllowVersionUpgrade": true, + "AutomatedSnapshotRetentionPeriod": 1, + "ClusterParameterGroupName": { + "Ref": "ClusterParameterGroup879806FD" + }, + "ClusterSubnetGroupName": { + "Ref": "ClusterSubnetsDCFA5CB7" + }, + "Encrypted": true, + "KmsKeyId": { + "Ref": "customkmskey377C6F9A" + }, + "NumberOfNodes": 2, + "PubliclyAccessible": true, + "VpcSecurityGroupIds": [ + { + "Fn::GetAtt": ["ClusterSecurityGroup0921994B", "GroupId"] + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ClusterParameterGroup879806FD": { + "Type": "AWS::Redshift::ClusterParameterGroup", + "Properties": { + "Description": "Cluster parameter group for family redshift-1.0", + "ParameterGroupFamily": "redshift-1.0", + "Parameters": [ + { + "ParameterName": "enable_user_activity_logging", + "ParameterValue": "true" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserSecretE2C04A69": { + "Type": "AWS::SecretsManager::Secret", + "Properties": { + "GenerateSecretString": { + "ExcludeCharacters": "\"@/\\ '", + "GenerateStringKey": "password", + "PasswordLength": 30, + "SecretStringTemplate": "{\"username\":\"awscdkredshiftclusterdatabaseuserc17d5ebd\"}" } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "Roles": [ - { - "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserSecretAttachment02022609": { + "Type": "AWS::SecretsManager::SecretTargetAttachment", + "Properties": { + "SecretId": { + "Ref": "UserSecretE2C04A69" + }, + "TargetId": { + "Ref": "ClusterEB0386A7" + }, + "TargetType": "AWS::Redshift::Cluster" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserProviderframeworkonEventServiceRole8FBA2FBD": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", + "Roles": [ + { + "Ref": "UserProviderframeworkonEventServiceRole8FBA2FBD" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserProviderframeworkonEvent4EC32885": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585.zip" + }, + "Role": { + "Fn::GetAtt": [ + "UserProviderframeworkonEventServiceRole8FBA2FBD", + "Arn" + ] + }, + "Description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/User/Resource/Provider)", + "Environment": { + "Variables": { + "USER_ON_EVENT_FUNCTION_ARN": { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + } + } + }, + "Handler": "framework.onEvent", + "Runtime": "nodejs14.x", + "Timeout": 900 + }, + "DependsOn": [ + "UserProviderframeworkonEventServiceRoleDefaultPolicy9A9E044F", + "UserProviderframeworkonEventServiceRole8FBA2FBD" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserFDDCDD17": { + "Type": "Custom::RedshiftDatabaseQuery", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": ["UserProviderframeworkonEvent4EC32885", "Arn"] + }, + "handler": "user", + "clusterName": { + "Ref": "ClusterEB0386A7" + }, + "adminUserArn": { + "Ref": "ClusterSecretAttachment769E6258" + }, + "databaseName": "my_db", + "username": "awscdkredshiftclusterdatabaseuserc17d5ebd", + "passwordSecretArn": { + "Ref": "UserSecretAttachment02022609" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", + "Roles": [ + { + "Ref": "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserTablePrivilegesProviderframeworkonEvent3F5C1851": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585.zip" + }, + "Role": { + "Fn::GetAtt": [ + "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A", + "Arn" + ] + }, + "Description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/User/TablePrivileges/Resource/Provider)", + "Environment": { + "Variables": { + "USER_ON_EVENT_FUNCTION_ARN": { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + } + } + }, + "Handler": "framework.onEvent", + "Runtime": "nodejs14.x", + "Timeout": 900 + }, + "DependsOn": [ + "UserTablePrivilegesProviderframeworkonEventServiceRoleDefaultPolicy3B6EF50C", + "UserTablePrivilegesProviderframeworkonEventServiceRole56BAEC9A" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "UserTablePrivileges3829D614": { + "Type": "Custom::RedshiftDatabaseQuery", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "UserTablePrivilegesProviderframeworkonEvent3F5C1851", + "Arn" + ] + }, + "handler": "user-table-privileges", + "clusterName": { + "Ref": "ClusterEB0386A7" + }, + "adminUserArn": { + "Ref": "ClusterSecretAttachment769E6258" + }, + "databaseName": "my_db", + "username": { + "Fn::GetAtt": ["UserFDDCDD17", "username"] + }, + "tablePrivileges": [ + { + "tableName": { + "Ref": "Table7ABB320E" + }, + "actions": ["INSERT", "DELETE", "SELECT"] + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "redshift-data:DescribeStatement", + "redshift-data:ExecuteStatement" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "secretsmanager:DescribeSecret", + "secretsmanager:GetSecretValue" + ], + "Effect": "Allow", + "Resource": [ + { + "Ref": "ClusterSecretAttachment769E6258" + }, + { + "Ref": "UserSecretAttachment02022609" + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D", + "Roles": [ + { + "Ref": "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "169a8c0beb97c903ee155ea9653e39b0884c9e3b860ac72ffbe906b3c1f4e338.zip" + }, + "Role": { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717", + "Arn" + ] + }, + "Handler": "index.handler", + "Runtime": "nodejs14.x", + "Timeout": 60 + }, + "DependsOn": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRoleDefaultPolicyDDD1388D", + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5fServiceRole0A90D717" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "TableProviderframeworkonEventServiceRoleC3128F67": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "Roles": [ + { + "Ref": "TableProviderframeworkonEventServiceRoleC3128F67" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "TableProviderframeworkonEvent97F3951A": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585.zip" + }, + "Role": { + "Fn::GetAtt": [ + "TableProviderframeworkonEventServiceRoleC3128F67", + "Arn" + ] + }, + "Description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/Table/Resource/Provider)", + "Environment": { + "Variables": { + "USER_ON_EVENT_FUNCTION_ARN": { + "Fn::GetAtt": [ + "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", + "Arn" + ] + } + } + }, + "Handler": "framework.onEvent", + "Runtime": "nodejs14.x", + "Timeout": 900 + }, + "DependsOn": [ + "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", + "TableProviderframeworkonEventServiceRoleC3128F67" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "Table7ABB320E": { + "Type": "Custom::RedshiftDatabaseQuery", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": ["TableProviderframeworkonEvent97F3951A", "Arn"] + }, + "handler": "table", + "clusterName": { + "Ref": "ClusterEB0386A7" + }, + "adminUserArn": { + "Ref": "ClusterSecretAttachment769E6258" + }, + "databaseName": "my_db", + "tableName": { + "prefix": "awscdkredshiftclusterdatabaseTable24923533", + "generateSuffix": "true" + }, + "tableColumns": [ + { + "name": "col1", + "dataType": "varchar(4)", + "distKey": true, + "comment": "A test column", + "encoding": "LZO" + }, + { + "name": "col2", + "dataType": "float", + "sortKey": true, + "comment": "A test column" + }, + { + "name": "col3", + "dataType": "float", + "comment": "A test column", + "encoding": "RAW" + } + ], + "distStyle": "KEY", + "sortStyle": "INTERLEAVED", + "tableComment": "A test table", + "useColumnIds": true + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } }, - "TableProviderframeworkonEvent97F3951A": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585.zip" - }, - "Role": { - "Fn::GetAtt": [ - "TableProviderframeworkonEventServiceRoleC3128F67", - "Arn" - ] - }, - "Description": "AWS CDK resource provider framework - onEvent (aws-cdk-redshift-cluster-database/Table/Resource/Provider)", - "Environment": { - "Variables": { - "USER_ON_EVENT_FUNCTION_ARN": { - "Fn::GetAtt": [ - "QueryRedshiftDatabase3de5bea727da479686625efb56431b5f3DF81997", - "Arn" - ] - } - } - }, - "Handler": "framework.onEvent", - "Runtime": "nodejs14.x", - "Timeout": 900 - }, - "DependsOn": [ - "TableProviderframeworkonEventServiceRoleDefaultPolicyAD08715D", - "TableProviderframeworkonEventServiceRoleC3128F67" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } }, - "Table7ABB320E": { - "Type": "Custom::RedshiftDatabaseQuery", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "TableProviderframeworkonEvent97F3951A", - "Arn" - ] - }, - "handler": "table", - "clusterName": { - "Ref": "ClusterEB0386A7" - }, - "adminUserArn": { - "Ref": "ClusterSecretAttachment769E6258" - }, - "databaseName": "my_db", - "tableName": { - "prefix": "awscdkredshiftclusterdatabaseTable24923533", - "generateSuffix": "true" - }, - "tableColumns": [ - { - "name": "col1", - "dataType": "varchar(4)", - "distKey": true - }, - { - "name": "col2", - "dataType": "float", - "sortKey": true - }, - { - "name": "col3", - "dataType": "float", - "sortKey": true - } - ], - "distStyle": "KEY", - "sortStyle": "INTERLEAVED", - "tableComment": "A test table", - "useColumnIds": true - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + ["1", "2", "3", "4", "5"], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." } - ] } - } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/cdk.out b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/cdk.out index b72fef144f05c..22aff0ee1a3eb 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"30.1.0"} \ No newline at end of file +{"version":"30.1.0"} diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/integ.json b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/integ.json index 43c7d308e429c..f38ac471f573e 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/integ.json @@ -2,11 +2,9 @@ "version": "30.1.0", "testCases": { "redshift-cluster-database-integ/DefaultTest": { - "stacks": [ - "aws-cdk-redshift-cluster-database" - ], + "stacks": ["aws-cdk-redshift-cluster-database"], "assertionStack": "redshift-cluster-database-integ/DefaultTest/DeployAssert", "assertionStackName": "redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/manifest.json index 839bb7d0a2ea1..371f1970d61c0 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/manifest.json @@ -20,18 +20,14 @@ "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/297bfa1758edc6b71a084153702165132d111eb7914b4bf8ed951da4b98faede.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "aws-cdk-redshift-cluster-database.assets" - ], + "additionalDependencies": ["aws-cdk-redshift-cluster-database.assets"], "lookupRole": { "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", "requiresBootstrapStackVersion": 8, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" } }, - "dependencies": [ - "aws-cdk-redshift-cluster-database.assets" - ], + "dependencies": ["aws-cdk-redshift-cluster-database.assets"], "metadata": { "/aws-cdk-redshift-cluster-database/custom-kms-key/Resource": [ { @@ -384,4 +380,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json index a21d912bf150e..76d14311f460d 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/redshiftclusterdatabaseintegDefaultTestDeployAssert4339FB48.assets.json @@ -16,4 +16,4 @@ } }, "dockerImages": {} -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/tree.json b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/tree.json index 0b2213b1b8f64..1a18995b967cc 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.js.snapshot/tree.json @@ -2001,4 +2001,4 @@ "version": "0.0.0" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.ts b/packages/@aws-cdk/aws-redshift/test/integ.database.ts index be9ce4b65a60f..1474e8811d459 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.ts @@ -48,9 +48,9 @@ const user = new redshift.User(stack, 'User', databaseOptions); const table = new redshift.Table(stack, 'Table', { ...databaseOptions, tableColumns: [ - { name: 'col1', dataType: 'varchar(4)', distKey: true }, - { name: 'col2', dataType: 'float', sortKey: true }, - { name: 'col3', dataType: 'float', sortKey: true }, + { name: 'col1', dataType: 'varchar(4)', distKey: true, comment: 'A test column', encoding: redshift.ColumnEncoding.LZO }, + { name: 'col2', dataType: 'float', sortKey: true, comment: 'A test column' }, + { name: 'col3', dataType: 'float', comment: 'A test column', encoding: redshift.ColumnEncoding.RAW }, ], distStyle: redshift.TableDistStyle.KEY, sortStyle: redshift.TableSortStyle.INTERLEAVED,