{-# 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.CreatePipeline
(
CreatePipeline (..),
newCreatePipeline,
createPipeline_tags,
createPipeline_pipeline,
CreatePipelineResponse (..),
newCreatePipelineResponse,
createPipelineResponse_pipeline,
createPipelineResponse_tags,
createPipelineResponse_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 CreatePipeline = CreatePipeline'
{
CreatePipeline -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreatePipeline -> PipelineDeclaration
pipeline :: PipelineDeclaration
}
deriving (CreatePipeline -> CreatePipeline -> Bool
(CreatePipeline -> CreatePipeline -> Bool)
-> (CreatePipeline -> CreatePipeline -> Bool) -> Eq CreatePipeline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePipeline -> CreatePipeline -> Bool
$c/= :: CreatePipeline -> CreatePipeline -> Bool
== :: CreatePipeline -> CreatePipeline -> Bool
$c== :: CreatePipeline -> CreatePipeline -> Bool
Prelude.Eq, ReadPrec [CreatePipeline]
ReadPrec CreatePipeline
Int -> ReadS CreatePipeline
ReadS [CreatePipeline]
(Int -> ReadS CreatePipeline)
-> ReadS [CreatePipeline]
-> ReadPrec CreatePipeline
-> ReadPrec [CreatePipeline]
-> Read CreatePipeline
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePipeline]
$creadListPrec :: ReadPrec [CreatePipeline]
readPrec :: ReadPrec CreatePipeline
$creadPrec :: ReadPrec CreatePipeline
readList :: ReadS [CreatePipeline]
$creadList :: ReadS [CreatePipeline]
readsPrec :: Int -> ReadS CreatePipeline
$creadsPrec :: Int -> ReadS CreatePipeline
Prelude.Read, Int -> CreatePipeline -> ShowS
[CreatePipeline] -> ShowS
CreatePipeline -> String
(Int -> CreatePipeline -> ShowS)
-> (CreatePipeline -> String)
-> ([CreatePipeline] -> ShowS)
-> Show CreatePipeline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePipeline] -> ShowS
$cshowList :: [CreatePipeline] -> ShowS
show :: CreatePipeline -> String
$cshow :: CreatePipeline -> String
showsPrec :: Int -> CreatePipeline -> ShowS
$cshowsPrec :: Int -> CreatePipeline -> ShowS
Prelude.Show, (forall x. CreatePipeline -> Rep CreatePipeline x)
-> (forall x. Rep CreatePipeline x -> CreatePipeline)
-> Generic CreatePipeline
forall x. Rep CreatePipeline x -> CreatePipeline
forall x. CreatePipeline -> Rep CreatePipeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePipeline x -> CreatePipeline
$cfrom :: forall x. CreatePipeline -> Rep CreatePipeline x
Prelude.Generic)
newCreatePipeline ::
PipelineDeclaration ->
CreatePipeline
newCreatePipeline :: PipelineDeclaration -> CreatePipeline
newCreatePipeline PipelineDeclaration
pPipeline_ =
CreatePipeline' :: Maybe [Tag] -> PipelineDeclaration -> CreatePipeline
CreatePipeline'
{ $sel:tags:CreatePipeline' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:pipeline:CreatePipeline' :: PipelineDeclaration
pipeline = PipelineDeclaration
pPipeline_
}
createPipeline_tags :: Lens.Lens' CreatePipeline (Prelude.Maybe [Tag])
createPipeline_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePipeline -> f CreatePipeline
createPipeline_tags = (CreatePipeline -> Maybe [Tag])
-> (CreatePipeline -> Maybe [Tag] -> CreatePipeline)
-> Lens CreatePipeline CreatePipeline (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipeline' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreatePipeline' :: CreatePipeline -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreatePipeline
s@CreatePipeline' {} Maybe [Tag]
a -> CreatePipeline
s {$sel:tags:CreatePipeline' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreatePipeline) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePipeline -> f CreatePipeline)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePipeline
-> f CreatePipeline
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createPipeline_pipeline :: Lens.Lens' CreatePipeline PipelineDeclaration
createPipeline_pipeline :: (PipelineDeclaration -> f PipelineDeclaration)
-> CreatePipeline -> f CreatePipeline
createPipeline_pipeline = (CreatePipeline -> PipelineDeclaration)
-> (CreatePipeline -> PipelineDeclaration -> CreatePipeline)
-> Lens
CreatePipeline
CreatePipeline
PipelineDeclaration
PipelineDeclaration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipeline' {PipelineDeclaration
pipeline :: PipelineDeclaration
$sel:pipeline:CreatePipeline' :: CreatePipeline -> PipelineDeclaration
pipeline} -> PipelineDeclaration
pipeline) (\s :: CreatePipeline
s@CreatePipeline' {} PipelineDeclaration
a -> CreatePipeline
s {$sel:pipeline:CreatePipeline' :: PipelineDeclaration
pipeline = PipelineDeclaration
a} :: CreatePipeline)
instance Core.AWSRequest CreatePipeline where
type
AWSResponse CreatePipeline =
CreatePipelineResponse
request :: CreatePipeline -> Request CreatePipeline
request = Service -> CreatePipeline -> Request CreatePipeline
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePipeline)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreatePipeline))
-> Logger
-> Service
-> Proxy CreatePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePipeline)))
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
-> Maybe [Tag] -> Int -> CreatePipelineResponse
CreatePipelineResponse'
(Maybe PipelineDeclaration
-> Maybe [Tag] -> Int -> CreatePipelineResponse)
-> Either String (Maybe PipelineDeclaration)
-> Either String (Maybe [Tag] -> Int -> CreatePipelineResponse)
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 (Maybe [Tag] -> Int -> CreatePipelineResponse)
-> Either String (Maybe [Tag])
-> Either String (Int -> CreatePipelineResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"tags" Either String (Maybe (Maybe [Tag]))
-> Maybe [Tag] -> Either String (Maybe [Tag])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> CreatePipelineResponse)
-> Either String Int -> Either String CreatePipelineResponse
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 CreatePipeline
instance Prelude.NFData CreatePipeline
instance Core.ToHeaders CreatePipeline where
toHeaders :: CreatePipeline -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreatePipeline -> 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.CreatePipeline" ::
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 CreatePipeline where
toJSON :: CreatePipeline -> Value
toJSON CreatePipeline' {Maybe [Tag]
PipelineDeclaration
pipeline :: PipelineDeclaration
tags :: Maybe [Tag]
$sel:pipeline:CreatePipeline' :: CreatePipeline -> PipelineDeclaration
$sel:tags:CreatePipeline' :: CreatePipeline -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"tags" Key -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
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 CreatePipeline where
toPath :: CreatePipeline -> ByteString
toPath = ByteString -> CreatePipeline -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreatePipeline where
toQuery :: CreatePipeline -> QueryString
toQuery = QueryString -> CreatePipeline -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreatePipelineResponse = CreatePipelineResponse'
{
CreatePipelineResponse -> Maybe PipelineDeclaration
pipeline :: Prelude.Maybe PipelineDeclaration,
CreatePipelineResponse -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreatePipelineResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePipelineResponse -> CreatePipelineResponse -> Bool
(CreatePipelineResponse -> CreatePipelineResponse -> Bool)
-> (CreatePipelineResponse -> CreatePipelineResponse -> Bool)
-> Eq CreatePipelineResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePipelineResponse -> CreatePipelineResponse -> Bool
$c/= :: CreatePipelineResponse -> CreatePipelineResponse -> Bool
== :: CreatePipelineResponse -> CreatePipelineResponse -> Bool
$c== :: CreatePipelineResponse -> CreatePipelineResponse -> Bool
Prelude.Eq, ReadPrec [CreatePipelineResponse]
ReadPrec CreatePipelineResponse
Int -> ReadS CreatePipelineResponse
ReadS [CreatePipelineResponse]
(Int -> ReadS CreatePipelineResponse)
-> ReadS [CreatePipelineResponse]
-> ReadPrec CreatePipelineResponse
-> ReadPrec [CreatePipelineResponse]
-> Read CreatePipelineResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePipelineResponse]
$creadListPrec :: ReadPrec [CreatePipelineResponse]
readPrec :: ReadPrec CreatePipelineResponse
$creadPrec :: ReadPrec CreatePipelineResponse
readList :: ReadS [CreatePipelineResponse]
$creadList :: ReadS [CreatePipelineResponse]
readsPrec :: Int -> ReadS CreatePipelineResponse
$creadsPrec :: Int -> ReadS CreatePipelineResponse
Prelude.Read, Int -> CreatePipelineResponse -> ShowS
[CreatePipelineResponse] -> ShowS
CreatePipelineResponse -> String
(Int -> CreatePipelineResponse -> ShowS)
-> (CreatePipelineResponse -> String)
-> ([CreatePipelineResponse] -> ShowS)
-> Show CreatePipelineResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePipelineResponse] -> ShowS
$cshowList :: [CreatePipelineResponse] -> ShowS
show :: CreatePipelineResponse -> String
$cshow :: CreatePipelineResponse -> String
showsPrec :: Int -> CreatePipelineResponse -> ShowS
$cshowsPrec :: Int -> CreatePipelineResponse -> ShowS
Prelude.Show, (forall x. CreatePipelineResponse -> Rep CreatePipelineResponse x)
-> (forall x.
Rep CreatePipelineResponse x -> CreatePipelineResponse)
-> Generic CreatePipelineResponse
forall x. Rep CreatePipelineResponse x -> CreatePipelineResponse
forall x. CreatePipelineResponse -> Rep CreatePipelineResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePipelineResponse x -> CreatePipelineResponse
$cfrom :: forall x. CreatePipelineResponse -> Rep CreatePipelineResponse x
Prelude.Generic)
newCreatePipelineResponse ::
Prelude.Int ->
CreatePipelineResponse
newCreatePipelineResponse :: Int -> CreatePipelineResponse
newCreatePipelineResponse Int
pHttpStatus_ =
CreatePipelineResponse' :: Maybe PipelineDeclaration
-> Maybe [Tag] -> Int -> CreatePipelineResponse
CreatePipelineResponse'
{ $sel:pipeline:CreatePipelineResponse' :: Maybe PipelineDeclaration
pipeline = Maybe PipelineDeclaration
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreatePipelineResponse' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePipelineResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPipelineResponse_pipeline :: Lens.Lens' CreatePipelineResponse (Prelude.Maybe PipelineDeclaration)
createPipelineResponse_pipeline :: (Maybe PipelineDeclaration -> f (Maybe PipelineDeclaration))
-> CreatePipelineResponse -> f CreatePipelineResponse
createPipelineResponse_pipeline = (CreatePipelineResponse -> Maybe PipelineDeclaration)
-> (CreatePipelineResponse
-> Maybe PipelineDeclaration -> CreatePipelineResponse)
-> Lens
CreatePipelineResponse
CreatePipelineResponse
(Maybe PipelineDeclaration)
(Maybe PipelineDeclaration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipelineResponse' {Maybe PipelineDeclaration
pipeline :: Maybe PipelineDeclaration
$sel:pipeline:CreatePipelineResponse' :: CreatePipelineResponse -> Maybe PipelineDeclaration
pipeline} -> Maybe PipelineDeclaration
pipeline) (\s :: CreatePipelineResponse
s@CreatePipelineResponse' {} Maybe PipelineDeclaration
a -> CreatePipelineResponse
s {$sel:pipeline:CreatePipelineResponse' :: Maybe PipelineDeclaration
pipeline = Maybe PipelineDeclaration
a} :: CreatePipelineResponse)
createPipelineResponse_tags :: Lens.Lens' CreatePipelineResponse (Prelude.Maybe [Tag])
createPipelineResponse_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePipelineResponse -> f CreatePipelineResponse
createPipelineResponse_tags = (CreatePipelineResponse -> Maybe [Tag])
-> (CreatePipelineResponse
-> Maybe [Tag] -> CreatePipelineResponse)
-> Lens
CreatePipelineResponse
CreatePipelineResponse
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipelineResponse' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreatePipelineResponse' :: CreatePipelineResponse -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreatePipelineResponse
s@CreatePipelineResponse' {} Maybe [Tag]
a -> CreatePipelineResponse
s {$sel:tags:CreatePipelineResponse' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreatePipelineResponse) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePipelineResponse -> f CreatePipelineResponse)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreatePipelineResponse
-> f CreatePipelineResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createPipelineResponse_httpStatus :: Lens.Lens' CreatePipelineResponse Prelude.Int
createPipelineResponse_httpStatus :: (Int -> f Int)
-> CreatePipelineResponse -> f CreatePipelineResponse
createPipelineResponse_httpStatus = (CreatePipelineResponse -> Int)
-> (CreatePipelineResponse -> Int -> CreatePipelineResponse)
-> Lens CreatePipelineResponse CreatePipelineResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipelineResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePipelineResponse' :: CreatePipelineResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePipelineResponse
s@CreatePipelineResponse' {} Int
a -> CreatePipelineResponse
s {$sel:httpStatus:CreatePipelineResponse' :: Int
httpStatus = Int
a} :: CreatePipelineResponse)
instance Prelude.NFData CreatePipelineResponse