{-# 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.PublishVersion
(
PublishVersion (..),
newPublishVersion,
publishVersion_codeSha256,
publishVersion_description,
publishVersion_revisionId,
publishVersion_functionName,
FunctionConfiguration (..),
newFunctionConfiguration,
functionConfiguration_memorySize,
functionConfiguration_runtime,
functionConfiguration_state,
functionConfiguration_signingProfileVersionArn,
functionConfiguration_lastUpdateStatus,
functionConfiguration_functionArn,
functionConfiguration_kmsKeyArn,
functionConfiguration_packageType,
functionConfiguration_fileSystemConfigs,
functionConfiguration_environment,
functionConfiguration_deadLetterConfig,
functionConfiguration_architectures,
functionConfiguration_signingJobArn,
functionConfiguration_role,
functionConfiguration_vpcConfig,
functionConfiguration_version,
functionConfiguration_functionName,
functionConfiguration_layers,
functionConfiguration_codeSize,
functionConfiguration_handler,
functionConfiguration_timeout,
functionConfiguration_lastUpdateStatusReason,
functionConfiguration_stateReason,
functionConfiguration_lastModified,
functionConfiguration_codeSha256,
functionConfiguration_tracingConfig,
functionConfiguration_stateReasonCode,
functionConfiguration_imageConfigResponse,
functionConfiguration_description,
functionConfiguration_lastUpdateStatusReasonCode,
functionConfiguration_revisionId,
functionConfiguration_masterArn,
)
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 PublishVersion = PublishVersion'
{
PublishVersion -> Maybe Text
codeSha256 :: Prelude.Maybe Prelude.Text,
PublishVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
PublishVersion -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
PublishVersion -> Text
functionName :: Prelude.Text
}
deriving (PublishVersion -> PublishVersion -> Bool
(PublishVersion -> PublishVersion -> Bool)
-> (PublishVersion -> PublishVersion -> Bool) -> Eq PublishVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublishVersion -> PublishVersion -> Bool
$c/= :: PublishVersion -> PublishVersion -> Bool
== :: PublishVersion -> PublishVersion -> Bool
$c== :: PublishVersion -> PublishVersion -> Bool
Prelude.Eq, ReadPrec [PublishVersion]
ReadPrec PublishVersion
Int -> ReadS PublishVersion
ReadS [PublishVersion]
(Int -> ReadS PublishVersion)
-> ReadS [PublishVersion]
-> ReadPrec PublishVersion
-> ReadPrec [PublishVersion]
-> Read PublishVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublishVersion]
$creadListPrec :: ReadPrec [PublishVersion]
readPrec :: ReadPrec PublishVersion
$creadPrec :: ReadPrec PublishVersion
readList :: ReadS [PublishVersion]
$creadList :: ReadS [PublishVersion]
readsPrec :: Int -> ReadS PublishVersion
$creadsPrec :: Int -> ReadS PublishVersion
Prelude.Read, Int -> PublishVersion -> ShowS
[PublishVersion] -> ShowS
PublishVersion -> String
(Int -> PublishVersion -> ShowS)
-> (PublishVersion -> String)
-> ([PublishVersion] -> ShowS)
-> Show PublishVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublishVersion] -> ShowS
$cshowList :: [PublishVersion] -> ShowS
show :: PublishVersion -> String
$cshow :: PublishVersion -> String
showsPrec :: Int -> PublishVersion -> ShowS
$cshowsPrec :: Int -> PublishVersion -> ShowS
Prelude.Show, (forall x. PublishVersion -> Rep PublishVersion x)
-> (forall x. Rep PublishVersion x -> PublishVersion)
-> Generic PublishVersion
forall x. Rep PublishVersion x -> PublishVersion
forall x. PublishVersion -> Rep PublishVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublishVersion x -> PublishVersion
$cfrom :: forall x. PublishVersion -> Rep PublishVersion x
Prelude.Generic)
newPublishVersion ::
Prelude.Text ->
PublishVersion
newPublishVersion :: Text -> PublishVersion
newPublishVersion Text
pFunctionName_ =
PublishVersion' :: Maybe Text -> Maybe Text -> Maybe Text -> Text -> PublishVersion
PublishVersion'
{ $sel:codeSha256:PublishVersion' :: Maybe Text
codeSha256 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:PublishVersion' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:revisionId:PublishVersion' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:functionName:PublishVersion' :: Text
functionName = Text
pFunctionName_
}
publishVersion_codeSha256 :: Lens.Lens' PublishVersion (Prelude.Maybe Prelude.Text)
publishVersion_codeSha256 :: (Maybe Text -> f (Maybe Text))
-> PublishVersion -> f PublishVersion
publishVersion_codeSha256 = (PublishVersion -> Maybe Text)
-> (PublishVersion -> Maybe Text -> PublishVersion)
-> Lens PublishVersion PublishVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishVersion' {Maybe Text
codeSha256 :: Maybe Text
$sel:codeSha256:PublishVersion' :: PublishVersion -> Maybe Text
codeSha256} -> Maybe Text
codeSha256) (\s :: PublishVersion
s@PublishVersion' {} Maybe Text
a -> PublishVersion
s {$sel:codeSha256:PublishVersion' :: Maybe Text
codeSha256 = Maybe Text
a} :: PublishVersion)
publishVersion_description :: Lens.Lens' PublishVersion (Prelude.Maybe Prelude.Text)
publishVersion_description :: (Maybe Text -> f (Maybe Text))
-> PublishVersion -> f PublishVersion
publishVersion_description = (PublishVersion -> Maybe Text)
-> (PublishVersion -> Maybe Text -> PublishVersion)
-> Lens PublishVersion PublishVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishVersion' {Maybe Text
description :: Maybe Text
$sel:description:PublishVersion' :: PublishVersion -> Maybe Text
description} -> Maybe Text
description) (\s :: PublishVersion
s@PublishVersion' {} Maybe Text
a -> PublishVersion
s {$sel:description:PublishVersion' :: Maybe Text
description = Maybe Text
a} :: PublishVersion)
publishVersion_revisionId :: Lens.Lens' PublishVersion (Prelude.Maybe Prelude.Text)
publishVersion_revisionId :: (Maybe Text -> f (Maybe Text))
-> PublishVersion -> f PublishVersion
publishVersion_revisionId = (PublishVersion -> Maybe Text)
-> (PublishVersion -> Maybe Text -> PublishVersion)
-> Lens PublishVersion PublishVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishVersion' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:PublishVersion' :: PublishVersion -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: PublishVersion
s@PublishVersion' {} Maybe Text
a -> PublishVersion
s {$sel:revisionId:PublishVersion' :: Maybe Text
revisionId = Maybe Text
a} :: PublishVersion)
publishVersion_functionName :: Lens.Lens' PublishVersion Prelude.Text
publishVersion_functionName :: (Text -> f Text) -> PublishVersion -> f PublishVersion
publishVersion_functionName = (PublishVersion -> Text)
-> (PublishVersion -> Text -> PublishVersion)
-> Lens PublishVersion PublishVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishVersion' {Text
functionName :: Text
$sel:functionName:PublishVersion' :: PublishVersion -> Text
functionName} -> Text
functionName) (\s :: PublishVersion
s@PublishVersion' {} Text
a -> PublishVersion
s {$sel:functionName:PublishVersion' :: Text
functionName = Text
a} :: PublishVersion)
instance Core.AWSRequest PublishVersion where
type
AWSResponse PublishVersion =
FunctionConfiguration
request :: PublishVersion -> Request PublishVersion
request = Service -> PublishVersion -> Request PublishVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PublishVersion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PublishVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PublishVersion))
-> Logger
-> Service
-> Proxy PublishVersion
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PublishVersion)))
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 -> Object -> Either String FunctionConfiguration
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable PublishVersion
instance Prelude.NFData PublishVersion
instance Core.ToHeaders PublishVersion where
toHeaders :: PublishVersion -> ResponseHeaders
toHeaders = ResponseHeaders -> PublishVersion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON PublishVersion where
toJSON :: PublishVersion -> Value
toJSON PublishVersion' {Maybe Text
Text
functionName :: Text
revisionId :: Maybe Text
description :: Maybe Text
codeSha256 :: Maybe Text
$sel:functionName:PublishVersion' :: PublishVersion -> Text
$sel:revisionId:PublishVersion' :: PublishVersion -> Maybe Text
$sel:description:PublishVersion' :: PublishVersion -> Maybe Text
$sel:codeSha256:PublishVersion' :: PublishVersion -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CodeSha256" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
codeSha256,
(Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Text
"RevisionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
revisionId
]
)
instance Core.ToPath PublishVersion where
toPath :: PublishVersion -> ByteString
toPath PublishVersion' {Maybe Text
Text
functionName :: Text
revisionId :: Maybe Text
description :: Maybe Text
codeSha256 :: Maybe Text
$sel:functionName:PublishVersion' :: PublishVersion -> Text
$sel:revisionId:PublishVersion' :: PublishVersion -> Maybe Text
$sel:description:PublishVersion' :: PublishVersion -> Maybe Text
$sel:codeSha256:PublishVersion' :: PublishVersion -> 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,
ByteString
"/versions"
]
instance Core.ToQuery PublishVersion where
toQuery :: PublishVersion -> QueryString
toQuery = QueryString -> PublishVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty