From e6b91e64fe861faf042fc53734a3baed70c0ea15 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Mon, 4 Mar 2019 16:14:05 -0800 Subject: [PATCH 01/30] Rename Output to CfnOutput. --- CHANGELOG.md | 2 +- design/aws-guidelines.md | 10 +++--- design/cloud-assembly.md | 2 +- .../assets/test/integ.assets.refs.lit.ts | 6 ++-- packages/@aws-cdk/aws-apigateway/README.md | 2 +- .../@aws-cdk/aws-apigateway/lib/restapi.ts | 6 ++-- .../aws-certificatemanager/lib/certificate.ts | 4 +-- .../lib/dns-validated-certificate.ts | 2 +- .../lib/pipeline-actions.ts | 2 +- .../test/integ.trivial-lambda-resource.ts | 2 +- .../@aws-cdk/aws-codebuild/lib/project.ts | 2 +- .../aws-codecommit/lib/pipeline-action.ts | 2 +- .../@aws-cdk/aws-codecommit/lib/repository.ts | 2 +- .../aws-codedeploy/lib/lambda/application.ts | 2 +- .../lib/lambda/deployment-group.ts | 2 +- .../aws-codedeploy/lib/server/application.ts | 2 +- .../lib/server/deployment-config.ts | 2 +- .../lib/server/deployment-group.ts | 2 +- .../aws-codepipeline-api/lib/artifact.ts | 2 +- .../aws-codepipeline-api/lib/source-action.ts | 2 +- .../lib/github-source-action.ts | 2 +- .../aws-codepipeline/lib/jenkins-provider.ts | 6 ++-- .../@aws-cdk/aws-cognito/lib/user-pool.ts | 10 +++--- .../@aws-cdk/aws-ec2/lib/security-group.ts | 4 +-- packages/@aws-cdk/aws-ec2/lib/util.ts | 2 +- packages/@aws-cdk/aws-ec2/lib/vpc.ts | 8 ++--- .../test/integ.import-default-vpc.lit.ts | 4 +-- .../@aws-cdk/aws-ecr/lib/pipeline-action.ts | 2 +- packages/@aws-cdk/aws-ecr/lib/repository.ts | 4 +-- packages/@aws-cdk/aws-ecr/test/integ.basic.ts | 2 +- packages/@aws-cdk/aws-ecs/lib/cluster.ts | 2 +- .../aws-ecs/lib/load-balanced-service-base.ts | 4 +-- .../aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts | 2 +- .../aws-ecs/test/ec2/integ.lb-bridge-nw.ts | 2 +- .../aws-ecs/test/fargate/integ.asset-image.ts | 6 ++-- .../test/fargate/integ.lb-awsvpc-nw.ts | 2 +- packages/@aws-cdk/aws-eks/lib/cluster-base.ts | 4 +-- packages/@aws-cdk/aws-eks/lib/cluster.ts | 6 ++-- .../lib/alb/application-listener.ts | 4 +-- .../lib/alb/application-load-balancer.ts | 2 +- .../lib/nlb/network-listener.ts | 2 +- .../lib/nlb/network-load-balancer.ts | 2 +- .../lib/shared/base-target-group.ts | 4 +-- packages/@aws-cdk/aws-events/lib/rule.ts | 4 +-- packages/@aws-cdk/aws-iam/lib/role.ts | 6 ++-- packages/@aws-cdk/aws-kinesis/lib/stream.ts | 2 +- packages/@aws-cdk/aws-kms/lib/key.ts | 4 +-- packages/@aws-cdk/aws-lambda/lib/alias.ts | 2 +- packages/@aws-cdk/aws-lambda/lib/function.ts | 4 +-- packages/@aws-cdk/aws-lambda/lib/layers.ts | 2 +- packages/@aws-cdk/aws-logs/lib/log-group.ts | 2 +- packages/@aws-cdk/aws-logs/lib/log-stream.ts | 2 +- .../lib/cluster-parameter-group-ref.ts | 2 +- .../aws-rds/lib/cluster-parameter-group.ts | 2 +- packages/@aws-cdk/aws-rds/lib/cluster.ts | 14 ++++---- .../@aws-cdk/aws-route53/lib/hosted-zone.ts | 2 +- .../aws-route53/test/integ.route53.ts | 4 +-- packages/@aws-cdk/aws-s3/lib/bucket.ts | 8 ++--- .../@aws-cdk/aws-s3/lib/pipeline-actions.ts | 2 +- .../aws-s3/test/integ.bucket.domain-name.ts | 4 +-- .../aws-s3/test/integ.bucket.url.lit.ts | 4 +-- packages/@aws-cdk/aws-s3/test/test.bucket.ts | 6 ++-- packages/@aws-cdk/aws-sns/lib/topic.ts | 6 ++-- packages/@aws-cdk/aws-sqs/lib/queue.ts | 6 ++-- packages/@aws-cdk/aws-sqs/test/integ.sqs.ts | 4 +-- .../test/integ.parameter-store-string.lit.ts | 4 +-- .../aws-ssm/test/integ.parameter.lit.ts | 2 +- packages/@aws-cdk/aws-stepfunctions/README.md | 4 +-- .../aws-stepfunctions/lib/state-machine.ts | 2 +- packages/@aws-cdk/cdk/lib/app.ts | 2 +- .../cdk/lib/cloudformation/cfn-tokens.ts | 8 ++--- .../@aws-cdk/cdk/lib/cloudformation/output.ts | 32 +++++++++---------- .../cdk/test/cloudformation/test.arn.ts | 4 +-- .../cdk/test/cloudformation/test.include.ts | 6 ++-- .../cdk/test/cloudformation/test.output.ts | 20 ++++++------ .../cdk/test/cloudformation/test.stack.ts | 6 ++-- .../app/csharp/.template.gitignore | 6 ++-- tools/awslint/.gitignore | 4 +-- tools/awslint/README.md | 2 +- tools/cfn2ts/test/expected.cdk.output | 2 +- tools/cfn2ts/test/expected.cfnobjects.output | 2 +- tools/pkgtools/bin/find-jsii-packages.ts | 2 +- 82 files changed, 172 insertions(+), 172 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04a17f6c53068..15f896dc07e67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1911,7 +1911,7 @@ new codepipeline.PipelineResource(this, { - Introducing **CDK Applets** which allow instantiating specific CDK stacks using a declarative YAML syntax. - As a first step to enable diagnostics features in the toolkit, record logical ID (and stack trace) in metadata for stack elements. - Introduce a new scheme for generating CloudFormation logical IDs which adds a hash of the construct path to the generated ID to avoid ID collisions. To opt-in for the new scheme, set `hashedLogicalIDs` to `true` when creating a **Stack**. -- Allow specifying explicit **logicalID** for stack elements like **Resource** **Parameter** and **Output**. +- Allow specifying explicit **logicalID** for stack elements like **Resource** **Parameter** and **CfnOutput**. - `async exec()` changed to `run()` and `validate` was changed to be a synchronous method instead of async. - Merged **@aws-cdk/core** into **aws-cdk**, which now where the core classes of the CDK framework live. - The **Runtime Values** library, which was under **@aws-cdk/rtv** is now **@aws-cdk/rtv**. diff --git a/design/aws-guidelines.md b/design/aws-guidelines.md index c5f68addb3cbb..0c131c1454263 100644 --- a/design/aws-guidelines.md +++ b/design/aws-guidelines.md @@ -245,7 +245,7 @@ it in another stack through an `Xxx.import` call. The implementation of `export` is different between internal resources (`Xxx`) and external imported resource (`ImportedXxx` as recommended above): -For internal resources, the `export` method should produce a CloudFormation Output +For internal resources, the `export` method should produce a CloudFormation CfnOutput for each resource attribute, and return a set of `{ "Fn::ImportValue" }` tokens so they can be imported to another stack. @@ -253,8 +253,8 @@ so they can be imported to another stack. class Xxx extends XxxBase { public export(): XxxImportProps { return { - attr1: new cdk.Output(this, 'Attr1', { value: this.attr1 }).makeImportValue().toString(), - attr2: new cdk.Output(this, 'Attr2', { value: this.attr2 }).makeImportValue().toString(), + attr1: new cdk.CfnOutput(this, 'Attr1', { value: this.attr1 }).makeImportValue().toString(), + attr2: new cdk.CfnOutput(this, 'Attr2', { value: this.attr2 }).makeImportValue().toString(), } } } @@ -405,8 +405,8 @@ export class Foo extends FooBase implements IAnotherInterface { // for them so they can be imported to another stack. public export(): FooAttributes { return { - fooArn: new cdk.Output(this, 'Arn', { value: this.fooArn }).makeImportValue().toString(), // represent Fn::ImportValue as a string - fooBoo: new cdk.Output(this, 'Boo', { value: this.fooBoo }).makeImportValue().toList() // represent as string[] + fooArn: new cdk.CfnOutput(this, 'Arn', { value: this.fooArn }).makeImportValue().toString(), // represent Fn::ImportValue as a string + fooBoo: new cdk.CfnOutput(this, 'Boo', { value: this.fooBoo }).makeImportValue().toList() // represent as string[] // ... } } diff --git a/design/cloud-assembly.md b/design/cloud-assembly.md index 63d8d808ceda1..9a1c4d5f96586 100644 --- a/design/cloud-assembly.md +++ b/design/cloud-assembly.md @@ -470,4 +470,4 @@ Hash: SHA256 [ISO/IEC 21320-1:2015]: https://www.iso.org/standard/60101.html [JSON]: https://www.json.org [RFC 4880]: https://tools.ietf.org/html/rfc4880 -[ISO 8601]: https://www.iso.org/standard/40874.html \ No newline at end of file +[ISO 8601]: https://www.iso.org/standard/40874.html diff --git a/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts b/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts index 056fc21136f11..ec7bb79953163 100644 --- a/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts +++ b/packages/@aws-cdk/assets/test/integ.assets.refs.lit.ts @@ -12,9 +12,9 @@ class TestStack extends cdk.Stack { path: path.join(__dirname, 'sample-asset-directory') }); - new cdk.Output(this, 'S3BucketName', { value: asset.s3BucketName }); - new cdk.Output(this, 'S3ObjectKey', { value: asset.s3ObjectKey }); - new cdk.Output(this, 'S3URL', { value: asset.s3Url }); + new cdk.CfnOutput(this, 'S3BucketName', { value: asset.s3BucketName }); + new cdk.CfnOutput(this, 'S3ObjectKey', { value: asset.s3ObjectKey }); + new cdk.CfnOutput(this, 'S3URL', { value: asset.s3Url }); /// !hide // we need at least one resource diff --git a/packages/@aws-cdk/aws-apigateway/README.md b/packages/@aws-cdk/aws-apigateway/README.md index a333707703efb..3e459e51861da 100644 --- a/packages/@aws-cdk/aws-apigateway/README.md +++ b/packages/@aws-cdk/aws-apigateway/README.md @@ -154,7 +154,7 @@ defined in your CDK app. This means that when you deploy your app, your API will be have open access from the internet via the stage URL. The URL of your API can be obtained from the attribute `restApi.url`, and is -also exported as an `Output` from your stack, so it's printed when you `cdk +also exported as an `CfnOutput` from your stack, so it's printed when you `cdk deploy` your app: ``` diff --git a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts index b964ca3bd2c9f..e5d0420036dc3 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts @@ -44,7 +44,7 @@ export interface RestApiProps extends ResourceOptions { * deployment. To customize the stage options, use the `deployStageOptions` * property. * - * A CloudFormation Output will also be defined with the root URL endpoint + * A CloudFormation CfnOutput will also be defined with the root URL endpoint * of this REST API. * * @default true @@ -230,7 +230,7 @@ export class RestApi extends cdk.Construct implements IRestApi { */ public export(): RestApiImportProps { return { - restApiId: new cdk.Output(this, 'RestApiId', { value: this.restApiId }).makeImportValue().toString() + restApiId: new cdk.CfnOutput(this, 'RestApiId', { value: this.restApiId }).makeImportValue().toString() }; } @@ -317,7 +317,7 @@ export class RestApi extends cdk.Construct implements IRestApi { ...props.deployOptions }); - new cdk.Output(this, 'Endpoint', { value: this.urlForPath() }); + new cdk.CfnOutput(this, 'Endpoint', { value: this.urlForPath() }); } else { if (props.deployOptions) { throw new Error(`Cannot set 'deployOptions' if 'deploy' is disabled`); diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts index e10aa43ea72bc..43ff126c18af7 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts @@ -1,4 +1,4 @@ -import { Construct, IConstruct, Output } from '@aws-cdk/cdk'; +import { Construct, IConstruct, CfnOutput } from '@aws-cdk/cdk'; import { CfnCertificate } from './certificatemanager.generated'; import { apexDomain } from './util'; @@ -114,7 +114,7 @@ export class Certificate extends Construct implements ICertificate { */ public export(): CertificateImportProps { return { - certificateArn: new Output(this, 'Arn', { value: this.certificateArn }).makeImportValue().toString() + certificateArn: new CfnOutput(this, 'Arn', { value: this.certificateArn }).makeImportValue().toString() }; } } diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts index 2c7d234849f78..f1e0b265aa6a1 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts @@ -76,7 +76,7 @@ export class DnsValidatedCertificate extends cdk.Construct implements ICertifica */ public export(): CertificateImportProps { return { - certificateArn: new cdk.Output(this, 'Arn', { value: this.certificateArn }).makeImportValue().toString() + certificateArn: new cdk.CfnOutput(this, 'Arn', { value: this.certificateArn }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts index 3f731b11d1d3d..b886276a4339c 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts @@ -59,7 +59,7 @@ export interface PipelineCloudFormationActionProps extends codepipeline.CommonAc */ export abstract class PipelineCloudFormationAction extends codepipeline.Action { /** - * Output artifact containing the CloudFormation call response + * CfnOutput artifact containing the CloudFormation call response * * Only present if configured by passing `outputFileName`. */ diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts index bb4278fe12620..dd10191880f57 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.ts @@ -49,7 +49,7 @@ class SucceedingStack extends cdk.Stack { }); // Publish the custom resource output - new cdk.Output(this, 'ResponseMessage', { + new cdk.CfnOutput(this, 'ResponseMessage', { description: 'The message that came back from the Custom Resource', value: resource.response }); diff --git a/packages/@aws-cdk/aws-codebuild/lib/project.ts b/packages/@aws-cdk/aws-codebuild/lib/project.ts index e058313819448..8f1ade3a851d0 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/project.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/project.ts @@ -683,7 +683,7 @@ export class Project extends ProjectBase { */ public export(): ProjectImportProps { return { - projectName: new cdk.Output(this, 'ProjectName', { value: this.projectName }).makeImportValue().toString(), + projectName: new cdk.CfnOutput(this, 'ProjectName', { value: this.projectName }).makeImportValue().toString(), }; } diff --git a/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts b/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts index 26bedcca53747..b661e90cf63bd 100644 --- a/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts +++ b/packages/@aws-cdk/aws-codecommit/lib/pipeline-action.ts @@ -11,7 +11,7 @@ import { IRepository } from './repository'; export interface CommonPipelineSourceActionProps extends codepipeline.CommonActionProps { /** * The name of the source's output artifact. - * Output artifacts are used by CodePipeline as inputs into other actions. + * CfnOutput artifacts are used by CodePipeline as inputs into other actions. * * @default a name will be auto-generated */ diff --git a/packages/@aws-cdk/aws-codecommit/lib/repository.ts b/packages/@aws-cdk/aws-codecommit/lib/repository.ts index 3092d5e4282b5..201198a90cec3 100644 --- a/packages/@aws-cdk/aws-codecommit/lib/repository.ts +++ b/packages/@aws-cdk/aws-codecommit/lib/repository.ts @@ -320,7 +320,7 @@ export class Repository extends RepositoryBase { */ public export(): RepositoryImportProps { return { - repositoryName: new cdk.Output(this, 'RepositoryName', { value: this.repositoryName }).makeImportValue().toString() + repositoryName: new cdk.CfnOutput(this, 'RepositoryName', { value: this.repositoryName }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts index cbc4d2f3c78d5..2238b6ebe2ddc 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts @@ -65,7 +65,7 @@ export class LambdaApplication extends cdk.Construct implements ILambdaApplicati public export(): LambdaApplicationImportProps { return { - applicationName: new cdk.Output(this, 'ApplicationName', { value: this.applicationName }).makeImportValue().toString() + applicationName: new cdk.CfnOutput(this, 'ApplicationName', { value: this.applicationName }).makeImportValue().toString() }; } } diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts index 99063157a5ea0..9c259750dc77c 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts @@ -228,7 +228,7 @@ export class LambdaDeploymentGroup extends cdk.Construct implements ILambdaDeplo public export(): LambdaDeploymentGroupImportProps { return { application: this.application, - deploymentGroupName: new cdk.Output(this, 'DeploymentGroupName', { + deploymentGroupName: new cdk.CfnOutput(this, 'DeploymentGroupName', { value: this.deploymentGroupName }).makeImportValue().toString() }; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts index 3ea12f261677d..c786ccfe005dd 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts @@ -95,7 +95,7 @@ export class ServerApplication extends cdk.Construct implements IServerApplicati public export(): ServerApplicationImportProps { return { - applicationName: new cdk.Output(this, 'ApplicationName', { value: this.applicationName }).makeImportValue().toString() + applicationName: new cdk.CfnOutput(this, 'ApplicationName', { value: this.applicationName }).makeImportValue().toString() }; } } diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts index 88f76c0bad8b3..e2b39b5e676a5 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts @@ -133,7 +133,7 @@ export class ServerDeploymentConfig extends cdk.Construct implements IServerDepl public export(): ServerDeploymentConfigImportProps { return { - deploymentConfigName: new cdk.Output(this, 'DeploymentConfigName', { + deploymentConfigName: new cdk.CfnOutput(this, 'DeploymentConfigName', { value: this.deploymentConfigName, }).makeImportValue().toString(), }; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts index a86328ec92762..11ffdb9972482 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts +++ b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts @@ -321,7 +321,7 @@ export class ServerDeploymentGroup extends ServerDeploymentGroupBase { public export(): ServerDeploymentGroupImportProps { return { application: this.application, - deploymentGroupName: new cdk.Output(this, 'DeploymentGroupName', { + deploymentGroupName: new cdk.CfnOutput(this, 'DeploymentGroupName', { value: this.deploymentGroupName }).makeImportValue().toString(), deploymentConfig: this.deploymentConfig, diff --git a/packages/@aws-cdk/aws-codepipeline-api/lib/artifact.ts b/packages/@aws-cdk/aws-codepipeline-api/lib/artifact.ts index 4b0d9826e7976..0e4f03a1e0c6e 100644 --- a/packages/@aws-cdk/aws-codepipeline-api/lib/artifact.ts +++ b/packages/@aws-cdk/aws-codepipeline-api/lib/artifact.ts @@ -9,7 +9,7 @@ export class Artifact { /** * Returns an ArtifactPath for a file within this artifact. - * Output is in the form "::" + * CfnOutput is in the form "::" * @param fileName The name of the file */ public atPath(fileName: string): ArtifactPath { diff --git a/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts b/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts index 77635f7a799d3..100cde6cf333f 100644 --- a/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline-api/lib/source-action.ts @@ -21,7 +21,7 @@ export interface SourceActionProps extends CommonActionProps { /** * The name of the source's output artifact. - * Output artifacts are used by CodePipeline as inputs into other actions. + * CfnOutput artifacts are used by CodePipeline as inputs into other actions. */ outputArtifactName: string; diff --git a/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts b/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts index 73c1c636b77ce..30ca355929aeb 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/github-source-action.ts @@ -7,7 +7,7 @@ import { CfnWebhook } from './codepipeline.generated'; */ export interface GitHubSourceActionProps extends actions.CommonActionProps { /** - * The name of the source's output artifact. Output artifacts are used by CodePipeline as + * The name of the source's output artifact. CfnOutput artifacts are used by CodePipeline as * inputs into other actions. */ outputArtifactName: string; diff --git a/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts b/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts index fbff2e340fc32..bd2ce57736f7d 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/jenkins-provider.ts @@ -131,13 +131,13 @@ export abstract class BaseJenkinsProvider extends cdk.Construct implements IJenk public export(): JenkinsProviderImportProps { return { - providerName: new cdk.Output(this, 'JenkinsProviderName', { + providerName: new cdk.CfnOutput(this, 'JenkinsProviderName', { value: this.providerName, }).makeImportValue().toString(), - serverUrl: new cdk.Output(this, 'JenkinsServerUrl', { + serverUrl: new cdk.CfnOutput(this, 'JenkinsServerUrl', { value: this.serverUrl, }).makeImportValue().toString(), - version: new cdk.Output(this, 'JenkinsProviderVersion', { + version: new cdk.CfnOutput(this, 'JenkinsProviderVersion', { value: this.version, }).makeImportValue().toString(), }; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts index 4612a218267d9..fff3b0945374c 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts @@ -477,10 +477,10 @@ export class UserPool extends cdk.Construct implements IUserPool { public export(): UserPoolImportProps { return { - userPoolId: new cdk.Output(this, 'UserPoolId', { value: this.userPoolId }).makeImportValue().toString(), - userPoolArn: new cdk.Output(this, 'UserPoolArn', { value: this.userPoolArn }).makeImportValue().toString(), - userPoolProviderName: new cdk.Output(this, 'UserPoolProviderName', { value: this.userPoolProviderName }).makeImportValue().toString(), - userPoolProviderUrl: new cdk.Output(this, 'UserPoolProviderUrl', { value: this.userPoolProviderUrl }).makeImportValue().toString() + userPoolId: new cdk.CfnOutput(this, 'UserPoolId', { value: this.userPoolId }).makeImportValue().toString(), + userPoolArn: new cdk.CfnOutput(this, 'UserPoolArn', { value: this.userPoolArn }).makeImportValue().toString(), + userPoolProviderName: new cdk.CfnOutput(this, 'UserPoolProviderName', { value: this.userPoolProviderName }).makeImportValue().toString(), + userPoolProviderUrl: new cdk.CfnOutput(this, 'UserPoolProviderUrl', { value: this.userPoolProviderUrl }).makeImportValue().toString() }; } @@ -529,4 +529,4 @@ class ImportedUserPool extends cdk.Construct implements IUserPool { public export(): UserPoolImportProps { return this.props; } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-ec2/lib/security-group.ts b/packages/@aws-cdk/aws-ec2/lib/security-group.ts index 8cfd3471df83e..db7e9832a11a9 100644 --- a/packages/@aws-cdk/aws-ec2/lib/security-group.ts +++ b/packages/@aws-cdk/aws-ec2/lib/security-group.ts @@ -1,4 +1,4 @@ -import { Construct, IConstruct, Output, Token } from '@aws-cdk/cdk'; +import { Construct, IConstruct, CfnOutput, Token } from '@aws-cdk/cdk'; import { Connections, IConnectable } from './connections'; import { CfnSecurityGroup, CfnSecurityGroupEgress, CfnSecurityGroupIngress } from './ec2.generated'; import { IPortRange, ISecurityGroupRule } from './security-group-rule'; @@ -296,7 +296,7 @@ export class SecurityGroup extends SecurityGroupBase { */ public export(): SecurityGroupImportProps { return { - securityGroupId: new Output(this, 'SecurityGroupId', { value: this.securityGroupId }).makeImportValue().toString() + securityGroupId: new CfnOutput(this, 'SecurityGroupId', { value: this.securityGroupId }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-ec2/lib/util.ts b/packages/@aws-cdk/aws-ec2/lib/util.ts index 77a11e16bb305..873d453d418d7 100644 --- a/packages/@aws-cdk/aws-ec2/lib/util.ts +++ b/packages/@aws-cdk/aws-ec2/lib/util.ts @@ -65,7 +65,7 @@ export class ExportSubnetGroup { private exportIds(scope: cdk.Construct, name: string): string[] | undefined { if (this.subnets.length === 0) { return undefined; } - return new cdk.StringListOutput(scope, name, { values: this.subnets.map(s => s.subnetId) }).makeImportValues().map(x => x.toString()); + return new cdk.StringListCfnOutput(scope, name, { values: this.subnets.map(s => s.subnetId) }).makeImportValues().map(x => x.toString()); } /** diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index af1ba62bebbbb..3d74cb89479c1 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -433,8 +433,8 @@ export class VpcNetwork extends VpcNetworkBase { const iso = new ExportSubnetGroup(this, 'IsolatedSubnetIDs', this.isolatedSubnets, SubnetType.Isolated, this.availabilityZones.length); return { - vpcId: new cdk.Output(this, 'VpcId', { value: this.vpcId }).makeImportValue().toString(), - vpnGatewayId: new cdk.Output(this, 'VpnGatewayId', { value: this.vpnGatewayId }).makeImportValue().toString(), + vpcId: new cdk.CfnOutput(this, 'VpcId', { value: this.vpcId }).makeImportValue().toString(), + vpnGatewayId: new cdk.CfnOutput(this, 'VpnGatewayId', { value: this.vpnGatewayId }).makeImportValue().toString(), availabilityZones: this.availabilityZones, publicSubnetIds: pub.ids, publicSubnetNames: pub.names, @@ -633,8 +633,8 @@ export class VpcSubnet extends cdk.Construct implements IVpcSubnet { public export(): VpcSubnetImportProps { return { - availabilityZone: new cdk.Output(this, 'AvailabilityZone', { value: this.availabilityZone }).makeImportValue().toString(), - subnetId: new cdk.Output(this, 'VpcSubnetId', { value: this.subnetId }).makeImportValue().toString(), + availabilityZone: new cdk.CfnOutput(this, 'AvailabilityZone', { value: this.availabilityZone }).makeImportValue().toString(), + subnetId: new cdk.CfnOutput(this, 'VpcSubnetId', { value: this.subnetId }).makeImportValue().toString(), }; } diff --git a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.ts b/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.ts index 19fcff0cb4d04..981929957583c 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.ts +++ b/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.ts @@ -18,7 +18,7 @@ new ec2.SecurityGroup(stack, 'SecurityGroup', { }); // Try subnet selection -new cdk.Output(stack, 'PublicSubnets', { value: 'ids:' + vpc.subnets({ subnetsToUse: ec2.SubnetType.Public }).map(s => s.subnetId).join(',') }); -new cdk.Output(stack, 'PrivateSubnets', { value: 'ids:' + vpc.subnets({ subnetsToUse: ec2.SubnetType.Private }).map(s => s.subnetId).join(',') }); +new cdk.CfnOutput(stack, 'PublicSubnets', { value: 'ids:' + vpc.subnets({ subnetsToUse: ec2.SubnetType.Public }).map(s => s.subnetId).join(',') }); +new cdk.CfnOutput(stack, 'PrivateSubnets', { value: 'ids:' + vpc.subnets({ subnetsToUse: ec2.SubnetType.Private }).map(s => s.subnetId).join(',') }); app.run(); diff --git a/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts b/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts index d231e8c593ead..8570d006adfd0 100644 --- a/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts +++ b/packages/@aws-cdk/aws-ecr/lib/pipeline-action.ts @@ -18,7 +18,7 @@ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActi /** * The name of the source's output artifact. - * Output artifacts are used by CodePipeline as inputs into other actions. + * CfnOutput artifacts are used by CodePipeline as inputs into other actions. * * @default a name will be auto-generated */ diff --git a/packages/@aws-cdk/aws-ecr/lib/repository.ts b/packages/@aws-cdk/aws-ecr/lib/repository.ts index c7346889b8177..79b9b083caa6b 100644 --- a/packages/@aws-cdk/aws-ecr/lib/repository.ts +++ b/packages/@aws-cdk/aws-ecr/lib/repository.ts @@ -76,8 +76,8 @@ export class Repository extends RepositoryBase { */ public export(): RepositoryImportProps { return { - repositoryArn: new cdk.Output(this, 'RepositoryArn', { value: this.repositoryArn }).makeImportValue().toString(), - repositoryName: new cdk.Output(this, 'RepositoryName', { value: this.repositoryName }).makeImportValue().toString() + repositoryArn: new cdk.CfnOutput(this, 'RepositoryArn', { value: this.repositoryArn }).makeImportValue().toString(), + repositoryName: new cdk.CfnOutput(this, 'RepositoryName', { value: this.repositoryName }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.ts b/packages/@aws-cdk/aws-ecr/test/integ.basic.ts index 373962e57fdb7..deb72bdcf5887 100644 --- a/packages/@aws-cdk/aws-ecr/test/integ.basic.ts +++ b/packages/@aws-cdk/aws-ecr/test/integ.basic.ts @@ -7,7 +7,7 @@ const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); const repo = new ecr.Repository(stack, 'Repo'); repo.addLifecycleRule({ maxImageCount: 5 }); -new cdk.Output(stack, 'RepositoryURI', { +new cdk.CfnOutput(stack, 'RepositoryURI', { value: repo.repositoryUri }); diff --git a/packages/@aws-cdk/aws-ecs/lib/cluster.ts b/packages/@aws-cdk/aws-ecs/lib/cluster.ts index a11c886a5e96f..591c0da164f96 100644 --- a/packages/@aws-cdk/aws-ecs/lib/cluster.ts +++ b/packages/@aws-cdk/aws-ecs/lib/cluster.ts @@ -144,7 +144,7 @@ export class Cluster extends cdk.Construct implements ICluster { */ public export(): ClusterImportProps { return { - clusterName: new cdk.Output(this, 'ClusterName', { value: this.clusterName }).makeImportValue().toString(), + clusterName: new cdk.CfnOutput(this, 'ClusterName', { value: this.clusterName }).makeImportValue().toString(), clusterArn: this.clusterArn, vpc: this.vpc.export(), securityGroups: this.connections.securityGroups.map(sg => sg.export()), diff --git a/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts b/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts index d5b50d1fff5dc..9e9aeed50769c 100644 --- a/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts +++ b/packages/@aws-cdk/aws-ecs/lib/load-balanced-service-base.ts @@ -121,7 +121,7 @@ export abstract class LoadBalancedServiceBase extends cdk.Construct { this.targetGroup = this.listener.addTargets('ECS', targetProps); } - new cdk.Output(this, 'LoadBalancerDNS', { value: this.loadBalancer.dnsName }); + new cdk.CfnOutput(this, 'LoadBalancerDNS', { value: this.loadBalancer.dnsName }); } protected addServiceAsTarget(service: BaseService) { @@ -131,4 +131,4 @@ export abstract class LoadBalancedServiceBase extends cdk.Construct { (this.targetGroup as elbv2.NetworkTargetGroup).addTarget(service); } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts index d6617c5a923fc..3bae4398bcf2d 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts +++ b/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts @@ -40,6 +40,6 @@ listener.addTargets('ECS', { targets: [service] }); -new cdk.Output(stack, 'LoadBalancerDNS', { value: lb.dnsName, }); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.dnsName, }); app.run(); diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.ts index 93532431269b2..b8bfe2bfcc0e9 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.ts +++ b/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.ts @@ -42,6 +42,6 @@ listener.addTargets('ECS', { targets: [service] }); -new cdk.Output(stack, 'LoadBalancerDNS', { value: lb.dnsName, }); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.dnsName, }); app.run(); diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.asset-image.ts b/packages/@aws-cdk/aws-ecs/test/fargate/integ.asset-image.ts index c80af87c3776a..eb4eef79aaf7b 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.asset-image.ts +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.asset-image.ts @@ -21,7 +21,7 @@ const fargateService = new ecs.LoadBalancedFargateService(stack, "FargateService }) }); -// Output the DNS where you can access your service -new cdk.Output(stack, 'LoadBalancerDNS', { value: fargateService.loadBalancer.dnsName }); +// CfnOutput the DNS where you can access your service +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: fargateService.loadBalancer.dnsName }); -app.run(); \ No newline at end of file +app.run(); diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts b/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts index 8b5e793cb20dd..769caf9e97f78 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts @@ -40,6 +40,6 @@ listener.addTargets('Fargate', { targets: [service] }); -new cdk.Output(stack, 'LoadBalancerDNS', { value: lb.dnsName, }); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.dnsName, }); app.run(); diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-base.ts b/packages/@aws-cdk/aws-eks/lib/cluster-base.ts index 9de91498e56c4..186e7aee4437f 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster-base.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster-base.ts @@ -63,7 +63,7 @@ export abstract class ClusterBase extends cdk.Construct implements ICluster { } private makeOutput(name: string, value: any): string { - return new cdk.Output(this, name, { value }).makeImportValue().toString(); + return new cdk.CfnOutput(this, name, { value }).makeImportValue().toString(); } } @@ -95,4 +95,4 @@ export interface ClusterImportProps { readonly clusterCertificateAuthorityData: string; readonly securityGroups: ec2.SecurityGroupImportProps[]; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-eks/lib/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster.ts index 44692c4500496..46f743b513e55 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster.ts @@ -178,7 +178,7 @@ export class Cluster extends ClusterBase { this.clusterEndpoint = resource.clusterEndpoint; this.clusterCertificateAuthorityData = resource.clusterCertificateAuthorityData; - new cdk.Output(this, 'ClusterName', { value: this.clusterName, disableExport: true }); + new cdk.CfnOutput(this, 'ClusterName', { value: this.clusterName, disableExport: true }); } /** @@ -249,8 +249,8 @@ export class Cluster extends ClusterBase { // EKS Required Tags autoScalingGroup.node.apply(new cdk.Tag(`kubernetes.io/cluster/${this.clusterName}`, 'owned', { applyToLaunchedInstances: true })); - // Create an Output for the Instance Role ARN (need to paste it into aws-auth-cm.yaml) - new cdk.Output(autoScalingGroup, 'InstanceRoleARN', { + // Create an CfnOutput for the Instance Role ARN (need to paste it into aws-auth-cm.yaml) + new cdk.CfnOutput(autoScalingGroup, 'InstanceRoleARN', { disableExport: true, value: autoScalingGroup.role.roleArn }); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts index 540b88e0973df..6774ce8aa21ea 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts @@ -229,9 +229,9 @@ export class ApplicationListener extends BaseListener implements IApplicationLis */ public export(): ApplicationListenerImportProps { return { - listenerArn: new cdk.Output(this, 'ListenerArn', { value: this.listenerArn }).makeImportValue().toString(), + listenerArn: new cdk.CfnOutput(this, 'ListenerArn', { value: this.listenerArn }).makeImportValue().toString(), securityGroupId: this.connections.securityGroups[0]!.export().securityGroupId, - defaultPort: new cdk.Output(this, 'Port', { value: this.defaultPort }).makeImportValue().toString(), + defaultPort: new cdk.CfnOutput(this, 'Port', { value: this.defaultPort }).makeImportValue().toString(), }; } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts index 4c9cde7a9bef4..60e2e3f1b465b 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts @@ -110,7 +110,7 @@ export class ApplicationLoadBalancer extends BaseLoadBalancer implements IApplic */ public export(): ApplicationLoadBalancerImportProps { return { - loadBalancerArn: new cdk.Output(this, 'LoadBalancerArn', { value: this.loadBalancerArn }).makeImportValue().toString(), + loadBalancerArn: new cdk.CfnOutput(this, 'LoadBalancerArn', { value: this.loadBalancerArn }).makeImportValue().toString(), securityGroupId: this.securityGroup.export().securityGroupId, }; } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts index b0b2034d9f5db..f9e96005ae95a 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts @@ -105,7 +105,7 @@ export class NetworkListener extends BaseListener implements INetworkListener { */ public export(): NetworkListenerImportProps { return { - listenerArn: new cdk.Output(this, 'ListenerArn', { value: this.listenerArn }).makeImportValue().toString() + listenerArn: new cdk.CfnOutput(this, 'ListenerArn', { value: this.listenerArn }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts index 9dbba56279829..96005eec9cf75 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts @@ -49,7 +49,7 @@ export class NetworkLoadBalancer extends BaseLoadBalancer implements INetworkLoa */ public export(): NetworkLoadBalancerImportProps { return { - loadBalancerArn: new cdk.Output(this, 'LoadBalancerArn', { value: this.loadBalancerArn }).makeImportValue().toString() + loadBalancerArn: new cdk.CfnOutput(this, 'LoadBalancerArn', { value: this.loadBalancerArn }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts index 447262e1d8c1d..8233dc4668331 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts @@ -270,8 +270,8 @@ export abstract class TargetGroupBase extends cdk.Construct implements ITargetGr */ public export(): TargetGroupImportProps { return { - targetGroupArn: new cdk.Output(this, 'TargetGroupArn', { value: this.targetGroupArn }).makeImportValue().toString(), - defaultPort: new cdk.Output(this, 'Port', { value: this.defaultPort }).makeImportValue().toString(), + targetGroupArn: new cdk.CfnOutput(this, 'TargetGroupArn', { value: this.targetGroupArn }).makeImportValue().toString(), + defaultPort: new cdk.CfnOutput(this, 'Port', { value: this.defaultPort }).makeImportValue().toString(), }; } diff --git a/packages/@aws-cdk/aws-events/lib/rule.ts b/packages/@aws-cdk/aws-events/lib/rule.ts index 9932b4160c9fd..e93606b7f654f 100644 --- a/packages/@aws-cdk/aws-events/lib/rule.ts +++ b/packages/@aws-cdk/aws-events/lib/rule.ts @@ -1,4 +1,4 @@ -import { Construct, Output, Token } from '@aws-cdk/cdk'; +import { Construct, CfnOutput, Token } from '@aws-cdk/cdk'; import { EventPattern } from './event-pattern'; import { CfnRule } from './events.generated'; import { TargetInputTemplate } from './input-options'; @@ -104,7 +104,7 @@ export class EventRule extends Construct implements IEventRule { */ public export(): EventRuleImportProps { return { - eventRuleArn: new Output(this, 'RuleArn', { value: this.ruleArn }).makeImportValue().toString() + eventRuleArn: new CfnOutput(this, 'RuleArn', { value: this.ruleArn }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-iam/lib/role.ts b/packages/@aws-cdk/aws-iam/lib/role.ts index d6b64ed3d143e..b229a76b11eb2 100644 --- a/packages/@aws-cdk/aws-iam/lib/role.ts +++ b/packages/@aws-cdk/aws-iam/lib/role.ts @@ -1,4 +1,4 @@ -import { Construct, IConstruct, Output } from '@aws-cdk/cdk'; +import { Construct, IConstruct, CfnOutput } from '@aws-cdk/cdk'; import { CfnRole } from './iam.generated'; import { IPrincipal, Policy } from './policy'; import { ArnPrincipal, PolicyDocument, PolicyPrincipal, PolicyStatement } from './policy-document'; @@ -165,8 +165,8 @@ export class Role extends Construct implements IRole { public export(): RoleImportProps { return { - roleArn: new Output(this, 'RoleArn', { value: this.roleArn }).makeImportValue(), - roleId: new Output(this, 'RoleId', { value: this.roleId }).makeImportValue() + roleArn: new CfnOutput(this, 'RoleArn', { value: this.roleArn }).makeImportValue(), + roleId: new CfnOutput(this, 'RoleId', { value: this.roleId }).makeImportValue() }; } diff --git a/packages/@aws-cdk/aws-kinesis/lib/stream.ts b/packages/@aws-cdk/aws-kinesis/lib/stream.ts index 872dedd16a55b..4a79da7e65ca1 100644 --- a/packages/@aws-cdk/aws-kinesis/lib/stream.ts +++ b/packages/@aws-cdk/aws-kinesis/lib/stream.ts @@ -359,7 +359,7 @@ export class Stream extends StreamBase { */ public export(): StreamImportProps { return { - streamArn: new cdk.Output(this, 'StreamArn', { value: this.streamArn }).makeImportValue().toString(), + streamArn: new cdk.CfnOutput(this, 'StreamArn', { value: this.streamArn }).makeImportValue().toString(), encryptionKey: this.encryptionKey ? this.encryptionKey.export() : undefined, }; } diff --git a/packages/@aws-cdk/aws-kms/lib/key.ts b/packages/@aws-cdk/aws-kms/lib/key.ts index d77bf73f60dfb..7dfbf21451e9a 100644 --- a/packages/@aws-cdk/aws-kms/lib/key.ts +++ b/packages/@aws-cdk/aws-kms/lib/key.ts @@ -1,5 +1,5 @@ import { PolicyDocument, PolicyStatement } from '@aws-cdk/aws-iam'; -import { Construct, DeletionPolicy, IConstruct, Output } from '@aws-cdk/cdk'; +import { Construct, DeletionPolicy, IConstruct, CfnOutput } from '@aws-cdk/cdk'; import { EncryptionKeyAlias } from './alias'; import { CfnKey } from './kms.generated'; @@ -174,7 +174,7 @@ export class EncryptionKey extends EncryptionKeyBase { */ public export(): EncryptionKeyImportProps { return { - keyArn: new Output(this, 'KeyArn', { value: this.keyArn }).makeImportValue().toString() + keyArn: new CfnOutput(this, 'KeyArn', { value: this.keyArn }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-lambda/lib/alias.ts b/packages/@aws-cdk/aws-lambda/lib/alias.ts index 2bc80fc6b3fd5..ba2d0c6681520 100644 --- a/packages/@aws-cdk/aws-lambda/lib/alias.ts +++ b/packages/@aws-cdk/aws-lambda/lib/alias.ts @@ -101,7 +101,7 @@ export class Alias extends FunctionBase { public export(): FunctionImportProps { return { - functionArn: new cdk.Output(this, 'AliasArn', { value: this.functionArn }).makeImportValue().toString() + functionArn: new cdk.CfnOutput(this, 'AliasArn', { value: this.functionArn }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-lambda/lib/function.ts b/packages/@aws-cdk/aws-lambda/lib/function.ts index 9fc1de92d6f2a..9d603e43dc860 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function.ts @@ -402,9 +402,9 @@ export class Function extends FunctionBase { */ public export(): FunctionImportProps { return { - functionArn: new cdk.Output(this, 'FunctionArn', { value: this.functionArn }).makeImportValue().toString(), + functionArn: new cdk.CfnOutput(this, 'FunctionArn', { value: this.functionArn }).makeImportValue().toString(), securityGroupId: this._connections && this._connections.securityGroups[0] - ? new cdk.Output(this, 'SecurityGroupId', { value: this._connections.securityGroups[0].securityGroupId }).makeImportValue().toString() + ? new cdk.CfnOutput(this, 'SecurityGroupId', { value: this._connections.securityGroups[0].securityGroupId }).makeImportValue().toString() : undefined }; } diff --git a/packages/@aws-cdk/aws-lambda/lib/layers.ts b/packages/@aws-cdk/aws-lambda/lib/layers.ts index d37b7de1cb614..b42cd8930403d 100644 --- a/packages/@aws-cdk/aws-lambda/lib/layers.ts +++ b/packages/@aws-cdk/aws-lambda/lib/layers.ts @@ -87,7 +87,7 @@ export abstract class LayerVersionBase extends cdk.Construct implements ILayerVe public export(): LayerVersionImportProps { return { - layerVersionArn: new cdk.Output(this, 'LayerVersionArn', { value: this.layerVersionArn }).makeImportValue().toString(), + layerVersionArn: new cdk.CfnOutput(this, 'LayerVersionArn', { value: this.layerVersionArn }).makeImportValue().toString(), compatibleRuntimes: this.compatibleRuntimes, }; } diff --git a/packages/@aws-cdk/aws-logs/lib/log-group.ts b/packages/@aws-cdk/aws-logs/lib/log-group.ts index a3215ceec2fc4..c0df6719e0cc6 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-group.ts +++ b/packages/@aws-cdk/aws-logs/lib/log-group.ts @@ -272,7 +272,7 @@ export class LogGroup extends LogGroupBase { */ public export(): LogGroupImportProps { return { - logGroupArn: new cdk.Output(this, 'LogGroupArn', { value: this.logGroupArn }).makeImportValue().toString() + logGroupArn: new cdk.CfnOutput(this, 'LogGroupArn', { value: this.logGroupArn }).makeImportValue().toString() }; } } diff --git a/packages/@aws-cdk/aws-logs/lib/log-stream.ts b/packages/@aws-cdk/aws-logs/lib/log-stream.ts index e8ee08078233e..a40885e430f63 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-stream.ts +++ b/packages/@aws-cdk/aws-logs/lib/log-stream.ts @@ -89,7 +89,7 @@ export class LogStream extends cdk.Construct implements ILogStream { */ public export(): LogStreamImportProps { return { - logStreamName: new cdk.Output(this, 'LogStreamName', { value: this.logStreamName }).makeImportValue().toString() + logStreamName: new cdk.CfnOutput(this, 'LogStreamName', { value: this.logStreamName }).makeImportValue().toString() }; } } diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group-ref.ts b/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group-ref.ts index 2acc2fc5a1940..f0b01df78b043 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group-ref.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group-ref.ts @@ -21,7 +21,7 @@ export abstract class ClusterParameterGroupRef extends cdk.Construct { */ public export(): ClusterParameterGroupRefProps { return { - parameterGroupName: new cdk.Output(this, 'ParameterGroupName', { value: this.parameterGroupName }).makeImportValue().toString() + parameterGroupName: new cdk.CfnOutput(this, 'ParameterGroupName', { value: this.parameterGroupName }).makeImportValue().toString() }; } } diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts b/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts index 10a8e89c06524..55ccfabf5fb60 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts @@ -79,7 +79,7 @@ export class ClusterParameterGroup extends cdk.Construct implements IClusterPara */ public export(): ClusterParameterGroupImportProps { return { - parameterGroupName: new cdk.Output(this, 'ParameterGroupName', { value: this.parameterGroupName }).makeImportValue().toString() + parameterGroupName: new cdk.CfnOutput(this, 'ParameterGroupName', { value: this.parameterGroupName }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-rds/lib/cluster.ts b/packages/@aws-cdk/aws-rds/lib/cluster.ts index e87c5340209cb..bec077a5283f9 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster.ts @@ -225,13 +225,13 @@ export class DatabaseCluster extends cdk.Construct implements IDatabaseCluster { public export(): DatabaseClusterImportProps { // tslint:disable:max-line-length return { - port: new cdk.Output(this, 'Port', { value: this.clusterEndpoint.port, }).makeImportValue().toString(), - securityGroupId: new cdk.Output(this, 'SecurityGroupId', { value: this.securityGroupId, }).makeImportValue().toString(), - clusterIdentifier: new cdk.Output(this, 'ClusterIdentifier', { value: this.clusterIdentifier, }).makeImportValue().toString(), - instanceIdentifiers: new cdk.StringListOutput(this, 'InstanceIdentifiers', { values: this.instanceIdentifiers }).makeImportValues().map(x => x.toString()), - clusterEndpointAddress: new cdk.Output(this, 'ClusterEndpointAddress', { value: this.clusterEndpoint.hostname, }).makeImportValue().toString(), - readerEndpointAddress: new cdk.Output(this, 'ReaderEndpointAddress', { value: this.readerEndpoint.hostname, }).makeImportValue().toString(), - instanceEndpointAddresses: new cdk.StringListOutput(this, 'InstanceEndpointAddresses', { values: this.instanceEndpoints.map(e => e.hostname) }).makeImportValues().map(x => x.toString()), + port: new cdk.CfnOutput(this, 'Port', { value: this.clusterEndpoint.port, }).makeImportValue().toString(), + securityGroupId: new cdk.CfnOutput(this, 'SecurityGroupId', { value: this.securityGroupId, }).makeImportValue().toString(), + clusterIdentifier: new cdk.CfnOutput(this, 'ClusterIdentifier', { value: this.clusterIdentifier, }).makeImportValue().toString(), + instanceIdentifiers: new cdk.StringListCfnOutput(this, 'InstanceIdentifiers', { values: this.instanceIdentifiers }).makeImportValues().map(x => x.toString()), + clusterEndpointAddress: new cdk.CfnOutput(this, 'ClusterEndpointAddress', { value: this.clusterEndpoint.hostname, }).makeImportValue().toString(), + readerEndpointAddress: new cdk.CfnOutput(this, 'ReaderEndpointAddress', { value: this.readerEndpoint.hostname, }).makeImportValue().toString(), + instanceEndpointAddresses: new cdk.StringListCfnOutput(this, 'InstanceEndpointAddresses', { values: this.instanceEndpoints.map(e => e.hostname) }).makeImportValues().map(x => x.toString()), }; // tslint:enable:max-line-length } diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts b/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts index 1cbc9d2d12adb..ef198625d057b 100644 --- a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts +++ b/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts @@ -82,7 +82,7 @@ export class HostedZone extends cdk.Construct implements IHostedZone { public export(): HostedZoneImportProps { return { - hostedZoneId: new cdk.Output(this, 'HostedZoneId', { value: this.hostedZoneId }).makeImportValue(), + hostedZoneId: new cdk.CfnOutput(this, 'HostedZoneId', { value: this.hostedZoneId }).makeImportValue(), zoneName: this.zoneName, }; } diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.ts b/packages/@aws-cdk/aws-route53/test/integ.route53.ts index 4109fc0b61713..b39e4178e28a7 100644 --- a/packages/@aws-cdk/aws-route53/test/integ.route53.ts +++ b/packages/@aws-cdk/aws-route53/test/integ.route53.ts @@ -33,7 +33,7 @@ new CnameRecord(stack, 'CNAME', { recordValue: 'server' }); -new cdk.Output(stack, 'PrivateZoneId', { value: privateZone.hostedZoneId }); -new cdk.Output(stack, 'PublicZoneId', { value: publicZone.hostedZoneId }); +new cdk.CfnOutput(stack, 'PrivateZoneId', { value: privateZone.hostedZoneId }); +new cdk.CfnOutput(stack, 'PublicZoneId', { value: publicZone.hostedZoneId }); app.run(); diff --git a/packages/@aws-cdk/aws-s3/lib/bucket.ts b/packages/@aws-cdk/aws-s3/lib/bucket.ts index 44e1bb517ad01..adfb0a8f0100b 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket.ts +++ b/packages/@aws-cdk/aws-s3/lib/bucket.ts @@ -752,10 +752,10 @@ export class Bucket extends BucketBase { */ public export(): BucketImportProps { return { - bucketArn: new cdk.Output(this, 'BucketArn', { value: this.bucketArn }).makeImportValue().toString(), - bucketName: new cdk.Output(this, 'BucketName', { value: this.bucketName }).makeImportValue().toString(), - bucketDomainName: new cdk.Output(this, 'DomainName', { value: this.domainName }).makeImportValue().toString(), - bucketWebsiteUrl: new cdk.Output(this, 'WebsiteURL', { value: this.bucketWebsiteUrl }).makeImportValue().toString() + bucketArn: new cdk.CfnOutput(this, 'BucketArn', { value: this.bucketArn }).makeImportValue().toString(), + bucketName: new cdk.CfnOutput(this, 'BucketName', { value: this.bucketName }).makeImportValue().toString(), + bucketDomainName: new cdk.CfnOutput(this, 'DomainName', { value: this.domainName }).makeImportValue().toString(), + bucketWebsiteUrl: new cdk.CfnOutput(this, 'WebsiteURL', { value: this.bucketWebsiteUrl }).makeImportValue().toString() }; } diff --git a/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts b/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts index 2343c33d3c81e..db16f68fe7599 100644 --- a/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-s3/lib/pipeline-actions.ts @@ -9,7 +9,7 @@ import { IBucket } from './bucket'; */ export interface CommonPipelineSourceActionProps extends codepipeline.CommonActionProps { /** - * The name of the source's output artifact. Output artifacts are used by CodePipeline as + * The name of the source's output artifact. CfnOutput artifacts are used by CodePipeline as * inputs into other actions. * * @default a name will be auto-generated diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts index 1cf02bc2acc7c..ac0245e570543 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts @@ -13,8 +13,8 @@ class TestStack extends cdk.Stack { bucketArn: "arn:aws:s3:::my-bucket-test" }); - new cdk.Output(this, 'RealBucketDomain', { value: bucket.domainName }); - new cdk.Output(this, 'ImportedBucketDomain', { value: bucket2.domainName }); + new cdk.CfnOutput(this, 'RealBucketDomain', { value: bucket.domainName }); + new cdk.CfnOutput(this, 'ImportedBucketDomain', { value: bucket2.domainName }); /// !hide } } diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts index 09949dca7c71a..7f5e0b961bfaa 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.ts @@ -10,8 +10,8 @@ class TestStack extends cdk.Stack { removalPolicy: cdk.RemovalPolicy.Destroy }); - new cdk.Output(this, 'BucketURL', { value: bucket.bucketUrl }); - new cdk.Output(this, 'ObjectURL', { value: bucket.urlForObject('myfolder/myfile.txt') }); + new cdk.CfnOutput(this, 'BucketURL', { value: bucket.bucketUrl }); + new cdk.CfnOutput(this, 'ObjectURL', { value: bucket.urlForObject('myfolder/myfile.txt') }); /// !hide } } diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket.ts b/packages/@aws-cdk/aws-s3/test/test.bucket.ts index 8f5abfa7bc3c2..df9eb379964cf 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket.ts @@ -1049,9 +1049,9 @@ export = { const stack = new cdk.Stack(); const bucket = new s3.Bucket(stack, 'MyBucket'); - new cdk.Output(stack, 'BucketURL', { value: bucket.bucketUrl }); - new cdk.Output(stack, 'MyFileURL', { value: bucket.urlForObject('my/file.txt') }); - new cdk.Output(stack, 'YourFileURL', { value: bucket.urlForObject('/your/file.txt') }); // "/" is optional + new cdk.CfnOutput(stack, 'BucketURL', { value: bucket.bucketUrl }); + new cdk.CfnOutput(stack, 'MyFileURL', { value: bucket.urlForObject('my/file.txt') }); + new cdk.CfnOutput(stack, 'YourFileURL', { value: bucket.urlForObject('/your/file.txt') }); // "/" is optional expect(stack).toMatch({ "Resources": { diff --git a/packages/@aws-cdk/aws-sns/lib/topic.ts b/packages/@aws-cdk/aws-sns/lib/topic.ts index 489b2d304a4e2..058f87d49fa72 100644 --- a/packages/@aws-cdk/aws-sns/lib/topic.ts +++ b/packages/@aws-cdk/aws-sns/lib/topic.ts @@ -1,4 +1,4 @@ -import { Construct, Output } from '@aws-cdk/cdk'; +import { Construct, CfnOutput } from '@aws-cdk/cdk'; import { CfnTopic } from './sns.generated'; import { ITopic, TopicBase, TopicImportProps } from './topic-base'; @@ -58,8 +58,8 @@ export class Topic extends TopicBase { */ public export(): TopicImportProps { return { - topicArn: new Output(this, 'TopicArn', { value: this.topicArn }).makeImportValue().toString(), - topicName: new Output(this, 'TopicName', { value: this.topicName }).makeImportValue().toString(), + topicArn: new CfnOutput(this, 'TopicArn', { value: this.topicArn }).makeImportValue().toString(), + topicName: new CfnOutput(this, 'TopicName', { value: this.topicName }).makeImportValue().toString(), }; } } diff --git a/packages/@aws-cdk/aws-sqs/lib/queue.ts b/packages/@aws-cdk/aws-sqs/lib/queue.ts index 9afbf6d97a710..f7d0fb76946bc 100644 --- a/packages/@aws-cdk/aws-sqs/lib/queue.ts +++ b/packages/@aws-cdk/aws-sqs/lib/queue.ts @@ -287,10 +287,10 @@ export class Queue extends QueueBase { */ public export(): QueueImportProps { return { - queueArn: new cdk.Output(this, 'QueueArn', { value: this.queueArn }).makeImportValue().toString(), - queueUrl: new cdk.Output(this, 'QueueUrl', { value: this.queueUrl }).makeImportValue().toString(), + queueArn: new cdk.CfnOutput(this, 'QueueArn', { value: this.queueArn }).makeImportValue().toString(), + queueUrl: new cdk.CfnOutput(this, 'QueueUrl', { value: this.queueUrl }).makeImportValue().toString(), keyArn: this.encryptionMasterKey - ? new cdk.Output(this, 'KeyArn', { value: this.encryptionMasterKey.keyArn }).makeImportValue().toString() + ? new cdk.CfnOutput(this, 'KeyArn', { value: this.encryptionMasterKey.keyArn }).makeImportValue().toString() : undefined }; } diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts b/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts index 4786149bdf426..831549b272e71 100644 --- a/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts +++ b/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts @@ -1,4 +1,4 @@ -import { App, Output, Stack } from '@aws-cdk/cdk'; +import { App, CfnOutput, Stack } from '@aws-cdk/cdk'; import { Queue } from '../lib'; const app = new App(); @@ -14,6 +14,6 @@ new Queue(stack, 'FifoQueue', { fifo: true }); -new Output(stack, 'QueueUrl', { value: queue.queueUrl }); +new CfnOutput(stack, 'QueueUrl', { value: queue.queueUrl }); app.run(); diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.lit.ts b/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.lit.ts index 4a1c7397f85b9..261ec9363cf86 100644 --- a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.lit.ts +++ b/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.lit.ts @@ -32,7 +32,7 @@ class UsingStack extends cdk.Stack { }).stringValue; /// !hide - new cdk.Output(this, 'TheValue', { value: stringValue }); + new cdk.CfnOutput(this, 'TheValue', { value: stringValue }); // Cannot be provisioned so cannot be actually used Array.isArray(secretValue); @@ -45,4 +45,4 @@ const creating = new CreatingStack(app, 'sspms-creating'); const using = new UsingStack(app, 'sspms-using'); using.addDependency(creating); -app.run(); \ No newline at end of file +app.run(); diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.lit.ts b/packages/@aws-cdk/aws-ssm/test/integ.parameter.lit.ts index 473387a179820..ec3a0a81cf2bf 100644 --- a/packages/@aws-cdk/aws-ssm/test/integ.parameter.lit.ts +++ b/packages/@aws-cdk/aws-ssm/test/integ.parameter.lit.ts @@ -30,7 +30,7 @@ const listParameter = new ssm.StringListParameter(stack, 'StringListParameter', }); /// !hide -new cdk.Output(stack, 'StringListOutput', { +new cdk.CfnOutput(stack, 'StringListOutput', { value: cdk.Fn.join('+', listParameter.stringListValue), }); diff --git a/packages/@aws-cdk/aws-stepfunctions/README.md b/packages/@aws-cdk/aws-stepfunctions/README.md index a19b3a0a74869..b63116d2fe1e4 100644 --- a/packages/@aws-cdk/aws-stepfunctions/README.md +++ b/packages/@aws-cdk/aws-stepfunctions/README.md @@ -387,9 +387,9 @@ ARN into your worker pool: ```ts const activity = new stepfunctions.Activity(this, 'Activity'); -// Read this Output from your application and use it to poll for work on +// Read this CfnOutput from your application and use it to poll for work on // the activity. -new cdk.Output(this, 'ActivityArn', { value: activity.activityArn }); +new cdk.CfnOutput(this, 'ActivityArn', { value: activity.activityArn }); ``` ## Metrics diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts index 0e51318d98f36..eec511e368d39 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts @@ -194,7 +194,7 @@ export class StateMachine extends cdk.Construct implements IStateMachine, events */ public export(): StateMachineImportProps { return { - stateMachineArn: new cdk.Output(this, 'StateMachineArn', { value: this.stateMachineArn }).makeImportValue().toString(), + stateMachineArn: new cdk.CfnOutput(this, 'StateMachineArn', { value: this.stateMachineArn }).makeImportValue().toString(), }; } } diff --git a/packages/@aws-cdk/cdk/lib/app.ts b/packages/@aws-cdk/cdk/lib/app.ts index fb9a73b53bc62..8fe400e9c3395 100644 --- a/packages/@aws-cdk/cdk/lib/app.ts +++ b/packages/@aws-cdk/cdk/lib/app.ts @@ -24,7 +24,7 @@ export class App extends Root { } /** - * Runs the program. Output is written to output directory as specified in the request. + * Runs the program. CfnOutput is written to output directory as specified in the request. */ public run(): ISynthesisSession { // this app has already been executed, no-op for you diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts index 8a4ab68ed574f..5c85fec6ca1ca 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts @@ -96,12 +96,12 @@ export class CfnReference extends Token { stackExports = new Construct(producingStack, exportsName); } - // Ensure a singleton Output for this value + // Ensure a singleton CfnOutput for this value const resolved = producingStack.node.resolve(tokenValue); const id = 'Output' + JSON.stringify(resolved); - let output = stackExports.node.tryFindChild(id) as Output; + let output = stackExports.node.tryFindChild(id) as CfnOutput; if (!output) { - output = new Output(stackExports, id, { value: tokenValue }); + output = new CfnOutput(stackExports, id, { value: tokenValue }); } // We want to return an actual FnImportValue Token here, but Fn.importValue() returns a 'string', @@ -112,5 +112,5 @@ export class CfnReference extends Token { } import { Construct } from "../core/construct"; -import { Output } from "./output"; +import { CfnOutput } from "./output"; import { Stack } from "./stack"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts b/packages/@aws-cdk/cdk/lib/cloudformation/output.ts index c098f4dfc09ab..1c67a7e8680e8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/output.ts @@ -1,7 +1,7 @@ import { Construct } from '../core/construct'; import { StackElement } from './stack-element'; -export interface OutputProps { +export interface CfnOutputProps { /** * A String type that describes the output value. * The description can be a maximum of 4 K in length. @@ -44,7 +44,7 @@ export interface OutputProps { condition?: Condition; } -export class Output extends StackElement { +export class CfnOutput extends StackElement { /** * A String type that describes the output value. * The description can be a maximum of 4 K in length. @@ -53,9 +53,9 @@ export class Output extends StackElement { /** * The name of the resource output to be exported for a cross-stack reference. - * By default, the logical ID of the Output element is used as it's export name. + * By default, the logical ID of the CfnOutput element is used as it's export name. * - * May be undefined if the Output hasn't been exported yet. + * May be undefined if the CfnOutput hasn't been exported yet. */ public export?: string; @@ -71,11 +71,11 @@ export class Output extends StackElement { private disableExport: boolean; /** - * Creates an Output value for this stack. + * Creates an CfnOutput value for this stack. * @param parent The parent construct. - * @param props Output properties. + * @param props CfnOutput properties. */ - constructor(scope: Construct, id: string, props: OutputProps = {}) { + constructor(scope: Construct, id: string, props: CfnOutputProps = {}) { super(scope, id); this.description = props.description; @@ -129,7 +129,7 @@ export class Output extends StackElement { } /** - * Allocate an export name for this `Output` if not already done. + * Allocate an export name for this `CfnOutput` if not already done. */ public obtainExportName(): string { if (!this.export && this.disableExport) { @@ -158,7 +158,7 @@ export class Output extends StackElement { /** * Properties for ListOutput */ -export interface StringListOutputProps { +export interface StringListCfnOutputProps { /** * A String type that describes the output value. * The description can be a maximum of 4 K in length. @@ -207,10 +207,10 @@ export interface StringListOutputProps { /** * An output for a list of strings. * - * Exports a list of Tokens via an Output variable, and return a list of Tokens + * Exports a list of Tokens via an CfnOutput variable, and return a list of Tokens * that selects the imported values for them. */ -export class StringListOutput extends Construct { +export class StringListCfnOutput extends Construct { /** * Number of elements in the stringlist */ @@ -222,17 +222,17 @@ export class StringListOutput extends Construct { private readonly separator: string; /** - * The Output object that was created + * The CfnOutput object that was created */ - private readonly output: Output; + private readonly output: CfnOutput; - constructor(scope: Construct, id: string, props: StringListOutputProps) { + constructor(scope: Construct, id: string, props: StringListCfnOutputProps) { super(scope, id); this.separator = props.separator || ','; this.length = props.values.length; - this.output = new Output(this, 'Resource', { + this.output = new CfnOutput(this, 'Resource', { description: props.description, condition: props.condition, disableExport: props.disableExport, @@ -242,7 +242,7 @@ export class StringListOutput extends Construct { } /** - * Return an array of imported values for this Output + * Return an array of imported values for this CfnOutput */ public makeImportValues(): string[] { const combined = this.output.makeImportValue(); diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts index 0dc6bfef0bc93..4d559bc360975 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { ArnComponents, Output, ScopedAws, Stack, Token } from '../../lib'; +import { ArnComponents, CfnOutput, ScopedAws, Stack, Token } from '../../lib'; export = { 'create from components with defaults'(test: Test) { @@ -216,7 +216,7 @@ export = { resource: 'thing', resourceName: 'thong', }); - new Output(stack2, 'SomeValue', { value: arn }); + new CfnOutput(stack2, 'SomeValue', { value: arn }); // THEN test.deepEqual(stack2.node.resolve(stack2.toCloudFormation()), { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts index b3bb4be284cdc..b9693c48a7958 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { Include, Output, Parameter, Resource, Stack } from '../../lib'; +import { Include, CfnOutput, Parameter, Resource, Stack } from '../../lib'; export = { 'the Include construct can be used to embed an existing template as-is into a stack'(test: Test) { @@ -21,7 +21,7 @@ export = { new Include(stack, 'T1', { template: clone(template) }); new Resource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); - new Output(stack, 'MyOutput', { description: 'Out!', disableExport: true }); + new CfnOutput(stack, 'MyOutput', { description: 'Out!', disableExport: true }); new Parameter(stack, 'MyParam2', { type: 'Integer' }); test.deepEqual(stack.toCloudFormation(), { @@ -43,7 +43,7 @@ export = { new Include(stack, 'T1', { template }); new Resource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); - new Output(stack, 'MyOutput', { description: 'Out!' }); + new CfnOutput(stack, 'MyOutput', { description: 'Out!' }); new Parameter(stack, 'MyParam', { type: 'Integer' }); // duplicate! test.throws(() => stack.toCloudFormation()); diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts index 7ffbbb7c66014..030aa947b89a3 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { Output, Ref, Resource, Stack } from '../../lib'; +import { CfnOutput, Ref, Resource, Stack } from '../../lib'; export = { 'outputs can be added to the stack'(test: Test) { @@ -7,15 +7,15 @@ export = { const res = new Resource(stack, 'MyResource', { type: 'R' }); const ref = new Ref(res); - new Output(stack, 'MyOutput', { + new CfnOutput(stack, 'MyOutput', { export: 'ExportName', value: ref, - description: 'Output properties' + description: 'CfnOutput properties' }); test.deepEqual(stack.toCloudFormation(), { Resources: { MyResource: { Type: 'R' } }, Outputs: { MyOutput: - { Description: 'Output properties', + { Description: 'CfnOutput properties', Export: { Name: 'ExportName' }, Value: { Ref: 'MyResource' } } } }); test.done(); @@ -23,19 +23,19 @@ export = { 'outputs cannot be referenced'(test: Test) { const stack = new Stack(); - const output = new Output(stack, 'MyOutput', { description: 'My Output' }); + const output = new CfnOutput(stack, 'MyOutput', { description: 'My CfnOutput' }); test.throws(() => output.ref); test.done(); }, 'disableExport can be used to disable the auto-export behavior'(test: Test) { const stack = new Stack(); - const output = new Output(stack, 'MyOutput', { disableExport: true }); + const output = new CfnOutput(stack, 'MyOutput', { disableExport: true }); test.equal(output.export, null); // cannot specify `export` and `disableExport` at the same time. - test.throws(() => new Output(stack, 'YourOutput', { + test.throws(() => new CfnOutput(stack, 'YourOutput', { disableExport: true, export: 'bla' }), /Cannot set `disableExport` and specify an export name/); @@ -45,14 +45,14 @@ export = { 'if stack name is undefined, we will only use the logical ID for the export name'(test: Test) { const stack = new Stack(); - const output = new Output(stack, 'MyOutput'); + const output = new CfnOutput(stack, 'MyOutput'); test.deepEqual(stack.node.resolve(output.makeImportValue()), { 'Fn::ImportValue': 'MyOutput' }); test.done(); }, 'makeImportValue can be used to create an Fn::ImportValue from an output'(test: Test) { const stack = new Stack(undefined, 'MyStack'); - const output = new Output(stack, 'MyOutput'); + const output = new CfnOutput(stack, 'MyOutput'); test.deepEqual(stack.node.resolve(output.makeImportValue()), { 'Fn::ImportValue': 'MyStack:MyOutput' }); test.deepEqual(stack.toCloudFormation(), { @@ -70,7 +70,7 @@ export = { const stack = new Stack(); // WHEN - new Output(stack, 'SomeOutput', { value: 'x' }); + new CfnOutput(stack, 'SomeOutput', { value: 'x' }); // THEN test.deepEqual(stack.toCloudFormation(), { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts index 4580a8674c237..29db8a27674d2 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { App, Condition, Construct, Include, Output, Parameter, Resource, ScopedAws, Stack, Token } from '../../lib'; +import { App, Condition, Construct, Include, CfnOutput, Parameter, Resource, ScopedAws, Stack, Token } from '../../lib'; export = { 'a stack can be serialized into a CloudFormation template, initially it\'s empty'(test: Test) { @@ -118,7 +118,7 @@ export = { const stack = new Stack(); const p = new Parameter(stack, 'MyParam', { type: 'String' }); - const o = new Output(stack, 'MyOutput'); + const o = new CfnOutput(stack, 'MyOutput'); const c = new Condition(stack, 'MyCondition'); test.equal(stack.node.findChild(p.node.path), p); @@ -229,7 +229,7 @@ export = { const stack2 = new Stack(app, 'Stack2'); // WHEN - used in another stack - new Output(stack2, 'DemOutput', { value: stack1.region }); + new CfnOutput(stack2, 'DemOutput', { value: stack1.region }); // THEN // Need to do this manually now, since we're in testing mode. In a normal CDK app, diff --git a/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore b/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore index 8f83e36d4919a..003e4bedc73ec 100644 --- a/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore +++ b/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore @@ -167,7 +167,7 @@ DocProject/Help/html # Click-Once directory publish/ -# Publish Web Output +# Publish Web CfnOutput *.[Pp]ublish.xml *.azurePubxml # Note: Comment the next line if you want to checkin your web deploy settings, @@ -192,7 +192,7 @@ PublishScripts/ *.nuget.props *.nuget.targets -# Microsoft Azure Build Output +# Microsoft Azure Build CfnOutput csx/ *.build.csdef @@ -336,4 +336,4 @@ ASALocalRun/ .localhistory/ -# End of https://www.gitignore.io/api/csharp \ No newline at end of file +# End of https://www.gitignore.io/api/csharp diff --git a/tools/awslint/.gitignore b/tools/awslint/.gitignore index a2e520b801389..8e25b191cb5e8 100644 --- a/tools/awslint/.gitignore +++ b/tools/awslint/.gitignore @@ -56,7 +56,7 @@ typings/ # Optional REPL history .node_repl_history -# Output of 'npm pack' +# CfnOutput of 'npm pack' *.tgz # Yarn Integrity file @@ -92,4 +92,4 @@ dist .LAST_PACKAGE .LAST_BUILD *.snk -.nycrc \ No newline at end of file +.nycrc diff --git a/tools/awslint/README.md b/tools/awslint/README.md index fc5511dbe593c..4728ee8a97206 100644 --- a/tools/awslint/README.md +++ b/tools/awslint/README.md @@ -108,7 +108,7 @@ $ awslint If `--save` is specified, `awslint` will always exit with status code 0. -## Output Options +## CfnOutput Options * Use `--verbose` to print all passing linter rules (disabled by default). * Use `--quiet` to hide all warnings and skips (just prints errors) diff --git a/tools/cfn2ts/test/expected.cdk.output b/tools/cfn2ts/test/expected.cdk.output index 7baeab41380df..08a961f5777c8 100644 --- a/tools/cfn2ts/test/expected.cdk.output +++ b/tools/cfn2ts/test/expected.cdk.output @@ -8122,7 +8122,7 @@ export namespace aws.kinesisanalytics { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationoutput.html#cfn-kinesisanalytics-applicationoutput-output */ - Output: aws.kinesisanalytics.ApplicationOutput.OutputProperty; + CfnOutput: aws.kinesisanalytics.ApplicationOutput.OutputProperty; } diff --git a/tools/cfn2ts/test/expected.cfnobjects.output b/tools/cfn2ts/test/expected.cfnobjects.output index 6abb18e509768..1024a8e1a1b2a 100644 --- a/tools/cfn2ts/test/expected.cfnobjects.output +++ b/tools/cfn2ts/test/expected.cfnobjects.output @@ -8752,7 +8752,7 @@ export namespace aws.kinesisanalytics { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisanalytics-applicationoutput.html#cfn-kinesisanalytics-applicationoutput-output */ - Output: aws.kinesisanalytics.ApplicationOutput.OutputProperty; + CfnOutput: aws.kinesisanalytics.ApplicationOutput.OutputProperty; } diff --git a/tools/pkgtools/bin/find-jsii-packages.ts b/tools/pkgtools/bin/find-jsii-packages.ts index cb27f1969e478..9adf614345c76 100644 --- a/tools/pkgtools/bin/find-jsii-packages.ts +++ b/tools/pkgtools/bin/find-jsii-packages.ts @@ -32,7 +32,7 @@ function main() { return isJsii && matches; }); - // Output the JSII directories + // CfnOutput the JSII directories for (const pkg of packages) { process.stdout.write(pkg.directory + '\n'); } From 30b6742383297dd843cf0756ce114c2a46def3a3 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Mon, 4 Mar 2019 16:24:50 -0800 Subject: [PATCH 02/30] Rename Condition to CfnCondition. --- packages/@aws-cdk/cdk/lib/cloudformation/condition.ts | 6 +++--- packages/@aws-cdk/cdk/lib/cloudformation/output.ts | 8 ++++---- packages/@aws-cdk/cdk/lib/cloudformation/resource.ts | 4 ++-- .../@aws-cdk/cdk/test/cloudformation/test.condition.ts | 8 ++++---- .../@aws-cdk/cdk/test/cloudformation/test.resource.ts | 4 ++-- packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts index 4d1d8d425ce3a..e7783f23f370a 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts @@ -2,7 +2,7 @@ import { Construct } from '../core/construct'; import { ResolveContext } from '../core/tokens'; import { Referenceable } from './stack-element'; -export interface ConditionProps { +export interface CfnConditionProps { expression?: IConditionExpression; } @@ -10,7 +10,7 @@ export interface ConditionProps { * Represents a CloudFormation condition, for resources which must be conditionally created and * the determination must be made at deploy time. */ -export class Condition extends Referenceable implements IConditionExpression { +export class CfnCondition extends Referenceable implements IConditionExpression { /** * The condition statement. */ @@ -20,7 +20,7 @@ export class Condition extends Referenceable implements IConditionExpression { * Build a new condition. The condition must be constructed with a condition token, * that the condition is based on. */ - constructor(scope: Construct, id: string, props?: ConditionProps) { + constructor(scope: Construct, id: string, props?: CfnConditionProps) { super(scope, id); this.expression = props && props.expression; } diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts b/packages/@aws-cdk/cdk/lib/cloudformation/output.ts index 1c67a7e8680e8..0d8e3d48e2276 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/output.ts @@ -41,7 +41,7 @@ export interface CfnOutputProps { * value. If the condition evaluates to `false`, this output value will not * be included in the stack. */ - condition?: Condition; + condition?: CfnCondition; } export class CfnOutput extends StackElement { @@ -64,7 +64,7 @@ export class CfnOutput extends StackElement { * value. If the condition evaluates to `false`, this output value will not * be included in the stack. */ - public readonly condition?: Condition; + public readonly condition?: CfnCondition; private _value?: any; @@ -201,7 +201,7 @@ export interface StringListCfnOutputProps { * value. If the condition evaluates to `false`, this output value will not * be included in the stack. */ - readonly condition?: Condition; + readonly condition?: CfnCondition; } /** @@ -261,4 +261,4 @@ function fn() { return require('./fn').Fn; } -import { Condition } from './condition'; +import { CfnCondition } from './condition'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts index 1487aa61e7282..e7c8636733346 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts @@ -3,7 +3,7 @@ import { Construct, IConstruct } from '../core/construct'; import { TagManager } from '../core/tag-manager'; import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/util'; import { CfnReference } from './cfn-tokens'; -import { Condition } from './condition'; +import { CfnCondition } from './condition'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; import { Referenceable } from './stack-element'; @@ -270,7 +270,7 @@ export interface ResourceOptions { * is deployed, the resource will be included. This is provided to allow CDK projects to produce legacy templates, but noramlly * there is no need to use it in CDK projects. */ - condition?: Condition; + condition?: CfnCondition; /** * Associate the CreationPolicy attribute with a resource to prevent its status from reaching create complete until diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts index 7b69aee3e0aee..d778270846284 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts @@ -6,12 +6,12 @@ export = { // GIVEN const stack = new cdk.Stack(); const param = new cdk.Parameter(stack, 'Param1', { type: 'String' }); - const cond1 = new cdk.Condition(stack, 'Condition1', { expression: cdk.Fn.conditionEquals("a", "b") }); - const cond2 = new cdk.Condition(stack, 'Condition2', { expression: cdk.Fn.conditionContains([ "a", "b", "c" ], "c") }); - const cond3 = new cdk.Condition(stack, 'Condition3', { expression: cdk.Fn.conditionEquals(param, "hello") }); + const cond1 = new cdk.CfnCondition(stack, 'Condition1', { expression: cdk.Fn.conditionEquals("a", "b") }); + const cond2 = new cdk.CfnCondition(stack, 'Condition2', { expression: cdk.Fn.conditionContains([ "a", "b", "c" ], "c") }); + const cond3 = new cdk.CfnCondition(stack, 'Condition3', { expression: cdk.Fn.conditionEquals(param, "hello") }); // WHEN - new cdk.Condition(stack, 'Condition4', { + new cdk.CfnCondition(stack, 'Condition4', { expression: cdk.Fn.conditionOr(cond1, cond2, cdk.Fn.conditionNot(cond3)) }); diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts index 4160199108fdd..5d9a73c19dda8 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { App, applyRemovalPolicy, Condition, Construct, +import { App, applyRemovalPolicy, CfnCondition, Construct, DeletionPolicy, Fn, HashedAddressingScheme, RemovalPolicy, Resource, Root, Stack } from '../../lib'; @@ -188,7 +188,7 @@ export = { 'conditions can be attached to a resource'(test: Test) { const stack = new Stack(); const r1 = new Resource(stack, 'Resource', { type: 'Type' }); - const cond = new Condition(stack, 'MyCondition', { expression: Fn.conditionNot(Fn.conditionEquals('a', 'b')) }); + const cond = new CfnCondition(stack, 'MyCondition', { expression: Fn.conditionNot(Fn.conditionEquals('a', 'b')) }); r1.options.condition = cond; test.deepEqual(stack.toCloudFormation(), { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts index 29db8a27674d2..4c0986520e9c4 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { App, Condition, Construct, Include, CfnOutput, Parameter, Resource, ScopedAws, Stack, Token } from '../../lib'; +import { App, CfnCondition, Construct, Include, CfnOutput, Parameter, Resource, ScopedAws, Stack, Token } from '../../lib'; export = { 'a stack can be serialized into a CloudFormation template, initially it\'s empty'(test: Test) { @@ -119,7 +119,7 @@ export = { const p = new Parameter(stack, 'MyParam', { type: 'String' }); const o = new CfnOutput(stack, 'MyOutput'); - const c = new Condition(stack, 'MyCondition'); + const c = new CfnCondition(stack, 'MyCondition'); test.equal(stack.node.findChild(p.node.path), p); test.equal(stack.node.findChild(o.node.path), o); From 1e138896619b33b5c9555e1f7bccf93081b85888 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Mon, 4 Mar 2019 16:28:57 -0800 Subject: [PATCH 03/30] Rename Parameter to CfnParameter. --- .../@aws-cdk/applet-js/test/test-applet.ts | 12 +++++------ .../@aws-cdk/assets-docker/lib/image-asset.ts | 2 +- packages/@aws-cdk/assets/lib/asset.ts | 4 ++-- .../aws-ssm/lib/parameter-store-string.ts | 2 +- .../cdk/lib/cloudformation/parameter.ts | 8 ++++---- .../@aws-cdk/cdk/lib/cloudformation/secret.ts | 4 ++-- .../@aws-cdk/cdk/lib/cloudformation/stack.ts | 4 ++-- .../cdk/test/cloudformation/test.condition.ts | 2 +- .../cdk/test/cloudformation/test.include.ts | 6 +++--- .../cdk/test/cloudformation/test.parameter.ts | 8 ++++---- .../cdk/test/cloudformation/test.stack.ts | 20 +++++++++---------- packages/@aws-cdk/cdk/test/test.synthesis.ts | 2 +- tools/cfn2ts/test/expected.cdk.output | 4 ++-- tools/cfn2ts/test/expected.cfnobjects.output | 4 ++-- 14 files changed, 41 insertions(+), 41 deletions(-) diff --git a/packages/@aws-cdk/applet-js/test/test-applet.ts b/packages/@aws-cdk/applet-js/test/test-applet.ts index 978f644bd88d3..1254b5a766420 100644 --- a/packages/@aws-cdk/applet-js/test/test-applet.ts +++ b/packages/@aws-cdk/applet-js/test/test-applet.ts @@ -1,4 +1,4 @@ -import { App, Construct, Parameter, Stack, StackProps } from '@aws-cdk/cdk'; +import { App, CfnParameter, Construct, Stack, StackProps } from '@aws-cdk/cdk'; export interface TestAppletProps extends StackProps { prop1: string @@ -10,11 +10,11 @@ export class TestApplet extends Stack { constructor(scope: App, id: string, props: TestAppletProps) { super(scope, id, props); - new Parameter(this, 'P1', { default: this.node.required(props, 'prop1'), type: 'String' }); - new Parameter(this, 'P2', { default: this.node.required(props, 'prop2'), type: 'Number' }); + new CfnParameter(this, 'P1', { default: this.node.required(props, 'prop1'), type: 'String' }); + new CfnParameter(this, 'P2', { default: this.node.required(props, 'prop2'), type: 'Number' }); if (props.prop3) { - new Parameter(this, 'P3', { default: props.prop3.join(','), type: 'StringList' }); + new CfnParameter(this, 'P3', { default: props.prop3.join(','), type: 'StringList' }); } } } @@ -39,6 +39,6 @@ export class NoStackApplet extends Construct { constructor(scope: Construct, id: string, props: NoStackAppletProps) { super(scope, id); - new Parameter(this, 'P1', { default: props.argument, type: 'String' }); + new CfnParameter(this, 'P1', { default: props.argument, type: 'String' }); } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/assets-docker/lib/image-asset.ts b/packages/@aws-cdk/assets-docker/lib/image-asset.ts index b1ecc35b652fb..b2de0ad22503d 100644 --- a/packages/@aws-cdk/assets-docker/lib/image-asset.ts +++ b/packages/@aws-cdk/assets-docker/lib/image-asset.ts @@ -46,7 +46,7 @@ export class DockerImageAsset extends cdk.Construct { throw new Error(`No 'Dockerfile' found in ${this.directory}`); } - const imageNameParameter = new cdk.Parameter(this, 'ImageName', { + const imageNameParameter = new cdk.CfnParameter(this, 'ImageName', { type: 'String', description: `ECR repository name and tag asset "${this.node.path}"`, }); diff --git a/packages/@aws-cdk/assets/lib/asset.ts b/packages/@aws-cdk/assets/lib/asset.ts index d70818cefcae4..99cd12bc09062 100644 --- a/packages/@aws-cdk/assets/lib/asset.ts +++ b/packages/@aws-cdk/assets/lib/asset.ts @@ -99,12 +99,12 @@ export class Asset extends cdk.Construct { // the toolkit or by CI/CD when the stack is deployed and will include // the name of the bucket and the S3 key where the code lives. - const bucketParam = new cdk.Parameter(this, 'S3Bucket', { + const bucketParam = new cdk.CfnParameter(this, 'S3Bucket', { type: 'String', description: `S3 bucket for asset "${this.node.path}"`, }); - const keyParam = new cdk.Parameter(this, 'S3VersionKey', { + const keyParam = new cdk.CfnParameter(this, 'S3VersionKey', { type: 'String', description: `S3 key for asset version "${this.node.path}"` }); diff --git a/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts b/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts index a976e5e59869b..d945cef0cc2d2 100644 --- a/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts +++ b/packages/@aws-cdk/aws-ssm/lib/parameter-store-string.ts @@ -35,7 +35,7 @@ export class ParameterStoreString extends cdk.Construct { // * Specific - use a Dynamic Reference. if (props.version === undefined) { // Construct/get a singleton parameter under the stack - const param = new cdk.Parameter(this, 'Parameter', { + const param = new cdk.CfnParameter(this, 'Parameter', { type: 'AWS::SSM::Parameter::Value', default: props.parameterName }); diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts b/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts index 540197efddf67..6d837d4073ba7 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts @@ -2,7 +2,7 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; import { Ref, Referenceable } from './stack-element'; -export interface ParameterProps { +export interface CfnParameterProps { /** * The data type for the parameter (DataType). */ @@ -70,7 +70,7 @@ export interface ParameterProps { * Parameters enable you to input custom values to your template each time you create or * update a stack. */ -export class Parameter extends Referenceable { +export class CfnParameter extends Referenceable { /** * A token that represents the actual value of this parameter. */ @@ -86,7 +86,7 @@ export class Parameter extends Referenceable { */ public stringListValue: string[]; - private properties: ParameterProps; + private properties: CfnParameterProps; /** * Creates a parameter construct. @@ -96,7 +96,7 @@ export class Parameter extends Referenceable { * @param parent The parent construct. * @param props The parameter properties. */ - constructor(scope: Construct, id: string, props: ParameterProps) { + constructor(scope: Construct, id: string, props: CfnParameterProps) { super(scope, id); this.properties = props; this.value = new Ref(this); diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts b/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts index 5565bc72c883e..5c9c1aec31277 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; -import { Parameter } from './parameter'; +import { CfnParameter } from './parameter'; /** * A token that represents a value that's expected to be a secret, like @@ -77,7 +77,7 @@ export class SecretParameter extends Construct { constructor(scope: Construct, id: string, props: SecretParameterProps) { super(scope, id); - const param = new Parameter(this, 'Parameter', { + const param = new CfnParameter(this, 'Parameter', { type: 'AWS::SSM::Parameter::Value', default: props.ssmParameter, description: props.description, diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index 99f97ae63f069..c380d1f08f23f 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -5,7 +5,7 @@ import { Environment } from '../environment'; import { ISynthesisSession } from '../synthesis'; import { CfnReference } from './cfn-tokens'; import { HashedAddressingScheme, IAddressingScheme, LogicalIDs } from './logical-id'; -import { Parameter } from './parameter'; +import { CfnParameter } from './parameter'; export interface StackProps { /** @@ -396,7 +396,7 @@ export class Stack extends Construct { * @param parameter The parameter to set the value for * @param value The value, can use `${}` notation to reference other assembly block attributes. */ - public setParameterValue(parameter: Parameter, value: string) { + public setParameterValue(parameter: CfnParameter, value: string) { this.parameterValues[parameter.logicalId] = value; } diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts index d778270846284..d5a3aba3845b1 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts @@ -5,7 +5,7 @@ export = { 'chain conditions'(test: Test) { // GIVEN const stack = new cdk.Stack(); - const param = new cdk.Parameter(stack, 'Param1', { type: 'String' }); + const param = new cdk.CfnParameter(stack, 'Param1', { type: 'String' }); const cond1 = new cdk.CfnCondition(stack, 'Condition1', { expression: cdk.Fn.conditionEquals("a", "b") }); const cond2 = new cdk.CfnCondition(stack, 'Condition2', { expression: cdk.Fn.conditionContains([ "a", "b", "c" ], "c") }); const cond3 = new cdk.CfnCondition(stack, 'Condition3', { expression: cdk.Fn.conditionEquals(param, "hello") }); diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts index b9693c48a7958..a96162c20f766 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { Include, CfnOutput, Parameter, Resource, Stack } from '../../lib'; +import { CfnOutput, CfnParameter, Include, Resource, Stack } from '../../lib'; export = { 'the Include construct can be used to embed an existing template as-is into a stack'(test: Test) { @@ -22,7 +22,7 @@ export = { new Include(stack, 'T1', { template: clone(template) }); new Resource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); new CfnOutput(stack, 'MyOutput', { description: 'Out!', disableExport: true }); - new Parameter(stack, 'MyParam2', { type: 'Integer' }); + new CfnParameter(stack, 'MyParam2', { type: 'Integer' }); test.deepEqual(stack.toCloudFormation(), { Parameters: { @@ -44,7 +44,7 @@ export = { new Include(stack, 'T1', { template }); new Resource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); new CfnOutput(stack, 'MyOutput', { description: 'Out!' }); - new Parameter(stack, 'MyParam', { type: 'Integer' }); // duplicate! + new CfnParameter(stack, 'MyParam', { type: 'Integer' }); // duplicate! test.throws(() => stack.toCloudFormation()); test.done(); diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts index 2424939dccbac..8ebb5ad9dde6d 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts @@ -1,12 +1,12 @@ import { Test } from 'nodeunit'; -import { Construct, Parameter, Resource, Stack } from '../../lib'; +import { CfnParameter, Construct, Resource, Stack } from '../../lib'; export = { 'parameters can be used and referenced using param.ref'(test: Test) { const stack = new Stack(); const child = new Construct(stack, 'Child'); - const param = new Parameter(child, 'MyParam', { + const param = new CfnParameter(child, 'MyParam', { default: 10, type: 'Integer', description: 'My first parameter' @@ -30,9 +30,9 @@ export = { 'parameters are tokens, so they can be assigned without .ref and their Ref will be taken'(test: Test) { const stack = new Stack(); - const param = new Parameter(stack, 'MyParam', { type: 'String' }); + const param = new CfnParameter(stack, 'MyParam', { type: 'String' }); test.deepEqual(stack.node.resolve(param), { Ref: 'MyParam' }); test.done(); } -}; \ No newline at end of file +}; diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts index 4c0986520e9c4..783fa9a8ab3f4 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { App, CfnCondition, Construct, Include, CfnOutput, Parameter, Resource, ScopedAws, Stack, Token } from '../../lib'; +import { App, CfnCondition, CfnOutput, CfnParameter, Construct, Include, Resource, ScopedAws, Stack, Token } from '../../lib'; export = { 'a stack can be serialized into a CloudFormation template, initially it\'s empty'(test: Test) { @@ -107,7 +107,7 @@ export = { 'Stack.findResource will fail if the element is not a resource'(test: Test) { const stack = new Stack(); - const p = new Parameter(stack, 'MyParam', { type: 'String' }); + const p = new CfnParameter(stack, 'MyParam', { type: 'String' }); test.throws(() => stack.findResource(p.node.path)); test.done(); @@ -117,7 +117,7 @@ export = { const stack = new Stack(); - const p = new Parameter(stack, 'MyParam', { type: 'String' }); + const p = new CfnParameter(stack, 'MyParam', { type: 'String' }); const o = new CfnOutput(stack, 'MyOutput'); const c = new CfnCondition(stack, 'MyCondition'); @@ -160,7 +160,7 @@ export = { const stack2 = new Stack(app, 'Stack2'); // WHEN - used in another stack - new Parameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); + new CfnParameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); // THEN // Need to do this manually now, since we're in testing mode. In a normal CDK app, @@ -196,7 +196,7 @@ export = { const stack2 = new Stack(app, 'Stack2'); // WHEN - used in another stack - new Parameter(stack2, 'SomeParameter', { type: 'String', default: new Token(() => account1) }); + new CfnParameter(stack2, 'SomeParameter', { type: 'String', default: new Token(() => account1) }); app.node.prepareTree(); @@ -255,7 +255,7 @@ export = { const stack2 = new Stack(app, 'Stack2'); // WHEN - used in another stack - new Parameter(stack2, 'SomeParameter', { type: 'String', default: `TheAccountIs${account1}` }); + new CfnParameter(stack2, 'SomeParameter', { type: 'String', default: `TheAccountIs${account1}` }); app.node.prepareTree(); @@ -281,8 +281,8 @@ export = { const account2 = new ScopedAws(stack2).accountId; // WHEN - new Parameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); - new Parameter(stack1, 'SomeParameter', { type: 'String', default: account2 }); + new CfnParameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); + new CfnParameter(stack1, 'SomeParameter', { type: 'String', default: account2 }); test.throws(() => { app.node.prepareTree(); @@ -299,7 +299,7 @@ export = { const stack2 = new Stack(app, 'Stack2'); // WHEN - new Parameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); + new CfnParameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); app.node.prepareTree(); @@ -317,7 +317,7 @@ export = { const stack2 = new Stack(app, 'Stack2', { env: { account: '123456789012', region: 'es-norst-2' }}); // WHEN - new Parameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); + new CfnParameter(stack2, 'SomeParameter', { type: 'String', default: account1 }); test.throws(() => { app.node.prepareTree(); diff --git a/packages/@aws-cdk/cdk/test/test.synthesis.ts b/packages/@aws-cdk/cdk/test/test.synthesis.ts index 108e668da5668..95a49ba606daf 100644 --- a/packages/@aws-cdk/cdk/test/test.synthesis.ts +++ b/packages/@aws-cdk/cdk/test/test.synthesis.ts @@ -284,7 +284,7 @@ const storeTests = { // GIVEN const app = createModernApp(); const stack = new cdk.Stack(app, 'my-stack'); - const param = new cdk.Parameter(stack, 'MyParam', { type: 'string' }); + const param = new cdk.CfnParameter(stack, 'MyParam', { type: 'string' }); // WHEN stack.setParameterValue(param, 'Foo'); diff --git a/tools/cfn2ts/test/expected.cdk.output b/tools/cfn2ts/test/expected.cdk.output index 08a961f5777c8..83c3553d1f5f9 100644 --- a/tools/cfn2ts/test/expected.cdk.output +++ b/tools/cfn2ts/test/expected.cdk.output @@ -10904,7 +10904,7 @@ export namespace aws.ssm { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html */ - export class ParameterProps extends core.ConstructProps { + export class CfnParameterProps extends core.ConstructProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-type */ @@ -10946,7 +10946,7 @@ export namespace aws.ssm { */ public readonly parameterValue: ParameterValueAttribute - constructor(parent: core.Construct, props?: ParameterProps) { + constructor(parent: core.Construct, props?: CfnParameterProps) { super(parent, { type: 'AWS::SSM::Parameter', ...props }); this.parameterType = new ParameterTypeAttribute(this, 'Type'); this.parameterValue = new ParameterValueAttribute(this, 'Value'); diff --git a/tools/cfn2ts/test/expected.cfnobjects.output b/tools/cfn2ts/test/expected.cfnobjects.output index 1024a8e1a1b2a..007383a90e624 100644 --- a/tools/cfn2ts/test/expected.cfnobjects.output +++ b/tools/cfn2ts/test/expected.cfnobjects.output @@ -11725,7 +11725,7 @@ export namespace aws.ssm { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html */ - export class ParameterProps { + export class CfnParameterProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-type */ @@ -11760,7 +11760,7 @@ export namespace aws.ssm { /** * Resource properties */ - public Properties = new ParameterProps(); + public Properties = new CfnParameterProps(); /** * @cloudformation_attribute Type From bccfb2ee712335a03812dba5fa1f44be3a6b34f2 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Mon, 4 Mar 2019 16:40:39 -0800 Subject: [PATCH 04/30] Rename StackElement to CfnElement. --- .../{stack-element.ts => cfn-element.ts} | 10 +++++----- .../@aws-cdk/cdk/lib/cloudformation/condition.ts | 2 +- .../@aws-cdk/cdk/lib/cloudformation/include.ts | 4 ++-- .../cdk/lib/cloudformation/logical-id.ts | 6 +++--- .../@aws-cdk/cdk/lib/cloudformation/mapping.ts | 2 +- .../@aws-cdk/cdk/lib/cloudformation/output.ts | 4 ++-- .../@aws-cdk/cdk/lib/cloudformation/parameter.ts | 2 +- .../@aws-cdk/cdk/lib/cloudformation/resource.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/rule.ts | 2 +- .../@aws-cdk/cdk/lib/cloudformation/stack.ts | 16 ++++++++-------- packages/@aws-cdk/cdk/lib/index.ts | 4 ++-- 11 files changed, 27 insertions(+), 27 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{stack-element.ts => cfn-element.ts} (94%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack-element.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts similarity index 94% rename from packages/@aws-cdk/cdk/lib/cloudformation/stack-element.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts index 044bf504848a4..ff270bacc618b 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack-element.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts @@ -6,7 +6,7 @@ const LOGICAL_ID_MD = 'aws:cdk:logicalId'; /** * An element of a CloudFormation stack. */ -export abstract class StackElement extends Construct { +export abstract class CfnElement extends Construct { /** * Returns `true` if a construct is a stack element (i.e. part of the * synthesized cloudformation template). @@ -16,7 +16,7 @@ export abstract class StackElement extends Construct { * * @returns The construct as a stack element or undefined if it is not a stack element. */ - public static isStackElement(construct: IConstruct): construct is StackElement { + public static isCfnElement(construct: IConstruct): construct is CfnElement { return ('logicalId' in construct && 'toCloudFormation' in construct); } @@ -104,7 +104,7 @@ export abstract class StackElement extends Construct { public abstract toCloudFormation(): object; /** - * Automatically detect references in this StackElement + * Automatically detect references in this CfnElement */ protected prepare() { try { @@ -130,7 +130,7 @@ import { CfnReference } from "./cfn-tokens"; * A generic, untyped reference to a Stack Element */ export class Ref extends CfnReference { - constructor(element: StackElement) { + constructor(element: CfnElement) { super({ Ref: element.logicalId }, 'Ref', element); } } @@ -145,7 +145,7 @@ export class Ref extends CfnReference { * own, more specific types returned from the .ref attribute. Also, some * resources aren't referenceable at all (such as BucketPolicies or GatewayAttachments). */ -export abstract class Referenceable extends StackElement { +export abstract class Referenceable extends CfnElement { /** * Returns a token to a CloudFormation { Ref } that references this entity based on it's logical ID. */ diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts index e7783f23f370a..b1134a26913b1 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { ResolveContext } from '../core/tokens'; -import { Referenceable } from './stack-element'; +import { Referenceable } from './cfn-element'; export interface CfnConditionProps { expression?: IConditionExpression; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts index a938fe87a58ba..e493121209801 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts @@ -1,5 +1,5 @@ import { Construct } from '../core/construct'; -import { StackElement } from './stack-element'; +import { CfnElement } from './cfn-element'; export interface IncludeProps { /** @@ -12,7 +12,7 @@ export interface IncludeProps { * Includes a CloudFormation template into a stack. All elements of the template will be merged into * the current stack, together with any elements created programmatically. */ -export class Include extends StackElement { +export class Include extends CfnElement { /** * The included template. */ diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts index 5f858f774efd8..decb63c909fd8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts @@ -1,5 +1,5 @@ import { makeUniqueId } from '../util/uniqueid'; -import { StackElement } from './stack-element'; +import { CfnElement } from './cfn-element'; const PATH_SEP = '/'; @@ -92,8 +92,8 @@ export class LogicalIDs { /** * Return the logical ID for the given stack element */ - public getLogicalId(stackElement: StackElement): string { - const path = stackElement.stackPath.split(PATH_SEP); + public getLogicalId(cfnElement: CfnElement): string { + const path = cfnElement.stackPath.split(PATH_SEP); const generatedId = this.namingScheme.allocateAddress(path); const finalId = this.applyRename(generatedId); diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts b/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts index 5446b6977f49b..9f426a69e35f8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; +import { Referenceable } from './cfn-element'; import { Fn } from './fn'; -import { Referenceable } from './stack-element'; export interface MappingProps { mapping?: { [k1: string]: { [k2: string]: any } }; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts b/packages/@aws-cdk/cdk/lib/cloudformation/output.ts index 0d8e3d48e2276..f17c752035164 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/output.ts @@ -1,5 +1,5 @@ import { Construct } from '../core/construct'; -import { StackElement } from './stack-element'; +import { CfnElement } from './cfn-element'; export interface CfnOutputProps { /** @@ -44,7 +44,7 @@ export interface CfnOutputProps { condition?: CfnCondition; } -export class CfnOutput extends StackElement { +export class CfnOutput extends CfnElement { /** * A String type that describes the output value. * The description can be a maximum of 4 K in length. diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts b/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts index 6d837d4073ba7..8b19e995fc0e3 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; -import { Ref, Referenceable } from './stack-element'; +import { Ref, Referenceable } from './cfn-element'; export interface CfnParameterProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts index e7c8636733346..33a2eee7848df 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts @@ -2,10 +2,10 @@ import cxapi = require('@aws-cdk/cx-api'); import { Construct, IConstruct } from '../core/construct'; import { TagManager } from '../core/tag-manager'; import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/util'; +import { Referenceable } from './cfn-element'; import { CfnReference } from './cfn-tokens'; import { CfnCondition } from './condition'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; -import { Referenceable } from './stack-element'; export interface ResourceProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts index 1b7b0fe5caac9..7002332cb4d83 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts @@ -1,7 +1,7 @@ import { Construct } from '../core/construct'; import { capitalizePropertyNames } from '../core/util'; +import { Referenceable } from './cfn-element'; import { IConditionExpression } from './condition'; -import { Referenceable } from './stack-element'; /** * A rule can include a RuleCondition property and must include an Assertions property. diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index c380d1f08f23f..fe8f35c07b302 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -157,7 +157,7 @@ export class Stack extends Construct { Metadata: this.templateOptions.metadata }; - const elements = stackElements(this); + const elements = cfnElements(this); const fragments = elements.map(e => this.node.resolve(e.toCloudFormation())); // merge in all CloudFormation fragments collected from the tree @@ -582,19 +582,19 @@ export interface TemplateOptions { } /** - * Collect all StackElements from a construct + * Collect all CfnElements from a construct * - * @param node Root node to collect all StackElements from - * @param into Array to append StackElements to + * @param node Root node to collect all CfnElements from + * @param into Array to append CfnElements to * @returns The same array as is being collected into */ -function stackElements(node: IConstruct, into: StackElement[] = []): StackElement[] { - if (StackElement.isStackElement(node)) { +function cfnElements(node: IConstruct, into: CfnElement[] = []): CfnElement[] { + if (CfnElement.isCfnElement(node)) { into.push(node); } for (const child of node.node.children) { - stackElements(child, into); + cfnElements(child, into); } return into; @@ -602,9 +602,9 @@ function stackElements(node: IConstruct, into: StackElement[] = []): StackElemen // These imports have to be at the end to prevent circular imports import { ArnComponents, arnFromComponents, parseArn } from './arn'; +import { CfnElement } from './cfn-element'; import { Aws, ScopedAws } from './pseudo'; import { Resource } from './resource'; -import { StackElement } from './stack-element'; /** * Find all resources in a set of constructs diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 6b4e11a8fb43a..8fe9b9c3e99d8 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -20,7 +20,7 @@ export * from './cloudformation/resource'; export * from './cloudformation/resource-policy'; export * from './cloudformation/rule'; export * from './cloudformation/stack'; -export * from './cloudformation/stack-element'; +export * from './cloudformation/cfn-element'; export * from './cloudformation/dynamic-reference'; export * from './cloudformation/tag'; export * from './cloudformation/removal-policy'; @@ -33,4 +33,4 @@ export * from './environment'; export * from './runtime'; -export * from './synthesis'; \ No newline at end of file +export * from './synthesis'; From 4e3ffc17ae69597843e46f335f7bca23e86bddfa Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Mon, 4 Mar 2019 16:49:01 -0800 Subject: [PATCH 05/30] Rename Resource to CfnResource. --- .../@aws-cdk/assert/test/test.assertions.ts | 4 +- packages/@aws-cdk/assets/lib/asset.ts | 2 +- packages/@aws-cdk/assets/test/test.asset.ts | 4 +- .../aws-apigateway/test/test.deployment.ts | 2 +- .../aws-apigateway/test/test.restapi.ts | 2 +- .../test/integ.alarm-and-dashboard.ts | 2 +- .../@aws-cdk/aws-ec2/lib/security-group.ts | 2 +- .../test/alb/test.listener.ts | 2 +- .../test/nlb/test.listener.ts | 2 +- packages/@aws-cdk/aws-iam/lib/role.ts | 2 +- packages/@aws-cdk/aws-lambda/lib/code.ts | 8 +- .../@aws-cdk/aws-lambda/lib/function-base.ts | 2 +- .../notifications-resource-handler.ts | 2 +- .../notifications-resource.ts | 4 +- .../aws-s3/test/notification-dests.ts | 4 +- .../aws-s3/test/test.notifications.ts | 2 +- .../aws-secretsmanager/test/test.secret.ts | 2 +- .../@aws-cdk/cdk/lib/aspects/tag-aspect.ts | 8 +- .../{resource.ts => cfn-resource.ts} | 16 ++-- .../cdk/lib/cloudformation/removal-policy.ts | 4 +- .../@aws-cdk/cdk/lib/cloudformation/stack.ts | 12 +-- packages/@aws-cdk/cdk/lib/core/tag-manager.ts | 2 +- packages/@aws-cdk/cdk/lib/index.ts | 2 +- .../cdk/test/aspects/test.tag-aspect.ts | 4 +- .../cdk/test/cloudformation/test.include.ts | 6 +- .../test/cloudformation/test.logical-id.ts | 30 +++---- .../cdk/test/cloudformation/test.mappings.ts | 4 +- .../cdk/test/cloudformation/test.output.ts | 4 +- .../cdk/test/cloudformation/test.parameter.ts | 4 +- .../cdk/test/cloudformation/test.resource.ts | 78 +++++++++---------- .../cdk/test/cloudformation/test.stack.ts | 14 ++-- .../cdk/test/core/test.tag-manager.ts | 2 +- packages/@aws-cdk/cdk/test/test.app.ts | 22 +++--- packages/@aws-cdk/cdk/test/test.synthesis.ts | 6 +- packages/decdk/lib/cdk-schema.ts | 2 +- tools/awslint/lib/cfn-resources.ts | 2 +- tools/cfn2ts/lib/codegen.ts | 2 +- tools/cfn2ts/test/expected.cdk.output | 4 +- tools/cfn2ts/test/expected.cfnobjects.output | 4 +- 39 files changed, 140 insertions(+), 140 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{resource.ts => cfn-resource.ts} (96%) diff --git a/packages/@aws-cdk/assert/test/test.assertions.ts b/packages/@aws-cdk/assert/test/test.assertions.ts index f3af3fc3d7514..808ec71018bda 100644 --- a/packages/@aws-cdk/assert/test/test.assertions.ts +++ b/packages/@aws-cdk/assert/test/test.assertions.ts @@ -212,11 +212,11 @@ function synthesizedStack(fn: (stack: cdk.Stack) => void): cx.SynthesizedStack { return app.synthesizeStack(stack.name); } -interface TestResourceProps extends cdk.ResourceProps { +interface TestResourceProps extends cdk.CfnResourceProps { type: string; } -class TestResource extends cdk.Resource { +class TestResource extends cdk.CfnResource { constructor(scope: cdk.Construct, id: string, props: TestResourceProps) { super(scope, id, props); } diff --git a/packages/@aws-cdk/assets/lib/asset.ts b/packages/@aws-cdk/assets/lib/asset.ts index 99cd12bc09062..e7d230aa60be4 100644 --- a/packages/@aws-cdk/assets/lib/asset.ts +++ b/packages/@aws-cdk/assets/lib/asset.ts @@ -156,7 +156,7 @@ export class Asset extends cdk.Construct { * @param resourceProperty The property name where this asset is referenced * (e.g. "Code" for AWS::Lambda::Function) */ - public addResourceMetadata(resource: cdk.Resource, resourceProperty: string) { + public addResourceMetadata(resource: cdk.CfnResource, resourceProperty: string) { if (!this.node.getContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT)) { return; // not enabled } diff --git a/packages/@aws-cdk/assets/test/test.asset.ts b/packages/@aws-cdk/assets/test/test.asset.ts index 1c23f1b49f699..f27b07e38d26c 100644 --- a/packages/@aws-cdk/assets/test/test.asset.ts +++ b/packages/@aws-cdk/assets/test/test.asset.ts @@ -174,7 +174,7 @@ export = { stack.node.setContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT, true); const location = path.join(__dirname, 'sample-asset-directory'); - const resource = new cdk.Resource(stack, 'MyResource', { type: 'My::Resource::Type' }); + const resource = new cdk.CfnResource(stack, 'MyResource', { type: 'My::Resource::Type' }); const asset = new ZipDirectoryAsset(stack, 'MyAsset', { path: location }); // WHEN @@ -195,7 +195,7 @@ export = { const stack = new cdk.Stack(); const location = path.join(__dirname, 'sample-asset-directory'); - const resource = new cdk.Resource(stack, 'MyResource', { type: 'My::Resource::Type' }); + const resource = new cdk.CfnResource(stack, 'MyResource', { type: 'My::Resource::Type' }); const asset = new ZipDirectoryAsset(stack, 'MyAsset', { path: location }); // WHEN diff --git a/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts b/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts index 09763db2942e1..2017eb2e70a38 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts @@ -164,7 +164,7 @@ export = { const deployment = new apigateway.Deployment(stack, 'deployment', { api }); api.root.addMethod('GET'); - const dep = new cdk.Resource(stack, 'MyResource', { type: 'foo' }); + const dep = new cdk.CfnResource(stack, 'MyResource', { type: 'foo' }); // WHEN deployment.node.addDependency(dep); diff --git a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts index 5a4f243b3b76c..d3fe96d286b97 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.restapi.ts @@ -517,7 +517,7 @@ export = { const stack = new cdk.Stack(); const api = new apigateway.RestApi(stack, 'myapi'); api.root.addMethod('GET'); - const resource = new cdk.Resource(stack, 'DependsOnRestApi', { type: 'My::Resource' }); + const resource = new cdk.CfnResource(stack, 'DependsOnRestApi', { type: 'My::Resource' }); // WHEN resource.node.addDependency(api); diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts b/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts index ac6944251406b..ae5a2f6bf3a27 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts +++ b/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts @@ -11,7 +11,7 @@ const app = new cdk.App(); const stack = new cdk.Stack(app, `aws-cdk-cloudwatch`); -const queue = new cdk.Resource(stack, 'queue', { type: 'AWS::SQS::Queue' }); +const queue = new cdk.CfnResource(stack, 'queue', { type: 'AWS::SQS::Queue' }); const metric = new cloudwatch.Metric({ namespace: 'AWS/SQS', diff --git a/packages/@aws-cdk/aws-ec2/lib/security-group.ts b/packages/@aws-cdk/aws-ec2/lib/security-group.ts index db7e9832a11a9..e15ba76415d3d 100644 --- a/packages/@aws-cdk/aws-ec2/lib/security-group.ts +++ b/packages/@aws-cdk/aws-ec2/lib/security-group.ts @@ -1,4 +1,4 @@ -import { Construct, IConstruct, CfnOutput, Token } from '@aws-cdk/cdk'; +import { CfnOutput, Construct, IConstruct, Token } from '@aws-cdk/cdk'; import { Connections, IConnectable } from './connections'; import { CfnSecurityGroup, CfnSecurityGroupEgress, CfnSecurityGroupIngress } from './ec2.generated'; import { IPortRange, ISecurityGroupRule } from './security-group-rule'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.listener.ts index 061a578d03798..d12486eaa68a2 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/test.listener.ts @@ -484,7 +484,7 @@ export = { }, }; -class ResourceWithLBDependency extends cdk.Resource { +class ResourceWithLBDependency extends cdk.CfnResource { constructor(scope: cdk.Construct, id: string, targetGroup: elbv2.ITargetGroup) { super(scope, id, { type: 'Test::Resource' }); this.node.addDependency(targetGroup.loadBalancerAttached); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/test.listener.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/test.listener.ts index b60d0db5801f3..f5fd6f554c1da 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/test.listener.ts +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/test.listener.ts @@ -146,7 +146,7 @@ export = { }, }; -class ResourceWithLBDependency extends cdk.Resource { +class ResourceWithLBDependency extends cdk.CfnResource { constructor(scope: cdk.Construct, id: string, targetGroup: elbv2.ITargetGroup) { super(scope, id, { type: 'Test::Resource' }); this.node.addDependency(targetGroup.loadBalancerAttached); diff --git a/packages/@aws-cdk/aws-iam/lib/role.ts b/packages/@aws-cdk/aws-iam/lib/role.ts index b229a76b11eb2..065fa6e49e916 100644 --- a/packages/@aws-cdk/aws-iam/lib/role.ts +++ b/packages/@aws-cdk/aws-iam/lib/role.ts @@ -1,4 +1,4 @@ -import { Construct, IConstruct, CfnOutput } from '@aws-cdk/cdk'; +import { CfnOutput, Construct, IConstruct } from '@aws-cdk/cdk'; import { CfnRole } from './iam.generated'; import { IPrincipal, Policy } from './policy'; import { ArnPrincipal, PolicyDocument, PolicyPrincipal, PolicyStatement } from './policy-document'; diff --git a/packages/@aws-cdk/aws-lambda/lib/code.ts b/packages/@aws-cdk/aws-lambda/lib/code.ts index e252d32fe675a..3ebee37f33b62 100644 --- a/packages/@aws-cdk/aws-lambda/lib/code.ts +++ b/packages/@aws-cdk/aws-lambda/lib/code.ts @@ -61,7 +61,7 @@ export abstract class Code { * * @param resource the resource to which the code will be attached (a CfnFunction, or a CfnLayerVersion). */ - public abstract _toJSON(resource?: cdk.Resource): CfnFunction.CodeProperty; + public abstract _toJSON(resource?: cdk.CfnResource): CfnFunction.CodeProperty; /** * Called when the lambda or layer is initialized to allow this object to @@ -89,7 +89,7 @@ export class S3Code extends Code { this.bucketName = bucket.bucketName; } - public _toJSON(_?: cdk.Resource): CfnFunction.CodeProperty { + public _toJSON(_?: cdk.CfnResource): CfnFunction.CodeProperty { return { s3Bucket: this.bucketName, s3Key: this.key, @@ -119,7 +119,7 @@ export class InlineCode extends Code { } } - public _toJSON(_?: cdk.Resource): CfnFunction.CodeProperty { + public _toJSON(_?: cdk.CfnResource): CfnFunction.CodeProperty { return { zipFile: this.code }; @@ -169,7 +169,7 @@ export class AssetCode extends Code { } } - public _toJSON(resource?: cdk.Resource): CfnFunction.CodeProperty { + public _toJSON(resource?: cdk.CfnResource): CfnFunction.CodeProperty { if (resource) { // https://github.com/awslabs/aws-cdk/issues/1432 this.asset!.addResourceMetadata(resource, 'Code'); diff --git a/packages/@aws-cdk/aws-lambda/lib/function-base.ts b/packages/@aws-cdk/aws-lambda/lib/function-base.ts index c2f9edb762ee6..06e42ea0f4599 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function-base.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function-base.ts @@ -292,7 +292,7 @@ export abstract class FunctionBase extends cdk.Construct implements IFunction { // if we have a permission resource for this relationship, add it as a dependency // to the bucket notifications resource, so it will be created first. - const permission = this.node.tryFindChild(permissionId) as cdk.Resource; + const permission = this.node.tryFindChild(permissionId) as cdk.CfnResource; return { type: s3n.BucketNotificationDestinationType.Lambda, diff --git a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts b/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts index 9318aa023c8ba..9415d6e136e0b 100644 --- a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts +++ b/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts @@ -66,7 +66,7 @@ export class NotificationsResourceHandler extends cdk.Construct { .addAllResources()); const resourceType = 'AWS::Lambda::Function'; - class InLineLambda extends cdk.Resource { + class InLineLambda extends cdk.CfnResource { public readonly tags: cdk.TagManager = new cdk.TagManager(cdk.TagType.Standard, resourceType); protected renderProperties(properties: any): { [key: string]: any } { diff --git a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts b/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts index 9f924caee4f69..e6f3a98f58359 100644 --- a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts +++ b/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts @@ -32,7 +32,7 @@ export class BucketNotifications extends cdk.Construct { private readonly lambdaNotifications = new Array(); private readonly queueNotifications = new Array(); private readonly topicNotifications = new Array(); - private resource?: cdk.Resource; + private resource?: cdk.CfnResource; private readonly bucket: Bucket; constructor(scope: cdk.Construct, id: string, props: NotificationsProps) { @@ -102,7 +102,7 @@ export class BucketNotifications extends cdk.Construct { if (!this.resource) { const handlerArn = NotificationsResourceHandler.singleton(this); - this.resource = new cdk.Resource(this, 'Resource', { + this.resource = new cdk.CfnResource(this, 'Resource', { type: 'Custom::S3BucketNotifications', properties: { ServiceToken: handlerArn, diff --git a/packages/@aws-cdk/aws-s3/test/notification-dests.ts b/packages/@aws-cdk/aws-s3/test/notification-dests.ts index acdda43f26b46..d988f360967ab 100644 --- a/packages/@aws-cdk/aws-s3/test/notification-dests.ts +++ b/packages/@aws-cdk/aws-s3/test/notification-dests.ts @@ -14,10 +14,10 @@ export class Topic extends cdk.Construct implements s3notifications.IBucketNotif constructor(scope: cdk.Construct, id: string) { super(scope, id); - const resource = new cdk.Resource(this, 'Resource', { type: 'AWS::SNS::Topic' }); + const resource = new cdk.CfnResource(this, 'Resource', { type: 'AWS::SNS::Topic' }); const topicArn = resource.ref; - new cdk.Resource(this, 'Policy', { + new cdk.CfnResource(this, 'Policy', { type: 'AWS::SNS::TopicPolicy', properties: { Topics: [ topicArn ], diff --git a/packages/@aws-cdk/aws-s3/test/test.notifications.ts b/packages/@aws-cdk/aws-s3/test/test.notifications.ts index 9163b50ea0f3b..a82c1359fe0d5 100644 --- a/packages/@aws-cdk/aws-s3/test/test.notifications.ts +++ b/packages/@aws-cdk/aws-s3/test/test.notifications.ts @@ -295,7 +295,7 @@ export = { const stack = new Stack(); const bucket = new s3.Bucket(stack, 'Bucket'); - const dependent = new cdk.Resource(stack, 'Dependent', { type: 'DependOnMe' }); + const dependent = new cdk.CfnResource(stack, 'Dependent', { type: 'DependOnMe' }); const dest: s3n.IBucketNotificationDestination = { asBucketNotificationDestination: () => ({ arn: 'arn', diff --git a/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts b/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts index 47b724900612d..b45e670fec303 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts +++ b/packages/@aws-cdk/aws-secretsmanager/test/test.secret.ts @@ -221,7 +221,7 @@ export = { const secret = new secretsmanager.Secret(stack, 'Secret', { encryptionKey: key }); // WHEN - new cdk.Resource(stack, 'FakeResource', { + new cdk.CfnResource(stack, 'FakeResource', { type: 'CDK::Phony::Resource', properties: { value: secret.stringValue diff --git a/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts b/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts index ea35af4153e11..58f60b6ccd661 100644 --- a/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts +++ b/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts @@ -1,4 +1,4 @@ -import { ITaggable, Resource } from '../cloudformation/resource'; +import { CfnResource, ITaggable } from '../cloudformation/cfn-resource'; import { IConstruct } from '../core/construct'; import { IAspect } from './aspect'; @@ -71,11 +71,11 @@ export abstract class TagBase implements IAspect { } public visit(construct: IConstruct): void { - if (!Resource.isResource(construct)) { + if (!CfnResource.isResource(construct)) { return; } - const resource = construct as Resource; - if (Resource.isTaggable(resource)) { + const resource = construct as CfnResource; + if (CfnResource.isTaggable(resource)) { this.applyTag(resource); } } diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/cloudformation/resource.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index 33a2eee7848df..5397e9c5c7b62 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -7,7 +7,7 @@ import { CfnReference } from './cfn-tokens'; import { CfnCondition } from './condition'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; -export interface ResourceProps { +export interface CfnResourceProps { /** * CloudFormation resource type. */ @@ -28,7 +28,7 @@ export interface ITaggable { /** * Represents a CloudFormation resource. */ -export class Resource extends Referenceable { +export class CfnResource extends Referenceable { /** * A decoration used to create a CloudFormation attribute property. * @param customName Custom name for the attribute (default is the name of the property) @@ -48,7 +48,7 @@ export class Resource extends Referenceable { /** * Check whether the given construct is a Resource */ - public static isResource(construct: IConstruct): construct is Resource { + public static isResource(construct: IConstruct): construct is CfnResource { return (construct as any).resourceType !== undefined; } @@ -98,13 +98,13 @@ export class Resource extends Referenceable { * * Is filled during prepare(). */ - private readonly dependsOn = new Set(); + private readonly dependsOn = new Set(); /** * Creates a resource construct. * @param resourceType The CloudFormation type of this resource (e.g. AWS::DynamoDB::Table) */ - constructor(scope: Construct, id: string, props: ResourceProps) { + constructor(scope: Construct, id: string, props: CfnResourceProps) { super(scope, id); if (!props.type) { @@ -197,7 +197,7 @@ export class Resource extends Referenceable { * Indicates that this resource depends on another resource and cannot be provisioned * unless the other resource has been successfully provisioned. */ - public addDependsOn(resource: Resource) { + public addDependsOn(resource: CfnResource) { this.dependsOn.add(resource); } @@ -207,7 +207,7 @@ export class Resource extends Referenceable { public toCloudFormation(): object { try { // merge property overrides onto properties and then render (and validate). - const tags = Resource.isTaggable(this) ? this.tags.renderTags() : undefined; + const tags = CfnResource.isTaggable(this) ? this.tags.renderTags() : undefined; const properties = this.renderProperties(deepMerge( this.properties || {}, { tags }, @@ -244,7 +244,7 @@ export class Resource extends Referenceable { // returns the set of logical ID (tokens) this resource depends on // sorted by construct paths to ensure test determinism - function renderDependsOn(dependsOn: Set) { + function renderDependsOn(dependsOn: Set) { return Array .from(dependsOn) .sort((x, y) => x.node.path.localeCompare(y.node.path)) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/removal-policy.ts b/packages/@aws-cdk/cdk/lib/cloudformation/removal-policy.ts index bfbc297dc59fc..6e8248d9d6fe8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/removal-policy.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/removal-policy.ts @@ -1,4 +1,4 @@ -import { Resource } from './resource'; +import { CfnResource } from './cfn-resource'; import { DeletionPolicy } from './resource-policy'; export enum RemovalPolicy { @@ -21,7 +21,7 @@ export enum RemovalPolicy { Forbid } -export function applyRemovalPolicy(resource: Resource, removalPolicy: RemovalPolicy | undefined) { +export function applyRemovalPolicy(resource: CfnResource, removalPolicy: RemovalPolicy | undefined) { if (removalPolicy === RemovalPolicy.Orphan || removalPolicy === RemovalPolicy.Forbid) { resource.options.deletionPolicy = DeletionPolicy.Retain; } diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index fe8f35c07b302..dea5fe9b4a252 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -129,7 +129,7 @@ export class Stack extends Construct { * * @returns The Resource or undefined if not found */ - public findResource(path: string): Resource | undefined { + public findResource(path: string): CfnResource | undefined { const r = this.node.findChild(path); if (!r) { return undefined; } @@ -138,7 +138,7 @@ export class Stack extends Construct { throw new Error(`Found a stack element for ${path} but it is not a resource: ${r.toString()}`); } - return r as Resource; + return r as CfnResource; } /** @@ -603,16 +603,16 @@ function cfnElements(node: IConstruct, into: CfnElement[] = []): CfnElement[] { // These imports have to be at the end to prevent circular imports import { ArnComponents, arnFromComponents, parseArn } from './arn'; import { CfnElement } from './cfn-element'; +import { CfnResource } from './cfn-resource'; import { Aws, ScopedAws } from './pseudo'; -import { Resource } from './resource'; /** * Find all resources in a set of constructs */ -function findResources(roots: Iterable): Resource[] { - const ret = new Array(); +function findResources(roots: Iterable): CfnResource[] { + const ret = new Array(); for (const root of roots) { - ret.push(...root.node.findAll().filter(Resource.isResource)); + ret.push(...root.node.findAll().filter(CfnResource.isResource)); } return ret; } diff --git a/packages/@aws-cdk/cdk/lib/core/tag-manager.ts b/packages/@aws-cdk/cdk/lib/core/tag-manager.ts index 1739fb5ffa86f..a0c6a91f9a327 100644 --- a/packages/@aws-cdk/cdk/lib/core/tag-manager.ts +++ b/packages/@aws-cdk/cdk/lib/core/tag-manager.ts @@ -1,4 +1,4 @@ -import { TagType } from '../cloudformation/resource'; +import { TagType } from '../cloudformation/cfn-resource'; import { CfnTag } from '../cloudformation/tag'; interface Tag { diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 8fe9b9c3e99d8..85a2c315f59fb 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -16,7 +16,7 @@ export * from './cloudformation/mapping'; export * from './cloudformation/output'; export * from './cloudformation/parameter'; export * from './cloudformation/pseudo'; -export * from './cloudformation/resource'; +export * from './cloudformation/cfn-resource'; export * from './cloudformation/resource-policy'; export * from './cloudformation/rule'; export * from './cloudformation/stack'; diff --git a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts b/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts index 368259e287be1..4ecb350aaec4c 100644 --- a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts +++ b/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts @@ -1,7 +1,7 @@ import { Test } from 'nodeunit'; -import { Construct, RemoveTag, Resource, ResourceProps, Stack, Tag, TagManager, TagType } from '../../lib'; +import { CfnResource, CfnResourceProps, RemoveTag, Stack, Tag, TagManager, TagType } from '../../lib'; -class TaggableResource extends Resource { +class TaggableResource extends CfnResource { public readonly tags: TagManager; constructor(scope: Construct, id: string, props: ResourceProps) { super(scope, id, props); diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts index a96162c20f766..f42134c19a513 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnOutput, CfnParameter, Include, Resource, Stack } from '../../lib'; +import { CfnOutput, CfnParameter, CfnResource, Include, Stack } from '../../lib'; export = { 'the Include construct can be used to embed an existing template as-is into a stack'(test: Test) { @@ -20,7 +20,7 @@ export = { const stack = new Stack(); new Include(stack, 'T1', { template: clone(template) }); - new Resource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); + new CfnResource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); new CfnOutput(stack, 'MyOutput', { description: 'Out!', disableExport: true }); new CfnParameter(stack, 'MyParam2', { type: 'Integer' }); @@ -42,7 +42,7 @@ export = { const stack = new Stack(); new Include(stack, 'T1', { template }); - new Resource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); + new CfnResource(stack, 'MyResource3', { type: 'ResourceType3', properties: { P3: 'Hello' } }); new CfnOutput(stack, 'MyOutput', { description: 'Out!' }); new CfnParameter(stack, 'MyParam', { type: 'Integer' }); // duplicate! diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.logical-id.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.logical-id.ts index ba610c8e195a4..254a49049a5ac 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.logical-id.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.logical-id.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { Construct, HashedAddressingScheme, IAddressingScheme, Ref, Resource, Stack } from '../../lib'; +import { CfnResource, Construct, HashedAddressingScheme, IAddressingScheme, Ref, Stack } from '../../lib'; /** * These tests are executed once (for specific ID schemes) @@ -10,11 +10,11 @@ const uniqueTests = { const stack = new Stack(undefined, 'TestStack', { namingScheme: new HashedAddressingScheme() }); const A = new Construct(stack, 'A'); - new Resource(A, 'BC', { type: 'Resource' }); + new CfnResource(A, 'BC', { type: 'Resource' }); // WHEN const AB = new Construct(stack, 'AB'); - new Resource(AB, 'C', { type: 'Resource' }); + new CfnResource(AB, 'C', { type: 'Resource' }); // THEN: no exception @@ -26,7 +26,7 @@ const uniqueTests = { const stack = new Stack(undefined, 'TestStack', { namingScheme: new HashedAddressingScheme() }); // WHEN - const r = new Resource(stack, 'MyAwesomeness', { type: 'Resource' }); + const r = new CfnResource(stack, 'MyAwesomeness', { type: 'Resource' }); // THEN test.equal(stack.node.resolve(r.logicalId), 'MyAwesomeness'); @@ -41,7 +41,7 @@ const uniqueTests = { // WHEN const parent = new Construct(stack, 'Parent'); - new Resource(parent, 'ThingResource', { type: 'AWS::TAAS::Thing' }); + new CfnResource(parent, 'ThingResource', { type: 'AWS::TAAS::Thing' }); // THEN const template = stack.toCloudFormation(); @@ -73,11 +73,11 @@ const uniqueTests = { // WHEN const parent = new Construct(stack, 'Parent'); - new Resource(parent, 'ThingResource1', { type: 'AWS::TAAS::Thing' }); + new CfnResource(parent, 'ThingResource1', { type: 'AWS::TAAS::Thing' }); // THEN test.throws(() => { - new Resource(parent, 'ThingResource2', { type: 'AWS::TAAS::Thing' }); + new CfnResource(parent, 'ThingResource2', { type: 'AWS::TAAS::Thing' }); }); test.done(); @@ -92,7 +92,7 @@ const uniqueTests = { const child1 = new Construct(parent, 'Child'); const child2 = new Construct(child1, 'Resource'); - new Resource(child2, 'HeyThere', { type: 'AWS::TAAS::Thing' }); + new CfnResource(child2, 'HeyThere', { type: 'AWS::TAAS::Thing' }); // THEN const template = stack.toCloudFormation(); @@ -111,7 +111,7 @@ const uniqueTests = { // GIVEN const stack1 = new Stack(); const parent1 = new Construct(stack1, 'Parent'); - new Resource(parent1, 'HeyThere', { type: 'AWS::TAAS::Thing' }); + new CfnResource(parent1, 'HeyThere', { type: 'AWS::TAAS::Thing' }); const template1 = stack1.toCloudFormation(); // AND @@ -122,7 +122,7 @@ const uniqueTests = { const stack2 = new Stack(); const parent2 = new Construct(stack2, 'Parent'); const invisibleWrapper = new Construct(parent2, 'Default'); - new Resource(invisibleWrapper, 'HeyThere', { type: 'AWS::TAAS::Thing' }); + new CfnResource(invisibleWrapper, 'HeyThere', { type: 'AWS::TAAS::Thing' }); const template2 = stack1.toCloudFormation(); const theId2 = Object.keys(template2.Resources)[0]; @@ -169,7 +169,7 @@ const allSchemesTests: {[name: string]: (scheme: IAddressingScheme, test: Test) // WHEN test.throws(() => { - new Resource(stack, '.', { type: 'R' }); + new CfnResource(stack, '.', { type: 'R' }); }); test.done(); }, @@ -186,8 +186,8 @@ const allSchemesTests: {[name: string]: (scheme: IAddressingScheme, test: Test) // The shared part has now exceeded the maximum length of CloudFormation identifiers // so the identity generator will have to something smart - const C1 = new Resource(B, firstPart + generateString(40), { type: 'Resource' }); - const C2 = new Resource(B, firstPart + generateString(40), { type: 'Resource' }); + const C1 = new CfnResource(B, firstPart + generateString(40), { type: 'Resource' }); + const C2 = new CfnResource(B, firstPart + generateString(40), { type: 'Resource' }); // THEN test.ok(C1.logicalId.length <= 255); @@ -203,10 +203,10 @@ const allSchemesTests: {[name: string]: (scheme: IAddressingScheme, test: Test) stack.renameLogical('OriginalName', 'NewName'); // WHEN - const c1 = new Resource(stack, 'OriginalName', { type: 'R1' }); + const c1 = new CfnResource(stack, 'OriginalName', { type: 'R1' }); const ref = new Ref(c1); - const c2 = new Resource(stack, 'Construct2', { type: 'R2', properties: { ReferenceToR1: ref } }); + const c2 = new CfnResource(stack, 'Construct2', { type: 'R2', properties: { ReferenceToR1: ref } }); c2.node.addDependency(c1); // THEN diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts index 31bae1f5d8a7f..9a7954c7deef0 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { Mapping, Resource, Stack } from '../../lib'; +import { CfnResource, Mapping, Stack } from '../../lib'; export = { 'mappings can be added as another type of entity, and mapping.findInMap can be used to get a token'(test: Test) { @@ -15,7 +15,7 @@ export = { } }); // findInMap can be used to take a reference - new Resource(stack, 'MyResource', { + new CfnResource(stack, 'MyResource', { type: 'R', properties: { RefToValueInMap: mapping.findInMap('TopLevelKey1', 'SecondLevelKey1') diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts index 030aa947b89a3..919bd0848223b 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts @@ -1,10 +1,10 @@ import { Test } from 'nodeunit'; -import { CfnOutput, Ref, Resource, Stack } from '../../lib'; +import { CfnOutput, CfnResource, Ref, Stack } from '../../lib'; export = { 'outputs can be added to the stack'(test: Test) { const stack = new Stack(); - const res = new Resource(stack, 'MyResource', { type: 'R' }); + const res = new CfnResource(stack, 'MyResource', { type: 'R' }); const ref = new Ref(res); new CfnOutput(stack, 'MyOutput', { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts index 8ebb5ad9dde6d..ac9e870fd2db2 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnParameter, Construct, Resource, Stack } from '../../lib'; +import { CfnParameter, CfnResource, Construct, Stack } from '../../lib'; export = { 'parameters can be used and referenced using param.ref'(test: Test) { @@ -12,7 +12,7 @@ export = { description: 'My first parameter' }); - new Resource(stack, 'Resource', { type: 'Type', properties: { ReferenceToParam: param.ref } }); + new CfnResource(stack, 'Resource', { type: 'Type', properties: { ReferenceToParam: param.ref } }); test.deepEqual(stack.toCloudFormation(), { Parameters: { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts index 5d9a73c19dda8..897aba9b7d188 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts @@ -1,14 +1,14 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { App, applyRemovalPolicy, CfnCondition, Construct, - DeletionPolicy, Fn, HashedAddressingScheme, RemovalPolicy, - Resource, Root, Stack } from '../../lib'; +import { App, applyRemovalPolicy, CfnCondition, CfnResource, + Construct, DeletionPolicy, Fn, HashedAddressingScheme, + RemovalPolicy, Root, Stack } from '../../lib'; export = { 'all resources derive from Resource, which derives from Entity'(test: Test) { const stack = new Stack(); - new Resource(stack, 'MyResource', { + new CfnResource(stack, 'MyResource', { type: 'MyResourceType', properties: { Prop1: 'p1', Prop2: 123 @@ -32,7 +32,7 @@ export = { 'resources must reside within a Stack and fail upon creation if not'(test: Test) { const root = new Root(); - test.throws(() => new Resource(root, 'R1', { type: 'ResourceType' })); + test.throws(() => new CfnResource(root, 'R1', { type: 'ResourceType' })); test.done(); }, @@ -41,8 +41,8 @@ export = { const level1 = new Construct(stack, 'level1'); const level2 = new Construct(level1, 'level2'); const level3 = new Construct(level2, 'level3'); - const res1 = new Resource(level1, 'childoflevel1', { type: 'MyResourceType1' }); - const res2 = new Resource(level3, 'childoflevel3', { type: 'MyResourceType2' }); + const res1 = new CfnResource(level1, 'childoflevel1', { type: 'MyResourceType1' }); + const res2 = new CfnResource(level3, 'childoflevel3', { type: 'MyResourceType2' }); test.equal(withoutHash(stack.node.resolve(res1.logicalId)), 'level1childoflevel1'); test.equal(withoutHash(stack.node.resolve(res2.logicalId)), 'level1level2level3childoflevel3'); @@ -69,7 +69,7 @@ export = { const stack = new Stack(); const res = new Counter(stack, 'MyResource', { Count: 10 }); - new Resource(stack, 'YourResource', { + new CfnResource(stack, 'YourResource', { type: 'Type', properties: { CounterName: res.getAtt('Name'), @@ -98,7 +98,7 @@ export = { 'ARN-type resource attributes have some common functionality'(test: Test) { const stack = new Stack(); const res = new Counter(stack, 'MyResource', { Count: 1 }); - new Resource(stack, 'MyResource2', { + new CfnResource(stack, 'MyResource2', { type: 'Type', properties: { Perm: res.arn @@ -126,7 +126,7 @@ export = { const stack = new Stack(); const r1 = new Counter(stack, 'Counter1', { Count: 1 }); const r2 = new Counter(stack, 'Counter2', { Count: 1 }); - const r3 = new Resource(stack, 'Resource3', { type: 'MyResourceType' }); + const r3 = new CfnResource(stack, 'Resource3', { type: 'MyResourceType' }); r2.node.addDependency(r1); r2.node.addDependency(r3); @@ -156,7 +156,7 @@ export = { // GIVEN const stack = new Stack(); const r1 = new Counter(stack, 'Counter1', { Count: 1 }); - const dependent = new Resource(stack, 'Dependent', { type: 'R' }); + const dependent = new CfnResource(stack, 'Dependent', { type: 'R' }); // WHEN dependent.addDependsOn(r1); @@ -187,7 +187,7 @@ export = { 'conditions can be attached to a resource'(test: Test) { const stack = new Stack(); - const r1 = new Resource(stack, 'Resource', { type: 'Type' }); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); const cond = new CfnCondition(stack, 'MyCondition', { expression: Fn.conditionNot(Fn.conditionEquals('a', 'b')) }); r1.options.condition = cond; @@ -201,7 +201,7 @@ export = { 'creation/update/updateReplace/deletion policies can be set on a resource'(test: Test) { const stack = new Stack(); - const r1 = new Resource(stack, 'Resource', { type: 'Type' }); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); r1.options.creationPolicy = { autoScalingCreationPolicy: { minSuccessfulInstancesPercent: 10 } }; // tslint:disable-next-line:max-line-length @@ -242,7 +242,7 @@ export = { 'update policies UseOnlineResharding flag'(test: Test) { const stack = new Stack(); - const r1 = new Resource(stack, 'Resource', { type: 'Type' }); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); r1.options.updatePolicy = { useOnlineResharding: true }; @@ -262,7 +262,7 @@ export = { 'metadata can be set on a resource'(test: Test) { const stack = new Stack(); - const r1 = new Resource(stack, 'Resource', { type: 'Type' }); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); r1.options.metadata = { MyKey: 10, @@ -286,16 +286,16 @@ export = { 'the "type" property is required when creating a resource'(test: Test) { const stack = new Stack(); - test.throws(() => new Resource(stack, 'Resource', { notypehere: true } as any)); + test.throws(() => new CfnResource(stack, 'Resource', { notypehere: true } as any)); test.done(); }, 'removal policy is a high level abstraction of deletion policy used by l2'(test: Test) { const stack = new Stack(); - const orphan = new Resource(stack, 'Orphan', { type: 'T1' }); - const forbid = new Resource(stack, 'Forbid', { type: 'T2' }); - const destroy = new Resource(stack, 'Destroy', { type: 'T3' }); + const orphan = new CfnResource(stack, 'Orphan', { type: 'T1' }); + const forbid = new CfnResource(stack, 'Forbid', { type: 'T2' }); + const destroy = new CfnResource(stack, 'Destroy', { type: 'T3' }); applyRemovalPolicy(orphan, RemovalPolicy.Orphan); applyRemovalPolicy(forbid, RemovalPolicy.Forbid); @@ -311,24 +311,24 @@ export = { 'addDependency adds all dependencyElements of dependent constructs'(test: Test) { class C1 extends Construct { - public readonly r1: Resource; - public readonly r2: Resource; + public readonly r1: CfnResource; + public readonly r2: CfnResource; constructor(scope: Construct, id: string) { super(scope, id); - this.r1 = new Resource(this, 'R1', { type: 'T1' }); - this.r2 = new Resource(this, 'R2', { type: 'T2' }); + this.r1 = new CfnResource(this, 'R1', { type: 'T1' }); + this.r2 = new CfnResource(this, 'R2', { type: 'T2' }); } } class C2 extends Construct { - public readonly r3: Resource; + public readonly r3: CfnResource; constructor(scope: Construct, id: string) { super(scope, id); - this.r3 = new Resource(this, 'R3', { type: 'T3' }); + this.r3 = new CfnResource(this, 'R3', { type: 'T3' }); } } @@ -347,7 +347,7 @@ export = { const c2 = new C2(stack, 'MyC2'); const c3 = new C3(stack, 'MyC3'); - const dependingResource = new Resource(stack, 'MyResource', { type: 'R' }); + const dependingResource = new CfnResource(stack, 'MyResource', { type: 'R' }); dependingResource.node.addDependency(c1, c2); dependingResource.node.addDependency(c3); @@ -369,7 +369,7 @@ export = { 'resource.ref returns the {Ref} token'(test: Test) { const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { type: 'R' }); + const r = new CfnResource(stack, 'MyResource', { type: 'R' }); test.deepEqual(stack.node.resolve(r.ref), { Ref: 'MyResource' }); test.done(); @@ -379,7 +379,7 @@ export = { 'addOverride(p, v) allows assigning arbitrary values to synthesized resource definitions'(test: Test) { // GIVEN const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); // WHEN r.addOverride('Type', 'YouCanEvenOverrideTheType'); @@ -400,7 +400,7 @@ export = { // GIVEN const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type', properties: { Hello: { @@ -428,7 +428,7 @@ export = { // GIVEN const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type', properties: { Hello: { @@ -456,7 +456,7 @@ export = { // GIVEN const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); // WHEN r.addPropertyOverride('Tree.Exists', 42); @@ -475,7 +475,7 @@ export = { // GIVEN const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type', properties: { Hello: { @@ -504,7 +504,7 @@ export = { 'addOverride(p, v) will overwrite any non-objects along the path'(test: Test) { // GIVEN const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type', properties: { Hello: { @@ -533,7 +533,7 @@ export = { 'addPropertyOverride(pp, v) is a sugar for overriding properties'(test: Test) { // GIVEN const stack = new Stack(); - const r = new Resource(stack, 'MyResource', { + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type', properties: { Hello: { World: 42 } } }); @@ -604,7 +604,7 @@ export = { const parent = new Construct(stack, 'Parent'); - new Resource(parent, 'MyResource', { + new CfnResource(parent, 'MyResource', { type: 'MyResourceType', }); @@ -620,9 +620,9 @@ export = { // GIVEN const app = new App(); const stackA = new Stack(app, 'StackA'); - const resA = new Resource(stackA, 'Resource', { type: 'R' }); + const resA = new CfnResource(stackA, 'Resource', { type: 'R' }); const stackB = new Stack(app, 'StackB'); - const resB = new Resource(stackB, 'Resource', { type: 'R' }); + const resB = new CfnResource(stackB, 'Resource', { type: 'R' }); // WHEN resB.node.addDependency(resA); @@ -648,7 +648,7 @@ interface CounterProps { Count: number; } -class Counter extends Resource { +class Counter extends CfnResource { public readonly arn: string; public readonly url: string; @@ -667,7 +667,7 @@ function withoutHash(logId: string) { return logId.substr(0, logId.length - 8); } -class CustomizableResource extends Resource { +class CustomizableResource extends CfnResource { constructor(scope: Construct, id: string, props?: any) { super(scope, id, { type: 'MyResourceType', properties: props }); } diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts index 783fa9a8ab3f4..f09564da5fa97 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { App, CfnCondition, CfnOutput, CfnParameter, Construct, Include, Resource, ScopedAws, Stack, Token } from '../../lib'; +import { App, CfnCondition, CfnOutput, CfnParameter, CfnResource, Construct, Include, ScopedAws, Stack, Token } from '../../lib'; export = { 'a stack can be serialized into a CloudFormation template, initially it\'s empty'(test: Test) { @@ -32,7 +32,7 @@ export = { 'stack.id is not included in the logical identities of resources within it'(test: Test) { const stack = new Stack(undefined, 'MyStack'); - new Resource(stack, 'MyResource', { type: 'MyResourceType' }); + new CfnResource(stack, 'MyResource', { type: 'MyResourceType' }); test.deepEqual(stack.toCloudFormation(), { Resources: { MyResource: { Type: 'MyResourceType' } } }); test.done(); @@ -66,7 +66,7 @@ export = { const stack = new StackWithPostProcessor(); - new Resource(stack, 'myResource', { + new CfnResource(stack, 'myResource', { type: 'AWS::MyResource', properties: { MyProp1: 'hello', @@ -93,11 +93,11 @@ export = { test.ok(!stack.node.tryFindChild('foo'), 'empty stack'); - const r1 = new Resource(stack, 'Hello', { type: 'MyResource' }); + const r1 = new CfnResource(stack, 'Hello', { type: 'MyResource' }); test.equal(stack.findResource(r1.stackPath), r1, 'look up top-level'); const child = new Construct(stack, 'Child'); - const r2 = new Resource(child, 'Hello', { type: 'MyResource' }); + const r2 = new CfnResource(child, 'Hello', { type: 'MyResource' }); test.equal(stack.findResource(r2.stackPath), r2, 'look up child'); @@ -353,10 +353,10 @@ export = { 'overrideLogicalId(id) can be used to override the logical ID of a resource'(test: Test) { // GIVEN const stack = new Stack(); - const bonjour = new Resource(stack, 'BonjourResource', { type: 'Resource::Type' }); + const bonjour = new CfnResource(stack, 'BonjourResource', { type: 'Resource::Type' }); // { Ref } and { GetAtt } - new Resource(stack, 'RefToBonjour', { type: 'Other::Resource', properties: { + new CfnResource(stack, 'RefToBonjour', { type: 'Other::Resource', properties: { RefToBonjour: bonjour.ref.toString(), GetAttBonjour: bonjour.getAtt('TheAtt').toString() }}); diff --git a/packages/@aws-cdk/cdk/test/core/test.tag-manager.ts b/packages/@aws-cdk/cdk/test/core/test.tag-manager.ts index 3916097ed6edd..c4e1b59ce8e12 100644 --- a/packages/@aws-cdk/cdk/test/core/test.tag-manager.ts +++ b/packages/@aws-cdk/cdk/test/core/test.tag-manager.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { TagType } from '../../lib/cloudformation/resource'; +import { TagType } from '../../lib/cloudformation/cfn-resource'; import { TagManager } from '../../lib/core/tag-manager'; export = { diff --git a/packages/@aws-cdk/cdk/test/test.app.ts b/packages/@aws-cdk/cdk/test/test.app.ts index 59916f49c83d3..d3df0bc9be71f 100644 --- a/packages/@aws-cdk/cdk/test/test.app.ts +++ b/packages/@aws-cdk/cdk/test/test.app.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { Construct, Resource, Stack, StackProps } from '../lib'; +import { CfnResource, Construct, Stack, StackProps } from '../lib'; import { App } from '../lib/app'; function withApp(context: { [key: string]: any } | undefined, block: (app: App) => void): cxapi.SynthesizeResponse { @@ -17,11 +17,11 @@ function withApp(context: { [key: string]: any } | undefined, block: (app: App) function synth(context?: { [key: string]: any }): cxapi.SynthesizeResponse { return withApp(context, app => { const stack1 = new Stack(app, 'stack1', { env: { account: '12345', region: 'us-east-1' } }); - new Resource(stack1, 's1c1', { type: 'DummyResource', properties: { Prop1: 'Prop1' } }); - const r2 = new Resource(stack1, 's1c2', { type: 'DummyResource', properties: { Foo: 123 } }); + new CfnResource(stack1, 's1c1', { type: 'DummyResource', properties: { Prop1: 'Prop1' } }); + const r2 = new CfnResource(stack1, 's1c2', { type: 'DummyResource', properties: { Foo: 123 } }); const stack2 = new Stack(app, 'stack2'); - new Resource(stack2, 's2c1', { type: 'DummyResource', properties: { Prog2: 'Prog2' } }); + new CfnResource(stack2, 's2c1', { type: 'DummyResource', properties: { Prog2: 'Prog2' } }); const c1 = new MyConstruct(stack2, 's1c2'); // add some metadata @@ -84,7 +84,7 @@ export = { 'synth(name) can be used programmatically'(test: Test) { const prog = new App(); const stack = new Stack(prog, 'MyStack'); - new Resource(stack, 'MyResource', { type: 'MyResourceType' }); + new CfnResource(stack, 'MyResource', { type: 'MyResourceType' }); test.throws(() => prog.synthesizeStacks(['foo']), /foo/); @@ -254,7 +254,7 @@ export = { const response = withApp(context, app => { const stack = new Stack(app, 'stack1'); - new Resource(stack, 'MyResource', { type: 'Resource::Type' }); + new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); }); test.equals(response.runtime, undefined); @@ -264,7 +264,7 @@ export = { 'runtime library versions'(test: Test) { const response = withApp({}, app => { const stack = new Stack(app, 'stack1'); - new Resource(stack, 'MyResource', { type: 'Resource::Type' }); + new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); }); const libs = (response.runtime && response.runtime.libraries) || { }; @@ -281,7 +281,7 @@ export = { const response = withApp({}, app => { const stack = new Stack(app, 'stack1'); - new Resource(stack, 'MyResource', { type: 'Resource::Type' }); + new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); }); const libs = (response.runtime && response.runtime.libraries) || { }; @@ -294,7 +294,7 @@ export = { 'version reporting includes only @aws-cdk, aws-cdk and jsii libraries'(test: Test) { const response = withApp({}, app => { const stack = new Stack(app, 'stack1'); - new Resource(stack, 'MyResource', { type: 'Resource::Type' }); + new CfnResource(stack, 'MyResource', { type: 'Resource::Type' }); }); const libs = (response.runtime && response.runtime.libraries) || { }; @@ -314,8 +314,8 @@ class MyConstruct extends Construct { constructor(scope: Construct, id: string) { super(scope, id); - new Resource(this, 'r1', { type: 'ResourceType1' }); - new Resource(this, 'r2', { type: 'ResourceType2', properties: { FromContext: this.node.getContext('ctx1') } }); + new CfnResource(this, 'r1', { type: 'ResourceType1' }); + new CfnResource(this, 'r2', { type: 'ResourceType2', properties: { FromContext: this.node.getContext('ctx1') } }); } } diff --git a/packages/@aws-cdk/cdk/test/test.synthesis.ts b/packages/@aws-cdk/cdk/test/test.synthesis.ts index 95a49ba606daf..8f8e5539f14b0 100644 --- a/packages/@aws-cdk/cdk/test/test.synthesis.ts +++ b/packages/@aws-cdk/cdk/test/test.synthesis.ts @@ -98,10 +98,10 @@ export = { // GIVEN const app = new cdk.App(); const stack1 = new cdk.Stack(app, 'stack1'); - new cdk.Resource(stack1, 'Resource1', { type: 'AWS::CDK::Resource' }); - new cdk.Resource(stack1, 'Resource2', { type: 'AWS::CDK::Resource' }); + new cdk.CfnResource(stack1, 'Resource1', { type: 'AWS::CDK::Resource' }); + new cdk.CfnResource(stack1, 'Resource2', { type: 'AWS::CDK::Resource' }); const stack2 = new cdk.Stack(app, 'stack2'); - new cdk.Resource(stack2, 'ResourceA', { type: 'AWS::CDK::Resource' }); + new cdk.CfnResource(stack2, 'ResourceA', { type: 'AWS::CDK::Resource' }); // WHEN const session = app.run(); diff --git a/packages/decdk/lib/cdk-schema.ts b/packages/decdk/lib/cdk-schema.ts index 36c03503cf2e0..e14bda84bc31c 100644 --- a/packages/decdk/lib/cdk-schema.ts +++ b/packages/decdk/lib/cdk-schema.ts @@ -100,7 +100,7 @@ export function schemaForResource(construct: ConstructAndProps, ctx: SchemaConte } function isCfnResource(klass: jsiiReflect.ClassType) { - const resource = klass.system.findClass('@aws-cdk/cdk.Resource'); + const resource = klass.system.findClass('@aws-cdk/cdk.CfnResource'); return extendsType(klass, resource); } diff --git a/tools/awslint/lib/cfn-resources.ts b/tools/awslint/lib/cfn-resources.ts index 5903a3d41fbbd..e01fe3451129a 100644 --- a/tools/awslint/lib/cfn-resources.ts +++ b/tools/awslint/lib/cfn-resources.ts @@ -68,7 +68,7 @@ export function findCfnResources(assembly: reflect.Assembly): CfnResourceSpec[] if (!c.system.includesAssembly(cdkAssembly)) { return false; } - const resourceBaseClass = c.system.findFqn(`${cdkAssembly}.Resource`); + const resourceBaseClass = c.system.findFqn('@aws-cdk/cdk.CfnResource'); if (!isConstruct(c)) { return false; diff --git a/tools/cfn2ts/lib/codegen.ts b/tools/cfn2ts/lib/codegen.ts index 7d7c653bc508f..e6a73ddc4a815 100644 --- a/tools/cfn2ts/lib/codegen.ts +++ b/tools/cfn2ts/lib/codegen.ts @@ -6,7 +6,7 @@ import genspec = require('./genspec'); import { itemTypeNames, PropertyAttributeName, scalarTypeNames, SpecName } from './spec-utils'; const CORE = genspec.CORE_NAMESPACE; -const RESOURCE_BASE_CLASS = `${CORE}.Resource`; // base class for all resources +const RESOURCE_BASE_CLASS = `${CORE}.CfnResource`; // base class for all resources const CONSTRUCT_CLASS = `${CORE}.Construct`; const TAG_TYPE = `${CORE}.TagType`; const TAG_MANAGER = `${CORE}.TagManager`; diff --git a/tools/cfn2ts/test/expected.cdk.output b/tools/cfn2ts/test/expected.cdk.output index 83c3553d1f5f9..f8eecd2d0ae3e 100644 --- a/tools/cfn2ts/test/expected.cdk.output +++ b/tools/cfn2ts/test/expected.cdk.output @@ -515,7 +515,7 @@ export namespace aws.apigateway { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html */ - export class ResourceProps extends core.ConstructProps { + export class CfnResourceProps extends core.ConstructProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html#cfn-apigateway-resource-parentid */ @@ -537,7 +537,7 @@ export namespace aws.apigateway { * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html */ export class Resource extends core.Resource { - constructor(parent: core.Construct, props?: ResourceProps) { + constructor(parent: core.Construct, props?: CfnResourceProps) { super(parent, { type: 'AWS::ApiGateway::Resource', ...props }); } } diff --git a/tools/cfn2ts/test/expected.cfnobjects.output b/tools/cfn2ts/test/expected.cfnobjects.output index 007383a90e624..b66c435a7aa58 100644 --- a/tools/cfn2ts/test/expected.cfnobjects.output +++ b/tools/cfn2ts/test/expected.cfnobjects.output @@ -596,7 +596,7 @@ export namespace aws.apigateway { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html */ - export class ResourceProps { + export class CfnResourceProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html#cfn-apigateway-resource-parentid */ @@ -621,7 +621,7 @@ export namespace aws.apigateway { /** * Resource properties */ - public Properties = new ResourceProps(); + public Properties = new CfnResourceProps(); static readonly RESOURCE_TYPE = 'AWS::ApiGateway::Resource' static readonly REQUIRED_TRANSFORM = '' From db0c4ad79e7a458113954b75d663b710a8d919b5 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Tue, 5 Mar 2019 12:21:19 -0800 Subject: [PATCH 06/30] Imports order fixes due to the class and file name changes. --- packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts | 2 +- packages/@aws-cdk/aws-events/lib/rule.ts | 2 +- packages/@aws-cdk/aws-kms/lib/key.ts | 2 +- packages/@aws-cdk/aws-sns/lib/topic.ts | 2 +- .../cdk/lib/cloudformation/{condition.ts => cfn-condition.ts} | 0 .../cdk/lib/cloudformation/{output.ts => cfn-output.ts} | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/fn.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/rule.ts | 2 +- packages/@aws-cdk/cdk/lib/index.ts | 4 ++-- 11 files changed, 11 insertions(+), 11 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{condition.ts => cfn-condition.ts} (100%) rename packages/@aws-cdk/cdk/lib/cloudformation/{output.ts => cfn-output.ts} (99%) diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts index 43ff126c18af7..8812049458687 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts +++ b/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts @@ -1,4 +1,4 @@ -import { Construct, IConstruct, CfnOutput } from '@aws-cdk/cdk'; +import { CfnOutput, Construct, IConstruct } from '@aws-cdk/cdk'; import { CfnCertificate } from './certificatemanager.generated'; import { apexDomain } from './util'; diff --git a/packages/@aws-cdk/aws-events/lib/rule.ts b/packages/@aws-cdk/aws-events/lib/rule.ts index e93606b7f654f..5354dda249ca7 100644 --- a/packages/@aws-cdk/aws-events/lib/rule.ts +++ b/packages/@aws-cdk/aws-events/lib/rule.ts @@ -1,4 +1,4 @@ -import { Construct, CfnOutput, Token } from '@aws-cdk/cdk'; +import { CfnOutput, Construct, Token } from '@aws-cdk/cdk'; import { EventPattern } from './event-pattern'; import { CfnRule } from './events.generated'; import { TargetInputTemplate } from './input-options'; diff --git a/packages/@aws-cdk/aws-kms/lib/key.ts b/packages/@aws-cdk/aws-kms/lib/key.ts index 7dfbf21451e9a..6e773948d14f6 100644 --- a/packages/@aws-cdk/aws-kms/lib/key.ts +++ b/packages/@aws-cdk/aws-kms/lib/key.ts @@ -1,5 +1,5 @@ import { PolicyDocument, PolicyStatement } from '@aws-cdk/aws-iam'; -import { Construct, DeletionPolicy, IConstruct, CfnOutput } from '@aws-cdk/cdk'; +import { CfnOutput, Construct, DeletionPolicy, IConstruct } from '@aws-cdk/cdk'; import { EncryptionKeyAlias } from './alias'; import { CfnKey } from './kms.generated'; diff --git a/packages/@aws-cdk/aws-sns/lib/topic.ts b/packages/@aws-cdk/aws-sns/lib/topic.ts index 058f87d49fa72..de21f2e4ba433 100644 --- a/packages/@aws-cdk/aws-sns/lib/topic.ts +++ b/packages/@aws-cdk/aws-sns/lib/topic.ts @@ -1,4 +1,4 @@ -import { Construct, CfnOutput } from '@aws-cdk/cdk'; +import { CfnOutput, Construct } from '@aws-cdk/cdk'; import { CfnTopic } from './sns.generated'; import { ITopic, TopicBase, TopicImportProps } from './topic-base'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/cloudformation/condition.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/cloudformation/output.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts index f17c752035164..9848879a70aba 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/output.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts @@ -261,4 +261,4 @@ function fn() { return require('./fn').Fn; } -import { CfnCondition } from './condition'; +import { CfnCondition } from './cfn-condition'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index 5397e9c5c7b62..4852cad464c14 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -2,9 +2,9 @@ import cxapi = require('@aws-cdk/cx-api'); import { Construct, IConstruct } from '../core/construct'; import { TagManager } from '../core/tag-manager'; import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/util'; +import { CfnCondition } from './cfn-condition'; import { Referenceable } from './cfn-element'; import { CfnReference } from './cfn-tokens'; -import { CfnCondition } from './condition'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; export interface CfnResourceProps { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts index 5c85fec6ca1ca..9e7d721ed8137 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts @@ -112,5 +112,5 @@ export class CfnReference extends Token { } import { Construct } from "../core/construct"; -import { CfnOutput } from "./output"; +import { CfnOutput } from "./cfn-output"; import { Stack } from "./stack"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts index 0a28c09873ee8..2592c1f87ada8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts @@ -1,6 +1,6 @@ import { ResolveContext, Token, unresolved } from '../core/tokens'; import { resolve } from '../core/tokens/resolve'; -import { IConditionExpression } from './condition'; +import { IConditionExpression } from './cfn-condition'; import { minimalCloudFormationJoin } from './instrinsics'; // tslint:disable:max-line-length diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts index 7002332cb4d83..733d7af23f93a 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts @@ -1,7 +1,7 @@ import { Construct } from '../core/construct'; import { capitalizePropertyNames } from '../core/util'; +import { IConditionExpression } from './cfn-condition'; import { Referenceable } from './cfn-element'; -import { IConditionExpression } from './condition'; /** * A rule can include a RuleCondition property and must include an Assertions property. diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 85a2c315f59fb..f833726bd114a 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -8,12 +8,12 @@ export * from './core/dependency'; export * from './cloudformation/cloudformation-json'; export * from './cloudformation/cfn-tokens'; -export * from './cloudformation/condition'; +export * from './cloudformation/cfn-condition'; export * from './cloudformation/fn'; export * from './cloudformation/include'; export * from './cloudformation/logical-id'; export * from './cloudformation/mapping'; -export * from './cloudformation/output'; +export * from './cloudformation/cfn-output'; export * from './cloudformation/parameter'; export * from './cloudformation/pseudo'; export * from './cloudformation/cfn-resource'; From a71570c49b7593980581d4fb125c60a84c66cfcd Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Tue, 5 Mar 2019 13:10:26 -0800 Subject: [PATCH 07/30] Rename cfn-element.ts back to stack-element.ts to fix dependency cycles. --- packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/include.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/rule.ts | 2 +- .../cdk/lib/cloudformation/{cfn-element.ts => stack-element.ts} | 0 packages/@aws-cdk/cdk/lib/cloudformation/stack.ts | 2 +- packages/@aws-cdk/cdk/lib/index.ts | 2 +- 11 files changed, 10 insertions(+), 10 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{cfn-element.ts => stack-element.ts} (100%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts index b1134a26913b1..e7783f23f370a 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { ResolveContext } from '../core/tokens'; -import { Referenceable } from './cfn-element'; +import { Referenceable } from './stack-element'; export interface CfnConditionProps { expression?: IConditionExpression; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts index 9848879a70aba..56c96edf7b5ca 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts @@ -1,5 +1,5 @@ import { Construct } from '../core/construct'; -import { CfnElement } from './cfn-element'; +import { CfnElement } from './stack-element'; export interface CfnOutputProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index 4852cad464c14..99d7c106d820e 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -3,9 +3,9 @@ import { Construct, IConstruct } from '../core/construct'; import { TagManager } from '../core/tag-manager'; import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/util'; import { CfnCondition } from './cfn-condition'; -import { Referenceable } from './cfn-element'; import { CfnReference } from './cfn-tokens'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; +import { Referenceable } from './stack-element'; export interface CfnResourceProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts index e493121209801..79734af608696 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts @@ -1,5 +1,5 @@ import { Construct } from '../core/construct'; -import { CfnElement } from './cfn-element'; +import { CfnElement } from './stack-element'; export interface IncludeProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts index decb63c909fd8..a13db16d27461 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts @@ -1,5 +1,5 @@ import { makeUniqueId } from '../util/uniqueid'; -import { CfnElement } from './cfn-element'; +import { CfnElement } from './stack-element'; const PATH_SEP = '/'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts b/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts index 9f426a69e35f8..5446b6977f49b 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; -import { Referenceable } from './cfn-element'; import { Fn } from './fn'; +import { Referenceable } from './stack-element'; export interface MappingProps { mapping?: { [k1: string]: { [k2: string]: any } }; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts b/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts index 8b19e995fc0e3..6d837d4073ba7 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; -import { Ref, Referenceable } from './cfn-element'; +import { Ref, Referenceable } from './stack-element'; export interface CfnParameterProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts index 733d7af23f93a..4d95adeea2b01 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts @@ -1,7 +1,7 @@ import { Construct } from '../core/construct'; import { capitalizePropertyNames } from '../core/util'; import { IConditionExpression } from './cfn-condition'; -import { Referenceable } from './cfn-element'; +import { Referenceable } from './stack-element'; /** * A rule can include a RuleCondition property and must include an Assertions property. diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack-element.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/stack-element.ts diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index dea5fe9b4a252..028116fce94ca 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -602,9 +602,9 @@ function cfnElements(node: IConstruct, into: CfnElement[] = []): CfnElement[] { // These imports have to be at the end to prevent circular imports import { ArnComponents, arnFromComponents, parseArn } from './arn'; -import { CfnElement } from './cfn-element'; import { CfnResource } from './cfn-resource'; import { Aws, ScopedAws } from './pseudo'; +import { CfnElement } from './stack-element'; /** * Find all resources in a set of constructs diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index f833726bd114a..1feb8d548beb1 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -20,7 +20,7 @@ export * from './cloudformation/cfn-resource'; export * from './cloudformation/resource-policy'; export * from './cloudformation/rule'; export * from './cloudformation/stack'; -export * from './cloudformation/cfn-element'; +export * from './cloudformation/stack-element'; export * from './cloudformation/dynamic-reference'; export * from './cloudformation/tag'; export * from './cloudformation/removal-policy'; From 974fc61d19919998ba8f7432b27f758403c76055 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Tue, 5 Mar 2019 13:40:16 -0800 Subject: [PATCH 08/30] Rename parameter.ts to cfn-parameter.ts. --- .../cdk/lib/cloudformation/{parameter.ts => cfn-parameter.ts} | 0 packages/@aws-cdk/cdk/lib/cloudformation/secret.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/stack.ts | 2 +- packages/@aws-cdk/cdk/lib/index.ts | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{parameter.ts => cfn-parameter.ts} (100%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/cloudformation/parameter.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts b/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts index 5c9c1aec31277..923bceb6765e2 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; -import { CfnParameter } from './parameter'; +import { CfnParameter } from './cfn-parameter'; /** * A token that represents a value that's expected to be a secret, like diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index 028116fce94ca..e97b34905c070 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -3,9 +3,9 @@ import { App } from '../app'; import { Construct, IConstruct, PATH_SEP } from '../core/construct'; import { Environment } from '../environment'; import { ISynthesisSession } from '../synthesis'; +import { CfnParameter } from './cfn-parameter'; import { CfnReference } from './cfn-tokens'; import { HashedAddressingScheme, IAddressingScheme, LogicalIDs } from './logical-id'; -import { CfnParameter } from './parameter'; export interface StackProps { /** diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 1feb8d548beb1..4689886c8f00f 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -14,7 +14,7 @@ export * from './cloudformation/include'; export * from './cloudformation/logical-id'; export * from './cloudformation/mapping'; export * from './cloudformation/cfn-output'; -export * from './cloudformation/parameter'; +export * from './cloudformation/cfn-parameter'; export * from './cloudformation/pseudo'; export * from './cloudformation/cfn-resource'; export * from './cloudformation/resource-policy'; From 253feeafb654c6f7e35debe4508a755562b7297e Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Tue, 5 Mar 2019 14:41:24 -0800 Subject: [PATCH 09/30] Rename stack-element.ts to cfn-element.ts. --- packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts | 2 +- .../lib/cloudformation/{stack-element.ts => cfn-element.ts} | 0 packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts | 4 +++- packages/@aws-cdk/cdk/lib/cloudformation/include.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/rule.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/stack.ts | 2 +- packages/@aws-cdk/cdk/lib/index.ts | 2 +- 11 files changed, 12 insertions(+), 10 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{stack-element.ts => cfn-element.ts} (100%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts index e7783f23f370a..b1134a26913b1 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { ResolveContext } from '../core/tokens'; -import { Referenceable } from './stack-element'; +import { Referenceable } from './cfn-element'; export interface CfnConditionProps { expression?: IConditionExpression; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack-element.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/cloudformation/stack-element.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts index 56c96edf7b5ca..9848879a70aba 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts @@ -1,5 +1,5 @@ import { Construct } from '../core/construct'; -import { CfnElement } from './stack-element'; +import { CfnElement } from './cfn-element'; export interface CfnOutputProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts index 6d837d4073ba7..8b19e995fc0e3 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; -import { Ref, Referenceable } from './stack-element'; +import { Ref, Referenceable } from './cfn-element'; export interface CfnParameterProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index 99d7c106d820e..1d1ca238ce251 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -5,7 +5,9 @@ import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/ import { CfnCondition } from './cfn-condition'; import { CfnReference } from './cfn-tokens'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; -import { Referenceable } from './stack-element'; +// import required to be here, otherwise causes a cycle when running the generated JavaScript +// tslint:disable-next-line:ordered-imports +import { Referenceable } from './cfn-element'; export interface CfnResourceProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts index 79734af608696..e493121209801 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts @@ -1,5 +1,5 @@ import { Construct } from '../core/construct'; -import { CfnElement } from './stack-element'; +import { CfnElement } from './cfn-element'; export interface IncludeProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts index a13db16d27461..decb63c909fd8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts @@ -1,5 +1,5 @@ import { makeUniqueId } from '../util/uniqueid'; -import { CfnElement } from './stack-element'; +import { CfnElement } from './cfn-element'; const PATH_SEP = '/'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts b/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts index 5446b6977f49b..9f426a69e35f8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; +import { Referenceable } from './cfn-element'; import { Fn } from './fn'; -import { Referenceable } from './stack-element'; export interface MappingProps { mapping?: { [k1: string]: { [k2: string]: any } }; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts index 4d95adeea2b01..733d7af23f93a 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts @@ -1,7 +1,7 @@ import { Construct } from '../core/construct'; import { capitalizePropertyNames } from '../core/util'; import { IConditionExpression } from './cfn-condition'; -import { Referenceable } from './stack-element'; +import { Referenceable } from './cfn-element'; /** * A rule can include a RuleCondition property and must include an Assertions property. diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index e97b34905c070..651e56a9faf2e 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -602,9 +602,9 @@ function cfnElements(node: IConstruct, into: CfnElement[] = []): CfnElement[] { // These imports have to be at the end to prevent circular imports import { ArnComponents, arnFromComponents, parseArn } from './arn'; +import { CfnElement } from './cfn-element'; import { CfnResource } from './cfn-resource'; import { Aws, ScopedAws } from './pseudo'; -import { CfnElement } from './stack-element'; /** * Find all resources in a set of constructs diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 4689886c8f00f..f0b2d6eeb4722 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -20,7 +20,7 @@ export * from './cloudformation/cfn-resource'; export * from './cloudformation/resource-policy'; export * from './cloudformation/rule'; export * from './cloudformation/stack'; -export * from './cloudformation/stack-element'; +export * from './cloudformation/cfn-element'; export * from './cloudformation/dynamic-reference'; export * from './cloudformation/tag'; export * from './cloudformation/removal-policy'; From b25587f98f08312791e35c3d989fd7aa9070356d Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:21:46 -0800 Subject: [PATCH 10/30] Revert some changes to Markdown files. --- CHANGELOG.md | 2 +- design/aws-guidelines.md | 2 +- packages/@aws-cdk/aws-apigateway/README.md | 2 +- packages/@aws-cdk/aws-stepfunctions/README.md | 2 +- .../aws-cdk/lib/init-templates/app/csharp/.template.gitignore | 4 ++-- tools/awslint/README.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f896dc07e67..04a17f6c53068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1911,7 +1911,7 @@ new codepipeline.PipelineResource(this, { - Introducing **CDK Applets** which allow instantiating specific CDK stacks using a declarative YAML syntax. - As a first step to enable diagnostics features in the toolkit, record logical ID (and stack trace) in metadata for stack elements. - Introduce a new scheme for generating CloudFormation logical IDs which adds a hash of the construct path to the generated ID to avoid ID collisions. To opt-in for the new scheme, set `hashedLogicalIDs` to `true` when creating a **Stack**. -- Allow specifying explicit **logicalID** for stack elements like **Resource** **Parameter** and **CfnOutput**. +- Allow specifying explicit **logicalID** for stack elements like **Resource** **Parameter** and **Output**. - `async exec()` changed to `run()` and `validate` was changed to be a synchronous method instead of async. - Merged **@aws-cdk/core** into **aws-cdk**, which now where the core classes of the CDK framework live. - The **Runtime Values** library, which was under **@aws-cdk/rtv** is now **@aws-cdk/rtv**. diff --git a/design/aws-guidelines.md b/design/aws-guidelines.md index 0c131c1454263..dfb1a27ee8458 100644 --- a/design/aws-guidelines.md +++ b/design/aws-guidelines.md @@ -245,7 +245,7 @@ it in another stack through an `Xxx.import` call. The implementation of `export` is different between internal resources (`Xxx`) and external imported resource (`ImportedXxx` as recommended above): -For internal resources, the `export` method should produce a CloudFormation CfnOutput +For internal resources, the `export` method should produce a CloudFormation Output for each resource attribute, and return a set of `{ "Fn::ImportValue" }` tokens so they can be imported to another stack. diff --git a/packages/@aws-cdk/aws-apigateway/README.md b/packages/@aws-cdk/aws-apigateway/README.md index 3e459e51861da..a333707703efb 100644 --- a/packages/@aws-cdk/aws-apigateway/README.md +++ b/packages/@aws-cdk/aws-apigateway/README.md @@ -154,7 +154,7 @@ defined in your CDK app. This means that when you deploy your app, your API will be have open access from the internet via the stage URL. The URL of your API can be obtained from the attribute `restApi.url`, and is -also exported as an `CfnOutput` from your stack, so it's printed when you `cdk +also exported as an `Output` from your stack, so it's printed when you `cdk deploy` your app: ``` diff --git a/packages/@aws-cdk/aws-stepfunctions/README.md b/packages/@aws-cdk/aws-stepfunctions/README.md index b63116d2fe1e4..1f63977cf24a8 100644 --- a/packages/@aws-cdk/aws-stepfunctions/README.md +++ b/packages/@aws-cdk/aws-stepfunctions/README.md @@ -387,7 +387,7 @@ ARN into your worker pool: ```ts const activity = new stepfunctions.Activity(this, 'Activity'); -// Read this CfnOutput from your application and use it to poll for work on +// Read this CloudFormation Output from your application and use it to poll for work on // the activity. new cdk.CfnOutput(this, 'ActivityArn', { value: activity.activityArn }); ``` diff --git a/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore b/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore index 003e4bedc73ec..cf1054062c36b 100644 --- a/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore +++ b/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore @@ -167,7 +167,7 @@ DocProject/Help/html # Click-Once directory publish/ -# Publish Web CfnOutput +# Publish Web Output *.[Pp]ublish.xml *.azurePubxml # Note: Comment the next line if you want to checkin your web deploy settings, @@ -192,7 +192,7 @@ PublishScripts/ *.nuget.props *.nuget.targets -# Microsoft Azure Build CfnOutput +# Microsoft Azure Build Output csx/ *.build.csdef diff --git a/tools/awslint/README.md b/tools/awslint/README.md index 4728ee8a97206..fc5511dbe593c 100644 --- a/tools/awslint/README.md +++ b/tools/awslint/README.md @@ -108,7 +108,7 @@ $ awslint If `--save` is specified, `awslint` will always exit with status code 0. -## CfnOutput Options +## Output Options * Use `--verbose` to print all passing linter rules (disabled by default). * Use `--quiet` to hide all warnings and skips (just prints errors) From c0a33be74bf8986355c8e6f84535f8752d2c26e4 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:24:15 -0800 Subject: [PATCH 11/30] Revert merge mistake in awslint. --- tools/awslint/lib/cfn-resources.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/awslint/lib/cfn-resources.ts b/tools/awslint/lib/cfn-resources.ts index e01fe3451129a..b9e725e819572 100644 --- a/tools/awslint/lib/cfn-resources.ts +++ b/tools/awslint/lib/cfn-resources.ts @@ -68,7 +68,7 @@ export function findCfnResources(assembly: reflect.Assembly): CfnResourceSpec[] if (!c.system.includesAssembly(cdkAssembly)) { return false; } - const resourceBaseClass = c.system.findFqn('@aws-cdk/cdk.CfnResource'); + const resourceBaseClass = c.system.findFqn(`${cdkAssembly}.CfnResource`); if (!isConstruct(c)) { return false; From 30acf28ff2320aa28fbc19f10077cfbcd0817d60 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:32:05 -0800 Subject: [PATCH 12/30] Renamed CfnResource.isResource to isCfnResource. --- packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/stack.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts b/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts index 58f60b6ccd661..7ad3c18ce3e64 100644 --- a/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts +++ b/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts @@ -71,7 +71,7 @@ export abstract class TagBase implements IAspect { } public visit(construct: IConstruct): void { - if (!CfnResource.isResource(construct)) { + if (!CfnResource.isCfnResource(construct)) { return; } const resource = construct as CfnResource; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index 1d1ca238ce251..c4d44f1633209 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -48,9 +48,9 @@ export class CfnResource extends Referenceable { } /** - * Check whether the given construct is a Resource + * Check whether the given construct is a CfnResource */ - public static isResource(construct: IConstruct): construct is CfnResource { + public static isCfnResource(construct: IConstruct): construct is CfnResource { return (construct as any).resourceType !== undefined; } diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index 651e56a9faf2e..2f378900a2cfd 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -612,7 +612,7 @@ import { Aws, ScopedAws } from './pseudo'; function findResources(roots: Iterable): CfnResource[] { const ret = new Array(); for (const root of roots) { - ret.push(...root.node.findAll().filter(CfnResource.isResource)); + ret.push(...root.node.findAll().filter(CfnResource.isCfnResource)); } return ret; } From 1082bfb89468b83ca741d5afbb656080d8763070 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:38:23 -0800 Subject: [PATCH 13/30] Remove CfnOutput rename from a .gitignore in awslint. --- tools/awslint/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/awslint/.gitignore b/tools/awslint/.gitignore index 8e25b191cb5e8..7164f5d838004 100644 --- a/tools/awslint/.gitignore +++ b/tools/awslint/.gitignore @@ -56,7 +56,7 @@ typings/ # Optional REPL history .node_repl_history -# CfnOutput of 'npm pack' +# Output of 'npm pack' *.tgz # Yarn Integrity file From d7b359e0487dee7fa2dda467a6a751ea540a4953 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:40:09 -0800 Subject: [PATCH 14/30] Remove CfnOutput rename from a comment in pkgtools. --- tools/pkgtools/bin/find-jsii-packages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/pkgtools/bin/find-jsii-packages.ts b/tools/pkgtools/bin/find-jsii-packages.ts index 9adf614345c76..cb27f1969e478 100644 --- a/tools/pkgtools/bin/find-jsii-packages.ts +++ b/tools/pkgtools/bin/find-jsii-packages.ts @@ -32,7 +32,7 @@ function main() { return isJsii && matches; }); - // CfnOutput the JSII directories + // Output the JSII directories for (const pkg of packages) { process.stdout.write(pkg.directory + '\n'); } From 05b6c76d01c8f5e517e15bf017fbb52da11655aa Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:43:41 -0800 Subject: [PATCH 15/30] Remove CfnOutput rename from a comment in @aws-cdk/cdk. --- packages/@aws-cdk/cdk/lib/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/cdk/lib/app.ts b/packages/@aws-cdk/cdk/lib/app.ts index 8fe400e9c3395..fb9a73b53bc62 100644 --- a/packages/@aws-cdk/cdk/lib/app.ts +++ b/packages/@aws-cdk/cdk/lib/app.ts @@ -24,7 +24,7 @@ export class App extends Root { } /** - * Runs the program. CfnOutput is written to output directory as specified in the request. + * Runs the program. Output is written to output directory as specified in the request. */ public run(): ISynthesisSession { // this app has already been executed, no-op for you From 29d530931d50351dce44a5760f5b6d458e77ea88 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:49:12 -0800 Subject: [PATCH 16/30] Revert changes in the C# template .gitignore. --- .../aws-cdk/lib/init-templates/app/csharp/.template.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore b/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore index cf1054062c36b..8f83e36d4919a 100644 --- a/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore +++ b/packages/aws-cdk/lib/init-templates/app/csharp/.template.gitignore @@ -336,4 +336,4 @@ ASALocalRun/ .localhistory/ -# End of https://www.gitignore.io/api/csharp +# End of https://www.gitignore.io/api/csharp \ No newline at end of file From 7c9ea71f54a145c7ff4c133cdfcbcc30ce3645ed Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 7 Mar 2019 11:51:53 -0800 Subject: [PATCH 17/30] Revert changes in the Cloud Assembly doc. --- design/cloud-assembly.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/design/cloud-assembly.md b/design/cloud-assembly.md index 9a1c4d5f96586..63d8d808ceda1 100644 --- a/design/cloud-assembly.md +++ b/design/cloud-assembly.md @@ -470,4 +470,4 @@ Hash: SHA256 [ISO/IEC 21320-1:2015]: https://www.iso.org/standard/60101.html [JSON]: https://www.json.org [RFC 4880]: https://tools.ietf.org/html/rfc4880 -[ISO 8601]: https://www.iso.org/standard/40874.html +[ISO 8601]: https://www.iso.org/standard/40874.html \ No newline at end of file From 1df85ef1befafeaa73545fc69f146994c68ef46d Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 13:54:36 -0700 Subject: [PATCH 18/30] Rename CfnReference to Reference. --- packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts | 6 +++--- .../lib/cloudformation/{cfn-tokens.ts => reference.ts} | 8 ++++---- packages/@aws-cdk/cdk/lib/cloudformation/stack.ts | 4 ++-- packages/@aws-cdk/cdk/lib/index.ts | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{cfn-tokens.ts => reference.ts} (94%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts index ff270bacc618b..9a9ec569577b1 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts @@ -124,12 +124,12 @@ export abstract class CfnElement extends Construct { } } -import { CfnReference } from "./cfn-tokens"; +import { Reference } from "./reference"; /** * A generic, untyped reference to a Stack Element */ -export class Ref extends CfnReference { +export class Ref extends Reference { constructor(element: CfnElement) { super({ Ref: element.logicalId }, 'Ref', element); } diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index c4d44f1633209..63992b8f22e3d 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -3,7 +3,7 @@ import { Construct, IConstruct } from '../core/construct'; import { TagManager } from '../core/tag-manager'; import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/util'; import { CfnCondition } from './cfn-condition'; -import { CfnReference } from './cfn-tokens'; +import { Reference } from './reference'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; // import required to be here, otherwise causes a cycle when running the generated JavaScript // tslint:disable-next-line:ordered-imports @@ -133,7 +133,7 @@ export class CfnResource extends Referenceable { * @param attributeName The name of the attribute. */ public getAtt(attributeName: string) { - return new CfnReference({ 'Fn::GetAtt': [this.logicalId, attributeName] }, attributeName, this); + return new Reference({ 'Fn::GetAtt': [this.logicalId, attributeName] }, attributeName, this); } /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts b/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts index 6df7a99b0ba22..5f647405aba92 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; -import { CfnReference } from './cfn-tokens'; +import { Reference } from './reference'; /** * Accessor for pseudo parameters @@ -85,7 +85,7 @@ export class ScopedAws { } } -class PseudoParameter extends CfnReference { +class PseudoParameter extends Reference { constructor(name: string, scope: Construct | undefined) { super({ Ref: name }, name, scope); } @@ -137,4 +137,4 @@ class AwsStackName extends PseudoParameter { constructor(scope: Construct | undefined) { super('AWS::StackName', scope); } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts b/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts similarity index 94% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/reference.ts index 9e7d721ed8137..3edc4f846483a 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-tokens.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts @@ -14,11 +14,11 @@ import { ResolveContext, Token } from "../core/tokens"; * `consumeFromStack` on these Tokens and if they happen to be exported by a different * Stack, we'll register the dependency. */ -export class CfnReference extends Token { +export class Reference extends Token { /** - * Check whether this is actually a CfnReference + * Check whether this is actually a Reference */ - public static isCfnReference(x: Token): x is CfnReference { + public static isReference(x: Token): x is Reference { return (x as any).consumeFromStack !== undefined; } @@ -36,7 +36,7 @@ export class CfnReference extends Token { constructor(value: any, displayName?: string, scope?: Construct) { if (typeof(value) === 'function') { - throw new Error('CfnReference can only hold CloudFormation intrinsics (not a function)'); + throw new Error('Reference can only hold CloudFormation intrinsics (not a function)'); } // prepend scope path to display name if (displayName && scope) { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index 2f378900a2cfd..3819526f9f51d 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -4,8 +4,8 @@ import { Construct, IConstruct, PATH_SEP } from '../core/construct'; import { Environment } from '../environment'; import { ISynthesisSession } from '../synthesis'; import { CfnParameter } from './cfn-parameter'; -import { CfnReference } from './cfn-tokens'; import { HashedAddressingScheme, IAddressingScheme, LogicalIDs } from './logical-id'; +import { Reference } from './reference'; export interface StackProps { /** @@ -422,7 +422,7 @@ export class Stack extends Construct { protected prepare() { // References for (const ref of this.node.findReferences()) { - if (CfnReference.isCfnReference(ref)) { + if (Reference.isReference(ref)) { ref.consumeFromStack(this); } } diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index f0b2d6eeb4722..af3e4480ca50b 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -7,7 +7,7 @@ export * from './core/tag-manager'; export * from './core/dependency'; export * from './cloudformation/cloudformation-json'; -export * from './cloudformation/cfn-tokens'; +export * from './cloudformation/reference'; export * from './cloudformation/cfn-condition'; export * from './cloudformation/fn'; export * from './cloudformation/include'; From 5bf7d2dc475fad20329516a339216f6f7dea50bc Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 14:06:27 -0700 Subject: [PATCH 19/30] Rename Rule to CfnRule. --- .../cdk/lib/cloudformation/{rule.ts => cfn-rule.ts} | 6 +++--- packages/@aws-cdk/cdk/lib/index.ts | 2 +- .../@aws-cdk/cdk/test/cloudformation/test.rule.ts | 4 ++-- tools/cfn2ts/test/expected.cdk.output | 12 ++++++------ tools/cfn2ts/test/expected.cfnobjects.output | 12 ++++++------ 5 files changed, 18 insertions(+), 18 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{rule.ts => cfn-rule.ts} (96%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/cloudformation/rule.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts index 733d7af23f93a..5aefb01806cc8 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts @@ -24,7 +24,7 @@ import { Referenceable } from './cfn-element'; * * https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html */ -export interface RuleProps { +export interface CfnRuleProps { /** * If the rule condition evaluates to false, the rule doesn't take effect. * If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied. @@ -52,7 +52,7 @@ export interface RuleProps { * * @link https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html */ -export class Rule extends Referenceable { +export class CfnRule extends Referenceable { /** * If the rule condition evaluates to false, the rule doesn't take effect. * If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied. @@ -69,7 +69,7 @@ export class Rule extends Referenceable { * @param parent The parent construct. * @param props The rule props. */ - constructor(scope: Construct, id: string, props?: RuleProps) { + constructor(scope: Construct, id: string, props?: CfnRuleProps) { super(scope, id); this.ruleCondition = props && props.ruleCondition; diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index af3e4480ca50b..3c02c0c85ea2d 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -18,7 +18,7 @@ export * from './cloudformation/cfn-parameter'; export * from './cloudformation/pseudo'; export * from './cloudformation/cfn-resource'; export * from './cloudformation/resource-policy'; -export * from './cloudformation/rule'; +export * from './cloudformation/cfn-rule'; export * from './cloudformation/stack'; export * from './cloudformation/cfn-element'; export * from './cloudformation/dynamic-reference'; diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.rule.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.rule.ts index c4576dae703f2..9d2cd5e20dcb7 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.rule.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.rule.ts @@ -1,11 +1,11 @@ import { Test } from 'nodeunit'; -import { Fn, Rule, Stack } from '../../lib'; +import { CfnRule, Fn, Stack } from '../../lib'; export = { 'Rule can be used to create rules'(test: Test) { const stack = new Stack(); - const rule = new Rule(stack, 'MyRule'); + const rule = new CfnRule(stack, 'MyRule'); rule.addAssertion(Fn.conditionEquals('lhs', 'rhs'), 'lhs equals rhs'); rule.addAssertion(Fn.conditionNot(Fn.conditionAnd(Fn.conditionContains([ 'hello', 'world' ], "world"))), 'some assertion'); diff --git a/tools/cfn2ts/test/expected.cdk.output b/tools/cfn2ts/test/expected.cdk.output index f8eecd2d0ae3e..67517a675f21f 100644 --- a/tools/cfn2ts/test/expected.cdk.output +++ b/tools/cfn2ts/test/expected.cdk.output @@ -7188,7 +7188,7 @@ export namespace aws.events { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html */ - export class RuleProps extends core.ConstructProps { + export class CfnRuleProps extends core.ConstructProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-description */ @@ -7235,7 +7235,7 @@ export namespace aws.events { */ public readonly ruleArn: RuleArnAttribute - constructor(parent: core.Construct, props?: RuleProps) { + constructor(parent: core.Construct, props?: CfnRuleProps) { super(parent, { type: 'AWS::Events::Rule', ...props }); this.ruleArn = new RuleArnAttribute(this, 'Arn'); } @@ -11269,7 +11269,7 @@ export namespace aws.waf { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html */ - export class RuleProps extends core.ConstructProps { + export class CfnRuleProps extends core.ConstructProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html#cfn-waf-rule-metricname */ @@ -11291,7 +11291,7 @@ export namespace aws.waf { * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html */ export class Rule extends core.Resource { - constructor(parent: core.Construct, props?: RuleProps) { + constructor(parent: core.Construct, props?: CfnRuleProps) { super(parent, { type: 'AWS::WAF::Rule', ...props }); } } @@ -11473,7 +11473,7 @@ export namespace aws.wafregional { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html */ - export class RuleProps extends core.ConstructProps { + export class CfnRuleProps extends core.ConstructProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html#cfn-wafregional-rule-metricname */ @@ -11495,7 +11495,7 @@ export namespace aws.wafregional { * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html */ export class Rule extends core.Resource { - constructor(parent: core.Construct, props?: RuleProps) { + constructor(parent: core.Construct, props?: CfnRuleProps) { super(parent, { type: 'AWS::WAFRegional::Rule', ...props }); } } diff --git a/tools/cfn2ts/test/expected.cfnobjects.output b/tools/cfn2ts/test/expected.cfnobjects.output index b66c435a7aa58..b5bb14d87b94c 100644 --- a/tools/cfn2ts/test/expected.cfnobjects.output +++ b/tools/cfn2ts/test/expected.cfnobjects.output @@ -7719,7 +7719,7 @@ export namespace aws.events { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html */ - export class RuleProps { + export class CfnRuleProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-description */ @@ -7764,7 +7764,7 @@ export namespace aws.events { /** * Resource properties */ - public Properties = new RuleProps(); + public Properties = new CfnRuleProps(); /** * @cloudformation_attribute Arn @@ -11929,7 +11929,7 @@ export namespace aws.waf { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html */ - export class RuleProps { + export class CfnRuleProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-waf-rule.html#cfn-waf-rule-metricname */ @@ -11954,7 +11954,7 @@ export namespace aws.waf { /** * Resource properties */ - public Properties = new RuleProps(); + public Properties = new CfnRuleProps(); static readonly RESOURCE_TYPE = 'AWS::WAF::Rule' static readonly REQUIRED_TRANSFORM = '' @@ -12182,7 +12182,7 @@ export namespace aws.wafregional { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html */ - export class RuleProps { + export class CfnRuleProps { /** * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-rule.html#cfn-wafregional-rule-metricname */ @@ -12207,7 +12207,7 @@ export namespace aws.wafregional { /** * Resource properties */ - public Properties = new RuleProps(); + public Properties = new CfnRuleProps(); static readonly RESOURCE_TYPE = 'AWS::WAFRegional::Rule' static readonly REQUIRED_TRANSFORM = '' From 901c1247fbd5b3305f28645d54298bf1167afa67 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 14:16:10 -0700 Subject: [PATCH 20/30] Rename Mapping to CfnMapping. --- .../cdk/lib/cloudformation/{mapping.ts => cfn-mapping.ts} | 6 +++--- packages/@aws-cdk/cdk/lib/index.ts | 2 +- packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename packages/@aws-cdk/cdk/lib/cloudformation/{mapping.ts => cfn-mapping.ts} (88%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts similarity index 88% rename from packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts rename to packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts index 9f426a69e35f8..e8e317a5cab6e 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts @@ -2,17 +2,17 @@ import { Construct } from '../core/construct'; import { Referenceable } from './cfn-element'; import { Fn } from './fn'; -export interface MappingProps { +export interface CfnMappingProps { mapping?: { [k1: string]: { [k2: string]: any } }; } /** * Represents a CloudFormation mapping. */ -export class Mapping extends Referenceable { +export class CfnMapping extends Referenceable { private mapping: { [k1: string]: { [k2: string]: any } } = { }; - constructor(scope: Construct, id: string, props: MappingProps) { + constructor(scope: Construct, id: string, props: CfnMappingProps) { super(scope, id); this.mapping = props.mapping || { }; } diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 3c02c0c85ea2d..6947a1a3415e9 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -12,7 +12,7 @@ export * from './cloudformation/cfn-condition'; export * from './cloudformation/fn'; export * from './cloudformation/include'; export * from './cloudformation/logical-id'; -export * from './cloudformation/mapping'; +export * from './cloudformation/cfn-mapping'; export * from './cloudformation/cfn-output'; export * from './cloudformation/cfn-parameter'; export * from './cloudformation/pseudo'; diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts index 9a7954c7deef0..a42cf47224885 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts @@ -1,10 +1,10 @@ import { Test } from 'nodeunit'; -import { CfnResource, Mapping, Stack } from '../../lib'; +import { CfnMapping, CfnResource, Stack } from '../../lib'; export = { 'mappings can be added as another type of entity, and mapping.findInMap can be used to get a token'(test: Test) { const stack = new Stack(); - const mapping = new Mapping(stack, 'MyMapping', { mapping: { + const mapping = new CfnMapping(stack, 'MyMapping', { mapping: { TopLevelKey1: { SecondLevelKey1: [ 1, 2, 3 ], SecondLevelKey2: { Hello: 'World' } From 6311a3055bb3dfbe7f92ea950cbdd66e35573588 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 14:19:27 -0700 Subject: [PATCH 21/30] Rename Referencable to CfnRefElement. --- packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts index b1134a26913b1..ebe88a8fe67e4 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { ResolveContext } from '../core/tokens'; -import { Referenceable } from './cfn-element'; +import { CfnRefElement } from './cfn-element'; export interface CfnConditionProps { expression?: IConditionExpression; @@ -10,7 +10,7 @@ export interface CfnConditionProps { * Represents a CloudFormation condition, for resources which must be conditionally created and * the determination must be made at deploy time. */ -export class CfnCondition extends Referenceable implements IConditionExpression { +export class CfnCondition extends CfnRefElement implements IConditionExpression { /** * The condition statement. */ diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts index 9a9ec569577b1..aaabdef5ed08b 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts @@ -141,11 +141,11 @@ export class Ref extends Reference { * These constructs are things like Conditions and Parameters, can be * referenced by taking the `.ref` attribute. * - * Resource constructs do not inherit from Referenceable because they have their + * Resource constructs do not inherit from CfnRefElement because they have their * own, more specific types returned from the .ref attribute. Also, some * resources aren't referenceable at all (such as BucketPolicies or GatewayAttachments). */ -export abstract class Referenceable extends CfnElement { +export abstract class CfnRefElement extends CfnElement { /** * Returns a token to a CloudFormation { Ref } that references this entity based on it's logical ID. */ diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts index e8e317a5cab6e..01db04b26f71f 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts @@ -1,5 +1,5 @@ import { Construct } from '../core/construct'; -import { Referenceable } from './cfn-element'; +import { CfnRefElement } from './cfn-element'; import { Fn } from './fn'; export interface CfnMappingProps { @@ -9,7 +9,7 @@ export interface CfnMappingProps { /** * Represents a CloudFormation mapping. */ -export class CfnMapping extends Referenceable { +export class CfnMapping extends CfnRefElement { private mapping: { [k1: string]: { [k2: string]: any } } = { }; constructor(scope: Construct, id: string, props: CfnMappingProps) { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts index 8b19e995fc0e3..d64b99f789c29 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { Token } from '../core/tokens'; -import { Ref, Referenceable } from './cfn-element'; +import { CfnRefElement, Ref } from './cfn-element'; export interface CfnParameterProps { /** @@ -70,7 +70,7 @@ export interface CfnParameterProps { * Parameters enable you to input custom values to your template each time you create or * update a stack. */ -export class CfnParameter extends Referenceable { +export class CfnParameter extends CfnRefElement { /** * A token that represents the actual value of this parameter. */ diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index 63992b8f22e3d..fb11d9e4edf51 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -7,7 +7,7 @@ import { Reference } from './reference'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; // import required to be here, otherwise causes a cycle when running the generated JavaScript // tslint:disable-next-line:ordered-imports -import { Referenceable } from './cfn-element'; +import { CfnRefElement } from './cfn-element'; export interface CfnResourceProps { /** @@ -30,7 +30,7 @@ export interface ITaggable { /** * Represents a CloudFormation resource. */ -export class CfnResource extends Referenceable { +export class CfnResource extends CfnRefElement { /** * A decoration used to create a CloudFormation attribute property. * @param customName Custom name for the attribute (default is the name of the property) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts index 5aefb01806cc8..498180817d228 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts @@ -1,7 +1,7 @@ import { Construct } from '../core/construct'; import { capitalizePropertyNames } from '../core/util'; import { IConditionExpression } from './cfn-condition'; -import { Referenceable } from './cfn-element'; +import { CfnRefElement } from './cfn-element'; /** * A rule can include a RuleCondition property and must include an Assertions property. @@ -52,7 +52,7 @@ export interface CfnRuleProps { * * @link https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html */ -export class CfnRule extends Referenceable { +export class CfnRule extends CfnRefElement { /** * If the rule condition evaluates to false, the rule doesn't take effect. * If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied. From a394e13fb669d097fa2feb28bd4846908e75efeb Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 14:25:08 -0700 Subject: [PATCH 22/30] Rename IConditionExpression to ICfnConditionExpression. --- .../cdk/lib/cloudformation/cfn-condition.ts | 8 +++--- .../cdk/lib/cloudformation/cfn-rule.ts | 10 +++---- .../@aws-cdk/cdk/lib/cloudformation/fn.ts | 26 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts index ebe88a8fe67e4..91fe0a2471003 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts @@ -3,18 +3,18 @@ import { ResolveContext } from '../core/tokens'; import { CfnRefElement } from './cfn-element'; export interface CfnConditionProps { - expression?: IConditionExpression; + expression?: ICfnConditionExpression; } /** * Represents a CloudFormation condition, for resources which must be conditionally created and * the determination must be made at deploy time. */ -export class CfnCondition extends CfnRefElement implements IConditionExpression { +export class CfnCondition extends CfnRefElement implements ICfnConditionExpression { /** * The condition statement. */ - public expression?: IConditionExpression; + public expression?: ICfnConditionExpression; /** * Build a new condition. The condition must be constructed with a condition token, @@ -69,7 +69,7 @@ export class CfnCondition extends CfnRefElement implements IConditionExpression * capabilities to save costs. With conditions, you can define which resources * are created and how they're configured for each environment type. */ -export interface IConditionExpression { +export interface ICfnConditionExpression { /** * Returns a JSON node that represents this condition expression */ diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts index 498180817d228..2cb3fd533916d 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts @@ -1,6 +1,6 @@ import { Construct } from '../core/construct'; import { capitalizePropertyNames } from '../core/util'; -import { IConditionExpression } from './cfn-condition'; +import { ICfnConditionExpression } from './cfn-condition'; import { CfnRefElement } from './cfn-element'; /** @@ -29,7 +29,7 @@ export interface CfnRuleProps { * If the rule condition evaluates to false, the rule doesn't take effect. * If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied. */ - ruleCondition?: IConditionExpression; + ruleCondition?: ICfnConditionExpression; /** * Assertions which define the rule. @@ -57,7 +57,7 @@ export class CfnRule extends CfnRefElement { * If the rule condition evaluates to false, the rule doesn't take effect. * If the function in the rule condition evaluates to true, expressions in each assert are evaluated and applied. */ - public ruleCondition?: IConditionExpression; + public ruleCondition?: ICfnConditionExpression; /** * Assertions which define the rule. @@ -81,7 +81,7 @@ export class CfnRule extends CfnRefElement { * @param condition The expression to evaluation. * @param description The description of the assertion. */ - public addAssertion(condition: IConditionExpression, description: string) { + public addAssertion(condition: ICfnConditionExpression, description: string) { if (!this.assertions) { this.assertions = []; } @@ -111,7 +111,7 @@ export interface RuleAssertion { /** * The assertion. */ - assert: IConditionExpression; + assert: ICfnConditionExpression; /** * The assertion description. diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts index 2592c1f87ada8..2b4112f492ffa 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts @@ -1,6 +1,6 @@ import { ResolveContext, Token, unresolved } from '../core/tokens'; import { resolve } from '../core/tokens/resolve'; -import { IConditionExpression } from './cfn-condition'; +import { ICfnConditionExpression } from './cfn-condition'; import { minimalCloudFormationJoin } from './instrinsics'; // tslint:disable:max-line-length @@ -150,7 +150,7 @@ export class Fn { * @param conditions conditions to AND * @returns an FnCondition token */ - public static conditionAnd(...conditions: IConditionExpression[]): IConditionExpression { + public static conditionAnd(...conditions: ICfnConditionExpression[]): ICfnConditionExpression { return new FnAnd(...conditions); } @@ -161,7 +161,7 @@ export class Fn { * @param rhs A value of any type that you want to compare. * @returns an FnCondition token */ - public static conditionEquals(lhs: any, rhs: any): IConditionExpression { + public static conditionEquals(lhs: any, rhs: any): ICfnConditionExpression { return new FnEquals(lhs, rhs); } @@ -180,7 +180,7 @@ export class Fn { * evaluates to false. * @returns an FnCondition token */ - public static conditionIf(conditionId: string, valueIfTrue: any, valueIfFalse: any): IConditionExpression { + public static conditionIf(conditionId: string, valueIfTrue: any, valueIfFalse: any): ICfnConditionExpression { return new FnIf(conditionId, valueIfTrue, valueIfFalse); } @@ -191,7 +191,7 @@ export class Fn { * or false. * @returns an FnCondition token */ - public static conditionNot(condition: IConditionExpression): IConditionExpression { + public static conditionNot(condition: ICfnConditionExpression): ICfnConditionExpression { return new FnNot(condition); } @@ -203,7 +203,7 @@ export class Fn { * @param conditions conditions that evaluates to true or false. * @returns an FnCondition token */ - public static conditionOr(...conditions: IConditionExpression[]): IConditionExpression { + public static conditionOr(...conditions: ICfnConditionExpression[]): ICfnConditionExpression { return new FnOr(...conditions); } @@ -214,7 +214,7 @@ export class Fn { * @param value A string, such as "A", that you want to compare against a list of strings. * @returns an FnCondition token */ - public static conditionContains(listOfStrings: string[], value: string): IConditionExpression { + public static conditionContains(listOfStrings: string[], value: string): ICfnConditionExpression { return new FnContains(listOfStrings, value); } @@ -225,7 +225,7 @@ export class Fn { * of strings. * @returns an FnCondition token */ - public conditionEachMemberEquals(listOfStrings: string[], value: string): IConditionExpression { + public conditionEachMemberEquals(listOfStrings: string[], value: string): ICfnConditionExpression { return new FnEachMemberEquals(listOfStrings, value); } @@ -240,7 +240,7 @@ export class Fn { * strings_to_check parameter. * @returns an FnCondition token */ - public conditionEachMemberIn(stringsToCheck: string[], stringsToMatch: string): IConditionExpression { + public conditionEachMemberIn(stringsToCheck: string[], stringsToMatch: string): ICfnConditionExpression { return new FnEachMemberIn(stringsToCheck, stringsToMatch); } @@ -444,7 +444,7 @@ class FnCidr extends FnBase { } } -class FnConditionBase extends Token implements IConditionExpression { +class FnConditionBase extends Token implements ICfnConditionExpression { constructor(type: string, value: any) { super({ [type]: value }); } @@ -456,7 +456,7 @@ class FnConditionBase extends Token implements IConditionExpression { * conditions that you can include is 2, and the maximum is 10. */ class FnAnd extends FnConditionBase { - constructor(...condition: IConditionExpression[]) { + constructor(...condition: ICfnConditionExpression[]) { super('Fn::And', condition); } } @@ -504,7 +504,7 @@ class FnNot extends FnConditionBase { * Creates an ``Fn::Not`` condition function. * @param condition A condition such as ``Fn::Equals`` that evaluates to true or false. */ - constructor(condition: IConditionExpression) { + constructor(condition: ICfnConditionExpression) { super('Fn::Not', [ condition ]); } } @@ -519,7 +519,7 @@ class FnOr extends FnConditionBase { * Creates an ``Fn::Or`` condition function. * @param condition A condition that evaluates to true or false. */ - constructor(...condition: IConditionExpression[]) { + constructor(...condition: ICfnConditionExpression[]) { super('Fn::Or', condition); } } From 06d2160ebd40f294ba044e3dfde6dc0549e79f1f Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 14:59:17 -0700 Subject: [PATCH 23/30] Updates to tests. --- .../@aws-cdk/cdk/test/aspects/test.tag-aspect.ts | 12 ++++++------ .../cdk/test/cloudformation/test.condition.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts b/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts index 4ecb350aaec4c..33b576b99f7d6 100644 --- a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts +++ b/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts @@ -1,9 +1,9 @@ import { Test } from 'nodeunit'; -import { CfnResource, CfnResourceProps, RemoveTag, Stack, Tag, TagManager, TagType } from '../../lib'; +import { CfnResource, CfnResourceProps, Construct, RemoveTag, Stack, Tag, TagManager, TagType } from '../../lib'; class TaggableResource extends CfnResource { public readonly tags: TagManager; - constructor(scope: Construct, id: string, props: ResourceProps) { + constructor(scope: Construct, id: string, props: CfnResourceProps) { super(scope, id, props); const tags = props.properties === undefined ? undefined : props.properties.tags; this.tags = new TagManager(TagType.Standard, 'AWS::Fake::Resource', tags); @@ -13,9 +13,9 @@ class TaggableResource extends CfnResource { } } -class AsgTaggableResource extends Resource { +class AsgTaggableResource extends CfnResource { public readonly tags: TagManager; - constructor(scope: Construct, id: string, props: ResourceProps) { + constructor(scope: Construct, id: string, props: CfnResourceProps) { super(scope, id, props); const tags = props.properties === undefined ? undefined : props.properties.tags; this.tags = new TagManager(TagType.AutoScalingGroup, 'AWS::Fake::Resource', tags); @@ -25,9 +25,9 @@ class AsgTaggableResource extends Resource { } } -class MapTaggableResource extends Resource { +class MapTaggableResource extends CfnResource { public readonly tags: TagManager; - constructor(scope: Construct, id: string, props: ResourceProps) { + constructor(scope: Construct, id: string, props: CfnResourceProps) { super(scope, id, props); const tags = props.properties === undefined ? undefined : props.properties.tags; this.tags = new TagManager(TagType.Map, 'AWS::Fake::Resource', tags); diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts b/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts index d5a3aba3845b1..48e5363b46ced 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts +++ b/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts @@ -36,7 +36,7 @@ export = { const propValue: string = cdk.Fn.conditionIf('Cond', 'A', 'B').toString(); // WHEN - new cdk.Resource(stack, 'MyResource', { + new cdk.CfnResource(stack, 'MyResource', { type: 'AWS::Foo::Bar', properties: { StringProp: propValue From daf1462cad73e42cb3dd0e6ea9227aaa2fdb67f7 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 14:32:38 -0700 Subject: [PATCH 24/30] Flatten the 'aspects' directory. --- packages/@aws-cdk/cdk/README.md | 2 +- packages/@aws-cdk/cdk/lib/{aspects => }/aspect.ts | 2 +- packages/@aws-cdk/cdk/lib/core/construct.ts | 2 +- packages/@aws-cdk/cdk/lib/index.ts | 4 ++-- packages/@aws-cdk/cdk/lib/{aspects => }/tag-aspect.ts | 4 ++-- packages/@aws-cdk/cdk/test/test.aspect.ts | 2 +- packages/@aws-cdk/cdk/test/{aspects => }/test.tag-aspect.ts | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) rename packages/@aws-cdk/cdk/lib/{aspects => }/aspect.ts (75%) rename packages/@aws-cdk/cdk/lib/{aspects => }/tag-aspect.ts (96%) rename packages/@aws-cdk/cdk/test/{aspects => }/test.tag-aspect.ts (99%) diff --git a/packages/@aws-cdk/cdk/README.md b/packages/@aws-cdk/cdk/README.md index 344443c30b1b0..0aef94964ed42 100644 --- a/packages/@aws-cdk/cdk/README.md +++ b/packages/@aws-cdk/cdk/README.md @@ -9,7 +9,7 @@ Aspects are a mechanism to extend the CDK without having to directly impact the class hierarchy. We have implemented aspects using the [Visitor Pattern](https://en.wikipedia.org/wiki/Visitor_pattern). -An aspect in the CDK is defined by this [interface](lib/aspects/aspect.ts) +An aspect in the CDK is defined by this [interface](lib/aspect.ts) Aspects can be applied to any construct. During the tree "prepare" phase the aspect will visit each construct in the tree once. diff --git a/packages/@aws-cdk/cdk/lib/aspects/aspect.ts b/packages/@aws-cdk/cdk/lib/aspect.ts similarity index 75% rename from packages/@aws-cdk/cdk/lib/aspects/aspect.ts rename to packages/@aws-cdk/cdk/lib/aspect.ts index e8148bba35c58..ca6b38798e811 100644 --- a/packages/@aws-cdk/cdk/lib/aspects/aspect.ts +++ b/packages/@aws-cdk/cdk/lib/aspect.ts @@ -1,4 +1,4 @@ -import { IConstruct } from '../core/construct'; +import { IConstruct } from './core/construct'; /** * Represents an Aspect diff --git a/packages/@aws-cdk/cdk/lib/core/construct.ts b/packages/@aws-cdk/cdk/lib/core/construct.ts index 7892adc9b7f66..86a1280298e84 100644 --- a/packages/@aws-cdk/cdk/lib/core/construct.ts +++ b/packages/@aws-cdk/cdk/lib/core/construct.ts @@ -1,5 +1,5 @@ import cxapi = require('@aws-cdk/cx-api'); -import { IAspect } from '../aspects/aspect'; +import { IAspect } from '../aspect'; import { CloudFormationJSON } from '../cloudformation/cloudformation-json'; import { makeUniqueId } from '../util/uniqueid'; import { IDependable } from './dependency'; diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 6947a1a3415e9..11dde15913437 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -1,5 +1,5 @@ -export * from './aspects/aspect'; -export * from './aspects/tag-aspect'; +export * from './aspect'; +export * from './tag-aspect'; export * from './core/construct'; export * from './core/tokens'; diff --git a/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts b/packages/@aws-cdk/cdk/lib/tag-aspect.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts rename to packages/@aws-cdk/cdk/lib/tag-aspect.ts index 7ad3c18ce3e64..48882888577dc 100644 --- a/packages/@aws-cdk/cdk/lib/aspects/tag-aspect.ts +++ b/packages/@aws-cdk/cdk/lib/tag-aspect.ts @@ -1,6 +1,6 @@ -import { CfnResource, ITaggable } from '../cloudformation/cfn-resource'; -import { IConstruct } from '../core/construct'; import { IAspect } from './aspect'; +import { CfnResource, ITaggable } from './cloudformation/cfn-resource'; +import { IConstruct } from './core/construct'; /** * Properties for a tag diff --git a/packages/@aws-cdk/cdk/test/test.aspect.ts b/packages/@aws-cdk/cdk/test/test.aspect.ts index dde1629db5daa..d3aa7fe8c302b 100644 --- a/packages/@aws-cdk/cdk/test/test.aspect.ts +++ b/packages/@aws-cdk/cdk/test/test.aspect.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { IAspect } from '../lib/aspects/aspect'; +import { IAspect } from '../lib/aspect'; import { IConstruct, Root } from '../lib/core/construct'; class MyConstruct extends Root { diff --git a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts b/packages/@aws-cdk/cdk/test/test.tag-aspect.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts rename to packages/@aws-cdk/cdk/test/test.tag-aspect.ts index 33b576b99f7d6..ce660803bd00a 100644 --- a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts +++ b/packages/@aws-cdk/cdk/test/test.tag-aspect.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnResource, CfnResourceProps, Construct, RemoveTag, Stack, Tag, TagManager, TagType } from '../../lib'; +import { CfnResource, CfnResourceProps, Construct, RemoveTag, Stack, Tag, TagManager, TagType } from '../lib'; class TaggableResource extends CfnResource { public readonly tags: TagManager; From 6fbf1a1c79bdd89e7149b85db86adf0b673d75c2 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 15:08:45 -0700 Subject: [PATCH 25/30] Flatten the 'util' directory. --- packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts | 2 +- packages/@aws-cdk/cdk/lib/core/construct.ts | 2 +- packages/@aws-cdk/cdk/lib/{util => }/uniqueid.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename packages/@aws-cdk/cdk/lib/{util => }/uniqueid.ts (96%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts index decb63c909fd8..78f58f4340e03 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts @@ -1,4 +1,4 @@ -import { makeUniqueId } from '../util/uniqueid'; +import { makeUniqueId } from '../uniqueid'; import { CfnElement } from './cfn-element'; const PATH_SEP = '/'; diff --git a/packages/@aws-cdk/cdk/lib/core/construct.ts b/packages/@aws-cdk/cdk/lib/core/construct.ts index 86a1280298e84..3ceff32240639 100644 --- a/packages/@aws-cdk/cdk/lib/core/construct.ts +++ b/packages/@aws-cdk/cdk/lib/core/construct.ts @@ -1,7 +1,7 @@ import cxapi = require('@aws-cdk/cx-api'); import { IAspect } from '../aspect'; import { CloudFormationJSON } from '../cloudformation/cloudformation-json'; -import { makeUniqueId } from '../util/uniqueid'; +import { makeUniqueId } from '../uniqueid'; import { IDependable } from './dependency'; import { Token, unresolved } from './tokens'; import { resolve } from './tokens/resolve'; diff --git a/packages/@aws-cdk/cdk/lib/util/uniqueid.ts b/packages/@aws-cdk/cdk/lib/uniqueid.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/util/uniqueid.ts rename to packages/@aws-cdk/cdk/lib/uniqueid.ts index 1fd72cb1c765d..987455c81c397 100644 --- a/packages/@aws-cdk/cdk/lib/util/uniqueid.ts +++ b/packages/@aws-cdk/cdk/lib/uniqueid.ts @@ -36,7 +36,7 @@ export function makeUniqueId(components: string[]) { } // Lazy require in order to break a module dependency cycle - const unresolvedTokens = components.filter(c => require('../core/tokens').unresolved(c)); + const unresolvedTokens = components.filter(c => require('./core/tokens').unresolved(c)); if (unresolvedTokens.length > 0) { throw new Error(`ID components may not include unresolved tokens: ${unresolvedTokens.join(',')}`); } From 8945084044fe262416624dd56e21a0fdbb1cb11c Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 15:28:03 -0700 Subject: [PATCH 26/30] Flatten the 'core' directory. --- packages/@aws-cdk/cdk/lib/app.ts | 2 +- packages/@aws-cdk/cdk/lib/aspect.ts | 2 +- .../cdk/lib/{core/tokens => }/cfn-concat.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/arn.ts | 2 +- .../cdk/lib/cloudformation/cfn-condition.ts | 4 ++-- .../@aws-cdk/cdk/lib/cloudformation/cfn-element.ts | 8 ++++---- .../@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts | 2 +- .../@aws-cdk/cdk/lib/cloudformation/cfn-output.ts | 2 +- .../cdk/lib/cloudformation/cfn-parameter.ts | 4 ++-- .../@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts | 6 +++--- .../@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts | 4 ++-- .../cdk/lib/cloudformation/cloudformation-json.ts | 6 +++--- .../cdk/lib/cloudformation/dynamic-reference.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/fn.ts | 5 +++-- packages/@aws-cdk/cdk/lib/cloudformation/include.ts | 2 +- .../@aws-cdk/cdk/lib/cloudformation/instrinsics.ts | 2 +- packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts | 4 ++-- .../@aws-cdk/cdk/lib/cloudformation/reference.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/secret.ts | 4 ++-- packages/@aws-cdk/cdk/lib/cloudformation/stack.ts | 2 +- packages/@aws-cdk/cdk/lib/{core => }/construct.ts | 13 +++++++------ packages/@aws-cdk/cdk/lib/context.ts | 2 +- packages/@aws-cdk/cdk/lib/core/tokens/index.ts | 4 ---- packages/@aws-cdk/cdk/lib/{core => }/dependency.ts | 0 .../@aws-cdk/cdk/lib/{core/tokens => }/encoding.ts | 0 packages/@aws-cdk/cdk/lib/index.ts | 9 +++++---- .../@aws-cdk/cdk/lib/{core/tokens => }/options.ts | 0 .../@aws-cdk/cdk/lib/{core/tokens => }/resolve.ts | 4 ++-- packages/@aws-cdk/cdk/lib/runtime.ts | 4 ++-- packages/@aws-cdk/cdk/lib/tag-aspect.ts | 2 +- packages/@aws-cdk/cdk/lib/{core => }/tag-manager.ts | 4 ++-- .../@aws-cdk/cdk/lib/{core/tokens => }/token.ts | 4 ++-- packages/@aws-cdk/cdk/lib/uniqueid.ts | 2 +- .../cdk/lib/{core/tokens => }/unresolved.ts | 0 packages/@aws-cdk/cdk/lib/{core => }/util.ts | 4 ++-- packages/@aws-cdk/cdk/test/test.aspect.ts | 2 +- .../@aws-cdk/cdk/test/{core => }/test.construct.ts | 2 +- .../cdk/test/{core => }/test.tag-manager.ts | 4 ++-- .../@aws-cdk/cdk/test/{core => }/test.tokens.ts | 6 +++--- packages/@aws-cdk/cdk/test/{core => }/test.util.ts | 4 ++-- 40 files changed, 70 insertions(+), 71 deletions(-) rename packages/@aws-cdk/cdk/lib/{core/tokens => }/cfn-concat.ts (91%) rename packages/@aws-cdk/cdk/lib/{core => }/construct.ts (98%) delete mode 100644 packages/@aws-cdk/cdk/lib/core/tokens/index.ts rename packages/@aws-cdk/cdk/lib/{core => }/dependency.ts (100%) rename packages/@aws-cdk/cdk/lib/{core/tokens => }/encoding.ts (100%) rename packages/@aws-cdk/cdk/lib/{core/tokens => }/options.ts (100%) rename packages/@aws-cdk/cdk/lib/{core/tokens => }/resolve.ts (98%) rename packages/@aws-cdk/cdk/lib/{core => }/tag-manager.ts (98%) rename packages/@aws-cdk/cdk/lib/{core/tokens => }/token.ts (99%) rename packages/@aws-cdk/cdk/lib/{core/tokens => }/unresolved.ts (100%) rename packages/@aws-cdk/cdk/lib/{core => }/util.ts (98%) rename packages/@aws-cdk/cdk/test/{core => }/test.construct.ts (99%) rename packages/@aws-cdk/cdk/test/{core => }/test.tag-manager.ts (96%) rename packages/@aws-cdk/cdk/test/{core => }/test.tokens.ts (98%) rename packages/@aws-cdk/cdk/test/{core => }/test.util.ts (96%) diff --git a/packages/@aws-cdk/cdk/lib/app.ts b/packages/@aws-cdk/cdk/lib/app.ts index fb9a73b53bc62..ea7a2057a2ef7 100644 --- a/packages/@aws-cdk/cdk/lib/app.ts +++ b/packages/@aws-cdk/cdk/lib/app.ts @@ -1,5 +1,5 @@ import cxapi = require('@aws-cdk/cx-api'); -import { ConstructOrder, Root } from './core/construct'; +import { ConstructOrder, Root } from './construct'; import { FileSystemStore, InMemoryStore, ISynthesisSession, SynthesisSession } from './synthesis'; /** diff --git a/packages/@aws-cdk/cdk/lib/aspect.ts b/packages/@aws-cdk/cdk/lib/aspect.ts index ca6b38798e811..c6382e132cfdf 100644 --- a/packages/@aws-cdk/cdk/lib/aspect.ts +++ b/packages/@aws-cdk/cdk/lib/aspect.ts @@ -1,4 +1,4 @@ -import { IConstruct } from './core/construct'; +import { IConstruct } from './construct'; /** * Represents an Aspect diff --git a/packages/@aws-cdk/cdk/lib/core/tokens/cfn-concat.ts b/packages/@aws-cdk/cdk/lib/cfn-concat.ts similarity index 91% rename from packages/@aws-cdk/cdk/lib/core/tokens/cfn-concat.ts rename to packages/@aws-cdk/cdk/lib/cfn-concat.ts index f454521bce255..157ca1f4d6348 100644 --- a/packages/@aws-cdk/cdk/lib/core/tokens/cfn-concat.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-concat.ts @@ -19,4 +19,4 @@ export function cloudFormationConcat(left: any | undefined, right: any | undefin return { 'Fn::Join': ['', minimalCloudFormationJoin('', parts)] }; } -import { minimalCloudFormationJoin } from "../../cloudformation/instrinsics"; \ No newline at end of file +import { minimalCloudFormationJoin } from "./cloudformation/instrinsics"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/arn.ts b/packages/@aws-cdk/cdk/lib/cloudformation/arn.ts index 7bffa08d2da3f..92c88a12f9989 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/arn.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/arn.ts @@ -1,5 +1,5 @@ import { Fn } from '../cloudformation/fn'; -import { unresolved } from '../core/tokens'; +import { unresolved } from '../unresolved'; import { Stack } from './stack'; /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts index 91fe0a2471003..2e6cc3e4e8037 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts @@ -1,5 +1,5 @@ -import { Construct } from '../core/construct'; -import { ResolveContext } from '../core/tokens'; +import { Construct } from '../construct'; +import { ResolveContext } from '../token'; import { CfnRefElement } from './cfn-element'; export interface CfnConditionProps { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts index aaabdef5ed08b..8a818b99a91ef 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts @@ -1,5 +1,5 @@ -import { Construct, IConstruct, PATH_SEP } from "../core/construct"; -import { Token } from '../core/tokens'; +import { Construct, IConstruct, PATH_SEP } from "../construct"; +import { Token } from '../token'; const LOGICAL_ID_MD = 'aws:cdk:logicalId'; @@ -43,7 +43,7 @@ export abstract class CfnElement extends Construct { constructor(scope: Construct, id: string) { super(scope, id); - this.node.addMetadata(LOGICAL_ID_MD, new (require("../core/tokens/token").Token)(() => this.logicalId), this.constructor); + this.node.addMetadata(LOGICAL_ID_MD, new (require("../token").Token)(() => this.logicalId), this.constructor); this._logicalId = this.node.stack.logicalIds.getLogicalId(this); this.logicalId = new Token(() => this._logicalId).toString(); @@ -154,4 +154,4 @@ export abstract class CfnRefElement extends CfnElement { } } -import { findTokens } from "../core/tokens/resolve"; +import { findTokens } from "../resolve"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts index 01db04b26f71f..7d7a6cf68c9cf 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts @@ -1,4 +1,4 @@ -import { Construct } from '../core/construct'; +import { Construct } from '../construct'; import { CfnRefElement } from './cfn-element'; import { Fn } from './fn'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts index 9848879a70aba..08edf82c89c14 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts @@ -1,4 +1,4 @@ -import { Construct } from '../core/construct'; +import { Construct } from '../construct'; import { CfnElement } from './cfn-element'; export interface CfnOutputProps { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts index d64b99f789c29..38ba93163582d 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts @@ -1,5 +1,5 @@ -import { Construct } from '../core/construct'; -import { Token } from '../core/tokens'; +import { Construct } from '../construct'; +import { Token } from '../token'; import { CfnRefElement, Ref } from './cfn-element'; export interface CfnParameterProps { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts index fb11d9e4edf51..c4f8e45af0114 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts @@ -1,7 +1,7 @@ import cxapi = require('@aws-cdk/cx-api'); -import { Construct, IConstruct } from '../core/construct'; -import { TagManager } from '../core/tag-manager'; -import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../core/util'; +import { Construct, IConstruct } from '../construct'; +import { TagManager } from '../tag-manager'; +import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../util'; import { CfnCondition } from './cfn-condition'; import { Reference } from './reference'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts index 2cb3fd533916d..907f57a2abce9 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts @@ -1,5 +1,5 @@ -import { Construct } from '../core/construct'; -import { capitalizePropertyNames } from '../core/util'; +import { Construct } from '../construct'; +import { capitalizePropertyNames } from '../util'; import { ICfnConditionExpression } from './cfn-condition'; import { CfnRefElement } from './cfn-element'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cloudformation-json.ts b/packages/@aws-cdk/cdk/lib/cloudformation/cloudformation-json.ts index 62d5333397f49..711d3be2181f1 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cloudformation-json.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/cloudformation-json.ts @@ -1,6 +1,6 @@ -import { IConstruct } from "../core/construct"; -import { Token } from "../core/tokens"; -import { resolve } from "../core/tokens/resolve"; +import { IConstruct } from "../construct"; +import { resolve } from "../resolve"; +import { Token } from "../token"; import { isIntrinsic } from "./instrinsics"; /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts b/packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts index f3bccf0a78a41..bbc5b8573ff28 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts @@ -1,5 +1,5 @@ -import { Construct } from "../core/construct"; -import { Token } from "../core/tokens"; +import { Construct } from "../construct"; +import { Token } from "../token"; /** * Properties for a Dynamic Reference diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts index 2b4112f492ffa..877491dd2a351 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts @@ -1,5 +1,6 @@ -import { ResolveContext, Token, unresolved } from '../core/tokens'; -import { resolve } from '../core/tokens/resolve'; +import { resolve } from '../resolve'; +import { ResolveContext, Token } from '../token'; +import { unresolved } from '../unresolved'; import { ICfnConditionExpression } from './cfn-condition'; import { minimalCloudFormationJoin } from './instrinsics'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts index e493121209801..a2fe0346f4675 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/include.ts @@ -1,4 +1,4 @@ -import { Construct } from '../core/construct'; +import { Construct } from '../construct'; import { CfnElement } from './cfn-element'; export interface IncludeProps { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts b/packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts index 58356f3061a58..5adf61fcc7a01 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts @@ -55,4 +55,4 @@ export function canEvaluateToList(x: any) { return isIntrinsic(x) && ['Ref', 'Fn::GetAtt', 'Fn::GetAZs', 'Fn::Split', 'Fn::FindInMap', 'Fn::ImportValue'].includes(Object.keys(x)[0]); } -import { unresolved } from "../core/tokens/unresolved"; +import { unresolved } from "../unresolved"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts b/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts index 5f647405aba92..5d3166c9b7a6b 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts @@ -1,5 +1,5 @@ -import { Construct } from '../core/construct'; -import { Token } from '../core/tokens'; +import { Construct } from '../construct'; +import { Token } from '../token'; import { Reference } from './reference'; /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts b/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts index 3edc4f846483a..73db649ae087c 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts @@ -1,4 +1,4 @@ -import { ResolveContext, Token } from "../core/tokens"; +import { ResolveContext, Token } from "../token"; /** * A Token that represents a CloudFormation reference to another resource @@ -111,6 +111,6 @@ export class Reference extends Token { } -import { Construct } from "../core/construct"; +import { Construct } from "../construct"; import { CfnOutput } from "./cfn-output"; import { Stack } from "./stack"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts b/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts index 923bceb6765e2..12fde7821f181 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts @@ -1,5 +1,5 @@ -import { Construct } from '../core/construct'; -import { Token } from '../core/tokens'; +import { Construct } from '../construct'; +import { Token } from '../token'; import { CfnParameter } from './cfn-parameter'; /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts index 3819526f9f51d..b7bee1fd0ae60 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { App } from '../app'; -import { Construct, IConstruct, PATH_SEP } from '../core/construct'; +import { Construct, IConstruct, PATH_SEP } from '../construct'; import { Environment } from '../environment'; import { ISynthesisSession } from '../synthesis'; import { CfnParameter } from './cfn-parameter'; diff --git a/packages/@aws-cdk/cdk/lib/core/construct.ts b/packages/@aws-cdk/cdk/lib/construct.ts similarity index 98% rename from packages/@aws-cdk/cdk/lib/core/construct.ts rename to packages/@aws-cdk/cdk/lib/construct.ts index 3ceff32240639..b8585087d6443 100644 --- a/packages/@aws-cdk/cdk/lib/core/construct.ts +++ b/packages/@aws-cdk/cdk/lib/construct.ts @@ -1,10 +1,11 @@ import cxapi = require('@aws-cdk/cx-api'); -import { IAspect } from '../aspect'; -import { CloudFormationJSON } from '../cloudformation/cloudformation-json'; -import { makeUniqueId } from '../uniqueid'; +import { IAspect } from './aspect'; +import { CloudFormationJSON } from './cloudformation/cloudformation-json'; import { IDependable } from './dependency'; -import { Token, unresolved } from './tokens'; -import { resolve } from './tokens/resolve'; +import { resolve } from './resolve'; +import { Token } from './token'; +import { makeUniqueId } from './uniqueid'; +import { unresolved } from './unresolved'; export const PATH_SEP = '/'; @@ -737,4 +738,4 @@ export interface Dependency { } // Import this _after_ everything else to help node work the classes out in the correct order... -import { Stack } from '../cloudformation/stack'; +import { Stack } from './cloudformation/stack'; diff --git a/packages/@aws-cdk/cdk/lib/context.ts b/packages/@aws-cdk/cdk/lib/context.ts index c31ae244f9cc2..9ced8ea2a6bda 100644 --- a/packages/@aws-cdk/cdk/lib/context.ts +++ b/packages/@aws-cdk/cdk/lib/context.ts @@ -1,5 +1,5 @@ import cxapi = require('@aws-cdk/cx-api'); -import { Construct } from './core/construct'; +import { Construct } from './construct'; type ContextProviderProps = {[key: string]: any}; /** diff --git a/packages/@aws-cdk/cdk/lib/core/tokens/index.ts b/packages/@aws-cdk/cdk/lib/core/tokens/index.ts deleted file mode 100644 index af82e0f1c238c..0000000000000 --- a/packages/@aws-cdk/cdk/lib/core/tokens/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This exports the modules that should be publicly available (not all of them) - -export * from './token'; -export * from './unresolved'; \ No newline at end of file diff --git a/packages/@aws-cdk/cdk/lib/core/dependency.ts b/packages/@aws-cdk/cdk/lib/dependency.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/core/dependency.ts rename to packages/@aws-cdk/cdk/lib/dependency.ts diff --git a/packages/@aws-cdk/cdk/lib/core/tokens/encoding.ts b/packages/@aws-cdk/cdk/lib/encoding.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/core/tokens/encoding.ts rename to packages/@aws-cdk/cdk/lib/encoding.ts diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 11dde15913437..8eae746e92331 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -1,10 +1,11 @@ export * from './aspect'; export * from './tag-aspect'; -export * from './core/construct'; -export * from './core/tokens'; -export * from './core/tag-manager'; -export * from './core/dependency'; +export * from './construct'; +export * from './token'; +export * from './unresolved'; +export * from './tag-manager'; +export * from './dependency'; export * from './cloudformation/cloudformation-json'; export * from './cloudformation/reference'; diff --git a/packages/@aws-cdk/cdk/lib/core/tokens/options.ts b/packages/@aws-cdk/cdk/lib/options.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/core/tokens/options.ts rename to packages/@aws-cdk/cdk/lib/options.ts diff --git a/packages/@aws-cdk/cdk/lib/core/tokens/resolve.ts b/packages/@aws-cdk/cdk/lib/resolve.ts similarity index 98% rename from packages/@aws-cdk/cdk/lib/core/tokens/resolve.ts rename to packages/@aws-cdk/cdk/lib/resolve.ts index af19bb0cc9489..a8a4582274a7e 100644 --- a/packages/@aws-cdk/cdk/lib/core/tokens/resolve.ts +++ b/packages/@aws-cdk/cdk/lib/resolve.ts @@ -1,4 +1,4 @@ -import { IConstruct } from '../construct'; +import { IConstruct } from './construct'; import { containsListToken, TOKEN_MAP } from "./encoding"; import { RESOLVE_OPTIONS } from "./options"; import { isResolvedValuePostProcessor, RESOLVE_METHOD, ResolveContext, Token } from "./token"; @@ -153,4 +153,4 @@ export function findTokens(scope: IConstruct, fn: () => any): Token[] { */ function isConstruct(x: any): boolean { return x._children !== undefined && x._metadata !== undefined; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/cdk/lib/runtime.ts b/packages/@aws-cdk/cdk/lib/runtime.ts index 00d55a2cdcfbe..56e2aec98595b 100644 --- a/packages/@aws-cdk/cdk/lib/runtime.ts +++ b/packages/@aws-cdk/cdk/lib/runtime.ts @@ -1,4 +1,4 @@ -import { Construct } from './core/construct'; +import { Construct } from './construct'; // ---------------------------------------------------------------------- // PROPERTY MAPPERS @@ -388,4 +388,4 @@ function isCloudFormationIntrinsic(x: any) { // Cannot be public because JSII gets confused about es5.d.ts class CfnSynthesisError extends Error { public readonly type = 'CfnSynthesisError'; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/cdk/lib/tag-aspect.ts b/packages/@aws-cdk/cdk/lib/tag-aspect.ts index 48882888577dc..a78b5df515936 100644 --- a/packages/@aws-cdk/cdk/lib/tag-aspect.ts +++ b/packages/@aws-cdk/cdk/lib/tag-aspect.ts @@ -1,6 +1,6 @@ import { IAspect } from './aspect'; import { CfnResource, ITaggable } from './cloudformation/cfn-resource'; -import { IConstruct } from './core/construct'; +import { IConstruct } from './construct'; /** * Properties for a tag diff --git a/packages/@aws-cdk/cdk/lib/core/tag-manager.ts b/packages/@aws-cdk/cdk/lib/tag-manager.ts similarity index 98% rename from packages/@aws-cdk/cdk/lib/core/tag-manager.ts rename to packages/@aws-cdk/cdk/lib/tag-manager.ts index a0c6a91f9a327..832cb21aa763a 100644 --- a/packages/@aws-cdk/cdk/lib/core/tag-manager.ts +++ b/packages/@aws-cdk/cdk/lib/tag-manager.ts @@ -1,5 +1,5 @@ -import { TagType } from '../cloudformation/cfn-resource'; -import { CfnTag } from '../cloudformation/tag'; +import { TagType } from './cloudformation/cfn-resource'; +import { CfnTag } from './cloudformation/tag'; interface Tag { key: string; diff --git a/packages/@aws-cdk/cdk/lib/core/tokens/token.ts b/packages/@aws-cdk/cdk/lib/token.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/core/tokens/token.ts rename to packages/@aws-cdk/cdk/lib/token.ts index a99ef11a194b8..232bd92f1ec97 100644 --- a/packages/@aws-cdk/cdk/lib/core/tokens/token.ts +++ b/packages/@aws-cdk/cdk/lib/token.ts @@ -1,4 +1,4 @@ -import { IConstruct } from "../construct"; +import { IConstruct } from "./construct"; import { TOKEN_MAP } from "./encoding"; /** @@ -147,4 +147,4 @@ export interface IResolvedValuePostProcessor { */ export function isResolvedValuePostProcessor(x: any): x is IResolvedValuePostProcessor { return x.postProcess !== undefined; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/cdk/lib/uniqueid.ts b/packages/@aws-cdk/cdk/lib/uniqueid.ts index 987455c81c397..13942f4817b8b 100644 --- a/packages/@aws-cdk/cdk/lib/uniqueid.ts +++ b/packages/@aws-cdk/cdk/lib/uniqueid.ts @@ -36,7 +36,7 @@ export function makeUniqueId(components: string[]) { } // Lazy require in order to break a module dependency cycle - const unresolvedTokens = components.filter(c => require('./core/tokens').unresolved(c)); + const unresolvedTokens = components.filter(c => require('./unresolved').unresolved(c)); if (unresolvedTokens.length > 0) { throw new Error(`ID components may not include unresolved tokens: ${unresolvedTokens.join(',')}`); } diff --git a/packages/@aws-cdk/cdk/lib/core/tokens/unresolved.ts b/packages/@aws-cdk/cdk/lib/unresolved.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/core/tokens/unresolved.ts rename to packages/@aws-cdk/cdk/lib/unresolved.ts diff --git a/packages/@aws-cdk/cdk/lib/core/util.ts b/packages/@aws-cdk/cdk/lib/util.ts similarity index 98% rename from packages/@aws-cdk/cdk/lib/core/util.ts rename to packages/@aws-cdk/cdk/lib/util.ts index 9f13df13aad78..941b14d8c1e8a 100644 --- a/packages/@aws-cdk/cdk/lib/core/util.ts +++ b/packages/@aws-cdk/cdk/lib/util.ts @@ -1,5 +1,5 @@ import { IConstruct } from "./construct"; -import { IResolvedValuePostProcessor, ResolveContext, Token } from "./tokens"; +import { IResolvedValuePostProcessor, ResolveContext, Token } from "./token"; /** * Given an object, converts all keys to PascalCase given they are currently in camel case. @@ -61,4 +61,4 @@ export class PostResolveToken extends Token implements IResolvedValuePostProcess public postProcess(o: any, _context: ResolveContext): any { return this.processor(o); } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/cdk/test/test.aspect.ts b/packages/@aws-cdk/cdk/test/test.aspect.ts index d3aa7fe8c302b..9566213de8968 100644 --- a/packages/@aws-cdk/cdk/test/test.aspect.ts +++ b/packages/@aws-cdk/cdk/test/test.aspect.ts @@ -1,6 +1,6 @@ import { Test } from 'nodeunit'; import { IAspect } from '../lib/aspect'; -import { IConstruct, Root } from '../lib/core/construct'; +import { IConstruct, Root } from '../lib/construct'; class MyConstruct extends Root { public static IsMyConstruct(x: any): x is MyConstruct { diff --git a/packages/@aws-cdk/cdk/test/core/test.construct.ts b/packages/@aws-cdk/cdk/test/test.construct.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/core/test.construct.ts rename to packages/@aws-cdk/cdk/test/test.construct.ts index a711efa001360..1a03a5d26165f 100644 --- a/packages/@aws-cdk/cdk/test/core/test.construct.ts +++ b/packages/@aws-cdk/cdk/test/test.construct.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { ArnComponents, Construct, ConstructOrder, Root, Stack, Token } from '../../lib'; +import { ArnComponents, Construct, ConstructOrder, Root, Stack, Token } from '../lib'; // tslint:disable:variable-name // tslint:disable:max-line-length diff --git a/packages/@aws-cdk/cdk/test/core/test.tag-manager.ts b/packages/@aws-cdk/cdk/test/test.tag-manager.ts similarity index 96% rename from packages/@aws-cdk/cdk/test/core/test.tag-manager.ts rename to packages/@aws-cdk/cdk/test/test.tag-manager.ts index c4e1b59ce8e12..1f092c9f08b80 100644 --- a/packages/@aws-cdk/cdk/test/core/test.tag-manager.ts +++ b/packages/@aws-cdk/cdk/test/test.tag-manager.ts @@ -1,6 +1,6 @@ import { Test } from 'nodeunit'; -import { TagType } from '../../lib/cloudformation/cfn-resource'; -import { TagManager } from '../../lib/core/tag-manager'; +import { TagType } from '../lib/cloudformation/cfn-resource'; +import { TagManager } from '../lib/tag-manager'; export = { '#setTag() supports setting a tag regardless of Type'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/core/test.tokens.ts b/packages/@aws-cdk/cdk/test/test.tokens.ts similarity index 98% rename from packages/@aws-cdk/cdk/test/core/test.tokens.ts rename to packages/@aws-cdk/cdk/test/test.tokens.ts index 17bb584166bba..437e36f7f2bfc 100644 --- a/packages/@aws-cdk/cdk/test/core/test.tokens.ts +++ b/packages/@aws-cdk/cdk/test/test.tokens.ts @@ -1,6 +1,6 @@ import { Test } from 'nodeunit'; -import { Fn, Root, Token, unresolved } from '../../lib'; -import { evaluateCFN } from '../cloudformation/evaluate-cfn'; +import { Fn, Root, Token, unresolved } from '../lib'; +import { evaluateCFN } from './cloudformation/evaluate-cfn'; export = { 'resolve a plain old object should just return the object'(test: Test) { @@ -435,4 +435,4 @@ function tokensThatResolveTo(value: string): Token[] { */ function resolve(x: any) { return new Root().node.resolve(x); -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/cdk/test/core/test.util.ts b/packages/@aws-cdk/cdk/test/test.util.ts similarity index 96% rename from packages/@aws-cdk/cdk/test/core/test.util.ts rename to packages/@aws-cdk/cdk/test/test.util.ts index 22cb7416e96a0..98e9b24f5b775 100644 --- a/packages/@aws-cdk/cdk/test/core/test.util.ts +++ b/packages/@aws-cdk/cdk/test/test.util.ts @@ -1,6 +1,6 @@ import { Test } from 'nodeunit'; -import { Root } from '../../lib'; -import { capitalizePropertyNames, ignoreEmpty } from '../../lib/core/util'; +import { Root } from '../lib'; +import { capitalizePropertyNames, ignoreEmpty } from '../lib/util'; export = { 'capitalizeResourceProperties capitalizes all keys of an object (recursively) from camelCase to PascalCase'(test: Test) { From ef6da3c22f568143762eb0c2a3c7050e4e76f860 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 16:11:43 -0700 Subject: [PATCH 27/30] Flatten the 'cloudformation' directory. --- .../cdk/lib/{cloudformation => }/arn.ts | 4 +- packages/@aws-cdk/cdk/lib/cfn-concat.ts | 2 +- .../lib/{cloudformation => }/cfn-condition.ts | 4 +- .../lib/{cloudformation => }/cfn-element.ts | 8 ++-- .../lib/{cloudformation => }/cfn-mapping.ts | 2 +- .../lib/{cloudformation => }/cfn-output.ts | 2 +- .../lib/{cloudformation => }/cfn-parameter.ts | 4 +- .../lib/{cloudformation => }/cfn-resource.ts | 6 +-- .../cdk/lib/{cloudformation => }/cfn-rule.ts | 4 +- .../cloudformation-json.ts | 6 +-- packages/@aws-cdk/cdk/lib/construct.ts | 4 +- .../{cloudformation => }/dynamic-reference.ts | 4 +- .../cdk/lib/{cloudformation => }/fn.ts | 6 +-- .../cdk/lib/{cloudformation => }/include.ts | 2 +- packages/@aws-cdk/cdk/lib/index.ts | 40 +++++++++---------- .../lib/{cloudformation => }/instrinsics.ts | 2 +- .../lib/{cloudformation => }/logical-id.ts | 2 +- .../cdk/lib/{cloudformation => }/pseudo.ts | 4 +- .../cdk/lib/{cloudformation => }/reference.ts | 4 +- .../{cloudformation => }/removal-policy.ts | 0 .../{cloudformation => }/resource-policy.ts | 0 .../cdk/lib/{cloudformation => }/secret.ts | 4 +- .../cdk/lib/{cloudformation => }/stack.ts | 8 ++-- packages/@aws-cdk/cdk/lib/tag-aspect.ts | 2 +- packages/@aws-cdk/cdk/lib/tag-manager.ts | 4 +- .../cdk/lib/{cloudformation => }/tag.ts | 0 .../test/{cloudformation => }/evaluate-cfn.ts | 2 +- .../cdk/test/{cloudformation => }/test.arn.ts | 2 +- .../test.cloudformation-json.ts | 2 +- .../{cloudformation => }/test.condition.ts | 2 +- .../test.dynamic-reference.ts | 2 +- .../cdk/test/{cloudformation => }/test.fn.ts | 2 +- .../test/{cloudformation => }/test.include.ts | 2 +- .../{cloudformation => }/test.logical-id.ts | 2 +- .../{cloudformation => }/test.mappings.ts | 2 +- .../test/{cloudformation => }/test.output.ts | 2 +- .../{cloudformation => }/test.parameter.ts | 2 +- .../{cloudformation => }/test.resource.ts | 2 +- .../test/{cloudformation => }/test.rule.ts | 2 +- .../test/{cloudformation => }/test.secret.ts | 2 +- .../test/{cloudformation => }/test.stack.ts | 2 +- .../@aws-cdk/cdk/test/test.tag-manager.ts | 2 +- packages/@aws-cdk/cdk/test/test.tokens.ts | 2 +- 43 files changed, 81 insertions(+), 81 deletions(-) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/arn.ts (99%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cfn-condition.ts (97%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cfn-element.ts (95%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cfn-mapping.ts (96%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cfn-output.ts (99%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cfn-parameter.ts (98%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cfn-resource.ts (99%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cfn-rule.ts (97%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/cloudformation-json.ts (96%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/dynamic-reference.ts (96%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/fn.ts (99%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/include.ts (96%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/instrinsics.ts (97%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/logical-id.ts (99%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/pseudo.ts (97%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/reference.ts (97%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/removal-policy.ts (100%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/resource-policy.ts (100%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/secret.ts (97%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/stack.ts (99%) rename packages/@aws-cdk/cdk/lib/{cloudformation => }/tag.ts (100%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/evaluate-cfn.ts (95%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.arn.ts (99%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.cloudformation-json.ts (98%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.condition.ts (98%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.dynamic-reference.ts (97%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.fn.ts (98%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.include.ts (99%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.logical-id.ts (99%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.mappings.ts (96%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.output.ts (97%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.parameter.ts (99%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.resource.ts (99%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.rule.ts (94%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.secret.ts (96%) rename packages/@aws-cdk/cdk/test/{cloudformation => }/test.stack.ts (99%) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/arn.ts b/packages/@aws-cdk/cdk/lib/arn.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/cloudformation/arn.ts rename to packages/@aws-cdk/cdk/lib/arn.ts index 92c88a12f9989..6386155371753 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/arn.ts +++ b/packages/@aws-cdk/cdk/lib/arn.ts @@ -1,6 +1,6 @@ -import { Fn } from '../cloudformation/fn'; -import { unresolved } from '../unresolved'; +import { Fn } from './fn'; import { Stack } from './stack'; +import { unresolved } from './unresolved'; /** * Creates an ARN from components. diff --git a/packages/@aws-cdk/cdk/lib/cfn-concat.ts b/packages/@aws-cdk/cdk/lib/cfn-concat.ts index 157ca1f4d6348..fd16ed1046710 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-concat.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-concat.ts @@ -19,4 +19,4 @@ export function cloudFormationConcat(left: any | undefined, right: any | undefin return { 'Fn::Join': ['', minimalCloudFormationJoin('', parts)] }; } -import { minimalCloudFormationJoin } from "./cloudformation/instrinsics"; +import { minimalCloudFormationJoin } from "./instrinsics"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts b/packages/@aws-cdk/cdk/lib/cfn-condition.ts similarity index 97% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts rename to packages/@aws-cdk/cdk/lib/cfn-condition.ts index 2e6cc3e4e8037..4cd6549f7295c 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-condition.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-condition.ts @@ -1,6 +1,6 @@ -import { Construct } from '../construct'; -import { ResolveContext } from '../token'; import { CfnRefElement } from './cfn-element'; +import { Construct } from './construct'; +import { ResolveContext } from './token'; export interface CfnConditionProps { expression?: ICfnConditionExpression; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts b/packages/@aws-cdk/cdk/lib/cfn-element.ts similarity index 95% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts rename to packages/@aws-cdk/cdk/lib/cfn-element.ts index 8a818b99a91ef..89aba929fbe2a 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-element.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-element.ts @@ -1,5 +1,5 @@ -import { Construct, IConstruct, PATH_SEP } from "../construct"; -import { Token } from '../token'; +import { Construct, IConstruct, PATH_SEP } from "./construct"; +import { Token } from './token'; const LOGICAL_ID_MD = 'aws:cdk:logicalId'; @@ -43,7 +43,7 @@ export abstract class CfnElement extends Construct { constructor(scope: Construct, id: string) { super(scope, id); - this.node.addMetadata(LOGICAL_ID_MD, new (require("../token").Token)(() => this.logicalId), this.constructor); + this.node.addMetadata(LOGICAL_ID_MD, new (require("./token").Token)(() => this.logicalId), this.constructor); this._logicalId = this.node.stack.logicalIds.getLogicalId(this); this.logicalId = new Token(() => this._logicalId).toString(); @@ -154,4 +154,4 @@ export abstract class CfnRefElement extends CfnElement { } } -import { findTokens } from "../resolve"; +import { findTokens } from "./resolve"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts b/packages/@aws-cdk/cdk/lib/cfn-mapping.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts rename to packages/@aws-cdk/cdk/lib/cfn-mapping.ts index 7d7a6cf68c9cf..3897f255582d3 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-mapping.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-mapping.ts @@ -1,5 +1,5 @@ -import { Construct } from '../construct'; import { CfnRefElement } from './cfn-element'; +import { Construct } from './construct'; import { Fn } from './fn'; export interface CfnMappingProps { diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts b/packages/@aws-cdk/cdk/lib/cfn-output.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts rename to packages/@aws-cdk/cdk/lib/cfn-output.ts index 08edf82c89c14..4432ca7874b92 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-output.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-output.ts @@ -1,5 +1,5 @@ -import { Construct } from '../construct'; import { CfnElement } from './cfn-element'; +import { Construct } from './construct'; export interface CfnOutputProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts b/packages/@aws-cdk/cdk/lib/cfn-parameter.ts similarity index 98% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts rename to packages/@aws-cdk/cdk/lib/cfn-parameter.ts index 38ba93163582d..f04bca2300039 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-parameter.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-parameter.ts @@ -1,6 +1,6 @@ -import { Construct } from '../construct'; -import { Token } from '../token'; import { CfnRefElement, Ref } from './cfn-element'; +import { Construct } from './construct'; +import { Token } from './token'; export interface CfnParameterProps { /** diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cfn-resource.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts rename to packages/@aws-cdk/cdk/lib/cfn-resource.ts index c4f8e45af0114..68777d8de806d 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-resource.ts @@ -1,10 +1,10 @@ import cxapi = require('@aws-cdk/cx-api'); -import { Construct, IConstruct } from '../construct'; -import { TagManager } from '../tag-manager'; -import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from '../util'; import { CfnCondition } from './cfn-condition'; +import { Construct, IConstruct } from './construct'; import { Reference } from './reference'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; +import { TagManager } from './tag-manager'; +import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from './util'; // import required to be here, otherwise causes a cycle when running the generated JavaScript // tslint:disable-next-line:ordered-imports import { CfnRefElement } from './cfn-element'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts b/packages/@aws-cdk/cdk/lib/cfn-rule.ts similarity index 97% rename from packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts rename to packages/@aws-cdk/cdk/lib/cfn-rule.ts index 907f57a2abce9..c51a40f6617fa 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cfn-rule.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-rule.ts @@ -1,7 +1,7 @@ -import { Construct } from '../construct'; -import { capitalizePropertyNames } from '../util'; import { ICfnConditionExpression } from './cfn-condition'; import { CfnRefElement } from './cfn-element'; +import { Construct } from './construct'; +import { capitalizePropertyNames } from './util'; /** * A rule can include a RuleCondition property and must include an Assertions property. diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/cloudformation-json.ts b/packages/@aws-cdk/cdk/lib/cloudformation-json.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/cloudformation/cloudformation-json.ts rename to packages/@aws-cdk/cdk/lib/cloudformation-json.ts index 711d3be2181f1..4f0d79a5d2924 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/cloudformation-json.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation-json.ts @@ -1,7 +1,7 @@ -import { IConstruct } from "../construct"; -import { resolve } from "../resolve"; -import { Token } from "../token"; +import { IConstruct } from "./construct"; import { isIntrinsic } from "./instrinsics"; +import { resolve } from "./resolve"; +import { Token } from "./token"; /** * Class for JSON routines that are framework-aware diff --git a/packages/@aws-cdk/cdk/lib/construct.ts b/packages/@aws-cdk/cdk/lib/construct.ts index b8585087d6443..3928354a0ef34 100644 --- a/packages/@aws-cdk/cdk/lib/construct.ts +++ b/packages/@aws-cdk/cdk/lib/construct.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { IAspect } from './aspect'; -import { CloudFormationJSON } from './cloudformation/cloudformation-json'; +import { CloudFormationJSON } from './cloudformation-json'; import { IDependable } from './dependency'; import { resolve } from './resolve'; import { Token } from './token'; @@ -738,4 +738,4 @@ export interface Dependency { } // Import this _after_ everything else to help node work the classes out in the correct order... -import { Stack } from './cloudformation/stack'; +import { Stack } from './stack'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts b/packages/@aws-cdk/cdk/lib/dynamic-reference.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts rename to packages/@aws-cdk/cdk/lib/dynamic-reference.ts index bbc5b8573ff28..7be363e1f2e33 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/dynamic-reference.ts +++ b/packages/@aws-cdk/cdk/lib/dynamic-reference.ts @@ -1,5 +1,5 @@ -import { Construct } from "../construct"; -import { Token } from "../token"; +import { Construct } from "./construct"; +import { Token } from "./token"; /** * Properties for a Dynamic Reference diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts b/packages/@aws-cdk/cdk/lib/fn.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/cloudformation/fn.ts rename to packages/@aws-cdk/cdk/lib/fn.ts index 877491dd2a351..8d281673cbe47 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/fn.ts +++ b/packages/@aws-cdk/cdk/lib/fn.ts @@ -1,8 +1,8 @@ -import { resolve } from '../resolve'; -import { ResolveContext, Token } from '../token'; -import { unresolved } from '../unresolved'; import { ICfnConditionExpression } from './cfn-condition'; import { minimalCloudFormationJoin } from './instrinsics'; +import { resolve } from './resolve'; +import { ResolveContext, Token } from './token'; +import { unresolved } from './unresolved'; // tslint:disable:max-line-length diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts b/packages/@aws-cdk/cdk/lib/include.ts similarity index 96% rename from packages/@aws-cdk/cdk/lib/cloudformation/include.ts rename to packages/@aws-cdk/cdk/lib/include.ts index a2fe0346f4675..1ae1fbe030c0f 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/include.ts +++ b/packages/@aws-cdk/cdk/lib/include.ts @@ -1,5 +1,5 @@ -import { Construct } from '../construct'; import { CfnElement } from './cfn-element'; +import { Construct } from './construct'; export interface IncludeProps { /** diff --git a/packages/@aws-cdk/cdk/lib/index.ts b/packages/@aws-cdk/cdk/lib/index.ts index 8eae746e92331..c525bbed59809 100644 --- a/packages/@aws-cdk/cdk/lib/index.ts +++ b/packages/@aws-cdk/cdk/lib/index.ts @@ -7,26 +7,26 @@ export * from './unresolved'; export * from './tag-manager'; export * from './dependency'; -export * from './cloudformation/cloudformation-json'; -export * from './cloudformation/reference'; -export * from './cloudformation/cfn-condition'; -export * from './cloudformation/fn'; -export * from './cloudformation/include'; -export * from './cloudformation/logical-id'; -export * from './cloudformation/cfn-mapping'; -export * from './cloudformation/cfn-output'; -export * from './cloudformation/cfn-parameter'; -export * from './cloudformation/pseudo'; -export * from './cloudformation/cfn-resource'; -export * from './cloudformation/resource-policy'; -export * from './cloudformation/cfn-rule'; -export * from './cloudformation/stack'; -export * from './cloudformation/cfn-element'; -export * from './cloudformation/dynamic-reference'; -export * from './cloudformation/tag'; -export * from './cloudformation/removal-policy'; -export * from './cloudformation/arn'; -export * from './cloudformation/secret'; +export * from './cloudformation-json'; +export * from './reference'; +export * from './cfn-condition'; +export * from './fn'; +export * from './include'; +export * from './logical-id'; +export * from './cfn-mapping'; +export * from './cfn-output'; +export * from './cfn-parameter'; +export * from './pseudo'; +export * from './cfn-resource'; +export * from './resource-policy'; +export * from './cfn-rule'; +export * from './stack'; +export * from './cfn-element'; +export * from './dynamic-reference'; +export * from './tag'; +export * from './removal-policy'; +export * from './arn'; +export * from './secret'; export * from './app'; export * from './context'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts b/packages/@aws-cdk/cdk/lib/instrinsics.ts similarity index 97% rename from packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts rename to packages/@aws-cdk/cdk/lib/instrinsics.ts index 5adf61fcc7a01..99cd5ca73ae82 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/instrinsics.ts +++ b/packages/@aws-cdk/cdk/lib/instrinsics.ts @@ -55,4 +55,4 @@ export function canEvaluateToList(x: any) { return isIntrinsic(x) && ['Ref', 'Fn::GetAtt', 'Fn::GetAZs', 'Fn::Split', 'Fn::FindInMap', 'Fn::ImportValue'].includes(Object.keys(x)[0]); } -import { unresolved } from "../unresolved"; +import { unresolved } from "./unresolved"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts b/packages/@aws-cdk/cdk/lib/logical-id.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts rename to packages/@aws-cdk/cdk/lib/logical-id.ts index 78f58f4340e03..c8e8405a166cb 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/logical-id.ts +++ b/packages/@aws-cdk/cdk/lib/logical-id.ts @@ -1,5 +1,5 @@ -import { makeUniqueId } from '../uniqueid'; import { CfnElement } from './cfn-element'; +import { makeUniqueId } from './uniqueid'; const PATH_SEP = '/'; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts b/packages/@aws-cdk/cdk/lib/pseudo.ts similarity index 97% rename from packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts rename to packages/@aws-cdk/cdk/lib/pseudo.ts index 5d3166c9b7a6b..407aa421eb306 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/pseudo.ts +++ b/packages/@aws-cdk/cdk/lib/pseudo.ts @@ -1,6 +1,6 @@ -import { Construct } from '../construct'; -import { Token } from '../token'; +import { Construct } from './construct'; import { Reference } from './reference'; +import { Token } from './token'; /** * Accessor for pseudo parameters diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts b/packages/@aws-cdk/cdk/lib/reference.ts similarity index 97% rename from packages/@aws-cdk/cdk/lib/cloudformation/reference.ts rename to packages/@aws-cdk/cdk/lib/reference.ts index 73db649ae087c..a595ab79746c4 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/reference.ts +++ b/packages/@aws-cdk/cdk/lib/reference.ts @@ -1,4 +1,4 @@ -import { ResolveContext, Token } from "../token"; +import { ResolveContext, Token } from "./token"; /** * A Token that represents a CloudFormation reference to another resource @@ -111,6 +111,6 @@ export class Reference extends Token { } -import { Construct } from "../construct"; import { CfnOutput } from "./cfn-output"; +import { Construct } from "./construct"; import { Stack } from "./stack"; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/removal-policy.ts b/packages/@aws-cdk/cdk/lib/removal-policy.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/cloudformation/removal-policy.ts rename to packages/@aws-cdk/cdk/lib/removal-policy.ts diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/resource-policy.ts b/packages/@aws-cdk/cdk/lib/resource-policy.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/cloudformation/resource-policy.ts rename to packages/@aws-cdk/cdk/lib/resource-policy.ts diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts b/packages/@aws-cdk/cdk/lib/secret.ts similarity index 97% rename from packages/@aws-cdk/cdk/lib/cloudformation/secret.ts rename to packages/@aws-cdk/cdk/lib/secret.ts index 12fde7821f181..ba28803fe530c 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/secret.ts +++ b/packages/@aws-cdk/cdk/lib/secret.ts @@ -1,6 +1,6 @@ -import { Construct } from '../construct'; -import { Token } from '../token'; import { CfnParameter } from './cfn-parameter'; +import { Construct } from './construct'; +import { Token } from './token'; /** * A token that represents a value that's expected to be a secret, like diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts b/packages/@aws-cdk/cdk/lib/stack.ts similarity index 99% rename from packages/@aws-cdk/cdk/lib/cloudformation/stack.ts rename to packages/@aws-cdk/cdk/lib/stack.ts index b7bee1fd0ae60..80b51e7a3083d 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/stack.ts +++ b/packages/@aws-cdk/cdk/lib/stack.ts @@ -1,11 +1,11 @@ import cxapi = require('@aws-cdk/cx-api'); -import { App } from '../app'; -import { Construct, IConstruct, PATH_SEP } from '../construct'; -import { Environment } from '../environment'; -import { ISynthesisSession } from '../synthesis'; +import { App } from './app'; import { CfnParameter } from './cfn-parameter'; +import { Construct, IConstruct, PATH_SEP } from './construct'; +import { Environment } from './environment'; import { HashedAddressingScheme, IAddressingScheme, LogicalIDs } from './logical-id'; import { Reference } from './reference'; +import { ISynthesisSession } from './synthesis'; export interface StackProps { /** diff --git a/packages/@aws-cdk/cdk/lib/tag-aspect.ts b/packages/@aws-cdk/cdk/lib/tag-aspect.ts index a78b5df515936..0e4623208170d 100644 --- a/packages/@aws-cdk/cdk/lib/tag-aspect.ts +++ b/packages/@aws-cdk/cdk/lib/tag-aspect.ts @@ -1,5 +1,5 @@ import { IAspect } from './aspect'; -import { CfnResource, ITaggable } from './cloudformation/cfn-resource'; +import { CfnResource, ITaggable } from './cfn-resource'; import { IConstruct } from './construct'; /** diff --git a/packages/@aws-cdk/cdk/lib/tag-manager.ts b/packages/@aws-cdk/cdk/lib/tag-manager.ts index 832cb21aa763a..9a7b24da4ddfc 100644 --- a/packages/@aws-cdk/cdk/lib/tag-manager.ts +++ b/packages/@aws-cdk/cdk/lib/tag-manager.ts @@ -1,5 +1,5 @@ -import { TagType } from './cloudformation/cfn-resource'; -import { CfnTag } from './cloudformation/tag'; +import { TagType } from './cfn-resource'; +import { CfnTag } from './tag'; interface Tag { key: string; diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/tag.ts b/packages/@aws-cdk/cdk/lib/tag.ts similarity index 100% rename from packages/@aws-cdk/cdk/lib/cloudformation/tag.ts rename to packages/@aws-cdk/cdk/lib/tag.ts diff --git a/packages/@aws-cdk/cdk/test/cloudformation/evaluate-cfn.ts b/packages/@aws-cdk/cdk/test/evaluate-cfn.ts similarity index 95% rename from packages/@aws-cdk/cdk/test/cloudformation/evaluate-cfn.ts rename to packages/@aws-cdk/cdk/test/evaluate-cfn.ts index b9a69d1d9ede3..90120ae04ad26 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/evaluate-cfn.ts +++ b/packages/@aws-cdk/cdk/test/evaluate-cfn.ts @@ -3,7 +3,7 @@ * * Note that this function is not production quality, it exists to support tests. */ -import { isNameOfCloudFormationIntrinsic } from '../../lib/cloudformation/instrinsics'; +import { isNameOfCloudFormationIntrinsic } from '../lib/instrinsics'; export function evaluateCFN(object: any, context: {[key: string]: string} = {}): any { const intrinsics: any = { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts b/packages/@aws-cdk/cdk/test/test.arn.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts rename to packages/@aws-cdk/cdk/test/test.arn.ts index 4d559bc360975..8d4d02ef12c22 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.arn.ts +++ b/packages/@aws-cdk/cdk/test/test.arn.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { ArnComponents, CfnOutput, ScopedAws, Stack, Token } from '../../lib'; +import { ArnComponents, CfnOutput, ScopedAws, Stack, Token } from '../lib'; export = { 'create from components with defaults'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.cloudformation-json.ts b/packages/@aws-cdk/cdk/test/test.cloudformation-json.ts similarity index 98% rename from packages/@aws-cdk/cdk/test/cloudformation/test.cloudformation-json.ts rename to packages/@aws-cdk/cdk/test/test.cloudformation-json.ts index 4b46cab85ff2b..1686cd6c5d155 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.cloudformation-json.ts +++ b/packages/@aws-cdk/cdk/test/test.cloudformation-json.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CloudFormationJSON, Fn, Stack, Token } from '../../lib'; +import { CloudFormationJSON, Fn, Stack, Token } from '../lib'; import { evaluateCFN } from './evaluate-cfn'; export = { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts b/packages/@aws-cdk/cdk/test/test.condition.ts similarity index 98% rename from packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts rename to packages/@aws-cdk/cdk/test/test.condition.ts index 48e5363b46ced..546d2d80d93a0 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.condition.ts +++ b/packages/@aws-cdk/cdk/test/test.condition.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import cdk = require('../../lib'); +import cdk = require('../lib'); export = { 'chain conditions'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.dynamic-reference.ts b/packages/@aws-cdk/cdk/test/test.dynamic-reference.ts similarity index 97% rename from packages/@aws-cdk/cdk/test/cloudformation/test.dynamic-reference.ts rename to packages/@aws-cdk/cdk/test/test.dynamic-reference.ts index 81d42604fe881..fa82494a33abe 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.dynamic-reference.ts +++ b/packages/@aws-cdk/cdk/test/test.dynamic-reference.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { DynamicReference, DynamicReferenceService, Stack } from '../../lib'; +import { DynamicReference, DynamicReferenceService, Stack } from '../lib'; export = { 'can create dynamic references with service and key with colons'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.fn.ts b/packages/@aws-cdk/cdk/test/test.fn.ts similarity index 98% rename from packages/@aws-cdk/cdk/test/cloudformation/test.fn.ts rename to packages/@aws-cdk/cdk/test/test.fn.ts index adb82677c5248..0c323e23a5f9d 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.fn.ts +++ b/packages/@aws-cdk/cdk/test/test.fn.ts @@ -1,7 +1,7 @@ import fc = require('fast-check'); import _ = require('lodash'); import nodeunit = require('nodeunit'); -import { Fn, Stack, Token } from '../../lib'; +import { Fn, Stack, Token } from '../lib'; function asyncTest(cb: (test: nodeunit.Test) => Promise): (test: nodeunit.Test) => void { return async (test: nodeunit.Test) => { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts b/packages/@aws-cdk/cdk/test/test.include.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/cloudformation/test.include.ts rename to packages/@aws-cdk/cdk/test/test.include.ts index f42134c19a513..6e80bc19abb97 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.include.ts +++ b/packages/@aws-cdk/cdk/test/test.include.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnOutput, CfnParameter, CfnResource, Include, Stack } from '../../lib'; +import { CfnOutput, CfnParameter, CfnResource, Include, Stack } from '../lib'; export = { 'the Include construct can be used to embed an existing template as-is into a stack'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.logical-id.ts b/packages/@aws-cdk/cdk/test/test.logical-id.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/cloudformation/test.logical-id.ts rename to packages/@aws-cdk/cdk/test/test.logical-id.ts index 254a49049a5ac..c237670430dba 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.logical-id.ts +++ b/packages/@aws-cdk/cdk/test/test.logical-id.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnResource, Construct, HashedAddressingScheme, IAddressingScheme, Ref, Stack } from '../../lib'; +import { CfnResource, Construct, HashedAddressingScheme, IAddressingScheme, Ref, Stack } from '../lib'; /** * These tests are executed once (for specific ID schemes) diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts b/packages/@aws-cdk/cdk/test/test.mappings.ts similarity index 96% rename from packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts rename to packages/@aws-cdk/cdk/test/test.mappings.ts index a42cf47224885..9c619b03240d2 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.mappings.ts +++ b/packages/@aws-cdk/cdk/test/test.mappings.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnMapping, CfnResource, Stack } from '../../lib'; +import { CfnMapping, CfnResource, Stack } from '../lib'; export = { 'mappings can be added as another type of entity, and mapping.findInMap can be used to get a token'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts b/packages/@aws-cdk/cdk/test/test.output.ts similarity index 97% rename from packages/@aws-cdk/cdk/test/cloudformation/test.output.ts rename to packages/@aws-cdk/cdk/test/test.output.ts index 919bd0848223b..b0b0549777e65 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.output.ts +++ b/packages/@aws-cdk/cdk/test/test.output.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnOutput, CfnResource, Ref, Stack } from '../../lib'; +import { CfnOutput, CfnResource, Ref, Stack } from '../lib'; export = { 'outputs can be added to the stack'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts b/packages/@aws-cdk/cdk/test/test.parameter.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts rename to packages/@aws-cdk/cdk/test/test.parameter.ts index ac9e870fd2db2..a9773291f2862 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.parameter.ts +++ b/packages/@aws-cdk/cdk/test/test.parameter.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnParameter, CfnResource, Construct, Stack } from '../../lib'; +import { CfnParameter, CfnResource, Construct, Stack } from '../lib'; export = { 'parameters can be used and referenced using param.ref'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts b/packages/@aws-cdk/cdk/test/test.resource.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts rename to packages/@aws-cdk/cdk/test/test.resource.ts index 897aba9b7d188..5ee4f6f92872f 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.resource.ts +++ b/packages/@aws-cdk/cdk/test/test.resource.ts @@ -2,7 +2,7 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; import { App, applyRemovalPolicy, CfnCondition, CfnResource, Construct, DeletionPolicy, Fn, HashedAddressingScheme, - RemovalPolicy, Root, Stack } from '../../lib'; + RemovalPolicy, Root, Stack } from '../lib'; export = { 'all resources derive from Resource, which derives from Entity'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.rule.ts b/packages/@aws-cdk/cdk/test/test.rule.ts similarity index 94% rename from packages/@aws-cdk/cdk/test/cloudformation/test.rule.ts rename to packages/@aws-cdk/cdk/test/test.rule.ts index 9d2cd5e20dcb7..93fd6dc0b06ac 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.rule.ts +++ b/packages/@aws-cdk/cdk/test/test.rule.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { CfnRule, Fn, Stack } from '../../lib'; +import { CfnRule, Fn, Stack } from '../lib'; export = { 'Rule can be used to create rules'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.secret.ts b/packages/@aws-cdk/cdk/test/test.secret.ts similarity index 96% rename from packages/@aws-cdk/cdk/test/cloudformation/test.secret.ts rename to packages/@aws-cdk/cdk/test/test.secret.ts index 37b4dbd2bc805..6a4eb23ae3fff 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.secret.ts +++ b/packages/@aws-cdk/cdk/test/test.secret.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { Secret, SecretParameter, Stack } from '../../lib'; +import { Secret, SecretParameter, Stack } from '../lib'; export = { 'Secret is merely a token'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts b/packages/@aws-cdk/cdk/test/test.stack.ts similarity index 99% rename from packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts rename to packages/@aws-cdk/cdk/test/test.stack.ts index f09564da5fa97..ee507750abb7c 100644 --- a/packages/@aws-cdk/cdk/test/cloudformation/test.stack.ts +++ b/packages/@aws-cdk/cdk/test/test.stack.ts @@ -1,6 +1,6 @@ import cxapi = require('@aws-cdk/cx-api'); import { Test } from 'nodeunit'; -import { App, CfnCondition, CfnOutput, CfnParameter, CfnResource, Construct, Include, ScopedAws, Stack, Token } from '../../lib'; +import { App, CfnCondition, CfnOutput, CfnParameter, CfnResource, Construct, Include, ScopedAws, Stack, Token } from '../lib'; export = { 'a stack can be serialized into a CloudFormation template, initially it\'s empty'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/test.tag-manager.ts b/packages/@aws-cdk/cdk/test/test.tag-manager.ts index 1f092c9f08b80..dd9b1cb86e51e 100644 --- a/packages/@aws-cdk/cdk/test/test.tag-manager.ts +++ b/packages/@aws-cdk/cdk/test/test.tag-manager.ts @@ -1,5 +1,5 @@ import { Test } from 'nodeunit'; -import { TagType } from '../lib/cloudformation/cfn-resource'; +import { TagType } from '../lib/cfn-resource'; import { TagManager } from '../lib/tag-manager'; export = { diff --git a/packages/@aws-cdk/cdk/test/test.tokens.ts b/packages/@aws-cdk/cdk/test/test.tokens.ts index 437e36f7f2bfc..568f6bbfeec36 100644 --- a/packages/@aws-cdk/cdk/test/test.tokens.ts +++ b/packages/@aws-cdk/cdk/test/test.tokens.ts @@ -1,6 +1,6 @@ import { Test } from 'nodeunit'; import { Fn, Root, Token, unresolved } from '../lib'; -import { evaluateCFN } from './cloudformation/evaluate-cfn'; +import { evaluateCFN } from './evaluate-cfn'; export = { 'resolve a plain old object should just return the object'(test: Test) { From 0ab31aef2ae47db39ee92e7c2fe54e2cf5e4b0bd Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 16:59:39 -0700 Subject: [PATCH 28/30] Remove CfnOutput from a comment on RestApiProps. --- packages/@aws-cdk/aws-apigateway/lib/restapi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts index e5d0420036dc3..2a979fd50a178 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/restapi.ts @@ -44,7 +44,7 @@ export interface RestApiProps extends ResourceOptions { * deployment. To customize the stage options, use the `deployStageOptions` * property. * - * A CloudFormation CfnOutput will also be defined with the root URL endpoint + * A CloudFormation Output will also be defined with the root URL endpoint * of this REST API. * * @default true From 8327f8c5f8011e179c7c92ac0bec2d6de7f68770 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Wed, 13 Mar 2019 17:23:22 -0700 Subject: [PATCH 29/30] Rename Reference#isReference to isReferenceToken. --- packages/@aws-cdk/cdk/lib/reference.ts | 2 +- packages/@aws-cdk/cdk/lib/stack.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/cdk/lib/reference.ts b/packages/@aws-cdk/cdk/lib/reference.ts index a595ab79746c4..c7e897a0df26a 100644 --- a/packages/@aws-cdk/cdk/lib/reference.ts +++ b/packages/@aws-cdk/cdk/lib/reference.ts @@ -18,7 +18,7 @@ export class Reference extends Token { /** * Check whether this is actually a Reference */ - public static isReference(x: Token): x is Reference { + public static isReferenceToken(x: Token): x is Reference { return (x as any).consumeFromStack !== undefined; } diff --git a/packages/@aws-cdk/cdk/lib/stack.ts b/packages/@aws-cdk/cdk/lib/stack.ts index 80b51e7a3083d..25452e6e1d991 100644 --- a/packages/@aws-cdk/cdk/lib/stack.ts +++ b/packages/@aws-cdk/cdk/lib/stack.ts @@ -422,7 +422,7 @@ export class Stack extends Construct { protected prepare() { // References for (const ref of this.node.findReferences()) { - if (Reference.isReference(ref)) { + if (Reference.isReferenceToken(ref)) { ref.consumeFromStack(this); } } From bd842a6d97cfdb1890daeace1a75d2e3c173de7d Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 14 Mar 2019 02:16:02 -0700 Subject: [PATCH 30/30] Update the aws-glue package with the new name of Output. --- packages/@aws-cdk/aws-glue/lib/database.ts | 10 +++++----- packages/@aws-cdk/aws-glue/lib/table.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/@aws-cdk/aws-glue/lib/database.ts b/packages/@aws-cdk/aws-glue/lib/database.ts index 9439b02d59a52..8d44c65548b9b 100644 --- a/packages/@aws-cdk/aws-glue/lib/database.ts +++ b/packages/@aws-cdk/aws-glue/lib/database.ts @@ -131,11 +131,11 @@ export class Database extends cdk.Construct { */ public export(): DatabaseImportProps { return { - catalogArn: new cdk.Output(this, 'CatalogArn', { value: this.catalogArn }).makeImportValue().toString(), - catalogId: new cdk.Output(this, 'CatalogId', { value: this.catalogId }).makeImportValue().toString(), - databaseArn: new cdk.Output(this, 'DatabaseArn', { value: this.databaseArn }).makeImportValue().toString(), - databaseName: new cdk.Output(this, 'DatabaseName', { value: this.databaseName }).makeImportValue().toString(), - locationUri: new cdk.Output(this, 'LocationURI', { value: this.locationUri }).makeImportValue().toString() + catalogArn: new cdk.CfnOutput(this, 'CatalogArn', { value: this.catalogArn }).makeImportValue().toString(), + catalogId: new cdk.CfnOutput(this, 'CatalogId', { value: this.catalogId }).makeImportValue().toString(), + databaseArn: new cdk.CfnOutput(this, 'DatabaseArn', { value: this.databaseArn }).makeImportValue().toString(), + databaseName: new cdk.CfnOutput(this, 'DatabaseName', { value: this.databaseName }).makeImportValue().toString(), + locationUri: new cdk.CfnOutput(this, 'LocationURI', { value: this.locationUri }).makeImportValue().toString() }; } } diff --git a/packages/@aws-cdk/aws-glue/lib/table.ts b/packages/@aws-cdk/aws-glue/lib/table.ts index 25452ef99f454..553fcd80d9af8 100644 --- a/packages/@aws-cdk/aws-glue/lib/table.ts +++ b/packages/@aws-cdk/aws-glue/lib/table.ts @@ -256,8 +256,8 @@ export class Table extends cdk.Construct implements ITable { public export(): TableImportProps { return { - tableName: new cdk.Output(this, 'TableName', { value: this.tableName }).makeImportValue().toString(), - tableArn: new cdk.Output(this, 'TableArn', { value: this.tableArn }).makeImportValue().toString(), + tableName: new cdk.CfnOutput(this, 'TableName', { value: this.tableName }).makeImportValue().toString(), + tableArn: new cdk.CfnOutput(this, 'TableArn', { value: this.tableArn }).makeImportValue().toString(), }; }