{-# 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.GetPullRequestApprovalStates
(
GetPullRequestApprovalStates (..),
newGetPullRequestApprovalStates,
getPullRequestApprovalStates_pullRequestId,
getPullRequestApprovalStates_revisionId,
GetPullRequestApprovalStatesResponse (..),
newGetPullRequestApprovalStatesResponse,
getPullRequestApprovalStatesResponse_approvals,
getPullRequestApprovalStatesResponse_httpStatus,
)
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 GetPullRequestApprovalStates = GetPullRequestApprovalStates'
{
GetPullRequestApprovalStates -> Text
pullRequestId :: Prelude.Text,
GetPullRequestApprovalStates -> Text
revisionId :: Prelude.Text
}
deriving (GetPullRequestApprovalStates
-> GetPullRequestApprovalStates -> Bool
(GetPullRequestApprovalStates
-> GetPullRequestApprovalStates -> Bool)
-> (GetPullRequestApprovalStates
-> GetPullRequestApprovalStates -> Bool)
-> Eq GetPullRequestApprovalStates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPullRequestApprovalStates
-> GetPullRequestApprovalStates -> Bool
$c/= :: GetPullRequestApprovalStates
-> GetPullRequestApprovalStates -> Bool
== :: GetPullRequestApprovalStates
-> GetPullRequestApprovalStates -> Bool
$c== :: GetPullRequestApprovalStates
-> GetPullRequestApprovalStates -> Bool
Prelude.Eq, ReadPrec [GetPullRequestApprovalStates]
ReadPrec GetPullRequestApprovalStates
Int -> ReadS GetPullRequestApprovalStates
ReadS [GetPullRequestApprovalStates]
(Int -> ReadS GetPullRequestApprovalStates)
-> ReadS [GetPullRequestApprovalStates]
-> ReadPrec GetPullRequestApprovalStates
-> ReadPrec [GetPullRequestApprovalStates]
-> Read GetPullRequestApprovalStates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPullRequestApprovalStates]
$creadListPrec :: ReadPrec [GetPullRequestApprovalStates]
readPrec :: ReadPrec GetPullRequestApprovalStates
$creadPrec :: ReadPrec GetPullRequestApprovalStates
readList :: ReadS [GetPullRequestApprovalStates]
$creadList :: ReadS [GetPullRequestApprovalStates]
readsPrec :: Int -> ReadS GetPullRequestApprovalStates
$creadsPrec :: Int -> ReadS GetPullRequestApprovalStates
Prelude.Read, Int -> GetPullRequestApprovalStates -> ShowS
[GetPullRequestApprovalStates] -> ShowS
GetPullRequestApprovalStates -> String
(Int -> GetPullRequestApprovalStates -> ShowS)
-> (GetPullRequestApprovalStates -> String)
-> ([GetPullRequestApprovalStates] -> ShowS)
-> Show GetPullRequestApprovalStates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPullRequestApprovalStates] -> ShowS
$cshowList :: [GetPullRequestApprovalStates] -> ShowS
show :: GetPullRequestApprovalStates -> String
$cshow :: GetPullRequestApprovalStates -> String
showsPrec :: Int -> GetPullRequestApprovalStates -> ShowS
$cshowsPrec :: Int -> GetPullRequestApprovalStates -> ShowS
Prelude.Show, (forall x.
GetPullRequestApprovalStates -> Rep GetPullRequestApprovalStates x)
-> (forall x.
Rep GetPullRequestApprovalStates x -> GetPullRequestApprovalStates)
-> Generic GetPullRequestApprovalStates
forall x.
Rep GetPullRequestApprovalStates x -> GetPullRequestApprovalStates
forall x.
GetPullRequestApprovalStates -> Rep GetPullRequestApprovalStates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetPullRequestApprovalStates x -> GetPullRequestApprovalStates
$cfrom :: forall x.
GetPullRequestApprovalStates -> Rep GetPullRequestApprovalStates x
Prelude.Generic)
newGetPullRequestApprovalStates ::
Prelude.Text ->
Prelude.Text ->
GetPullRequestApprovalStates
newGetPullRequestApprovalStates :: Text -> Text -> GetPullRequestApprovalStates
newGetPullRequestApprovalStates
Text
pPullRequestId_
Text
pRevisionId_ =
GetPullRequestApprovalStates' :: Text -> Text -> GetPullRequestApprovalStates
GetPullRequestApprovalStates'
{ $sel:pullRequestId:GetPullRequestApprovalStates' :: Text
pullRequestId =
Text
pPullRequestId_,
$sel:revisionId:GetPullRequestApprovalStates' :: Text
revisionId = Text
pRevisionId_
}
getPullRequestApprovalStates_pullRequestId :: Lens.Lens' GetPullRequestApprovalStates Prelude.Text
getPullRequestApprovalStates_pullRequestId :: (Text -> f Text)
-> GetPullRequestApprovalStates -> f GetPullRequestApprovalStates
getPullRequestApprovalStates_pullRequestId = (GetPullRequestApprovalStates -> Text)
-> (GetPullRequestApprovalStates
-> Text -> GetPullRequestApprovalStates)
-> Lens
GetPullRequestApprovalStates GetPullRequestApprovalStates Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPullRequestApprovalStates' {Text
pullRequestId :: Text
$sel:pullRequestId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> Text
pullRequestId} -> Text
pullRequestId) (\s :: GetPullRequestApprovalStates
s@GetPullRequestApprovalStates' {} Text
a -> GetPullRequestApprovalStates
s {$sel:pullRequestId:GetPullRequestApprovalStates' :: Text
pullRequestId = Text
a} :: GetPullRequestApprovalStates)
getPullRequestApprovalStates_revisionId :: Lens.Lens' GetPullRequestApprovalStates Prelude.Text
getPullRequestApprovalStates_revisionId :: (Text -> f Text)
-> GetPullRequestApprovalStates -> f GetPullRequestApprovalStates
getPullRequestApprovalStates_revisionId = (GetPullRequestApprovalStates -> Text)
-> (GetPullRequestApprovalStates
-> Text -> GetPullRequestApprovalStates)
-> Lens
GetPullRequestApprovalStates GetPullRequestApprovalStates Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPullRequestApprovalStates' {Text
revisionId :: Text
$sel:revisionId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> Text
revisionId} -> Text
revisionId) (\s :: GetPullRequestApprovalStates
s@GetPullRequestApprovalStates' {} Text
a -> GetPullRequestApprovalStates
s {$sel:revisionId:GetPullRequestApprovalStates' :: Text
revisionId = Text
a} :: GetPullRequestApprovalStates)
instance Core.AWSRequest GetPullRequestApprovalStates where
type
AWSResponse GetPullRequestApprovalStates =
GetPullRequestApprovalStatesResponse
request :: GetPullRequestApprovalStates
-> Request GetPullRequestApprovalStates
request = Service
-> GetPullRequestApprovalStates
-> Request GetPullRequestApprovalStates
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetPullRequestApprovalStates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetPullRequestApprovalStates)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetPullRequestApprovalStates))
-> Logger
-> Service
-> Proxy GetPullRequestApprovalStates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetPullRequestApprovalStates)))
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 [Approval] -> Int -> GetPullRequestApprovalStatesResponse
GetPullRequestApprovalStatesResponse'
(Maybe [Approval] -> Int -> GetPullRequestApprovalStatesResponse)
-> Either String (Maybe [Approval])
-> Either String (Int -> GetPullRequestApprovalStatesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Approval]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"approvals" Either String (Maybe (Maybe [Approval]))
-> Maybe [Approval] -> Either String (Maybe [Approval])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Approval]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetPullRequestApprovalStatesResponse)
-> Either String Int
-> Either String GetPullRequestApprovalStatesResponse
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
GetPullRequestApprovalStates
instance Prelude.NFData GetPullRequestApprovalStates
instance Core.ToHeaders GetPullRequestApprovalStates where
toHeaders :: GetPullRequestApprovalStates -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetPullRequestApprovalStates -> 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.GetPullRequestApprovalStates" ::
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 GetPullRequestApprovalStates where
toJSON :: GetPullRequestApprovalStates -> Value
toJSON GetPullRequestApprovalStates' {Text
revisionId :: Text
pullRequestId :: Text
$sel:revisionId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> Text
$sel:pullRequestId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> 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 GetPullRequestApprovalStates where
toPath :: GetPullRequestApprovalStates -> ByteString
toPath = ByteString -> GetPullRequestApprovalStates -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetPullRequestApprovalStates where
toQuery :: GetPullRequestApprovalStates -> QueryString
toQuery = QueryString -> GetPullRequestApprovalStates -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetPullRequestApprovalStatesResponse = GetPullRequestApprovalStatesResponse'
{
GetPullRequestApprovalStatesResponse -> Maybe [Approval]
approvals :: Prelude.Maybe [Approval],
GetPullRequestApprovalStatesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPullRequestApprovalStatesResponse
-> GetPullRequestApprovalStatesResponse -> Bool
(GetPullRequestApprovalStatesResponse
-> GetPullRequestApprovalStatesResponse -> Bool)
-> (GetPullRequestApprovalStatesResponse
-> GetPullRequestApprovalStatesResponse -> Bool)
-> Eq GetPullRequestApprovalStatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPullRequestApprovalStatesResponse
-> GetPullRequestApprovalStatesResponse -> Bool
$c/= :: GetPullRequestApprovalStatesResponse
-> GetPullRequestApprovalStatesResponse -> Bool
== :: GetPullRequestApprovalStatesResponse
-> GetPullRequestApprovalStatesResponse -> Bool
$c== :: GetPullRequestApprovalStatesResponse
-> GetPullRequestApprovalStatesResponse -> Bool
Prelude.Eq, ReadPrec [GetPullRequestApprovalStatesResponse]
ReadPrec GetPullRequestApprovalStatesResponse
Int -> ReadS GetPullRequestApprovalStatesResponse
ReadS [GetPullRequestApprovalStatesResponse]
(Int -> ReadS GetPullRequestApprovalStatesResponse)
-> ReadS [GetPullRequestApprovalStatesResponse]
-> ReadPrec GetPullRequestApprovalStatesResponse
-> ReadPrec [GetPullRequestApprovalStatesResponse]
-> Read GetPullRequestApprovalStatesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPullRequestApprovalStatesResponse]
$creadListPrec :: ReadPrec [GetPullRequestApprovalStatesResponse]
readPrec :: ReadPrec GetPullRequestApprovalStatesResponse
$creadPrec :: ReadPrec GetPullRequestApprovalStatesResponse
readList :: ReadS [GetPullRequestApprovalStatesResponse]
$creadList :: ReadS [GetPullRequestApprovalStatesResponse]
readsPrec :: Int -> ReadS GetPullRequestApprovalStatesResponse
$creadsPrec :: Int -> ReadS GetPullRequestApprovalStatesResponse
Prelude.Read, Int -> GetPullRequestApprovalStatesResponse -> ShowS
[GetPullRequestApprovalStatesResponse] -> ShowS
GetPullRequestApprovalStatesResponse -> String
(Int -> GetPullRequestApprovalStatesResponse -> ShowS)
-> (GetPullRequestApprovalStatesResponse -> String)
-> ([GetPullRequestApprovalStatesResponse] -> ShowS)
-> Show GetPullRequestApprovalStatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPullRequestApprovalStatesResponse] -> ShowS
$cshowList :: [GetPullRequestApprovalStatesResponse] -> ShowS
show :: GetPullRequestApprovalStatesResponse -> String
$cshow :: GetPullRequestApprovalStatesResponse -> String
showsPrec :: Int -> GetPullRequestApprovalStatesResponse -> ShowS
$cshowsPrec :: Int -> GetPullRequestApprovalStatesResponse -> ShowS
Prelude.Show, (forall x.
GetPullRequestApprovalStatesResponse
-> Rep GetPullRequestApprovalStatesResponse x)
-> (forall x.
Rep GetPullRequestApprovalStatesResponse x
-> GetPullRequestApprovalStatesResponse)
-> Generic GetPullRequestApprovalStatesResponse
forall x.
Rep GetPullRequestApprovalStatesResponse x
-> GetPullRequestApprovalStatesResponse
forall x.
GetPullRequestApprovalStatesResponse
-> Rep GetPullRequestApprovalStatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetPullRequestApprovalStatesResponse x
-> GetPullRequestApprovalStatesResponse
$cfrom :: forall x.
GetPullRequestApprovalStatesResponse
-> Rep GetPullRequestApprovalStatesResponse x
Prelude.Generic)
newGetPullRequestApprovalStatesResponse ::
Prelude.Int ->
GetPullRequestApprovalStatesResponse
newGetPullRequestApprovalStatesResponse :: Int -> GetPullRequestApprovalStatesResponse
newGetPullRequestApprovalStatesResponse Int
pHttpStatus_ =
GetPullRequestApprovalStatesResponse' :: Maybe [Approval] -> Int -> GetPullRequestApprovalStatesResponse
GetPullRequestApprovalStatesResponse'
{ $sel:approvals:GetPullRequestApprovalStatesResponse' :: Maybe [Approval]
approvals =
Maybe [Approval]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPullRequestApprovalStatesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPullRequestApprovalStatesResponse_approvals :: Lens.Lens' GetPullRequestApprovalStatesResponse (Prelude.Maybe [Approval])
getPullRequestApprovalStatesResponse_approvals :: (Maybe [Approval] -> f (Maybe [Approval]))
-> GetPullRequestApprovalStatesResponse
-> f GetPullRequestApprovalStatesResponse
getPullRequestApprovalStatesResponse_approvals = (GetPullRequestApprovalStatesResponse -> Maybe [Approval])
-> (GetPullRequestApprovalStatesResponse
-> Maybe [Approval] -> GetPullRequestApprovalStatesResponse)
-> Lens
GetPullRequestApprovalStatesResponse
GetPullRequestApprovalStatesResponse
(Maybe [Approval])
(Maybe [Approval])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPullRequestApprovalStatesResponse' {Maybe [Approval]
approvals :: Maybe [Approval]
$sel:approvals:GetPullRequestApprovalStatesResponse' :: GetPullRequestApprovalStatesResponse -> Maybe [Approval]
approvals} -> Maybe [Approval]
approvals) (\s :: GetPullRequestApprovalStatesResponse
s@GetPullRequestApprovalStatesResponse' {} Maybe [Approval]
a -> GetPullRequestApprovalStatesResponse
s {$sel:approvals:GetPullRequestApprovalStatesResponse' :: Maybe [Approval]
approvals = Maybe [Approval]
a} :: GetPullRequestApprovalStatesResponse) ((Maybe [Approval] -> f (Maybe [Approval]))
-> GetPullRequestApprovalStatesResponse
-> f GetPullRequestApprovalStatesResponse)
-> ((Maybe [Approval] -> f (Maybe [Approval]))
-> Maybe [Approval] -> f (Maybe [Approval]))
-> (Maybe [Approval] -> f (Maybe [Approval]))
-> GetPullRequestApprovalStatesResponse
-> f GetPullRequestApprovalStatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Approval] [Approval] [Approval] [Approval]
-> Iso
(Maybe [Approval])
(Maybe [Approval])
(Maybe [Approval])
(Maybe [Approval])
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 [Approval] [Approval] [Approval] [Approval]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getPullRequestApprovalStatesResponse_httpStatus :: Lens.Lens' GetPullRequestApprovalStatesResponse Prelude.Int
getPullRequestApprovalStatesResponse_httpStatus :: (Int -> f Int)
-> GetPullRequestApprovalStatesResponse
-> f GetPullRequestApprovalStatesResponse
getPullRequestApprovalStatesResponse_httpStatus = (GetPullRequestApprovalStatesResponse -> Int)
-> (GetPullRequestApprovalStatesResponse
-> Int -> GetPullRequestApprovalStatesResponse)
-> Lens
GetPullRequestApprovalStatesResponse
GetPullRequestApprovalStatesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPullRequestApprovalStatesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPullRequestApprovalStatesResponse' :: GetPullRequestApprovalStatesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPullRequestApprovalStatesResponse
s@GetPullRequestApprovalStatesResponse' {} Int
a -> GetPullRequestApprovalStatesResponse
s {$sel:httpStatus:GetPullRequestApprovalStatesResponse' :: Int
httpStatus = Int
a} :: GetPullRequestApprovalStatesResponse)
instance
Prelude.NFData
GetPullRequestApprovalStatesResponse