{-# 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.GetMergeOptions
-- 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 the merge options available for merging two
-- specified branches. For details about why a merge option is not
-- available, use GetMergeConflicts or DescribeMergeConflicts.
module Amazonka.CodeCommit.GetMergeOptions
  ( -- * Creating a Request
    GetMergeOptions (..),
    newGetMergeOptions,

    -- * Request Lenses
    getMergeOptions_conflictDetailLevel,
    getMergeOptions_conflictResolutionStrategy,
    getMergeOptions_repositoryName,
    getMergeOptions_sourceCommitSpecifier,
    getMergeOptions_destinationCommitSpecifier,

    -- * Destructuring the Response
    GetMergeOptionsResponse (..),
    newGetMergeOptionsResponse,

    -- * Response Lenses
    getMergeOptionsResponse_httpStatus,
    getMergeOptionsResponse_mergeOptions,
    getMergeOptionsResponse_sourceCommitId,
    getMergeOptionsResponse_destinationCommitId,
    getMergeOptionsResponse_baseCommitId,
  )
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:/ 'newGetMergeOptions' smart constructor.
data GetMergeOptions = GetMergeOptions'
  { -- | 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.
    GetMergeOptions -> 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.
    GetMergeOptions -> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy :: Prelude.Maybe ConflictResolutionStrategyTypeEnum,
    -- | The name of the repository that contains the commits about which you
    -- want to get merge options.
    GetMergeOptions -> 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).
    GetMergeOptions -> 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).
    GetMergeOptions -> Text
destinationCommitSpecifier :: Prelude.Text
  }
  deriving (GetMergeOptions -> GetMergeOptions -> Bool
(GetMergeOptions -> GetMergeOptions -> Bool)
-> (GetMergeOptions -> GetMergeOptions -> Bool)
-> Eq GetMergeOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMergeOptions -> GetMergeOptions -> Bool
$c/= :: GetMergeOptions -> GetMergeOptions -> Bool
== :: GetMergeOptions -> GetMergeOptions -> Bool
$c== :: GetMergeOptions -> GetMergeOptions -> Bool
Prelude.Eq, ReadPrec [GetMergeOptions]
ReadPrec GetMergeOptions
Int -> ReadS GetMergeOptions
ReadS [GetMergeOptions]
(Int -> ReadS GetMergeOptions)
-> ReadS [GetMergeOptions]
-> ReadPrec GetMergeOptions
-> ReadPrec [GetMergeOptions]
-> Read GetMergeOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMergeOptions]
$creadListPrec :: ReadPrec [GetMergeOptions]
readPrec :: ReadPrec GetMergeOptions
$creadPrec :: ReadPrec GetMergeOptions
readList :: ReadS [GetMergeOptions]
$creadList :: ReadS [GetMergeOptions]
readsPrec :: Int -> ReadS GetMergeOptions
$creadsPrec :: Int -> ReadS GetMergeOptions
Prelude.Read, Int -> GetMergeOptions -> ShowS
[GetMergeOptions] -> ShowS
GetMergeOptions -> String
(Int -> GetMergeOptions -> ShowS)
-> (GetMergeOptions -> String)
-> ([GetMergeOptions] -> ShowS)
-> Show GetMergeOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMergeOptions] -> ShowS
$cshowList :: [GetMergeOptions] -> ShowS
show :: GetMergeOptions -> String
$cshow :: GetMergeOptions -> String
showsPrec :: Int -> GetMergeOptions -> ShowS
$cshowsPrec :: Int -> GetMergeOptions -> ShowS
Prelude.Show, (forall x. GetMergeOptions -> Rep GetMergeOptions x)
-> (forall x. Rep GetMergeOptions x -> GetMergeOptions)
-> Generic GetMergeOptions
forall x. Rep GetMergeOptions x -> GetMergeOptions
forall x. GetMergeOptions -> Rep GetMergeOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMergeOptions x -> GetMergeOptions
$cfrom :: forall x. GetMergeOptions -> Rep GetMergeOptions x
Prelude.Generic)

-- |
-- Create a value of 'GetMergeOptions' 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', 'getMergeOptions_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', 'getMergeOptions_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', 'getMergeOptions_repositoryName' - The name of the repository that contains the commits about which you
-- want to get merge options.
--
-- 'sourceCommitSpecifier', 'getMergeOptions_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', 'getMergeOptions_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).
newGetMergeOptions ::
  -- | 'repositoryName'
  Prelude.Text ->
  -- | 'sourceCommitSpecifier'
  Prelude.Text ->
  -- | 'destinationCommitSpecifier'
  Prelude.Text ->
  GetMergeOptions
newGetMergeOptions :: Text -> Text -> Text -> GetMergeOptions
newGetMergeOptions
  Text
pRepositoryName_
  Text
pSourceCommitSpecifier_
  Text
pDestinationCommitSpecifier_ =
    GetMergeOptions' :: Maybe ConflictDetailLevelTypeEnum
-> Maybe ConflictResolutionStrategyTypeEnum
-> Text
-> Text
-> Text
-> GetMergeOptions
GetMergeOptions'
      { $sel:conflictDetailLevel:GetMergeOptions' :: Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel =
          Maybe ConflictDetailLevelTypeEnum
forall a. Maybe a
Prelude.Nothing,
        $sel:conflictResolutionStrategy:GetMergeOptions' :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy = Maybe ConflictResolutionStrategyTypeEnum
forall a. Maybe a
Prelude.Nothing,
        $sel:repositoryName:GetMergeOptions' :: Text
repositoryName = Text
pRepositoryName_,
        $sel:sourceCommitSpecifier:GetMergeOptions' :: Text
sourceCommitSpecifier = Text
pSourceCommitSpecifier_,
        $sel:destinationCommitSpecifier:GetMergeOptions' :: 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.
getMergeOptions_conflictDetailLevel :: Lens.Lens' GetMergeOptions (Prelude.Maybe ConflictDetailLevelTypeEnum)
getMergeOptions_conflictDetailLevel :: (Maybe ConflictDetailLevelTypeEnum
 -> f (Maybe ConflictDetailLevelTypeEnum))
-> GetMergeOptions -> f GetMergeOptions
getMergeOptions_conflictDetailLevel = (GetMergeOptions -> Maybe ConflictDetailLevelTypeEnum)
-> (GetMergeOptions
    -> Maybe ConflictDetailLevelTypeEnum -> GetMergeOptions)
-> Lens
     GetMergeOptions
     GetMergeOptions
     (Maybe ConflictDetailLevelTypeEnum)
     (Maybe ConflictDetailLevelTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeOptions' {Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
$sel:conflictDetailLevel:GetMergeOptions' :: GetMergeOptions -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel} -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel) (\s :: GetMergeOptions
s@GetMergeOptions' {} Maybe ConflictDetailLevelTypeEnum
a -> GetMergeOptions
s {$sel:conflictDetailLevel:GetMergeOptions' :: Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel = Maybe ConflictDetailLevelTypeEnum
a} :: GetMergeOptions)

-- | 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.
getMergeOptions_conflictResolutionStrategy :: Lens.Lens' GetMergeOptions (Prelude.Maybe ConflictResolutionStrategyTypeEnum)
getMergeOptions_conflictResolutionStrategy :: (Maybe ConflictResolutionStrategyTypeEnum
 -> f (Maybe ConflictResolutionStrategyTypeEnum))
-> GetMergeOptions -> f GetMergeOptions
getMergeOptions_conflictResolutionStrategy = (GetMergeOptions -> Maybe ConflictResolutionStrategyTypeEnum)
-> (GetMergeOptions
    -> Maybe ConflictResolutionStrategyTypeEnum -> GetMergeOptions)
-> Lens
     GetMergeOptions
     GetMergeOptions
     (Maybe ConflictResolutionStrategyTypeEnum)
     (Maybe ConflictResolutionStrategyTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeOptions' {Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictResolutionStrategy:GetMergeOptions' :: GetMergeOptions -> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy} -> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy) (\s :: GetMergeOptions
s@GetMergeOptions' {} Maybe ConflictResolutionStrategyTypeEnum
a -> GetMergeOptions
s {$sel:conflictResolutionStrategy:GetMergeOptions' :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy = Maybe ConflictResolutionStrategyTypeEnum
a} :: GetMergeOptions)

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

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

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

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

instance Prelude.Hashable GetMergeOptions

instance Prelude.NFData GetMergeOptions

instance Core.ToHeaders GetMergeOptions where
  toHeaders :: GetMergeOptions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetMergeOptions -> 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.GetMergeOptions" ::
                          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 GetMergeOptions where
  toJSON :: GetMergeOptions -> Value
toJSON GetMergeOptions' {Maybe ConflictDetailLevelTypeEnum
Maybe ConflictResolutionStrategyTypeEnum
Text
destinationCommitSpecifier :: Text
sourceCommitSpecifier :: Text
repositoryName :: Text
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
$sel:destinationCommitSpecifier:GetMergeOptions' :: GetMergeOptions -> Text
$sel:sourceCommitSpecifier:GetMergeOptions' :: GetMergeOptions -> Text
$sel:repositoryName:GetMergeOptions' :: GetMergeOptions -> Text
$sel:conflictResolutionStrategy:GetMergeOptions' :: GetMergeOptions -> Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictDetailLevel:GetMergeOptions' :: GetMergeOptions -> 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 GetMergeOptions where
  toPath :: GetMergeOptions -> ByteString
toPath = ByteString -> GetMergeOptions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newGetMergeOptionsResponse' smart constructor.
data GetMergeOptionsResponse = GetMergeOptionsResponse'
  { -- | The response's http status code.
    GetMergeOptionsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The merge option or strategy used to merge the code.
    GetMergeOptionsResponse -> [MergeOptionTypeEnum]
mergeOptions :: [MergeOptionTypeEnum],
    -- | The commit ID of the source commit specifier that was used in the merge
    -- evaluation.
    GetMergeOptionsResponse -> Text
sourceCommitId :: Prelude.Text,
    -- | The commit ID of the destination commit specifier that was used in the
    -- merge evaluation.
    GetMergeOptionsResponse -> Text
destinationCommitId :: Prelude.Text,
    -- | The commit ID of the merge base.
    GetMergeOptionsResponse -> Text
baseCommitId :: Prelude.Text
  }
  deriving (GetMergeOptionsResponse -> GetMergeOptionsResponse -> Bool
(GetMergeOptionsResponse -> GetMergeOptionsResponse -> Bool)
-> (GetMergeOptionsResponse -> GetMergeOptionsResponse -> Bool)
-> Eq GetMergeOptionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMergeOptionsResponse -> GetMergeOptionsResponse -> Bool
$c/= :: GetMergeOptionsResponse -> GetMergeOptionsResponse -> Bool
== :: GetMergeOptionsResponse -> GetMergeOptionsResponse -> Bool
$c== :: GetMergeOptionsResponse -> GetMergeOptionsResponse -> Bool
Prelude.Eq, ReadPrec [GetMergeOptionsResponse]
ReadPrec GetMergeOptionsResponse
Int -> ReadS GetMergeOptionsResponse
ReadS [GetMergeOptionsResponse]
(Int -> ReadS GetMergeOptionsResponse)
-> ReadS [GetMergeOptionsResponse]
-> ReadPrec GetMergeOptionsResponse
-> ReadPrec [GetMergeOptionsResponse]
-> Read GetMergeOptionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMergeOptionsResponse]
$creadListPrec :: ReadPrec [GetMergeOptionsResponse]
readPrec :: ReadPrec GetMergeOptionsResponse
$creadPrec :: ReadPrec GetMergeOptionsResponse
readList :: ReadS [GetMergeOptionsResponse]
$creadList :: ReadS [GetMergeOptionsResponse]
readsPrec :: Int -> ReadS GetMergeOptionsResponse
$creadsPrec :: Int -> ReadS GetMergeOptionsResponse
Prelude.Read, Int -> GetMergeOptionsResponse -> ShowS
[GetMergeOptionsResponse] -> ShowS
GetMergeOptionsResponse -> String
(Int -> GetMergeOptionsResponse -> ShowS)
-> (GetMergeOptionsResponse -> String)
-> ([GetMergeOptionsResponse] -> ShowS)
-> Show GetMergeOptionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMergeOptionsResponse] -> ShowS
$cshowList :: [GetMergeOptionsResponse] -> ShowS
show :: GetMergeOptionsResponse -> String
$cshow :: GetMergeOptionsResponse -> String
showsPrec :: Int -> GetMergeOptionsResponse -> ShowS
$cshowsPrec :: Int -> GetMergeOptionsResponse -> ShowS
Prelude.Show, (forall x.
 GetMergeOptionsResponse -> Rep GetMergeOptionsResponse x)
-> (forall x.
    Rep GetMergeOptionsResponse x -> GetMergeOptionsResponse)
-> Generic GetMergeOptionsResponse
forall x. Rep GetMergeOptionsResponse x -> GetMergeOptionsResponse
forall x. GetMergeOptionsResponse -> Rep GetMergeOptionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMergeOptionsResponse x -> GetMergeOptionsResponse
$cfrom :: forall x. GetMergeOptionsResponse -> Rep GetMergeOptionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetMergeOptionsResponse' 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:
--
-- 'httpStatus', 'getMergeOptionsResponse_httpStatus' - The response's http status code.
--
-- 'mergeOptions', 'getMergeOptionsResponse_mergeOptions' - The merge option or strategy used to merge the code.
--
-- 'sourceCommitId', 'getMergeOptionsResponse_sourceCommitId' - The commit ID of the source commit specifier that was used in the merge
-- evaluation.
--
-- 'destinationCommitId', 'getMergeOptionsResponse_destinationCommitId' - The commit ID of the destination commit specifier that was used in the
-- merge evaluation.
--
-- 'baseCommitId', 'getMergeOptionsResponse_baseCommitId' - The commit ID of the merge base.
newGetMergeOptionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'sourceCommitId'
  Prelude.Text ->
  -- | 'destinationCommitId'
  Prelude.Text ->
  -- | 'baseCommitId'
  Prelude.Text ->
  GetMergeOptionsResponse
newGetMergeOptionsResponse :: Int -> Text -> Text -> Text -> GetMergeOptionsResponse
newGetMergeOptionsResponse
  Int
pHttpStatus_
  Text
pSourceCommitId_
  Text
pDestinationCommitId_
  Text
pBaseCommitId_ =
    GetMergeOptionsResponse' :: Int
-> [MergeOptionTypeEnum]
-> Text
-> Text
-> Text
-> GetMergeOptionsResponse
GetMergeOptionsResponse'
      { $sel:httpStatus:GetMergeOptionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:mergeOptions:GetMergeOptionsResponse' :: [MergeOptionTypeEnum]
mergeOptions = [MergeOptionTypeEnum]
forall a. Monoid a => a
Prelude.mempty,
        $sel:sourceCommitId:GetMergeOptionsResponse' :: Text
sourceCommitId = Text
pSourceCommitId_,
        $sel:destinationCommitId:GetMergeOptionsResponse' :: Text
destinationCommitId = Text
pDestinationCommitId_,
        $sel:baseCommitId:GetMergeOptionsResponse' :: Text
baseCommitId = Text
pBaseCommitId_
      }

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

-- | The merge option or strategy used to merge the code.
getMergeOptionsResponse_mergeOptions :: Lens.Lens' GetMergeOptionsResponse [MergeOptionTypeEnum]
getMergeOptionsResponse_mergeOptions :: ([MergeOptionTypeEnum] -> f [MergeOptionTypeEnum])
-> GetMergeOptionsResponse -> f GetMergeOptionsResponse
getMergeOptionsResponse_mergeOptions = (GetMergeOptionsResponse -> [MergeOptionTypeEnum])
-> (GetMergeOptionsResponse
    -> [MergeOptionTypeEnum] -> GetMergeOptionsResponse)
-> Lens
     GetMergeOptionsResponse
     GetMergeOptionsResponse
     [MergeOptionTypeEnum]
     [MergeOptionTypeEnum]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMergeOptionsResponse' {[MergeOptionTypeEnum]
mergeOptions :: [MergeOptionTypeEnum]
$sel:mergeOptions:GetMergeOptionsResponse' :: GetMergeOptionsResponse -> [MergeOptionTypeEnum]
mergeOptions} -> [MergeOptionTypeEnum]
mergeOptions) (\s :: GetMergeOptionsResponse
s@GetMergeOptionsResponse' {} [MergeOptionTypeEnum]
a -> GetMergeOptionsResponse
s {$sel:mergeOptions:GetMergeOptionsResponse' :: [MergeOptionTypeEnum]
mergeOptions = [MergeOptionTypeEnum]
a} :: GetMergeOptionsResponse) (([MergeOptionTypeEnum] -> f [MergeOptionTypeEnum])
 -> GetMergeOptionsResponse -> f GetMergeOptionsResponse)
-> (([MergeOptionTypeEnum] -> f [MergeOptionTypeEnum])
    -> [MergeOptionTypeEnum] -> f [MergeOptionTypeEnum])
-> ([MergeOptionTypeEnum] -> f [MergeOptionTypeEnum])
-> GetMergeOptionsResponse
-> f GetMergeOptionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MergeOptionTypeEnum] -> f [MergeOptionTypeEnum])
-> [MergeOptionTypeEnum] -> f [MergeOptionTypeEnum]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

instance Prelude.NFData GetMergeOptionsResponse