{-# 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.CodeCommit.EvaluatePullRequestApprovalRules
(
EvaluatePullRequestApprovalRules (..),
newEvaluatePullRequestApprovalRules,
evaluatePullRequestApprovalRules_pullRequestId,
evaluatePullRequestApprovalRules_revisionId,
EvaluatePullRequestApprovalRulesResponse (..),
newEvaluatePullRequestApprovalRulesResponse,
evaluatePullRequestApprovalRulesResponse_httpStatus,
evaluatePullRequestApprovalRulesResponse_evaluation,
)
where
import Amazonka.CodeCommit.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 EvaluatePullRequestApprovalRules = EvaluatePullRequestApprovalRules'
{
EvaluatePullRequestApprovalRules -> Text
pullRequestId :: Prelude.Text,
EvaluatePullRequestApprovalRules -> Text
revisionId :: Prelude.Text
}
deriving (EvaluatePullRequestApprovalRules
-> EvaluatePullRequestApprovalRules -> Bool
(EvaluatePullRequestApprovalRules
-> EvaluatePullRequestApprovalRules -> Bool)
-> (EvaluatePullRequestApprovalRules
-> EvaluatePullRequestApprovalRules -> Bool)
-> Eq EvaluatePullRequestApprovalRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EvaluatePullRequestApprovalRules
-> EvaluatePullRequestApprovalRules -> Bool
$c/= :: EvaluatePullRequestApprovalRules
-> EvaluatePullRequestApprovalRules -> Bool
== :: EvaluatePullRequestApprovalRules
-> EvaluatePullRequestApprovalRules -> Bool
$c== :: EvaluatePullRequestApprovalRules
-> EvaluatePullRequestApprovalRules -> Bool
Prelude.Eq, ReadPrec [EvaluatePullRequestApprovalRules]
ReadPrec EvaluatePullRequestApprovalRules
Int -> ReadS EvaluatePullRequestApprovalRules
ReadS [EvaluatePullRequestApprovalRules]
(Int -> ReadS EvaluatePullRequestApprovalRules)
-> ReadS [EvaluatePullRequestApprovalRules]
-> ReadPrec EvaluatePullRequestApprovalRules
-> ReadPrec [EvaluatePullRequestApprovalRules]
-> Read EvaluatePullRequestApprovalRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EvaluatePullRequestApprovalRules]
$creadListPrec :: ReadPrec [EvaluatePullRequestApprovalRules]
readPrec :: ReadPrec EvaluatePullRequestApprovalRules
$creadPrec :: ReadPrec EvaluatePullRequestApprovalRules
readList :: ReadS [EvaluatePullRequestApprovalRules]
$creadList :: ReadS [EvaluatePullRequestApprovalRules]
readsPrec :: Int -> ReadS EvaluatePullRequestApprovalRules
$creadsPrec :: Int -> ReadS EvaluatePullRequestApprovalRules
Prelude.Read, Int -> EvaluatePullRequestApprovalRules -> ShowS
[EvaluatePullRequestApprovalRules] -> ShowS
EvaluatePullRequestApprovalRules -> String
(Int -> EvaluatePullRequestApprovalRules -> ShowS)
-> (EvaluatePullRequestApprovalRules -> String)
-> ([EvaluatePullRequestApprovalRules] -> ShowS)
-> Show EvaluatePullRequestApprovalRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvaluatePullRequestApprovalRules] -> ShowS
$cshowList :: [EvaluatePullRequestApprovalRules] -> ShowS
show :: EvaluatePullRequestApprovalRules -> String
$cshow :: EvaluatePullRequestApprovalRules -> String
showsPrec :: Int -> EvaluatePullRequestApprovalRules -> ShowS
$cshowsPrec :: Int -> EvaluatePullRequestApprovalRules -> ShowS
Prelude.Show, (forall x.
EvaluatePullRequestApprovalRules
-> Rep EvaluatePullRequestApprovalRules x)
-> (forall x.
Rep EvaluatePullRequestApprovalRules x
-> EvaluatePullRequestApprovalRules)
-> Generic EvaluatePullRequestApprovalRules
forall x.
Rep EvaluatePullRequestApprovalRules x
-> EvaluatePullRequestApprovalRules
forall x.
EvaluatePullRequestApprovalRules
-> Rep EvaluatePullRequestApprovalRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EvaluatePullRequestApprovalRules x
-> EvaluatePullRequestApprovalRules
$cfrom :: forall x.
EvaluatePullRequestApprovalRules
-> Rep EvaluatePullRequestApprovalRules x
Prelude.Generic)
newEvaluatePullRequestApprovalRules ::
Prelude.Text ->
Prelude.Text ->
EvaluatePullRequestApprovalRules
newEvaluatePullRequestApprovalRules :: Text -> Text -> EvaluatePullRequestApprovalRules
newEvaluatePullRequestApprovalRules
Text
pPullRequestId_
Text
pRevisionId_ =
EvaluatePullRequestApprovalRules' :: Text -> Text -> EvaluatePullRequestApprovalRules
EvaluatePullRequestApprovalRules'
{ $sel:pullRequestId:EvaluatePullRequestApprovalRules' :: Text
pullRequestId =
Text
pPullRequestId_,
$sel:revisionId:EvaluatePullRequestApprovalRules' :: Text
revisionId = Text
pRevisionId_
}
evaluatePullRequestApprovalRules_pullRequestId :: Lens.Lens' EvaluatePullRequestApprovalRules Prelude.Text
evaluatePullRequestApprovalRules_pullRequestId :: (Text -> f Text)
-> EvaluatePullRequestApprovalRules
-> f EvaluatePullRequestApprovalRules
evaluatePullRequestApprovalRules_pullRequestId = (EvaluatePullRequestApprovalRules -> Text)
-> (EvaluatePullRequestApprovalRules
-> Text -> EvaluatePullRequestApprovalRules)
-> Lens
EvaluatePullRequestApprovalRules
EvaluatePullRequestApprovalRules
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluatePullRequestApprovalRules' {Text
pullRequestId :: Text
$sel:pullRequestId:EvaluatePullRequestApprovalRules' :: EvaluatePullRequestApprovalRules -> Text
pullRequestId} -> Text
pullRequestId) (\s :: EvaluatePullRequestApprovalRules
s@EvaluatePullRequestApprovalRules' {} Text
a -> EvaluatePullRequestApprovalRules
s {$sel:pullRequestId:EvaluatePullRequestApprovalRules' :: Text
pullRequestId = Text
a} :: EvaluatePullRequestApprovalRules)
evaluatePullRequestApprovalRules_revisionId :: Lens.Lens' EvaluatePullRequestApprovalRules Prelude.Text
evaluatePullRequestApprovalRules_revisionId :: (Text -> f Text)
-> EvaluatePullRequestApprovalRules
-> f EvaluatePullRequestApprovalRules
evaluatePullRequestApprovalRules_revisionId = (EvaluatePullRequestApprovalRules -> Text)
-> (EvaluatePullRequestApprovalRules
-> Text -> EvaluatePullRequestApprovalRules)
-> Lens
EvaluatePullRequestApprovalRules
EvaluatePullRequestApprovalRules
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluatePullRequestApprovalRules' {Text
revisionId :: Text
$sel:revisionId:EvaluatePullRequestApprovalRules' :: EvaluatePullRequestApprovalRules -> Text
revisionId} -> Text
revisionId) (\s :: EvaluatePullRequestApprovalRules
s@EvaluatePullRequestApprovalRules' {} Text
a -> EvaluatePullRequestApprovalRules
s {$sel:revisionId:EvaluatePullRequestApprovalRules' :: Text
revisionId = Text
a} :: EvaluatePullRequestApprovalRules)
instance
Core.AWSRequest
EvaluatePullRequestApprovalRules
where
type
AWSResponse EvaluatePullRequestApprovalRules =
EvaluatePullRequestApprovalRulesResponse
request :: EvaluatePullRequestApprovalRules
-> Request EvaluatePullRequestApprovalRules
request = Service
-> EvaluatePullRequestApprovalRules
-> Request EvaluatePullRequestApprovalRules
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy EvaluatePullRequestApprovalRules
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse EvaluatePullRequestApprovalRules)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse EvaluatePullRequestApprovalRules))
-> Logger
-> Service
-> Proxy EvaluatePullRequestApprovalRules
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse EvaluatePullRequestApprovalRules)))
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 ->
Int -> Evaluation -> EvaluatePullRequestApprovalRulesResponse
EvaluatePullRequestApprovalRulesResponse'
(Int -> Evaluation -> EvaluatePullRequestApprovalRulesResponse)
-> Either String Int
-> Either
String (Evaluation -> EvaluatePullRequestApprovalRulesResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String (Evaluation -> EvaluatePullRequestApprovalRulesResponse)
-> Either String Evaluation
-> Either String EvaluatePullRequestApprovalRulesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Evaluation
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"evaluation")
)
instance
Prelude.Hashable
EvaluatePullRequestApprovalRules
instance
Prelude.NFData
EvaluatePullRequestApprovalRules
instance
Core.ToHeaders
EvaluatePullRequestApprovalRules
where
toHeaders :: EvaluatePullRequestApprovalRules -> ResponseHeaders
toHeaders =
ResponseHeaders
-> EvaluatePullRequestApprovalRules -> 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
"CodeCommit_20150413.EvaluatePullRequestApprovalRules" ::
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 EvaluatePullRequestApprovalRules where
toJSON :: EvaluatePullRequestApprovalRules -> Value
toJSON EvaluatePullRequestApprovalRules' {Text
revisionId :: Text
pullRequestId :: Text
$sel:revisionId:EvaluatePullRequestApprovalRules' :: EvaluatePullRequestApprovalRules -> Text
$sel:pullRequestId:EvaluatePullRequestApprovalRules' :: EvaluatePullRequestApprovalRules -> 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
"pullRequestId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pullRequestId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"revisionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
revisionId)
]
)
instance Core.ToPath EvaluatePullRequestApprovalRules where
toPath :: EvaluatePullRequestApprovalRules -> ByteString
toPath = ByteString -> EvaluatePullRequestApprovalRules -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance
Core.ToQuery
EvaluatePullRequestApprovalRules
where
toQuery :: EvaluatePullRequestApprovalRules -> QueryString
toQuery = QueryString -> EvaluatePullRequestApprovalRules -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data EvaluatePullRequestApprovalRulesResponse = EvaluatePullRequestApprovalRulesResponse'
{
EvaluatePullRequestApprovalRulesResponse -> Int
httpStatus :: Prelude.Int,
EvaluatePullRequestApprovalRulesResponse -> Evaluation
evaluation :: Evaluation
}
deriving (EvaluatePullRequestApprovalRulesResponse
-> EvaluatePullRequestApprovalRulesResponse -> Bool
(EvaluatePullRequestApprovalRulesResponse
-> EvaluatePullRequestApprovalRulesResponse -> Bool)
-> (EvaluatePullRequestApprovalRulesResponse
-> EvaluatePullRequestApprovalRulesResponse -> Bool)
-> Eq EvaluatePullRequestApprovalRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EvaluatePullRequestApprovalRulesResponse
-> EvaluatePullRequestApprovalRulesResponse -> Bool
$c/= :: EvaluatePullRequestApprovalRulesResponse
-> EvaluatePullRequestApprovalRulesResponse -> Bool
== :: EvaluatePullRequestApprovalRulesResponse
-> EvaluatePullRequestApprovalRulesResponse -> Bool
$c== :: EvaluatePullRequestApprovalRulesResponse
-> EvaluatePullRequestApprovalRulesResponse -> Bool
Prelude.Eq, ReadPrec [EvaluatePullRequestApprovalRulesResponse]
ReadPrec EvaluatePullRequestApprovalRulesResponse
Int -> ReadS EvaluatePullRequestApprovalRulesResponse
ReadS [EvaluatePullRequestApprovalRulesResponse]
(Int -> ReadS EvaluatePullRequestApprovalRulesResponse)
-> ReadS [EvaluatePullRequestApprovalRulesResponse]
-> ReadPrec EvaluatePullRequestApprovalRulesResponse
-> ReadPrec [EvaluatePullRequestApprovalRulesResponse]
-> Read EvaluatePullRequestApprovalRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EvaluatePullRequestApprovalRulesResponse]
$creadListPrec :: ReadPrec [EvaluatePullRequestApprovalRulesResponse]
readPrec :: ReadPrec EvaluatePullRequestApprovalRulesResponse
$creadPrec :: ReadPrec EvaluatePullRequestApprovalRulesResponse
readList :: ReadS [EvaluatePullRequestApprovalRulesResponse]
$creadList :: ReadS [EvaluatePullRequestApprovalRulesResponse]
readsPrec :: Int -> ReadS EvaluatePullRequestApprovalRulesResponse
$creadsPrec :: Int -> ReadS EvaluatePullRequestApprovalRulesResponse
Prelude.Read, Int -> EvaluatePullRequestApprovalRulesResponse -> ShowS
[EvaluatePullRequestApprovalRulesResponse] -> ShowS
EvaluatePullRequestApprovalRulesResponse -> String
(Int -> EvaluatePullRequestApprovalRulesResponse -> ShowS)
-> (EvaluatePullRequestApprovalRulesResponse -> String)
-> ([EvaluatePullRequestApprovalRulesResponse] -> ShowS)
-> Show EvaluatePullRequestApprovalRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvaluatePullRequestApprovalRulesResponse] -> ShowS
$cshowList :: [EvaluatePullRequestApprovalRulesResponse] -> ShowS
show :: EvaluatePullRequestApprovalRulesResponse -> String
$cshow :: EvaluatePullRequestApprovalRulesResponse -> String
showsPrec :: Int -> EvaluatePullRequestApprovalRulesResponse -> ShowS
$cshowsPrec :: Int -> EvaluatePullRequestApprovalRulesResponse -> ShowS
Prelude.Show, (forall x.
EvaluatePullRequestApprovalRulesResponse
-> Rep EvaluatePullRequestApprovalRulesResponse x)
-> (forall x.
Rep EvaluatePullRequestApprovalRulesResponse x
-> EvaluatePullRequestApprovalRulesResponse)
-> Generic EvaluatePullRequestApprovalRulesResponse
forall x.
Rep EvaluatePullRequestApprovalRulesResponse x
-> EvaluatePullRequestApprovalRulesResponse
forall x.
EvaluatePullRequestApprovalRulesResponse
-> Rep EvaluatePullRequestApprovalRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EvaluatePullRequestApprovalRulesResponse x
-> EvaluatePullRequestApprovalRulesResponse
$cfrom :: forall x.
EvaluatePullRequestApprovalRulesResponse
-> Rep EvaluatePullRequestApprovalRulesResponse x
Prelude.Generic)
newEvaluatePullRequestApprovalRulesResponse ::
Prelude.Int ->
Evaluation ->
EvaluatePullRequestApprovalRulesResponse
newEvaluatePullRequestApprovalRulesResponse :: Int -> Evaluation -> EvaluatePullRequestApprovalRulesResponse
newEvaluatePullRequestApprovalRulesResponse
Int
pHttpStatus_
Evaluation
pEvaluation_ =
EvaluatePullRequestApprovalRulesResponse' :: Int -> Evaluation -> EvaluatePullRequestApprovalRulesResponse
EvaluatePullRequestApprovalRulesResponse'
{ $sel:httpStatus:EvaluatePullRequestApprovalRulesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:evaluation:EvaluatePullRequestApprovalRulesResponse' :: Evaluation
evaluation = Evaluation
pEvaluation_
}
evaluatePullRequestApprovalRulesResponse_httpStatus :: Lens.Lens' EvaluatePullRequestApprovalRulesResponse Prelude.Int
evaluatePullRequestApprovalRulesResponse_httpStatus :: (Int -> f Int)
-> EvaluatePullRequestApprovalRulesResponse
-> f EvaluatePullRequestApprovalRulesResponse
evaluatePullRequestApprovalRulesResponse_httpStatus = (EvaluatePullRequestApprovalRulesResponse -> Int)
-> (EvaluatePullRequestApprovalRulesResponse
-> Int -> EvaluatePullRequestApprovalRulesResponse)
-> Lens
EvaluatePullRequestApprovalRulesResponse
EvaluatePullRequestApprovalRulesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluatePullRequestApprovalRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:EvaluatePullRequestApprovalRulesResponse' :: EvaluatePullRequestApprovalRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: EvaluatePullRequestApprovalRulesResponse
s@EvaluatePullRequestApprovalRulesResponse' {} Int
a -> EvaluatePullRequestApprovalRulesResponse
s {$sel:httpStatus:EvaluatePullRequestApprovalRulesResponse' :: Int
httpStatus = Int
a} :: EvaluatePullRequestApprovalRulesResponse)
evaluatePullRequestApprovalRulesResponse_evaluation :: Lens.Lens' EvaluatePullRequestApprovalRulesResponse Evaluation
evaluatePullRequestApprovalRulesResponse_evaluation :: (Evaluation -> f Evaluation)
-> EvaluatePullRequestApprovalRulesResponse
-> f EvaluatePullRequestApprovalRulesResponse
evaluatePullRequestApprovalRulesResponse_evaluation = (EvaluatePullRequestApprovalRulesResponse -> Evaluation)
-> (EvaluatePullRequestApprovalRulesResponse
-> Evaluation -> EvaluatePullRequestApprovalRulesResponse)
-> Lens
EvaluatePullRequestApprovalRulesResponse
EvaluatePullRequestApprovalRulesResponse
Evaluation
Evaluation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluatePullRequestApprovalRulesResponse' {Evaluation
evaluation :: Evaluation
$sel:evaluation:EvaluatePullRequestApprovalRulesResponse' :: EvaluatePullRequestApprovalRulesResponse -> Evaluation
evaluation} -> Evaluation
evaluation) (\s :: EvaluatePullRequestApprovalRulesResponse
s@EvaluatePullRequestApprovalRulesResponse' {} Evaluation
a -> EvaluatePullRequestApprovalRulesResponse
s {$sel:evaluation:EvaluatePullRequestApprovalRulesResponse' :: Evaluation
evaluation = Evaluation
a} :: EvaluatePullRequestApprovalRulesResponse)
instance
Prelude.NFData
EvaluatePullRequestApprovalRulesResponse