diff --git a/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts b/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts index 9a67f5b49904b..f9bbf8cac761a 100644 --- a/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts +++ b/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts @@ -1,7 +1,7 @@ import ec2 = require('@aws-cdk/aws-ec2'); import lambda = require('@aws-cdk/aws-lambda'); +import serverless = require('@aws-cdk/aws-sam'); import secretsmanager = require('@aws-cdk/aws-secretsmanager'); -import serverless = require('@aws-cdk/aws-serverless'); import cdk = require('@aws-cdk/cdk'); /** diff --git a/packages/@aws-cdk/aws-rds/package.json b/packages/@aws-cdk/aws-rds/package.json index 79999fb99e94d..87090f7ea9c76 100644 --- a/packages/@aws-cdk/aws-rds/package.json +++ b/packages/@aws-cdk/aws-rds/package.json @@ -66,7 +66,7 @@ "@aws-cdk/aws-kms": "^0.26.0", "@aws-cdk/aws-lambda": "^0.26.0", "@aws-cdk/aws-secretsmanager": "^0.26.0", - "@aws-cdk/aws-serverless": "^0.26.0", + "@aws-cdk/aws-sam": "^0.26.0", "@aws-cdk/cdk": "^0.26.0" }, "homepage": "https://github.com/awslabs/aws-cdk", diff --git a/packages/@aws-cdk/aws-serverless/.gitignore b/packages/@aws-cdk/aws-sam/.gitignore similarity index 100% rename from packages/@aws-cdk/aws-serverless/.gitignore rename to packages/@aws-cdk/aws-sam/.gitignore diff --git a/packages/@aws-cdk/aws-serverless/.npmignore b/packages/@aws-cdk/aws-sam/.npmignore similarity index 100% rename from packages/@aws-cdk/aws-serverless/.npmignore rename to packages/@aws-cdk/aws-sam/.npmignore diff --git a/packages/@aws-cdk/aws-serverless/LICENSE b/packages/@aws-cdk/aws-sam/LICENSE similarity index 100% rename from packages/@aws-cdk/aws-serverless/LICENSE rename to packages/@aws-cdk/aws-sam/LICENSE diff --git a/packages/@aws-cdk/aws-serverless/NOTICE b/packages/@aws-cdk/aws-sam/NOTICE similarity index 100% rename from packages/@aws-cdk/aws-serverless/NOTICE rename to packages/@aws-cdk/aws-sam/NOTICE diff --git a/packages/@aws-cdk/aws-sam/README.md b/packages/@aws-cdk/aws-sam/README.md new file mode 100644 index 0000000000000..d67b26a50e3a8 --- /dev/null +++ b/packages/@aws-cdk/aws-sam/README.md @@ -0,0 +1,7 @@ +## AWS Serverless Application Model Construct Library + +```ts +const sam = require('@aws-cdk/aws-sam'); +``` + +Note: we recommended to use `@aws-cdk/aws-lambda`, `aws-cdk/aws-lambda-event-sources` and `@aws-cdk/aws-apigateway` packages to build 'serverless' applications with the CDK instead of the `AWS::Serverless` resources exposes by `@aws-cdk/aws-sam`. diff --git a/packages/@aws-cdk/aws-serverless/lib/index.ts b/packages/@aws-cdk/aws-sam/lib/index.ts similarity index 52% rename from packages/@aws-cdk/aws-serverless/lib/index.ts rename to packages/@aws-cdk/aws-sam/lib/index.ts index eb26f203a6065..7431d9e9031b7 100644 --- a/packages/@aws-cdk/aws-serverless/lib/index.ts +++ b/packages/@aws-cdk/aws-sam/lib/index.ts @@ -1,2 +1,2 @@ // AWS::Serverless CloudFormation Resources: -export * from './serverless.generated'; +export * from './sam.generated'; diff --git a/packages/@aws-cdk/aws-serverless/package.json b/packages/@aws-cdk/aws-sam/package.json similarity index 80% rename from packages/@aws-cdk/aws-serverless/package.json rename to packages/@aws-cdk/aws-sam/package.json index 43888b177757f..61e71f9889084 100644 --- a/packages/@aws-cdk/aws-serverless/package.json +++ b/packages/@aws-cdk/aws-sam/package.json @@ -1,23 +1,23 @@ { - "name": "@aws-cdk/aws-serverless", + "name": "@aws-cdk/aws-sam", "version": "0.26.0", - "description": "The CDK Construct Library for AWS::Serverless", + "description": "The CDK Construct Library for the AWS Serverless Application Model (SAM) resources", "main": "lib/index.js", "types": "lib/index.d.ts", "jsii": { "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Serverless", - "packageId": "Amazon.CDK.AWS.Serverless", + "namespace": "Amazon.CDK.AWS.SAM", + "packageId": "Amazon.CDK.AWS.SAM", "signAssembly": true, "assemblyOriginatorKeyFile": "../../key.snk" }, "java": { - "package": "software.amazon.awscdk.services.serverless", + "package": "software.amazon.awscdk.services.sam", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "serverless" + "artifactId": "sam" } }, "sphinx": {} @@ -46,7 +46,7 @@ "aws", "cdk", "constructs", - "aws-serverless" + "aws-sam" ], "author": { "name": "Amazon Web Services", diff --git a/packages/@aws-cdk/aws-serverless/test/test.serverless.ts b/packages/@aws-cdk/aws-sam/test/test.sam.ts similarity index 100% rename from packages/@aws-cdk/aws-serverless/test/test.serverless.ts rename to packages/@aws-cdk/aws-sam/test/test.sam.ts diff --git a/packages/@aws-cdk/aws-serverless/README.md b/packages/@aws-cdk/aws-serverless/README.md deleted file mode 100644 index 86d576684fc5e..0000000000000 --- a/packages/@aws-cdk/aws-serverless/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## AWS Serverless Construct Library - -```ts -const serverless = require('@aws-cdk/aws-serverless'); -``` diff --git a/packages/decdk/package.json b/packages/decdk/package.json index 786fafc7abe61..ad90cc929fd52 100644 --- a/packages/decdk/package.json +++ b/packages/decdk/package.json @@ -104,10 +104,10 @@ "@aws-cdk/aws-s3": "^0.26.0", "@aws-cdk/aws-s3-deployment": "^0.26.0", "@aws-cdk/aws-s3-notifications": "^0.26.0", + "@aws-cdk/aws-sam": "^0.26.0", "@aws-cdk/aws-sagemaker": "^0.26.0", "@aws-cdk/aws-sdb": "^0.26.0", "@aws-cdk/aws-secretsmanager": "^0.26.0", - "@aws-cdk/aws-serverless": "^0.26.0", "@aws-cdk/aws-servicecatalog": "^0.26.0", "@aws-cdk/aws-servicediscovery": "^0.26.0", "@aws-cdk/aws-ses": "^0.26.0", diff --git a/packages/decdk/test/schema.test.ts b/packages/decdk/test/schema.test.ts index 3ac79cdeb4252..f83f7d715317d 100644 --- a/packages/decdk/test/schema.test.ts +++ b/packages/decdk/test/schema.test.ts @@ -21,7 +21,7 @@ beforeAll(async () => { await typesys.load(path.dirname(require.resolve('@aws-cdk/cdk/.jsii'))); }); -test('schemaForInterface: interface with primitives', () => { +test('schemaForInterface: interface with primitives', async () => { // GIVEN const defs = { }; const ctx = SchemaContext.root(defs); diff --git a/tools/awslint/lib/rules/module.ts b/tools/awslint/lib/rules/module.ts index ae4ac8db9d315..c733e8749c4f7 100644 --- a/tools/awslint/lib/rules/module.ts +++ b/tools/awslint/lib/rules/module.ts @@ -25,7 +25,17 @@ moduleLinter.add( { eval: e => { if (!e.ctx.namespace) { return; } if (!e.ctx.assembly) { return; } - const namespace = e.ctx.namespace.toLocaleLowerCase().replace('::', '-'); + const namespace = overrideNamespace(e.ctx.namespace.toLocaleLowerCase().replace('::', '-')); e.assertEquals(e.ctx.assembly.name, `@aws-cdk/${namespace}`, e.ctx.assembly.name); } }); + +/** + * Overrides special-case namespaces like aws-serverless=>aws-sam + */ +function overrideNamespace(namespace: string) { + if (namespace === 'aws-serverless') { + return 'aws-sam'; + } + return namespace; +} diff --git a/tools/cfn2ts/lib/genspec.ts b/tools/cfn2ts/lib/genspec.ts index ca5ec4ffaf613..4603e4b9b092f 100644 --- a/tools/cfn2ts/lib/genspec.ts +++ b/tools/cfn2ts/lib/genspec.ts @@ -119,7 +119,17 @@ export function packageName(module: SpecName | string): string { throw new Error(`Module component name must be "AWS::Xxx" or "Alexa::Xxx" (module: ${module})`); } - return parts[parts.length - 1].toLowerCase(); + return overridePackageName(parts[parts.length - 1].toLowerCase()); +} + +/** + * Overrides special-case namespaces like serverless=>sam + */ +function overridePackageName(name: string) { + if (name === 'serverless') { + return 'sam'; + } + return name; } /**