@kensio/yulin 1.21.8 → 1.21.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-properties.d.ts +1 -1
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-properties.js +6 -3
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-names.d.ts +30 -0
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-names.js +91 -0
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.d.ts +7 -12
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.js +12 -92
- package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping-input.d.ts +2 -0
- package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping-input.js +5 -0
- package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping-refusals.js +0 -10
- package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping.handler.d.ts +2 -0
- package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping.handler.js +2 -0
- package/dist/service/lambda/command/event-source-mapping/sim-lambda-event-source-mapping-commands.d.ts +2 -0
- package/dist/service/lambda/destination/sim-lambda-destination-targets.d.ts +2 -1
- package/dist/service/lambda/event-source/poll/kinesis/sim-lambda-kinesis-shard-poller.d.ts +0 -4
- package/dist/service/lambda/event-source/poll/kinesis/sim-lambda-kinesis-shard-poller.js +11 -16
- package/dist/service/lambda/event-source/poll/sim-lambda-dynamodb-stream-event-source-poller.d.ts +1 -6
- package/dist/service/lambda/event-source/poll/sim-lambda-dynamodb-stream-event-source-poller.js +9 -27
- package/dist/service/lambda/event-source/poll/sim-lambda-dynamodb-stream-polling.d.ts +19 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-dynamodb-stream-polling.js +27 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-event-source-function.d.ts +1 -1
- package/dist/service/lambda/event-source/poll/sim-lambda-event-source-function.js +3 -1
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-age.d.ts +13 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-age.js +27 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-info.d.ts +15 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-info.js +26 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-outcome.d.ts +1 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-outcome.js +7 -1
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-processing.d.ts +17 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-batch-processing.js +12 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-bisect.d.ts +53 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-bisect.js +79 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-cursor.d.ts +15 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-cursor.js +28 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-expiry.d.ts +19 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-expiry.js +23 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-failure-context.d.ts +3 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-failure-context.js +19 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-failure-destination.d.ts +15 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-failure-destination.js +38 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-failure-record.d.ts +41 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-failure-record.js +17 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-progress-state.d.ts +23 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-progress-state.js +42 -0
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-progress.d.ts +21 -38
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-progress.js +45 -63
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-retry.d.ts +4 -39
- package/dist/service/lambda/event-source/poll/sim-lambda-stream-retry.js +12 -64
- package/dist/service/lambda/event-source/sim-lambda-event-source-mapping.d.ts +10 -3
- package/dist/service/lambda/event-source/sim-lambda-event-source-mapping.js +12 -3
- package/dist/service/lambda/event-source/sim-lambda-event-source-retry-limits.d.ts +8 -7
- package/dist/service/lambda/event-source/sim-lambda-event-source-retry-limits.js +6 -3
- package/dist/service/lambda/event-source/sim-lambda-stream-destination-config.d.ts +7 -0
- package/dist/service/lambda/event-source/sim-lambda-stream-destination-config.js +38 -0
- package/dist/service/lambda/event-source/sim-lambda-stream-retry-limits.d.ts +15 -7
- package/dist/service/lambda/event-source/sim-lambda-stream-retry-limits.js +15 -7
- package/dist/service/lambda/event-source/stream/kinesis/sim-kinesis-event-source-streams.js +1 -0
- package/dist/service/lambda/event-source/stream/sim-dynamodb-event-source-stream-reader.js +1 -0
- package/dist/service/lambda/event-source/stream/sim-dynamodb-event-source-stream-shard.d.ts +1 -0
- package/dist/service/lambda/event-source/stream/sim-dynamodb-event-source-stream-shard.js +7 -0
- package/dist/service/lambda/event-source/stream/sim-lambda-event-source-streams.d.ts +1 -0
- package/dist/service/lambda/index.d.ts +1 -0
- package/dist/service/lambda/sim-lambda-commands.js +1 -0
- package/docs/services/lambda/README.md +111 -11
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ export declare class SimCfnLambdaEventSourceMappingProperties {
|
|
|
19
19
|
private readonly parser;
|
|
20
20
|
constructor(properties: SimCfnLambdaEventSourceMappingPropertiesProperties);
|
|
21
21
|
/**
|
|
22
|
-
* The create input this Resource asks for,
|
|
22
|
+
* The create input this Resource asks for, recording what is left out of it.
|
|
23
23
|
*
|
|
24
24
|
* The event source ARN is read before anything else is judged, as the command
|
|
25
25
|
* reads it first for the same reason: what a mapping may ask for depends on
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { simLambdaStreamDestinationConfig } from "../../event-source/sim-lambda-stream-destination-config.js";
|
|
1
2
|
import { SimCfnLambdaPropertyParser } from "../function/sim-cfn-lambda-property-parser.js";
|
|
2
|
-
import {
|
|
3
|
+
import { recordUnsimulatedEventSourceMappingProperties } from "./sim-cfn-lambda-event-source-mapping-property-rules.js";
|
|
3
4
|
import { simCfnLambdaTargetFunctionName } from "../function/sim-cfn-lambda-target-function.js";
|
|
4
5
|
/**
|
|
5
6
|
* What a CloudFormation Unix time seconds value is multiplied by to reach the
|
|
@@ -23,7 +24,7 @@ export class SimCfnLambdaEventSourceMappingProperties {
|
|
|
23
24
|
this.properties = properties.properties;
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
* The create input this Resource asks for,
|
|
27
|
+
* The create input this Resource asks for, recording what is left out of it.
|
|
27
28
|
*
|
|
28
29
|
* The event source ARN is read before anything else is judged, as the command
|
|
29
30
|
* reads it first for the same reason: what a mapping may ask for depends on
|
|
@@ -31,15 +32,17 @@ export class SimCfnLambdaEventSourceMappingProperties {
|
|
|
31
32
|
*/
|
|
32
33
|
createInput() {
|
|
33
34
|
const eventSourceArn = this.parser.requiredString(this.resource, this.properties["EventSourceArn"], "EventSourceArn");
|
|
34
|
-
|
|
35
|
+
recordUnsimulatedEventSourceMappingProperties(this.resource, this.properties);
|
|
35
36
|
return {
|
|
36
37
|
EventSourceArn: eventSourceArn,
|
|
38
|
+
DestinationConfig: simLambdaStreamDestinationConfig(this.properties["DestinationConfig"]),
|
|
37
39
|
FunctionName: simCfnLambdaTargetFunctionName(this.parser.requiredString(this.resource, this.properties["FunctionName"], "FunctionName")),
|
|
38
40
|
BatchSize: this.parser.optionalNumber(this.resource, this.properties["BatchSize"], "BatchSize"),
|
|
39
41
|
Enabled: this.parser.optionalBoolean(this.resource, this.properties["Enabled"], "Enabled"),
|
|
40
42
|
MaximumBatchingWindowInSeconds: this.parser.optionalNumber(this.resource, this.properties["MaximumBatchingWindowInSeconds"], "MaximumBatchingWindowInSeconds"),
|
|
41
43
|
MaximumRetryAttempts: this.parser.optionalNumber(this.resource, this.properties["MaximumRetryAttempts"], "MaximumRetryAttempts"),
|
|
42
44
|
MaximumRecordAgeInSeconds: this.parser.optionalNumber(this.resource, this.properties["MaximumRecordAgeInSeconds"], "MaximumRecordAgeInSeconds"),
|
|
45
|
+
BisectBatchOnFunctionError: this.parser.optionalBoolean(this.resource, this.properties["BisectBatchOnFunctionError"], "BisectBatchOnFunctionError"),
|
|
43
46
|
StartingPosition: this.parser.optionalString(this.resource, this.properties["StartingPosition"], "StartingPosition"),
|
|
44
47
|
StartingPositionTimestamp: this.startingPositionTimestamp(),
|
|
45
48
|
FunctionResponseTypes: this.functionResponseTypes(),
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AWS::Lambda::EventSourceMapping properties this simulation acts on.
|
|
3
|
+
*
|
|
4
|
+
* The two starting position properties are here rather than among the
|
|
5
|
+
* unsimulated ones because whether a mapping may carry one is the event
|
|
6
|
+
* source's own rule: a stream has to be given a position and a queue is refused
|
|
7
|
+
* for naming one. That is decided by CreateEventSourceMapping, which knows
|
|
8
|
+
* which source the ARN names, so both are read and passed on. The two
|
|
9
|
+
* failed-batch limits are read for the same reason: a stream mapping keeps them
|
|
10
|
+
* and a queue mapping is refused for naming one.
|
|
11
|
+
*/
|
|
12
|
+
export declare const simulatedPropertyNames: ReadonlySet<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Real AWS::Lambda::EventSourceMapping properties this simulation does not act
|
|
15
|
+
* on, and what the mapping does in place of each.
|
|
16
|
+
*
|
|
17
|
+
* Every one of them changes what the function sees or when it sees it. That is
|
|
18
|
+
* what the record against the Resource is for. A mapping created without one
|
|
19
|
+
* still carries the records the template asked for to the function the
|
|
20
|
+
* template named, and the difference is there to be read.
|
|
21
|
+
*/
|
|
22
|
+
export declare const unsimulatedPropertyReasons: ReadonlyMap<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Why a property name this simulation has never heard of is recorded.
|
|
25
|
+
*
|
|
26
|
+
* A typo and a property AWS added after this simulation read the docs look
|
|
27
|
+
* identical from here. A mapping that deploys with the unread name reported is
|
|
28
|
+
* more use than a stack that fails over either.
|
|
29
|
+
*/
|
|
30
|
+
export declare const unknownPropertyReason: string;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AWS::Lambda::EventSourceMapping properties this simulation acts on.
|
|
3
|
+
*
|
|
4
|
+
* The two starting position properties are here rather than among the
|
|
5
|
+
* unsimulated ones because whether a mapping may carry one is the event
|
|
6
|
+
* source's own rule: a stream has to be given a position and a queue is refused
|
|
7
|
+
* for naming one. That is decided by CreateEventSourceMapping, which knows
|
|
8
|
+
* which source the ARN names, so both are read and passed on. The two
|
|
9
|
+
* failed-batch limits are read for the same reason: a stream mapping keeps them
|
|
10
|
+
* and a queue mapping is refused for naming one.
|
|
11
|
+
*/
|
|
12
|
+
export const simulatedPropertyNames = new Set([
|
|
13
|
+
"BatchSize",
|
|
14
|
+
"Enabled",
|
|
15
|
+
"EventSourceArn",
|
|
16
|
+
"FunctionName",
|
|
17
|
+
"FunctionResponseTypes",
|
|
18
|
+
"MaximumBatchingWindowInSeconds",
|
|
19
|
+
"MaximumRecordAgeInSeconds",
|
|
20
|
+
"MaximumRetryAttempts",
|
|
21
|
+
"BisectBatchOnFunctionError",
|
|
22
|
+
"DestinationConfig",
|
|
23
|
+
"StartingPosition",
|
|
24
|
+
"StartingPositionTimestamp",
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* The event sources a mapping property can only be configuring, none of which
|
|
28
|
+
* this simulation has.
|
|
29
|
+
*
|
|
30
|
+
* A mapping naming one of these has an event source ARN to match, and that ARN
|
|
31
|
+
* is what the mapping is refused on. The property beside it is recorded.
|
|
32
|
+
*/
|
|
33
|
+
const absentEventSource = "the mapping polls the source its EventSourceArn names, and this " +
|
|
34
|
+
"simulation has SQS queues, DynamoDB streams and Kinesis streams";
|
|
35
|
+
/**
|
|
36
|
+
* Real AWS::Lambda::EventSourceMapping properties this simulation does not act
|
|
37
|
+
* on, and what the mapping does in place of each.
|
|
38
|
+
*
|
|
39
|
+
* Every one of them changes what the function sees or when it sees it. That is
|
|
40
|
+
* what the record against the Resource is for. A mapping created without one
|
|
41
|
+
* still carries the records the template asked for to the function the
|
|
42
|
+
* template named, and the difference is there to be read.
|
|
43
|
+
*/
|
|
44
|
+
export const unsimulatedPropertyReasons = new Map([
|
|
45
|
+
["AmazonManagedKafkaEventSourceConfig", absentEventSource],
|
|
46
|
+
["DocumentDBEventSourceConfig", absentEventSource],
|
|
47
|
+
[
|
|
48
|
+
"FilterCriteria",
|
|
49
|
+
"every record on the event source is delivered to the function, unfiltered",
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"KmsKeyArn",
|
|
53
|
+
"the key encrypts filter criteria, and filter criteria are not simulated",
|
|
54
|
+
],
|
|
55
|
+
["MetricsConfig", "the mapping publishes no CloudWatch metrics"],
|
|
56
|
+
[
|
|
57
|
+
"ParallelizationFactor",
|
|
58
|
+
"polling concurrency is not simulated, and each shard of a stream is read " +
|
|
59
|
+
"by one reader",
|
|
60
|
+
],
|
|
61
|
+
["ProvisionedPollerConfig", "polling concurrency is not simulated"],
|
|
62
|
+
["Queues", absentEventSource],
|
|
63
|
+
["ScalingConfig", "polling concurrency is not simulated"],
|
|
64
|
+
["SelfManagedEventSource", absentEventSource],
|
|
65
|
+
["SelfManagedKafkaEventSourceConfig", absentEventSource],
|
|
66
|
+
[
|
|
67
|
+
"SourceAccessConfigurations",
|
|
68
|
+
"event source authentication is not simulated",
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"Tags",
|
|
72
|
+
"the mapping is created without them, and nothing reads them back or " +
|
|
73
|
+
"groups or bills by them",
|
|
74
|
+
],
|
|
75
|
+
["Topics", absentEventSource],
|
|
76
|
+
[
|
|
77
|
+
"TumblingWindowInSeconds",
|
|
78
|
+
"a batch carries no window state from the batch before it, and the " +
|
|
79
|
+
"function is handed no state to return",
|
|
80
|
+
],
|
|
81
|
+
]);
|
|
82
|
+
/**
|
|
83
|
+
* Why a property name this simulation has never heard of is recorded.
|
|
84
|
+
*
|
|
85
|
+
* A typo and a property AWS added after this simulation read the docs look
|
|
86
|
+
* identical from here. A mapping that deploys with the unread name reported is
|
|
87
|
+
* more use than a stack that fails over either.
|
|
88
|
+
*/
|
|
89
|
+
export const unknownPropertyReason = "it is not an AWS::Lambda::EventSourceMapping property this simulation " +
|
|
90
|
+
"knows, whether because AWS added it or because the template misspelled " +
|
|
91
|
+
"something";
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
|
|
2
2
|
import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Record everything about an AWS::Lambda::EventSourceMapping Resource that the
|
|
5
|
+
* mapping is created without.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Nothing here fails the Resource. A mapping missing one of these settings
|
|
8
|
+
* still carries records from the source to the function, and a stack that
|
|
9
|
+
* refused it would take every other Resource down over one line of a template.
|
|
10
|
+
* What the mapping does instead is in `stack.ignoredProperties`.
|
|
11
11
|
*/
|
|
12
|
-
export declare function
|
|
13
|
-
/**
|
|
14
|
-
* Refuse everything about an AWS::Lambda::EventSourceMapping Resource that is
|
|
15
|
-
* not simulated, and record what the mapping is created without.
|
|
16
|
-
*/
|
|
17
|
-
export declare function assertSimulatedEventSourceMappingProperties(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): void;
|
|
12
|
+
export declare function recordUnsimulatedEventSourceMappingProperties(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): void;
|
|
@@ -1,100 +1,20 @@
|
|
|
1
|
+
import { simulatedPropertyNames, unknownPropertyReason, unsimulatedPropertyReasons, } from "./sim-cfn-lambda-event-source-mapping-property-names.js";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Record everything about an AWS::Lambda::EventSourceMapping Resource that the
|
|
4
|
+
* mapping is created without.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* which source the ARN names, so both are read and passed on. The two
|
|
9
|
-
* failed-batch limits are read for the same reason: a stream mapping keeps them
|
|
10
|
-
* and a queue mapping is refused for naming one.
|
|
6
|
+
* Nothing here fails the Resource. A mapping missing one of these settings
|
|
7
|
+
* still carries records from the source to the function, and a stack that
|
|
8
|
+
* refused it would take every other Resource down over one line of a template.
|
|
9
|
+
* What the mapping does instead is in `stack.ignoredProperties`.
|
|
11
10
|
*/
|
|
12
|
-
|
|
13
|
-
"BatchSize",
|
|
14
|
-
"Enabled",
|
|
15
|
-
"EventSourceArn",
|
|
16
|
-
"FunctionName",
|
|
17
|
-
"FunctionResponseTypes",
|
|
18
|
-
"MaximumBatchingWindowInSeconds",
|
|
19
|
-
"MaximumRecordAgeInSeconds",
|
|
20
|
-
"MaximumRetryAttempts",
|
|
21
|
-
"StartingPosition",
|
|
22
|
-
"StartingPositionTimestamp",
|
|
23
|
-
]);
|
|
24
|
-
/**
|
|
25
|
-
* Real AWS::Lambda::EventSourceMapping properties this simulation does not
|
|
26
|
-
* model.
|
|
27
|
-
*
|
|
28
|
-
* Every one of them changes what the function sees or when it sees it, so a
|
|
29
|
-
* template asking for one fails the Resource rather than deploying a mapping
|
|
30
|
-
* that quietly ignores it.
|
|
31
|
-
*/
|
|
32
|
-
const unsimulatedPropertyNames = new Set([
|
|
33
|
-
"AmazonManagedKafkaEventSourceConfig",
|
|
34
|
-
"BisectBatchOnFunctionError",
|
|
35
|
-
"DestinationConfig",
|
|
36
|
-
"DocumentDBEventSourceConfig",
|
|
37
|
-
"FilterCriteria",
|
|
38
|
-
"KmsKeyArn",
|
|
39
|
-
"MetricsConfig",
|
|
40
|
-
"ParallelizationFactor",
|
|
41
|
-
"ProvisionedPollerConfig",
|
|
42
|
-
"Queues",
|
|
43
|
-
"ScalingConfig",
|
|
44
|
-
"SelfManagedEventSource",
|
|
45
|
-
"SelfManagedKafkaEventSourceConfig",
|
|
46
|
-
"SourceAccessConfigurations",
|
|
47
|
-
"Topics",
|
|
48
|
-
"TumblingWindowInSeconds",
|
|
49
|
-
]);
|
|
50
|
-
/**
|
|
51
|
-
* Real AWS::Lambda::EventSourceMapping properties this simulation has nothing
|
|
52
|
-
* to act on and no reason to fail a stack over.
|
|
53
|
-
*
|
|
54
|
-
* `Tags` is the whole list. The mapping is created without them and the
|
|
55
|
-
* omission is recorded against the Resource. A mapping delivers the same
|
|
56
|
-
* records with a tag and without one, and a CDK app calling
|
|
57
|
-
* `Tags.of(app).add(...)` tags every mapping in it.
|
|
58
|
-
*/
|
|
59
|
-
const ignoredPropertyReasons = new Map([
|
|
60
|
-
[
|
|
61
|
-
"Tags",
|
|
62
|
-
"AWS::Lambda::EventSourceMapping property Tags is not simulated, so the " +
|
|
63
|
-
"mapping is created without them. Nothing reads them back and nothing " +
|
|
64
|
-
"is grouped or billed by them.",
|
|
65
|
-
],
|
|
66
|
-
]);
|
|
67
|
-
/**
|
|
68
|
-
* Build the error a property of an AWS::Lambda::EventSourceMapping Resource is
|
|
69
|
-
* refused with.
|
|
70
|
-
*
|
|
71
|
-
* The wording matters: sim CloudFormation skips a Resource whose error reads as
|
|
72
|
-
* an unsupported Resource type, and skipping is the wrong answer for a mapping
|
|
73
|
-
* that cannot be created as the template asks. The stack would deploy with the
|
|
74
|
-
* queue and the function and nothing between them.
|
|
75
|
-
*/
|
|
76
|
-
export function eventSourceMappingPropertyError(logicalId, reason) {
|
|
77
|
-
return new Error(`Invalid AWS::Lambda::EventSourceMapping Resource ${logicalId}: ${reason}`);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Refuse everything about an AWS::Lambda::EventSourceMapping Resource that is
|
|
81
|
-
* not simulated, and record what the mapping is created without.
|
|
82
|
-
*/
|
|
83
|
-
export function assertSimulatedEventSourceMappingProperties(resource, properties) {
|
|
84
|
-
const logicalId = resource.logicalId;
|
|
11
|
+
export function recordUnsimulatedEventSourceMappingProperties(resource, properties) {
|
|
85
12
|
for (const name of Object.keys(properties)) {
|
|
86
|
-
|
|
87
|
-
if (ignoredReason !== undefined) {
|
|
88
|
-
resource.ignoreProperty(name, ignoredReason);
|
|
13
|
+
if (simulatedPropertyNames.has(name)) {
|
|
89
14
|
continue;
|
|
90
15
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"ignored");
|
|
95
|
-
}
|
|
96
|
-
if (!simulatedPropertyNames.has(name)) {
|
|
97
|
-
throw eventSourceMappingPropertyError(logicalId, `${name} is not an AWS::Lambda::EventSourceMapping property`);
|
|
98
|
-
}
|
|
16
|
+
const reason = unsimulatedPropertyReasons.get(name) ?? unknownPropertyReason;
|
|
17
|
+
resource.ignoreProperty(name, `AWS::Lambda::EventSourceMapping property ${name} is not simulated: ` +
|
|
18
|
+
`${reason}.`);
|
|
99
19
|
}
|
|
100
20
|
}
|
package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping-input.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SimLambdaStreamDestinationConfiguration } from "../../event-source/sim-lambda-stream-destination-config.js";
|
|
1
2
|
import type { SimAwsAccountRegionScope } from "../../../aws/sim-aws-account-region-scope.js";
|
|
2
3
|
import { type SimLambdaEventSourceArn } from "../../event-source/sim-lambda-event-source-arn.js";
|
|
3
4
|
import type { SimLambdaFunctionResponseType } from "../../event-source/sim-lambda-event-source-mapping.js";
|
|
@@ -29,6 +30,7 @@ export declare class SimLambdaEventSourceMappingInput {
|
|
|
29
30
|
readonly start: SimLambdaEventSourceStart | undefined;
|
|
30
31
|
readonly enabled: boolean;
|
|
31
32
|
readonly functionResponseTypes: readonly SimLambdaFunctionResponseType[];
|
|
33
|
+
readonly destinationConfig: SimLambdaStreamDestinationConfiguration | undefined;
|
|
32
34
|
/**
|
|
33
35
|
* When a failed batch stops being delivered again, for a source that leaves
|
|
34
36
|
* the counting to the mapping.
|
package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping-input.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { simLambdaStreamDestinationConfig, } from "../../event-source/sim-lambda-stream-destination-config.js";
|
|
1
2
|
import { simLambdaEventSourceArnOf, } from "../../event-source/sim-lambda-event-source-arn.js";
|
|
2
3
|
import { SimLambdaInvalidParameterValueException } from "../../error/sim-lambda.error.js";
|
|
3
4
|
import { simLambdaFunctionReferenceOf } from "../../function/sim-lambda-function-reference.js";
|
|
@@ -28,6 +29,7 @@ export class SimLambdaEventSourceMappingInput {
|
|
|
28
29
|
start;
|
|
29
30
|
enabled;
|
|
30
31
|
functionResponseTypes;
|
|
32
|
+
destinationConfig;
|
|
31
33
|
/**
|
|
32
34
|
* When a failed batch stops being delivered again, for a source that leaves
|
|
33
35
|
* the counting to the mapping.
|
|
@@ -41,6 +43,7 @@ export class SimLambdaEventSourceMappingInput {
|
|
|
41
43
|
this.start = properties.start;
|
|
42
44
|
this.enabled = properties.enabled;
|
|
43
45
|
this.functionResponseTypes = properties.functionResponseTypes;
|
|
46
|
+
this.destinationConfig = properties.destinationConfig;
|
|
44
47
|
this.streamRetryLimits = properties.streamRetryLimits;
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
@@ -53,6 +56,7 @@ export class SimLambdaEventSourceMappingInput {
|
|
|
53
56
|
refuseUnsimulatedInput(input);
|
|
54
57
|
return new this({
|
|
55
58
|
eventSourceArn,
|
|
59
|
+
destinationConfig: simLambdaStreamDestinationConfig(input.DestinationConfig, eventSourceArn.kind),
|
|
56
60
|
...simLambdaFunctionReferenceOf(requiredString(input.FunctionName, "functionName")),
|
|
57
61
|
batchSize: eventSourceArn.batchRules.sizeIn(input.BatchSize),
|
|
58
62
|
start: eventSourceArn.startingPositionRules.startIn({
|
|
@@ -64,6 +68,7 @@ export class SimLambdaEventSourceMappingInput {
|
|
|
64
68
|
streamRetryLimits: eventSourceArn.retryLimitRules.limitsIn({
|
|
65
69
|
maximumRetryAttempts: input.MaximumRetryAttempts,
|
|
66
70
|
maximumRecordAgeInSeconds: input.MaximumRecordAgeInSeconds,
|
|
71
|
+
bisectBatchOnFunctionError: input.BisectBatchOnFunctionError,
|
|
67
72
|
}),
|
|
68
73
|
});
|
|
69
74
|
}
|
package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping-refusals.js
CHANGED
|
@@ -12,16 +12,6 @@ const unsimulatedInputs = new Map([
|
|
|
12
12
|
["FilterCriteria", "event filtering is not simulated"],
|
|
13
13
|
["ScalingConfig", "polling concurrency is not simulated"],
|
|
14
14
|
["ProvisionedPollerConfig", "polling concurrency is not simulated"],
|
|
15
|
-
[
|
|
16
|
-
"DestinationConfig",
|
|
17
|
-
"failure destinations are not simulated, so a stream batch that runs out " +
|
|
18
|
-
"of attempts is discarded rather than sent anywhere",
|
|
19
|
-
],
|
|
20
|
-
[
|
|
21
|
-
"BisectBatchOnFunctionError",
|
|
22
|
-
"batch bisection is not simulated, so a failing stream batch is retried " +
|
|
23
|
-
"whole",
|
|
24
|
-
],
|
|
25
15
|
[
|
|
26
16
|
"ParallelizationFactor",
|
|
27
17
|
"polling concurrency is not simulated, so each shard of a stream is read " +
|
package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping.handler.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimLambdaDestinationTargets } from "../../destination/sim-lambda-destination-targets.js";
|
|
1
2
|
import type { CommandHandler } from "../../../../command/command-handler.js";
|
|
2
3
|
import type { BackgroundScheduler } from "../../../../util/background/background.js";
|
|
3
4
|
import type { SimAwsCaller } from "../../../aws/caller/sim-aws-caller.js";
|
|
@@ -19,6 +20,7 @@ interface CreateEventSourceMappingCommandHandlerProperties {
|
|
|
19
20
|
readonly kinesisStreams: SimLambdaKinesisStreams;
|
|
20
21
|
readonly functions: SimLambdaFunctionLookup;
|
|
21
22
|
readonly iam: SimIamInterServiceAuthZ;
|
|
23
|
+
readonly destinations?: SimLambdaDestinationTargets;
|
|
22
24
|
readonly background: BackgroundScheduler;
|
|
23
25
|
}
|
|
24
26
|
interface CreateEventSourceMappingCommandHandlerOptions {
|
package/dist/service/lambda/command/event-source-mapping/create-event-source-mapping.handler.js
CHANGED
|
@@ -81,6 +81,8 @@ export class CreateEventSourceMappingCommandHandler {
|
|
|
81
81
|
enabled: input.enabled,
|
|
82
82
|
functionResponseTypes: input.functionResponseTypes,
|
|
83
83
|
streamRetryLimits: input.streamRetryLimits,
|
|
84
|
+
destinationConfig: input.destinationConfig,
|
|
85
|
+
destinations: this.properties.destinations,
|
|
84
86
|
createdAt: this.properties.background.now(),
|
|
85
87
|
});
|
|
86
88
|
this.properties.mappings.add(mapping);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimLambdaDestinationTargets } from "../../destination/sim-lambda-destination-targets.js";
|
|
1
2
|
import type { BackgroundScheduler } from "../../../../util/background/background.js";
|
|
2
3
|
import type { SimAwsCaller } from "../../../aws/caller/sim-aws-caller.js";
|
|
3
4
|
import type { SimAwsAccountRegionScope } from "../../../aws/sim-aws-account-region-scope.js";
|
|
@@ -17,6 +18,7 @@ interface SimLambdaEventSourceMappingCommandsProperties {
|
|
|
17
18
|
readonly kinesisStreams: SimLambdaKinesisStreams;
|
|
18
19
|
readonly functions: SimLambdaFunctionLookup;
|
|
19
20
|
readonly iam: SimIamInterServiceAuthZ;
|
|
21
|
+
readonly destinations?: SimLambdaDestinationTargets;
|
|
20
22
|
readonly background: BackgroundScheduler;
|
|
21
23
|
}
|
|
22
24
|
interface SimLambdaEventSourceMappingCommandOptions {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimLambdaStreamFailureRecord } from "../event-source/poll/sim-lambda-stream-failure-record.js";
|
|
1
2
|
import type { SimLambdaDestinationArn } from "./sim-lambda-destination-arn.js";
|
|
2
3
|
import type { SimLambdaDestinationRecord } from "./sim-lambda-destination-record.js";
|
|
3
4
|
/**
|
|
@@ -5,7 +6,7 @@ import type { SimLambdaDestinationRecord } from "./sim-lambda-destination-record
|
|
|
5
6
|
*/
|
|
6
7
|
export interface SimLambdaDestinationDeliveryRequest {
|
|
7
8
|
readonly destinationArn: SimLambdaDestinationArn;
|
|
8
|
-
readonly record: SimLambdaDestinationRecord;
|
|
9
|
+
readonly record: SimLambdaDestinationRecord | SimLambdaStreamFailureRecord;
|
|
9
10
|
/**
|
|
10
11
|
* The function whose invocation produced this record, which is what the
|
|
11
12
|
* delivery is attributed to.
|
|
@@ -49,9 +49,5 @@ export declare class SimLambdaKinesisShardPoller implements SimLambdaEventSource
|
|
|
49
49
|
* reading the same records.
|
|
50
50
|
*/
|
|
51
51
|
poll(): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* The function this mapping delivers to, while it should be delivering.
|
|
54
|
-
*/
|
|
55
|
-
private pollingFunction;
|
|
56
52
|
}
|
|
57
53
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { processSimLambdaStreamBatch } from "../sim-lambda-stream-batch-processing.js";
|
|
2
|
+
import { simLambdaKinesisStreamRecordTimes } from "../sim-lambda-stream-record-times.js";
|
|
1
3
|
import { simLambdaEventSourceFunction } from "../sim-lambda-event-source-function.js";
|
|
2
4
|
import { SimLambdaEventSourcePollTurn, } from "../sim-lambda-event-source-poll-turn.js";
|
|
3
5
|
import { SimLambdaStreamProgress } from "../sim-lambda-stream-progress.js";
|
|
@@ -57,27 +59,20 @@ export class SimLambdaKinesisShardPoller {
|
|
|
57
59
|
* reading the same records.
|
|
58
60
|
*/
|
|
59
61
|
async poll() {
|
|
60
|
-
const simFunction = this.
|
|
62
|
+
const simFunction = simLambdaEventSourceFunction(this.functions, this.mapping, this.stopped);
|
|
61
63
|
if (simFunction === undefined) {
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
64
66
|
const { progress } = this;
|
|
65
67
|
// Reading is done as the function's execution role, as on real Lambda, so
|
|
66
68
|
// simulated IAM decides whether this mapping may read its stream.
|
|
67
|
-
const batch = await this.shard.read(progress.position, this.mapping.batchSize);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* The function this mapping delivers to, while it should be delivering.
|
|
76
|
-
*/
|
|
77
|
-
pollingFunction() {
|
|
78
|
-
if (this.stopped || !this.mapping.isPolling) {
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
return simLambdaEventSourceFunction(this.functions, this.mapping);
|
|
69
|
+
const batch = await this.shard.read(progress.position, progress.batchSizeWithin(this.mapping.batchSize));
|
|
70
|
+
await processSimLambdaStreamBatch({
|
|
71
|
+
batch,
|
|
72
|
+
progress,
|
|
73
|
+
simFunction,
|
|
74
|
+
times: simLambdaKinesisStreamRecordTimes,
|
|
75
|
+
deliver: async (records) => await this.delivery.to(simFunction, records),
|
|
76
|
+
});
|
|
82
77
|
}
|
|
83
78
|
}
|
package/dist/service/lambda/event-source/poll/sim-lambda-dynamodb-stream-event-source-poller.d.ts
CHANGED
|
@@ -26,10 +26,9 @@ interface SimLambdaDynamoDbStreamEventSourcePollerProperties {
|
|
|
26
26
|
* overlapping the first would hand the same records to the function twice.
|
|
27
27
|
*/
|
|
28
28
|
export declare class SimLambdaDynamoDbStreamEventSourcePoller implements SimLambdaEventSourcePoller, SimLambdaEventSourcePolls {
|
|
29
|
-
private readonly mapping;
|
|
30
|
-
private readonly functions;
|
|
31
29
|
private readonly stream;
|
|
32
30
|
private readonly delivery;
|
|
31
|
+
private readonly polling;
|
|
33
32
|
private readonly progress;
|
|
34
33
|
private readonly turn;
|
|
35
34
|
private stopped;
|
|
@@ -68,9 +67,5 @@ export declare class SimLambdaDynamoDbStreamEventSourcePoller implements SimLamb
|
|
|
68
67
|
* reading the same records.
|
|
69
68
|
*/
|
|
70
69
|
poll(): Promise<void>;
|
|
71
|
-
/**
|
|
72
|
-
* The function this mapping delivers to, while it should be delivering.
|
|
73
|
-
*/
|
|
74
|
-
private pollingFunction;
|
|
75
70
|
}
|
|
76
71
|
export {};
|
package/dist/service/lambda/event-source/poll/sim-lambda-dynamodb-stream-event-source-poller.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SimLambdaDynamoDbStreamPolling } from "./sim-lambda-dynamodb-stream-polling.js";
|
|
2
2
|
import { SimLambdaDynamoDbPolledStream } from "./sim-lambda-dynamodb-polled-stream.js";
|
|
3
3
|
import { SimLambdaDynamoDbStreamDelivery } from "./sim-lambda-dynamodb-stream-delivery.js";
|
|
4
4
|
import { SimLambdaEventSourcePollTurn, } from "./sim-lambda-event-source-poll-turn.js";
|
|
@@ -17,17 +17,14 @@ import { SimLambdaStreamProgress } from "./sim-lambda-stream-progress.js";
|
|
|
17
17
|
* overlapping the first would hand the same records to the function twice.
|
|
18
18
|
*/
|
|
19
19
|
export class SimLambdaDynamoDbStreamEventSourcePoller {
|
|
20
|
-
mapping;
|
|
21
|
-
functions;
|
|
22
20
|
stream;
|
|
23
21
|
delivery;
|
|
22
|
+
polling;
|
|
24
23
|
progress;
|
|
25
24
|
turn = new SimLambdaEventSourcePollTurn(this);
|
|
26
25
|
stopped = false;
|
|
27
26
|
constructor(properties) {
|
|
28
27
|
const { eventSourceArn, mapping } = properties;
|
|
29
|
-
this.mapping = mapping;
|
|
30
|
-
this.functions = properties.functions;
|
|
31
28
|
this.stream = new SimLambdaDynamoDbPolledStream(properties.streams, eventSourceArn.value);
|
|
32
29
|
this.delivery = new SimLambdaDynamoDbStreamDelivery({
|
|
33
30
|
mapping,
|
|
@@ -40,6 +37,12 @@ export class SimLambdaDynamoDbStreamEventSourcePoller {
|
|
|
40
37
|
await this.turn.take();
|
|
41
38
|
},
|
|
42
39
|
});
|
|
40
|
+
this.polling = new SimLambdaDynamoDbStreamPolling({
|
|
41
|
+
...properties,
|
|
42
|
+
stream: this.stream,
|
|
43
|
+
progress: this.progress,
|
|
44
|
+
delivery: this.delivery,
|
|
45
|
+
});
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
48
|
* Watch the stream this mapping polls.
|
|
@@ -88,27 +91,6 @@ export class SimLambdaDynamoDbStreamEventSourcePoller {
|
|
|
88
91
|
* reading the same records.
|
|
89
92
|
*/
|
|
90
93
|
async poll() {
|
|
91
|
-
|
|
92
|
-
if (simFunction === undefined) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const { progress } = this;
|
|
96
|
-
// Reading is done as the function's execution role, as on real Lambda, so
|
|
97
|
-
// simulated IAM decides whether this mapping may read its stream.
|
|
98
|
-
const batch = await this.stream.read(simFunction.roleArn, progress.position, this.mapping.batchSize);
|
|
99
|
-
if (batch.records.length === 0) {
|
|
100
|
-
progress.caughtUp(batch);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
progress.after(await this.delivery.to(simFunction, batch.records), batch);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* The function this mapping delivers to, while it should be delivering.
|
|
107
|
-
*/
|
|
108
|
-
pollingFunction() {
|
|
109
|
-
if (this.stopped || !this.mapping.isPolling) {
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
return simLambdaEventSourceFunction(this.functions, this.mapping);
|
|
94
|
+
await this.polling.poll(this.stopped);
|
|
113
95
|
}
|
|
114
96
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SimLambdaFunctionLookup } from "../../function/url/sim-lambda-function-lookup.js";
|
|
2
|
+
import type { SimLambdaEventSourceMapping } from "../sim-lambda-event-source-mapping.js";
|
|
3
|
+
import type { SimLambdaDynamoDbPolledStream } from "./sim-lambda-dynamodb-polled-stream.js";
|
|
4
|
+
import type { SimLambdaDynamoDbStreamDelivery } from "./sim-lambda-dynamodb-stream-delivery.js";
|
|
5
|
+
import type { SimLambdaStreamProgress } from "./sim-lambda-stream-progress.js";
|
|
6
|
+
interface DynamoDbStreamPollingProperties {
|
|
7
|
+
readonly functions: SimLambdaFunctionLookup;
|
|
8
|
+
readonly mapping: SimLambdaEventSourceMapping;
|
|
9
|
+
readonly stream: SimLambdaDynamoDbPolledStream;
|
|
10
|
+
readonly delivery: SimLambdaDynamoDbStreamDelivery;
|
|
11
|
+
readonly progress: SimLambdaStreamProgress;
|
|
12
|
+
}
|
|
13
|
+
/** Read and process DynamoDB batches as the function execution role. */
|
|
14
|
+
export declare class SimLambdaDynamoDbStreamPolling {
|
|
15
|
+
private readonly properties;
|
|
16
|
+
constructor(properties: DynamoDbStreamPollingProperties);
|
|
17
|
+
poll(stopped: boolean): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { simLambdaDynamoDbStreamRecordTimes } from "./sim-lambda-stream-record-times.js";
|
|
2
|
+
import { processSimLambdaStreamBatch } from "./sim-lambda-stream-batch-processing.js";
|
|
3
|
+
import { simLambdaEventSourceFunction } from "./sim-lambda-event-source-function.js";
|
|
4
|
+
/** Read and process DynamoDB batches as the function execution role. */
|
|
5
|
+
export class SimLambdaDynamoDbStreamPolling {
|
|
6
|
+
properties;
|
|
7
|
+
constructor(properties) {
|
|
8
|
+
this.properties = properties;
|
|
9
|
+
}
|
|
10
|
+
async poll(stopped) {
|
|
11
|
+
const simFunction = simLambdaEventSourceFunction(this.properties.functions, this.properties.mapping, stopped);
|
|
12
|
+
if (simFunction === undefined) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const { progress, stream, mapping, delivery } = this.properties;
|
|
16
|
+
// Reading is done as the function's execution role, as on real Lambda, so
|
|
17
|
+
// simulated IAM decides whether this mapping may read its stream.
|
|
18
|
+
const batch = await stream.read(simFunction.roleArn, progress.position, progress.batchSizeWithin(mapping.batchSize));
|
|
19
|
+
await processSimLambdaStreamBatch({
|
|
20
|
+
batch,
|
|
21
|
+
progress,
|
|
22
|
+
simFunction,
|
|
23
|
+
times: simLambdaDynamoDbStreamRecordTimes,
|
|
24
|
+
deliver: async (records) => await delivery.to(simFunction, records),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -9,4 +9,4 @@ import type { SimLambdaEventSourceMapping } from "../sim-lambda-event-source-map
|
|
|
9
9
|
* delivers to. A function that has gone, and a qualifier that names nothing,
|
|
10
10
|
* both answer with nothing, and the poll then does nothing.
|
|
11
11
|
*/
|
|
12
|
-
export declare function simLambdaEventSourceFunction(functions: SimLambdaFunctionLookup, mapping: SimLambdaEventSourceMapping): SimLambdaFunction | undefined;
|
|
12
|
+
export declare function simLambdaEventSourceFunction(functions: SimLambdaFunctionLookup, mapping: SimLambdaEventSourceMapping, stopped?: boolean): SimLambdaFunction | undefined;
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* delivers to. A function that has gone, and a qualifier that names nothing,
|
|
7
7
|
* both answer with nothing, and the poll then does nothing.
|
|
8
8
|
*/
|
|
9
|
-
export function simLambdaEventSourceFunction(functions, mapping) {
|
|
9
|
+
export function simLambdaEventSourceFunction(functions, mapping, stopped = false) {
|
|
10
|
+
if (stopped || !mapping.isPolling)
|
|
11
|
+
return undefined;
|
|
10
12
|
return functions.findTarget(mapping.functionName, mapping.qualifier)
|
|
11
13
|
?.simFunction;
|
|
12
14
|
}
|