Skip to content
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

Fix DestinationConfig in streaming event sources #2215

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

hawflau
Copy link
Contributor

@hawflau hawflau commented Nov 8, 2021

Issue #, if available:

Description of changes:
Fix DestinationConfig of streaming event sources by ensuring OnFailure is defined before it's used.
If OnFailure is missing, an error will be thrown.

Description of how you validated changes:

Checklist:

  • Add/update tests using:
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected

Examples?

Please reach out in the comments, if you want to add an example. Examples will be
added to sam init through https://github.com/awslabs/aws-sam-cli-app-templates/

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -110,6 +110,9 @@ def to_cloudformation(self, **kwargs):

destination_config_policy = None
if self.DestinationConfig:
if self.DestinationConfig.get("OnFailure") is None:
raise InvalidEventException(self.logical_id, "'OnFailure' is a required field for 'DestinationConfig'")
Copy link
Contributor

@marekaiv marekaiv Nov 9, 2021

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 that OnFailure is not a required field. I'm not sure why someone would create DestinationConfig without its only possible field so I think the docs are incorrect. Either way, we should make the code and the docs consistent.

Copy link
Contributor Author

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 under OnFailure. I'll request a doc update to address these inconsistencies.

@hawflau hawflau merged commit 1174f0f into aws:develop Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants