{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
{ $sel:pullRequestId:GetPullRequestApprovalStates' :: Text
pullRequestId =
Text
pPullRequestId_,
$sel:revisionId:GetPullRequestApprovalStates' :: Text
revisionId = Text
pRevisionId_
}
getPullRequestApprovalStates_pullRequestId :: Lens.Lens' GetPullRequestApprovalStates Prelude.Text
getPullRequestApprovalStates_pullRequestId :: Lens' GetPullRequestApprovalStates Text
getPullRequestApprovalStates_pullRequestId = 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 :: Lens' GetPullRequestApprovalStates Text
getPullRequestApprovalStates_revisionId = 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 :: (Service -> Service)
-> GetPullRequestApprovalStates
-> Request GetPullRequestApprovalStates
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetPullRequestApprovalStates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetPullRequestApprovalStates)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Approval] -> Int -> GetPullRequestApprovalStatesResponse
GetPullRequestApprovalStatesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"approvals" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
GetPullRequestApprovalStates
where
hashWithSalt :: Int -> GetPullRequestApprovalStates -> Int
hashWithSalt Int
_salt GetPullRequestApprovalStates' {Text
revisionId :: Text
pullRequestId :: Text
$sel:revisionId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> Text
$sel:pullRequestId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pullRequestId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
revisionId
instance Prelude.NFData GetPullRequestApprovalStates where
rnf :: GetPullRequestApprovalStates -> ()
rnf GetPullRequestApprovalStates' {Text
revisionId :: Text
pullRequestId :: Text
$sel:revisionId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> Text
$sel:pullRequestId:GetPullRequestApprovalStates' :: GetPullRequestApprovalStates -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
pullRequestId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
revisionId
instance Data.ToHeaders GetPullRequestApprovalStates where
toHeaders :: GetPullRequestApprovalStates -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"CodeCommit_20150413.GetPullRequestApprovalStates" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"pullRequestId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
pullRequestId),
forall a. a -> Maybe a
Prelude.Just (Key
"revisionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
revisionId)
]
)
instance Data.ToPath GetPullRequestApprovalStates where
toPath :: GetPullRequestApprovalStates -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetPullRequestApprovalStates where
toQuery :: GetPullRequestApprovalStates -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:approvals:GetPullRequestApprovalStatesResponse' :: Maybe [Approval]
approvals =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPullRequestApprovalStatesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPullRequestApprovalStatesResponse_approvals :: Lens.Lens' GetPullRequestApprovalStatesResponse (Prelude.Maybe [Approval])
getPullRequestApprovalStatesResponse_approvals :: Lens' GetPullRequestApprovalStatesResponse (Maybe [Approval])
getPullRequestApprovalStatesResponse_approvals = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' GetPullRequestApprovalStatesResponse Int
getPullRequestApprovalStatesResponse_httpStatus = 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
where
rnf :: GetPullRequestApprovalStatesResponse -> ()
rnf GetPullRequestApprovalStatesResponse' {Int
Maybe [Approval]
httpStatus :: Int
approvals :: Maybe [Approval]
$sel:httpStatus:GetPullRequestApprovalStatesResponse' :: GetPullRequestApprovalStatesResponse -> Int
$sel:approvals:GetPullRequestApprovalStatesResponse' :: GetPullRequestApprovalStatesResponse -> Maybe [Approval]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Approval]
approvals
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus