{-# 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.PutApprovalResult
(
PutApprovalResult (..),
newPutApprovalResult,
putApprovalResult_pipelineName,
putApprovalResult_stageName,
putApprovalResult_actionName,
putApprovalResult_result,
putApprovalResult_token,
PutApprovalResultResponse (..),
newPutApprovalResultResponse,
putApprovalResultResponse_approvedAt,
putApprovalResultResponse_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 PutApprovalResult = PutApprovalResult'
{
PutApprovalResult -> Text
pipelineName :: Prelude.Text,
PutApprovalResult -> Text
stageName :: Prelude.Text,
PutApprovalResult -> Text
actionName :: Prelude.Text,
PutApprovalResult -> ApprovalResult
result :: ApprovalResult,
PutApprovalResult -> Text
token :: Prelude.Text
}
deriving (PutApprovalResult -> PutApprovalResult -> Bool
(PutApprovalResult -> PutApprovalResult -> Bool)
-> (PutApprovalResult -> PutApprovalResult -> Bool)
-> Eq PutApprovalResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutApprovalResult -> PutApprovalResult -> Bool
$c/= :: PutApprovalResult -> PutApprovalResult -> Bool
== :: PutApprovalResult -> PutApprovalResult -> Bool
$c== :: PutApprovalResult -> PutApprovalResult -> Bool
Prelude.Eq, ReadPrec [PutApprovalResult]
ReadPrec PutApprovalResult
Int -> ReadS PutApprovalResult
ReadS [PutApprovalResult]
(Int -> ReadS PutApprovalResult)
-> ReadS [PutApprovalResult]
-> ReadPrec PutApprovalResult
-> ReadPrec [PutApprovalResult]
-> Read PutApprovalResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutApprovalResult]
$creadListPrec :: ReadPrec [PutApprovalResult]
readPrec :: ReadPrec PutApprovalResult
$creadPrec :: ReadPrec PutApprovalResult
readList :: ReadS [PutApprovalResult]
$creadList :: ReadS [PutApprovalResult]
readsPrec :: Int -> ReadS PutApprovalResult
$creadsPrec :: Int -> ReadS PutApprovalResult
Prelude.Read, Int -> PutApprovalResult -> ShowS
[PutApprovalResult] -> ShowS
PutApprovalResult -> String
(Int -> PutApprovalResult -> ShowS)
-> (PutApprovalResult -> String)
-> ([PutApprovalResult] -> ShowS)
-> Show PutApprovalResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutApprovalResult] -> ShowS
$cshowList :: [PutApprovalResult] -> ShowS
show :: PutApprovalResult -> String
$cshow :: PutApprovalResult -> String
showsPrec :: Int -> PutApprovalResult -> ShowS
$cshowsPrec :: Int -> PutApprovalResult -> ShowS
Prelude.Show, (forall x. PutApprovalResult -> Rep PutApprovalResult x)
-> (forall x. Rep PutApprovalResult x -> PutApprovalResult)
-> Generic PutApprovalResult
forall x. Rep PutApprovalResult x -> PutApprovalResult
forall x. PutApprovalResult -> Rep PutApprovalResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutApprovalResult x -> PutApprovalResult
$cfrom :: forall x. PutApprovalResult -> Rep PutApprovalResult x
Prelude.Generic)
newPutApprovalResult ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ApprovalResult ->
Prelude.Text ->
PutApprovalResult
newPutApprovalResult :: Text -> Text -> Text -> ApprovalResult -> Text -> PutApprovalResult
newPutApprovalResult
Text
pPipelineName_
Text
pStageName_
Text
pActionName_
ApprovalResult
pResult_
Text
pToken_ =
PutApprovalResult' :: Text -> Text -> Text -> ApprovalResult -> Text -> PutApprovalResult
PutApprovalResult'
{ $sel:pipelineName:PutApprovalResult' :: Text
pipelineName = Text
pPipelineName_,
$sel:stageName:PutApprovalResult' :: Text
stageName = Text
pStageName_,
$sel:actionName:PutApprovalResult' :: Text
actionName = Text
pActionName_,
$sel:result:PutApprovalResult' :: ApprovalResult
result = ApprovalResult
pResult_,
$sel:token:PutApprovalResult' :: Text
token = Text
pToken_
}
putApprovalResult_pipelineName :: Lens.Lens' PutApprovalResult Prelude.Text
putApprovalResult_pipelineName :: (Text -> f Text) -> PutApprovalResult -> f PutApprovalResult
putApprovalResult_pipelineName = (PutApprovalResult -> Text)
-> (PutApprovalResult -> Text -> PutApprovalResult)
-> Lens PutApprovalResult PutApprovalResult Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutApprovalResult' {Text
pipelineName :: Text
$sel:pipelineName:PutApprovalResult' :: PutApprovalResult -> Text
pipelineName} -> Text
pipelineName) (\s :: PutApprovalResult
s@PutApprovalResult' {} Text
a -> PutApprovalResult
s {$sel:pipelineName:PutApprovalResult' :: Text
pipelineName = Text
a} :: PutApprovalResult)
putApprovalResult_stageName :: Lens.Lens' PutApprovalResult Prelude.Text
putApprovalResult_stageName :: (Text -> f Text) -> PutApprovalResult -> f PutApprovalResult
putApprovalResult_stageName = (PutApprovalResult -> Text)
-> (PutApprovalResult -> Text -> PutApprovalResult)
-> Lens PutApprovalResult PutApprovalResult Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutApprovalResult' {Text
stageName :: Text
$sel:stageName:PutApprovalResult' :: PutApprovalResult -> Text
stageName} -> Text
stageName) (\s :: PutApprovalResult
s@PutApprovalResult' {} Text
a -> PutApprovalResult
s {$sel:stageName:PutApprovalResult' :: Text
stageName = Text
a} :: PutApprovalResult)
putApprovalResult_actionName :: Lens.Lens' PutApprovalResult Prelude.Text
putApprovalResult_actionName :: (Text -> f Text) -> PutApprovalResult -> f PutApprovalResult
putApprovalResult_actionName = (PutApprovalResult -> Text)
-> (PutApprovalResult -> Text -> PutApprovalResult)
-> Lens PutApprovalResult PutApprovalResult Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutApprovalResult' {Text
actionName :: Text
$sel:actionName:PutApprovalResult' :: PutApprovalResult -> Text
actionName} -> Text
actionName) (\s :: PutApprovalResult
s@PutApprovalResult' {} Text
a -> PutApprovalResult
s {$sel:actionName:PutApprovalResult' :: Text
actionName = Text
a} :: PutApprovalResult)
putApprovalResult_result :: Lens.Lens' PutApprovalResult ApprovalResult
putApprovalResult_result :: (ApprovalResult -> f ApprovalResult)
-> PutApprovalResult -> f PutApprovalResult
putApprovalResult_result = (PutApprovalResult -> ApprovalResult)
-> (PutApprovalResult -> ApprovalResult -> PutApprovalResult)
-> Lens
PutApprovalResult PutApprovalResult ApprovalResult ApprovalResult
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutApprovalResult' {ApprovalResult
result :: ApprovalResult
$sel:result:PutApprovalResult' :: PutApprovalResult -> ApprovalResult
result} -> ApprovalResult
result) (\s :: PutApprovalResult
s@PutApprovalResult' {} ApprovalResult
a -> PutApprovalResult
s {$sel:result:PutApprovalResult' :: ApprovalResult
result = ApprovalResult
a} :: PutApprovalResult)
putApprovalResult_token :: Lens.Lens' PutApprovalResult Prelude.Text
putApprovalResult_token :: (Text -> f Text) -> PutApprovalResult -> f PutApprovalResult
putApprovalResult_token = (PutApprovalResult -> Text)
-> (PutApprovalResult -> Text -> PutApprovalResult)
-> Lens PutApprovalResult PutApprovalResult Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutApprovalResult' {Text
token :: Text
$sel:token:PutApprovalResult' :: PutApprovalResult -> Text
token} -> Text
token) (\s :: PutApprovalResult
s@PutApprovalResult' {} Text
a -> PutApprovalResult
s {$sel:token:PutApprovalResult' :: Text
token = Text
a} :: PutApprovalResult)
instance Core.AWSRequest PutApprovalResult where
type
AWSResponse PutApprovalResult =
PutApprovalResultResponse
request :: PutApprovalResult -> Request PutApprovalResult
request = Service -> PutApprovalResult -> Request PutApprovalResult
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutApprovalResult
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutApprovalResult)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutApprovalResult))
-> Logger
-> Service
-> Proxy PutApprovalResult
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutApprovalResult)))
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 POSIX -> Int -> PutApprovalResultResponse
PutApprovalResultResponse'
(Maybe POSIX -> Int -> PutApprovalResultResponse)
-> Either String (Maybe POSIX)
-> Either String (Int -> PutApprovalResultResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"approvedAt")
Either String (Int -> PutApprovalResultResponse)
-> Either String Int -> Either String PutApprovalResultResponse
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 PutApprovalResult
instance Prelude.NFData PutApprovalResult
instance Core.ToHeaders PutApprovalResult where
toHeaders :: PutApprovalResult -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutApprovalResult -> 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.PutApprovalResult" ::
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 PutApprovalResult where
toJSON :: PutApprovalResult -> Value
toJSON PutApprovalResult' {Text
ApprovalResult
token :: Text
result :: ApprovalResult
actionName :: Text
stageName :: Text
pipelineName :: Text
$sel:token:PutApprovalResult' :: PutApprovalResult -> Text
$sel:result:PutApprovalResult' :: PutApprovalResult -> ApprovalResult
$sel:actionName:PutApprovalResult' :: PutApprovalResult -> Text
$sel:stageName:PutApprovalResult' :: PutApprovalResult -> Text
$sel:pipelineName:PutApprovalResult' :: PutApprovalResult -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"pipelineName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pipelineName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"stageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stageName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"actionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
actionName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"result" Text -> ApprovalResult -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApprovalResult
result),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"token" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
token)
]
)
instance Core.ToPath PutApprovalResult where
toPath :: PutApprovalResult -> ByteString
toPath = ByteString -> PutApprovalResult -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutApprovalResult where
toQuery :: PutApprovalResult -> QueryString
toQuery = QueryString -> PutApprovalResult -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutApprovalResultResponse = PutApprovalResultResponse'
{
PutApprovalResultResponse -> Maybe POSIX
approvedAt :: Prelude.Maybe Core.POSIX,
PutApprovalResultResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutApprovalResultResponse -> PutApprovalResultResponse -> Bool
(PutApprovalResultResponse -> PutApprovalResultResponse -> Bool)
-> (PutApprovalResultResponse -> PutApprovalResultResponse -> Bool)
-> Eq PutApprovalResultResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutApprovalResultResponse -> PutApprovalResultResponse -> Bool
$c/= :: PutApprovalResultResponse -> PutApprovalResultResponse -> Bool
== :: PutApprovalResultResponse -> PutApprovalResultResponse -> Bool
$c== :: PutApprovalResultResponse -> PutApprovalResultResponse -> Bool
Prelude.Eq, ReadPrec [PutApprovalResultResponse]
ReadPrec PutApprovalResultResponse
Int -> ReadS PutApprovalResultResponse
ReadS [PutApprovalResultResponse]
(Int -> ReadS PutApprovalResultResponse)
-> ReadS [PutApprovalResultResponse]
-> ReadPrec PutApprovalResultResponse
-> ReadPrec [PutApprovalResultResponse]
-> Read PutApprovalResultResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutApprovalResultResponse]
$creadListPrec :: ReadPrec [PutApprovalResultResponse]
readPrec :: ReadPrec PutApprovalResultResponse
$creadPrec :: ReadPrec PutApprovalResultResponse
readList :: ReadS [PutApprovalResultResponse]
$creadList :: ReadS [PutApprovalResultResponse]
readsPrec :: Int -> ReadS PutApprovalResultResponse
$creadsPrec :: Int -> ReadS PutApprovalResultResponse
Prelude.Read, Int -> PutApprovalResultResponse -> ShowS
[PutApprovalResultResponse] -> ShowS
PutApprovalResultResponse -> String
(Int -> PutApprovalResultResponse -> ShowS)
-> (PutApprovalResultResponse -> String)
-> ([PutApprovalResultResponse] -> ShowS)
-> Show PutApprovalResultResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutApprovalResultResponse] -> ShowS
$cshowList :: [PutApprovalResultResponse] -> ShowS
show :: PutApprovalResultResponse -> String
$cshow :: PutApprovalResultResponse -> String
showsPrec :: Int -> PutApprovalResultResponse -> ShowS
$cshowsPrec :: Int -> PutApprovalResultResponse -> ShowS
Prelude.Show, (forall x.
PutApprovalResultResponse -> Rep PutApprovalResultResponse x)
-> (forall x.
Rep PutApprovalResultResponse x -> PutApprovalResultResponse)
-> Generic PutApprovalResultResponse
forall x.
Rep PutApprovalResultResponse x -> PutApprovalResultResponse
forall x.
PutApprovalResultResponse -> Rep PutApprovalResultResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutApprovalResultResponse x -> PutApprovalResultResponse
$cfrom :: forall x.
PutApprovalResultResponse -> Rep PutApprovalResultResponse x
Prelude.Generic)
newPutApprovalResultResponse ::
Prelude.Int ->
PutApprovalResultResponse
newPutApprovalResultResponse :: Int -> PutApprovalResultResponse
newPutApprovalResultResponse Int
pHttpStatus_ =
PutApprovalResultResponse' :: Maybe POSIX -> Int -> PutApprovalResultResponse
PutApprovalResultResponse'
{ $sel:approvedAt:PutApprovalResultResponse' :: Maybe POSIX
approvedAt =
Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutApprovalResultResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putApprovalResultResponse_approvedAt :: Lens.Lens' PutApprovalResultResponse (Prelude.Maybe Prelude.UTCTime)
putApprovalResultResponse_approvedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PutApprovalResultResponse -> f PutApprovalResultResponse
putApprovalResultResponse_approvedAt = (PutApprovalResultResponse -> Maybe POSIX)
-> (PutApprovalResultResponse
-> Maybe POSIX -> PutApprovalResultResponse)
-> Lens
PutApprovalResultResponse
PutApprovalResultResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutApprovalResultResponse' {Maybe POSIX
approvedAt :: Maybe POSIX
$sel:approvedAt:PutApprovalResultResponse' :: PutApprovalResultResponse -> Maybe POSIX
approvedAt} -> Maybe POSIX
approvedAt) (\s :: PutApprovalResultResponse
s@PutApprovalResultResponse' {} Maybe POSIX
a -> PutApprovalResultResponse
s {$sel:approvedAt:PutApprovalResultResponse' :: Maybe POSIX
approvedAt = Maybe POSIX
a} :: PutApprovalResultResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> PutApprovalResultResponse -> f PutApprovalResultResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PutApprovalResultResponse
-> f PutApprovalResultResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
putApprovalResultResponse_httpStatus :: Lens.Lens' PutApprovalResultResponse Prelude.Int
putApprovalResultResponse_httpStatus :: (Int -> f Int)
-> PutApprovalResultResponse -> f PutApprovalResultResponse
putApprovalResultResponse_httpStatus = (PutApprovalResultResponse -> Int)
-> (PutApprovalResultResponse -> Int -> PutApprovalResultResponse)
-> Lens PutApprovalResultResponse PutApprovalResultResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutApprovalResultResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutApprovalResultResponse' :: PutApprovalResultResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutApprovalResultResponse
s@PutApprovalResultResponse' {} Int
a -> PutApprovalResultResponse
s {$sel:httpStatus:PutApprovalResultResponse' :: Int
httpStatus = Int
a} :: PutApprovalResultResponse)
instance Prelude.NFData PutApprovalResultResponse