packages feed

hal 0.2.0 → 0.2.2

raw patch · 4 files changed

+13/−65 lines, 4 filesdep ~aesondep ~bytestringdep ~containersPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson, bytestring, containers, envy, exceptions, http-conduit, http-types, mtl, text, time

API changes (from Hackage documentation)

- AWS.Lambda.Events.S3.PutEvent: Record :: Text -> Text -> RequestParameters -> Record
- AWS.Lambda.Events.S3.PutEvent: RequestParameters :: Text -> RequestParameters
- AWS.Lambda.Events.S3.PutEvent: [eventTime] :: Record -> Text
- AWS.Lambda.Events.S3.PutEvent: [eventVersion] :: Record -> Text
- AWS.Lambda.Events.S3.PutEvent: [requestParameters] :: Record -> RequestParameters
- AWS.Lambda.Events.S3.PutEvent: [sourceIPAddress] :: RequestParameters -> Text
- AWS.Lambda.Events.S3.PutEvent: data Record
- AWS.Lambda.Events.S3.PutEvent: data RequestParameters
- AWS.Lambda.Events.S3.PutEvent: instance GHC.Classes.Eq AWS.Lambda.Events.S3.PutEvent.RequestParameters
- AWS.Lambda.Events.S3.PutEvent: instance GHC.Generics.Generic AWS.Lambda.Events.S3.PutEvent.RequestParameters
- AWS.Lambda.Events.S3.PutEvent: instance GHC.Show.Show AWS.Lambda.Events.S3.PutEvent.RequestParameters
- AWS.Lambda.Events.S3.PutEvent: type PutEvent = [Record]

Files

README.md view
@@ -1,5 +1,3 @@-[![Build Status](https://travis-ci.org/Nike-Inc/hal.svg?branch=master)](https://travis-ci.org/Nike-Inc/hal)- # hal  A runtime environment for [Haskell] applications running on [AWS Lambda].
hal.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: c9fc7c14f698aaa49f0ba921b13814ab0b22cee9b7c41ba645725672ac7a0382+-- hash: 6c1e9ef789f342358ee8b7ee790929f61a3d1ba6fb3c9f5bc0498f2ceee3676b  name:           hal-version:        0.2.0+version:        0.2.2 synopsis:       A runtime environment for Haskell applications running on AWS Lambda. description:    This library uniquely supports different types of AWS Lambda Handlers for your                 needs/comfort with advanced Haskell. Instead of exposing a single function@@ -32,7 +32,6 @@   exposed-modules:       AWS.Lambda.Combinators       AWS.Lambda.Context-      AWS.Lambda.Events.S3.PutEvent       AWS.Lambda.Internal       AWS.Lambda.Runtime       AWS.Lambda.RuntimeClient
− src/AWS/Lambda/Events/S3/PutEvent.hs
@@ -1,56 +0,0 @@-module AWS.Lambda.Events.S3.PutEvent (-  PutEvent,-  RequestParameters(..),-  Record(..)-) where--import Data.Text (Text)-import GHC.Generics (Generic)-import Data.Aeson (FromJSON)--type PutEvent = [Record]--data RequestParameters = RequestParameters { sourceIPAddress :: Text } deriving (Show, Eq, Generic)--data Record = Record {-  eventVersion :: Text,-  eventTime :: Text, -- Should be date-  requestParameters :: RequestParameters-}--{--{-  "eventVersion": "2.0",-  "eventTime": "1970-01-01T00:00:00.000Z",-  "requestParameters": {-    "sourceIPAddress": "127.0.0.1"-  },-  "s3": {-    "configurationId": "testConfigRule",-    "object": {-      "eTag": "0123456789abcdef0123456789abcdef",-      "sequencer": "0A1B2C3D4E5F678901",-      "key": "HappyFace.jpg",-      "size": 1024-    },-    "bucket": {-      "arn": bucketarn,-      "name": "sourcebucket",-      "ownerIdentity": {-        "principalId": "EXAMPLE"-      }-    },-    "s3SchemaVersion": "1.0"-  },-  "responseElements": {-    "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH",-    "x-amz-request-id": "EXAMPLE123456789"-  },-  "awsRegion": "us-east-1",-  "eventName": "ObjectCreated:Put",-  "userIdentity": {-    "principalId": "EXAMPLE"-  },-  "eventSource": "aws:s3"-}--}
src/AWS/Lambda/RuntimeClient.hs view
@@ -31,7 +31,7 @@                                             setRequestCheckStatus,                                             setRequestHeader, setRequestMethod,                                             setRequestPath)-import           Network.HTTP.Types.Status (status413, statusIsSuccessful)+import           Network.HTTP.Types.Status (status403, status413, statusIsSuccessful) import           System.Environment        (getEnv)  -- | Lambda runtime error that we pass back to AWS@@ -110,9 +110,16 @@ runtimeClientRetryTry' 1 f = try f runtimeClientRetryTry' i f = do   resOrEx <- try f+  let retry = threadDelay 500 >> runtimeClientRetryTry' (i - 1) f   case resOrEx of-    Left (_ :: HttpException) -> threadDelay 500 >> runtimeClientRetryTry' (i - 1) f-    Right res -> return $ Right res+    Left (_ :: HttpException) -> retry+    Right res ->+      -- TODO: Explore this further.+      -- Before ~July 22nd 2020 it seemed that if a next event request reached+      -- the runtime before a new event was available that there would be a+      -- network error.  After it appears that a 403 is returned.+      if getResponseStatus res == status403 then retry+      else return $ Right res  runtimeClientRetryTry :: IO (Response a) -> IO (Either HttpException (Response a)) runtimeClientRetryTry = runtimeClientRetryTry' 3