{-# 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.UpdateAlias
(
UpdateAlias (..),
newUpdateAlias,
updateAlias_routingConfig,
updateAlias_functionVersion,
updateAlias_description,
updateAlias_revisionId,
updateAlias_functionName,
updateAlias_name,
AliasConfiguration (..),
newAliasConfiguration,
aliasConfiguration_routingConfig,
aliasConfiguration_name,
aliasConfiguration_functionVersion,
aliasConfiguration_aliasArn,
aliasConfiguration_description,
aliasConfiguration_revisionId,
)
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 UpdateAlias = UpdateAlias'
{
UpdateAlias -> Maybe AliasRoutingConfiguration
routingConfig :: Prelude.Maybe AliasRoutingConfiguration,
UpdateAlias -> Maybe Text
functionVersion :: Prelude.Maybe Prelude.Text,
UpdateAlias -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateAlias -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
UpdateAlias -> Text
functionName :: Prelude.Text,
UpdateAlias -> Text
name :: Prelude.Text
}
deriving (UpdateAlias -> UpdateAlias -> Bool
(UpdateAlias -> UpdateAlias -> Bool)
-> (UpdateAlias -> UpdateAlias -> Bool) -> Eq UpdateAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAlias -> UpdateAlias -> Bool
$c/= :: UpdateAlias -> UpdateAlias -> Bool
== :: UpdateAlias -> UpdateAlias -> Bool
$c== :: UpdateAlias -> UpdateAlias -> Bool
Prelude.Eq, ReadPrec [UpdateAlias]
ReadPrec UpdateAlias
Int -> ReadS UpdateAlias
ReadS [UpdateAlias]
(Int -> ReadS UpdateAlias)
-> ReadS [UpdateAlias]
-> ReadPrec UpdateAlias
-> ReadPrec [UpdateAlias]
-> Read UpdateAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAlias]
$creadListPrec :: ReadPrec [UpdateAlias]
readPrec :: ReadPrec UpdateAlias
$creadPrec :: ReadPrec UpdateAlias
readList :: ReadS [UpdateAlias]
$creadList :: ReadS [UpdateAlias]
readsPrec :: Int -> ReadS UpdateAlias
$creadsPrec :: Int -> ReadS UpdateAlias
Prelude.Read, Int -> UpdateAlias -> ShowS
[UpdateAlias] -> ShowS
UpdateAlias -> String
(Int -> UpdateAlias -> ShowS)
-> (UpdateAlias -> String)
-> ([UpdateAlias] -> ShowS)
-> Show UpdateAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAlias] -> ShowS
$cshowList :: [UpdateAlias] -> ShowS
show :: UpdateAlias -> String
$cshow :: UpdateAlias -> String
showsPrec :: Int -> UpdateAlias -> ShowS
$cshowsPrec :: Int -> UpdateAlias -> ShowS
Prelude.Show, (forall x. UpdateAlias -> Rep UpdateAlias x)
-> (forall x. Rep UpdateAlias x -> UpdateAlias)
-> Generic UpdateAlias
forall x. Rep UpdateAlias x -> UpdateAlias
forall x. UpdateAlias -> Rep UpdateAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAlias x -> UpdateAlias
$cfrom :: forall x. UpdateAlias -> Rep UpdateAlias x
Prelude.Generic)
newUpdateAlias ::
Prelude.Text ->
Prelude.Text ->
UpdateAlias
newUpdateAlias :: Text -> Text -> UpdateAlias
newUpdateAlias Text
pFunctionName_ Text
pName_ =
UpdateAlias' :: Maybe AliasRoutingConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> UpdateAlias
UpdateAlias'
{ $sel:routingConfig:UpdateAlias' :: Maybe AliasRoutingConfiguration
routingConfig = Maybe AliasRoutingConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:functionVersion:UpdateAlias' :: Maybe Text
functionVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateAlias' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:revisionId:UpdateAlias' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:functionName:UpdateAlias' :: Text
functionName = Text
pFunctionName_,
$sel:name:UpdateAlias' :: Text
name = Text
pName_
}
updateAlias_routingConfig :: Lens.Lens' UpdateAlias (Prelude.Maybe AliasRoutingConfiguration)
updateAlias_routingConfig :: (Maybe AliasRoutingConfiguration
-> f (Maybe AliasRoutingConfiguration))
-> UpdateAlias -> f UpdateAlias
updateAlias_routingConfig = (UpdateAlias -> Maybe AliasRoutingConfiguration)
-> (UpdateAlias -> Maybe AliasRoutingConfiguration -> UpdateAlias)
-> Lens
UpdateAlias
UpdateAlias
(Maybe AliasRoutingConfiguration)
(Maybe AliasRoutingConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Maybe AliasRoutingConfiguration
routingConfig :: Maybe AliasRoutingConfiguration
$sel:routingConfig:UpdateAlias' :: UpdateAlias -> Maybe AliasRoutingConfiguration
routingConfig} -> Maybe AliasRoutingConfiguration
routingConfig) (\s :: UpdateAlias
s@UpdateAlias' {} Maybe AliasRoutingConfiguration
a -> UpdateAlias
s {$sel:routingConfig:UpdateAlias' :: Maybe AliasRoutingConfiguration
routingConfig = Maybe AliasRoutingConfiguration
a} :: UpdateAlias)
updateAlias_functionVersion :: Lens.Lens' UpdateAlias (Prelude.Maybe Prelude.Text)
updateAlias_functionVersion :: (Maybe Text -> f (Maybe Text)) -> UpdateAlias -> f UpdateAlias
updateAlias_functionVersion = (UpdateAlias -> Maybe Text)
-> (UpdateAlias -> Maybe Text -> UpdateAlias)
-> Lens UpdateAlias UpdateAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Maybe Text
functionVersion :: Maybe Text
$sel:functionVersion:UpdateAlias' :: UpdateAlias -> Maybe Text
functionVersion} -> Maybe Text
functionVersion) (\s :: UpdateAlias
s@UpdateAlias' {} Maybe Text
a -> UpdateAlias
s {$sel:functionVersion:UpdateAlias' :: Maybe Text
functionVersion = Maybe Text
a} :: UpdateAlias)
updateAlias_description :: Lens.Lens' UpdateAlias (Prelude.Maybe Prelude.Text)
updateAlias_description :: (Maybe Text -> f (Maybe Text)) -> UpdateAlias -> f UpdateAlias
updateAlias_description = (UpdateAlias -> Maybe Text)
-> (UpdateAlias -> Maybe Text -> UpdateAlias)
-> Lens UpdateAlias UpdateAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Maybe Text
description :: Maybe Text
$sel:description:UpdateAlias' :: UpdateAlias -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateAlias
s@UpdateAlias' {} Maybe Text
a -> UpdateAlias
s {$sel:description:UpdateAlias' :: Maybe Text
description = Maybe Text
a} :: UpdateAlias)
updateAlias_revisionId :: Lens.Lens' UpdateAlias (Prelude.Maybe Prelude.Text)
updateAlias_revisionId :: (Maybe Text -> f (Maybe Text)) -> UpdateAlias -> f UpdateAlias
updateAlias_revisionId = (UpdateAlias -> Maybe Text)
-> (UpdateAlias -> Maybe Text -> UpdateAlias)
-> Lens UpdateAlias UpdateAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:UpdateAlias' :: UpdateAlias -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: UpdateAlias
s@UpdateAlias' {} Maybe Text
a -> UpdateAlias
s {$sel:revisionId:UpdateAlias' :: Maybe Text
revisionId = Maybe Text
a} :: UpdateAlias)
updateAlias_functionName :: Lens.Lens' UpdateAlias Prelude.Text
updateAlias_functionName :: (Text -> f Text) -> UpdateAlias -> f UpdateAlias
updateAlias_functionName = (UpdateAlias -> Text)
-> (UpdateAlias -> Text -> UpdateAlias)
-> Lens UpdateAlias UpdateAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Text
functionName :: Text
$sel:functionName:UpdateAlias' :: UpdateAlias -> Text
functionName} -> Text
functionName) (\s :: UpdateAlias
s@UpdateAlias' {} Text
a -> UpdateAlias
s {$sel:functionName:UpdateAlias' :: Text
functionName = Text
a} :: UpdateAlias)
updateAlias_name :: Lens.Lens' UpdateAlias Prelude.Text
updateAlias_name :: (Text -> f Text) -> UpdateAlias -> f UpdateAlias
updateAlias_name = (UpdateAlias -> Text)
-> (UpdateAlias -> Text -> UpdateAlias)
-> Lens UpdateAlias UpdateAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAlias' {Text
name :: Text
$sel:name:UpdateAlias' :: UpdateAlias -> Text
name} -> Text
name) (\s :: UpdateAlias
s@UpdateAlias' {} Text
a -> UpdateAlias
s {$sel:name:UpdateAlias' :: Text
name = Text
a} :: UpdateAlias)
instance Core.AWSRequest UpdateAlias where
type AWSResponse UpdateAlias = AliasConfiguration
request :: UpdateAlias -> Request UpdateAlias
request = Service -> UpdateAlias -> Request UpdateAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAlias)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateAlias))
-> Logger
-> Service
-> Proxy UpdateAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAlias)))
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 AliasConfiguration
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateAlias
instance Prelude.NFData UpdateAlias
instance Core.ToHeaders UpdateAlias where
toHeaders :: UpdateAlias -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateAlias -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdateAlias where
toJSON :: UpdateAlias -> Value
toJSON UpdateAlias' {Maybe Text
Maybe AliasRoutingConfiguration
Text
name :: Text
functionName :: Text
revisionId :: Maybe Text
description :: Maybe Text
functionVersion :: Maybe Text
routingConfig :: Maybe AliasRoutingConfiguration
$sel:name:UpdateAlias' :: UpdateAlias -> Text
$sel:functionName:UpdateAlias' :: UpdateAlias -> Text
$sel:revisionId:UpdateAlias' :: UpdateAlias -> Maybe Text
$sel:description:UpdateAlias' :: UpdateAlias -> Maybe Text
$sel:functionVersion:UpdateAlias' :: UpdateAlias -> Maybe Text
$sel:routingConfig:UpdateAlias' :: UpdateAlias -> Maybe AliasRoutingConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RoutingConfig" Text -> AliasRoutingConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AliasRoutingConfiguration -> Pair)
-> Maybe AliasRoutingConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AliasRoutingConfiguration
routingConfig,
(Text
"FunctionVersion" 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
functionVersion,
(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 UpdateAlias where
toPath :: UpdateAlias -> ByteString
toPath UpdateAlias' {Maybe Text
Maybe AliasRoutingConfiguration
Text
name :: Text
functionName :: Text
revisionId :: Maybe Text
description :: Maybe Text
functionVersion :: Maybe Text
routingConfig :: Maybe AliasRoutingConfiguration
$sel:name:UpdateAlias' :: UpdateAlias -> Text
$sel:functionName:UpdateAlias' :: UpdateAlias -> Text
$sel:revisionId:UpdateAlias' :: UpdateAlias -> Maybe Text
$sel:description:UpdateAlias' :: UpdateAlias -> Maybe Text
$sel:functionVersion:UpdateAlias' :: UpdateAlias -> Maybe Text
$sel:routingConfig:UpdateAlias' :: UpdateAlias -> Maybe AliasRoutingConfiguration
..} =
[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
"/aliases/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name
]
instance Core.ToQuery UpdateAlias where
toQuery :: UpdateAlias -> QueryString
toQuery = QueryString -> UpdateAlias -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty