-
Notifications
You must be signed in to change notification settings - Fork 420
feat(data-classes): AppSync Lambda authorizer event #610
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
feat(data-classes): AppSync Lambda authorizer event #610
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #610 +/- ##
========================================
Coverage 99.95% 99.95%
========================================
Files 113 114 +1
Lines 4535 4579 +44
Branches 246 249 +3
========================================
+ Hits 4533 4577 +44
Partials 2 2
Continue to review full report at Codecov.
|
@heitorlessa - i am not sure if fluent apis is a thing in Python? Maybe just optionals? |
How does this tie in with app.resolve(event, context) |
@gwlester - this applies to AppSync only. API gateway use case would be based on how this is implemented. |
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.
Looks good! Some minor changes. Should we have a method to ease adding a fully qualified field name?
Because we're mimicking the data classes, I think we can set some good defaults, correct the constructor, and simply get rid of self._data
.
If we do add a method to add a fully qualified field, we can make a nice experience in the AppSync Handler since we would know both API ID and Region to construct the ARN while also making it standalone ;)
def __init__(
self,
authorize: bool = False,
max_age: int = 300,
resolver_context: Optional[Dict[str, Any]] = None,
deny_fields: Optional[List[str]] = None,
):
self.authorize = authorize
self.max_age = max_age
self.resolver_context = resolver_context or {}
self.deny_fields = deny_fields or []
def to_dict(self) -> dict:
"""Return the response as dict"""
return {
"isAuthorized": self.authorize,
"resolverContext": json.dumps(self.resolver_context),
"ttlOverride": self.max_age,
"deniedFields": self.deny_fields
}
Issue #, if available:
Description of changes:
Change:
APPSYNC_AUTHORIZER
Example usage:
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.