-
Notifications
You must be signed in to change notification settings - Fork 118
WIP: Mock API Gateway response #138
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
Conversation
|
Can one of the admins verify this patch? |
3 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
I missed #83 which defines |
# Conflicts: # Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift
| public protocol LocalLambdaInvocationProxy { | ||
| init(eventLoop: EventLoop) | ||
|
|
||
| // TODO: in most (all?) cases we do not need async interface | ||
|
|
||
| /// throws `LocalLambda.InvocationError` if request is invalid | ||
| func invocation(from request: LocalLambda.HTTPRequest) -> EventLoopFuture<ByteBuffer> | ||
| func processResult(_ result: ByteBuffer?) -> EventLoopFuture<LocalLambda.HTTPResponse> | ||
| func processError(_ error: ByteBuffer?) -> EventLoopFuture<LocalLambda.HTTPResponse> | ||
| } |
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.
I think in most cases there is no need for async calls.
In a typical scenario a HTTP request would be used to create new HTTP request with different payload.
Async interface would be useful in a fairly exotic scenario (as far as local testing/development is concerned); for example, if the LocalLambdaInvocationProxy was connecting with external server to set valid Authorization header.
| // TODO: do we need a circular buffer? there is only (up to) one request at a time | ||
| private var pending = CircularBuffer<(head: HTTPRequestHead, body: ByteBuffer?)>() |
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.
do we need a circular buffer? there is only (up to) one request at a time
|
@tomerd @fabianfett please let me know your thoughts on this, a few comments/questions inline (above) |
|
hi @parkera if you want to keep this around, could you please update this PR to be against the |
Motivation:
Allow user to configure
LocalLambda.Serverto create invocations:API Gateway)AppSyncevents) orAuthorizationheader/logic).Modifications:
This picks up and updates #83
LocalLambda.Serveropens two ports:ControlPlaneHandlerInvokeHandlerInvokeHandlerwhich created themLocalLambdaInvocationProxy, defaults toInvokeProxy(current behavior)the main difference from #83 is
bootstrapand separation ofProxyTypefromServerState;ServerStateprovides API to queue new invocations and promises to fulfill them but it has no interest how they were created and what is going to happen with the resultResult:
Allows to setup
LocalLambdaproviding custom implementation ofLocalLambdaInvocationProxy,InvokeProxyby default.If the change is approved I can create
APIGatewayV2ProxyinAWSLambdaEventswhich could be used tobootstrapLocalLambda: