{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CodeCommit.GetMergeCommit
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about a specified merge commit.
module Amazonka.CodeCommit.GetMergeCommit
  ( -- * Creating a Request
    GetMergeCommit (..),
    newGetMergeCommit,

    -- * Request Lenses
    getMergeCommit_conflictDetailLevel,
    getMergeCommit_conflictResolutionStrategy,
    getMergeCommit_repositoryName,
    getMergeCommit_sourceCommitSpecifier,
    getMergeCommit_destinationCommitSpecifier,

    -- * Destructuring the Response
    GetMergeCommitResponse (..),
    newGetMergeCommitResponse,

    -- * Response Lenses
    getMergeCommitResponse_mergedCommitId,
    getMergeCommitResponse_destinationCommitId,
    getMergeCommitResponse_baseCommitId,
    getMergeCommitResponse_sourceCommitId,
    getMergeCommitResponse_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

-- | /See:/ 'newGetMergeCommit' smart constructor.
data GetMergeCommit = GetMergeCommit'
  { -- | The level of conflict detail to use. If unspecified, the default
    -- FILE_LEVEL is used, which returns a not-mergeable result if the same
    -- file has differences in both branches. If LINE_LEVEL is specified, a
    -- conflict is considered not mergeable if the same file in both branches
    -- has differences on the same line.
    GetMergeCommit -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel :: Prelude.Maybe ConflictDetailLevelTypeEnum,
    -- | Specifies which branch to use when resolving conflicts, or whether to
    -- attempt automatically merging two versions of a file. The default is
    -- NONE, which requires any conflicts to be resolved manually before the
    -- merge operation is successful.
    GetMergeCommit -> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy :: Prelude.Maybe ConflictResolutionStrategyTypeEnum,
    -- | The name of the repository that contains the merge commit about which
    -- you want to get information.
    GetMergeCommit -> Text
repositoryName :: Prelude.Text,
    -- | The branch, tag, HEAD, or other fully qualified reference used to
    -- identify a commit (for example, a branch name or a full commit ID).
    GetMergeCommit -> Text
sourceCommitSpecifier :: Prelude.Text,
    -- | The branch, tag, HEAD, or other fully qualified reference used to
    -- identify a commit (for example, a branch name or a full commit ID).
    GetMergeCommit -> Text
destinationCommitSpecifier :: Prelude.Text
  }
  deriving (GetMergeCommit -> GetMergeCommit -> Bool
(GetMergeCommit -> GetMergeCommit -> Bool)
-> (GetMergeCommit -> GetMergeCommit -> Bool) -> Eq GetMergeCommit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMergeCommit -> GetMergeCommit -> Bool
$c/= :: GetMergeCommit -> GetMergeCommit -> Bool
== :: GetMergeCommit -> GetMergeCommit -> Bool
$c== :: GetMergeCommit -> GetMergeCommit -> Bool
Prelude.Eq, ReadPrec [GetMergeCommit]
ReadPrec GetMergeCommit
Int -> ReadS GetMergeCommit
ReadS [GetMergeCommit]
(Int -> ReadS GetMergeCommit)
-> ReadS [GetMergeCommit]
-> ReadPrec GetMergeCommit
-> ReadPrec [GetMergeCommit]
-> Read GetMergeCommit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMergeCommit]
$creadListPrec :: ReadPrec [GetMergeCommit]
readPrec :: ReadPrec GetMergeCommit
$creadPrec :: ReadPrec GetMergeCommit
readList :: ReadS [GetMergeCommit]
$creadList :: ReadS [GetMergeCommit]
readsPrec :: Int -> ReadS GetMergeCommit
$creadsPrec :: Int -> ReadS GetMergeCommit
Prelude.Read, Int -> GetMergeCommit -> ShowS
[GetMergeCommit] -> ShowS
GetMergeCommit -> String
(Int -> GetMergeCommit -> ShowS)
-> (GetMergeCommit -> String)
-> ([GetMergeCommit] -> ShowS)
-> Show GetMergeCommit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMergeCommit] -> ShowS
$cshowList :: [GetMergeCommit] -> ShowS
show :: GetMergeCommit -> String
$cshow :: GetMergeCommit -> String
showsPrec :: Int -> GetMergeCommit -> ShowS
$cshowsPrec :: Int -> GetMergeCommit -> ShowS
Prelude.Show, (forall x. GetMergeCommit -> Rep GetMergeCommit x)
-> (forall x. Rep GetMergeCommit x -> GetMergeCommit)
-> Generic GetMergeCommit
forall x. Rep GetMergeCommit x -> GetMergeCommit
forall x. GetMergeCommit -> Rep GetMergeCommit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMergeCommit x -> GetMergeCommit
$cfrom :: forall x. GetMergeCommit -> Rep GetMergeCommit x
Prelude.Generic)

-- |
-- Create a value of 'GetMergeCommit' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'conflictDetailLevel', 'getMergeCommit_conflictDetailLevel' - The level of conflict detail to use. If unspecified, the default
-- FILE_LEVEL is used, which returns a not-mergeable result if the same
-- file has differences in both branches. If LINE_LEVEL is specified, a
-- conflict is considered not mergeable if the same file in both branches
-- has differences on the same line.
--
-- 'conflictResolutionStrategy', 'getMergeCommit_conflictResolutionStrategy' - Specifies which branch to use when resolving conflicts, or whether to
-- attempt automatically merging two versions of a file. The default is
-- NONE, which requires any conflicts to be resolved manually before the
-- merge operation is successful.
--
-- 'repositoryName', 'getMergeCommit_repositoryName' - The name of the repository that contains the merge commit about which
-- you want to get information.
--
-- 'sourceCommitSpecifier', 'getMergeCommit_sourceCommitSpecifier' - The branch, tag, HEAD, or other fully qualified reference used to
-- identify a commit (for example, a branch name or a full commit ID).
--
-- 'destinationCommitSpecifier', 'getMergeCommit_destinationCommitSpecifier' - The branch, tag, HEAD, or other fully qualified reference used to
-- identify a commit (for example, a branch name or a full commit ID).
newGetMergeCommit ::
  -- | 'repositoryName'
  Prelude.Text ->
  -- | 'sourceCommitSpecifier'
  Prelude.Text ->
  -- | 'destinationCommitSpecifier'
  Prelude.Text ->
  GetMergeCommit
newGetMergeCommit :: Text -> Text -> Text -> GetMergeCommit
newGetMergeCommit
  Text
pRepositoryName_
  Text
pSourceCommitSpecifier_
  Text
pDestinationCommitSpecifier_ =
    GetMergeCommit' :: Maybe ConflictDetailLevelTypeEnum
-> Maybe ConflictResolutionStrategyTypeEnum
-> Text
-> Text
-> Text
-> GetMergeCommit
GetMergeCommit'
      { $sel:conflictDetailLevel:GetMergeCommit' :: Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel =
          Maybe ConflictDetailLevelTypeEnum
forall a. Maybe a
Prelude.Nothing,
        $sel:conflictResolutionStrategy:GetMergeCommit' :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy = Maybe ConflictResolutionStrategyTypeEnum
forall a. Maybe a
Prelude.Nothing,
        $sel:repositoryName:GetMergeCommit' :: Text
repositoryName = Text
pRepositoryName_,
        $sel:sourceCommitSpecifier:GetMergeCommit' :: Text
sourceCommitSpecifier = Text
pSourceCommitSpecifier_,
        $sel:destinationCommitSpecifier:GetMergeCommit' :: Text
destinationCommitSpecifier =
          Text
pDestinationCommitSpecifier_
      }

-- | The level of conflict detail to use. If unspecified, the default
-- FILE_LEVEL is used, which returns a not-mergeable result if the same
-- file has differences in both branches. If LINE_LEVEL is specified, a
-- conflict is considered not mergeable if the same file in both branches
-- has differences on the same line.
getMergeCommit_conflictDetailLevel :: Lens.Lens' GetMergeCommit (Prelude.Maybe ConflictDetailLevelTypeEnum)
getMergeCommit_conflictDetailLevel :: (Maybe ConflictDetailLevelTypeEnum
 -> f (Maybe ConflictDetailLevelTypeEnum))
-> GetMergeCommit -> f GetMergeCommit
getMergeCommit_conflictDetailLevel = (GetMergeCommit -> Maybe ConflictDetailLevelTypeEnum)
-> (GetMergeCommit
    -> Maybe ConflictDetailLevelTypeEnum -> GetMergeCommit)
-> Lens
     GetMergeCommit
     GetMergeCommit
     (Maybe ConflictDetailLevelTypeEnum)
     (Maybe ConflictDetailLevelTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommit' {Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
$sel:conflictDetailLevel:GetMergeCommit' :: GetMergeCommit -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel} -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel) (\s :: GetMergeCommit
s@GetMergeCommit' {} Maybe ConflictDetailLevelTypeEnum
a -> GetMergeCommit
s {$sel:conflictDetailLevel:GetMergeCommit' :: Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel = Maybe ConflictDetailLevelTypeEnum
a} :: GetMergeCommit)

-- | Specifies which branch to use when resolving conflicts, or whether to
-- attempt automatically merging two versions of a file. The default is
-- NONE, which requires any conflicts to be resolved manually before the
-- merge operation is successful.
getMergeCommit_conflictResolutionStrategy :: Lens.Lens' GetMergeCommit (Prelude.Maybe ConflictResolutionStrategyTypeEnum)
getMergeCommit_conflictResolutionStrategy :: (Maybe ConflictResolutionStrategyTypeEnum
 -> f (Maybe ConflictResolutionStrategyTypeEnum))
-> GetMergeCommit -> f GetMergeCommit
getMergeCommit_conflictResolutionStrategy = (GetMergeCommit -> Maybe ConflictResolutionStrategyTypeEnum)
-> (GetMergeCommit
    -> Maybe ConflictResolutionStrategyTypeEnum -> GetMergeCommit)
-> Lens
     GetMergeCommit
     GetMergeCommit
     (Maybe ConflictResolutionStrategyTypeEnum)
     (Maybe ConflictResolutionStrategyTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommit' {Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictResolutionStrategy:GetMergeCommit' :: GetMergeCommit -> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy} -> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy) (\s :: GetMergeCommit
s@GetMergeCommit' {} Maybe ConflictResolutionStrategyTypeEnum
a -> GetMergeCommit
s {$sel:conflictResolutionStrategy:GetMergeCommit' :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy = Maybe ConflictResolutionStrategyTypeEnum
a} :: GetMergeCommit)

-- | The name of the repository that contains the merge commit about which
-- you want to get information.
getMergeCommit_repositoryName :: Lens.Lens' GetMergeCommit Prelude.Text
getMergeCommit_repositoryName :: (Text -> f Text) -> GetMergeCommit -> f GetMergeCommit
getMergeCommit_repositoryName = (GetMergeCommit -> Text)
-> (GetMergeCommit -> Text -> GetMergeCommit)
-> Lens GetMergeCommit GetMergeCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommit' {Text
repositoryName :: Text
$sel:repositoryName:GetMergeCommit' :: GetMergeCommit -> Text
repositoryName} -> Text
repositoryName) (\s :: GetMergeCommit
s@GetMergeCommit' {} Text
a -> GetMergeCommit
s {$sel:repositoryName:GetMergeCommit' :: Text
repositoryName = Text
a} :: GetMergeCommit)

-- | The branch, tag, HEAD, or other fully qualified reference used to
-- identify a commit (for example, a branch name or a full commit ID).
getMergeCommit_sourceCommitSpecifier :: Lens.Lens' GetMergeCommit Prelude.Text
getMergeCommit_sourceCommitSpecifier :: (Text -> f Text) -> GetMergeCommit -> f GetMergeCommit
getMergeCommit_sourceCommitSpecifier = (GetMergeCommit -> Text)
-> (GetMergeCommit -> Text -> GetMergeCommit)
-> Lens GetMergeCommit GetMergeCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommit' {Text
sourceCommitSpecifier :: Text
$sel:sourceCommitSpecifier:GetMergeCommit' :: GetMergeCommit -> Text
sourceCommitSpecifier} -> Text
sourceCommitSpecifier) (\s :: GetMergeCommit
s@GetMergeCommit' {} Text
a -> GetMergeCommit
s {$sel:sourceCommitSpecifier:GetMergeCommit' :: Text
sourceCommitSpecifier = Text
a} :: GetMergeCommit)

-- | The branch, tag, HEAD, or other fully qualified reference used to
-- identify a commit (for example, a branch name or a full commit ID).
getMergeCommit_destinationCommitSpecifier :: Lens.Lens' GetMergeCommit Prelude.Text
getMergeCommit_destinationCommitSpecifier :: (Text -> f Text) -> GetMergeCommit -> f GetMergeCommit
getMergeCommit_destinationCommitSpecifier = (GetMergeCommit -> Text)
-> (GetMergeCommit -> Text -> GetMergeCommit)
-> Lens GetMergeCommit GetMergeCommit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommit' {Text
destinationCommitSpecifier :: Text
$sel:destinationCommitSpecifier:GetMergeCommit' :: GetMergeCommit -> Text
destinationCommitSpecifier} -> Text
destinationCommitSpecifier) (\s :: GetMergeCommit
s@GetMergeCommit' {} Text
a -> GetMergeCommit
s {$sel:destinationCommitSpecifier:GetMergeCommit' :: Text
destinationCommitSpecifier = Text
a} :: GetMergeCommit)

instance Core.AWSRequest GetMergeCommit where
  type
    AWSResponse GetMergeCommit =
      GetMergeCommitResponse
  request :: GetMergeCommit -> Request GetMergeCommit
request = Service -> GetMergeCommit -> Request GetMergeCommit
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetMergeCommit
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMergeCommit)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetMergeCommit))
-> Logger
-> Service
-> Proxy GetMergeCommit
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMergeCommit)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetMergeCommitResponse
GetMergeCommitResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> GetMergeCommitResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Int -> GetMergeCommitResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"mergedCommitId")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Int -> GetMergeCommitResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> GetMergeCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"destinationCommitId")
            Either
  String (Maybe Text -> Maybe Text -> Int -> GetMergeCommitResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetMergeCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"baseCommitId")
            Either String (Maybe Text -> Int -> GetMergeCommitResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetMergeCommitResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"sourceCommitId")
            Either String (Int -> GetMergeCommitResponse)
-> Either String Int -> Either String GetMergeCommitResponse
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 GetMergeCommit

instance Prelude.NFData GetMergeCommit

instance Core.ToHeaders GetMergeCommit where
  toHeaders :: GetMergeCommit -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetMergeCommit -> 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.GetMergeCommit" ::
                          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 GetMergeCommit where
  toJSON :: GetMergeCommit -> Value
toJSON GetMergeCommit' {Maybe ConflictDetailLevelTypeEnum
Maybe ConflictResolutionStrategyTypeEnum
Text
destinationCommitSpecifier :: Text
sourceCommitSpecifier :: Text
repositoryName :: Text
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
$sel:destinationCommitSpecifier:GetMergeCommit' :: GetMergeCommit -> Text
$sel:sourceCommitSpecifier:GetMergeCommit' :: GetMergeCommit -> Text
$sel:repositoryName:GetMergeCommit' :: GetMergeCommit -> Text
$sel:conflictResolutionStrategy:GetMergeCommit' :: GetMergeCommit -> Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictDetailLevel:GetMergeCommit' :: GetMergeCommit -> Maybe ConflictDetailLevelTypeEnum
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"conflictDetailLevel" Text -> ConflictDetailLevelTypeEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConflictDetailLevelTypeEnum -> Pair)
-> Maybe ConflictDetailLevelTypeEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel,
            (Text
"conflictResolutionStrategy" Text -> ConflictResolutionStrategyTypeEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConflictResolutionStrategyTypeEnum -> Pair)
-> Maybe ConflictResolutionStrategyTypeEnum -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy,
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"sourceCommitSpecifier"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceCommitSpecifier
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"destinationCommitSpecifier"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationCommitSpecifier
              )
          ]
      )

instance Core.ToPath GetMergeCommit where
  toPath :: GetMergeCommit -> ByteString
toPath = ByteString -> GetMergeCommit -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery GetMergeCommit where
  toQuery :: GetMergeCommit -> QueryString
toQuery = QueryString -> GetMergeCommit -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetMergeCommitResponse' smart constructor.
data GetMergeCommitResponse = GetMergeCommitResponse'
  { -- | The commit ID for the merge commit created when the source branch was
    -- merged into the destination branch. If the fast-forward merge strategy
    -- was used, there is no merge commit.
    GetMergeCommitResponse -> Maybe Text
mergedCommitId :: Prelude.Maybe Prelude.Text,
    -- | The commit ID of the destination commit specifier that was used in the
    -- merge evaluation.
    GetMergeCommitResponse -> Maybe Text
destinationCommitId :: Prelude.Maybe Prelude.Text,
    -- | The commit ID of the merge base.
    GetMergeCommitResponse -> Maybe Text
baseCommitId :: Prelude.Maybe Prelude.Text,
    -- | The commit ID of the source commit specifier that was used in the merge
    -- evaluation.
    GetMergeCommitResponse -> Maybe Text
sourceCommitId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetMergeCommitResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetMergeCommitResponse -> GetMergeCommitResponse -> Bool
(GetMergeCommitResponse -> GetMergeCommitResponse -> Bool)
-> (GetMergeCommitResponse -> GetMergeCommitResponse -> Bool)
-> Eq GetMergeCommitResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMergeCommitResponse -> GetMergeCommitResponse -> Bool
$c/= :: GetMergeCommitResponse -> GetMergeCommitResponse -> Bool
== :: GetMergeCommitResponse -> GetMergeCommitResponse -> Bool
$c== :: GetMergeCommitResponse -> GetMergeCommitResponse -> Bool
Prelude.Eq, ReadPrec [GetMergeCommitResponse]
ReadPrec GetMergeCommitResponse
Int -> ReadS GetMergeCommitResponse
ReadS [GetMergeCommitResponse]
(Int -> ReadS GetMergeCommitResponse)
-> ReadS [GetMergeCommitResponse]
-> ReadPrec GetMergeCommitResponse
-> ReadPrec [GetMergeCommitResponse]
-> Read GetMergeCommitResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMergeCommitResponse]
$creadListPrec :: ReadPrec [GetMergeCommitResponse]
readPrec :: ReadPrec GetMergeCommitResponse
$creadPrec :: ReadPrec GetMergeCommitResponse
readList :: ReadS [GetMergeCommitResponse]
$creadList :: ReadS [GetMergeCommitResponse]
readsPrec :: Int -> ReadS GetMergeCommitResponse
$creadsPrec :: Int -> ReadS GetMergeCommitResponse
Prelude.Read, Int -> GetMergeCommitResponse -> ShowS
[GetMergeCommitResponse] -> ShowS
GetMergeCommitResponse -> String
(Int -> GetMergeCommitResponse -> ShowS)
-> (GetMergeCommitResponse -> String)
-> ([GetMergeCommitResponse] -> ShowS)
-> Show GetMergeCommitResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMergeCommitResponse] -> ShowS
$cshowList :: [GetMergeCommitResponse] -> ShowS
show :: GetMergeCommitResponse -> String
$cshow :: GetMergeCommitResponse -> String
showsPrec :: Int -> GetMergeCommitResponse -> ShowS
$cshowsPrec :: Int -> GetMergeCommitResponse -> ShowS
Prelude.Show, (forall x. GetMergeCommitResponse -> Rep GetMergeCommitResponse x)
-> (forall x.
    Rep GetMergeCommitResponse x -> GetMergeCommitResponse)
-> Generic GetMergeCommitResponse
forall x. Rep GetMergeCommitResponse x -> GetMergeCommitResponse
forall x. GetMergeCommitResponse -> Rep GetMergeCommitResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMergeCommitResponse x -> GetMergeCommitResponse
$cfrom :: forall x. GetMergeCommitResponse -> Rep GetMergeCommitResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetMergeCommitResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'mergedCommitId', 'getMergeCommitResponse_mergedCommitId' - The commit ID for the merge commit created when the source branch was
-- merged into the destination branch. If the fast-forward merge strategy
-- was used, there is no merge commit.
--
-- 'destinationCommitId', 'getMergeCommitResponse_destinationCommitId' - The commit ID of the destination commit specifier that was used in the
-- merge evaluation.
--
-- 'baseCommitId', 'getMergeCommitResponse_baseCommitId' - The commit ID of the merge base.
--
-- 'sourceCommitId', 'getMergeCommitResponse_sourceCommitId' - The commit ID of the source commit specifier that was used in the merge
-- evaluation.
--
-- 'httpStatus', 'getMergeCommitResponse_httpStatus' - The response's http status code.
newGetMergeCommitResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMergeCommitResponse
newGetMergeCommitResponse :: Int -> GetMergeCommitResponse
newGetMergeCommitResponse Int
pHttpStatus_ =
  GetMergeCommitResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetMergeCommitResponse
GetMergeCommitResponse'
    { $sel:mergedCommitId:GetMergeCommitResponse' :: Maybe Text
mergedCommitId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationCommitId:GetMergeCommitResponse' :: Maybe Text
destinationCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:baseCommitId:GetMergeCommitResponse' :: Maybe Text
baseCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceCommitId:GetMergeCommitResponse' :: Maybe Text
sourceCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMergeCommitResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The commit ID for the merge commit created when the source branch was
-- merged into the destination branch. If the fast-forward merge strategy
-- was used, there is no merge commit.
getMergeCommitResponse_mergedCommitId :: Lens.Lens' GetMergeCommitResponse (Prelude.Maybe Prelude.Text)
getMergeCommitResponse_mergedCommitId :: (Maybe Text -> f (Maybe Text))
-> GetMergeCommitResponse -> f GetMergeCommitResponse
getMergeCommitResponse_mergedCommitId = (GetMergeCommitResponse -> Maybe Text)
-> (GetMergeCommitResponse -> Maybe Text -> GetMergeCommitResponse)
-> Lens
     GetMergeCommitResponse
     GetMergeCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommitResponse' {Maybe Text
mergedCommitId :: Maybe Text
$sel:mergedCommitId:GetMergeCommitResponse' :: GetMergeCommitResponse -> Maybe Text
mergedCommitId} -> Maybe Text
mergedCommitId) (\s :: GetMergeCommitResponse
s@GetMergeCommitResponse' {} Maybe Text
a -> GetMergeCommitResponse
s {$sel:mergedCommitId:GetMergeCommitResponse' :: Maybe Text
mergedCommitId = Maybe Text
a} :: GetMergeCommitResponse)

-- | The commit ID of the destination commit specifier that was used in the
-- merge evaluation.
getMergeCommitResponse_destinationCommitId :: Lens.Lens' GetMergeCommitResponse (Prelude.Maybe Prelude.Text)
getMergeCommitResponse_destinationCommitId :: (Maybe Text -> f (Maybe Text))
-> GetMergeCommitResponse -> f GetMergeCommitResponse
getMergeCommitResponse_destinationCommitId = (GetMergeCommitResponse -> Maybe Text)
-> (GetMergeCommitResponse -> Maybe Text -> GetMergeCommitResponse)
-> Lens
     GetMergeCommitResponse
     GetMergeCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommitResponse' {Maybe Text
destinationCommitId :: Maybe Text
$sel:destinationCommitId:GetMergeCommitResponse' :: GetMergeCommitResponse -> Maybe Text
destinationCommitId} -> Maybe Text
destinationCommitId) (\s :: GetMergeCommitResponse
s@GetMergeCommitResponse' {} Maybe Text
a -> GetMergeCommitResponse
s {$sel:destinationCommitId:GetMergeCommitResponse' :: Maybe Text
destinationCommitId = Maybe Text
a} :: GetMergeCommitResponse)

-- | The commit ID of the merge base.
getMergeCommitResponse_baseCommitId :: Lens.Lens' GetMergeCommitResponse (Prelude.Maybe Prelude.Text)
getMergeCommitResponse_baseCommitId :: (Maybe Text -> f (Maybe Text))
-> GetMergeCommitResponse -> f GetMergeCommitResponse
getMergeCommitResponse_baseCommitId = (GetMergeCommitResponse -> Maybe Text)
-> (GetMergeCommitResponse -> Maybe Text -> GetMergeCommitResponse)
-> Lens
     GetMergeCommitResponse
     GetMergeCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommitResponse' {Maybe Text
baseCommitId :: Maybe Text
$sel:baseCommitId:GetMergeCommitResponse' :: GetMergeCommitResponse -> Maybe Text
baseCommitId} -> Maybe Text
baseCommitId) (\s :: GetMergeCommitResponse
s@GetMergeCommitResponse' {} Maybe Text
a -> GetMergeCommitResponse
s {$sel:baseCommitId:GetMergeCommitResponse' :: Maybe Text
baseCommitId = Maybe Text
a} :: GetMergeCommitResponse)

-- | The commit ID of the source commit specifier that was used in the merge
-- evaluation.
getMergeCommitResponse_sourceCommitId :: Lens.Lens' GetMergeCommitResponse (Prelude.Maybe Prelude.Text)
getMergeCommitResponse_sourceCommitId :: (Maybe Text -> f (Maybe Text))
-> GetMergeCommitResponse -> f GetMergeCommitResponse
getMergeCommitResponse_sourceCommitId = (GetMergeCommitResponse -> Maybe Text)
-> (GetMergeCommitResponse -> Maybe Text -> GetMergeCommitResponse)
-> Lens
     GetMergeCommitResponse
     GetMergeCommitResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommitResponse' {Maybe Text
sourceCommitId :: Maybe Text
$sel:sourceCommitId:GetMergeCommitResponse' :: GetMergeCommitResponse -> Maybe Text
sourceCommitId} -> Maybe Text
sourceCommitId) (\s :: GetMergeCommitResponse
s@GetMergeCommitResponse' {} Maybe Text
a -> GetMergeCommitResponse
s {$sel:sourceCommitId:GetMergeCommitResponse' :: Maybe Text
sourceCommitId = Maybe Text
a} :: GetMergeCommitResponse)

-- | The response's http status code.
getMergeCommitResponse_httpStatus :: Lens.Lens' GetMergeCommitResponse Prelude.Int
getMergeCommitResponse_httpStatus :: (Int -> f Int)
-> GetMergeCommitResponse -> f GetMergeCommitResponse
getMergeCommitResponse_httpStatus = (GetMergeCommitResponse -> Int)
-> (GetMergeCommitResponse -> Int -> GetMergeCommitResponse)
-> Lens GetMergeCommitResponse GetMergeCommitResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeCommitResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMergeCommitResponse' :: GetMergeCommitResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMergeCommitResponse
s@GetMergeCommitResponse' {} Int
a -> GetMergeCommitResponse
s {$sel:httpStatus:GetMergeCommitResponse' :: Int
httpStatus = Int
a} :: GetMergeCommitResponse)

instance Prelude.NFData GetMergeCommitResponse