Skip to content

Conversation

leandrodamascena
Copy link
Contributor

@leandrodamascena leandrodamascena commented Aug 14, 2022

Issue number: #1367

Summary

Changes

Changes snippet fictitious names to real code snippet filenames for easier discovery and collaboration to improve/correct document snippets.

Some examples have also been refactored so that the codes are complete and there are no lint/pre-commit hooks issues.

User experience

Before:
image
image

After:
image
image

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.


View rendered docs/utilities/middleware_factory.md

@leandrodamascena leandrodamascena requested a review from a team as a code owner August 14, 2022 18:05
@leandrodamascena leandrodamascena requested review from am29d and removed request for a team August 14, 2022 18:05
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Aug 14, 2022
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 14, 2022
@heitorlessa heitorlessa self-assigned this Aug 17, 2022
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good too! Navigation needs fixing and made a suggestion to raise the bar by including a new section Combining Powertools utilities.

This should address a common question on how to best handle decorator stacking or create their own middleware with common Powertools utilities baked in

@heitorlessa heitorlessa linked an issue Aug 19, 2022 that may be closed by this pull request
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 20, 2022
@leandrodamascena
Copy link
Contributor Author

Hi @heitorlessa and @rubenfonseca.. Could you please review the example?

I think it covers a lot of features/utilities provided by Lambda Powertools and it is a real case for many customers.

Thank you 😄

- dynamodb:PutItem
Resource: !GetAtt HistoryTable.Arn
- Effect: Allow
Action: # https://docs.aws.amazon.com/appconfig/latest/userguide/getting-started-with-appconfig-permissions.html
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I'm comfortable with this, but from what I can see it's a real example in an official AWS documentation.


# this is just an example
# change this values according your deployment strategy
BasicDeploymentStrategy:
Copy link
Contributor Author

@leandrodamascena leandrodamascena Aug 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the deployment strategy to avoid the default baking time.. The default time (10 minutes) is too long to someone that wants to test this template.

def middleware_custom(handler: Callable, event: dict, context: LambdaContext):

# validating the INPUT with the given schema
# X-Customer-Id header must be informed in all requests
Copy link
Contributor Author

@leandrodamascena leandrodamascena Aug 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early return? I think I need other opinions here.

Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job Leandro! Left some comments :)

Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@heitorlessa heitorlessa merged commit 75d2ff9 into aws-powertools:develop Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Middleware factory docs code snippets
3 participants