{-# 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.StartPipelineExecution
(
StartPipelineExecution (..),
newStartPipelineExecution,
startPipelineExecution_clientRequestToken,
startPipelineExecution_name,
StartPipelineExecutionResponse (..),
newStartPipelineExecutionResponse,
startPipelineExecutionResponse_pipelineExecutionId,
startPipelineExecutionResponse_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 StartPipelineExecution = StartPipelineExecution'
{
StartPipelineExecution -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
StartPipelineExecution -> Text
name :: Prelude.Text
}
deriving (StartPipelineExecution -> StartPipelineExecution -> Bool
(StartPipelineExecution -> StartPipelineExecution -> Bool)
-> (StartPipelineExecution -> StartPipelineExecution -> Bool)
-> Eq StartPipelineExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartPipelineExecution -> StartPipelineExecution -> Bool
$c/= :: StartPipelineExecution -> StartPipelineExecution -> Bool
== :: StartPipelineExecution -> StartPipelineExecution -> Bool
$c== :: StartPipelineExecution -> StartPipelineExecution -> Bool
Prelude.Eq, ReadPrec [StartPipelineExecution]
ReadPrec StartPipelineExecution
Int -> ReadS StartPipelineExecution
ReadS [StartPipelineExecution]
(Int -> ReadS StartPipelineExecution)
-> ReadS [StartPipelineExecution]
-> ReadPrec StartPipelineExecution
-> ReadPrec [StartPipelineExecution]
-> Read StartPipelineExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartPipelineExecution]
$creadListPrec :: ReadPrec [StartPipelineExecution]
readPrec :: ReadPrec StartPipelineExecution
$creadPrec :: ReadPrec StartPipelineExecution
readList :: ReadS [StartPipelineExecution]
$creadList :: ReadS [StartPipelineExecution]
readsPrec :: Int -> ReadS StartPipelineExecution
$creadsPrec :: Int -> ReadS StartPipelineExecution
Prelude.Read, Int -> StartPipelineExecution -> ShowS
[StartPipelineExecution] -> ShowS
StartPipelineExecution -> String
(Int -> StartPipelineExecution -> ShowS)
-> (StartPipelineExecution -> String)
-> ([StartPipelineExecution] -> ShowS)
-> Show StartPipelineExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartPipelineExecution] -> ShowS
$cshowList :: [StartPipelineExecution] -> ShowS
show :: StartPipelineExecution -> String
$cshow :: StartPipelineExecution -> String
showsPrec :: Int -> StartPipelineExecution -> ShowS
$cshowsPrec :: Int -> StartPipelineExecution -> ShowS
Prelude.Show, (forall x. StartPipelineExecution -> Rep StartPipelineExecution x)
-> (forall x.
Rep StartPipelineExecution x -> StartPipelineExecution)
-> Generic StartPipelineExecution
forall x. Rep StartPipelineExecution x -> StartPipelineExecution
forall x. StartPipelineExecution -> Rep StartPipelineExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartPipelineExecution x -> StartPipelineExecution
$cfrom :: forall x. StartPipelineExecution -> Rep StartPipelineExecution x
Prelude.Generic)
newStartPipelineExecution ::
Prelude.Text ->
StartPipelineExecution
newStartPipelineExecution :: Text -> StartPipelineExecution
newStartPipelineExecution Text
pName_ =
StartPipelineExecution' :: Maybe Text -> Text -> StartPipelineExecution
StartPipelineExecution'
{ $sel:clientRequestToken:StartPipelineExecution' :: Maybe Text
clientRequestToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:StartPipelineExecution' :: Text
name = Text
pName_
}
startPipelineExecution_clientRequestToken :: Lens.Lens' StartPipelineExecution (Prelude.Maybe Prelude.Text)
startPipelineExecution_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartPipelineExecution -> f StartPipelineExecution
startPipelineExecution_clientRequestToken = (StartPipelineExecution -> Maybe Text)
-> (StartPipelineExecution -> Maybe Text -> StartPipelineExecution)
-> Lens
StartPipelineExecution
StartPipelineExecution
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPipelineExecution' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartPipelineExecution' :: StartPipelineExecution -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartPipelineExecution
s@StartPipelineExecution' {} Maybe Text
a -> StartPipelineExecution
s {$sel:clientRequestToken:StartPipelineExecution' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartPipelineExecution)
startPipelineExecution_name :: Lens.Lens' StartPipelineExecution Prelude.Text
startPipelineExecution_name :: (Text -> f Text)
-> StartPipelineExecution -> f StartPipelineExecution
startPipelineExecution_name = (StartPipelineExecution -> Text)
-> (StartPipelineExecution -> Text -> StartPipelineExecution)
-> Lens StartPipelineExecution StartPipelineExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPipelineExecution' {Text
name :: Text
$sel:name:StartPipelineExecution' :: StartPipelineExecution -> Text
name} -> Text
name) (\s :: StartPipelineExecution
s@StartPipelineExecution' {} Text
a -> StartPipelineExecution
s {$sel:name:StartPipelineExecution' :: Text
name = Text
a} :: StartPipelineExecution)
instance Core.AWSRequest StartPipelineExecution where
type
AWSResponse StartPipelineExecution =
StartPipelineExecutionResponse
request :: StartPipelineExecution -> Request StartPipelineExecution
request = Service -> StartPipelineExecution -> Request StartPipelineExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartPipelineExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartPipelineExecution)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartPipelineExecution))
-> Logger
-> Service
-> Proxy StartPipelineExecution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartPipelineExecution)))
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 Text -> Int -> StartPipelineExecutionResponse
StartPipelineExecutionResponse'
(Maybe Text -> Int -> StartPipelineExecutionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartPipelineExecutionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"pipelineExecutionId")
Either String (Int -> StartPipelineExecutionResponse)
-> Either String Int
-> Either String StartPipelineExecutionResponse
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 StartPipelineExecution
instance Prelude.NFData StartPipelineExecution
instance Core.ToHeaders StartPipelineExecution where
toHeaders :: StartPipelineExecution -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartPipelineExecution -> 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.StartPipelineExecution" ::
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 StartPipelineExecution where
toJSON :: StartPipelineExecution -> Value
toJSON StartPipelineExecution' {Maybe Text
Text
name :: Text
clientRequestToken :: Maybe Text
$sel:name:StartPipelineExecution' :: StartPipelineExecution -> Text
$sel:clientRequestToken:StartPipelineExecution' :: StartPipelineExecution -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientRequestToken" 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
clientRequestToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath StartPipelineExecution where
toPath :: StartPipelineExecution -> ByteString
toPath = ByteString -> StartPipelineExecution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartPipelineExecution where
toQuery :: StartPipelineExecution -> QueryString
toQuery = QueryString -> StartPipelineExecution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartPipelineExecutionResponse = StartPipelineExecutionResponse'
{
StartPipelineExecutionResponse -> Maybe Text
pipelineExecutionId :: Prelude.Maybe Prelude.Text,
StartPipelineExecutionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartPipelineExecutionResponse
-> StartPipelineExecutionResponse -> Bool
(StartPipelineExecutionResponse
-> StartPipelineExecutionResponse -> Bool)
-> (StartPipelineExecutionResponse
-> StartPipelineExecutionResponse -> Bool)
-> Eq StartPipelineExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartPipelineExecutionResponse
-> StartPipelineExecutionResponse -> Bool
$c/= :: StartPipelineExecutionResponse
-> StartPipelineExecutionResponse -> Bool
== :: StartPipelineExecutionResponse
-> StartPipelineExecutionResponse -> Bool
$c== :: StartPipelineExecutionResponse
-> StartPipelineExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StartPipelineExecutionResponse]
ReadPrec StartPipelineExecutionResponse
Int -> ReadS StartPipelineExecutionResponse
ReadS [StartPipelineExecutionResponse]
(Int -> ReadS StartPipelineExecutionResponse)
-> ReadS [StartPipelineExecutionResponse]
-> ReadPrec StartPipelineExecutionResponse
-> ReadPrec [StartPipelineExecutionResponse]
-> Read StartPipelineExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartPipelineExecutionResponse]
$creadListPrec :: ReadPrec [StartPipelineExecutionResponse]
readPrec :: ReadPrec StartPipelineExecutionResponse
$creadPrec :: ReadPrec StartPipelineExecutionResponse
readList :: ReadS [StartPipelineExecutionResponse]
$creadList :: ReadS [StartPipelineExecutionResponse]
readsPrec :: Int -> ReadS StartPipelineExecutionResponse
$creadsPrec :: Int -> ReadS StartPipelineExecutionResponse
Prelude.Read, Int -> StartPipelineExecutionResponse -> ShowS
[StartPipelineExecutionResponse] -> ShowS
StartPipelineExecutionResponse -> String
(Int -> StartPipelineExecutionResponse -> ShowS)
-> (StartPipelineExecutionResponse -> String)
-> ([StartPipelineExecutionResponse] -> ShowS)
-> Show StartPipelineExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartPipelineExecutionResponse] -> ShowS
$cshowList :: [StartPipelineExecutionResponse] -> ShowS
show :: StartPipelineExecutionResponse -> String
$cshow :: StartPipelineExecutionResponse -> String
showsPrec :: Int -> StartPipelineExecutionResponse -> ShowS
$cshowsPrec :: Int -> StartPipelineExecutionResponse -> ShowS
Prelude.Show, (forall x.
StartPipelineExecutionResponse
-> Rep StartPipelineExecutionResponse x)
-> (forall x.
Rep StartPipelineExecutionResponse x
-> StartPipelineExecutionResponse)
-> Generic StartPipelineExecutionResponse
forall x.
Rep StartPipelineExecutionResponse x
-> StartPipelineExecutionResponse
forall x.
StartPipelineExecutionResponse
-> Rep StartPipelineExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartPipelineExecutionResponse x
-> StartPipelineExecutionResponse
$cfrom :: forall x.
StartPipelineExecutionResponse
-> Rep StartPipelineExecutionResponse x
Prelude.Generic)
newStartPipelineExecutionResponse ::
Prelude.Int ->
StartPipelineExecutionResponse
newStartPipelineExecutionResponse :: Int -> StartPipelineExecutionResponse
newStartPipelineExecutionResponse Int
pHttpStatus_ =
StartPipelineExecutionResponse' :: Maybe Text -> Int -> StartPipelineExecutionResponse
StartPipelineExecutionResponse'
{ $sel:pipelineExecutionId:StartPipelineExecutionResponse' :: Maybe Text
pipelineExecutionId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartPipelineExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startPipelineExecutionResponse_pipelineExecutionId :: Lens.Lens' StartPipelineExecutionResponse (Prelude.Maybe Prelude.Text)
startPipelineExecutionResponse_pipelineExecutionId :: (Maybe Text -> f (Maybe Text))
-> StartPipelineExecutionResponse
-> f StartPipelineExecutionResponse
startPipelineExecutionResponse_pipelineExecutionId = (StartPipelineExecutionResponse -> Maybe Text)
-> (StartPipelineExecutionResponse
-> Maybe Text -> StartPipelineExecutionResponse)
-> Lens
StartPipelineExecutionResponse
StartPipelineExecutionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPipelineExecutionResponse' {Maybe Text
pipelineExecutionId :: Maybe Text
$sel:pipelineExecutionId:StartPipelineExecutionResponse' :: StartPipelineExecutionResponse -> Maybe Text
pipelineExecutionId} -> Maybe Text
pipelineExecutionId) (\s :: StartPipelineExecutionResponse
s@StartPipelineExecutionResponse' {} Maybe Text
a -> StartPipelineExecutionResponse
s {$sel:pipelineExecutionId:StartPipelineExecutionResponse' :: Maybe Text
pipelineExecutionId = Maybe Text
a} :: StartPipelineExecutionResponse)
startPipelineExecutionResponse_httpStatus :: Lens.Lens' StartPipelineExecutionResponse Prelude.Int
startPipelineExecutionResponse_httpStatus :: (Int -> f Int)
-> StartPipelineExecutionResponse
-> f StartPipelineExecutionResponse
startPipelineExecutionResponse_httpStatus = (StartPipelineExecutionResponse -> Int)
-> (StartPipelineExecutionResponse
-> Int -> StartPipelineExecutionResponse)
-> Lens
StartPipelineExecutionResponse
StartPipelineExecutionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPipelineExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartPipelineExecutionResponse' :: StartPipelineExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartPipelineExecutionResponse
s@StartPipelineExecutionResponse' {} Int
a -> StartPipelineExecutionResponse
s {$sel:httpStatus:StartPipelineExecutionResponse' :: Int
httpStatus = Int
a} :: StartPipelineExecutionResponse)
instance
Prelude.NFData
StartPipelineExecutionResponse