Skip to content

Commit ed1e1e4

Browse files
authored
chore: Replace old POC for Neptune with the real deal (#848)
The Neptune package that was provided so far was the result of a proof-of-concept that was made before the eventual Neptune API was made available. Replacing this with the generated L1 for Neptune, that would otherwise not have been available at all. Fixes #807
1 parent 3d1095e commit ed1e1e4

File tree

9 files changed

+19807
-259
lines changed

9 files changed

+19807
-259
lines changed

examples/cdk-examples-typescript/neptune-demo/cdk.json

-21
This file was deleted.

examples/cdk-examples-typescript/neptune-demo/index.ts

-33
This file was deleted.
+7-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
*.d.ts
2+
*.generated.ts
13
*.js
2-
tsconfig.json
3-
tslint.json
44
*.js.map
5-
*.d.ts
6-
dist
7-
lib/generated/resources.ts
85
.jsii
9-
106
.LAST_BUILD
7+
.LAST_PACKAGE
8+
.nycrc
119
.nyc_output
1210
coverage
13-
.nycrc
14-
.LAST_PACKAGE
11+
dist
12+
tsconfig.json
13+
tslint.json
+9-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Don't include original .ts files when doing `npm pack`
1+
# The basics
22
*.ts
3+
*.tgz
34
!*.d.ts
5+
!*.js
6+
7+
# Coverage
48
coverage
59
.nyc_output
6-
*.tgz
10+
.nycrc
711

12+
# Build gear
813
dist
9-
.LAST_PACKAGE
1014
.LAST_BUILD
11-
!*.js
12-
13-
# Include .jsii
14-
!.jsii
15+
.LAST_PACKAGE
16+
.jsii
+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
## CDK Constructs for AWS Neptune
2-
This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project.
1+
## AWS Neptune Construct Library
2+
3+
```ts
4+
const neptune = require('@aws-cdk/aws-neptune');
5+
```
+2-142
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,2 @@
1-
import ec2 = require('@aws-cdk/aws-ec2');
2-
import rds = require('@aws-cdk/aws-rds');
3-
import cdk = require('@aws-cdk/cdk');
4-
5-
/**
6-
* Properties for a Neptune Graph Database Cluster
7-
*/
8-
export interface NeptuneDatabaseProps {
9-
/**
10-
* How many replicas/instances to create
11-
*
12-
* Has to be at least 1. Default is 2.
13-
*
14-
* @default 2
15-
*/
16-
instances?: number;
17-
18-
/**
19-
* Settings for the individual instances that are launched
20-
*/
21-
instanceProps: rds.InstanceProps;
22-
23-
/**
24-
* Username and password for the administrative user
25-
*/
26-
masterUser: rds.Login;
27-
28-
/**
29-
* What port to listen on
30-
*
31-
* @default 3306
32-
*/
33-
port?: number;
34-
35-
/**
36-
* An optional identifier for the cluster
37-
*
38-
* If not given, a name is generated.
39-
*/
40-
clusterIdentifier?: string;
41-
42-
/**
43-
* Base identifier for instances
44-
*
45-
* Every replica is named by appending the replica number to this string, 1-based.
46-
*
47-
* If not given, the clusterIdentifier is used with the word "Instance" appended.
48-
*
49-
* If clusterIdentifier is also not given, the identifier is automatically generated.
50-
*/
51-
instanceIdentifierBase?: string;
52-
53-
/**
54-
* Name of a database which is automatically created inside the cluster
55-
*
56-
* If not given, no database is created.
57-
*/
58-
defaultDatabaseName?: string;
59-
60-
/**
61-
* ARN of KMS key if you want to enable storage encryption
62-
*/
63-
kmsKeyArn?: string;
64-
65-
/**
66-
* A daily time range in 24-hours UTC format in which backups preferably execute.
67-
*
68-
* Must be at least 30 minutes long.
69-
*
70-
* Example: '01:00-02:00'
71-
*
72-
* If not given, an window is randomly.
73-
*/
74-
preferredMaintenanceWindow?: string;
75-
76-
/**
77-
* Parameter group with Neptune settings
78-
*
79-
* @default No parameter group
80-
*/
81-
parameterGroup?: rds.ClusterParameterGroupRef;
82-
}
83-
84-
/**
85-
* Neptune Graph Database cluster
86-
*
87-
* Creates a new Neptune database cluster with a given number of replicas.
88-
*/
89-
export class NeptuneDatabase extends cdk.Construct implements ec2.IConnectable {
90-
/**
91-
* Identifier of the cluster
92-
*/
93-
public readonly clusterIdentifier: string;
94-
95-
/**
96-
* Identifiers of the replicas
97-
*/
98-
public readonly instanceIdentifiers: string[] = [];
99-
100-
/**
101-
* The endpoint to use for read/write operations
102-
*/
103-
public readonly clusterEndpoint: rds.Endpoint;
104-
105-
/**
106-
* Endpoint to use for load-balanced read-only operations.
107-
*/
108-
public readonly readerEndpoint: rds.Endpoint;
109-
110-
/**
111-
* Endpoints which address each individual replica.
112-
*/
113-
public readonly instanceEndpoints: rds.Endpoint[] = [];
114-
115-
public readonly connections: ec2.Connections;
116-
117-
private readonly cluster: rds.DatabaseCluster;
118-
119-
constructor(parent: cdk.Construct, name: string, props: NeptuneDatabaseProps) {
120-
super(parent, name);
121-
122-
this.cluster = new rds.DatabaseCluster(this, 'Cluster', {
123-
engine: rds.DatabaseClusterEngine.Aurora,
124-
instances: props.instances,
125-
instanceProps: props.instanceProps,
126-
masterUser: props.masterUser,
127-
port: props.port,
128-
clusterIdentifier: props.clusterIdentifier,
129-
instanceIdentifierBase: props.instanceIdentifierBase,
130-
defaultDatabaseName: props.defaultDatabaseName,
131-
kmsKeyArn: props.kmsKeyArn,
132-
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
133-
parameterGroup: props.parameterGroup,
134-
});
135-
136-
this.clusterIdentifier = this.cluster.clusterIdentifier;
137-
this.instanceIdentifiers = this.cluster.instanceIdentifiers;
138-
this.clusterEndpoint = this.cluster.clusterEndpoint;
139-
this.readerEndpoint = this.cluster.readerEndpoint;
140-
this.connections = this.cluster.connections;
141-
}
142-
}
1+
// AWS::Neptune CloudFormation Resources:
2+
export * from './neptune.generated';

0 commit comments

Comments
 (0)