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

feat(core): environment-agnostic cloud assemblies #2922

Merged
merged 10 commits into from
Jun 19, 2019
Merged
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Test extends cdk.Stack {
name: 'Basic',
apiKey: key,
description: 'Free tier monthly usage plan',
throttle: { rateLimit: 5 },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually required

quota: {
limit: 10000,
period: apigateway.Period.Month
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export * from './machine-image';
export * from './security-group';
export * from './security-group-rule';
export * from './vpc';
export * from './vpc-network-provider';
export * from './vpc-lookup';
export * from './vpn';
export * from './vpc-endpoint';

Expand Down
12 changes: 7 additions & 5 deletions packages/@aws-cdk/aws-ec2/lib/machine-image.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Construct, Context, Stack, Token } from '@aws-cdk/cdk';
import ssm = require('@aws-cdk/aws-ssm');
import { Construct, Stack, Token } from '@aws-cdk/cdk';

/**
* Interface for classes that can select an appropriate machine image to use
Expand All @@ -25,7 +26,8 @@ export class WindowsImage implements IMachineImageSource {
* Return the image to use in the given context
*/
public getImage(scope: Construct): MachineImage {
const ami = Context.getSsmParameter(scope, this.imageParameterName(this.version));
const parameterName = this.imageParameterName(this.version);
eladb marked this conversation as resolved.
Show resolved Hide resolved
const ami = ssm.StringParameter.valueForStringParameter(scope, parameterName);
return new MachineImage(ami, new WindowsOS());
}

Expand Down Expand Up @@ -102,7 +104,7 @@ export class AmazonLinuxImage implements IMachineImageSource {
].filter(x => x !== undefined); // Get rid of undefineds

const parameterName = '/aws/service/ami-amazon-linux-latest/' + parts.join('-');
const ami = Context.getSsmParameter(scope, parameterName);
const ami = ssm.StringParameter.valueForStringParameter(scope, parameterName);
return new MachineImage(ami, new LinuxOS());
}
}
Expand Down Expand Up @@ -180,9 +182,9 @@ export class GenericLinuxImage implements IMachineImageSource {
}

public getImage(scope: Construct): MachineImage {
let region = Stack.of(scope).region;
const region = Stack.of(scope).region;
if (Token.isUnresolved(region)) {
region = Context.getDefaultRegion(scope);
throw new Error(`Unable to determine AMI from AMI map since stack is region-agnostic`);
}

const ami = region !== 'test-region' ? this.amiMap[region] : 'ami-12345';
Expand Down
41 changes: 41 additions & 0 deletions packages/@aws-cdk/aws-ec2/lib/vpc-lookup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Properties for looking up an existing VPC.
*
* The combination of properties must specify filter down to exactly one
* non-default VPC, otherwise an error is raised.
*/
export interface VpcLookupOptions {
eladb marked this conversation as resolved.
Show resolved Hide resolved
/**
* The ID of the VPC
*
* If given, will import exactly this VPC.
*
* @default Don't filter on vpcId
*/
readonly vpcId?: string;

/**
* The name of the VPC
*
* If given, will import the VPC with this name.
*
* @default Don't filter on vpcName
*/
readonly vpcName?: string;

/**
* Tags on the VPC
*
* The VPC must have all of these tags
*
* @default Don't filter on tags
*/
readonly tags?: {[key: string]: string};

/**
* Whether to match the default VPC
*
* @default Don't care whether we return the default VPC
*/
readonly isDefault?: boolean;
}
85 changes: 0 additions & 85 deletions packages/@aws-cdk/aws-ec2/lib/vpc-network-provider.ts

This file was deleted.

Loading