{-# 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.GetPullRequest
(
GetPullRequest (..),
newGetPullRequest,
getPullRequest_pullRequestId,
GetPullRequestResponse (..),
newGetPullRequestResponse,
getPullRequestResponse_httpStatus,
getPullRequestResponse_pullRequest,
)
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 GetPullRequest = GetPullRequest'
{
GetPullRequest -> Text
pullRequestId :: Prelude.Text
}
deriving (GetPullRequest -> GetPullRequest -> Bool
(GetPullRequest -> GetPullRequest -> Bool)
-> (GetPullRequest -> GetPullRequest -> Bool) -> Eq GetPullRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPullRequest -> GetPullRequest -> Bool
$c/= :: GetPullRequest -> GetPullRequest -> Bool
== :: GetPullRequest -> GetPullRequest -> Bool
$c== :: GetPullRequest -> GetPullRequest -> Bool
Prelude.Eq, ReadPrec [GetPullRequest]
ReadPrec GetPullRequest
Int -> ReadS GetPullRequest
ReadS [GetPullRequest]
(Int -> ReadS GetPullRequest)
-> ReadS [GetPullRequest]
-> ReadPrec GetPullRequest
-> ReadPrec [GetPullRequest]
-> Read GetPullRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPullRequest]
$creadListPrec :: ReadPrec [GetPullRequest]
readPrec :: ReadPrec GetPullRequest
$creadPrec :: ReadPrec GetPullRequest
readList :: ReadS [GetPullRequest]
$creadList :: ReadS [GetPullRequest]
readsPrec :: Int -> ReadS GetPullRequest
$creadsPrec :: Int -> ReadS GetPullRequest
Prelude.Read, Int -> GetPullRequest -> ShowS
[GetPullRequest] -> ShowS
GetPullRequest -> String
(Int -> GetPullRequest -> ShowS)
-> (GetPullRequest -> String)
-> ([GetPullRequest] -> ShowS)
-> Show GetPullRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPullRequest] -> ShowS
$cshowList :: [GetPullRequest] -> ShowS
show :: GetPullRequest -> String
$cshow :: GetPullRequest -> String
showsPrec :: Int -> GetPullRequest -> ShowS
$cshowsPrec :: Int -> GetPullRequest -> ShowS
Prelude.Show, (forall x. GetPullRequest -> Rep GetPullRequest x)
-> (forall x. Rep GetPullRequest x -> GetPullRequest)
-> Generic GetPullRequest
forall x. Rep GetPullRequest x -> GetPullRequest
forall x. GetPullRequest -> Rep GetPullRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPullRequest x -> GetPullRequest
$cfrom :: forall x. GetPullRequest -> Rep GetPullRequest x
Prelude.Generic)
newGetPullRequest ::
Prelude.Text ->
GetPullRequest
newGetPullRequest :: Text -> GetPullRequest
newGetPullRequest Text
pPullRequestId_ =
GetPullRequest' :: Text -> GetPullRequest
GetPullRequest' {$sel:pullRequestId:GetPullRequest' :: Text
pullRequestId = Text
pPullRequestId_}
getPullRequest_pullRequestId :: Lens.Lens' GetPullRequest Prelude.Text
getPullRequest_pullRequestId :: (Text -> f Text) -> GetPullRequest -> f GetPullRequest
getPullRequest_pullRequestId = (GetPullRequest -> Text)
-> (GetPullRequest -> Text -> GetPullRequest)
-> Lens GetPullRequest GetPullRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPullRequest' {Text
pullRequestId :: Text
$sel:pullRequestId:GetPullRequest' :: GetPullRequest -> Text
pullRequestId} -> Text
pullRequestId) (\s :: GetPullRequest
s@GetPullRequest' {} Text
a -> GetPullRequest
s {$sel:pullRequestId:GetPullRequest' :: Text
pullRequestId = Text
a} :: GetPullRequest)
instance Core.AWSRequest GetPullRequest where
type
AWSResponse GetPullRequest =
GetPullRequestResponse
request :: GetPullRequest -> Request GetPullRequest
request = Service -> GetPullRequest -> Request GetPullRequest
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetPullRequest
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPullRequest)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetPullRequest))
-> Logger
-> Service
-> Proxy GetPullRequest
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPullRequest)))
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 -> PullRequest -> GetPullRequestResponse
GetPullRequestResponse'
(Int -> PullRequest -> GetPullRequestResponse)
-> Either String Int
-> Either String (PullRequest -> GetPullRequestResponse)
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 (PullRequest -> GetPullRequestResponse)
-> Either String PullRequest
-> Either String GetPullRequestResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String PullRequest
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"pullRequest")
)
instance Prelude.Hashable GetPullRequest
instance Prelude.NFData GetPullRequest
instance Core.ToHeaders GetPullRequest where
toHeaders :: GetPullRequest -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetPullRequest -> 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.GetPullRequest" ::
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 GetPullRequest where
toJSON :: GetPullRequest -> Value
toJSON GetPullRequest' {Text
pullRequestId :: Text
$sel:pullRequestId:GetPullRequest' :: GetPullRequest -> 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)
]
)
instance Core.ToPath GetPullRequest where
toPath :: GetPullRequest -> ByteString
toPath = ByteString -> GetPullRequest -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetPullRequest where
toQuery :: GetPullRequest -> QueryString
toQuery = QueryString -> GetPullRequest -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetPullRequestResponse = GetPullRequestResponse'
{
GetPullRequestResponse -> Int
httpStatus :: Prelude.Int,
GetPullRequestResponse -> PullRequest
pullRequest :: PullRequest
}
deriving (GetPullRequestResponse -> GetPullRequestResponse -> Bool
(GetPullRequestResponse -> GetPullRequestResponse -> Bool)
-> (GetPullRequestResponse -> GetPullRequestResponse -> Bool)
-> Eq GetPullRequestResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPullRequestResponse -> GetPullRequestResponse -> Bool
$c/= :: GetPullRequestResponse -> GetPullRequestResponse -> Bool
== :: GetPullRequestResponse -> GetPullRequestResponse -> Bool
$c== :: GetPullRequestResponse -> GetPullRequestResponse -> Bool
Prelude.Eq, ReadPrec [GetPullRequestResponse]
ReadPrec GetPullRequestResponse
Int -> ReadS GetPullRequestResponse
ReadS [GetPullRequestResponse]
(Int -> ReadS GetPullRequestResponse)
-> ReadS [GetPullRequestResponse]
-> ReadPrec GetPullRequestResponse
-> ReadPrec [GetPullRequestResponse]
-> Read GetPullRequestResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPullRequestResponse]
$creadListPrec :: ReadPrec [GetPullRequestResponse]
readPrec :: ReadPrec GetPullRequestResponse
$creadPrec :: ReadPrec GetPullRequestResponse
readList :: ReadS [GetPullRequestResponse]
$creadList :: ReadS [GetPullRequestResponse]
readsPrec :: Int -> ReadS GetPullRequestResponse
$creadsPrec :: Int -> ReadS GetPullRequestResponse
Prelude.Read, Int -> GetPullRequestResponse -> ShowS
[GetPullRequestResponse] -> ShowS
GetPullRequestResponse -> String
(Int -> GetPullRequestResponse -> ShowS)
-> (GetPullRequestResponse -> String)
-> ([GetPullRequestResponse] -> ShowS)
-> Show GetPullRequestResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPullRequestResponse] -> ShowS
$cshowList :: [GetPullRequestResponse] -> ShowS
show :: GetPullRequestResponse -> String
$cshow :: GetPullRequestResponse -> String
showsPrec :: Int -> GetPullRequestResponse -> ShowS
$cshowsPrec :: Int -> GetPullRequestResponse -> ShowS
Prelude.Show, (forall x. GetPullRequestResponse -> Rep GetPullRequestResponse x)
-> (forall x.
Rep GetPullRequestResponse x -> GetPullRequestResponse)
-> Generic GetPullRequestResponse
forall x. Rep GetPullRequestResponse x -> GetPullRequestResponse
forall x. GetPullRequestResponse -> Rep GetPullRequestResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPullRequestResponse x -> GetPullRequestResponse
$cfrom :: forall x. GetPullRequestResponse -> Rep GetPullRequestResponse x
Prelude.Generic)
newGetPullRequestResponse ::
Prelude.Int ->
PullRequest ->
GetPullRequestResponse
newGetPullRequestResponse :: Int -> PullRequest -> GetPullRequestResponse
newGetPullRequestResponse Int
pHttpStatus_ PullRequest
pPullRequest_ =
GetPullRequestResponse' :: Int -> PullRequest -> GetPullRequestResponse
GetPullRequestResponse'
{ $sel:httpStatus:GetPullRequestResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:pullRequest:GetPullRequestResponse' :: PullRequest
pullRequest = PullRequest
pPullRequest_
}
getPullRequestResponse_httpStatus :: Lens.Lens' GetPullRequestResponse Prelude.Int
getPullRequestResponse_httpStatus :: (Int -> f Int)
-> GetPullRequestResponse -> f GetPullRequestResponse
getPullRequestResponse_httpStatus = (GetPullRequestResponse -> Int)
-> (GetPullRequestResponse -> Int -> GetPullRequestResponse)
-> Lens GetPullRequestResponse GetPullRequestResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPullRequestResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPullRequestResponse' :: GetPullRequestResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPullRequestResponse
s@GetPullRequestResponse' {} Int
a -> GetPullRequestResponse
s {$sel:httpStatus:GetPullRequestResponse' :: Int
httpStatus = Int
a} :: GetPullRequestResponse)
getPullRequestResponse_pullRequest :: Lens.Lens' GetPullRequestResponse PullRequest
getPullRequestResponse_pullRequest :: (PullRequest -> f PullRequest)
-> GetPullRequestResponse -> f GetPullRequestResponse
getPullRequestResponse_pullRequest = (GetPullRequestResponse -> PullRequest)
-> (GetPullRequestResponse
-> PullRequest -> GetPullRequestResponse)
-> Lens
GetPullRequestResponse
GetPullRequestResponse
PullRequest
PullRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPullRequestResponse' {PullRequest
pullRequest :: PullRequest
$sel:pullRequest:GetPullRequestResponse' :: GetPullRequestResponse -> PullRequest
pullRequest} -> PullRequest
pullRequest) (\s :: GetPullRequestResponse
s@GetPullRequestResponse' {} PullRequest
a -> GetPullRequestResponse
s {$sel:pullRequest:GetPullRequestResponse' :: PullRequest
pullRequest = PullRequest
a} :: GetPullRequestResponse)
instance Prelude.NFData GetPullRequestResponse