From bbc9ef73e18d8429ba2b0d81abae7cc0ea50a9e4 Mon Sep 17 00:00:00 2001 From: shivlaks <32604953+shivlaks@users.noreply.github.com> Date: Tue, 11 Jun 2019 03:48:51 -0700 Subject: [PATCH] docs: update READMEs and sample snippets so they don't reference constructs that have been renamed. (#2816) --- .../aws-ecs-autoscaling-queue-worker.md | 4 +-- .../aws-ecs-scheduled-ecs-task-construct.md | 2 +- .../aws-ecs-service-discovery-integration.md | 4 +-- packages/@aws-cdk/aws-cloudtrail/README.md | 6 ++-- packages/@aws-cdk/aws-codebuild/README.md | 2 +- .../aws-codepipeline-actions/README.md | 2 +- packages/@aws-cdk/aws-ec2/README.md | 28 +++++++++---------- .../aws-elasticloadbalancingv2/README.md | 2 +- packages/@aws-cdk/aws-glue/README.md | 4 +-- packages/@aws-cdk/aws-kinesis/README.md | 4 +-- packages/@aws-cdk/aws-route53/README.md | 2 +- packages/@aws-cdk/aws-s3/README.md | 2 +- packages/@aws-cdk/cdk/README.md | 12 ++++---- packages/decdk/README.md | 2 +- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/design/aws-ecs/aws-ecs-autoscaling-queue-worker.md b/design/aws-ecs/aws-ecs-autoscaling-queue-worker.md index 148b3a23aa567..acb3e5c4b7a5b 100644 --- a/design/aws-ecs/aws-ecs-autoscaling-queue-worker.md +++ b/design/aws-ecs/aws-ecs-autoscaling-queue-worker.md @@ -147,7 +147,7 @@ export interface QueueProcessingEc2ServiceProps { An example use case: ```ts // Create the vpc and cluster used by the queue processing service -const vpc = new ec2.VpcNetwork(stack, 'Vpc', { maxAZs: 1 }); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 1 }); const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new ec2.InstanceType('t2.micro') @@ -219,7 +219,7 @@ export interface QueueProcessingFargateServiceProps { An example use case: ```ts // Create the vpc and cluster used by the queue processing service -const vpc = new ec2.VpcNetwork(stack, 'Vpc', { maxAZs: 2 }); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 2 }); const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); const queue = new sqs.Queue(stack, 'ProcessingQueue', { QueueName: 'FargateEventQueue' diff --git a/design/aws-ecs/aws-ecs-scheduled-ecs-task-construct.md b/design/aws-ecs/aws-ecs-scheduled-ecs-task-construct.md index 5a81c74420a24..dd6e9b502cd24 100644 --- a/design/aws-ecs/aws-ecs-scheduled-ecs-task-construct.md +++ b/design/aws-ecs/aws-ecs-scheduled-ecs-task-construct.md @@ -118,7 +118,7 @@ The `ScheduledEc2Task` construct will use the following existing constructs: An example use case to create a task that is scheduled to run every minute: ```ts // Create the vpc and cluster used by the scheduled task -const vpc = new ec2.VpcNetwork(stack, 'Vpc', { maxAZs: 1 }); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 1 }); const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new ec2.InstanceType('t2.micro') diff --git a/design/aws-ecs/aws-ecs-service-discovery-integration.md b/design/aws-ecs/aws-ecs-service-discovery-integration.md index 63ce8414af939..96695843d3a48 100644 --- a/design/aws-ecs/aws-ecs-service-discovery-integration.md +++ b/design/aws-ecs/aws-ecs-service-discovery-integration.md @@ -58,7 +58,7 @@ export interface NamespaceOptions { * * @default VPC of the cluster for Private DNS Namespace, otherwise none */ - vpc?: ec2.IVpcNetwork; + vpc?: ec2.IVpc; } ``` @@ -122,7 +122,7 @@ export interface ServiceDiscoveryOptions { A full example would look like the following: ``` -const vpc = new ec2.VpcNetwork(stack, 'Vpc', { maxAZs: 2 }); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 2 }); // Cloud Map Namespace const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'MyNamespace', { diff --git a/packages/@aws-cdk/aws-cloudtrail/README.md b/packages/@aws-cdk/aws-cloudtrail/README.md index 8bfa4f7511a8e..1bcc8f3c4cfff 100644 --- a/packages/@aws-cdk/aws-cloudtrail/README.md +++ b/packages/@aws-cdk/aws-cloudtrail/README.md @@ -19,7 +19,7 @@ Example usage: ```ts import cloudtrail = require('@aws-cdk/aws-cloudtrail'); -const trail = new cloudtrail.CloudTrail(this, 'CloudTrail'); +const trail = new cloudtrail.Trail(this, 'CloudTrail'); ``` You can instantiate the CloudTrail construct with no arguments - this will by default: @@ -43,7 +43,7 @@ For example, to log to CloudWatch Logs import cloudtrail = require('@aws-cdk/aws-cloudtrail'); -const trail = new cloudtrail.CloudTrail(this, 'CloudTrail', { +const trail = new cloudtrail.Trail(this, 'CloudTrail', { sendToCloudWatchLogs: true }); ``` @@ -58,7 +58,7 @@ Example: ```ts import cloudtrail = require('@aws-cdk/aws-cloudtrail'); -const trail = new cloudtrail.CloudTrail(this, 'MyAmazingCloudTrail'); +const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail'); // Adds an event selector to the bucket magic-bucket. // By default, this includes management events and all operations (Read + Write) diff --git a/packages/@aws-cdk/aws-codebuild/README.md b/packages/@aws-cdk/aws-codebuild/README.md index 1d20e66e2d3ea..8bb4d088a57bb 100644 --- a/packages/@aws-cdk/aws-codebuild/README.md +++ b/packages/@aws-cdk/aws-codebuild/README.md @@ -316,7 +316,7 @@ For example: ```ts const stack = new cdk.Stack(app, 'aws-cdk-codebuild-project-vpc'); -const vpc = new ec2.VpcNetwork(stack, 'MyVPC'); +const vpc = new ec2.Vpc(stack, 'MyVPC'); const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { allowAllOutbound: true, description: 'Example', diff --git a/packages/@aws-cdk/aws-codepipeline-actions/README.md b/packages/@aws-cdk/aws-codepipeline-actions/README.md index 7335c689bc925..9763e297ad249 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/README.md +++ b/packages/@aws-cdk/aws-codepipeline-actions/README.md @@ -107,7 +107,7 @@ You can do it through the CDK: import cloudtrail = require('@aws-cdk/aws-cloudtrail'); const key = 'some/key.zip'; -const trail = new cloudtrail.CloudTrail(this, 'CloudTrail'); +const trail = new cloudtrail.Trail(this, 'CloudTrail'); trail.addS3EventSelector([sourceBucket.arnForObjects(key)], { readWriteType: cloudtrail.ReadWriteType.WriteOnly, }); diff --git a/packages/@aws-cdk/aws-ec2/README.md b/packages/@aws-cdk/aws-ec2/README.md index 526f154d56fb9..411b0623fb4f5 100644 --- a/packages/@aws-cdk/aws-ec2/README.md +++ b/packages/@aws-cdk/aws-ec2/README.md @@ -19,19 +19,19 @@ instances. Most projects need a Virtual Private Cloud to provide security by means of network partitioning. This is easily achieved by creating an instance of -`VpcNetwork`: +`Vpc`: ```ts import ec2 = require('@aws-cdk/aws-ec2'); -const vpc = new ec2.VpcNetwork(this, 'VPC'); +const vpc = new ec2.Vpc(this, 'VPC'); ``` All default Constructs requires EC2 instances to be launched inside a VPC, so you should generally start by defining a VPC whenever you need to launch instances for your project. -Our default `VpcNetwork` class creates a private and public subnet for every +Our default `Vpc` class creates a private and public subnet for every availability zone. Classes that use the VPC will generally launch instances into all private subnets, and provide a parameter called `vpcSubnets` to allow you to override the placement. [Read more about @@ -39,14 +39,14 @@ subnets](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html #### Advanced Subnet Configuration -If you require the ability to configure subnets the `VpcNetwork` can be +If you require the ability to configure subnets the `Vpc` can be customized with `SubnetConfiguration` array. This is best explained by an example: ```ts import ec2 = require('@aws-cdk/aws-ec2'); -const vpc = new ec2.VpcNetwork(this, 'TheVPC', { +const vpc = new ec2.Vpc(this, 'TheVPC', { cidr: '10.0.0.0/21', subnetConfiguration: [ { @@ -71,7 +71,7 @@ const vpc = new ec2.VpcNetwork(this, 'TheVPC', { The example above is one possible configuration, but the user can use the constructs above to implement many other network configurations. -The `VpcNetwork` from the above configuration in a Region with three +The `Vpc` from the above configuration in a Region with three availability zones will be the following: * IngressSubnet1: 10.0.0.0/24 * IngressSubnet2: 10.0.1.0/24 @@ -110,7 +110,7 @@ distributed for the application. ```ts import ec2 = require('@aws-cdk/aws-ec2'); -const vpc = new ec2.VpcNetwork(this, 'TheVPC', { +const vpc = new ec2.Vpc(this, 'TheVPC', { cidr: '10.0.0.0/16', natGateways: 1, subnetConfiguration: [ @@ -132,7 +132,7 @@ const vpc = new ec2.VpcNetwork(this, 'TheVPC', { }); ``` -The `VpcNetwork` from the above configuration in a Region with three +The `Vpc` from the above configuration in a Region with three availability zones will be the following: * PublicSubnet1: 10.0.0.0/26 * PublicSubnet2: 10.0.0.64/26 @@ -156,7 +156,7 @@ traffic. This can be accomplished with a single parameter configuration: ```ts import ec2 = require('@aws-cdk/aws-ec2'); -const vpc = new ec2.VpcNetwork(this, 'TheVPC', { +const vpc = new ec2.Vpc(this, 'TheVPC', { cidr: '10.0.0.0/16', natGateways: 1, natGatewayPlacement: {subnetName: 'Public'}, @@ -180,7 +180,7 @@ const vpc = new ec2.VpcNetwork(this, 'TheVPC', { }); ``` -The `VpcNetwork` above will have the exact same subnet definitions as listed +The `Vpc` above will have the exact same subnet definitions as listed above. However, this time the VPC will have only 1 NAT Gateway and all Application subnets will route to the NAT Gateway. @@ -193,7 +193,7 @@ by setting the `reserved` subnetConfiguration property to true, as shown below: ```ts import ec2 = require('@aws-cdk/aws-ec2'); -const vpc = new ec2.VpcNetwork(this, 'TheVPC', { +const vpc = new ec2.Vpc(this, 'TheVPC', { cidr: '10.0.0.0/16', natGateways: 1, subnetConfiguration: [ @@ -240,7 +240,7 @@ can reuse a VPC defined in one Stack in another by using `export()` and #### Importing an existing VPC -If your VPC is created outside your CDK app, you can use `importFromContext()`: +If your VPC is created outside your CDK app, you can use `fromLookup()`: [importing existing VPCs](test/integ.import-default-vpc.lit.ts) @@ -367,7 +367,7 @@ selectable by instantiating one of these classes: Create your VPC with VPN connections by specifying the `vpnConnections` props (keys are construct `id`s): ```ts -const vpc = new ec2.VpcNetwork(stack, 'MyVpc', { +const vpc = new ec2.Vpc(stack, 'MyVpc', { vpnConnections: { dynamic: { // Dynamic routing (BGP) ip: '1.2.3.4' @@ -386,7 +386,7 @@ const vpc = new ec2.VpcNetwork(stack, 'MyVpc', { To create a VPC that can accept VPN connections, set `vpnGateway` to `true`: ```ts -const vpc = new ec2.VpcNetwork(stack, 'MyVpc', { +const vpc = new ec2.Vpc(stack, 'MyVpc', { vpnGateway: true }); ``` diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/README.md b/packages/@aws-cdk/aws-elasticloadbalancingv2/README.md index 8a9a3bfbe513d..923802d7fabe2 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/README.md +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/README.md @@ -32,7 +32,7 @@ import autoscaling = require('@aws-cdk/aws-autoscaling'); // ... -const vpc = new ec2.VpcNetwork(...); +const vpc = new ec2.Vpc(...); // Create the load balancer in a VPC. 'internetFacing' is 'false' // by default, which creates an internal load balancer. diff --git a/packages/@aws-cdk/aws-glue/README.md b/packages/@aws-cdk/aws-glue/README.md index 894935e3caa7e..6d68bb600b32a 100644 --- a/packages/@aws-cdk/aws-glue/README.md +++ b/packages/@aws-cdk/aws-glue/README.md @@ -109,7 +109,7 @@ new glue.Table(stack, 'MyTable', { // with an explicit KMS key new glue.Table(stack, 'MyTable', { encryption: glue.TableEncryption.Kms, - encryptionKey: new kms.EncryptionKey(stack, 'MyKey') + encryptionKey: new kms.Key(stack, 'MyKey') ... }); ``` @@ -131,7 +131,7 @@ new glue.Table(stack, 'MyTable', { // with an explicit KMS key new glue.Table(stack, 'MyTable', { encryption: glue.TableEncryption.ClientSideKms, - encryptionKey: new kms.EncryptionKey(stack, 'MyKey') + encryptionKey: new kms.Key(stack, 'MyKey') ... }); ``` diff --git a/packages/@aws-cdk/aws-kinesis/README.md b/packages/@aws-cdk/aws-kinesis/README.md index 8a3c723275938..64222c47d09d9 100644 --- a/packages/@aws-cdk/aws-kinesis/README.md +++ b/packages/@aws-cdk/aws-kinesis/README.md @@ -28,13 +28,13 @@ const stream = newStream(this, 'MyEncryptedStream', { }); // you can access the encryption key: -assert(stream.encryptionKey instanceof kms.EncryptionKey); +assert(stream.encryptionKey instanceof kms.Key); ``` You can also supply your own key: ```ts -const myKmsKey = new kms.EncryptionKey(this, 'MyKey'); +const myKmsKey = new kms.Key(this, 'MyKey'); const stream = new Stream(this, 'MyEncryptedStream', { encryption: StreamEncryption.Kms, diff --git a/packages/@aws-cdk/aws-route53/README.md b/packages/@aws-cdk/aws-route53/README.md index a455c562012ed..35edaeb27fe3f 100644 --- a/packages/@aws-cdk/aws-route53/README.md +++ b/packages/@aws-cdk/aws-route53/README.md @@ -30,7 +30,7 @@ VPC you're configuring for private hosted zones. import ec2 = require('@aws-cdk/aws-ec2'); import route53 = require('@aws-cdk/aws-route53'); -const vpc = new ec2.VpcNetwork(this, 'VPC'); +const vpc = new ec2.Vpc(this, 'VPC'); const zone = new route53.PrivateHostedZone(this, 'HostedZone', { zoneName: 'fully.qualified.domain.com', diff --git a/packages/@aws-cdk/aws-s3/README.md b/packages/@aws-cdk/aws-s3/README.md index 60d92601ef161..cdf69fee0e65f 100644 --- a/packages/@aws-cdk/aws-s3/README.md +++ b/packages/@aws-cdk/aws-s3/README.md @@ -47,7 +47,7 @@ assert(bucket.encryptionKey instanceof kms.Key); You can also supply your own key: ```ts -const myKmsKey = new kms.EncryptionKey(this, 'MyKey'); +const myKmsKey = new kms.Key(this, 'MyKey'); const bucket = new Bucket(this, 'MyEncryptedBucket', { encryption: BucketEncryption.Kms, diff --git a/packages/@aws-cdk/cdk/README.md b/packages/@aws-cdk/cdk/README.md index e5c14a5361134..48b7f820690c9 100644 --- a/packages/@aws-cdk/cdk/README.md +++ b/packages/@aws-cdk/cdk/README.md @@ -112,7 +112,7 @@ As you can see many tags are generated with only a few intent based directives. ```ts // snip // -const vpc = new ec2.VpcNetwork(marketingStack, 'MarketingVpc', { +const vpc = new ec2.Vpc(marketingStack, 'MarketingVpc', { maxAZs: 3 // Default is all AZs in region }); // override the VPC tags with Platform @@ -150,7 +150,7 @@ true. If false the property is set accordingly. ```ts // ... snip -const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... }); +const vpc = new ec2.Vpc(this, 'MyVpc', { ... }); vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { applyToLaunchedInstances: false })); // ... snip ``` @@ -164,12 +164,12 @@ interpreted as apply to any resource type. ```ts // ... snip -const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... }); +const vpc = new ec2.Vpc(this, 'MyVpc', { ... }); vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { includeResourceTypes: ['AWS::EC2::Subnet']})); // ... snip ``` -#### excludeResourceTypes +#### excludeResourceTypes Exclude is the inverse of include. Exclude is also an array of CloudFormation Resource Types. As the aspect visit nodes it will not take action if the node is @@ -179,7 +179,7 @@ over include in the event of a collision. ```ts // ... snip -const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... }); +const vpc = new ec2.Vpc(this, 'MyVpc', { ... }); vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { exludeResourceTypes: ['AWS::EC2::Subnet']})); // ... snip ``` @@ -193,7 +193,7 @@ setting for removing tags uses a higher priority than the standard tag. ```ts // ... snip -const vpc = new ec2.VpcNetwork(this, 'MyVpc', { ... }); +const vpc = new ec2.Vpc(this, 'MyVpc', { ... }); vpc.node.apply(new cdk.Tag('MyKey', 'MyValue', { priority: 2 })); // ... snip ``` diff --git a/packages/decdk/README.md b/packages/decdk/README.md index ade52c422182f..8d21c445a0c79 100644 --- a/packages/decdk/README.md +++ b/packages/decdk/README.md @@ -90,7 +90,7 @@ If deCDK encounters a reference to another __construct__ (a type that extends `c ```yaml Resources: VPC: - Type: "@aws-cdk/aws-ec2.VpcNetwork" + Type: "@aws-cdk/aws-ec2.Vpc" Properties: maxAZs: 1 Cluster: