diff --git a/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts b/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts index a03f7e3c23f65..17974dbe72aa2 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts @@ -123,7 +123,7 @@ function uppercaseProperties(props: Properties): Properties { function renderResourceType(resourceType?: string) { if (!resourceType) { - return CfnCustomResource.cfnResourceTypeName; + return CfnCustomResource.CFN_RESOURCE_TYPE_NAME; } if (!resourceType.startsWith('Custom::')) { diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index 97ea7b16e14da..5f9aa9c34978b 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -1004,7 +1004,7 @@ export class Vpc extends VpcBase { } // These values will be used to recover the config upon provider import - const includeResourceTypes = [CfnSubnet.cfnResourceTypeName]; + const includeResourceTypes = [CfnSubnet.CFN_RESOURCE_TYPE_NAME]; subnet.node.applyAspect(new Tag(SUBNETNAME_TAG, subnetConfig.name, {includeResourceTypes})); subnet.node.applyAspect(new Tag(SUBNETTYPE_TAG, subnetTypeTagValue(subnetConfig.subnetType), {includeResourceTypes})); }); diff --git a/packages/@aws-cdk/aws-ec2/test/test.vpc.ts b/packages/@aws-cdk/aws-ec2/test/test.vpc.ts index 331edf2d9f709..76c961ed333a7 100644 --- a/packages/@aws-cdk/aws-ec2/test/test.vpc.ts +++ b/packages/@aws-cdk/aws-ec2/test/test.vpc.ts @@ -564,7 +564,7 @@ export = { const vpc = new Vpc(stack, 'TheVPC'); // overwrite to set propagate - vpc.node.applyAspect(new Tag('BusinessUnit', 'Marketing', {includeResourceTypes: [CfnVPC.cfnResourceTypeName]})); + vpc.node.applyAspect(new Tag('BusinessUnit', 'Marketing', {includeResourceTypes: [CfnVPC.CFN_RESOURCE_TYPE_NAME]})); vpc.node.applyAspect(new Tag('VpcType', 'Good')); expect(stack).to(haveResource("AWS::EC2::VPC", hasTags(toCfnTags(allTags)))); const taggables = ['Subnet', 'InternetGateway', 'NatGateway', 'RouteTable']; diff --git a/tools/awslint/lib/rules/public-static-properties.ts b/tools/awslint/lib/rules/public-static-properties.ts index 7f64ba2c5a79c..4667a92973b7c 100644 --- a/tools/awslint/lib/rules/public-static-properties.ts +++ b/tools/awslint/lib/rules/public-static-properties.ts @@ -1,14 +1,11 @@ import { Property } from 'jsii-reflect'; import { Linter } from '../linter'; -import { CoreTypes } from './core-types'; const UPPER_SNAKE_CASE_ALLOWED_PATTERN = new RegExp('^[A-Z0-9][A-Z0-9_]*[A-Z0-9]+$'); export const publicStaticPropertiesLinter = new Linter(assembly => { const result = new Array(); for (const c of assembly.classes) { - // L1 classes are exempted - if (CoreTypes.isCfnResource(c)) { continue; } for (const property of c.allProperties) { if (property.const && property.static) { result.push(property); diff --git a/tools/cfn2ts/lib/codegen.ts b/tools/cfn2ts/lib/codegen.ts index 3038779502897..1520fc865b5ab 100644 --- a/tools/cfn2ts/lib/codegen.ts +++ b/tools/cfn2ts/lib/codegen.ts @@ -209,13 +209,13 @@ export default class CodeGenerator { this.code.line('/**'); this.code.line(` * The CloudFormation resource type name for this resource class.`); this.code.line(' */'); - this.code.line(`public static readonly cfnResourceTypeName = ${cfnResourceTypeName};`); + this.code.line(`public static readonly CFN_RESOURCE_TYPE_NAME = ${cfnResourceTypeName};`); if (spec.RequiredTransform) { this.code.line('/**'); this.code.line(' * The `Transform` a template must use in order to use this resource'); this.code.line(' */'); - this.code.line(`public static readonly requiredTransform = ${JSON.stringify(spec.RequiredTransform)};`); + this.code.line(`public static readonly REQUIRED_TRANSFORM = ${JSON.stringify(spec.RequiredTransform)};`); } // @@ -260,7 +260,7 @@ export default class CodeGenerator { const optionalProps = spec.Properties && !Object.values(spec.Properties).some(p => p.Required || false); const propsArgument = propsType ? `, props: ${propsType.className}${optionalProps ? ' = {}' : ''}` : ''; this.code.openBlock(`constructor(scope: ${CONSTRUCT_CLASS}, id: string${propsArgument})`); - this.code.line(`super(scope, id, { type: ${resourceName.className}.cfnResourceTypeName${propsType ? ', properties: props' : ''} });`); + this.code.line(`super(scope, id, { type: ${resourceName.className}.CFN_RESOURCE_TYPE_NAME${propsType ? ', properties: props' : ''} });`); // verify all required properties if (spec.Properties) { for (const propName of Object.keys(spec.Properties)) { @@ -271,14 +271,14 @@ export default class CodeGenerator { } } if (spec.RequiredTransform) { - const transformField = `${resourceName.className}.requiredTransform`; + const transformField = `${resourceName.className}.REQUIRED_TRANSFORM`; this.code.line('// If a different transform than the required one is in use, this resource cannot be used'); this.code.openBlock(`if (this.stack.templateOptions.transform && this.stack.templateOptions.transform !== ${transformField})`); // tslint:disable-next-line:max-line-length this.code.line(`throw new Error(\`The \${JSON.stringify(${transformField})} transform is required when using ${resourceName.className}, but the \${JSON.stringify(this.stack.templateOptions.transform)} is used.\`);`); this.code.closeBlock(); this.code.line('// Automatically configure the required transform'); - this.code.line(`this.stack.templateOptions.transform = ${resourceName.className}.requiredTransform;`); + this.code.line(`this.stack.templateOptions.transform = ${resourceName.className}.REQUIRED_TRANSFORM;`); } // initialize all attribute properties