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: remove the construct compatibility layer #12054

Merged
merged 23 commits into from Jan 5, 2021
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.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
@@ -1,6 +1,6 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { EnvironmentCapacityType } from './extensions/extension-interfaces';

/**
Expand Down Expand Up @@ -64,11 +64,11 @@ export interface IEnvironment {
* or it can create it's own VPC and cluster. By default it will create
* a cluster with Fargate capacity.
*/
export class Environment extends cdk.Construct implements IEnvironment {
export class Environment extends Construct implements IEnvironment {
/**
* Import an existing environment from its attributes.
*/
public static fromEnvironmentAttributes(scope: cdk.Construct, id: string, attrs: EnvironmentAttributes): IEnvironment {
public static fromEnvironmentAttributes(scope: Construct, id: string, attrs: EnvironmentAttributes): IEnvironment {
return new ImportedEnvironment(scope, id, attrs);
}

Expand All @@ -92,9 +92,9 @@ export class Environment extends cdk.Construct implements IEnvironment {
*/
public readonly capacityType: EnvironmentCapacityType;

private readonly scope: cdk.Construct;
private readonly scope: Construct;

constructor(scope: cdk.Construct, id: string, props?: EnvironmentProps) {
constructor(scope: Construct, id: string, props?: EnvironmentProps) {
super(scope, id);

this.scope = scope;
Expand Down Expand Up @@ -139,13 +139,13 @@ export interface EnvironmentAttributes {
cluster: ecs.ICluster;
}

export class ImportedEnvironment extends cdk.Construct implements IEnvironment {
export class ImportedEnvironment extends Construct implements IEnvironment {
public readonly capacityType: EnvironmentCapacityType;
public readonly cluster: ecs.ICluster;
public readonly id: string;
public readonly vpc: ec2.IVpc;

constructor(scope: cdk.Construct, id: string, props: EnvironmentAttributes) {
constructor(scope: Construct, id: string, props: EnvironmentAttributes) {
super(scope, id);

this.id = id;
Expand Down
Expand Up @@ -5,6 +5,7 @@ import * as ecs from '@aws-cdk/aws-ecs';
import * as iam from '@aws-cdk/aws-iam';
import * as cdk from '@aws-cdk/core';
import * as regionInfo from '@aws-cdk/region-info';
import { Construct } from 'constructs';
import { Service } from '../service';
import { Container } from './container';
import { ServiceExtension, ServiceBuild } from './extension-interfaces';
Expand Down Expand Up @@ -63,7 +64,7 @@ export class AppMeshExtension extends ServiceExtension {
}
}

public prehook(service: Service, scope: cdk.Construct) {
public prehook(service: Service, scope: Construct) {
this.parentService = service;
this.scope = scope;

Expand Down
@@ -1,7 +1,7 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as route53 from '@aws-cdk/aws-route53';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Service } from '../../service';
import { Container } from '../container';
import { ServiceExtension, ServiceBuild, EnvironmentCapacityType } from '../extension-interfaces';
Expand Down Expand Up @@ -52,7 +52,7 @@ export class AssignPublicIpExtension extends ServiceExtension {
return Boolean(this.dns);
}

public prehook(service: Service, _scope: cdk.Construct) {
public prehook(service: Service, _scope: Construct) {
super.prehook(service, _scope);

if (service.capacityType != EnvironmentCapacityType.FARGATE) {
Expand Down
Expand Up @@ -10,6 +10,7 @@ import * as route53 from '@aws-cdk/aws-route53';
import * as sqs from '@aws-cdk/aws-sqs';
import * as cdk from '@aws-cdk/core';
import * as customresources from '@aws-cdk/custom-resources';
import { Construct } from 'constructs';

export interface TaskRecordManagerProps {
service: ecs.Ec2Service | ecs.FargateService;
Expand All @@ -21,8 +22,8 @@ export interface TaskRecordManagerProps {
* An event-driven serverless app to maintain a list of public ips in a Route 53
* hosted zone.
*/
export class TaskRecordManager extends cdk.Construct {
constructor(scope: cdk.Construct, id: string, props: TaskRecordManagerProps) {
export class TaskRecordManager extends Construct {
constructor(scope: Construct, id: string, props: TaskRecordManagerProps) {
super(scope, id);

// Poison pills go here.
Expand Down
@@ -1,6 +1,6 @@
import * as ecs from '@aws-cdk/aws-ecs';
import * as iam from '@aws-cdk/aws-iam';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Service } from '../service';
import { ServiceExtension } from './extension-interfaces';

Expand Down Expand Up @@ -28,7 +28,7 @@ export class CloudwatchAgentExtension extends ServiceExtension {
super('cloudwatchAgent');
}

public prehook(service: Service, scope: cdk.Construct) {
public prehook(service: Service, scope: Construct) {
this.parentService = service;
this.scope = scope;
}
Expand Down
@@ -1,5 +1,6 @@
import * as ecs from '@aws-cdk/aws-ecs';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Service } from '../service';

/**
Expand Down Expand Up @@ -105,7 +106,7 @@ export abstract class ServiceExtension {
* the extension is told what Service it is now working on.
*/
protected parentService!: Service;
protected scope!: cdk.Construct;
protected scope!: Construct;

// A list of other extensions which want to mutate the
// container definition for this extension.
Expand Down Expand Up @@ -154,7 +155,7 @@ export abstract class ServiceExtension {
* @param parent - The parent service which this extension has been added to
* @param scope - The scope that this extension should create resources in
*/
public prehook(parent: Service, scope: cdk.Construct) {
public prehook(parent: Service, scope: Construct) {
this.parentService = parent;
this.scope = scope;
}
Expand Down
@@ -1,6 +1,7 @@
import * as ecs from '@aws-cdk/aws-ecs';
import * as awslogs from '@aws-cdk/aws-logs';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Service } from '../service';
import { Container } from './container';
import { ContainerMutatingHook, ServiceExtension } from './extension-interfaces';
Expand Down Expand Up @@ -63,7 +64,7 @@ export class FireLensExtension extends ServiceExtension {
super('firelens');
}

public prehook(service: Service, scope: cdk.Construct) {
public prehook(service: Service, scope: Construct) {
this.parentService = service;

// Create a log group for the service, into which FireLens
Expand Down
@@ -1,6 +1,7 @@
import * as ecs from '@aws-cdk/aws-ecs';
import * as alb from '@aws-cdk/aws-elasticloadbalancingv2';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Service } from '../service';
import { ServiceExtension, ServiceBuild } from './extension-interfaces';

Expand All @@ -17,7 +18,7 @@ export class HttpLoadBalancerExtension extends ServiceExtension {
}

// Before the service is created go ahead and create the load balancer itself.
public prehook(service: Service, scope: cdk.Construct) {
public prehook(service: Service, scope: Construct) {
this.parentService = service;

this.loadBalancer = new alb.ApplicationLoadBalancer(scope, `${this.parentService.id}-load-balancer`, {
Expand Down
@@ -1,6 +1,6 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { IEnvironment } from './environment';
import { EnvironmentCapacityType, ServiceBuild } from './extensions/extension-interfaces';
import { ServiceDescription } from './service-description';
Expand All @@ -24,7 +24,7 @@ export interface ServiceProps {
* A service builder class. This construct support various extensions
* which can construct an ECS service progressively.
*/
export class Service extends cdk.Construct {
export class Service extends Construct {
/**
* The underlying ECS service that was created
*/
Expand Down Expand Up @@ -72,9 +72,9 @@ export class Service extends cdk.Construct {
*/
private urls: Record<string, string> = {};

private readonly scope: cdk.Construct;
private readonly scope: Construct;

constructor(scope: cdk.Construct, id: string, props: ServiceProps) {
constructor(scope: Construct, id: string, props: ServiceProps) {
super(scope, id);

this.scope = scope;
Expand Down
Expand Up @@ -67,7 +67,7 @@
"@aws-cdk/core": "0.0.0",
"@aws-cdk/custom-resources": "0.0.0",
"@aws-cdk/region-info": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"homepage": "https://github.com/aws/aws-cdk",
"peerDependencies": {
Expand All @@ -92,7 +92,7 @@
"@aws-cdk/core": "0.0.0",
"@aws-cdk/custom-resources": "0.0.0",
"@aws-cdk/region-info": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/alexa-ask/package.json
Expand Up @@ -82,11 +82,11 @@
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
eladb marked this conversation as resolved.
Show resolved Hide resolved
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
Expand Down
Expand Up @@ -5,6 +5,7 @@ import * as events from '@aws-cdk/aws-events';
import * as iam from '@aws-cdk/aws-iam';
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';

export interface PipelineDeployStackActionProps {
/**
Expand Down Expand Up @@ -147,7 +148,7 @@ export class PipelineDeployStackAction implements codepipeline.IAction {
});
}

public bind(scope: cdk.Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions):
public bind(scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions):
codepipeline.ActionConfig {
if (this.stack.environment !== cdk.Stack.of(scope).environment) {
// FIXME: Add the necessary to extend to stacks in a different account
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/app-delivery/package.json
Expand Up @@ -57,7 +57,7 @@
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"@aws-cdk/cloud-assembly-schema": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down Expand Up @@ -95,7 +95,7 @@
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"@aws-cdk/cloud-assembly-schema": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/assert/lib/synth-utils.ts
Expand Up @@ -7,7 +7,7 @@ export class SynthUtils {
/**
* Returns the cloud assembly template artifact for a stack.
*/
public static synthesize(stack: core.Stack, options: core.SynthesisOptions = { }): cxapi.CloudFormationStackArtifact {
public static synthesize(stack: core.Stack, options: core.StageSynthesisOptions = { }): cxapi.CloudFormationStackArtifact {
// always synthesize against the root (be it an App or whatever) so all artifacts will be included
const assembly = synthesizeApp(stack, options);
return assembly.getStackArtifact(stack.artifactId);
Expand All @@ -16,7 +16,7 @@ export class SynthUtils {
/**
* Synthesizes the stack and returns the resulting CloudFormation template.
*/
public static toCloudFormation(stack: core.Stack, options: core.SynthesisOptions = { }): any {
public static toCloudFormation(stack: core.Stack, options: core.StageSynthesisOptions = { }): any {
const synth = this._synthesizeWithNested(stack, options);
if (synth instanceof cxapi.CloudFormationStackArtifact) {
return synth.template;
Expand Down Expand Up @@ -48,7 +48,7 @@ export class SynthUtils {
* @return CloudFormationStackArtifact for normal stacks or the actual template for nested stacks
* @internal
*/
public static _synthesizeWithNested(stack: core.Stack, options: core.SynthesisOptions = { }): cxapi.CloudFormationStackArtifact | object {
public static _synthesizeWithNested(stack: core.Stack, options: core.StageSynthesisOptions = { }): cxapi.CloudFormationStackArtifact | object {
// always synthesize against the root (be it an App or whatever) so all artifacts will be included
const assembly = synthesizeApp(stack, options);

Expand All @@ -64,7 +64,7 @@ export class SynthUtils {
/**
* Synthesizes the app in which a stack resides and returns the cloud assembly object.
*/
function synthesizeApp(stack: core.Stack, options: core.SynthesisOptions) {
function synthesizeApp(stack: core.Stack, options: core.StageSynthesisOptions) {
const root = stack.node.root;
if (!core.Stage.isStage(root)) {
throw new Error('unexpected: all stacks must be part of a Stage or an App');
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assert/package.json
Expand Up @@ -33,11 +33,11 @@
"@aws-cdk/cloudformation-diff": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0",
"constructs": "10.0.0-pre.5",
"jest": "^26.6.3"
},
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/assets/lib/staging.ts
@@ -1,4 +1,5 @@
import { AssetStaging, Construct } from '@aws-cdk/core';
import { AssetStaging } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { toSymlinkFollow } from './compat';
import { FingerprintOptions } from './fs/options';

Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assets/package.json
Expand Up @@ -84,13 +84,13 @@
"dependencies": {
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"homepage": "https://github.com/aws/aws-cdk",
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-accessanalyzer/package.json
Expand Up @@ -83,11 +83,11 @@
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-acmpca/package.json
Expand Up @@ -83,11 +83,11 @@
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-amazonmq/package.json
Expand Up @@ -82,11 +82,11 @@
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.2.0"
"constructs": "10.0.0-pre.5"
},
"engines": {
"node": ">= 10.13.0 <13 || >=13.7.0"
Expand Down