Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace old POC for Neptune with the real deal #848

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions examples/cdk-examples-typescript/neptune-demo/cdk.json

This file was deleted.

33 changes: 0 additions & 33 deletions examples/cdk-examples-typescript/neptune-demo/index.ts

This file was deleted.

15 changes: 7 additions & 8 deletions packages/@aws-cdk/aws-neptune/.gitignore
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
16 changes: 9 additions & 7 deletions packages/@aws-cdk/aws-neptune/.npmignore
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
7 changes: 5 additions & 2 deletions packages/@aws-cdk/aws-neptune/README.md
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');
```
144 changes: 2 additions & 142 deletions packages/@aws-cdk/aws-neptune/lib/index.ts
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';
Loading