cdk-rds-sql 7.0.2 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -10,8 +10,8 @@
10
10
  "@types/aws-lambda": "^8.10.152"
11
11
  },
12
12
  "dependencies": {
13
- "aws-cdk-lib": "^2.189.1",
14
- "constructs": "^10.3.0"
13
+ "aws-cdk-lib": "^2.214.0",
14
+ "constructs": "^10.4.2"
15
15
  },
16
16
  "dependencyClosure": {
17
17
  "@aws-cdk/asset-awscli-v1": {
@@ -163,6 +163,19 @@
163
163
  }
164
164
  }
165
165
  },
166
+ "aws-cdk-lib.aws_aiops": {
167
+ "targets": {
168
+ "dotnet": {
169
+ "package": "Amazon.CDK.AWS.AIOps"
170
+ },
171
+ "java": {
172
+ "package": "software.amazon.awscdk.services.aiops"
173
+ },
174
+ "python": {
175
+ "module": "aws_cdk.aws_aiops"
176
+ }
177
+ }
178
+ },
166
179
  "aws-cdk-lib.aws_amazonmq": {
167
180
  "targets": {
168
181
  "dotnet": {
@@ -410,6 +423,19 @@
410
423
  }
411
424
  }
412
425
  },
426
+ "aws-cdk-lib.aws_arcregionswitch": {
427
+ "targets": {
428
+ "dotnet": {
429
+ "package": "Amazon.CDK.AWS.ARCRegionSwitch"
430
+ },
431
+ "java": {
432
+ "package": "software.amazon.awscdk.services.arcregionswitch"
433
+ },
434
+ "python": {
435
+ "module": "aws_cdk.aws_arcregionswitch"
436
+ }
437
+ }
438
+ },
413
439
  "aws-cdk-lib.aws_arczonalshift": {
414
440
  "targets": {
415
441
  "dotnet": {
@@ -1555,6 +1581,19 @@
1555
1581
  }
1556
1582
  }
1557
1583
  },
1584
+ "aws-cdk-lib.aws_evs": {
1585
+ "targets": {
1586
+ "dotnet": {
1587
+ "package": "Amazon.CDK.AWS.EVS"
1588
+ },
1589
+ "java": {
1590
+ "package": "software.amazon.awscdk.services.evs"
1591
+ },
1592
+ "python": {
1593
+ "module": "aws_cdk.aws_evs"
1594
+ }
1595
+ }
1596
+ },
1558
1597
  "aws-cdk-lib.aws_finspace": {
1559
1598
  "targets": {
1560
1599
  "dotnet": {
@@ -2491,6 +2530,19 @@
2491
2530
  }
2492
2531
  }
2493
2532
  },
2533
+ "aws-cdk-lib.aws_mpa": {
2534
+ "targets": {
2535
+ "dotnet": {
2536
+ "package": "Amazon.CDK.AWS.MPA"
2537
+ },
2538
+ "java": {
2539
+ "package": "software.amazon.awscdk.services.mpa"
2540
+ },
2541
+ "python": {
2542
+ "module": "aws_cdk.aws_mpa"
2543
+ }
2544
+ }
2545
+ },
2494
2546
  "aws-cdk-lib.aws_msk": {
2495
2547
  "targets": {
2496
2548
  "dotnet": {
@@ -2621,6 +2673,32 @@
2621
2673
  }
2622
2674
  }
2623
2675
  },
2676
+ "aws-cdk-lib.aws_observabilityadmin": {
2677
+ "targets": {
2678
+ "dotnet": {
2679
+ "package": "Amazon.CDK.AWS.ObservabilityAdmin"
2680
+ },
2681
+ "java": {
2682
+ "package": "software.amazon.awscdk.services.observabilityadmin"
2683
+ },
2684
+ "python": {
2685
+ "module": "aws_cdk.aws_observabilityadmin"
2686
+ }
2687
+ }
2688
+ },
2689
+ "aws-cdk-lib.aws_odb": {
2690
+ "targets": {
2691
+ "dotnet": {
2692
+ "package": "Amazon.CDK.AWS.ODB"
2693
+ },
2694
+ "java": {
2695
+ "package": "software.amazon.awscdk.services.odb"
2696
+ },
2697
+ "python": {
2698
+ "module": "aws_cdk.aws_odb"
2699
+ }
2700
+ }
2701
+ },
2624
2702
  "aws-cdk-lib.aws_omics": {
2625
2703
  "targets": {
2626
2704
  "dotnet": {
@@ -3518,6 +3596,19 @@
3518
3596
  }
3519
3597
  }
3520
3598
  },
3599
+ "aws-cdk-lib.aws_ssmguiconnect": {
3600
+ "targets": {
3601
+ "dotnet": {
3602
+ "package": "Amazon.CDK.AWS.SSMGuiConnect"
3603
+ },
3604
+ "java": {
3605
+ "package": "software.amazon.awscdk.services.ssmguiconnect"
3606
+ },
3607
+ "python": {
3608
+ "module": "aws_cdk.aws_ssmguiconnect"
3609
+ }
3610
+ }
3611
+ },
3521
3612
  "aws-cdk-lib.aws_ssmincidents": {
3522
3613
  "targets": {
3523
3614
  "dotnet": {
@@ -3752,6 +3843,19 @@
3752
3843
  }
3753
3844
  }
3754
3845
  },
3846
+ "aws-cdk-lib.aws_workspacesinstances": {
3847
+ "targets": {
3848
+ "dotnet": {
3849
+ "package": "Amazon.CDK.AWS.WorkspacesInstances"
3850
+ },
3851
+ "java": {
3852
+ "package": "software.amazon.awscdk.services.workspacesinstances"
3853
+ },
3854
+ "python": {
3855
+ "module": "aws_cdk.aws_workspacesinstances"
3856
+ }
3857
+ }
3858
+ },
3755
3859
  "aws-cdk-lib.aws_workspacesthinclient": {
3756
3860
  "targets": {
3757
3861
  "dotnet": {
@@ -3949,7 +4053,7 @@
3949
4053
  }
3950
4054
  }
3951
4055
  },
3952
- "description": "A CDK construct that allows creating roles or users and databases an on Aurora Serverless Postgresql or Mysql/MariaDB cluster.",
4056
+ "description": "A CDK construct that allows creating roles or users and databases on Aurora Serverless PostgreSQL or MySQL/MariaDB clusters, as well as AWS DSQL clusters.",
3953
4057
  "docs": {
3954
4058
  "stability": "stable"
3955
4059
  },
@@ -3960,6 +4064,7 @@
3960
4064
  "aws",
3961
4065
  "aws-cdk",
3962
4066
  "cdk",
4067
+ "dsql",
3963
4068
  "mysql",
3964
4069
  "postgres",
3965
4070
  "rds"
@@ -3975,7 +4080,7 @@
3975
4080
  },
3976
4081
  "name": "cdk-rds-sql",
3977
4082
  "readme": {
3978
- "markdown": "# About\n\nThis CDK construct library makes it possible to create databases,\nschemas, and roles in an Aurora Serverless v2, RDS Database Cluster or\nDatabase Instance. Both PostgreSQL and MySQL databases are supported.\n\nThis construct library is intended to be used in enterprise\nenvironments, and works in isolated subnets.\n\n<p align=\"left\">\n <a href=\"https://github.com/semantic-release/semantic-release\"><img src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release\" alt=semantic-release: angular\"></a>\n <a href=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml\"><img src=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml/badge.svg\" alt=\"Release badge\"></a>\n</p>\n\n# Requirements\n\n- CDK v2.\n\n# Installation\n\n npm i cdk-rds-sql\n\n# Usage\n\n## Provider\n\nFirst setup your VPC and create your cluster:\n\n```ts\nimport { Duration, RemovalPolicy } from \"aws-cdk-lib\"\nimport * as ec2 from \"aws-cdk-lib/aws-ec2\"\nimport * as rds from \"aws-cdk-lib/aws-rds\"\n\nconst vpc = ec2.Vpc.fromLookup(this, \"Vpc\", {\n vpcId: this.node.tryGetContext(\"vpc-id\"),\n})\n\nconst cluster = new rds.ServerlessCluster(this, \"Cluster\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_ISOLATED,\n },\n engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,\n parameterGroup: rds.ParameterGroup.fromParameterGroupName(\n this,\n \"ParameterGroup\",\n \"default.aurora-postgresql11\"\n ),\n removalPolicy: RemovalPolicy.DESTROY,\n scaling: {\n autoPause: Duration.minutes(60),\n minCapacity: rds.AuroraCapacityUnit.ACU_2,\n maxCapacity: rds.AuroraCapacityUnit.ACU_2,\n },\n})\n```\n\nThen create a provider which will connect to your database. For a cluster:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\nFor an instance:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n})\n```\n\nThe provider will setup a lambda, which normally lives in the same VPC\nas the database. You can give a different VPC, as long as that VPC has\naccess to the VPC of the database. Only the provider lambda will talk\nto your database.\n\nThe provider will by default use the private isolated subnet of the\nVPC. Your isolated network must have a VPC endpoint to AWS Secrets Manager\nand possibly KMS as well. If you want to use a subnet with egress\naccess in case you have no such VPC endpoints, specify the subnet as\nfollows:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,\n },\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\n### Disabling SSL\n\nThe default connection to RDS is ssl enabled. You can disable ssl by\nsetting the `ssl` option to `false`:\n\n```ts\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n ssl: false, // default is true\n})\n```\n\n## Roles\n\nCreate a postgres role (or mysql user) for a cluster as follows:\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n})\n```\n\nThis will automatically create a secret just like `ServerlessCluster`\ndoes, with all the connection info needed for this user. It's secret\nvalue is a JSON like:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"password\": \"very-long-and-boring\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myrole\"\n}\n```\n\nYou can access the secret via `role.secret`.\n\nInstead of `databaseName` you can also specify `database` to reference\nan existing database. The role will not be created until the database\nhas been created.\n\nIf you want to make the role the owner of a new database, just specify\nthe `databaseName` here, and create the database later.\n\n### IAM Authentication\n\nInstead of password-based authentication, you can create roles that\nuse AWS IAM database authentication. This eliminates the need to store\ndatabase passwords and provides enhanced security through AWS IAM\npolicies.\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst iamRole = new Role(this, \"IamRole\", {\n provider: provider,\n roleName: \"myiamrole\",\n databaseName: \"mydb\",\n enableIamAuth: true,\n})\n```\n\nFor IAM-authenticated roles, the secret will not contain a password field:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myiamrole\"\n}\n```\n\n**Requirements for IAM Authentication:**\n\n- SSL connections are required (enabled by default in this library)\n- Your application must have IAM permissions to connect to the database\n- The database user/role name must match the IAM identity\n\n**IAM Policy Example:**\n\nYour application will need an IAM policy like this to connect:\n\n```json\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\"rds-db:connect\"],\n \"Resource\": [\n \"arn:aws:rds-db:region:account-id:dbuser:cluster-resource-id/myiamrole\"\n ]\n }\n ]\n}\n```\n\nBoth PostgreSQL and MySQL databases support IAM authentication. For more details, see the [AWS RDS IAM Database Authentication documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html).\n\n### MySQL support\n\nIn MySQL users are created with '%' as value for the host. It is hard\nto do this better:\n\n- Determine the CIDR blocks used by a VPC is not trivial.\n- For imported VPCs you cannot specify the IPv6 CIDR.\n- CIDRs might change without the system knowing, meaning applications\n could lose access to the database at random times, such as when a\n container is restarted.\n\n## Database\n\nCreate a database as follows:\n\n```ts\nimport { Database } from \"cdk-rds-sql\"\n\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n```\n\nYou can provide an owner, which makes it easy to create database owned\nby a new user:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n owner: role,\n})\n```\n\n## Schema\n\nCreate a schema in the default database as follows:\n\n```ts\nimport { Schema } from \"cdk-rds-sql\"\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n})\n```\n\nOr in another database:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n})\n```\n\nOne may need a role permitted for using schema:\n\n```ts\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n role: role,\n})\n```\n\n## Sql\n\nYou can insert arbitrary SQL into your database with the `Sql` construct:\n\n```ts\nimport { Sql } from \"cdk-rds-sql\"\n\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: \"create table t (i int)\",\n})\n```\n\nCreate a table if it does not exist, and grant a role privileges:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n})\n```\n\nRollback sql on stack deletion:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n rollback: `\nDO $$BEGIN\n IF EXISTS (select from pg_database WHERE datname = 't') THEN\n IF EXISTS (select from pg_catalog.pg_roles WHERE rolname = 'myrole') THEN\n revoke select t from myrole;\n END IF;\n drop table t;\n END IF;\nEND$$;\n`,\n})\n```\n\nNote that there is no synchronisation between various `Sql`\nconstructs, in particular the order in your code does not determine\nthe order in which your SQL is executed. This happens in parallel,\nunless you specify an explicit dependency via `sql.node.addDepency()`.\n\nThere are a lot of concerns when using `Sql`:\n\n- When you update your Sql, your previous Sql is not \"rolled back\",\n the new Sql is simply executed again.\n- When you delete your `Sql` construct the rollback is executed if specified\n- When permission are granted via `Sql` they must be removed via\n rollback to succesfully remove the role\n- Currently the `Sql` constructs has less than 5 minutes to execute\n its work.\n- It is unknown how large your SQL can be.\n\n# Parameters\n\nSome lambda constructs, in particular [Bref](https://bref.sh/), do not\nsupport secrets out of the box. Use the `parameterPrefix` property to\ncreate SSM parameters in addition to a secret:\n\n```ts\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n parameterPrefix: \"/my-app/\",\n})\n```\n\nThis will create `/my-app/username`, `/my-app/password` and such.\n\nTo access parameters you will need IAM permissions such as:\n\n```ts\ninitialPolicy: [\n new iam.PolicyStatement({\n\tactions: [\"ssm:GetParameter\", \"ssm:GetParameters\"],\n\tresources: [\n\t // Grant access to all parameters under the base path\n\t `arn:aws:ssm:${this.region}:${this.account}:parameter/my-app/*`,\n\t],\n\teffect: iam.Effect.ALLOW,\n })\n],\n```\n\nNote that your VPC will need an SSM Parameters interface endpoint to support this.\n\n# IPv6\n\nIf you use the provider in an IPv6 subnet you probably need these settings:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n ...\n functionProps: {\n\tipv6AllowedForDualStack: true,\n\tallowAllIpv6Outbound: true,\n },\n}\n```\n\n# Working on this code\n\nThis code is managed by\n[projen](https://github.com/projen/projen/blob/main/README.md). In\naddition [pre-commit](https://pre-commit.com/) is used.\n\nSo after git clone and `npm ci` you would do:\n\n```\npre-commit install --install-hooks --hook-type commit-msg --hook-type pre-commit\n```\n\nto install the pre-commit hooks.\n\n## Testing\n\nTest code via projen with:\n\n npx projen test\n\nYou can run the sample stack with:\n\n npx projen integ:deploy:serverless\n\nIf you want to use an existing vpc:\n\n npx cdk deploy --context vpc-id=vpc-0123456789 TestServerlessV2Stack\n\n# To do\n\n- Update role: will not revoke connect to previous database if database name has changed.\n"
4083
+ "markdown": "# About\n\nThis CDK construct library makes it possible to create databases,\nschemas, and roles in an Aurora Serverless v2, RDS Database Cluster,\nDatabase Instance, or AWS DSQL clusters. PostgreSQL, MySQL, and DSQL\ndatabases are supported.\n\nThis construct library is intended to be used in enterprise\nenvironments, and works in isolated subnets.\n\n<p align=\"left\">\n <a href=\"https://github.com/semantic-release/semantic-release\"><img src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release\" alt=semantic-release: angular\"></a>\n <a href=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml\"><img src=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml/badge.svg\" alt=\"Release badge\"></a>\n</p>\n\n# Requirements\n\n- CDK v2.\n\n# Installation\n\n npm i cdk-rds-sql\n\n# Usage\n\n## Provider\n\nFirst setup your VPC and create your cluster:\n\n```ts\nimport { Duration, RemovalPolicy } from \"aws-cdk-lib\"\nimport * as ec2 from \"aws-cdk-lib/aws-ec2\"\nimport * as rds from \"aws-cdk-lib/aws-rds\"\n\nconst vpc = ec2.Vpc.fromLookup(this, \"Vpc\", {\n vpcId: this.node.tryGetContext(\"vpc-id\"),\n})\n\nconst cluster = new rds.ServerlessCluster(this, \"Cluster\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_ISOLATED,\n },\n engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,\n parameterGroup: rds.ParameterGroup.fromParameterGroupName(\n this,\n \"ParameterGroup\",\n \"default.aurora-postgresql11\"\n ),\n removalPolicy: RemovalPolicy.DESTROY,\n scaling: {\n autoPause: Duration.minutes(60),\n minCapacity: rds.AuroraCapacityUnit.ACU_2,\n maxCapacity: rds.AuroraCapacityUnit.ACU_2,\n },\n})\n```\n\nThen create a provider which will connect to your database. For a cluster:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\nFor an instance:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n})\n```\n\nThe provider will setup a lambda, which normally lives in the same VPC\nas the database. You can give a different VPC, as long as that VPC has\naccess to the VPC of the database. Only the provider lambda will talk\nto your database.\n\nThe provider will by default use the private isolated subnet of the\nVPC. Your isolated network must have a VPC endpoint to AWS Secrets Manager\nand possibly KMS as well. If you want to use a subnet with egress\naccess in case you have no such VPC endpoints, specify the subnet as\nfollows:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,\n },\n cluster: cluster,\n secret: cluster.secret!,\n})\n```\n\n## Roles\n\nCreate a postgres role (or mysql user) for a cluster as follows:\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n})\n```\n\nThis will automatically create a secret just like `ServerlessCluster`\ndoes, with all the connection info needed for this user. It's secret\nvalue is a JSON like:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"password\": \"very-long-and-boring\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myrole\"\n}\n```\n\nYou can access the secret via `role.secret`.\n\nInstead of `databaseName` you can also specify `database` to reference\nan existing database. The role will not be created until the database\nhas been created.\n\nIf you want to make the role the owner of a new database, just specify\nthe `databaseName` here, and create the database later.\n\n### IAM Authentication\n\nInstead of password-based authentication, you can create roles that\nuse AWS IAM database authentication. This eliminates the need to store\ndatabase passwords and provides enhanced security through AWS IAM\npolicies.\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst iamRole = new Role(this, \"IamRole\", {\n provider: provider,\n roleName: \"myiamrole\",\n databaseName: \"mydb\",\n enableIamAuth: true,\n})\n```\n\nFor IAM-authenticated roles, the secret will not contain a password field:\n\n```json\n{\n \"dbClusterIdentifier\": \"teststack-clustereb1186t9-sh4wpqfdyfvu\",\n \"dbname\": \"mydb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"host\": \"teststack-clustereb1186t9-sh4wpqfdyfvu.cluster-cgudolabssna.us-east-1.rds.amazonaws.com\",\n \"username\": \"myiamrole\"\n}\n```\n\n**Requirements for IAM Authentication:**\n\n- SSL connections are required (enabled by default in this library)\n- Your application must have IAM permissions to connect to the database\n- The database user/role name must match the IAM identity\n\n**IAM Policy Example:**\n\nYour application will need an IAM policy like this to connect:\n\n```json\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\"rds-db:connect\"],\n \"Resource\": [\n \"arn:aws:rds-db:region:account-id:dbuser:cluster-resource-id/myiamrole\"\n ]\n }\n ]\n}\n```\n\nBoth PostgreSQL and MySQL databases support IAM authentication. For more details, see the [AWS RDS IAM Database Authentication documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html).\n\n### MySQL support\n\nIn MySQL users are created with '%' as value for the host. It is hard\nto do this better:\n\n- Determine the CIDR blocks used by a VPC is not trivial.\n- For imported VPCs you cannot specify the IPv6 CIDR.\n- CIDRs might change without the system knowing, meaning applications\n could lose access to the database at random times, such as when a\n container is restarted.\n\n## Database\n\nCreate a database as follows:\n\n```ts\nimport { Database } from \"cdk-rds-sql\"\n\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n```\n\nYou can provide an owner, which makes it easy to create database owned\nby a new user:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n owner: role,\n})\n```\n\n## Schema\n\nCreate a schema in the default database as follows:\n\n```ts\nimport { Schema } from \"cdk-rds-sql\"\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n})\n```\n\nOr in another database:\n\n```ts\nconst database = new Database(this, \"Database\", {\n provider: provider,\n databaseName: \"mydb\",\n})\n\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n})\n```\n\nOne may need a role permitted for using schema:\n\n```ts\nnew Schema(this, \"Schema\", {\n provider: provider,\n schemaName: \"myschema\",\n databaseName: database.databaseName,\n role: role,\n})\n```\n\n## Sql\n\nYou can insert arbitrary SQL into your database with the `Sql` construct:\n\n```ts\nimport { Sql } from \"cdk-rds-sql\"\n\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: \"create table t (i int)\",\n})\n```\n\nCreate a table if it does not exist, and grant a role privileges:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n})\n```\n\nRollback sql on stack deletion:\n\n```ts\nconst sql = new Sql(this, \"Sql\", {\n provider: provider,\n database: database,\n statement: `\ncreate table if not exists t (i int);\ngrant select on t to myrole;\n`,\n rollback: `\nDO $$BEGIN\n IF EXISTS (select from pg_database WHERE datname = 't') THEN\n IF EXISTS (select from pg_catalog.pg_roles WHERE rolname = 'myrole') THEN\n revoke select t from myrole;\n END IF;\n drop table t;\n END IF;\nEND$$;\n`,\n})\n```\n\nNote that there is no synchronisation between various `Sql`\nconstructs, in particular the order in your code does not determine\nthe order in which your SQL is executed. This happens in parallel,\nunless you specify an explicit dependency via `sql.node.addDepency()`.\n\nThere are a lot of concerns when using `Sql`:\n\n- When you update your Sql, your previous Sql is not \"rolled back\",\n the new Sql is simply executed again.\n- When you delete your `Sql` construct the rollback is executed if specified\n- When permission are granted via `Sql` they must be removed via\n rollback to succesfully remove the role\n- Currently the `Sql` constructs has less than 5 minutes to execute\n its work.\n- It is unknown how large your SQL can be.\n\n# Parameters\n\nSome lambda constructs, in particular [Bref](https://bref.sh/), do not\nsupport secrets out of the box. Use the `parameterPrefix` property to\ncreate SSM parameters in addition to a secret:\n\n```ts\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n databaseName: \"mydb\",\n parameterPrefix: \"/my-app/\",\n})\n```\n\nThis will create `/my-app/username`, `/my-app/password` and such.\n\nTo access parameters you will need IAM permissions such as:\n\n```ts\ninitialPolicy: [\n new iam.PolicyStatement({\n\tactions: [\"ssm:GetParameter\", \"ssm:GetParameters\"],\n\tresources: [\n\t // Grant access to all parameters under the base path\n\t `arn:aws:ssm:${this.region}:${this.account}:parameter/my-app/*`,\n\t],\n\teffect: iam.Effect.ALLOW,\n })\n],\n```\n\nNote that your VPC will need an SSM Parameters interface endpoint to support this.\n\n# AWS DSQL Support\n\nThis construct also supports AWS DSQL. DSQL is a great number of\nlimitations around it's postgresql support, so there is some learing\ncurve. This library supports creating roles, schemas, and executing\nSQL on DSQL clusters. Creating databases is not supported by DSQL.\n\n## DSQL Provider Setup\n\nDSQL clusters don't require a VPC or secrets since they use IAM authentication:\n\n```ts\nimport * as dsql from \"aws-cdk-lib/aws-dsql\"\nimport { Provider } from \"cdk-rds-sql\"\n\nconst dsqlCluster = new dsql.CfnCluster(this, \"DsqlCluster\", {\n deletionProtectionEnabled: false,\n})\n\nconst provider = new Provider(this, \"Provider\", {\n cluster: dsqlCluster,\n // No VPC or secret needed for DSQL\n})\n```\n\nYou can access DSQL from within a VPC, but cdk-rds-sql has not been\nspecifically tested with that scenario.\n\n## DSQL Roles\n\nDSQL always uses IAM authentication, so the `enableIamAuth` property is ignored:\n\n```ts\nimport { Role } from \"cdk-rds-sql\"\n\nconst role = new Role(this, \"Role\", {\n provider: provider,\n roleName: \"myrole\",\n})\n```\n\n## Using DSQL\n\nConnecting to DSQL requires a couple of things:\n\n1. Your IAM role needs the `dsql:DbConnect` IAM permission to connect to the cluster.\n2. You probably want a normal postgres role (not \"admin\") to use from your apps.\n3. Your IAM role needs to be connected to your postgres role: use the `IamGrant` construct for that:\n\n ```ts\n new IamGrant(this, \"LambdaIamGrant\", {\n provider: provider,\n roleName: role.roleName,\n resourceArn: queryLambda.role!.roleArn,\n })\n ```\n\n4. From your code use the Dsql signer to create the password:\n\n ```ts\n import { DsqlSigner } from \"@aws-sdk/dsql-signer\"\n import { Client } from \"pg\"\n\n const region =\n process.env[\"AWS_REGION\"] || process.env[\"AWS_DEFAULT_REGION\"] || \"us-west-2\"\n\n // Generate DSQL auth token using AWS SDK\n const signer = new DsqlSigner({\n hostname: host,\n region,\n })\n\n const authToken = await signer.getDbConnectAuthToken()\n\n const client = new Client({\n host,\n port: 5432,\n user: dbUser,\n database: dbName,\n password: authToken,\n ssl: { rejectUnauthorized: false },\n })\n\n await client.connect()\n ```\n\n# IPv6\n\nIf you use the provider in an IPv6 subnet you probably need these settings:\n\n```ts\nimport { Provider } from \"cdk-rds-sql\"\n\nconst provider = new Provider(this, \"Provider\", {\n ...\n functionProps: {\n\tipv6AllowedForDualStack: true,\n\tallowAllIpv6Outbound: true,\n },\n}\n```\n\n# Disabling SSL\n\nThe default connection to RDS is ssl enabled. You can disable ssl by\nsetting the `ssl` option to `false`:\n\n```ts\nconst provider = new Provider(this, \"Provider\", {\n vpc: vpc,\n instance: instance,\n secret: cluster.secret!,\n ssl: false, // default is true\n})\n```\n\n# Working on this code\n\nThis code is managed by\n[projen](https://github.com/projen/projen/blob/main/README.md). In\naddition [pre-commit](https://pre-commit.com/) is used.\n\nSo after git clone and `npm ci` you would do:\n\n```\npre-commit install --install-hooks --hook-type commit-msg --hook-type pre-commit\n```\n\nto install the pre-commit hooks.\n\n## Testing\n\nTest code via projen with:\n\n npx projen test\n\nYou can run the sample stack with:\n\n npx projen integ:deploy:serverless\n\nIf you want to use an existing vpc:\n\n npx cdk deploy --context vpc-id=vpc-0123456789 TestServerlessV2Stack\n\nYou can also test DSQL support with:\n\n npx projen integ:deploy:dsql\n\n# To do\n\n- Update role: will not revoke connect to previous database if database name has changed.\n"
3979
4084
  },
3980
4085
  "repository": {
3981
4086
  "type": "git",
@@ -4092,6 +4197,41 @@
4092
4197
  ],
4093
4198
  "symbolId": "src/database:Database"
4094
4199
  },
4200
+ "cdk-rds-sql.DatabaseEngine": {
4201
+ "assembly": "cdk-rds-sql",
4202
+ "docs": {
4203
+ "stability": "stable",
4204
+ "summary": "Supported database engines."
4205
+ },
4206
+ "fqn": "cdk-rds-sql.DatabaseEngine",
4207
+ "kind": "enum",
4208
+ "locationInModule": {
4209
+ "filename": "src/provider.ts",
4210
+ "line": 97
4211
+ },
4212
+ "members": [
4213
+ {
4214
+ "docs": {
4215
+ "stability": "stable"
4216
+ },
4217
+ "name": "POSTGRES"
4218
+ },
4219
+ {
4220
+ "docs": {
4221
+ "stability": "stable"
4222
+ },
4223
+ "name": "MYSQL"
4224
+ },
4225
+ {
4226
+ "docs": {
4227
+ "stability": "stable"
4228
+ },
4229
+ "name": "DSQL"
4230
+ }
4231
+ ],
4232
+ "name": "DatabaseEngine",
4233
+ "symbolId": "src/provider:DatabaseEngine"
4234
+ },
4095
4235
  "cdk-rds-sql.DatabaseProps": {
4096
4236
  "assembly": "cdk-rds-sql",
4097
4237
  "datatype": true,
@@ -4135,7 +4275,7 @@
4135
4275
  },
4136
4276
  "name": "provider",
4137
4277
  "type": {
4138
- "fqn": "cdk-rds-sql.Provider"
4278
+ "fqn": "cdk-rds-sql.IProvider"
4139
4279
  }
4140
4280
  },
4141
4281
  {
@@ -4189,6 +4329,220 @@
4189
4329
  ],
4190
4330
  "symbolId": "src/database:IDatabase"
4191
4331
  },
4332
+ "cdk-rds-sql.IProvider": {
4333
+ "assembly": "cdk-rds-sql",
4334
+ "docs": {
4335
+ "stability": "stable"
4336
+ },
4337
+ "fqn": "cdk-rds-sql.IProvider",
4338
+ "kind": "interface",
4339
+ "locationInModule": {
4340
+ "filename": "src/provider.ts",
4341
+ "line": 103
4342
+ },
4343
+ "name": "IProvider",
4344
+ "properties": [
4345
+ {
4346
+ "abstract": true,
4347
+ "docs": {
4348
+ "stability": "stable"
4349
+ },
4350
+ "immutable": true,
4351
+ "locationInModule": {
4352
+ "filename": "src/provider.ts",
4353
+ "line": 107
4354
+ },
4355
+ "name": "engine",
4356
+ "type": {
4357
+ "primitive": "string"
4358
+ }
4359
+ },
4360
+ {
4361
+ "abstract": true,
4362
+ "docs": {
4363
+ "stability": "stable"
4364
+ },
4365
+ "immutable": true,
4366
+ "locationInModule": {
4367
+ "filename": "src/provider.ts",
4368
+ "line": 105
4369
+ },
4370
+ "name": "handler",
4371
+ "type": {
4372
+ "fqn": "aws-cdk-lib.aws_lambda.IFunction"
4373
+ }
4374
+ },
4375
+ {
4376
+ "abstract": true,
4377
+ "docs": {
4378
+ "stability": "stable"
4379
+ },
4380
+ "immutable": true,
4381
+ "locationInModule": {
4382
+ "filename": "src/provider.ts",
4383
+ "line": 104
4384
+ },
4385
+ "name": "serviceToken",
4386
+ "type": {
4387
+ "primitive": "string"
4388
+ }
4389
+ },
4390
+ {
4391
+ "abstract": true,
4392
+ "docs": {
4393
+ "stability": "stable"
4394
+ },
4395
+ "immutable": true,
4396
+ "locationInModule": {
4397
+ "filename": "src/provider.ts",
4398
+ "line": 108
4399
+ },
4400
+ "name": "cluster",
4401
+ "optional": true,
4402
+ "type": {
4403
+ "union": {
4404
+ "types": [
4405
+ {
4406
+ "fqn": "aws-cdk-lib.aws_rds.IDatabaseCluster"
4407
+ },
4408
+ {
4409
+ "fqn": "aws-cdk-lib.aws_rds.IDatabaseInstance"
4410
+ },
4411
+ {
4412
+ "fqn": "aws-cdk-lib.aws_dsql.CfnCluster"
4413
+ }
4414
+ ]
4415
+ }
4416
+ }
4417
+ },
4418
+ {
4419
+ "abstract": true,
4420
+ "docs": {
4421
+ "stability": "stable"
4422
+ },
4423
+ "immutable": true,
4424
+ "locationInModule": {
4425
+ "filename": "src/provider.ts",
4426
+ "line": 106
4427
+ },
4428
+ "name": "secret",
4429
+ "optional": true,
4430
+ "type": {
4431
+ "fqn": "aws-cdk-lib.aws_secretsmanager.ISecret"
4432
+ }
4433
+ }
4434
+ ],
4435
+ "symbolId": "src/provider:IProvider"
4436
+ },
4437
+ "cdk-rds-sql.IamGrant": {
4438
+ "assembly": "cdk-rds-sql",
4439
+ "base": "aws-cdk-lib.CustomResource",
4440
+ "docs": {
4441
+ "stability": "stable"
4442
+ },
4443
+ "fqn": "cdk-rds-sql.IamGrant",
4444
+ "initializer": {
4445
+ "docs": {
4446
+ "stability": "stable"
4447
+ },
4448
+ "locationInModule": {
4449
+ "filename": "src/iam-grant.ts",
4450
+ "line": 24
4451
+ },
4452
+ "parameters": [
4453
+ {
4454
+ "name": "scope",
4455
+ "type": {
4456
+ "fqn": "constructs.Construct"
4457
+ }
4458
+ },
4459
+ {
4460
+ "name": "id",
4461
+ "type": {
4462
+ "primitive": "string"
4463
+ }
4464
+ },
4465
+ {
4466
+ "name": "props",
4467
+ "type": {
4468
+ "fqn": "cdk-rds-sql.IamGrantProps"
4469
+ }
4470
+ }
4471
+ ]
4472
+ },
4473
+ "kind": "class",
4474
+ "locationInModule": {
4475
+ "filename": "src/iam-grant.ts",
4476
+ "line": 23
4477
+ },
4478
+ "name": "IamGrant",
4479
+ "symbolId": "src/iam-grant:IamGrant"
4480
+ },
4481
+ "cdk-rds-sql.IamGrantProps": {
4482
+ "assembly": "cdk-rds-sql",
4483
+ "datatype": true,
4484
+ "docs": {
4485
+ "stability": "stable"
4486
+ },
4487
+ "fqn": "cdk-rds-sql.IamGrantProps",
4488
+ "kind": "interface",
4489
+ "locationInModule": {
4490
+ "filename": "src/iam-grant.ts",
4491
+ "line": 6
4492
+ },
4493
+ "name": "IamGrantProps",
4494
+ "properties": [
4495
+ {
4496
+ "abstract": true,
4497
+ "docs": {
4498
+ "stability": "stable",
4499
+ "summary": "Provider."
4500
+ },
4501
+ "immutable": true,
4502
+ "locationInModule": {
4503
+ "filename": "src/iam-grant.ts",
4504
+ "line": 10
4505
+ },
4506
+ "name": "provider",
4507
+ "type": {
4508
+ "fqn": "cdk-rds-sql.IProvider"
4509
+ }
4510
+ },
4511
+ {
4512
+ "abstract": true,
4513
+ "docs": {
4514
+ "stability": "stable",
4515
+ "summary": "IAM resource ARN (role, user, or other IAM principal)."
4516
+ },
4517
+ "immutable": true,
4518
+ "locationInModule": {
4519
+ "filename": "src/iam-grant.ts",
4520
+ "line": 20
4521
+ },
4522
+ "name": "resourceArn",
4523
+ "type": {
4524
+ "primitive": "string"
4525
+ }
4526
+ },
4527
+ {
4528
+ "abstract": true,
4529
+ "docs": {
4530
+ "stability": "stable",
4531
+ "summary": "Database role name to grant IAM access to."
4532
+ },
4533
+ "immutable": true,
4534
+ "locationInModule": {
4535
+ "filename": "src/iam-grant.ts",
4536
+ "line": 15
4537
+ },
4538
+ "name": "roleName",
4539
+ "type": {
4540
+ "primitive": "string"
4541
+ }
4542
+ }
4543
+ ],
4544
+ "symbolId": "src/iam-grant:IamGrantProps"
4545
+ },
4192
4546
  "cdk-rds-sql.Provider": {
4193
4547
  "assembly": "cdk-rds-sql",
4194
4548
  "base": "constructs.Construct",
@@ -4202,7 +4556,7 @@
4202
4556
  },
4203
4557
  "locationInModule": {
4204
4558
  "filename": "src/provider.ts",
4205
- "line": 89
4559
+ "line": 158
4206
4560
  },
4207
4561
  "parameters": [
4208
4562
  {
@@ -4225,19 +4579,59 @@
4225
4579
  }
4226
4580
  ]
4227
4581
  },
4582
+ "interfaces": [
4583
+ "cdk-rds-sql.IProvider"
4584
+ ],
4228
4585
  "kind": "class",
4229
4586
  "locationInModule": {
4230
4587
  "filename": "src/provider.ts",
4231
- "line": 76
4588
+ "line": 134
4232
4589
  },
4233
4590
  "methods": [
4591
+ {
4592
+ "docs": {
4593
+ "stability": "stable",
4594
+ "summary": "Import an existing provider Lambda function."
4595
+ },
4596
+ "locationInModule": {
4597
+ "filename": "src/provider.ts",
4598
+ "line": 138
4599
+ },
4600
+ "name": "fromProviderAttributes",
4601
+ "parameters": [
4602
+ {
4603
+ "name": "scope",
4604
+ "type": {
4605
+ "fqn": "constructs.Construct"
4606
+ }
4607
+ },
4608
+ {
4609
+ "name": "id",
4610
+ "type": {
4611
+ "primitive": "string"
4612
+ }
4613
+ },
4614
+ {
4615
+ "name": "attrs",
4616
+ "type": {
4617
+ "fqn": "cdk-rds-sql.ProviderAttributes"
4618
+ }
4619
+ }
4620
+ ],
4621
+ "returns": {
4622
+ "type": {
4623
+ "fqn": "cdk-rds-sql.IProvider"
4624
+ }
4625
+ },
4626
+ "static": true
4627
+ },
4234
4628
  {
4235
4629
  "docs": {
4236
4630
  "stability": "stable"
4237
4631
  },
4238
4632
  "locationInModule": {
4239
4633
  "filename": "src/provider.ts",
4240
- "line": 133
4634
+ "line": 241
4241
4635
  },
4242
4636
  "name": "newCustomResourceHandler",
4243
4637
  "parameters": [
@@ -4272,41 +4666,34 @@
4272
4666
  "properties": [
4273
4667
  {
4274
4668
  "docs": {
4275
- "stability": "stable"
4669
+ "default": "- if we cannot determine this \"postgres\"",
4670
+ "stability": "stable",
4671
+ "summary": "The engine like \"postgres\" or \"mysql\"."
4276
4672
  },
4277
4673
  "immutable": true,
4278
4674
  "locationInModule": {
4279
4675
  "filename": "src/provider.ts",
4280
- "line": 80
4676
+ "line": 156
4281
4677
  },
4282
- "name": "cluster",
4678
+ "name": "engine",
4679
+ "overrides": "cdk-rds-sql.IProvider",
4283
4680
  "type": {
4284
- "union": {
4285
- "types": [
4286
- {
4287
- "fqn": "aws-cdk-lib.aws_rds.IDatabaseCluster"
4288
- },
4289
- {
4290
- "fqn": "aws-cdk-lib.aws_rds.IDatabaseInstance"
4291
- }
4292
- ]
4293
- }
4681
+ "primitive": "string"
4294
4682
  }
4295
4683
  },
4296
4684
  {
4297
4685
  "docs": {
4298
- "default": "- if we cannot determine this \"postgres\"",
4299
- "stability": "stable",
4300
- "summary": "The engine like \"postgres\" or \"mysql\"."
4686
+ "stability": "stable"
4301
4687
  },
4302
4688
  "immutable": true,
4303
4689
  "locationInModule": {
4304
4690
  "filename": "src/provider.ts",
4305
- "line": 87
4691
+ "line": 148
4306
4692
  },
4307
- "name": "engine",
4693
+ "name": "handler",
4694
+ "overrides": "cdk-rds-sql.IProvider",
4308
4695
  "type": {
4309
- "primitive": "string"
4696
+ "fqn": "aws-cdk-lib.aws_lambda.IFunction"
4310
4697
  }
4311
4698
  },
4312
4699
  {
@@ -4316,11 +4703,12 @@
4316
4703
  "immutable": true,
4317
4704
  "locationInModule": {
4318
4705
  "filename": "src/provider.ts",
4319
- "line": 79
4706
+ "line": 146
4320
4707
  },
4321
- "name": "handler",
4708
+ "name": "serviceToken",
4709
+ "overrides": "cdk-rds-sql.IProvider",
4322
4710
  "type": {
4323
- "fqn": "aws-cdk-lib.aws_lambda.IFunction"
4711
+ "primitive": "string"
4324
4712
  }
4325
4713
  },
4326
4714
  {
@@ -4330,11 +4718,25 @@
4330
4718
  "immutable": true,
4331
4719
  "locationInModule": {
4332
4720
  "filename": "src/provider.ts",
4333
- "line": 78
4721
+ "line": 149
4334
4722
  },
4335
- "name": "secret",
4723
+ "name": "cluster",
4724
+ "optional": true,
4725
+ "overrides": "cdk-rds-sql.IProvider",
4336
4726
  "type": {
4337
- "fqn": "aws-cdk-lib.aws_secretsmanager.ISecret"
4727
+ "union": {
4728
+ "types": [
4729
+ {
4730
+ "fqn": "aws-cdk-lib.aws_rds.IDatabaseCluster"
4731
+ },
4732
+ {
4733
+ "fqn": "aws-cdk-lib.aws_rds.IDatabaseInstance"
4734
+ },
4735
+ {
4736
+ "fqn": "aws-cdk-lib.aws_dsql.CfnCluster"
4737
+ }
4738
+ ]
4739
+ }
4338
4740
  }
4339
4741
  },
4340
4742
  {
@@ -4344,42 +4746,61 @@
4344
4746
  "immutable": true,
4345
4747
  "locationInModule": {
4346
4748
  "filename": "src/provider.ts",
4347
- "line": 77
4749
+ "line": 147
4348
4750
  },
4349
- "name": "serviceToken",
4751
+ "name": "secret",
4752
+ "optional": true,
4753
+ "overrides": "cdk-rds-sql.IProvider",
4350
4754
  "type": {
4351
- "primitive": "string"
4755
+ "fqn": "aws-cdk-lib.aws_secretsmanager.ISecret"
4352
4756
  }
4353
4757
  }
4354
4758
  ],
4355
4759
  "symbolId": "src/provider:Provider"
4356
4760
  },
4357
- "cdk-rds-sql.RdsSqlProps": {
4761
+ "cdk-rds-sql.ProviderAttributes": {
4358
4762
  "assembly": "cdk-rds-sql",
4359
4763
  "datatype": true,
4360
4764
  "docs": {
4361
4765
  "stability": "stable"
4362
4766
  },
4363
- "fqn": "cdk-rds-sql.RdsSqlProps",
4767
+ "fqn": "cdk-rds-sql.ProviderAttributes",
4364
4768
  "kind": "interface",
4365
4769
  "locationInModule": {
4366
4770
  "filename": "src/provider.ts",
4367
- "line": 14
4771
+ "line": 111
4368
4772
  },
4369
- "name": "RdsSqlProps",
4773
+ "name": "ProviderAttributes",
4370
4774
  "properties": [
4371
4775
  {
4372
4776
  "abstract": true,
4373
4777
  "docs": {
4778
+ "stability": "stable"
4779
+ },
4780
+ "immutable": true,
4781
+ "locationInModule": {
4782
+ "filename": "src/provider.ts",
4783
+ "line": 119
4784
+ },
4785
+ "name": "engine",
4786
+ "type": {
4787
+ "fqn": "cdk-rds-sql.DatabaseEngine"
4788
+ }
4789
+ },
4790
+ {
4791
+ "abstract": true,
4792
+ "docs": {
4793
+ "remarks": "When importing a provider, cluster details are often not available.\nHowever, some operations like role creation require cluster endpoint\ninformation to build connection secrets.\n\nIf you plan to create roles with the imported provider, you must\nprovide the cluster reference. If you only plan to use existing\nroles, databases, schemas, or SQL operations, this can be omitted.",
4374
4794
  "stability": "stable",
4375
- "summary": "Your database."
4795
+ "summary": "Optional cluster information for role creation."
4376
4796
  },
4377
4797
  "immutable": true,
4378
4798
  "locationInModule": {
4379
4799
  "filename": "src/provider.ts",
4380
- "line": 34
4800
+ "line": 131
4381
4801
  },
4382
4802
  "name": "cluster",
4803
+ "optional": true,
4383
4804
  "type": {
4384
4805
  "union": {
4385
4806
  "types": [
@@ -4388,6 +4809,9 @@
4388
4809
  },
4389
4810
  {
4390
4811
  "fqn": "aws-cdk-lib.aws_rds.IDatabaseInstance"
4812
+ },
4813
+ {
4814
+ "fqn": "aws-cdk-lib.aws_dsql.CfnCluster"
4391
4815
  }
4392
4816
  ]
4393
4817
  }
@@ -4396,36 +4820,81 @@
4396
4820
  {
4397
4821
  "abstract": true,
4398
4822
  "docs": {
4399
- "remarks": "Usually this is your cluster's master secret.",
4823
+ "remarks": "Use functionArn for cross-account or cross-region scenarios.\nUse functionName for same-account, same-region scenarios.",
4400
4824
  "stability": "stable",
4401
- "summary": "Secret that grants access to your database."
4825
+ "summary": "Either the ARN or name of the Lambda function."
4402
4826
  },
4403
4827
  "immutable": true,
4404
4828
  "locationInModule": {
4405
4829
  "filename": "src/provider.ts",
4406
- "line": 41
4830
+ "line": 117
4407
4831
  },
4408
- "name": "secret",
4832
+ "name": "functionArn",
4833
+ "optional": true,
4409
4834
  "type": {
4410
- "fqn": "aws-cdk-lib.aws_secretsmanager.ISecret"
4835
+ "primitive": "string"
4411
4836
  }
4412
4837
  },
4413
4838
  {
4414
4839
  "abstract": true,
4415
4840
  "docs": {
4416
- "default": "- Function is not placed within a VPC.",
4417
- "remarks": "Normally this is the VPC of your database.",
4841
+ "stability": "stable"
4842
+ },
4843
+ "immutable": true,
4844
+ "locationInModule": {
4845
+ "filename": "src/provider.ts",
4846
+ "line": 118
4847
+ },
4848
+ "name": "functionName",
4849
+ "optional": true,
4850
+ "type": {
4851
+ "primitive": "string"
4852
+ }
4853
+ }
4854
+ ],
4855
+ "symbolId": "src/provider:ProviderAttributes"
4856
+ },
4857
+ "cdk-rds-sql.RdsSqlProps": {
4858
+ "assembly": "cdk-rds-sql",
4859
+ "datatype": true,
4860
+ "docs": {
4861
+ "stability": "stable"
4862
+ },
4863
+ "fqn": "cdk-rds-sql.RdsSqlProps",
4864
+ "kind": "interface",
4865
+ "locationInModule": {
4866
+ "filename": "src/provider.ts",
4867
+ "line": 24
4868
+ },
4869
+ "name": "RdsSqlProps",
4870
+ "properties": [
4871
+ {
4872
+ "abstract": true,
4873
+ "docs": {
4874
+ "remarks": "Supports both traditional RDS/Aurora clusters and DSQL clusters.\n- For RDS/Aurora: security groups will be configured to allow access\n- For DSQL: IAM authentication will be used instead of secrets",
4418
4875
  "stability": "stable",
4419
- "summary": "VPC network to place the provider lambda."
4876
+ "summary": "Your database cluster or instance."
4420
4877
  },
4421
4878
  "immutable": true,
4422
4879
  "locationInModule": {
4423
4880
  "filename": "src/provider.ts",
4424
- "line": 22
4881
+ "line": 49
4425
4882
  },
4426
- "name": "vpc",
4883
+ "name": "cluster",
4427
4884
  "type": {
4428
- "fqn": "aws-cdk-lib.aws_ec2.IVpc"
4885
+ "union": {
4886
+ "types": [
4887
+ {
4888
+ "fqn": "aws-cdk-lib.aws_rds.IDatabaseCluster"
4889
+ },
4890
+ {
4891
+ "fqn": "aws-cdk-lib.aws_rds.IDatabaseInstance"
4892
+ },
4893
+ {
4894
+ "fqn": "aws-cdk-lib.aws_dsql.CfnCluster"
4895
+ }
4896
+ ]
4897
+ }
4429
4898
  }
4430
4899
  },
4431
4900
  {
@@ -4439,7 +4908,7 @@
4439
4908
  "immutable": true,
4440
4909
  "locationInModule": {
4441
4910
  "filename": "src/provider.ts",
4442
- "line": 66
4911
+ "line": 84
4443
4912
  },
4444
4913
  "name": "functionProps",
4445
4914
  "optional": true,
@@ -4458,7 +4927,7 @@
4458
4927
  "immutable": true,
4459
4928
  "locationInModule": {
4460
4929
  "filename": "src/provider.ts",
4461
- "line": 55
4930
+ "line": 73
4462
4931
  },
4463
4932
  "name": "logger",
4464
4933
  "optional": true,
@@ -4466,6 +4935,25 @@
4466
4935
  "primitive": "boolean"
4467
4936
  }
4468
4937
  },
4938
+ {
4939
+ "abstract": true,
4940
+ "docs": {
4941
+ "default": "- undefined for DSQL clusters using IAM authentication",
4942
+ "remarks": "Usually this is your cluster's master secret.\nNot required when relying on IAM authentication (such as DSQL).",
4943
+ "stability": "stable",
4944
+ "summary": "Secret that grants access to your database."
4945
+ },
4946
+ "immutable": true,
4947
+ "locationInModule": {
4948
+ "filename": "src/provider.ts",
4949
+ "line": 59
4950
+ },
4951
+ "name": "secret",
4952
+ "optional": true,
4953
+ "type": {
4954
+ "fqn": "aws-cdk-lib.aws_secretsmanager.ISecret"
4955
+ }
4956
+ },
4469
4957
  {
4470
4958
  "abstract": true,
4471
4959
  "docs": {
@@ -4476,7 +4964,7 @@
4476
4964
  "immutable": true,
4477
4965
  "locationInModule": {
4478
4966
  "filename": "src/provider.ts",
4479
- "line": 73
4967
+ "line": 91
4480
4968
  },
4481
4969
  "name": "ssl",
4482
4970
  "optional": true,
@@ -4494,7 +4982,7 @@
4494
4982
  "immutable": true,
4495
4983
  "locationInModule": {
4496
4984
  "filename": "src/provider.ts",
4497
- "line": 48
4985
+ "line": 66
4498
4986
  },
4499
4987
  "name": "timeout",
4500
4988
  "optional": true,
@@ -4502,6 +4990,25 @@
4502
4990
  "fqn": "aws-cdk-lib.Duration"
4503
4991
  }
4504
4992
  },
4993
+ {
4994
+ "abstract": true,
4995
+ "docs": {
4996
+ "default": "- Function is not placed within a VPC.",
4997
+ "remarks": "Normally this is the VPC of your database.\nRequired when your database is only accessible in a VPC.\nNot required for DSQL as it uses public endpoints with IAM authentication.",
4998
+ "stability": "stable",
4999
+ "summary": "VPC network to place the provider lambda."
5000
+ },
5001
+ "immutable": true,
5002
+ "locationInModule": {
5003
+ "filename": "src/provider.ts",
5004
+ "line": 34
5005
+ },
5006
+ "name": "vpc",
5007
+ "optional": true,
5008
+ "type": {
5009
+ "fqn": "aws-cdk-lib.aws_ec2.IVpc"
5010
+ }
5011
+ },
4505
5012
  {
4506
5013
  "abstract": true,
4507
5014
  "docs": {
@@ -4512,7 +5019,7 @@
4512
5019
  "immutable": true,
4513
5020
  "locationInModule": {
4514
5021
  "filename": "src/provider.ts",
4515
- "line": 29
5022
+ "line": 41
4516
5023
  },
4517
5024
  "name": "vpcSubnets",
4518
5025
  "optional": true,
@@ -4564,6 +5071,12 @@
4564
5071
  "stability": "stable"
4565
5072
  },
4566
5073
  "name": "PARAMETER_PASSWORD"
5074
+ },
5075
+ {
5076
+ "docs": {
5077
+ "stability": "stable"
5078
+ },
5079
+ "name": "IAM_GRANT"
4567
5080
  }
4568
5081
  ],
4569
5082
  "name": "RdsSqlResource",
@@ -4582,7 +5095,7 @@
4582
5095
  },
4583
5096
  "locationInModule": {
4584
5097
  "filename": "src/role.ts",
4585
- "line": 152
5098
+ "line": 156
4586
5099
  },
4587
5100
  "parameters": [
4588
5101
  {
@@ -4608,7 +5121,7 @@
4608
5121
  "kind": "class",
4609
5122
  "locationInModule": {
4610
5123
  "filename": "src/role.ts",
4611
- "line": 141
5124
+ "line": 144
4612
5125
  },
4613
5126
  "name": "Role",
4614
5127
  "properties": [
@@ -4620,7 +5133,7 @@
4620
5133
  "immutable": true,
4621
5134
  "locationInModule": {
4622
5135
  "filename": "src/role.ts",
4623
- "line": 145
5136
+ "line": 148
4624
5137
  },
4625
5138
  "name": "roleName",
4626
5139
  "type": {
@@ -4629,15 +5142,17 @@
4629
5142
  },
4630
5143
  {
4631
5144
  "docs": {
5145
+ "remarks": "Only available for non-DSQL clusters as DSQL uses IAM authentication.",
4632
5146
  "stability": "stable",
4633
5147
  "summary": "The generated secret."
4634
5148
  },
4635
5149
  "immutable": true,
4636
5150
  "locationInModule": {
4637
5151
  "filename": "src/role.ts",
4638
- "line": 150
5152
+ "line": 154
4639
5153
  },
4640
5154
  "name": "secret",
5155
+ "optional": true,
4641
5156
  "type": {
4642
5157
  "fqn": "aws-cdk-lib.aws_secretsmanager.ISecret"
4643
5158
  }
@@ -4672,7 +5187,7 @@
4672
5187
  },
4673
5188
  "name": "provider",
4674
5189
  "type": {
4675
- "fqn": "cdk-rds-sql.Provider"
5190
+ "fqn": "cdk-rds-sql.IProvider"
4676
5191
  }
4677
5192
  },
4678
5193
  {
@@ -4731,14 +5246,14 @@
4731
5246
  "abstract": true,
4732
5247
  "docs": {
4733
5248
  "default": "false - use password authentication",
4734
- "remarks": "When enabled, the role will be created without a password and\nconfigured for AWS IAM database authentication. The secret\nwill not contain a password field.",
5249
+ "remarks": "When enabled, the role will be created without a password and\nconfigured for AWS IAM database authentication. The secret\nwill not contain a password field.\n\nNote: For DSQL clusters, this property is ignored as DSQL always\nuses IAM authentication.",
4735
5250
  "stability": "stable",
4736
5251
  "summary": "Enable IAM authentication for this role."
4737
5252
  },
4738
5253
  "immutable": true,
4739
5254
  "locationInModule": {
4740
5255
  "filename": "src/role.ts",
4741
- "line": 84
5256
+ "line": 87
4742
5257
  },
4743
5258
  "name": "enableIamAuth",
4744
5259
  "optional": true,
@@ -4817,7 +5332,7 @@
4817
5332
  },
4818
5333
  "locationInModule": {
4819
5334
  "filename": "src/schema.ts",
4820
- "line": 35
5335
+ "line": 37
4821
5336
  },
4822
5337
  "parameters": [
4823
5338
  {
@@ -4843,7 +5358,7 @@
4843
5358
  "kind": "class",
4844
5359
  "locationInModule": {
4845
5360
  "filename": "src/schema.ts",
4846
- "line": 32
5361
+ "line": 34
4847
5362
  },
4848
5363
  "name": "Schema",
4849
5364
  "properties": [
@@ -4854,7 +5369,7 @@
4854
5369
  "immutable": true,
4855
5370
  "locationInModule": {
4856
5371
  "filename": "src/schema.ts",
4857
- "line": 33
5372
+ "line": 35
4858
5373
  },
4859
5374
  "name": "schemaName",
4860
5375
  "type": {
@@ -4891,7 +5406,7 @@
4891
5406
  },
4892
5407
  "name": "provider",
4893
5408
  "type": {
4894
- "fqn": "cdk-rds-sql.Provider"
5409
+ "fqn": "cdk-rds-sql.IProvider"
4895
5410
  }
4896
5411
  },
4897
5412
  {
@@ -4931,13 +5446,14 @@
4931
5446
  {
4932
5447
  "abstract": true,
4933
5448
  "docs": {
5449
+ "remarks": "This way the role can read its own tables, but\ncannot see or access tables created by others.",
4934
5450
  "stability": "stable",
4935
- "summary": "Optional role to be granted for managing tables in schema."
5451
+ "summary": "Optional role which will be granted usage and create permissions to this schema."
4936
5452
  },
4937
5453
  "immutable": true,
4938
5454
  "locationInModule": {
4939
5455
  "filename": "src/schema.ts",
4940
- "line": 29
5456
+ "line": 31
4941
5457
  },
4942
5458
  "name": "role",
4943
5459
  "optional": true,
@@ -5019,7 +5535,7 @@
5019
5535
  },
5020
5536
  "name": "provider",
5021
5537
  "type": {
5022
- "fqn": "cdk-rds-sql.Provider"
5538
+ "fqn": "cdk-rds-sql.IProvider"
5023
5539
  }
5024
5540
  },
5025
5541
  {
@@ -5078,6 +5594,6 @@
5078
5594
  "symbolId": "src/sql:SqlProps"
5079
5595
  }
5080
5596
  },
5081
- "version": "7.0.2",
5082
- "fingerprint": "Gqi6ekHV+BnnlZxO+HWWzW/Cuy9wIzQgqLQGGRdodAw="
5597
+ "version": "7.2.0",
5598
+ "fingerprint": "Of4aNwhQvJvM+Og//gB6L+NW07b+Ad1GXY5ea224ofY="
5083
5599
  }