module Network.AWS.Lambda.UploadFunction
(
UploadFunction
, uploadFunction
, ufDescription
, ufFunctionName
, ufFunctionZip
, ufHandler
, ufMemorySize
, ufMode
, ufRole
, ufRuntime
, ufTimeout
, UploadFunctionResponse
, uploadFunctionResponse
, ufrCodeSize
, ufrConfigurationId
, ufrDescription
, ufrFunctionARN
, ufrFunctionName
, ufrHandler
, ufrLastModified
, ufrMemorySize
, ufrMode
, ufrRole
, ufrRuntime
, ufrTimeout
) where
import Network.AWS.Prelude
import Network.AWS.Request.RestJSON
import Network.AWS.Lambda.Types
import qualified GHC.Exts
data UploadFunction = UploadFunction
{ _ufDescription :: Maybe Text
, _ufFunctionName :: Text
, _ufFunctionZip :: Base64
, _ufHandler :: Text
, _ufMemorySize :: Maybe Nat
, _ufMode :: Mode
, _ufRole :: Text
, _ufRuntime :: Runtime
, _ufTimeout :: Maybe Nat
} deriving (Eq, Show)
uploadFunction :: Text
-> Base64
-> Runtime
-> Text
-> Text
-> Mode
-> UploadFunction
uploadFunction p1 p2 p3 p4 p5 p6 = UploadFunction
{ _ufFunctionName = p1
, _ufFunctionZip = p2
, _ufRuntime = p3
, _ufRole = p4
, _ufHandler = p5
, _ufMode = p6
, _ufDescription = Nothing
, _ufTimeout = Nothing
, _ufMemorySize = Nothing
}
ufDescription :: Lens' UploadFunction (Maybe Text)
ufDescription = lens _ufDescription (\s a -> s { _ufDescription = a })
ufFunctionName :: Lens' UploadFunction Text
ufFunctionName = lens _ufFunctionName (\s a -> s { _ufFunctionName = a })
ufFunctionZip :: Lens' UploadFunction Base64
ufFunctionZip = lens _ufFunctionZip (\s a -> s { _ufFunctionZip = a })
ufHandler :: Lens' UploadFunction Text
ufHandler = lens _ufHandler (\s a -> s { _ufHandler = a })
ufMemorySize :: Lens' UploadFunction (Maybe Natural)
ufMemorySize = lens _ufMemorySize (\s a -> s { _ufMemorySize = a }) . mapping _Nat
ufMode :: Lens' UploadFunction Mode
ufMode = lens _ufMode (\s a -> s { _ufMode = a })
ufRole :: Lens' UploadFunction Text
ufRole = lens _ufRole (\s a -> s { _ufRole = a })
ufRuntime :: Lens' UploadFunction Runtime
ufRuntime = lens _ufRuntime (\s a -> s { _ufRuntime = a })
ufTimeout :: Lens' UploadFunction (Maybe Natural)
ufTimeout = lens _ufTimeout (\s a -> s { _ufTimeout = a }) . mapping _Nat
data UploadFunctionResponse = UploadFunctionResponse
{ _ufrCodeSize :: Maybe Integer
, _ufrConfigurationId :: Maybe Text
, _ufrDescription :: Maybe Text
, _ufrFunctionARN :: Maybe Text
, _ufrFunctionName :: Maybe Text
, _ufrHandler :: Maybe Text
, _ufrLastModified :: Maybe POSIX
, _ufrMemorySize :: Maybe Nat
, _ufrMode :: Maybe Mode
, _ufrRole :: Maybe Text
, _ufrRuntime :: Maybe Runtime
, _ufrTimeout :: Maybe Nat
} deriving (Eq, Show)
uploadFunctionResponse :: UploadFunctionResponse
uploadFunctionResponse = UploadFunctionResponse
{ _ufrFunctionName = Nothing
, _ufrFunctionARN = Nothing
, _ufrConfigurationId = Nothing
, _ufrRuntime = Nothing
, _ufrRole = Nothing
, _ufrHandler = Nothing
, _ufrMode = Nothing
, _ufrCodeSize = Nothing
, _ufrDescription = Nothing
, _ufrTimeout = Nothing
, _ufrMemorySize = Nothing
, _ufrLastModified = Nothing
}
ufrCodeSize :: Lens' UploadFunctionResponse (Maybe Integer)
ufrCodeSize = lens _ufrCodeSize (\s a -> s { _ufrCodeSize = a })
ufrConfigurationId :: Lens' UploadFunctionResponse (Maybe Text)
ufrConfigurationId =
lens _ufrConfigurationId (\s a -> s { _ufrConfigurationId = a })
ufrDescription :: Lens' UploadFunctionResponse (Maybe Text)
ufrDescription = lens _ufrDescription (\s a -> s { _ufrDescription = a })
ufrFunctionARN :: Lens' UploadFunctionResponse (Maybe Text)
ufrFunctionARN = lens _ufrFunctionARN (\s a -> s { _ufrFunctionARN = a })
ufrFunctionName :: Lens' UploadFunctionResponse (Maybe Text)
ufrFunctionName = lens _ufrFunctionName (\s a -> s { _ufrFunctionName = a })
ufrHandler :: Lens' UploadFunctionResponse (Maybe Text)
ufrHandler = lens _ufrHandler (\s a -> s { _ufrHandler = a })
ufrLastModified :: Lens' UploadFunctionResponse (Maybe UTCTime)
ufrLastModified = lens _ufrLastModified (\s a -> s { _ufrLastModified = a }) . mapping _Time
ufrMemorySize :: Lens' UploadFunctionResponse (Maybe Natural)
ufrMemorySize = lens _ufrMemorySize (\s a -> s { _ufrMemorySize = a }) . mapping _Nat
ufrMode :: Lens' UploadFunctionResponse (Maybe Mode)
ufrMode = lens _ufrMode (\s a -> s { _ufrMode = a })
ufrRole :: Lens' UploadFunctionResponse (Maybe Text)
ufrRole = lens _ufrRole (\s a -> s { _ufrRole = a })
ufrRuntime :: Lens' UploadFunctionResponse (Maybe Runtime)
ufrRuntime = lens _ufrRuntime (\s a -> s { _ufrRuntime = a })
ufrTimeout :: Lens' UploadFunctionResponse (Maybe Natural)
ufrTimeout = lens _ufrTimeout (\s a -> s { _ufrTimeout = a }) . mapping _Nat
instance ToPath UploadFunction where
toPath UploadFunction{..} = mconcat
[ "/2014-11-13/functions/"
, toText _ufFunctionName
]
instance ToQuery UploadFunction where
toQuery UploadFunction{..} = mconcat
[ "Runtime" =? _ufRuntime
, "Role" =? _ufRole
, "Handler" =? _ufHandler
, "Mode" =? _ufMode
, "Description" =? _ufDescription
, "Timeout" =? _ufTimeout
, "MemorySize" =? _ufMemorySize
]
instance ToHeaders UploadFunction
instance ToJSON UploadFunction where
toJSON UploadFunction{..} = object
[ "FunctionZip" .= _ufFunctionZip
]
instance AWSRequest UploadFunction where
type Sv UploadFunction = Lambda
type Rs UploadFunction = UploadFunctionResponse
request = put
response = jsonResponse
instance FromJSON UploadFunctionResponse where
parseJSON = withObject "UploadFunctionResponse" $ \o -> UploadFunctionResponse
<$> o .:? "CodeSize"
<*> o .:? "ConfigurationId"
<*> o .:? "Description"
<*> o .:? "FunctionARN"
<*> o .:? "FunctionName"
<*> o .:? "Handler"
<*> o .:? "LastModified"
<*> o .:? "MemorySize"
<*> o .:? "Mode"
<*> o .:? "Role"
<*> o .:? "Runtime"
<*> o .:? "Timeout"