{-# 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.MergePullRequestByFastForward
(
MergePullRequestByFastForward (..),
newMergePullRequestByFastForward,
mergePullRequestByFastForward_sourceCommitId,
mergePullRequestByFastForward_pullRequestId,
mergePullRequestByFastForward_repositoryName,
MergePullRequestByFastForwardResponse (..),
newMergePullRequestByFastForwardResponse,
mergePullRequestByFastForwardResponse_pullRequest,
mergePullRequestByFastForwardResponse_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 MergePullRequestByFastForward = MergePullRequestByFastForward'
{
MergePullRequestByFastForward -> Maybe Text
sourceCommitId :: Prelude.Maybe Prelude.Text,
MergePullRequestByFastForward -> Text
pullRequestId :: Prelude.Text,
MergePullRequestByFastForward -> Text
repositoryName :: Prelude.Text
}
deriving (MergePullRequestByFastForward
-> MergePullRequestByFastForward -> Bool
(MergePullRequestByFastForward
-> MergePullRequestByFastForward -> Bool)
-> (MergePullRequestByFastForward
-> MergePullRequestByFastForward -> Bool)
-> Eq MergePullRequestByFastForward
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MergePullRequestByFastForward
-> MergePullRequestByFastForward -> Bool
$c/= :: MergePullRequestByFastForward
-> MergePullRequestByFastForward -> Bool
== :: MergePullRequestByFastForward
-> MergePullRequestByFastForward -> Bool
$c== :: MergePullRequestByFastForward
-> MergePullRequestByFastForward -> Bool
Prelude.Eq, ReadPrec [MergePullRequestByFastForward]
ReadPrec MergePullRequestByFastForward
Int -> ReadS MergePullRequestByFastForward
ReadS [MergePullRequestByFastForward]
(Int -> ReadS MergePullRequestByFastForward)
-> ReadS [MergePullRequestByFastForward]
-> ReadPrec MergePullRequestByFastForward
-> ReadPrec [MergePullRequestByFastForward]
-> Read MergePullRequestByFastForward
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MergePullRequestByFastForward]
$creadListPrec :: ReadPrec [MergePullRequestByFastForward]
readPrec :: ReadPrec MergePullRequestByFastForward
$creadPrec :: ReadPrec MergePullRequestByFastForward
readList :: ReadS [MergePullRequestByFastForward]
$creadList :: ReadS [MergePullRequestByFastForward]
readsPrec :: Int -> ReadS MergePullRequestByFastForward
$creadsPrec :: Int -> ReadS MergePullRequestByFastForward
Prelude.Read, Int -> MergePullRequestByFastForward -> ShowS
[MergePullRequestByFastForward] -> ShowS
MergePullRequestByFastForward -> String
(Int -> MergePullRequestByFastForward -> ShowS)
-> (MergePullRequestByFastForward -> String)
-> ([MergePullRequestByFastForward] -> ShowS)
-> Show MergePullRequestByFastForward
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MergePullRequestByFastForward] -> ShowS
$cshowList :: [MergePullRequestByFastForward] -> ShowS
show :: MergePullRequestByFastForward -> String
$cshow :: MergePullRequestByFastForward -> String
showsPrec :: Int -> MergePullRequestByFastForward -> ShowS
$cshowsPrec :: Int -> MergePullRequestByFastForward -> ShowS
Prelude.Show, (forall x.
MergePullRequestByFastForward
-> Rep MergePullRequestByFastForward x)
-> (forall x.
Rep MergePullRequestByFastForward x
-> MergePullRequestByFastForward)
-> Generic MergePullRequestByFastForward
forall x.
Rep MergePullRequestByFastForward x
-> MergePullRequestByFastForward
forall x.
MergePullRequestByFastForward
-> Rep MergePullRequestByFastForward x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MergePullRequestByFastForward x
-> MergePullRequestByFastForward
$cfrom :: forall x.
MergePullRequestByFastForward
-> Rep MergePullRequestByFastForward x
Prelude.Generic)
newMergePullRequestByFastForward ::
Prelude.Text ->
Prelude.Text ->
MergePullRequestByFastForward
newMergePullRequestByFastForward :: Text -> Text -> MergePullRequestByFastForward
newMergePullRequestByFastForward
Text
pPullRequestId_
Text
pRepositoryName_ =
MergePullRequestByFastForward' :: Maybe Text -> Text -> Text -> MergePullRequestByFastForward
MergePullRequestByFastForward'
{ $sel:sourceCommitId:MergePullRequestByFastForward' :: Maybe Text
sourceCommitId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pullRequestId:MergePullRequestByFastForward' :: Text
pullRequestId = Text
pPullRequestId_,
$sel:repositoryName:MergePullRequestByFastForward' :: Text
repositoryName = Text
pRepositoryName_
}
mergePullRequestByFastForward_sourceCommitId :: Lens.Lens' MergePullRequestByFastForward (Prelude.Maybe Prelude.Text)
mergePullRequestByFastForward_sourceCommitId :: (Maybe Text -> f (Maybe Text))
-> MergePullRequestByFastForward -> f MergePullRequestByFastForward
mergePullRequestByFastForward_sourceCommitId = (MergePullRequestByFastForward -> Maybe Text)
-> (MergePullRequestByFastForward
-> Maybe Text -> MergePullRequestByFastForward)
-> Lens
MergePullRequestByFastForward
MergePullRequestByFastForward
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestByFastForward' {Maybe Text
sourceCommitId :: Maybe Text
$sel:sourceCommitId:MergePullRequestByFastForward' :: MergePullRequestByFastForward -> Maybe Text
sourceCommitId} -> Maybe Text
sourceCommitId) (\s :: MergePullRequestByFastForward
s@MergePullRequestByFastForward' {} Maybe Text
a -> MergePullRequestByFastForward
s {$sel:sourceCommitId:MergePullRequestByFastForward' :: Maybe Text
sourceCommitId = Maybe Text
a} :: MergePullRequestByFastForward)
mergePullRequestByFastForward_pullRequestId :: Lens.Lens' MergePullRequestByFastForward Prelude.Text
mergePullRequestByFastForward_pullRequestId :: (Text -> f Text)
-> MergePullRequestByFastForward -> f MergePullRequestByFastForward
mergePullRequestByFastForward_pullRequestId = (MergePullRequestByFastForward -> Text)
-> (MergePullRequestByFastForward
-> Text -> MergePullRequestByFastForward)
-> Lens
MergePullRequestByFastForward
MergePullRequestByFastForward
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestByFastForward' {Text
pullRequestId :: Text
$sel:pullRequestId:MergePullRequestByFastForward' :: MergePullRequestByFastForward -> Text
pullRequestId} -> Text
pullRequestId) (\s :: MergePullRequestByFastForward
s@MergePullRequestByFastForward' {} Text
a -> MergePullRequestByFastForward
s {$sel:pullRequestId:MergePullRequestByFastForward' :: Text
pullRequestId = Text
a} :: MergePullRequestByFastForward)
mergePullRequestByFastForward_repositoryName :: Lens.Lens' MergePullRequestByFastForward Prelude.Text
mergePullRequestByFastForward_repositoryName :: (Text -> f Text)
-> MergePullRequestByFastForward -> f MergePullRequestByFastForward
mergePullRequestByFastForward_repositoryName = (MergePullRequestByFastForward -> Text)
-> (MergePullRequestByFastForward
-> Text -> MergePullRequestByFastForward)
-> Lens
MergePullRequestByFastForward
MergePullRequestByFastForward
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestByFastForward' {Text
repositoryName :: Text
$sel:repositoryName:MergePullRequestByFastForward' :: MergePullRequestByFastForward -> Text
repositoryName} -> Text
repositoryName) (\s :: MergePullRequestByFastForward
s@MergePullRequestByFastForward' {} Text
a -> MergePullRequestByFastForward
s {$sel:repositoryName:MergePullRequestByFastForward' :: Text
repositoryName = Text
a} :: MergePullRequestByFastForward)
instance
Core.AWSRequest
MergePullRequestByFastForward
where
type
AWSResponse MergePullRequestByFastForward =
MergePullRequestByFastForwardResponse
request :: MergePullRequestByFastForward
-> Request MergePullRequestByFastForward
request = Service
-> MergePullRequestByFastForward
-> Request MergePullRequestByFastForward
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy MergePullRequestByFastForward
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse MergePullRequestByFastForward)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse MergePullRequestByFastForward))
-> Logger
-> Service
-> Proxy MergePullRequestByFastForward
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse MergePullRequestByFastForward)))
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 PullRequest -> Int -> MergePullRequestByFastForwardResponse
MergePullRequestByFastForwardResponse'
(Maybe PullRequest -> Int -> MergePullRequestByFastForwardResponse)
-> Either String (Maybe PullRequest)
-> Either String (Int -> MergePullRequestByFastForwardResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe PullRequest)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"pullRequest")
Either String (Int -> MergePullRequestByFastForwardResponse)
-> Either String Int
-> Either String MergePullRequestByFastForwardResponse
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
MergePullRequestByFastForward
instance Prelude.NFData MergePullRequestByFastForward
instance Core.ToHeaders MergePullRequestByFastForward where
toHeaders :: MergePullRequestByFastForward -> ResponseHeaders
toHeaders =
ResponseHeaders -> MergePullRequestByFastForward -> 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.MergePullRequestByFastForward" ::
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 MergePullRequestByFastForward where
toJSON :: MergePullRequestByFastForward -> Value
toJSON MergePullRequestByFastForward' {Maybe Text
Text
repositoryName :: Text
pullRequestId :: Text
sourceCommitId :: Maybe Text
$sel:repositoryName:MergePullRequestByFastForward' :: MergePullRequestByFastForward -> Text
$sel:pullRequestId:MergePullRequestByFastForward' :: MergePullRequestByFastForward -> Text
$sel:sourceCommitId:MergePullRequestByFastForward' :: MergePullRequestByFastForward -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"sourceCommitId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceCommitId,
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
"repositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
repositoryName)
]
)
instance Core.ToPath MergePullRequestByFastForward where
toPath :: MergePullRequestByFastForward -> ByteString
toPath = ByteString -> MergePullRequestByFastForward -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery MergePullRequestByFastForward where
toQuery :: MergePullRequestByFastForward -> QueryString
toQuery = QueryString -> MergePullRequestByFastForward -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data MergePullRequestByFastForwardResponse = MergePullRequestByFastForwardResponse'
{
MergePullRequestByFastForwardResponse -> Maybe PullRequest
pullRequest :: Prelude.Maybe PullRequest,
MergePullRequestByFastForwardResponse -> Int
httpStatus :: Prelude.Int
}
deriving (MergePullRequestByFastForwardResponse
-> MergePullRequestByFastForwardResponse -> Bool
(MergePullRequestByFastForwardResponse
-> MergePullRequestByFastForwardResponse -> Bool)
-> (MergePullRequestByFastForwardResponse
-> MergePullRequestByFastForwardResponse -> Bool)
-> Eq MergePullRequestByFastForwardResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MergePullRequestByFastForwardResponse
-> MergePullRequestByFastForwardResponse -> Bool
$c/= :: MergePullRequestByFastForwardResponse
-> MergePullRequestByFastForwardResponse -> Bool
== :: MergePullRequestByFastForwardResponse
-> MergePullRequestByFastForwardResponse -> Bool
$c== :: MergePullRequestByFastForwardResponse
-> MergePullRequestByFastForwardResponse -> Bool
Prelude.Eq, ReadPrec [MergePullRequestByFastForwardResponse]
ReadPrec MergePullRequestByFastForwardResponse
Int -> ReadS MergePullRequestByFastForwardResponse
ReadS [MergePullRequestByFastForwardResponse]
(Int -> ReadS MergePullRequestByFastForwardResponse)
-> ReadS [MergePullRequestByFastForwardResponse]
-> ReadPrec MergePullRequestByFastForwardResponse
-> ReadPrec [MergePullRequestByFastForwardResponse]
-> Read MergePullRequestByFastForwardResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MergePullRequestByFastForwardResponse]
$creadListPrec :: ReadPrec [MergePullRequestByFastForwardResponse]
readPrec :: ReadPrec MergePullRequestByFastForwardResponse
$creadPrec :: ReadPrec MergePullRequestByFastForwardResponse
readList :: ReadS [MergePullRequestByFastForwardResponse]
$creadList :: ReadS [MergePullRequestByFastForwardResponse]
readsPrec :: Int -> ReadS MergePullRequestByFastForwardResponse
$creadsPrec :: Int -> ReadS MergePullRequestByFastForwardResponse
Prelude.Read, Int -> MergePullRequestByFastForwardResponse -> ShowS
[MergePullRequestByFastForwardResponse] -> ShowS
MergePullRequestByFastForwardResponse -> String
(Int -> MergePullRequestByFastForwardResponse -> ShowS)
-> (MergePullRequestByFastForwardResponse -> String)
-> ([MergePullRequestByFastForwardResponse] -> ShowS)
-> Show MergePullRequestByFastForwardResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MergePullRequestByFastForwardResponse] -> ShowS
$cshowList :: [MergePullRequestByFastForwardResponse] -> ShowS
show :: MergePullRequestByFastForwardResponse -> String
$cshow :: MergePullRequestByFastForwardResponse -> String
showsPrec :: Int -> MergePullRequestByFastForwardResponse -> ShowS
$cshowsPrec :: Int -> MergePullRequestByFastForwardResponse -> ShowS
Prelude.Show, (forall x.
MergePullRequestByFastForwardResponse
-> Rep MergePullRequestByFastForwardResponse x)
-> (forall x.
Rep MergePullRequestByFastForwardResponse x
-> MergePullRequestByFastForwardResponse)
-> Generic MergePullRequestByFastForwardResponse
forall x.
Rep MergePullRequestByFastForwardResponse x
-> MergePullRequestByFastForwardResponse
forall x.
MergePullRequestByFastForwardResponse
-> Rep MergePullRequestByFastForwardResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MergePullRequestByFastForwardResponse x
-> MergePullRequestByFastForwardResponse
$cfrom :: forall x.
MergePullRequestByFastForwardResponse
-> Rep MergePullRequestByFastForwardResponse x
Prelude.Generic)
newMergePullRequestByFastForwardResponse ::
Prelude.Int ->
MergePullRequestByFastForwardResponse
newMergePullRequestByFastForwardResponse :: Int -> MergePullRequestByFastForwardResponse
newMergePullRequestByFastForwardResponse Int
pHttpStatus_ =
MergePullRequestByFastForwardResponse' :: Maybe PullRequest -> Int -> MergePullRequestByFastForwardResponse
MergePullRequestByFastForwardResponse'
{ $sel:pullRequest:MergePullRequestByFastForwardResponse' :: Maybe PullRequest
pullRequest =
Maybe PullRequest
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:MergePullRequestByFastForwardResponse' :: Int
httpStatus = Int
pHttpStatus_
}
mergePullRequestByFastForwardResponse_pullRequest :: Lens.Lens' MergePullRequestByFastForwardResponse (Prelude.Maybe PullRequest)
mergePullRequestByFastForwardResponse_pullRequest :: (Maybe PullRequest -> f (Maybe PullRequest))
-> MergePullRequestByFastForwardResponse
-> f MergePullRequestByFastForwardResponse
mergePullRequestByFastForwardResponse_pullRequest = (MergePullRequestByFastForwardResponse -> Maybe PullRequest)
-> (MergePullRequestByFastForwardResponse
-> Maybe PullRequest -> MergePullRequestByFastForwardResponse)
-> Lens
MergePullRequestByFastForwardResponse
MergePullRequestByFastForwardResponse
(Maybe PullRequest)
(Maybe PullRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestByFastForwardResponse' {Maybe PullRequest
pullRequest :: Maybe PullRequest
$sel:pullRequest:MergePullRequestByFastForwardResponse' :: MergePullRequestByFastForwardResponse -> Maybe PullRequest
pullRequest} -> Maybe PullRequest
pullRequest) (\s :: MergePullRequestByFastForwardResponse
s@MergePullRequestByFastForwardResponse' {} Maybe PullRequest
a -> MergePullRequestByFastForwardResponse
s {$sel:pullRequest:MergePullRequestByFastForwardResponse' :: Maybe PullRequest
pullRequest = Maybe PullRequest
a} :: MergePullRequestByFastForwardResponse)
mergePullRequestByFastForwardResponse_httpStatus :: Lens.Lens' MergePullRequestByFastForwardResponse Prelude.Int
mergePullRequestByFastForwardResponse_httpStatus :: (Int -> f Int)
-> MergePullRequestByFastForwardResponse
-> f MergePullRequestByFastForwardResponse
mergePullRequestByFastForwardResponse_httpStatus = (MergePullRequestByFastForwardResponse -> Int)
-> (MergePullRequestByFastForwardResponse
-> Int -> MergePullRequestByFastForwardResponse)
-> Lens
MergePullRequestByFastForwardResponse
MergePullRequestByFastForwardResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestByFastForwardResponse' {Int
httpStatus :: Int
$sel:httpStatus:MergePullRequestByFastForwardResponse' :: MergePullRequestByFastForwardResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: MergePullRequestByFastForwardResponse
s@MergePullRequestByFastForwardResponse' {} Int
a -> MergePullRequestByFastForwardResponse
s {$sel:httpStatus:MergePullRequestByFastForwardResponse' :: Int
httpStatus = Int
a} :: MergePullRequestByFastForwardResponse)
instance
Prelude.NFData
MergePullRequestByFastForwardResponse