@aws-cdk/aws-lambda
Advanced tools
Comparing version 0.39.0 to 1.0.0
{ | ||
"name": "@aws-cdk/aws-lambda", | ||
"version": "0.39.0", | ||
"version": "1.0.0", | ||
"description": "CDK Constructs for AWS Lambda", | ||
@@ -72,3 +72,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@aws-cdk/assert": "^0.39.0", | ||
"@aws-cdk/assert": "^1.0.0", | ||
"@types/aws-lambda": "^8.10.27", | ||
@@ -80,34 +80,34 @@ "@types/lodash": "^4.14.134", | ||
"aws-sdk-mock": "^4.4.0", | ||
"cdk-build-tools": "^0.39.0", | ||
"cdk-integ-tools": "^0.39.0", | ||
"cfn2ts": "^0.39.0", | ||
"cdk-build-tools": "^1.0.0", | ||
"cdk-integ-tools": "^1.0.0", | ||
"cfn2ts": "^1.0.0", | ||
"lodash": "^4.17.11", | ||
"nock": "^10.0.6", | ||
"pkglint": "^0.39.0", | ||
"pkglint": "^1.0.0", | ||
"sinon": "^7.3.2" | ||
}, | ||
"dependencies": { | ||
"@aws-cdk/aws-cloudwatch": "^0.39.0", | ||
"@aws-cdk/aws-ec2": "^0.39.0", | ||
"@aws-cdk/aws-events": "^0.39.0", | ||
"@aws-cdk/aws-iam": "^0.39.0", | ||
"@aws-cdk/aws-logs": "^0.39.0", | ||
"@aws-cdk/aws-s3": "^0.39.0", | ||
"@aws-cdk/aws-s3-assets": "^0.39.0", | ||
"@aws-cdk/aws-sqs": "^0.39.0", | ||
"@aws-cdk/core": "^0.39.0", | ||
"@aws-cdk/cx-api": "^0.39.0" | ||
"@aws-cdk/aws-cloudwatch": "^1.0.0", | ||
"@aws-cdk/aws-ec2": "^1.0.0", | ||
"@aws-cdk/aws-events": "^1.0.0", | ||
"@aws-cdk/aws-iam": "^1.0.0", | ||
"@aws-cdk/aws-logs": "^1.0.0", | ||
"@aws-cdk/aws-s3": "^1.0.0", | ||
"@aws-cdk/aws-s3-assets": "^1.0.0", | ||
"@aws-cdk/aws-sqs": "^1.0.0", | ||
"@aws-cdk/core": "^1.0.0", | ||
"@aws-cdk/cx-api": "^1.0.0" | ||
}, | ||
"homepage": "https://github.com/awslabs/aws-cdk", | ||
"peerDependencies": { | ||
"@aws-cdk/aws-cloudwatch": "^0.39.0", | ||
"@aws-cdk/aws-ec2": "^0.39.0", | ||
"@aws-cdk/aws-events": "^0.39.0", | ||
"@aws-cdk/aws-iam": "^0.39.0", | ||
"@aws-cdk/aws-logs": "^0.39.0", | ||
"@aws-cdk/aws-s3": "^0.39.0", | ||
"@aws-cdk/aws-s3-assets": "^0.39.0", | ||
"@aws-cdk/aws-sqs": "^0.39.0", | ||
"@aws-cdk/core": "^0.39.0", | ||
"@aws-cdk/cx-api": "^0.39.0" | ||
"@aws-cdk/aws-cloudwatch": "^1.0.0", | ||
"@aws-cdk/aws-ec2": "^1.0.0", | ||
"@aws-cdk/aws-events": "^1.0.0", | ||
"@aws-cdk/aws-iam": "^1.0.0", | ||
"@aws-cdk/aws-logs": "^1.0.0", | ||
"@aws-cdk/aws-s3": "^1.0.0", | ||
"@aws-cdk/aws-s3-assets": "^1.0.0", | ||
"@aws-cdk/aws-sqs": "^1.0.0", | ||
"@aws-cdk/core": "^1.0.0", | ||
"@aws-cdk/cx-api": "^1.0.0" | ||
}, | ||
@@ -125,2 +125,2 @@ "engines": { | ||
"stability": "stable" | ||
} | ||
} |
@@ -8,4 +8,2 @@ ## AWS Lambda Construct Library | ||
> **This is a _developer preview_ (public beta) module. Releases might lack important features and might have | ||
> future breaking changes.** | ||
@@ -21,3 +19,3 @@ --- | ||
const fn = new lambda.Function(this, 'MyFunction', { | ||
runtime: lambda.Runtime.Nodejs810, | ||
runtime: lambda.Runtime.NODEJS_10_X, | ||
handler: 'index.handler', | ||
@@ -36,3 +34,3 @@ code: lambda.Code.asset('./lambda-handler'), | ||
* `lambda.Code.inline(code)` - inline the handle code as a string. This is | ||
limited to 4KB. | ||
limited to supported runtimes and the code cannot exceed 4KiB. | ||
* `lambda.Code.asset(path)` - specify a directory or a .zip file in the local | ||
@@ -72,5 +70,5 @@ filesystem which will be zipped and uploaded to S3 before deployment. | ||
In most cases, it is possible to trigger a function as a result of an event by | ||
using one of the `onXxx` methods on the source construct. For example, the `s3.Bucket` | ||
construct has an `onEvent` method which can be used to trigger a Lambda when an event, | ||
such as PutObject occurs on an S3 bucket. | ||
using one of the `add<Event>Notification` methods on the source construct. For | ||
example, the `s3.Bucket` construct has an `onEvent` method which can be used to | ||
trigger a Lambda when an event, such as PutObject occurs on an S3 bucket. | ||
@@ -93,3 +91,3 @@ An alternative way to add event sources to a function is to use `function.addEventSource(source)`. | ||
fn.addEventSource(new S3EventSource(bucket, { | ||
events: [ s3.EventType.ObjectCreated, s3.EventType.ObjectDeleted ], | ||
events: [ s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_DELETED ], | ||
filters: [ { prefix: 'subdir/' } ] // optional | ||
@@ -103,2 +101,5 @@ })); | ||
A dead-letter queue can be automatically created for a Lambda function by | ||
setting the `deadLetterQueueEnabled: true` configuration. | ||
```ts | ||
@@ -108,3 +109,3 @@ import lambda = require('@aws-cdk/aws-lambda'); | ||
const fn = new lambda.Function(this, 'MyFunction', { | ||
runtime: lambda.Runtime.Nodejs810, | ||
runtime: lambda.Runtime.NODEJS_10_X, | ||
handler: 'index.handler', | ||
@@ -115,2 +116,18 @@ code: lambda.Code.inline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'), | ||
``` | ||
It is also possible to provide a dead-letter queue instead of getting a new queue created: | ||
```ts | ||
import lambda = require('@aws-cdk/aws-lambda'); | ||
import sqs = require('@aws-cdk/aws-sqs'); | ||
const dlq = new sqs.Queue(this, 'DLQ'); | ||
const fn = new lambda.Function(this, 'MyFunction', { | ||
runtime: lambda.Runtime.NODEJS_10_X, | ||
handler: 'index.handler', | ||
code: lambda.Code.inline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'), | ||
deadLetterQueue: dlq | ||
}); | ||
``` | ||
See [the AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/dlq.html) | ||
@@ -125,6 +142,6 @@ to learn more about AWS Lambdas and DLQs. | ||
const fn = new lambda.Function(this, 'MyFunction', { | ||
runtime: lambda.Runtime.Nodejs810, | ||
runtime: lambda.Runtime.NODEJS_10_X, | ||
handler: 'index.handler', | ||
code: lambda.Code.inline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'), | ||
tracing: lambda.Tracing.Active | ||
tracing: lambda.Tracing.ACTIVE | ||
}); | ||
@@ -141,3 +158,3 @@ ``` | ||
const fn = new lambda.Function(this, 'MyFunction', { | ||
runtime: lambda.Runtime.Nodejs810, | ||
runtime: lambda.Runtime.NODEJS_10_X, | ||
handler: 'index.handler', | ||
@@ -144,0 +161,0 @@ code: lambda.Code.inline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1093534
0
157
+ Added@aws-cdk/assets@1.204.0(transitive)
+ Added@aws-cdk/aws-cloudwatch@1.204.0(transitive)
+ Added@aws-cdk/aws-ec2@1.204.0(transitive)
+ Added@aws-cdk/aws-events@1.204.0(transitive)
+ Added@aws-cdk/aws-iam@1.204.0(transitive)
+ Added@aws-cdk/aws-kms@1.204.0(transitive)
+ Added@aws-cdk/aws-logs@1.204.0(transitive)
+ Added@aws-cdk/aws-s3@1.204.0(transitive)
+ Added@aws-cdk/aws-s3-assets@1.204.0(transitive)
+ Added@aws-cdk/aws-sqs@1.204.0(transitive)
+ Added@aws-cdk/aws-ssm@1.204.0(transitive)
+ Added@aws-cdk/cloud-assembly-schema@1.204.0(transitive)
+ Added@aws-cdk/core@1.204.0(transitive)
+ Added@aws-cdk/cx-api@1.204.0(transitive)
+ Added@aws-cdk/region-info@1.204.0(transitive)
+ Addedconstructs@3.4.344(transitive)
- Removed@aws-cdk/assets@0.39.0(transitive)
- Removed@aws-cdk/aws-cloudwatch@0.39.0(transitive)
- Removed@aws-cdk/aws-ec2@0.39.0(transitive)
- Removed@aws-cdk/aws-events@0.39.0(transitive)
- Removed@aws-cdk/aws-iam@0.39.0(transitive)
- Removed@aws-cdk/aws-kms@0.39.0(transitive)
- Removed@aws-cdk/aws-logs@0.39.0(transitive)
- Removed@aws-cdk/aws-s3@0.39.0(transitive)
- Removed@aws-cdk/aws-s3-assets@0.39.0(transitive)
- Removed@aws-cdk/aws-sqs@0.39.0(transitive)
- Removed@aws-cdk/aws-ssm@0.39.0(transitive)
- Removed@aws-cdk/core@0.39.0(transitive)
- Removed@aws-cdk/cx-api@0.39.0(transitive)
- Removed@aws-cdk/region-info@0.39.0(transitive)
Updated@aws-cdk/aws-ec2@^1.0.0
Updated@aws-cdk/aws-events@^1.0.0
Updated@aws-cdk/aws-iam@^1.0.0
Updated@aws-cdk/aws-logs@^1.0.0
Updated@aws-cdk/aws-s3@^1.0.0
Updated@aws-cdk/aws-sqs@^1.0.0
Updated@aws-cdk/core@^1.0.0
Updated@aws-cdk/cx-api@^1.0.0