Skip to content

Commit

Permalink
docs: update READMEs and sample snippets so they don't reference cons…
Browse files Browse the repository at this point in the history
…tructs that have been renamed. (#2816)
  • Loading branch information
shivlaks authored and rix0rrr committed Jun 11, 2019
1 parent 9ef899c commit bbc9ef7
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions design/aws-ecs/aws-ecs-autoscaling-queue-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion design/aws-ecs/aws-ecs-scheduled-ecs-task-construct.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions design/aws-ecs/aws-ecs-service-discovery-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface NamespaceOptions {
*
* @default VPC of the cluster for Private DNS Namespace, otherwise none
*/
vpc?: ec2.IVpcNetwork;
vpc?: ec2.IVpc;
}
```

Expand Down Expand Up @@ -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', {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cloudtrail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
});
```
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codebuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codepipeline-actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
28 changes: 14 additions & 14 deletions packages/@aws-cdk/aws-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,34 @@ 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
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: [
{
Expand All @@ -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
Expand Down Expand Up @@ -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: [
Expand All @@ -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
Expand All @@ -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'},
Expand All @@ -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.

Expand All @@ -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: [
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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'
Expand All @@ -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
});
```
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-elasticloadbalancingv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-glue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
...
});
```
Expand All @@ -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')
...
});
```
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-kinesis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-route53/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions packages/@aws-cdk/cdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```
Expand All @@ -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
Expand All @@ -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
```
Expand All @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion packages/decdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bbc9ef7

Please sign in to comment.