{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Lambda.GetFunction
(
GetFunction (..),
newGetFunction,
getFunction_qualifier,
getFunction_functionName,
GetFunctionResponse (..),
newGetFunctionResponse,
getFunctionResponse_concurrency,
getFunctionResponse_code,
getFunctionResponse_configuration,
getFunctionResponse_tags,
getFunctionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetFunction = GetFunction'
{
GetFunction -> Maybe Text
qualifier :: Prelude.Maybe Prelude.Text,
GetFunction -> Text
functionName :: Prelude.Text
}
deriving (GetFunction -> GetFunction -> Bool
(GetFunction -> GetFunction -> Bool)
-> (GetFunction -> GetFunction -> Bool) -> Eq GetFunction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFunction -> GetFunction -> Bool
$c/= :: GetFunction -> GetFunction -> Bool
== :: GetFunction -> GetFunction -> Bool
$c== :: GetFunction -> GetFunction -> Bool
Prelude.Eq, ReadPrec [GetFunction]
ReadPrec GetFunction
Int -> ReadS GetFunction
ReadS [GetFunction]
(Int -> ReadS GetFunction)
-> ReadS [GetFunction]
-> ReadPrec GetFunction
-> ReadPrec [GetFunction]
-> Read GetFunction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFunction]
$creadListPrec :: ReadPrec [GetFunction]
readPrec :: ReadPrec GetFunction
$creadPrec :: ReadPrec GetFunction
readList :: ReadS [GetFunction]
$creadList :: ReadS [GetFunction]
readsPrec :: Int -> ReadS GetFunction
$creadsPrec :: Int -> ReadS GetFunction
Prelude.Read, Int -> GetFunction -> ShowS
[GetFunction] -> ShowS
GetFunction -> String
(Int -> GetFunction -> ShowS)
-> (GetFunction -> String)
-> ([GetFunction] -> ShowS)
-> Show GetFunction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFunction] -> ShowS
$cshowList :: [GetFunction] -> ShowS
show :: GetFunction -> String
$cshow :: GetFunction -> String
showsPrec :: Int -> GetFunction -> ShowS
$cshowsPrec :: Int -> GetFunction -> ShowS
Prelude.Show, (forall x. GetFunction -> Rep GetFunction x)
-> (forall x. Rep GetFunction x -> GetFunction)
-> Generic GetFunction
forall x. Rep GetFunction x -> GetFunction
forall x. GetFunction -> Rep GetFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFunction x -> GetFunction
$cfrom :: forall x. GetFunction -> Rep GetFunction x
Prelude.Generic)
newGetFunction ::
Prelude.Text ->
GetFunction
newGetFunction :: Text -> GetFunction
newGetFunction Text
pFunctionName_ =
GetFunction' :: Maybe Text -> Text -> GetFunction
GetFunction'
{ $sel:qualifier:GetFunction' :: Maybe Text
qualifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:functionName:GetFunction' :: Text
functionName = Text
pFunctionName_
}
getFunction_qualifier :: Lens.Lens' GetFunction (Prelude.Maybe Prelude.Text)
getFunction_qualifier :: (Maybe Text -> f (Maybe Text)) -> GetFunction -> f GetFunction
getFunction_qualifier = (GetFunction -> Maybe Text)
-> (GetFunction -> Maybe Text -> GetFunction)
-> Lens GetFunction GetFunction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFunction' {Maybe Text
qualifier :: Maybe Text
$sel:qualifier:GetFunction' :: GetFunction -> Maybe Text
qualifier} -> Maybe Text
qualifier) (\s :: GetFunction
s@GetFunction' {} Maybe Text
a -> GetFunction
s {$sel:qualifier:GetFunction' :: Maybe Text
qualifier = Maybe Text
a} :: GetFunction)
getFunction_functionName :: Lens.Lens' GetFunction Prelude.Text
getFunction_functionName :: (Text -> f Text) -> GetFunction -> f GetFunction
getFunction_functionName = (GetFunction -> Text)
-> (GetFunction -> Text -> GetFunction)
-> Lens GetFunction GetFunction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFunction' {Text
functionName :: Text
$sel:functionName:GetFunction' :: GetFunction -> Text
functionName} -> Text
functionName) (\s :: GetFunction
s@GetFunction' {} Text
a -> GetFunction
s {$sel:functionName:GetFunction' :: Text
functionName = Text
a} :: GetFunction)
instance Core.AWSRequest GetFunction where
type AWSResponse GetFunction = GetFunctionResponse
request :: GetFunction -> Request GetFunction
request = Service -> GetFunction -> Request GetFunction
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFunction)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetFunction))
-> Logger
-> Service
-> Proxy GetFunction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFunction)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Concurrency
-> Maybe FunctionCodeLocation
-> Maybe FunctionConfiguration
-> Maybe (HashMap Text Text)
-> Int
-> GetFunctionResponse
GetFunctionResponse'
(Maybe Concurrency
-> Maybe FunctionCodeLocation
-> Maybe FunctionConfiguration
-> Maybe (HashMap Text Text)
-> Int
-> GetFunctionResponse)
-> Either String (Maybe Concurrency)
-> Either
String
(Maybe FunctionCodeLocation
-> Maybe FunctionConfiguration
-> Maybe (HashMap Text Text)
-> Int
-> GetFunctionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Concurrency)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Concurrency")
Either
String
(Maybe FunctionCodeLocation
-> Maybe FunctionConfiguration
-> Maybe (HashMap Text Text)
-> Int
-> GetFunctionResponse)
-> Either String (Maybe FunctionCodeLocation)
-> Either
String
(Maybe FunctionConfiguration
-> Maybe (HashMap Text Text) -> Int -> GetFunctionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe FunctionCodeLocation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Code")
Either
String
(Maybe FunctionConfiguration
-> Maybe (HashMap Text Text) -> Int -> GetFunctionResponse)
-> Either String (Maybe FunctionConfiguration)
-> Either
String (Maybe (HashMap Text Text) -> Int -> GetFunctionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe FunctionConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Configuration")
Either
String (Maybe (HashMap Text Text) -> Int -> GetFunctionResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> GetFunctionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Tags" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetFunctionResponse)
-> Either String Int -> Either String GetFunctionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetFunction
instance Prelude.NFData GetFunction
instance Core.ToHeaders GetFunction where
toHeaders :: GetFunction -> ResponseHeaders
toHeaders = ResponseHeaders -> GetFunction -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetFunction where
toPath :: GetFunction -> ByteString
toPath GetFunction' {Maybe Text
Text
functionName :: Text
qualifier :: Maybe Text
$sel:functionName:GetFunction' :: GetFunction -> Text
$sel:qualifier:GetFunction' :: GetFunction -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2015-03-31/functions/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
functionName]
instance Core.ToQuery GetFunction where
toQuery :: GetFunction -> QueryString
toQuery GetFunction' {Maybe Text
Text
functionName :: Text
qualifier :: Maybe Text
$sel:functionName:GetFunction' :: GetFunction -> Text
$sel:qualifier:GetFunction' :: GetFunction -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"Qualifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
qualifier]
data GetFunctionResponse = GetFunctionResponse'
{
GetFunctionResponse -> Maybe Concurrency
concurrency :: Prelude.Maybe Concurrency,
GetFunctionResponse -> Maybe FunctionCodeLocation
code :: Prelude.Maybe FunctionCodeLocation,
GetFunctionResponse -> Maybe FunctionConfiguration
configuration :: Prelude.Maybe FunctionConfiguration,
GetFunctionResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetFunctionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetFunctionResponse -> GetFunctionResponse -> Bool
(GetFunctionResponse -> GetFunctionResponse -> Bool)
-> (GetFunctionResponse -> GetFunctionResponse -> Bool)
-> Eq GetFunctionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFunctionResponse -> GetFunctionResponse -> Bool
$c/= :: GetFunctionResponse -> GetFunctionResponse -> Bool
== :: GetFunctionResponse -> GetFunctionResponse -> Bool
$c== :: GetFunctionResponse -> GetFunctionResponse -> Bool
Prelude.Eq, Int -> GetFunctionResponse -> ShowS
[GetFunctionResponse] -> ShowS
GetFunctionResponse -> String
(Int -> GetFunctionResponse -> ShowS)
-> (GetFunctionResponse -> String)
-> ([GetFunctionResponse] -> ShowS)
-> Show GetFunctionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFunctionResponse] -> ShowS
$cshowList :: [GetFunctionResponse] -> ShowS
show :: GetFunctionResponse -> String
$cshow :: GetFunctionResponse -> String
showsPrec :: Int -> GetFunctionResponse -> ShowS
$cshowsPrec :: Int -> GetFunctionResponse -> ShowS
Prelude.Show, (forall x. GetFunctionResponse -> Rep GetFunctionResponse x)
-> (forall x. Rep GetFunctionResponse x -> GetFunctionResponse)
-> Generic GetFunctionResponse
forall x. Rep GetFunctionResponse x -> GetFunctionResponse
forall x. GetFunctionResponse -> Rep GetFunctionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFunctionResponse x -> GetFunctionResponse
$cfrom :: forall x. GetFunctionResponse -> Rep GetFunctionResponse x
Prelude.Generic)
newGetFunctionResponse ::
Prelude.Int ->
GetFunctionResponse
newGetFunctionResponse :: Int -> GetFunctionResponse
newGetFunctionResponse Int
pHttpStatus_ =
GetFunctionResponse' :: Maybe Concurrency
-> Maybe FunctionCodeLocation
-> Maybe FunctionConfiguration
-> Maybe (HashMap Text Text)
-> Int
-> GetFunctionResponse
GetFunctionResponse'
{ $sel:concurrency:GetFunctionResponse' :: Maybe Concurrency
concurrency = Maybe Concurrency
forall a. Maybe a
Prelude.Nothing,
$sel:code:GetFunctionResponse' :: Maybe FunctionCodeLocation
code = Maybe FunctionCodeLocation
forall a. Maybe a
Prelude.Nothing,
$sel:configuration:GetFunctionResponse' :: Maybe FunctionConfiguration
configuration = Maybe FunctionConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:tags:GetFunctionResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetFunctionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getFunctionResponse_concurrency :: Lens.Lens' GetFunctionResponse (Prelude.Maybe Concurrency)
getFunctionResponse_concurrency :: (Maybe Concurrency -> f (Maybe Concurrency))
-> GetFunctionResponse -> f GetFunctionResponse
getFunctionResponse_concurrency = (GetFunctionResponse -> Maybe Concurrency)
-> (GetFunctionResponse
-> Maybe Concurrency -> GetFunctionResponse)
-> Lens
GetFunctionResponse
GetFunctionResponse
(Maybe Concurrency)
(Maybe Concurrency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFunctionResponse' {Maybe Concurrency
concurrency :: Maybe Concurrency
$sel:concurrency:GetFunctionResponse' :: GetFunctionResponse -> Maybe Concurrency
concurrency} -> Maybe Concurrency
concurrency) (\s :: GetFunctionResponse
s@GetFunctionResponse' {} Maybe Concurrency
a -> GetFunctionResponse
s {$sel:concurrency:GetFunctionResponse' :: Maybe Concurrency
concurrency = Maybe Concurrency
a} :: GetFunctionResponse)
getFunctionResponse_code :: Lens.Lens' GetFunctionResponse (Prelude.Maybe FunctionCodeLocation)
getFunctionResponse_code :: (Maybe FunctionCodeLocation -> f (Maybe FunctionCodeLocation))
-> GetFunctionResponse -> f GetFunctionResponse
getFunctionResponse_code = (GetFunctionResponse -> Maybe FunctionCodeLocation)
-> (GetFunctionResponse
-> Maybe FunctionCodeLocation -> GetFunctionResponse)
-> Lens
GetFunctionResponse
GetFunctionResponse
(Maybe FunctionCodeLocation)
(Maybe FunctionCodeLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFunctionResponse' {Maybe FunctionCodeLocation
code :: Maybe FunctionCodeLocation
$sel:code:GetFunctionResponse' :: GetFunctionResponse -> Maybe FunctionCodeLocation
code} -> Maybe FunctionCodeLocation
code) (\s :: GetFunctionResponse
s@GetFunctionResponse' {} Maybe FunctionCodeLocation
a -> GetFunctionResponse
s {$sel:code:GetFunctionResponse' :: Maybe FunctionCodeLocation
code = Maybe FunctionCodeLocation
a} :: GetFunctionResponse)
getFunctionResponse_configuration :: Lens.Lens' GetFunctionResponse (Prelude.Maybe FunctionConfiguration)
getFunctionResponse_configuration :: (Maybe FunctionConfiguration -> f (Maybe FunctionConfiguration))
-> GetFunctionResponse -> f GetFunctionResponse
getFunctionResponse_configuration = (GetFunctionResponse -> Maybe FunctionConfiguration)
-> (GetFunctionResponse
-> Maybe FunctionConfiguration -> GetFunctionResponse)
-> Lens
GetFunctionResponse
GetFunctionResponse
(Maybe FunctionConfiguration)
(Maybe FunctionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFunctionResponse' {Maybe FunctionConfiguration
configuration :: Maybe FunctionConfiguration
$sel:configuration:GetFunctionResponse' :: GetFunctionResponse -> Maybe FunctionConfiguration
configuration} -> Maybe FunctionConfiguration
configuration) (\s :: GetFunctionResponse
s@GetFunctionResponse' {} Maybe FunctionConfiguration
a -> GetFunctionResponse
s {$sel:configuration:GetFunctionResponse' :: Maybe FunctionConfiguration
configuration = Maybe FunctionConfiguration
a} :: GetFunctionResponse)
getFunctionResponse_tags :: Lens.Lens' GetFunctionResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getFunctionResponse_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetFunctionResponse -> f GetFunctionResponse
getFunctionResponse_tags = (GetFunctionResponse -> Maybe (HashMap Text Text))
-> (GetFunctionResponse
-> Maybe (HashMap Text Text) -> GetFunctionResponse)
-> Lens
GetFunctionResponse
GetFunctionResponse
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFunctionResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:GetFunctionResponse' :: GetFunctionResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: GetFunctionResponse
s@GetFunctionResponse' {} Maybe (HashMap Text Text)
a -> GetFunctionResponse
s {$sel:tags:GetFunctionResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: GetFunctionResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetFunctionResponse -> f GetFunctionResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetFunctionResponse
-> f GetFunctionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getFunctionResponse_httpStatus :: Lens.Lens' GetFunctionResponse Prelude.Int
getFunctionResponse_httpStatus :: (Int -> f Int) -> GetFunctionResponse -> f GetFunctionResponse
getFunctionResponse_httpStatus = (GetFunctionResponse -> Int)
-> (GetFunctionResponse -> Int -> GetFunctionResponse)
-> Lens GetFunctionResponse GetFunctionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFunctionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetFunctionResponse' :: GetFunctionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetFunctionResponse
s@GetFunctionResponse' {} Int
a -> GetFunctionResponse
s {$sel:httpStatus:GetFunctionResponse' :: Int
httpStatus = Int
a} :: GetFunctionResponse)
instance Prelude.NFData GetFunctionResponse