-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
3d1095e
commit ed1e1e4
Showing
9 changed files
with
19,807 additions
and
259 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
*.d.ts | ||
*.generated.ts | ||
*.js | ||
tsconfig.json | ||
tslint.json | ||
*.js.map | ||
*.d.ts | ||
dist | ||
lib/generated/resources.ts | ||
.jsii | ||
|
||
.LAST_BUILD | ||
.LAST_PACKAGE | ||
.nycrc | ||
.nyc_output | ||
coverage | ||
.nycrc | ||
.LAST_PACKAGE | ||
dist | ||
tsconfig.json | ||
tslint.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
# Don't include original .ts files when doing `npm pack` | ||
# The basics | ||
*.ts | ||
*.tgz | ||
!*.d.ts | ||
!*.js | ||
|
||
# Coverage | ||
coverage | ||
.nyc_output | ||
*.tgz | ||
.nycrc | ||
|
||
# Build gear | ||
dist | ||
.LAST_PACKAGE | ||
.LAST_BUILD | ||
!*.js | ||
|
||
# Include .jsii | ||
!.jsii | ||
.LAST_PACKAGE | ||
.jsii |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
## CDK Constructs for AWS Neptune | ||
This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project. | ||
## AWS Neptune Construct Library | ||
|
||
```ts | ||
const neptune = require('@aws-cdk/aws-neptune'); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,2 @@ | ||
import ec2 = require('@aws-cdk/aws-ec2'); | ||
import rds = require('@aws-cdk/aws-rds'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
|
||
/** | ||
* Properties for a Neptune Graph Database Cluster | ||
*/ | ||
export interface NeptuneDatabaseProps { | ||
/** | ||
* How many replicas/instances to create | ||
* | ||
* Has to be at least 1. Default is 2. | ||
* | ||
* @default 2 | ||
*/ | ||
instances?: number; | ||
|
||
/** | ||
* Settings for the individual instances that are launched | ||
*/ | ||
instanceProps: rds.InstanceProps; | ||
|
||
/** | ||
* Username and password for the administrative user | ||
*/ | ||
masterUser: rds.Login; | ||
|
||
/** | ||
* What port to listen on | ||
* | ||
* @default 3306 | ||
*/ | ||
port?: number; | ||
|
||
/** | ||
* An optional identifier for the cluster | ||
* | ||
* If not given, a name is generated. | ||
*/ | ||
clusterIdentifier?: string; | ||
|
||
/** | ||
* Base identifier for instances | ||
* | ||
* Every replica is named by appending the replica number to this string, 1-based. | ||
* | ||
* If not given, the clusterIdentifier is used with the word "Instance" appended. | ||
* | ||
* If clusterIdentifier is also not given, the identifier is automatically generated. | ||
*/ | ||
instanceIdentifierBase?: string; | ||
|
||
/** | ||
* Name of a database which is automatically created inside the cluster | ||
* | ||
* If not given, no database is created. | ||
*/ | ||
defaultDatabaseName?: string; | ||
|
||
/** | ||
* ARN of KMS key if you want to enable storage encryption | ||
*/ | ||
kmsKeyArn?: string; | ||
|
||
/** | ||
* A daily time range in 24-hours UTC format in which backups preferably execute. | ||
* | ||
* Must be at least 30 minutes long. | ||
* | ||
* Example: '01:00-02:00' | ||
* | ||
* If not given, an window is randomly. | ||
*/ | ||
preferredMaintenanceWindow?: string; | ||
|
||
/** | ||
* Parameter group with Neptune settings | ||
* | ||
* @default No parameter group | ||
*/ | ||
parameterGroup?: rds.ClusterParameterGroupRef; | ||
} | ||
|
||
/** | ||
* Neptune Graph Database cluster | ||
* | ||
* Creates a new Neptune database cluster with a given number of replicas. | ||
*/ | ||
export class NeptuneDatabase extends cdk.Construct implements ec2.IConnectable { | ||
/** | ||
* Identifier of the cluster | ||
*/ | ||
public readonly clusterIdentifier: string; | ||
|
||
/** | ||
* Identifiers of the replicas | ||
*/ | ||
public readonly instanceIdentifiers: string[] = []; | ||
|
||
/** | ||
* The endpoint to use for read/write operations | ||
*/ | ||
public readonly clusterEndpoint: rds.Endpoint; | ||
|
||
/** | ||
* Endpoint to use for load-balanced read-only operations. | ||
*/ | ||
public readonly readerEndpoint: rds.Endpoint; | ||
|
||
/** | ||
* Endpoints which address each individual replica. | ||
*/ | ||
public readonly instanceEndpoints: rds.Endpoint[] = []; | ||
|
||
public readonly connections: ec2.Connections; | ||
|
||
private readonly cluster: rds.DatabaseCluster; | ||
|
||
constructor(parent: cdk.Construct, name: string, props: NeptuneDatabaseProps) { | ||
super(parent, name); | ||
|
||
this.cluster = new rds.DatabaseCluster(this, 'Cluster', { | ||
engine: rds.DatabaseClusterEngine.Aurora, | ||
instances: props.instances, | ||
instanceProps: props.instanceProps, | ||
masterUser: props.masterUser, | ||
port: props.port, | ||
clusterIdentifier: props.clusterIdentifier, | ||
instanceIdentifierBase: props.instanceIdentifierBase, | ||
defaultDatabaseName: props.defaultDatabaseName, | ||
kmsKeyArn: props.kmsKeyArn, | ||
preferredMaintenanceWindow: props.preferredMaintenanceWindow, | ||
parameterGroup: props.parameterGroup, | ||
}); | ||
|
||
this.clusterIdentifier = this.cluster.clusterIdentifier; | ||
this.instanceIdentifiers = this.cluster.instanceIdentifiers; | ||
this.clusterEndpoint = this.cluster.clusterEndpoint; | ||
this.readerEndpoint = this.cluster.readerEndpoint; | ||
this.connections = this.cluster.connections; | ||
} | ||
} | ||
// AWS::Neptune CloudFormation Resources: | ||
export * from './neptune.generated'; |
Oops, something went wrong.