Skip to content

Commit

Permalink
docs(aws-s3-notifications): added example usage of aws-s3-notificatio…
Browse files Browse the repository at this point in the history
…ns.LambdaDestination (aws#16896)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
greg5123334 authored Nov 7, 2021
1 parent 747eb7c commit 42fb291
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/@aws-cdk/aws-s3-notifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
This module includes integration classes for using Topics, Queues or Lambdas
as S3 Notification Destinations.

## Example
## Examples

The following example shows how to send a notification to an SNS
topic when an object is created in an S3 bucket:
Expand All @@ -25,3 +25,18 @@ const topic = new sns.Topic(stack, 'Topic');

bucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.SnsDestination(topic));
```

The following example shows how to send a notification to a Lambda function when an object is created in an S3 bucket:

```ts
import * as s3n from '@aws-cdk/aws-s3-notifications';

const bucket = new s3.Bucket(stack, 'Bucket');
const fn = new Function(this, 'MyFunction', {
runtime: Runtime.NODEJS_12_X,
handler: 'index.handler',
code: Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});

bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(fn));
```
20 changes: 20 additions & 0 deletions packages/@aws-cdk/aws-wafv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,23 @@ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aw
```ts
import * as wafv2 from '@aws-cdk/aws-wafv2';
```

## Examples

Create a simple WebACL resource.

```csharp
var WebACL = new CfnWebACL(this, "WebACL", new CfnWebACLProps{
Name = "MyWebACL",
Scope = "REGIONAL",
DefaultAction = new CfnWebACL.DefaultActionProperty {
Allow = new CfnWebACL.AllowActionProperty{}
},
VisibilityConfig = new CfnWebACL.VisibilityConfigProperty {
SampledRequestsEnabled = true,
CloudWatchMetricsEnabled = true,
MetricName = "WebACL",
},
Rules = new CfnWebACL.RuleProperty[] {}
});
```

0 comments on commit 42fb291

Please sign in to comment.