Skip to content

Commit

Permalink
Merge branch 'master' into shivlaks/revert-apigwatewayv2-integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 23, 2020
2 parents 0f8ed7c + f4f53a6 commit 0656c54
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cognito/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
| Features | Stability |
| --- | --- |
| CFN Resources | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) |
| Higher level constructs for User Pools | ![Developer Preview](https://img.shields.io/badge/developer--preview-informational.svg?style=for-the-badge) |
| Higher level constructs for User Pools | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) |
| Higher level constructs for Identity Pools | ![Not Implemented](https://img.shields.io/badge/not--implemented-black.svg?style=for-the-badge) |

> **CFN Resources:** All classes with the `Cfn` prefix in this module ([CFN Resources](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) are always stable and safe to use.
> **Developer Preview:** Higher level constructs in this module that are marked as developer preview have completed their phase of active development and are looking for adoption and feedback. While the same caveats around non-backward compatible as Experimental constructs apply, they will undergo fewer breaking changes. Just as with Experimental constructs, these are not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be announced in the release notes.
> **Stable:** Higher level constructs in this module that are marked stable will not undergo any breaking changes. They will strictly follow the [Semantic Versioning](https://semver.org/) model.
---
<!--END STABILITY BANNER-->
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cognito/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@
"props-physical-name:@aws-cdk/aws-cognito.UserPoolIdentityProviderGoogleProps"
]
},
"stability": "experimental",
"maturity": "developer-preview",
"stability": "stable",
"maturity": "stable",
"features": [
{
"name": "Higher level constructs for User Pools",
"stability": "Developer Preview"
"stability": "Stable"
},
{
"name": "Higher level constructs for Identity Pools",
Expand Down
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-lambda-event-sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ behavior:
* __receiveMessageWaitTime__: Will determine [long
poll](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-long-polling.html)
duration. The default value is 20 seconds.
* __enabled__: If the SQS event source mapping should be enabled. The default is true.

```ts
import * as sqs from '@aws-cdk/aws-sqs';
Expand Down Expand Up @@ -145,6 +146,7 @@ and add it to your Lambda function. The following parameters will impact Amazon
* __parallelizationFactor__: The number of batches to concurrently process on each shard.
* __retryAttempts__: The maximum number of times a record should be retried in the event of failure.
* __startingPosition__: Will determine where to being consumption, either at the most recent ('LATEST') record or the oldest record ('TRIM_HORIZON'). 'TRIM_HORIZON' will ensure you process all available data, while 'LATEST' will ignore all records that arrived prior to attaching the event source.
* __enabled__: If the DynamoDB Streams event source mapping should be enabled. The default is true.
```ts
import * as dynamodb from '@aws-cdk/aws-dynamodb';
Expand Down Expand Up @@ -188,6 +190,7 @@ behavior:
* __parallelizationFactor__: The number of batches to concurrently process on each shard.
* __retryAttempts__: The maximum number of times a record should be retried in the event of failure.
* __startingPosition__: Will determine where to being consumption, either at the most recent ('LATEST') record or the oldest record ('TRIM_HORIZON'). 'TRIM_HORIZON' will ensure you process all available data, while 'LATEST' will ignore all records that arrived prior to attaching the event source.
* __enabled__: If the DynamoDB Streams event source mapping should be enabled. The default is true.
```ts
import * as lambda from '@aws-cdk/aws-lambda';
Expand Down
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-lambda-event-sources/lib/sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export interface SqsEventSourceProps {
* @default 10
*/
readonly batchSize?: number;

/**
* If the SQS event source mapping should be enabled.
*
* @default true
*/
readonly enabled?: boolean;
}

/**
Expand All @@ -29,6 +36,7 @@ export class SqsEventSource implements lambda.IEventSource {
public bind(target: lambda.IFunction) {
const eventSourceMapping = target.addEventSourceMapping(`SqsEventSource:${this.queue.node.uniqueId}`, {
batchSize: this.props.batchSize,
enabled: this.props.enabled,
eventSourceArn: this.queue.queueArn,
});
this._eventSourceMappingId = eventSourceMapping.eventSourceMappingId;
Expand Down
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ export interface StreamEventSourceProps {
* @default Duration.seconds(0)
*/
readonly maxBatchingWindow?: Duration;

/**
* If the stream event source mapping should be enabled.
*
* @default true
*/
readonly enabled?: boolean;
}

/**
Expand All @@ -99,6 +106,7 @@ export abstract class StreamEventSource implements lambda.IEventSource {
retryAttempts: this.props.retryAttempts,
parallelizationFactor: this.props.parallelizationFactor,
onFailure: this.props.onFailure,
enabled: this.props.enabled,
};
}
}
26 changes: 26 additions & 0 deletions packages/@aws-cdk/aws-lambda-event-sources/test/test.dynamo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,4 +596,30 @@ export = {

test.done();
},

'event source disabled'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const fn = new TestFunction(stack, 'Fn');
const table = new dynamodb.Table(stack, 'T', {
partitionKey: {
name: 'id',
type: dynamodb.AttributeType.STRING,
},
stream: dynamodb.StreamViewType.NEW_IMAGE,
});

// WHEN
fn.addEventSource(new sources.DynamoEventSource(table, {
startingPosition: lambda.StartingPosition.LATEST,
enabled: false,
}));

//THEN
expect(stack).to(haveResource('AWS::Lambda::EventSourceMapping', {
'Enabled': false,
}));

test.done();
},
};
20 changes: 20 additions & 0 deletions packages/@aws-cdk/aws-lambda-event-sources/test/test.kinesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,24 @@ export = {
test.throws(() => eventSource.eventSourceMappingId, /KinesisEventSource is not yet bound to an event source mapping/);
test.done();
},

'event source disabled'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const fn = new TestFunction(stack, 'Fn');
const stream = new kinesis.Stream(stack, 'S');
const eventSource = new sources.KinesisEventSource(stream, {
startingPosition: lambda.StartingPosition.LATEST,
enabled: false,
});

// WHEN
fn.addEventSource(eventSource);

// THEN
expect(stack).to(haveResource('AWS::Lambda::EventSourceMapping', {
'Enabled': false,
}));
test.done();
},
};
19 changes: 19 additions & 0 deletions packages/@aws-cdk/aws-lambda-event-sources/test/test.sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,23 @@ export = {
test.throws(() => eventSource.eventSourceMappingId, /SqsEventSource is not yet bound to an event source mapping/);
test.done();
},

'event source disabled'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const fn = new TestFunction(stack, 'Fn');
const q = new sqs.Queue(stack, 'Q');

// WHEN
fn.addEventSource(new sources.SqsEventSource(q, {
enabled: false,
}));

// THEN
expect(stack).to(haveResource('AWS::Lambda::EventSourceMapping', {
'Enabled': false,
}));

test.done();
},
};
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ses-actions/lib/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class S3 implements ses.IReceiptRuleAction {
// See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html#receiving-email-permissions-kms
if (this.props.kmsKey && !/alias\/aws\/ses$/.test(this.props.kmsKey.keyArn)) {
const kmsStatement = new iam.PolicyStatement({
actions: ['km:Encrypt', 'kms:GenerateDataKey'],
actions: ['kms:Encrypt', 'kms:GenerateDataKey'],
principals: [new iam.ServicePrincipal('ses.amazonaws.com')],
resources: ['*'],
conditions: {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ses-actions/test/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ test('add s3 action', () => {
},
{
Action: [
'km:Encrypt',
'kms:Encrypt',
'kms:GenerateDataKey',
],
Condition: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
},
{
"Action": [
"km:Encrypt",
"kms:Encrypt",
"kms:GenerateDataKey"
],
"Condition": {
Expand Down Expand Up @@ -389,4 +389,4 @@
}
}
}
}
}

0 comments on commit 0656c54

Please sign in to comment.