@composurecdk/neptune 0.8.3
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/README.md +140 -0
- package/dist/commonjs/cluster-alarm-config.d.ts +77 -0
- package/dist/commonjs/cluster-alarm-config.d.ts.map +1 -0
- package/dist/commonjs/cluster-alarm-config.js +3 -0
- package/dist/commonjs/cluster-alarm-config.js.map +1 -0
- package/dist/commonjs/cluster-alarm-defaults.d.ts +20 -0
- package/dist/commonjs/cluster-alarm-defaults.d.ts.map +1 -0
- package/dist/commonjs/cluster-alarm-defaults.js +52 -0
- package/dist/commonjs/cluster-alarm-defaults.js.map +1 -0
- package/dist/commonjs/cluster-alarms.d.ts +25 -0
- package/dist/commonjs/cluster-alarms.d.ts.map +1 -0
- package/dist/commonjs/cluster-alarms.js +133 -0
- package/dist/commonjs/cluster-alarms.js.map +1 -0
- package/dist/commonjs/cluster-builder.d.ts +194 -0
- package/dist/commonjs/cluster-builder.d.ts.map +1 -0
- package/dist/commonjs/cluster-builder.js +140 -0
- package/dist/commonjs/cluster-builder.js.map +1 -0
- package/dist/commonjs/cluster-defaults.d.ts +19 -0
- package/dist/commonjs/cluster-defaults.d.ts.map +1 -0
- package/dist/commonjs/cluster-defaults.js +87 -0
- package/dist/commonjs/cluster-defaults.js.map +1 -0
- package/dist/commonjs/cluster-parameter-group-defaults.d.ts +30 -0
- package/dist/commonjs/cluster-parameter-group-defaults.d.ts.map +1 -0
- package/dist/commonjs/cluster-parameter-group-defaults.js +53 -0
- package/dist/commonjs/cluster-parameter-group-defaults.js.map +1 -0
- package/dist/commonjs/index.d.ts +6 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +13 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/esm/cluster-alarm-config.d.ts +77 -0
- package/dist/esm/cluster-alarm-config.d.ts.map +1 -0
- package/dist/esm/cluster-alarm-config.js +2 -0
- package/dist/esm/cluster-alarm-config.js.map +1 -0
- package/dist/esm/cluster-alarm-defaults.d.ts +20 -0
- package/dist/esm/cluster-alarm-defaults.d.ts.map +1 -0
- package/dist/esm/cluster-alarm-defaults.js +49 -0
- package/dist/esm/cluster-alarm-defaults.js.map +1 -0
- package/dist/esm/cluster-alarms.d.ts +25 -0
- package/dist/esm/cluster-alarms.d.ts.map +1 -0
- package/dist/esm/cluster-alarms.js +129 -0
- package/dist/esm/cluster-alarms.js.map +1 -0
- package/dist/esm/cluster-builder.d.ts +194 -0
- package/dist/esm/cluster-builder.d.ts.map +1 -0
- package/dist/esm/cluster-builder.js +137 -0
- package/dist/esm/cluster-builder.js.map +1 -0
- package/dist/esm/cluster-defaults.d.ts +19 -0
- package/dist/esm/cluster-defaults.d.ts.map +1 -0
- package/dist/esm/cluster-defaults.js +84 -0
- package/dist/esm/cluster-defaults.js.map +1 -0
- package/dist/esm/cluster-parameter-group-defaults.d.ts +30 -0
- package/dist/esm/cluster-parameter-group-defaults.d.ts.map +1 -0
- package/dist/esm/cluster-parameter-group-defaults.js +49 -0
- package/dist/esm/cluster-parameter-group-defaults.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/package.json +71 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { type Alarm } from "aws-cdk-lib/aws-cloudwatch";
|
|
2
|
+
import { type IConnectable, type ISecurityGroup, type IVpc } from "aws-cdk-lib/aws-ec2";
|
|
3
|
+
import { type IGrantable } from "aws-cdk-lib/aws-iam";
|
|
4
|
+
import { DatabaseCluster, type DatabaseClusterProps, type IClusterParameterGroup, type IDatabaseCluster, type ISubnetGroup } from "@aws-cdk/aws-neptune-alpha";
|
|
5
|
+
import { type IConstruct } from "constructs";
|
|
6
|
+
import { COPY_STATE, type Lifecycle, type Resolvable } from "@composurecdk/core";
|
|
7
|
+
import { type ITaggedBuilder } from "@composurecdk/cloudformation";
|
|
8
|
+
import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
|
|
9
|
+
import type { NeptuneClusterAlarmConfig } from "./cluster-alarm-config.js";
|
|
10
|
+
/**
|
|
11
|
+
* A principal that can be granted access to a Neptune cluster via
|
|
12
|
+
* {@link IClusterBuilder.allowAccessFrom}. Must be both an {@link IConnectable}
|
|
13
|
+
* (so its security group can be opened to the cluster's port) and an
|
|
14
|
+
* {@link IGrantable} (so it can be granted IAM `connect`). EC2 instances,
|
|
15
|
+
* Lambda functions, and Fargate tasks all satisfy this.
|
|
16
|
+
*/
|
|
17
|
+
export type ClusterAccessor = IConnectable & IGrantable;
|
|
18
|
+
/**
|
|
19
|
+
* Configuration properties for the Neptune cluster builder.
|
|
20
|
+
*
|
|
21
|
+
* Extends the CDK {@link DatabaseClusterProps} but lifts the
|
|
22
|
+
* cross-component-wiring props to {@link Resolvable} so they can be supplied
|
|
23
|
+
* as either concrete values or {@link Ref}s to sibling components in a
|
|
24
|
+
* {@link compose}d system:
|
|
25
|
+
*
|
|
26
|
+
* - `vpc` is supplied via the dedicated {@link IClusterBuilder.vpc | .vpc()}
|
|
27
|
+
* method (it is required).
|
|
28
|
+
* - `securityGroups` accepts `Resolvable<ISecurityGroup>` entries.
|
|
29
|
+
*
|
|
30
|
+
* It also adds builder-specific options for the auto-created cluster
|
|
31
|
+
* parameter group and recommended alarms.
|
|
32
|
+
*/
|
|
33
|
+
export interface ClusterBuilderProps extends Omit<DatabaseClusterProps, "vpc" | "securityGroups"> {
|
|
34
|
+
/**
|
|
35
|
+
* Security groups to attach to the cluster. Accepts concrete
|
|
36
|
+
* {@link ISecurityGroup}s or {@link Ref}s that resolve to them at build
|
|
37
|
+
* time (e.g. a sibling `SecurityGroupBuilder`).
|
|
38
|
+
*
|
|
39
|
+
* @default - CDK creates a security group for the cluster.
|
|
40
|
+
*/
|
|
41
|
+
securityGroups?: readonly Resolvable<ISecurityGroup>[];
|
|
42
|
+
/**
|
|
43
|
+
* Parameters to set on the auto-created cluster parameter group, merged
|
|
44
|
+
* onto (and overriding) {@link CLUSTER_PARAMETER_GROUP_DEFAULTS}. Use this
|
|
45
|
+
* to tune engine behaviour without managing a parameter group yourself.
|
|
46
|
+
*
|
|
47
|
+
* Mutually exclusive with `clusterParameterGroup`: a user-managed group is
|
|
48
|
+
* not built (or mutated) by this builder.
|
|
49
|
+
*/
|
|
50
|
+
clusterParameters?: Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Configuration for recommended CloudWatch alarms.
|
|
53
|
+
*
|
|
54
|
+
* By default the builder creates recommended alarms with sensible
|
|
55
|
+
* thresholds for every applicable metric. Individual alarms can be
|
|
56
|
+
* customized or disabled. Set to `false` to disable all alarms.
|
|
57
|
+
*
|
|
58
|
+
* No alarm actions are configured by default since notification methods
|
|
59
|
+
* are user-specific. Access alarms from the build result or use an
|
|
60
|
+
* `afterBuild` hook to apply actions.
|
|
61
|
+
*/
|
|
62
|
+
recommendedAlarms?: NeptuneClusterAlarmConfig | false;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The build output of an {@link IClusterBuilder}. Contains the CDK
|
|
66
|
+
* constructs created during {@link Lifecycle.build}, keyed by role.
|
|
67
|
+
*/
|
|
68
|
+
export interface ClusterBuilderResult {
|
|
69
|
+
/** The Neptune cluster, including the writer/reader instances it manages. */
|
|
70
|
+
cluster: DatabaseCluster;
|
|
71
|
+
/**
|
|
72
|
+
* The DB subnet group the cluster runs in. CDK auto-creates this from the
|
|
73
|
+
* VPC; it is exposed here so it can be reused or asserted against.
|
|
74
|
+
*/
|
|
75
|
+
subnetGroup: ISubnetGroup;
|
|
76
|
+
/**
|
|
77
|
+
* The cluster parameter group — either the one supplied via
|
|
78
|
+
* `.clusterParameterGroup()` or the audit-log-enabled group the builder
|
|
79
|
+
* auto-creates.
|
|
80
|
+
*/
|
|
81
|
+
clusterParameterGroup: IClusterParameterGroup;
|
|
82
|
+
/**
|
|
83
|
+
* CloudWatch alarms created for the cluster, keyed by alarm key (e.g.
|
|
84
|
+
* `result.alarms.cpuUtilization`). Includes recommended alarms and any
|
|
85
|
+
* added via {@link IClusterBuilder.addAlarm}. No alarm actions are
|
|
86
|
+
* configured — apply them via the result or an `afterBuild` hook.
|
|
87
|
+
*/
|
|
88
|
+
alarms: Record<string, Alarm>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A fluent builder for configuring and creating an Amazon Neptune cluster.
|
|
92
|
+
*
|
|
93
|
+
* Each configuration property from the CDK {@link DatabaseClusterProps} is
|
|
94
|
+
* exposed as an overloaded method: call with a value to set it (returns the
|
|
95
|
+
* builder for chaining), or call with no arguments to read the current value.
|
|
96
|
+
*
|
|
97
|
+
* The `vpc` is set via the dedicated {@link IClusterBuilder.vpc | .vpc()}
|
|
98
|
+
* method, which accepts a {@link Resolvable} for cross-component wiring (e.g.
|
|
99
|
+
* to a sibling `VpcBuilder`). `securityGroups` likewise accept
|
|
100
|
+
* {@link Resolvable} values.
|
|
101
|
+
*
|
|
102
|
+
* The builder implements {@link Lifecycle}, so it can be used directly as a
|
|
103
|
+
* component in a {@link compose | composed system}. When built it creates a
|
|
104
|
+
* cluster with {@link CLUSTER_DEFAULTS | well-architected defaults}, an
|
|
105
|
+
* audit-log-enabled cluster parameter group, recommended CloudWatch alarms,
|
|
106
|
+
* and returns a {@link ClusterBuilderResult}.
|
|
107
|
+
*
|
|
108
|
+
* Both provisioned and serverless clusters are supported — set a provisioned
|
|
109
|
+
* `.instanceType(InstanceType.R6G_LARGE)`, or `.instanceType(InstanceType.SERVERLESS)`
|
|
110
|
+
* with `.serverlessScalingConfiguration({ minCapacity, maxCapacity })`.
|
|
111
|
+
*
|
|
112
|
+
* @see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-neptune-alpha-readme.html
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* const graph = createClusterBuilder()
|
|
117
|
+
* .vpc(ref<VpcBuilderResult>("network").get("vpc"))
|
|
118
|
+
* .instanceType(InstanceType.SERVERLESS)
|
|
119
|
+
* .serverlessScalingConfiguration({ minCapacity: 1, maxCapacity: 8 });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export type IClusterBuilder = ITaggedBuilder<ClusterBuilderProps, ClusterBuilder>;
|
|
123
|
+
declare class ClusterBuilder implements Lifecycle<ClusterBuilderResult> {
|
|
124
|
+
#private;
|
|
125
|
+
props: Partial<ClusterBuilderProps>;
|
|
126
|
+
/**
|
|
127
|
+
* Sets the VPC the cluster runs in. Required. Accepts a concrete
|
|
128
|
+
* {@link IVpc} or a {@link Ref} that resolves to one at build time — the
|
|
129
|
+
* standard cross-component wiring path (e.g. to a sibling `VpcBuilder`).
|
|
130
|
+
*
|
|
131
|
+
* @param vpc - The VPC or a Ref to one.
|
|
132
|
+
* @returns This builder for chaining.
|
|
133
|
+
*/
|
|
134
|
+
vpc(vpc: Resolvable<IVpc>): this;
|
|
135
|
+
/**
|
|
136
|
+
* Grants a principal both network and IAM access to the cluster in a single
|
|
137
|
+
* declaration. At build time this applies
|
|
138
|
+
* `cluster.connections.allowDefaultPortFrom(peer)` (opening the cluster's
|
|
139
|
+
* port to the peer's security group) and `cluster.grantConnect(peer)`
|
|
140
|
+
* (granting the IAM `connect` action required by the cluster's
|
|
141
|
+
* IAM-authentication default).
|
|
142
|
+
*
|
|
143
|
+
* Accepts a concrete {@link ClusterAccessor} or a {@link Ref} to one, so the
|
|
144
|
+
* grant can be declared inside `compose()` rather than wired up in an
|
|
145
|
+
* `afterBuild` hook.
|
|
146
|
+
*
|
|
147
|
+
* @param peer - The principal to grant access to, or a Ref to one.
|
|
148
|
+
* @returns This builder for chaining.
|
|
149
|
+
*/
|
|
150
|
+
allowAccessFrom(peer: Resolvable<ClusterAccessor>): this;
|
|
151
|
+
/**
|
|
152
|
+
* Adds a custom CloudWatch alarm to be created alongside the recommended
|
|
153
|
+
* alarms. The callback receives an {@link AlarmDefinitionBuilder} scoped to
|
|
154
|
+
* the built cluster; configure it fluently and return it.
|
|
155
|
+
*
|
|
156
|
+
* @param key - A unique key for the alarm (used to generate the alarm id).
|
|
157
|
+
* @param configure - Callback that configures the alarm definition.
|
|
158
|
+
* @returns This builder for chaining.
|
|
159
|
+
*/
|
|
160
|
+
addAlarm(key: string, configure: (alarm: AlarmDefinitionBuilder<IDatabaseCluster>) => AlarmDefinitionBuilder<IDatabaseCluster>): this;
|
|
161
|
+
/** @internal — see ADR-0005. */
|
|
162
|
+
[COPY_STATE](target: ClusterBuilder): void;
|
|
163
|
+
build(scope: IConstruct, id: string, context?: Record<string, object>): ClusterBuilderResult;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Creates a new {@link IClusterBuilder} for configuring an Amazon Neptune
|
|
167
|
+
* cluster.
|
|
168
|
+
*
|
|
169
|
+
* This is the entry point for defining a Neptune component. The returned
|
|
170
|
+
* builder exposes every {@link ClusterBuilderProps} property as a fluent
|
|
171
|
+
* setter/getter, plus {@link IClusterBuilder.vpc | .vpc()} and
|
|
172
|
+
* {@link IClusterBuilder.allowAccessFrom | .allowAccessFrom()} for
|
|
173
|
+
* cross-component wiring with Ref support. It implements {@link Lifecycle}
|
|
174
|
+
* for use with {@link compose}.
|
|
175
|
+
*
|
|
176
|
+
* @returns A fluent builder for an Amazon Neptune cluster.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* const system = compose(
|
|
181
|
+
* {
|
|
182
|
+
* network: createVpcBuilder().maxAzs(2),
|
|
183
|
+
* graph: createClusterBuilder()
|
|
184
|
+
* .vpc(ref<VpcBuilderResult>("network").get("vpc"))
|
|
185
|
+
* .instanceType(InstanceType.SERVERLESS)
|
|
186
|
+
* .serverlessScalingConfiguration({ minCapacity: 1, maxCapacity: 8 }),
|
|
187
|
+
* },
|
|
188
|
+
* { network: [], graph: ["network"] },
|
|
189
|
+
* );
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export declare function createClusterBuilder(): IClusterBuilder;
|
|
193
|
+
export {};
|
|
194
|
+
//# sourceMappingURL=cluster-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-builder.d.ts","sourceRoot":"","sources":["../../src/cluster-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAEL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAW,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAG3E;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,UAAU,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,KAAK,GAAG,gBAAgB,CAAC;IAC/F;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,SAAS,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;IAEvD;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MA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tD"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createClusterBuilder = createClusterBuilder;
|
|
4
|
+
const aws_neptune_alpha_1 = require("@aws-cdk/aws-neptune-alpha");
|
|
5
|
+
const core_1 = require("@composurecdk/core");
|
|
6
|
+
const cloudformation_1 = require("@composurecdk/cloudformation");
|
|
7
|
+
const cloudwatch_1 = require("@composurecdk/cloudwatch");
|
|
8
|
+
const cluster_defaults_js_1 = require("./cluster-defaults.js");
|
|
9
|
+
const cluster_parameter_group_defaults_js_1 = require("./cluster-parameter-group-defaults.js");
|
|
10
|
+
const cluster_alarms_js_1 = require("./cluster-alarms.js");
|
|
11
|
+
class ClusterBuilder {
|
|
12
|
+
props = {};
|
|
13
|
+
#customAlarms = [];
|
|
14
|
+
#accessors = [];
|
|
15
|
+
#vpc;
|
|
16
|
+
/**
|
|
17
|
+
* Sets the VPC the cluster runs in. Required. Accepts a concrete
|
|
18
|
+
* {@link IVpc} or a {@link Ref} that resolves to one at build time — the
|
|
19
|
+
* standard cross-component wiring path (e.g. to a sibling `VpcBuilder`).
|
|
20
|
+
*
|
|
21
|
+
* @param vpc - The VPC or a Ref to one.
|
|
22
|
+
* @returns This builder for chaining.
|
|
23
|
+
*/
|
|
24
|
+
vpc(vpc) {
|
|
25
|
+
this.#vpc = vpc;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Grants a principal both network and IAM access to the cluster in a single
|
|
30
|
+
* declaration. At build time this applies
|
|
31
|
+
* `cluster.connections.allowDefaultPortFrom(peer)` (opening the cluster's
|
|
32
|
+
* port to the peer's security group) and `cluster.grantConnect(peer)`
|
|
33
|
+
* (granting the IAM `connect` action required by the cluster's
|
|
34
|
+
* IAM-authentication default).
|
|
35
|
+
*
|
|
36
|
+
* Accepts a concrete {@link ClusterAccessor} or a {@link Ref} to one, so the
|
|
37
|
+
* grant can be declared inside `compose()` rather than wired up in an
|
|
38
|
+
* `afterBuild` hook.
|
|
39
|
+
*
|
|
40
|
+
* @param peer - The principal to grant access to, or a Ref to one.
|
|
41
|
+
* @returns This builder for chaining.
|
|
42
|
+
*/
|
|
43
|
+
allowAccessFrom(peer) {
|
|
44
|
+
this.#accessors.push(peer);
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Adds a custom CloudWatch alarm to be created alongside the recommended
|
|
49
|
+
* alarms. The callback receives an {@link AlarmDefinitionBuilder} scoped to
|
|
50
|
+
* the built cluster; configure it fluently and return it.
|
|
51
|
+
*
|
|
52
|
+
* @param key - A unique key for the alarm (used to generate the alarm id).
|
|
53
|
+
* @param configure - Callback that configures the alarm definition.
|
|
54
|
+
* @returns This builder for chaining.
|
|
55
|
+
*/
|
|
56
|
+
addAlarm(key, configure) {
|
|
57
|
+
this.#customAlarms.push(configure(new cloudwatch_1.AlarmDefinitionBuilder(key)));
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/** @internal — see ADR-0005. */
|
|
61
|
+
[core_1.COPY_STATE](target) {
|
|
62
|
+
target.#vpc = this.#vpc;
|
|
63
|
+
target.#customAlarms.push(...this.#customAlarms);
|
|
64
|
+
target.#accessors.push(...this.#accessors);
|
|
65
|
+
}
|
|
66
|
+
build(scope, id, context) {
|
|
67
|
+
const resolvedVpc = this.#vpc ? (0, core_1.resolve)(this.#vpc, context) : undefined;
|
|
68
|
+
if (!resolvedVpc) {
|
|
69
|
+
throw new Error(`ClusterBuilder "${id}" requires a VPC. Call .vpc() with an IVpc or a Ref to one.`);
|
|
70
|
+
}
|
|
71
|
+
const { recommendedAlarms: alarmConfig, securityGroups: resolvableSgs, clusterParameters, clusterParameterGroup: userParameterGroup, ...clusterProps } = this.props;
|
|
72
|
+
if (clusterProps.instanceType === undefined) {
|
|
73
|
+
throw new Error(`ClusterBuilder "${id}" requires an instance type. Call .instanceType() with a ` +
|
|
74
|
+
`provisioned class (e.g. InstanceType.R6G_LARGE) or InstanceType.SERVERLESS ` +
|
|
75
|
+
`paired with .serverlessScalingConfiguration().`);
|
|
76
|
+
}
|
|
77
|
+
if (userParameterGroup !== undefined && clusterParameters !== undefined) {
|
|
78
|
+
throw new Error(`ClusterBuilder "${id}": .clusterParameters() cannot be combined with a ` +
|
|
79
|
+
`user-managed .clusterParameterGroup() — the supplied group is not mutated by ` +
|
|
80
|
+
`this builder. Set the parameters on your own group instead.`);
|
|
81
|
+
}
|
|
82
|
+
const clusterParameterGroup = userParameterGroup ??
|
|
83
|
+
new aws_neptune_alpha_1.ClusterParameterGroup(scope, `${id}ParameterGroup`, {
|
|
84
|
+
family: (0, cluster_parameter_group_defaults_js_1.clusterParameterGroupFamily)(clusterProps.engineVersion),
|
|
85
|
+
parameters: { ...cluster_parameter_group_defaults_js_1.CLUSTER_PARAMETER_GROUP_DEFAULTS, ...clusterParameters },
|
|
86
|
+
});
|
|
87
|
+
const securityGroups = resolvableSgs?.map((sg) => (0, core_1.resolve)(sg, context));
|
|
88
|
+
const mergedProps = {
|
|
89
|
+
...cluster_defaults_js_1.CLUSTER_DEFAULTS,
|
|
90
|
+
...clusterProps,
|
|
91
|
+
vpc: resolvedVpc,
|
|
92
|
+
clusterParameterGroup,
|
|
93
|
+
...(securityGroups ? { securityGroups } : {}),
|
|
94
|
+
};
|
|
95
|
+
const cluster = new aws_neptune_alpha_1.DatabaseCluster(scope, id, mergedProps);
|
|
96
|
+
for (const resolvable of this.#accessors) {
|
|
97
|
+
const peer = (0, core_1.resolve)(resolvable, context);
|
|
98
|
+
cluster.connections.allowDefaultPortFrom(peer);
|
|
99
|
+
// The IAM `connect` grant is only meaningful when IAM authentication is
|
|
100
|
+
// enabled (the default). If a user has turned it off, opening the
|
|
101
|
+
// network path is the whole grant — a grantConnect policy would be inert.
|
|
102
|
+
if (mergedProps.iamAuthentication !== false) {
|
|
103
|
+
cluster.grantConnect(peer);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const alarms = (0, cluster_alarms_js_1.createClusterAlarms)(scope, id, cluster, alarmConfig, mergedProps.serverlessScalingConfiguration, this.#customAlarms);
|
|
107
|
+
return { cluster, subnetGroup: cluster.subnetGroup, clusterParameterGroup, alarms };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new {@link IClusterBuilder} for configuring an Amazon Neptune
|
|
112
|
+
* cluster.
|
|
113
|
+
*
|
|
114
|
+
* This is the entry point for defining a Neptune component. The returned
|
|
115
|
+
* builder exposes every {@link ClusterBuilderProps} property as a fluent
|
|
116
|
+
* setter/getter, plus {@link IClusterBuilder.vpc | .vpc()} and
|
|
117
|
+
* {@link IClusterBuilder.allowAccessFrom | .allowAccessFrom()} for
|
|
118
|
+
* cross-component wiring with Ref support. It implements {@link Lifecycle}
|
|
119
|
+
* for use with {@link compose}.
|
|
120
|
+
*
|
|
121
|
+
* @returns A fluent builder for an Amazon Neptune cluster.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* const system = compose(
|
|
126
|
+
* {
|
|
127
|
+
* network: createVpcBuilder().maxAzs(2),
|
|
128
|
+
* graph: createClusterBuilder()
|
|
129
|
+
* .vpc(ref<VpcBuilderResult>("network").get("vpc"))
|
|
130
|
+
* .instanceType(InstanceType.SERVERLESS)
|
|
131
|
+
* .serverlessScalingConfiguration({ minCapacity: 1, maxCapacity: 8 }),
|
|
132
|
+
* },
|
|
133
|
+
* { network: [], graph: ["network"] },
|
|
134
|
+
* );
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
function createClusterBuilder() {
|
|
138
|
+
return (0, cloudformation_1.taggedBuilder)(ClusterBuilder);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=cluster-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-builder.js","sourceRoot":"","sources":["../../src/cluster-builder.ts"],"names":[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E,WAAW,CAAC,CAAC;QAE5D,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC1C,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;YAC/C,wEAAwE;YACxE,kEAAkE;YAClE,0EAA0E;YAC1E,IAAI,WAAW,CAAC,iBAAiB,KAAK,KAAK,EAAE,CAAC;gBAC5C,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,uCAAmB,EAChC,KAAK,EACL,EAAE,EACF,OAAO,EACP,WAAW,EACX,WAAW,CAAC,8BAA8B,EAC1C,IAAI,CAAC,aAAa,CACnB,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IACtF,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,oBAAoB;IAClC,OAAO,IAAA,8BAAa,EAAsC,cAAc,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type DatabaseClusterProps } from "@aws-cdk/aws-neptune-alpha";
|
|
2
|
+
/**
|
|
3
|
+
* Secure, AWS-recommended defaults applied to every Neptune cluster built
|
|
4
|
+
* with {@link createClusterBuilder}. Each property can be individually
|
|
5
|
+
* overridden via the builder's fluent API.
|
|
6
|
+
*
|
|
7
|
+
* Every default is anchored first to the AWS Well-Architected Framework
|
|
8
|
+
* (the _why_) and then to the Neptune User Guide (the _how_), matching the
|
|
9
|
+
* citation convention used across the other builder packages.
|
|
10
|
+
*
|
|
11
|
+
* Notably absent: `instanceType`. Defaulting an instance type would create
|
|
12
|
+
* surprise cost, so the builder requires the caller to pick one explicitly
|
|
13
|
+
* (a provisioned class such as `InstanceType.R6G_LARGE`, or
|
|
14
|
+
* `InstanceType.SERVERLESS` paired with `serverlessScalingConfiguration`).
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.aws.amazon.com/prescriptive-guidance/latest/neptune-well-architected-framework/introduction.html
|
|
17
|
+
*/
|
|
18
|
+
export declare const CLUSTER_DEFAULTS: Partial<DatabaseClusterProps>;
|
|
19
|
+
//# sourceMappingURL=cluster-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-defaults.d.ts","sourceRoot":"","sources":["../../src/cluster-defaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAuE1D,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLUSTER_DEFAULTS = void 0;
|
|
4
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
|
+
const aws_logs_1 = require("aws-cdk-lib/aws-logs");
|
|
6
|
+
const aws_neptune_alpha_1 = require("@aws-cdk/aws-neptune-alpha");
|
|
7
|
+
/**
|
|
8
|
+
* Secure, AWS-recommended defaults applied to every Neptune cluster built
|
|
9
|
+
* with {@link createClusterBuilder}. Each property can be individually
|
|
10
|
+
* overridden via the builder's fluent API.
|
|
11
|
+
*
|
|
12
|
+
* Every default is anchored first to the AWS Well-Architected Framework
|
|
13
|
+
* (the _why_) and then to the Neptune User Guide (the _how_), matching the
|
|
14
|
+
* citation convention used across the other builder packages.
|
|
15
|
+
*
|
|
16
|
+
* Notably absent: `instanceType`. Defaulting an instance type would create
|
|
17
|
+
* surprise cost, so the builder requires the caller to pick one explicitly
|
|
18
|
+
* (a provisioned class such as `InstanceType.R6G_LARGE`, or
|
|
19
|
+
* `InstanceType.SERVERLESS` paired with `serverlessScalingConfiguration`).
|
|
20
|
+
*
|
|
21
|
+
* @see https://docs.aws.amazon.com/prescriptive-guidance/latest/neptune-well-architected-framework/introduction.html
|
|
22
|
+
*/
|
|
23
|
+
exports.CLUSTER_DEFAULTS = {
|
|
24
|
+
/**
|
|
25
|
+
* Encrypt the cluster volume at rest. Uses the AWS-managed Neptune key
|
|
26
|
+
* unless a customer-managed key is supplied via `.kmsKey()`.
|
|
27
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_protect_data_rest_encrypt.html
|
|
28
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/encrypt.html
|
|
29
|
+
*/
|
|
30
|
+
storageEncrypted: true,
|
|
31
|
+
/**
|
|
32
|
+
* Require IAM authentication for data-plane connections, removing the
|
|
33
|
+
* need for long-lived static credentials. Pair with `.allowAccessFrom()`
|
|
34
|
+
* (or `cluster.grantConnect()`) to authorise principals.
|
|
35
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/framework/sec-03.html
|
|
36
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth.html
|
|
37
|
+
*/
|
|
38
|
+
iamAuthentication: true,
|
|
39
|
+
/**
|
|
40
|
+
* Retain the cluster on stack deletion/replacement so graph data is not
|
|
41
|
+
* destroyed by an errant `cdk destroy`. Ephemeral/dev stacks override to
|
|
42
|
+
* `RemovalPolicy.DESTROY`.
|
|
43
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/rel_backing_up_data_identified_backups_data.html
|
|
44
|
+
*/
|
|
45
|
+
removalPolicy: aws_cdk_lib_1.RemovalPolicy.RETAIN,
|
|
46
|
+
/**
|
|
47
|
+
* Block accidental deletion of the cluster itself. The CDK L2 would infer
|
|
48
|
+
* this from `RemovalPolicy.RETAIN`; setting it explicitly keeps the
|
|
49
|
+
* security posture auditable rather than implicit.
|
|
50
|
+
* @see https://docs.aws.amazon.com/securityhub/latest/userguide/neptune-controls.html
|
|
51
|
+
*/
|
|
52
|
+
deletionProtection: true,
|
|
53
|
+
/**
|
|
54
|
+
* Retain automated backups for 7 days. The CDK default is 1 day; AWS
|
|
55
|
+
* Well-Architected recommends a longer window for production data.
|
|
56
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/rel_backing_up_data_automated_backups_data.html
|
|
57
|
+
*/
|
|
58
|
+
backupRetention: aws_cdk_lib_1.Duration.days(7),
|
|
59
|
+
/**
|
|
60
|
+
* Export audit logs to CloudWatch Logs. Audit logging is the only log
|
|
61
|
+
* type Neptune exports to CloudWatch, and it only emits once
|
|
62
|
+
* `neptune_enable_audit_log` is set on the cluster parameter group — which
|
|
63
|
+
* the builder's auto-created parameter group does by default.
|
|
64
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_detect_investigate_events_app_service_logging.html
|
|
65
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/auditing.html
|
|
66
|
+
*/
|
|
67
|
+
cloudwatchLogsExports: [aws_neptune_alpha_1.LogType.AUDIT],
|
|
68
|
+
/**
|
|
69
|
+
* Expire exported audit logs after one month, matching the
|
|
70
|
+
* `@composurecdk/logs` retention default rather than keeping them forever.
|
|
71
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/framework/cost-05.html
|
|
72
|
+
*/
|
|
73
|
+
cloudwatchLogsRetention: aws_logs_1.RetentionDays.ONE_MONTH,
|
|
74
|
+
/**
|
|
75
|
+
* Copy cluster tags onto automated snapshots so cost-allocation and
|
|
76
|
+
* ownership tags survive into backups.
|
|
77
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/framework/ops-04.html
|
|
78
|
+
*/
|
|
79
|
+
copyTagsToSnapshot: true,
|
|
80
|
+
/**
|
|
81
|
+
* Apply patched minor engine versions automatically during the
|
|
82
|
+
* maintenance window.
|
|
83
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_protect_compute_validate_software_integrity.html
|
|
84
|
+
*/
|
|
85
|
+
autoMinorVersionUpgrade: true,
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=cluster-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-defaults.js","sourceRoot":"","sources":["../../src/cluster-defaults.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AACtD,mDAAqD;AACrD,kEAAgF;AAEhF;;;;;;;;;;;;;;;GAeG;AACU,QAAA,gBAAgB,GAAkC;IAC7D;;;;;OAKG;IACH,gBAAgB,EAAE,IAAI;IAEtB;;;;;;OAMG;IACH,iBAAiB,EAAE,IAAI;IAEvB;;;;;OAKG;IACH,aAAa,EAAE,2BAAa,CAAC,MAAM;IAEnC;;;;;OAKG;IACH,kBAAkB,EAAE,IAAI;IAExB;;;;OAIG;IACH,eAAe,EAAE,sBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,qBAAqB,EAAE,CAAC,2BAAO,CAAC,KAAK,CAAC;IAEtC;;;;OAIG;IACH,uBAAuB,EAAE,wBAAa,CAAC,SAAS;IAEhD;;;;OAIG;IACH,kBAAkB,EAAE,IAAI;IAExB;;;;OAIG;IACH,uBAAuB,EAAE,IAAI;CAC9B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EngineVersion, ParameterGroupFamily } from "@aws-cdk/aws-neptune-alpha";
|
|
2
|
+
/**
|
|
3
|
+
* Default parameters applied to the cluster parameter group the builder
|
|
4
|
+
* auto-creates when the caller does not supply their own. These change
|
|
5
|
+
* engine behaviour (not just observability), so each is documented and
|
|
6
|
+
* individually overridable via `.clusterParameters({...})`.
|
|
7
|
+
*
|
|
8
|
+
* `neptune_enable_audit_log` is what actually turns audit logging on inside
|
|
9
|
+
* the engine — without it, the `cloudwatchLogsExports: [AUDIT]` cluster
|
|
10
|
+
* default creates an empty log stream. The two defaults are deliberately
|
|
11
|
+
* paired so audit logging works end-to-end out of the box.
|
|
12
|
+
*
|
|
13
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_detect_investigate_events_app_service_logging.html
|
|
14
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/auditing.html#auditing-enable
|
|
15
|
+
*/
|
|
16
|
+
export declare const CLUSTER_PARAMETER_GROUP_DEFAULTS: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Derives the cluster parameter group family from a Neptune engine version.
|
|
19
|
+
*
|
|
20
|
+
* A cluster parameter group must declare a family compatible with the
|
|
21
|
+
* cluster's engine version, or the deploy fails. Rather than make the caller
|
|
22
|
+
* keep the two in sync by hand, the builder derives the family from the
|
|
23
|
+
* `engineVersion` (when set) so the auto-created parameter group is always
|
|
24
|
+
* compatible. When no engine version is pinned, Neptune uses a current
|
|
25
|
+
* 1.4.x engine, so the family defaults to {@link ParameterGroupFamily.NEPTUNE_1_4}.
|
|
26
|
+
*
|
|
27
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html
|
|
28
|
+
*/
|
|
29
|
+
export declare function clusterParameterGroupFamily(engineVersion?: EngineVersion): ParameterGroupFamily;
|
|
30
|
+
//# sourceMappingURL=cluster-parameter-group-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-parameter-group-defaults.d.ts","sourceRoot":"","sources":["../../src/cluster-parameter-group-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEjF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGnE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,oBAAoB,CAgB/F"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLUSTER_PARAMETER_GROUP_DEFAULTS = void 0;
|
|
4
|
+
exports.clusterParameterGroupFamily = clusterParameterGroupFamily;
|
|
5
|
+
const aws_neptune_alpha_1 = require("@aws-cdk/aws-neptune-alpha");
|
|
6
|
+
/**
|
|
7
|
+
* Default parameters applied to the cluster parameter group the builder
|
|
8
|
+
* auto-creates when the caller does not supply their own. These change
|
|
9
|
+
* engine behaviour (not just observability), so each is documented and
|
|
10
|
+
* individually overridable via `.clusterParameters({...})`.
|
|
11
|
+
*
|
|
12
|
+
* `neptune_enable_audit_log` is what actually turns audit logging on inside
|
|
13
|
+
* the engine — without it, the `cloudwatchLogsExports: [AUDIT]` cluster
|
|
14
|
+
* default creates an empty log stream. The two defaults are deliberately
|
|
15
|
+
* paired so audit logging works end-to-end out of the box.
|
|
16
|
+
*
|
|
17
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_detect_investigate_events_app_service_logging.html
|
|
18
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/auditing.html#auditing-enable
|
|
19
|
+
*/
|
|
20
|
+
exports.CLUSTER_PARAMETER_GROUP_DEFAULTS = {
|
|
21
|
+
/** Enable engine audit logging so the audit log export carries data. */
|
|
22
|
+
neptune_enable_audit_log: "1",
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Derives the cluster parameter group family from a Neptune engine version.
|
|
26
|
+
*
|
|
27
|
+
* A cluster parameter group must declare a family compatible with the
|
|
28
|
+
* cluster's engine version, or the deploy fails. Rather than make the caller
|
|
29
|
+
* keep the two in sync by hand, the builder derives the family from the
|
|
30
|
+
* `engineVersion` (when set) so the auto-created parameter group is always
|
|
31
|
+
* compatible. When no engine version is pinned, Neptune uses a current
|
|
32
|
+
* 1.4.x engine, so the family defaults to {@link ParameterGroupFamily.NEPTUNE_1_4}.
|
|
33
|
+
*
|
|
34
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html
|
|
35
|
+
*/
|
|
36
|
+
function clusterParameterGroupFamily(engineVersion) {
|
|
37
|
+
// version strings are "major.minor.patch.build", e.g. "1.4.5.1".
|
|
38
|
+
const [major, minor] = (engineVersion?.version ?? "1.4").split(".");
|
|
39
|
+
const majorMinor = `${major}.${minor}`;
|
|
40
|
+
switch (majorMinor) {
|
|
41
|
+
case "1.0":
|
|
42
|
+
case "1.1":
|
|
43
|
+
return aws_neptune_alpha_1.ParameterGroupFamily.NEPTUNE_1;
|
|
44
|
+
case "1.2":
|
|
45
|
+
return aws_neptune_alpha_1.ParameterGroupFamily.NEPTUNE_1_2;
|
|
46
|
+
case "1.3":
|
|
47
|
+
return aws_neptune_alpha_1.ParameterGroupFamily.NEPTUNE_1_3;
|
|
48
|
+
default:
|
|
49
|
+
// 1.4 and anything newer the builder has not been taught about yet.
|
|
50
|
+
return aws_neptune_alpha_1.ParameterGroupFamily.NEPTUNE_1_4;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=cluster-parameter-group-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-parameter-group-defaults.js","sourceRoot":"","sources":["../../src/cluster-parameter-group-defaults.ts"],"names":[],"mappings":";;;AAiCA,kEAgBC;AAjDD,kEAAiF;AAEjF;;;;;;;;;;;;;GAaG;AACU,QAAA,gCAAgC,GAA2B;IACtE,wEAAwE;IACxE,wBAAwB,EAAE,GAAG;CAC9B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,SAAgB,2BAA2B,CAAC,aAA6B;IACvE,iEAAiE;IACjE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC;IACvC,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,OAAO,wCAAoB,CAAC,SAAS,CAAC;QACxC,KAAK,KAAK;YACR,OAAO,wCAAoB,CAAC,WAAW,CAAC;QAC1C,KAAK,KAAK;YACR,OAAO,wCAAoB,CAAC,WAAW,CAAC;QAC1C;YACE,oEAAoE;YACpE,OAAO,wCAAoB,CAAC,WAAW,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createClusterBuilder, type ClusterAccessor, type ClusterBuilderProps, type ClusterBuilderResult, type IClusterBuilder, } from "./cluster-builder.js";
|
|
2
|
+
export { CLUSTER_DEFAULTS } from "./cluster-defaults.js";
|
|
3
|
+
export { CLUSTER_PARAMETER_GROUP_DEFAULTS, clusterParameterGroupFamily, } from "./cluster-parameter-group-defaults.js";
|
|
4
|
+
export { type NeptuneClusterAlarmConfig } from "./cluster-alarm-config.js";
|
|
5
|
+
export { CLUSTER_ALARM_DEFAULTS } from "./cluster-alarm-defaults.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLUSTER_ALARM_DEFAULTS = exports.clusterParameterGroupFamily = exports.CLUSTER_PARAMETER_GROUP_DEFAULTS = exports.CLUSTER_DEFAULTS = exports.createClusterBuilder = void 0;
|
|
4
|
+
var cluster_builder_js_1 = require("./cluster-builder.js");
|
|
5
|
+
Object.defineProperty(exports, "createClusterBuilder", { enumerable: true, get: function () { return cluster_builder_js_1.createClusterBuilder; } });
|
|
6
|
+
var cluster_defaults_js_1 = require("./cluster-defaults.js");
|
|
7
|
+
Object.defineProperty(exports, "CLUSTER_DEFAULTS", { enumerable: true, get: function () { return cluster_defaults_js_1.CLUSTER_DEFAULTS; } });
|
|
8
|
+
var cluster_parameter_group_defaults_js_1 = require("./cluster-parameter-group-defaults.js");
|
|
9
|
+
Object.defineProperty(exports, "CLUSTER_PARAMETER_GROUP_DEFAULTS", { enumerable: true, get: function () { return cluster_parameter_group_defaults_js_1.CLUSTER_PARAMETER_GROUP_DEFAULTS; } });
|
|
10
|
+
Object.defineProperty(exports, "clusterParameterGroupFamily", { enumerable: true, get: function () { return cluster_parameter_group_defaults_js_1.clusterParameterGroupFamily; } });
|
|
11
|
+
var cluster_alarm_defaults_js_1 = require("./cluster-alarm-defaults.js");
|
|
12
|
+
Object.defineProperty(exports, "CLUSTER_ALARM_DEFAULTS", { enumerable: true, get: function () { return cluster_alarm_defaults_js_1.CLUSTER_ALARM_DEFAULTS; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2DAM8B;AAL5B,0HAAA,oBAAoB,OAAA;AAMtB,6DAAyD;AAAhD,uHAAA,gBAAgB,OAAA;AACzB,6FAG+C;AAF7C,uJAAA,gCAAgC,OAAA;AAChC,kJAAA,2BAA2B,OAAA;AAG7B,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA"}
|