-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell Webapps on AWS Lambda -- -- -- Turn any wai webapp ( spock, servant, etc) into a -- handler for AWS Lambda and API Gateway requests. -- -- Works with any Lambda environment (nodejs, python, etc). Find out more -- in the README. @package wai-lambda @version 0.1.0.0 module Network.Wai.Handler.Lambda type RawResponse = (Status, ResponseHeaders, ByteString) data Settings Settings :: Int -> (ByteString -> IO RawResponse) -> (ByteString -> SomeException -> IO RawResponse) -> Settings [timeoutValue] :: Settings -> Int [handleTimeout] :: Settings -> ByteString -> IO RawResponse [handleException] :: Settings -> ByteString -> SomeException -> IO RawResponse -- | Run an Application. -- -- Continuously reads requests from stdin. Each line should be a -- a JSON document as described in decodeInput. -- -- All requests will be timed out after 2 seconds. If any exception is -- thrown while processing the request this will return an HTTP 500 -- Internal Server Error. -- -- If you need more control use handleRequest directly. run :: Application -> IO () runSettings :: Settings -> Application -> IO () setTimeoutSeconds :: Int -> Settings -> Settings setHandleException :: (ByteString -> SomeException -> IO RawResponse) -> Settings -> Settings setHandleTimeout :: (ByteString -> IO RawResponse) -> Settings -> Settings defaultSettings :: Settings defaultHandleException :: ByteString -> SomeException -> IO RawResponse -- | Default request timeout. 2 seconds. defaultTimeoutValue :: Int defaultHandleTimeout :: ByteString -> IO RawResponse -- | Parse and handle the request. -- -- handleRequest :: Settings -> Application -> ByteString -> IO () -- | Run the Request through the Application. -- -- This function is completely dependent on the 'Application. Any -- exception thrown by the Application will be rethrown here. No -- timeout is implemented: if the Application never provides a -- Response then processRequest won't return. processRequest :: Application -> Request -> IO Response -- | Decode a ByteString into (1) a Wai Request and (2) a -- filepath where the response should be written. The argument is JSON -- document with two fields: * request: the API Gateway request -- (see parseRequest) * reqsponseFile: Where to write the -- API Gateway response (see toJSONResponse) decodeInput :: ByteString -> Either (JSONPath, String) (FilePath, IO Request) -- | Parser for a Request. -- -- The input is an AWS API Gateway request event: -- https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-api-gateway-request parseRequest :: Value -> Parser (IO Request) originalRequestKey :: Key Object -- | Read the status, headers and body of a Response. readResponse :: Response -> IO RawResponse -- | Make an API Gateway response from status, headers and body. -- https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-api-gateway-response toJSONResponse :: Status -> ResponseHeaders -> ByteString -> Object -- | Atomically write the ByteString to the file. -- -- Uses rename(2). writeFileAtomic :: FilePath -> ByteString -> IO () -- |
--   flip fix
--   
xif :: b -> ((b -> c) -> b -> c) -> c uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d module Lambda -- | Run an Application. -- -- Continuously reads requests from stdin. Each line should be a -- a JSON document as described in decodeInput. -- -- All requests will be timed out after 2 seconds. If any exception is -- thrown while processing the request this will return an HTTP 500 -- Internal Server Error. -- -- If you need more control use handleRequest directly. run :: Application -> IO () -- | Parse and handle the request. -- -- handleRequest :: Settings -> Application -> ByteString -> IO ()