-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DestinationConfig in streaming event sources (#2215)
- Loading branch information
Showing
13 changed files
with
287 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
tests/translator/input/error_function_with_invalid_stream_eventsource_dest_type.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Transform: AWS::Serverless-2016-10-31 | ||
|
||
Parameters: | ||
MyBatchingWindowParam: | ||
Type: Number | ||
Default: 45 | ||
Description: parameter for batching window in seconds | ||
|
||
Resources: | ||
MyFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
InlineCode: | | ||
exports.handler = async (event) => { | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(event), | ||
headers: {} | ||
} | ||
} | ||
Runtime: nodejs12.x | ||
Policies: | ||
- SQSSendMessagePolicy: | ||
QueueName: !GetAtt MySqsQueue.QueueName | ||
Events: | ||
StreamEvent: | ||
Type: Kinesis | ||
Properties: | ||
Stream: !GetAtt KinesisStream.Arn | ||
MaximumBatchingWindowInSeconds: !Ref MyBatchingWindowParam | ||
StartingPosition: LATEST | ||
DestinationConfig: | ||
OnFailure: | ||
Type: INVALID_VALID | ||
Destination: !Ref MySnsTopic | ||
|
||
KinesisStream: | ||
Type: AWS::Kinesis::Stream | ||
Properties: | ||
ShardCount: 1 | ||
|
||
MySnsTopic: | ||
Type: AWS::SNS::Topic |
45 changes: 45 additions & 0 deletions
45
...ator/input/error_function_with_missing_on_failure_in_stream_event_destination_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Transform: AWS::Serverless-2016-10-31 | ||
|
||
Parameters: | ||
MyBatchingWindowParam: | ||
Type: Number | ||
Default: 45 | ||
Description: parameter for batching window in seconds | ||
|
||
Resources: | ||
MyFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
InlineCode: | | ||
exports.handler = async (event) => { | ||
return { | ||
statusCode: 200, | ||
body: JSON.stringify(event), | ||
headers: {} | ||
} | ||
} | ||
Runtime: nodejs12.x | ||
Policies: | ||
- SQSSendMessagePolicy: | ||
QueueName: !GetAtt MySqsQueue.QueueName | ||
Events: | ||
StreamEvent: | ||
Type: Kinesis | ||
Properties: | ||
Stream: !GetAtt KinesisStream.Arn | ||
MaximumBatchingWindowInSeconds: !Ref MyBatchingWindowParam | ||
StartingPosition: LATEST | ||
DestinationConfig: | ||
InvalidConfig: | ||
Type: SNS | ||
Destination: !Ref MySnsTopic | ||
|
||
KinesisStream: | ||
Type: AWS::Kinesis::Stream | ||
Properties: | ||
ShardCount: 1 | ||
|
||
MySnsTopic: | ||
Type: AWS::SNS::Topic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tests/translator/output/aws-cn/error_function_with_invalid_stream_eventsource_dest_type.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"errorMessage": "Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. The only valid values for 'Type' are 'SQS' and 'SNS'" | ||
} | ||
], | ||
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. The only valid values for 'Type' are 'SQS' and 'SNS'" | ||
} |
8 changes: 8 additions & 0 deletions
8
...put/aws-cn/error_function_with_missing_on_failure_in_stream_event_destination_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"errorMessage": "Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. 'OnFailure' is a required field for 'DestinationConfig'" | ||
} | ||
], | ||
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. 'OnFailure' is a required field for 'DestinationConfig'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...ranslator/output/aws-us-gov/error_function_with_invalid_stream_eventsource_dest_type.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"errorMessage": "Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. The only valid values for 'Type' are 'SQS' and 'SNS'" | ||
} | ||
], | ||
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. The only valid values for 'Type' are 'SQS' and 'SNS'" | ||
} |
8 changes: 8 additions & 0 deletions
8
...aws-us-gov/error_function_with_missing_on_failure_in_stream_event_destination_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"errorMessage": "Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. 'OnFailure' is a required field for 'DestinationConfig'" | ||
} | ||
], | ||
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. 'OnFailure' is a required field for 'DestinationConfig'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tests/translator/output/error_function_with_invalid_stream_eventsource_dest_type.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"errorMessage": "Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. The only valid values for 'Type' are 'SQS' and 'SNS'" | ||
} | ||
], | ||
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. The only valid values for 'Type' are 'SQS' and 'SNS'" | ||
} |
8 changes: 8 additions & 0 deletions
8
...tor/output/error_function_with_missing_on_failure_in_stream_event_destination_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"errorMessage": "Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. 'OnFailure' is a required field for 'DestinationConfig'" | ||
} | ||
], | ||
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. Event with id [MyFunctionStreamEvent] is invalid. 'OnFailure' is a required field for 'DestinationConfig'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters