{-# 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.APIGateway.UpdateDeployment
(
UpdateDeployment (..),
newUpdateDeployment,
updateDeployment_patchOperations,
updateDeployment_restApiId,
updateDeployment_deploymentId,
Deployment (..),
newDeployment,
deployment_apiSummary,
deployment_createdDate,
deployment_id,
deployment_description,
)
where
import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
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 UpdateDeployment = UpdateDeployment'
{
UpdateDeployment -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateDeployment -> Text
restApiId :: Prelude.Text,
UpdateDeployment -> Text
deploymentId :: Prelude.Text
}
deriving (UpdateDeployment -> UpdateDeployment -> Bool
(UpdateDeployment -> UpdateDeployment -> Bool)
-> (UpdateDeployment -> UpdateDeployment -> Bool)
-> Eq UpdateDeployment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeployment -> UpdateDeployment -> Bool
$c/= :: UpdateDeployment -> UpdateDeployment -> Bool
== :: UpdateDeployment -> UpdateDeployment -> Bool
$c== :: UpdateDeployment -> UpdateDeployment -> Bool
Prelude.Eq, ReadPrec [UpdateDeployment]
ReadPrec UpdateDeployment
Int -> ReadS UpdateDeployment
ReadS [UpdateDeployment]
(Int -> ReadS UpdateDeployment)
-> ReadS [UpdateDeployment]
-> ReadPrec UpdateDeployment
-> ReadPrec [UpdateDeployment]
-> Read UpdateDeployment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeployment]
$creadListPrec :: ReadPrec [UpdateDeployment]
readPrec :: ReadPrec UpdateDeployment
$creadPrec :: ReadPrec UpdateDeployment
readList :: ReadS [UpdateDeployment]
$creadList :: ReadS [UpdateDeployment]
readsPrec :: Int -> ReadS UpdateDeployment
$creadsPrec :: Int -> ReadS UpdateDeployment
Prelude.Read, Int -> UpdateDeployment -> ShowS
[UpdateDeployment] -> ShowS
UpdateDeployment -> String
(Int -> UpdateDeployment -> ShowS)
-> (UpdateDeployment -> String)
-> ([UpdateDeployment] -> ShowS)
-> Show UpdateDeployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeployment] -> ShowS
$cshowList :: [UpdateDeployment] -> ShowS
show :: UpdateDeployment -> String
$cshow :: UpdateDeployment -> String
showsPrec :: Int -> UpdateDeployment -> ShowS
$cshowsPrec :: Int -> UpdateDeployment -> ShowS
Prelude.Show, (forall x. UpdateDeployment -> Rep UpdateDeployment x)
-> (forall x. Rep UpdateDeployment x -> UpdateDeployment)
-> Generic UpdateDeployment
forall x. Rep UpdateDeployment x -> UpdateDeployment
forall x. UpdateDeployment -> Rep UpdateDeployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDeployment x -> UpdateDeployment
$cfrom :: forall x. UpdateDeployment -> Rep UpdateDeployment x
Prelude.Generic)
newUpdateDeployment ::
Prelude.Text ->
Prelude.Text ->
UpdateDeployment
newUpdateDeployment :: Text -> Text -> UpdateDeployment
newUpdateDeployment Text
pRestApiId_ Text
pDeploymentId_ =
UpdateDeployment' :: Maybe [PatchOperation] -> Text -> Text -> UpdateDeployment
UpdateDeployment'
{ $sel:patchOperations:UpdateDeployment' :: Maybe [PatchOperation]
patchOperations =
Maybe [PatchOperation]
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:UpdateDeployment' :: Text
restApiId = Text
pRestApiId_,
$sel:deploymentId:UpdateDeployment' :: Text
deploymentId = Text
pDeploymentId_
}
updateDeployment_patchOperations :: Lens.Lens' UpdateDeployment (Prelude.Maybe [PatchOperation])
updateDeployment_patchOperations :: (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateDeployment -> f UpdateDeployment
updateDeployment_patchOperations = (UpdateDeployment -> Maybe [PatchOperation])
-> (UpdateDeployment -> Maybe [PatchOperation] -> UpdateDeployment)
-> Lens
UpdateDeployment
UpdateDeployment
(Maybe [PatchOperation])
(Maybe [PatchOperation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeployment' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateDeployment' :: UpdateDeployment -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateDeployment
s@UpdateDeployment' {} Maybe [PatchOperation]
a -> UpdateDeployment
s {$sel:patchOperations:UpdateDeployment' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateDeployment) ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateDeployment -> f UpdateDeployment)
-> ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateDeployment
-> f UpdateDeployment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
-> Iso
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
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
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateDeployment_restApiId :: Lens.Lens' UpdateDeployment Prelude.Text
updateDeployment_restApiId :: (Text -> f Text) -> UpdateDeployment -> f UpdateDeployment
updateDeployment_restApiId = (UpdateDeployment -> Text)
-> (UpdateDeployment -> Text -> UpdateDeployment)
-> Lens UpdateDeployment UpdateDeployment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeployment' {Text
restApiId :: Text
$sel:restApiId:UpdateDeployment' :: UpdateDeployment -> Text
restApiId} -> Text
restApiId) (\s :: UpdateDeployment
s@UpdateDeployment' {} Text
a -> UpdateDeployment
s {$sel:restApiId:UpdateDeployment' :: Text
restApiId = Text
a} :: UpdateDeployment)
updateDeployment_deploymentId :: Lens.Lens' UpdateDeployment Prelude.Text
updateDeployment_deploymentId :: (Text -> f Text) -> UpdateDeployment -> f UpdateDeployment
updateDeployment_deploymentId = (UpdateDeployment -> Text)
-> (UpdateDeployment -> Text -> UpdateDeployment)
-> Lens UpdateDeployment UpdateDeployment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeployment' {Text
deploymentId :: Text
$sel:deploymentId:UpdateDeployment' :: UpdateDeployment -> Text
deploymentId} -> Text
deploymentId) (\s :: UpdateDeployment
s@UpdateDeployment' {} Text
a -> UpdateDeployment
s {$sel:deploymentId:UpdateDeployment' :: Text
deploymentId = Text
a} :: UpdateDeployment)
instance Core.AWSRequest UpdateDeployment where
type AWSResponse UpdateDeployment = Deployment
request :: UpdateDeployment -> Request UpdateDeployment
request = Service -> UpdateDeployment -> Request UpdateDeployment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDeployment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateDeployment))
-> Logger
-> Service
-> Proxy UpdateDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDeployment)))
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 Deployment
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateDeployment
instance Prelude.NFData UpdateDeployment
instance Core.ToHeaders UpdateDeployment where
toHeaders :: UpdateDeployment -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDeployment -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Core.ToJSON UpdateDeployment where
toJSON :: UpdateDeployment -> Value
toJSON UpdateDeployment' {Maybe [PatchOperation]
Text
deploymentId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:deploymentId:UpdateDeployment' :: UpdateDeployment -> Text
$sel:restApiId:UpdateDeployment' :: UpdateDeployment -> Text
$sel:patchOperations:UpdateDeployment' :: UpdateDeployment -> Maybe [PatchOperation]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"patchOperations" Text -> [PatchOperation] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PatchOperation] -> Pair) -> Maybe [PatchOperation] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOperation]
patchOperations
]
)
instance Core.ToPath UpdateDeployment where
toPath :: UpdateDeployment -> ByteString
toPath UpdateDeployment' {Maybe [PatchOperation]
Text
deploymentId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:deploymentId:UpdateDeployment' :: UpdateDeployment -> Text
$sel:restApiId:UpdateDeployment' :: UpdateDeployment -> Text
$sel:patchOperations:UpdateDeployment' :: UpdateDeployment -> Maybe [PatchOperation]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
ByteString
"/deployments/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deploymentId
]
instance Core.ToQuery UpdateDeployment where
toQuery :: UpdateDeployment -> QueryString
toQuery = QueryString -> UpdateDeployment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty