diff --git a/examples/cdk-examples-java/.gitignore b/examples/cdk-examples-java/.gitignore new file mode 100644 index 0000000000000..f7683cfb55edf --- /dev/null +++ b/examples/cdk-examples-java/.gitignore @@ -0,0 +1 @@ +!*.t.js diff --git a/examples/cdk-examples-java/README.md b/examples/cdk-examples-java/README.md new file mode 100644 index 0000000000000..fac78b184efa4 --- /dev/null +++ b/examples/cdk-examples-java/README.md @@ -0,0 +1,51 @@ +# CDK Java Example + +This an example of a CDK program written in Java. + +> NOTE: Since this example currently resides inside the CDK repository, it takes + a dependency on the CDK for Java maven package that's built under + `packages/aws-cdk-java`. To enable this, we generate the `pom.xml` file, so we + can plug in the locations of the local maven repositories. This is not + something you will need to do if you are simply using the published CDK maven + package. + +## Building + +To build this app, run `npm run prepare`. This will: + +1. Generate `project/pom.xml` with correct references to jsii and CDK + dependencies. +2. Run `mvn package`, which will compile, test and assemble an executable jar. + +## IDE + +Once the `pom.xml` file is generated, the [`./project`](./project) directory is +fully functional Maven project, and you should be able to open it from any Java +IDE which supports Maven. + +You can use the IDE to write code and unit tests, but you will need to use the +CDK toolkit if you wish to synthesize/deploy stacks. + +## CDK Toolkit + +The [`cdk.json`](./cdk.json) file in the root of this repository includes +instructions for the CDK toolkit on how to execute this program. Specifically, +it will use `java -jar app` for the `--app` switch. This means, +you should be able to use the toolkit normally: + +``` +$ cdk ls + + +$ cdk synth + + +$ cdk deploy + + +$ cdk diff + +``` + +If you make modifications, make sure to rebuild the app, either by callign `mvn +package` from `./project` or `npm run prepare` from the root. diff --git a/examples/cdk-examples-java/cdk.json b/examples/cdk-examples-java/cdk.json new file mode 100644 index 0000000000000..519ddcb2d6b71 --- /dev/null +++ b/examples/cdk-examples-java/cdk.json @@ -0,0 +1,3 @@ +{ + "app": "java -jar project/target/cdk-examples-java-0.7.2-beta-jar-with-dependencies.jar app" +} diff --git a/examples/cdk-examples-java/generate.sh b/examples/cdk-examples-java/generate.sh new file mode 100755 index 0000000000000..31c29d97a34d7 --- /dev/null +++ b/examples/cdk-examples-java/generate.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -euo pipefail +node ./pom.xml.t.js > project/pom.xml diff --git a/examples/cdk-examples-java/package.json b/examples/cdk-examples-java/package.json new file mode 100644 index 0000000000000..8f153d39aa649 --- /dev/null +++ b/examples/cdk-examples-java/package.json @@ -0,0 +1,30 @@ +{ + "name": "cdk-examples-java", + "version": "0.7.2-beta", + "description": "CDK examples in Java", + "private": true, + "repository": { + "type": "git", + "url": "git://github.com/awslabs/aws-cdk" + }, + "pkglint": { + "ignore": true + }, + "scripts": { + "prepare": "/bin/bash generate.sh && cd project && mvn package", + "cdk": "cdk", + "test": "echo ok" + }, + "author": { + "name": "Amazon Web Services", + "url": "https://aws.amazon.com" + }, + "license": "Apache-2.0", + "dependencies": { + "aws-cdk-java": "^0.7.2-beta" + }, + "devDependencies": { + "aws-cdk": "^0.7.2-beta", + "pkgtools": "^0.7.2-beta" + } +} diff --git a/examples/cdk-examples-java/pom.xml.t.js b/examples/cdk-examples-java/pom.xml.t.js new file mode 100644 index 0000000000000..a608d260dbd50 --- /dev/null +++ b/examples/cdk-examples-java/pom.xml.t.js @@ -0,0 +1,117 @@ +const path = require('path'); +const version = require('./package.json').version; + +const mavenFromNpm = name => ({ + version: require(`${name}/package.json`).version, + repo: path.join(path.dirname(require.resolve(name)), 'maven-repo'), +}); + +const cdk = mavenFromNpm('aws-cdk-java'); +const jsii = mavenFromNpm('jsii-java-runtime'); + +process.stdout.write(` + + + + + 4.0.0 + + + + cdk + file://${cdk.repo} + + + jsii + file://${jsii.repo} + + + + com.amazonaws.cdk + cdk-examples-java + ${version} + + + UTF-8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.1.0 + + + jar-with-dependencies + + + + com.amazonaws.cdk.examples.HelloJavaApp + + + + + + make-assembly + package + + single + + + + + + + + + + + com.amazonaws + jsii-runtime + ${jsii.version} + + + + com.amazonaws.cdk + aws-cdk + ${cdk.version} + + + + + com.fasterxml.jackson.core + jackson-core + 2.9.5 + + + + + com.fasterxml.jackson.core + jackson-databind + 2.9.5 + + + + + junit + junit + 4.12 + test + + + + + + +`); \ No newline at end of file diff --git a/examples/cdk-examples-java/project/.gitignore b/examples/cdk-examples-java/project/.gitignore new file mode 100644 index 0000000000000..84c84c4f13d2f --- /dev/null +++ b/examples/cdk-examples-java/project/.gitignore @@ -0,0 +1,9 @@ +target + +# generated by pom.xml.t.js +pom.xml + +.idea +.classpath +.project +.settings diff --git a/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/HelloJavaApp.java b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/HelloJavaApp.java new file mode 100644 index 0000000000000..720743daa9b2d --- /dev/null +++ b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/HelloJavaApp.java @@ -0,0 +1,15 @@ +package com.amazonaws.cdk.examples; + +import com.amazonaws.cdk.App; + +import java.util.Arrays; + +public class HelloJavaApp { + public static void main(final String[] args) { + App app = new App(Arrays.asList(args)); + + new HelloJavaStack(app, "hello-cdk"); + + System.out.println(app.run()); + } +} \ No newline at end of file diff --git a/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/HelloJavaStack.java b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/HelloJavaStack.java new file mode 100644 index 0000000000000..1eb463a6cae04 --- /dev/null +++ b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/HelloJavaStack.java @@ -0,0 +1,66 @@ +package com.amazonaws.cdk.examples; + +import com.amazonaws.cdk.App; +import com.amazonaws.cdk.Stack; +import com.amazonaws.cdk.StackProps; +import com.amazonaws.cdk.Construct; +import com.amazonaws.cdk.ec2.Fleet; +import com.amazonaws.cdk.ec2.FleetProps; +import com.amazonaws.cdk.ec2.InstanceType; +import com.amazonaws.cdk.ec2.VpcNetwork; +import com.amazonaws.cdk.ec2.WindowsImage; +import com.amazonaws.cdk.ec2.WindowsVersion; +import com.amazonaws.cdk.resources.s3.BucketResource; +import com.amazonaws.cdk.resources.s3.BucketResourceProps; +import com.amazonaws.cdk.sns.Topic; +import com.amazonaws.cdk.sqs.Queue; +import com.amazonaws.cdk.sqs.QueueProps; + +import java.util.Collections; +import java.util.List; + +/** + * Hello, CDK for Java! + */ +class HelloJavaStack extends Stack { + public HelloJavaStack(final App parent, final String name) { + super(parent, name); + + VpcNetwork vpc = new VpcNetwork(this, "VPC"); + + MyFleetProps fleetProps = new MyFleetProps(); + fleetProps.vpc = vpc; + + int topicCount = 5; + + SinkQueue sinkQueue = new SinkQueue(this, "MySinkQueue", SinkQueueProps.builder().withRequiredTopicCount(5).build()); + + for (int i = 0; i < topicCount; ++i) { + sinkQueue.subscribe(new Topic(this, "Topic" + (i+1))); + } + + new MyFleet(this, "MyFleet", fleetProps); + } + + static class MyFleetProps { + public VpcNetwork vpc; + } + + static class MyFleet extends Construct { + MyFleet(final Construct parent, final String name, final MyFleetProps props) { + super(parent, name); + + new Fleet(this, "Compute", FleetProps.builder() + .withInstanceType(new InstanceType("t2.micro")) + .withMachineImage(new WindowsImage(WindowsVersion.WindowsServer2016EnglishNanoBase)) + .withVpc(props.vpc) + .build()); + } + + @Override + public List validate() { + System.err.println("Validating MyFleet..."); + return Collections.emptyList(); + } + } +} \ No newline at end of file diff --git a/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/SinkQueue.java b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/SinkQueue.java new file mode 100644 index 0000000000000..5af71d425fd6a --- /dev/null +++ b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/SinkQueue.java @@ -0,0 +1,80 @@ +package com.amazonaws.cdk.examples; + +import com.amazonaws.cdk.Construct; +import com.amazonaws.cdk.sns.Topic; +import com.amazonaws.cdk.sqs.Queue; +import com.amazonaws.cdk.sqs.QueueProps; + +import java.util.Arrays; +import java.util.List; + +/** + * A sink queue is a queue aggregates messages published to any number of SNS topics. + */ +public class SinkQueue extends Construct { + private final Queue queue; + private final int expectedTopicCount; + + private int actualTopicCount = 0; + + /** + * Defines a SinkQueue. + * + * @param parent Parent construct + * @param name Logical name + * @param props Props + */ + public SinkQueue(final Construct parent, final String name, SinkQueueProps props) { + super(parent, name); + + // ensure props is non-null + props = props != null ? props : SinkQueueProps.builder().build(); + + // defaults + QueueProps queueProps = props.getQueueProps(); + this.expectedTopicCount = props.getRequiredTopicCount() != null ? props.getRequiredTopicCount().intValue() : 10; + + // WORKAROUND: https://github.com/awslabs/aws-cdk/issues/157 + if (queueProps == null) { + queueProps = QueueProps.builder().build(); + } + + this.queue = new Queue(this, "Resource", queueProps); + } + + /** + * Defines a SinkQueue with default props. + * @param parent Parent construct + * @param name Logical name + */ + public SinkQueue(final Construct parent, final String name) { + this(parent, name, null); + } + + /** + * Subscribes this queue to receive messages published to the specified topics. + * + * @param topics The topics to subscribe to + */ + public void subscribe(final Topic... topics) { + for (Topic topic: topics) { + if (actualTopicCount == expectedTopicCount) { + throw new RuntimeException("Cannot add more topics to the sink. Maximum topics is configured to " + this.expectedTopicCount); + } + topic.subscribeQueue(this.queue); + actualTopicCount++; + } + } + + @Override + public List validate() { + if (actualTopicCount < expectedTopicCount) { + return Arrays.asList( + "There are not enough subscribers to the sink. Expecting " + + this.expectedTopicCount + + ", actual is " + this.actualTopicCount); + } + + return super.validate(); + } +} diff --git a/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/SinkQueueProps.java b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/SinkQueueProps.java new file mode 100644 index 0000000000000..35aba61e767e2 --- /dev/null +++ b/examples/cdk-examples-java/project/src/main/java/com/amazonaws/cdk/examples/SinkQueueProps.java @@ -0,0 +1,67 @@ +package com.amazonaws.cdk.examples; + +import com.amazonaws.cdk.sqs.QueueProps; + +/** + * Props for {@link SinkQueue}. + */ +public class SinkQueueProps { + private QueueProps queueProps; + private Number requiredTopicCount; + + /** + * @return A builder for {@link SinkQueueProps}. + */ + public static SinkQueuePropsBuilder builder() { + return new SinkQueuePropsBuilder(); + } + + /** + * The exact number of topics required to subscribe to the queue. + * You must call {@link SinkQueue::subscribe} to subscribe topics to this queue. + * @default 0 + */ + public Number getRequiredTopicCount() { + return requiredTopicCount; + } + + /** + * Props for the queue itself + * @default See {@link com.amazonaws.cdk.sqs.Queue} defaults + */ + public QueueProps getQueueProps() { + return queueProps; + } + + /** + * Builder for {@link SinkQueue}. + */ + public static final class SinkQueuePropsBuilder { + private QueueProps queueProps; + private Number requiredTopicCount; + + private SinkQueuePropsBuilder() { + } + + public static SinkQueuePropsBuilder aSinkQueueProps() { + return new SinkQueuePropsBuilder(); + } + + public SinkQueuePropsBuilder withQueueProps(QueueProps queueProps) { + this.queueProps = queueProps; + return this; + } + + public SinkQueuePropsBuilder withRequiredTopicCount(Number requiredTopicCount) { + this.requiredTopicCount = requiredTopicCount; + return this; + } + + public SinkQueueProps build() { + SinkQueueProps sinkQueueProps = new SinkQueueProps(); + sinkQueueProps.requiredTopicCount = this.requiredTopicCount; + sinkQueueProps.queueProps = this.queueProps; + return sinkQueueProps; + } + } +} diff --git a/examples/cdk-examples-java/project/src/test/java/com/amazonaws/cdk/examples/SinkQueueTest.java b/examples/cdk-examples-java/project/src/test/java/com/amazonaws/cdk/examples/SinkQueueTest.java new file mode 100644 index 0000000000000..bb7d970e5d3c8 --- /dev/null +++ b/examples/cdk-examples-java/project/src/test/java/com/amazonaws/cdk/examples/SinkQueueTest.java @@ -0,0 +1,117 @@ +package com.amazonaws.cdk.examples; + +import com.amazonaws.cdk.App; +import com.amazonaws.cdk.Stack; +import com.amazonaws.cdk.sns.Topic; +import com.amazonaws.cdk.sqs.QueueProps; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.jsii.JsiiException; +import org.junit.Test; + +import java.io.IOException; +import java.net.URL; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class SinkQueueTest { + + private static ObjectMapper JSON = new ObjectMapper(); + + /** Defines a queue sink with default props */ + @Test public void testDefaults() throws IOException { + Stack stack = new Stack(); + new SinkQueue(stack, "MySinkQueue"); + assertTemplate(stack, "{\"Resources\":{\"MySinkQueueEFCD79C2\":{\"Type\":\"AWS::SQS::Queue\"}}}"); + } + + /** Defines a sink with custom queue props */ + @Test public void testQueueProps() throws IOException { + Stack stack = new Stack(); + new SinkQueue(stack, "MySinkQueue", SinkQueueProps.builder() + .withQueueProps(QueueProps.builder() + .withVisibilityTimeoutSec(500) + .build()) + .build()); + assertTemplate(stack, "{\n" + + " \"Resources\" : {\n" + + " \"MySinkQueueEFCD79C2\" : {\n" + + " \"Type\" : \"AWS::SQS::Queue\",\n" + + " \"Properties\" : {\n" + + " \"VisibilityTimeout\" : 500\n" + + " }\n" + + " }\n" + + " }\n" + + "}"); + } + + /** Calls "subscribe" to add topics to the sink */ + @Test public void testSubscribeTopics() throws IOException { + Stack stack = new Stack(); + + SinkQueue sink = new SinkQueue(stack, "MySinkQueue"); + + // add three topics in two calls to "subscribe" + sink.subscribe(new Topic(stack, "Topic1"), new Topic(stack, "Topic2")); + sink.subscribe(new Topic(stack, "Topic3")); + + assertTemplate(stack, getClass().getResource("testSubscribeTopics.expected.json")); + } + + /** Verifies that if we exceed the number of allows topics, an exception is thrown */ + @Test public void failsIfExceedMaxTopic() { + Stack stack = new Stack(); + + SinkQueue sink = new SinkQueue(stack, "MySinkQueue", SinkQueueProps.builder() + .withRequiredTopicCount(3) + .build()); + + sink.subscribe(new Topic(stack, "Topic1")); + sink.subscribe(new Topic(stack, "Topic2")); + sink.subscribe(new Topic(stack, "Topic3")); + + boolean thrown = false; + try { + sink.subscribe(new Topic(stack, "Topic4")); + } catch (RuntimeException e) { + thrown = true; + } + assertTrue(thrown); + } + + /** Verifies that the sink queue validates that the exact number of subscribers was added */ + @Test(expected = JsiiException.class) public void failsIfNotEnoughTopics() { + App app = new App(); + Stack stack = new Stack(app, "test"); + + SinkQueue sink = new SinkQueue(stack, "MySinkQueue", SinkQueueProps.builder() + .withRequiredTopicCount(80).build()); + + for (int i = 0; i < 77; ++i) { + sink.subscribe(new Topic(stack, "Topic" + i)); + } + + app.synthesizeStack(stack.getName()); + } + + private static void assertTemplate(final Stack stack, final URL expectedResource) throws IOException { + assertTemplate(stack, JSON.readTree(expectedResource)); + } + + private static void assertTemplate(final Stack stack, final String expectedTemplate) throws IOException { + assertTemplate(stack, JSON.readTree(expectedTemplate)); + } + + private static void assertTemplate(final Stack stack, final JsonNode expected) throws IOException { + JsonNode actual = JSON.valueToTree(stack.toCloudFormation()); + + // print to stderr if non-equal, so it will be easy to grab + if (expected == null || !expected.equals(actual)) { + String prettyActual = JSON.writerWithDefaultPrettyPrinter().writeValueAsString(actual); + System.err.println(prettyActual); + } + + assertEquals(expected, actual); + } +} \ No newline at end of file diff --git a/examples/cdk-examples-java/project/src/test/resources/com/amazonaws/cdk/examples/testSubscribeTopics.expected.json b/examples/cdk-examples-java/project/src/test/resources/com/amazonaws/cdk/examples/testSubscribeTopics.expected.json new file mode 100644 index 0000000000000..7c28ee9e0148a --- /dev/null +++ b/examples/cdk-examples-java/project/src/test/resources/com/amazonaws/cdk/examples/testSubscribeTopics.expected.json @@ -0,0 +1,112 @@ +{ + "Resources" : { + "Topic3DEAE47A7" : { + "Type" : "AWS::SNS::Topic" + }, + "MySinkQueueEFCD79C2" : { + "Type" : "AWS::SQS::Queue" + }, + "Topic1ResourceSubscriptionD55B1556" : { + "Type" : "AWS::SNS::Subscription", + "Properties" : { + "Endpoint" : { + "Fn::GetAtt" : [ "MySinkQueueEFCD79C2", "Arn" ] + }, + "TopicArn" : { + "Ref" : "Topic198E71B3E" + }, + "Protocol" : "sqs" + } + }, + "MySinkQueuePolicy3E2D0B9E" : { + "Type" : "AWS::SQS::QueuePolicy", + "Properties" : { + "PolicyDocument" : { + "Version" : "2012-10-17", + "Statement" : [ { + "Condition" : { + "ArnEquals" : { + "aws:SourceArn" : { + "Ref" : "Topic198E71B3E" + } + } + }, + "Action" : "sqs:SendMessage", + "Resource" : { + "Fn::GetAtt" : [ "MySinkQueueEFCD79C2", "Arn" ] + }, + "Effect" : "Allow", + "Principal" : { + "Service" : "sns.amazonaws.com" + } + }, { + "Condition" : { + "ArnEquals" : { + "aws:SourceArn" : { + "Ref" : "Topic269377B75" + } + } + }, + "Action" : "sqs:SendMessage", + "Resource" : { + "Fn::GetAtt" : [ "MySinkQueueEFCD79C2", "Arn" ] + }, + "Effect" : "Allow", + "Principal" : { + "Service" : "sns.amazonaws.com" + } + }, { + "Condition" : { + "ArnEquals" : { + "aws:SourceArn" : { + "Ref" : "Topic3DEAE47A7" + } + } + }, + "Action" : "sqs:SendMessage", + "Resource" : { + "Fn::GetAtt" : [ "MySinkQueueEFCD79C2", "Arn" ] + }, + "Effect" : "Allow", + "Principal" : { + "Service" : "sns.amazonaws.com" + } + } ] + }, + "Queues" : [ { + "Ref" : "MySinkQueueEFCD79C2" + } ] + } + }, + "Topic3ResourceSubscriptionA1D64BEE" : { + "Type" : "AWS::SNS::Subscription", + "Properties" : { + "Endpoint" : { + "Fn::GetAtt" : [ "MySinkQueueEFCD79C2", "Arn" ] + }, + "TopicArn" : { + "Ref" : "Topic3DEAE47A7" + }, + "Protocol" : "sqs" + } + }, + "Topic269377B75" : { + "Type" : "AWS::SNS::Topic" + }, + "Topic2ResourceSubscription88B54B51" : { + "Type" : "AWS::SNS::Subscription", + "Properties" : { + "Endpoint" : { + "Fn::GetAtt" : [ "MySinkQueueEFCD79C2", "Arn" ] + }, + "TopicArn" : { + "Ref" : "Topic269377B75" + }, + "Protocol" : "sqs" + } + }, + "Topic198E71B3E" : { + "Type" : "AWS::SNS::Topic" + } + } +} \ No newline at end of file diff --git a/examples/README.md b/examples/cdk-examples-typescript/README.md similarity index 100% rename from examples/README.md rename to examples/cdk-examples-typescript/README.md diff --git a/examples/advanced-usage/cdk.json b/examples/cdk-examples-typescript/advanced-usage/cdk.json similarity index 100% rename from examples/advanced-usage/cdk.json rename to examples/cdk-examples-typescript/advanced-usage/cdk.json diff --git a/examples/advanced-usage/index.ts b/examples/cdk-examples-typescript/advanced-usage/index.ts similarity index 100% rename from examples/advanced-usage/index.ts rename to examples/cdk-examples-typescript/advanced-usage/index.ts diff --git a/examples/bucket-import-export/cdk.json b/examples/cdk-examples-typescript/bucket-import-export/cdk.json similarity index 100% rename from examples/bucket-import-export/cdk.json rename to examples/cdk-examples-typescript/bucket-import-export/cdk.json diff --git a/examples/bucket-import-export/index.ts b/examples/cdk-examples-typescript/bucket-import-export/index.ts similarity index 100% rename from examples/bucket-import-export/index.ts rename to examples/cdk-examples-typescript/bucket-import-export/index.ts diff --git a/examples/chat-app/CognitoChatRoomPool.ts b/examples/cdk-examples-typescript/chat-app/CognitoChatRoomPool.ts similarity index 100% rename from examples/chat-app/CognitoChatRoomPool.ts rename to examples/cdk-examples-typescript/chat-app/CognitoChatRoomPool.ts diff --git a/examples/chat-app/DynamodbPostsTable.ts b/examples/cdk-examples-typescript/chat-app/DynamodbPostsTable.ts similarity index 100% rename from examples/chat-app/DynamodbPostsTable.ts rename to examples/cdk-examples-typescript/chat-app/DynamodbPostsTable.ts diff --git a/examples/chat-app/cdk.json b/examples/cdk-examples-typescript/chat-app/cdk.json similarity index 100% rename from examples/chat-app/cdk.json rename to examples/cdk-examples-typescript/chat-app/cdk.json diff --git a/examples/chat-app/index.ts b/examples/cdk-examples-typescript/chat-app/index.ts similarity index 100% rename from examples/chat-app/index.ts rename to examples/cdk-examples-typescript/chat-app/index.ts diff --git a/examples/chat-app/test/expected.yaml b/examples/cdk-examples-typescript/chat-app/test/expected.yaml similarity index 100% rename from examples/chat-app/test/expected.yaml rename to examples/cdk-examples-typescript/chat-app/test/expected.yaml diff --git a/examples/chat-app/test/test.sh b/examples/cdk-examples-typescript/chat-app/test/test.sh similarity index 100% rename from examples/chat-app/test/test.sh rename to examples/cdk-examples-typescript/chat-app/test/test.sh diff --git a/examples/cloudformation/cdk.json b/examples/cdk-examples-typescript/cloudformation/cdk.json similarity index 100% rename from examples/cloudformation/cdk.json rename to examples/cdk-examples-typescript/cloudformation/cdk.json diff --git a/examples/cloudformation/index.ts b/examples/cdk-examples-typescript/cloudformation/index.ts similarity index 100% rename from examples/cloudformation/index.ts rename to examples/cdk-examples-typescript/cloudformation/index.ts diff --git a/examples/ec2/cdk.json b/examples/cdk-examples-typescript/ec2/cdk.json similarity index 100% rename from examples/ec2/cdk.json rename to examples/cdk-examples-typescript/ec2/cdk.json diff --git a/examples/ec2/index.ts b/examples/cdk-examples-typescript/ec2/index.ts similarity index 100% rename from examples/ec2/index.ts rename to examples/cdk-examples-typescript/ec2/index.ts diff --git a/examples/ec2/out.json b/examples/cdk-examples-typescript/ec2/out.json similarity index 100% rename from examples/ec2/out.json rename to examples/cdk-examples-typescript/ec2/out.json diff --git a/examples/hello-cdk/cdk.json b/examples/cdk-examples-typescript/hello-cdk/cdk.json similarity index 100% rename from examples/hello-cdk/cdk.json rename to examples/cdk-examples-typescript/hello-cdk/cdk.json diff --git a/examples/hello-cdk/index.ts b/examples/cdk-examples-typescript/hello-cdk/index.ts similarity index 100% rename from examples/hello-cdk/index.ts rename to examples/cdk-examples-typescript/hello-cdk/index.ts diff --git a/examples/neptune-demo/cdk.json b/examples/cdk-examples-typescript/neptune-demo/cdk.json similarity index 100% rename from examples/neptune-demo/cdk.json rename to examples/cdk-examples-typescript/neptune-demo/cdk.json diff --git a/examples/neptune-demo/index.ts b/examples/cdk-examples-typescript/neptune-demo/index.ts similarity index 100% rename from examples/neptune-demo/index.ts rename to examples/cdk-examples-typescript/neptune-demo/index.ts diff --git a/examples/package-lock.json b/examples/cdk-examples-typescript/package-lock.json similarity index 100% rename from examples/package-lock.json rename to examples/cdk-examples-typescript/package-lock.json diff --git a/examples/package.json b/examples/cdk-examples-typescript/package.json similarity index 96% rename from examples/package.json rename to examples/cdk-examples-typescript/package.json index 732c766732488..c7e6d7687759f 100644 --- a/examples/package.json +++ b/examples/cdk-examples-typescript/package.json @@ -1,5 +1,5 @@ { - "name": "examples", + "name": "cdk-examples-typescript", "version": "0.7.2-beta", "description": "A bunch of CDK examples", "private": true, diff --git a/examples/sns-sqs/cdk.json b/examples/cdk-examples-typescript/sns-sqs/cdk.json similarity index 100% rename from examples/sns-sqs/cdk.json rename to examples/cdk-examples-typescript/sns-sqs/cdk.json diff --git a/examples/sns-sqs/index.ts b/examples/cdk-examples-typescript/sns-sqs/index.ts similarity index 100% rename from examples/sns-sqs/index.ts rename to examples/cdk-examples-typescript/sns-sqs/index.ts diff --git a/examples/tsconfig.json b/examples/cdk-examples-typescript/tsconfig.json similarity index 100% rename from examples/tsconfig.json rename to examples/cdk-examples-typescript/tsconfig.json diff --git a/lerna.json b/lerna.json index 019594c924113..a06b2c87072d2 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,7 @@ "packages/*", "packages/@aws-cdk/*", "tools/*", - "examples" + "examples/*" ], "rejectCycles": "true", "version": "0.7.2-beta"