module Network.AWS.Lambda.InvokeAsync
(
InvokeAsync
, invokeAsync
, iaFunctionName
, iaInvokeArgs
, InvokeAsyncResponse
, invokeAsyncResponse
, iarStatus
) where
import Network.AWS.Data (Object)
import Network.AWS.Prelude
import Network.AWS.Request.RestJSON
import Network.AWS.Lambda.Types
import qualified GHC.Exts
data InvokeAsync = InvokeAsync
{ _iaFunctionName :: Text
, _iaInvokeArgs :: RqBody
} deriving (Show)
invokeAsync :: Text
-> RqBody
-> InvokeAsync
invokeAsync p1 p2 = InvokeAsync
{ _iaFunctionName = p1
, _iaInvokeArgs = p2
}
iaFunctionName :: Lens' InvokeAsync Text
iaFunctionName = lens _iaFunctionName (\s a -> s { _iaFunctionName = a })
iaInvokeArgs :: Lens' InvokeAsync RqBody
iaInvokeArgs = lens _iaInvokeArgs (\s a -> s { _iaInvokeArgs = a })
newtype InvokeAsyncResponse = InvokeAsyncResponse
{ _iarStatus :: Int
} deriving (Eq, Ord, Read, Show, Enum, Num, Integral, Real)
invokeAsyncResponse :: Int
-> InvokeAsyncResponse
invokeAsyncResponse p1 = InvokeAsyncResponse
{ _iarStatus = p1
}
iarStatus :: Lens' InvokeAsyncResponse Int
iarStatus = lens _iarStatus (\s a -> s { _iarStatus = a })
instance ToPath InvokeAsync where
toPath InvokeAsync{..} = mconcat
[ "/2014-11-13/functions/"
, toText _iaFunctionName
, "/invoke-async/"
]
instance ToQuery InvokeAsync where
toQuery = const mempty
instance ToHeaders InvokeAsync
instance ToBody InvokeAsync where
toBody = toBody . _iaInvokeArgs
instance AWSRequest InvokeAsync where
type Sv InvokeAsync = Lambda
type Rs InvokeAsync = InvokeAsyncResponse
request = stream POST
response = jsonResponse
instance FromJSON InvokeAsyncResponse where
parseJSON = withObject "InvokeAsyncResponse" $ \o -> InvokeAsyncResponse
<$> o .: "Status"