-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix DestinationConfig in streaming event sources #2215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs for
DestinationConfig
show thatOnFailure
is not a required field. I'm not sure why someone would createDestinationConfig
without its only possible field so I think the docs are incorrect. Either way, we should make the code and the docs consistent.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a discrepancy between doc and code. In addition to the one you mentioned above, the doc is also missing to show
Type
as required underOnFailure
. I'll request a doc update to address these inconsistencies.