@fy-stack/database-construct 0.0.136 → 0.0.138
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.
|
@@ -12,7 +12,7 @@ import { DatabaseConstructProps } from './types';
|
|
|
12
12
|
export declare class DatabaseConstruct extends Construct implements Attachable, Grantable {
|
|
13
13
|
secrets: secretsManager.ISecret;
|
|
14
14
|
db: rds.DatabaseInstance;
|
|
15
|
-
constructor(scope: Construct, id: string, props: DatabaseConstructProps);
|
|
15
|
+
constructor(scope: Construct, id: string, { vpcId, engine, instance, public: publicDb, ...props }: DatabaseConstructProps);
|
|
16
16
|
grantable(grant: IGrantable): void;
|
|
17
17
|
attachable(): {
|
|
18
18
|
arn: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-construct.d.ts","sourceRoot":"","sources":["../../src/lib/database-construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;GAGG;AACH,qBAAa,iBACX,SAAQ,SACR,YAAW,UAAU,EAAE,SAAS;IAEzB,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC;IAChC,EAAE,EAAE,GAAG,CAAC,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"database-construct.d.ts","sourceRoot":"","sources":["../../src/lib/database-construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;GAGG;AACH,qBAAa,iBACX,SAAQ,SACR,YAAW,UAAU,EAAE,SAAS;IAEzB,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC;IAChC,EAAE,EAAE,GAAG,CAAC,gBAAgB,CAAC;gBAG9B,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,EACE,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EAAE,QAAQ,EAChB,GAAG,KAAK,EACT,EAAE,sBAAsB;IAgC3B,SAAS,CAAC,KAAK,EAAE,UAAU;IAY3B,UAAU;;;;;IAQV,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAQhD"}
|
|
@@ -15,21 +15,21 @@ const database_user_construct_1 = require("./database-user-construct");
|
|
|
15
15
|
class DatabaseConstruct extends constructs_1.Construct {
|
|
16
16
|
secrets;
|
|
17
17
|
db;
|
|
18
|
-
constructor(scope, id, props) {
|
|
18
|
+
constructor(scope, id, { vpcId, engine, instance, public: publicDb, ...props }) {
|
|
19
19
|
super(scope, id);
|
|
20
|
-
const vpc = ec2.Vpc.fromLookup(this, 'VPC',
|
|
20
|
+
const vpc = ec2.Vpc.fromLookup(this, 'VPC', vpcId ? { vpcId } : { isDefault: true });
|
|
21
21
|
this.db = new rds.DatabaseInstance(this, 'DB', {
|
|
22
22
|
vpc,
|
|
23
|
-
engine:
|
|
24
|
-
instanceType: ec2.InstanceType.of(
|
|
25
|
-
publiclyAccessible:
|
|
23
|
+
engine: engine ?? aws_rds_1.DatabaseInstanceEngine.POSTGRES,
|
|
24
|
+
instanceType: ec2.InstanceType.of(instance?.class ?? ec2.InstanceClass.T4G, instance?.size ?? ec2.InstanceSize.MICRO),
|
|
25
|
+
publiclyAccessible: publicDb,
|
|
26
26
|
vpcSubnets: {
|
|
27
|
-
subnetType:
|
|
27
|
+
subnetType: publicDb
|
|
28
28
|
? ec2.SubnetType.PUBLIC
|
|
29
29
|
: ec2.SubnetType.PRIVATE_ISOLATED,
|
|
30
30
|
},
|
|
31
|
+
...props,
|
|
31
32
|
});
|
|
32
|
-
this.db.addRotationSingleUser();
|
|
33
33
|
if (!this.db.secret)
|
|
34
34
|
throw new Error('Could not create database credentials secret');
|
|
35
35
|
this.secrets = this.db.secret;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { DatabaseInstanceProps, IInstanceEngine } from 'aws-cdk-lib/aws-rds
|
|
|
3
3
|
/**
|
|
4
4
|
* Properties required for setting up a database construct.
|
|
5
5
|
*/
|
|
6
|
-
export type DatabaseConstructProps = {
|
|
6
|
+
export type DatabaseConstructProps = Omit<DatabaseInstanceProps, 'instanceType' | 'databaseName' | 'publiclyAccessible' | 'engine' | 'vpc'> & {
|
|
7
|
+
useDefault?: boolean;
|
|
7
8
|
/** Optionally pass in existing VPC id */
|
|
8
9
|
vpcId?: string;
|
|
9
10
|
/**
|
|
@@ -17,7 +18,5 @@ export type DatabaseConstructProps = {
|
|
|
17
18
|
};
|
|
18
19
|
/** Make database public */
|
|
19
20
|
public?: boolean;
|
|
20
|
-
/** Other RDS properties {@link DatabaseInstanceProps} */
|
|
21
|
-
additionalData?: Omit<DatabaseInstanceProps, 'instanceType' | 'databaseName' | 'publiclyAccessible' | 'engine'>;
|
|
22
21
|
};
|
|
23
22
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,qBAAqB,EACrB,cAAc,GAAG,cAAc,GAAG,oBAAoB,GAAG,QAAQ,GAAG,KAAK,CAC1E,GAAG;IACF,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,qGAAqG;IACrG,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,aAAa,CAAC;QAAC,IAAI,EAAE,YAAY,CAAA;KAAE,CAAC;IAExD,2BAA2B;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fy-stack/database-construct",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.138",
|
|
4
4
|
"repository": "https://github.com/festusyuma/fy-stack",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@fy-stack/types": "0.0.
|
|
6
|
+
"@fy-stack/types": "0.0.138",
|
|
7
7
|
"tslib": "^2.3.0"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|