{-# 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.CodePipeline.UpdatePipeline
(
UpdatePipeline (..),
newUpdatePipeline,
updatePipeline_pipeline,
UpdatePipelineResponse (..),
newUpdatePipelineResponse,
updatePipelineResponse_pipeline,
updatePipelineResponse_httpStatus,
)
where
import Amazonka.CodePipeline.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 UpdatePipeline = UpdatePipeline'
{
UpdatePipeline -> PipelineDeclaration
pipeline :: PipelineDeclaration
}
deriving (UpdatePipeline -> UpdatePipeline -> Bool
(UpdatePipeline -> UpdatePipeline -> Bool)
-> (UpdatePipeline -> UpdatePipeline -> Bool) -> Eq UpdatePipeline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePipeline -> UpdatePipeline -> Bool
$c/= :: UpdatePipeline -> UpdatePipeline -> Bool
== :: UpdatePipeline -> UpdatePipeline -> Bool
$c== :: UpdatePipeline -> UpdatePipeline -> Bool
Prelude.Eq, ReadPrec [UpdatePipeline]
ReadPrec UpdatePipeline
Int -> ReadS UpdatePipeline
ReadS [UpdatePipeline]
(Int -> ReadS UpdatePipeline)
-> ReadS [UpdatePipeline]
-> ReadPrec UpdatePipeline
-> ReadPrec [UpdatePipeline]
-> Read UpdatePipeline
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePipeline]
$creadListPrec :: ReadPrec [UpdatePipeline]
readPrec :: ReadPrec UpdatePipeline
$creadPrec :: ReadPrec UpdatePipeline
readList :: ReadS [UpdatePipeline]
$creadList :: ReadS [UpdatePipeline]
readsPrec :: Int -> ReadS UpdatePipeline
$creadsPrec :: Int -> ReadS UpdatePipeline
Prelude.Read, Int -> UpdatePipeline -> ShowS
[UpdatePipeline] -> ShowS
UpdatePipeline -> String
(Int -> UpdatePipeline -> ShowS)
-> (UpdatePipeline -> String)
-> ([UpdatePipeline] -> ShowS)
-> Show UpdatePipeline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePipeline] -> ShowS
$cshowList :: [UpdatePipeline] -> ShowS
show :: UpdatePipeline -> String
$cshow :: UpdatePipeline -> String
showsPrec :: Int -> UpdatePipeline -> ShowS
$cshowsPrec :: Int -> UpdatePipeline -> ShowS
Prelude.Show, (forall x. UpdatePipeline -> Rep UpdatePipeline x)
-> (forall x. Rep UpdatePipeline x -> UpdatePipeline)
-> Generic UpdatePipeline
forall x. Rep UpdatePipeline x -> UpdatePipeline
forall x. UpdatePipeline -> Rep UpdatePipeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePipeline x -> UpdatePipeline
$cfrom :: forall x. UpdatePipeline -> Rep UpdatePipeline x
Prelude.Generic)
newUpdatePipeline ::
PipelineDeclaration ->
UpdatePipeline
newUpdatePipeline :: PipelineDeclaration -> UpdatePipeline
newUpdatePipeline PipelineDeclaration
pPipeline_ =
UpdatePipeline' :: PipelineDeclaration -> UpdatePipeline
UpdatePipeline' {$sel:pipeline:UpdatePipeline' :: PipelineDeclaration
pipeline = PipelineDeclaration
pPipeline_}
updatePipeline_pipeline :: Lens.Lens' UpdatePipeline PipelineDeclaration
updatePipeline_pipeline :: (PipelineDeclaration -> f PipelineDeclaration)
-> UpdatePipeline -> f UpdatePipeline
updatePipeline_pipeline = (UpdatePipeline -> PipelineDeclaration)
-> (UpdatePipeline -> PipelineDeclaration -> UpdatePipeline)
-> Lens
UpdatePipeline
UpdatePipeline
PipelineDeclaration
PipelineDeclaration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePipeline' {PipelineDeclaration
pipeline :: PipelineDeclaration
$sel:pipeline:UpdatePipeline' :: UpdatePipeline -> PipelineDeclaration
pipeline} -> PipelineDeclaration
pipeline) (\s :: UpdatePipeline
s@UpdatePipeline' {} PipelineDeclaration
a -> UpdatePipeline
s {$sel:pipeline:UpdatePipeline' :: PipelineDeclaration
pipeline = PipelineDeclaration
a} :: UpdatePipeline)
instance Core.AWSRequest UpdatePipeline where
type
AWSResponse UpdatePipeline =
UpdatePipelineResponse
request :: UpdatePipeline -> Request UpdatePipeline
request = Service -> UpdatePipeline -> Request UpdatePipeline
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdatePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePipeline)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdatePipeline))
-> Logger
-> Service
-> Proxy UpdatePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePipeline)))
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 PipelineDeclaration -> Int -> UpdatePipelineResponse
UpdatePipelineResponse'
(Maybe PipelineDeclaration -> Int -> UpdatePipelineResponse)
-> Either String (Maybe PipelineDeclaration)
-> Either String (Int -> UpdatePipelineResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe PipelineDeclaration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"pipeline")
Either String (Int -> UpdatePipelineResponse)
-> Either String Int -> Either String UpdatePipelineResponse
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 UpdatePipeline
instance Prelude.NFData UpdatePipeline
instance Core.ToHeaders UpdatePipeline where
toHeaders :: UpdatePipeline -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdatePipeline -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodePipeline_20150709.UpdatePipeline" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdatePipeline where
toJSON :: UpdatePipeline -> Value
toJSON UpdatePipeline' {PipelineDeclaration
pipeline :: PipelineDeclaration
$sel:pipeline:UpdatePipeline' :: UpdatePipeline -> PipelineDeclaration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Key
"pipeline" Key -> PipelineDeclaration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= PipelineDeclaration
pipeline)]
)
instance Core.ToPath UpdatePipeline where
toPath :: UpdatePipeline -> ByteString
toPath = ByteString -> UpdatePipeline -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdatePipeline where
toQuery :: UpdatePipeline -> QueryString
toQuery = QueryString -> UpdatePipeline -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdatePipelineResponse = UpdatePipelineResponse'
{
UpdatePipelineResponse -> Maybe PipelineDeclaration
pipeline :: Prelude.Maybe PipelineDeclaration,
UpdatePipelineResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdatePipelineResponse -> UpdatePipelineResponse -> Bool
(UpdatePipelineResponse -> UpdatePipelineResponse -> Bool)
-> (UpdatePipelineResponse -> UpdatePipelineResponse -> Bool)
-> Eq UpdatePipelineResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePipelineResponse -> UpdatePipelineResponse -> Bool
$c/= :: UpdatePipelineResponse -> UpdatePipelineResponse -> Bool
== :: UpdatePipelineResponse -> UpdatePipelineResponse -> Bool
$c== :: UpdatePipelineResponse -> UpdatePipelineResponse -> Bool
Prelude.Eq, ReadPrec [UpdatePipelineResponse]
ReadPrec UpdatePipelineResponse
Int -> ReadS UpdatePipelineResponse
ReadS [UpdatePipelineResponse]
(Int -> ReadS UpdatePipelineResponse)
-> ReadS [UpdatePipelineResponse]
-> ReadPrec UpdatePipelineResponse
-> ReadPrec [UpdatePipelineResponse]
-> Read UpdatePipelineResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePipelineResponse]
$creadListPrec :: ReadPrec [UpdatePipelineResponse]
readPrec :: ReadPrec UpdatePipelineResponse
$creadPrec :: ReadPrec UpdatePipelineResponse
readList :: ReadS [UpdatePipelineResponse]
$creadList :: ReadS [UpdatePipelineResponse]
readsPrec :: Int -> ReadS UpdatePipelineResponse
$creadsPrec :: Int -> ReadS UpdatePipelineResponse
Prelude.Read, Int -> UpdatePipelineResponse -> ShowS
[UpdatePipelineResponse] -> ShowS
UpdatePipelineResponse -> String
(Int -> UpdatePipelineResponse -> ShowS)
-> (UpdatePipelineResponse -> String)
-> ([UpdatePipelineResponse] -> ShowS)
-> Show UpdatePipelineResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePipelineResponse] -> ShowS
$cshowList :: [UpdatePipelineResponse] -> ShowS
show :: UpdatePipelineResponse -> String
$cshow :: UpdatePipelineResponse -> String
showsPrec :: Int -> UpdatePipelineResponse -> ShowS
$cshowsPrec :: Int -> UpdatePipelineResponse -> ShowS
Prelude.Show, (forall x. UpdatePipelineResponse -> Rep UpdatePipelineResponse x)
-> (forall x.
Rep UpdatePipelineResponse x -> UpdatePipelineResponse)
-> Generic UpdatePipelineResponse
forall x. Rep UpdatePipelineResponse x -> UpdatePipelineResponse
forall x. UpdatePipelineResponse -> Rep UpdatePipelineResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePipelineResponse x -> UpdatePipelineResponse
$cfrom :: forall x. UpdatePipelineResponse -> Rep UpdatePipelineResponse x
Prelude.Generic)
newUpdatePipelineResponse ::
Prelude.Int ->
UpdatePipelineResponse
newUpdatePipelineResponse :: Int -> UpdatePipelineResponse
newUpdatePipelineResponse Int
pHttpStatus_ =
UpdatePipelineResponse' :: Maybe PipelineDeclaration -> Int -> UpdatePipelineResponse
UpdatePipelineResponse'
{ $sel:pipeline:UpdatePipelineResponse' :: Maybe PipelineDeclaration
pipeline = Maybe PipelineDeclaration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdatePipelineResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updatePipelineResponse_pipeline :: Lens.Lens' UpdatePipelineResponse (Prelude.Maybe PipelineDeclaration)
updatePipelineResponse_pipeline :: (Maybe PipelineDeclaration -> f (Maybe PipelineDeclaration))
-> UpdatePipelineResponse -> f UpdatePipelineResponse
updatePipelineResponse_pipeline = (UpdatePipelineResponse -> Maybe PipelineDeclaration)
-> (UpdatePipelineResponse
-> Maybe PipelineDeclaration -> UpdatePipelineResponse)
-> Lens
UpdatePipelineResponse
UpdatePipelineResponse
(Maybe PipelineDeclaration)
(Maybe PipelineDeclaration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePipelineResponse' {Maybe PipelineDeclaration
pipeline :: Maybe PipelineDeclaration
$sel:pipeline:UpdatePipelineResponse' :: UpdatePipelineResponse -> Maybe PipelineDeclaration
pipeline} -> Maybe PipelineDeclaration
pipeline) (\s :: UpdatePipelineResponse
s@UpdatePipelineResponse' {} Maybe PipelineDeclaration
a -> UpdatePipelineResponse
s {$sel:pipeline:UpdatePipelineResponse' :: Maybe PipelineDeclaration
pipeline = Maybe PipelineDeclaration
a} :: UpdatePipelineResponse)
updatePipelineResponse_httpStatus :: Lens.Lens' UpdatePipelineResponse Prelude.Int
updatePipelineResponse_httpStatus :: (Int -> f Int)
-> UpdatePipelineResponse -> f UpdatePipelineResponse
updatePipelineResponse_httpStatus = (UpdatePipelineResponse -> Int)
-> (UpdatePipelineResponse -> Int -> UpdatePipelineResponse)
-> Lens UpdatePipelineResponse UpdatePipelineResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePipelineResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdatePipelineResponse' :: UpdatePipelineResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdatePipelineResponse
s@UpdatePipelineResponse' {} Int
a -> UpdatePipelineResponse
s {$sel:httpStatus:UpdatePipelineResponse' :: Int
httpStatus = Int
a} :: UpdatePipelineResponse)
instance Prelude.NFData UpdatePipelineResponse