{-# 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.MergePullRequestBySquash
-- 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)
--
-- Attempts to merge the source commit of a pull request into the specified
-- destination branch for that pull request at the specified commit using
-- the squash merge strategy. If the merge is successful, it closes the
-- pull request.
module Amazonka.CodeCommit.MergePullRequestBySquash
  ( -- * Creating a Request
    MergePullRequestBySquash (..),
    newMergePullRequestBySquash,

    -- * Request Lenses
    mergePullRequestBySquash_email,
    mergePullRequestBySquash_authorName,
    mergePullRequestBySquash_conflictDetailLevel,
    mergePullRequestBySquash_commitMessage,
    mergePullRequestBySquash_conflictResolution,
    mergePullRequestBySquash_conflictResolutionStrategy,
    mergePullRequestBySquash_keepEmptyFolders,
    mergePullRequestBySquash_sourceCommitId,
    mergePullRequestBySquash_pullRequestId,
    mergePullRequestBySquash_repositoryName,

    -- * Destructuring the Response
    MergePullRequestBySquashResponse (..),
    newMergePullRequestBySquashResponse,

    -- * Response Lenses
    mergePullRequestBySquashResponse_pullRequest,
    mergePullRequestBySquashResponse_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:/ 'newMergePullRequestBySquash' smart constructor.
data MergePullRequestBySquash = MergePullRequestBySquash'
  { -- | The email address of the person merging the branches. This information
    -- is used in the commit information for the merge.
    MergePullRequestBySquash -> Maybe Text
email :: Prelude.Maybe Prelude.Text,
    -- | The name of the author who created the commit. This information is used
    -- as both the author and committer for the commit.
    MergePullRequestBySquash -> Maybe Text
authorName :: Prelude.Maybe Prelude.Text,
    -- | 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.
    MergePullRequestBySquash -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel :: Prelude.Maybe ConflictDetailLevelTypeEnum,
    -- | The commit message to include in the commit information for the merge.
    MergePullRequestBySquash -> Maybe Text
commitMessage :: Prelude.Maybe Prelude.Text,
    -- | If AUTOMERGE is the conflict resolution strategy, a list of inputs to
    -- use when resolving conflicts during a merge.
    MergePullRequestBySquash -> Maybe ConflictResolution
conflictResolution :: Prelude.Maybe ConflictResolution,
    -- | 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.
    MergePullRequestBySquash
-> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy :: Prelude.Maybe ConflictResolutionStrategyTypeEnum,
    -- | If the commit contains deletions, whether to keep a folder or folder
    -- structure if the changes leave the folders empty. If true, a .gitkeep
    -- file is created for empty folders. The default is false.
    MergePullRequestBySquash -> Maybe Bool
keepEmptyFolders :: Prelude.Maybe Prelude.Bool,
    -- | The full commit ID of the original or updated commit in the pull request
    -- source branch. Pass this value if you want an exception thrown if the
    -- current commit ID of the tip of the source branch does not match this
    -- commit ID.
    MergePullRequestBySquash -> Maybe Text
sourceCommitId :: Prelude.Maybe Prelude.Text,
    -- | The system-generated ID of the pull request. To get this ID, use
    -- ListPullRequests.
    MergePullRequestBySquash -> Text
pullRequestId :: Prelude.Text,
    -- | The name of the repository where the pull request was created.
    MergePullRequestBySquash -> Text
repositoryName :: Prelude.Text
  }
  deriving (MergePullRequestBySquash -> MergePullRequestBySquash -> Bool
(MergePullRequestBySquash -> MergePullRequestBySquash -> Bool)
-> (MergePullRequestBySquash -> MergePullRequestBySquash -> Bool)
-> Eq MergePullRequestBySquash
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MergePullRequestBySquash -> MergePullRequestBySquash -> Bool
$c/= :: MergePullRequestBySquash -> MergePullRequestBySquash -> Bool
== :: MergePullRequestBySquash -> MergePullRequestBySquash -> Bool
$c== :: MergePullRequestBySquash -> MergePullRequestBySquash -> Bool
Prelude.Eq, ReadPrec [MergePullRequestBySquash]
ReadPrec MergePullRequestBySquash
Int -> ReadS MergePullRequestBySquash
ReadS [MergePullRequestBySquash]
(Int -> ReadS MergePullRequestBySquash)
-> ReadS [MergePullRequestBySquash]
-> ReadPrec MergePullRequestBySquash
-> ReadPrec [MergePullRequestBySquash]
-> Read MergePullRequestBySquash
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MergePullRequestBySquash]
$creadListPrec :: ReadPrec [MergePullRequestBySquash]
readPrec :: ReadPrec MergePullRequestBySquash
$creadPrec :: ReadPrec MergePullRequestBySquash
readList :: ReadS [MergePullRequestBySquash]
$creadList :: ReadS [MergePullRequestBySquash]
readsPrec :: Int -> ReadS MergePullRequestBySquash
$creadsPrec :: Int -> ReadS MergePullRequestBySquash
Prelude.Read, Int -> MergePullRequestBySquash -> ShowS
[MergePullRequestBySquash] -> ShowS
MergePullRequestBySquash -> String
(Int -> MergePullRequestBySquash -> ShowS)
-> (MergePullRequestBySquash -> String)
-> ([MergePullRequestBySquash] -> ShowS)
-> Show MergePullRequestBySquash
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MergePullRequestBySquash] -> ShowS
$cshowList :: [MergePullRequestBySquash] -> ShowS
show :: MergePullRequestBySquash -> String
$cshow :: MergePullRequestBySquash -> String
showsPrec :: Int -> MergePullRequestBySquash -> ShowS
$cshowsPrec :: Int -> MergePullRequestBySquash -> ShowS
Prelude.Show, (forall x.
 MergePullRequestBySquash -> Rep MergePullRequestBySquash x)
-> (forall x.
    Rep MergePullRequestBySquash x -> MergePullRequestBySquash)
-> Generic MergePullRequestBySquash
forall x.
Rep MergePullRequestBySquash x -> MergePullRequestBySquash
forall x.
MergePullRequestBySquash -> Rep MergePullRequestBySquash x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MergePullRequestBySquash x -> MergePullRequestBySquash
$cfrom :: forall x.
MergePullRequestBySquash -> Rep MergePullRequestBySquash x
Prelude.Generic)

-- |
-- Create a value of 'MergePullRequestBySquash' 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:
--
-- 'email', 'mergePullRequestBySquash_email' - The email address of the person merging the branches. This information
-- is used in the commit information for the merge.
--
-- 'authorName', 'mergePullRequestBySquash_authorName' - The name of the author who created the commit. This information is used
-- as both the author and committer for the commit.
--
-- 'conflictDetailLevel', 'mergePullRequestBySquash_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.
--
-- 'commitMessage', 'mergePullRequestBySquash_commitMessage' - The commit message to include in the commit information for the merge.
--
-- 'conflictResolution', 'mergePullRequestBySquash_conflictResolution' - If AUTOMERGE is the conflict resolution strategy, a list of inputs to
-- use when resolving conflicts during a merge.
--
-- 'conflictResolutionStrategy', 'mergePullRequestBySquash_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.
--
-- 'keepEmptyFolders', 'mergePullRequestBySquash_keepEmptyFolders' - If the commit contains deletions, whether to keep a folder or folder
-- structure if the changes leave the folders empty. If true, a .gitkeep
-- file is created for empty folders. The default is false.
--
-- 'sourceCommitId', 'mergePullRequestBySquash_sourceCommitId' - The full commit ID of the original or updated commit in the pull request
-- source branch. Pass this value if you want an exception thrown if the
-- current commit ID of the tip of the source branch does not match this
-- commit ID.
--
-- 'pullRequestId', 'mergePullRequestBySquash_pullRequestId' - The system-generated ID of the pull request. To get this ID, use
-- ListPullRequests.
--
-- 'repositoryName', 'mergePullRequestBySquash_repositoryName' - The name of the repository where the pull request was created.
newMergePullRequestBySquash ::
  -- | 'pullRequestId'
  Prelude.Text ->
  -- | 'repositoryName'
  Prelude.Text ->
  MergePullRequestBySquash
newMergePullRequestBySquash :: Text -> Text -> MergePullRequestBySquash
newMergePullRequestBySquash
  Text
pPullRequestId_
  Text
pRepositoryName_ =
    MergePullRequestBySquash' :: Maybe Text
-> Maybe Text
-> Maybe ConflictDetailLevelTypeEnum
-> Maybe Text
-> Maybe ConflictResolution
-> Maybe ConflictResolutionStrategyTypeEnum
-> Maybe Bool
-> Maybe Text
-> Text
-> Text
-> MergePullRequestBySquash
MergePullRequestBySquash'
      { $sel:email:MergePullRequestBySquash' :: Maybe Text
email = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:authorName:MergePullRequestBySquash' :: Maybe Text
authorName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:conflictDetailLevel:MergePullRequestBySquash' :: Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel = Maybe ConflictDetailLevelTypeEnum
forall a. Maybe a
Prelude.Nothing,
        $sel:commitMessage:MergePullRequestBySquash' :: Maybe Text
commitMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:conflictResolution:MergePullRequestBySquash' :: Maybe ConflictResolution
conflictResolution = Maybe ConflictResolution
forall a. Maybe a
Prelude.Nothing,
        $sel:conflictResolutionStrategy:MergePullRequestBySquash' :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy = Maybe ConflictResolutionStrategyTypeEnum
forall a. Maybe a
Prelude.Nothing,
        $sel:keepEmptyFolders:MergePullRequestBySquash' :: Maybe Bool
keepEmptyFolders = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceCommitId:MergePullRequestBySquash' :: Maybe Text
sourceCommitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:pullRequestId:MergePullRequestBySquash' :: Text
pullRequestId = Text
pPullRequestId_,
        $sel:repositoryName:MergePullRequestBySquash' :: Text
repositoryName = Text
pRepositoryName_
      }

-- | The email address of the person merging the branches. This information
-- is used in the commit information for the merge.
mergePullRequestBySquash_email :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe Prelude.Text)
mergePullRequestBySquash_email :: (Maybe Text -> f (Maybe Text))
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_email = (MergePullRequestBySquash -> Maybe Text)
-> (MergePullRequestBySquash
    -> Maybe Text -> MergePullRequestBySquash)
-> Lens
     MergePullRequestBySquash
     MergePullRequestBySquash
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Maybe Text
email :: Maybe Text
$sel:email:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
email} -> Maybe Text
email) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Maybe Text
a -> MergePullRequestBySquash
s {$sel:email:MergePullRequestBySquash' :: Maybe Text
email = Maybe Text
a} :: MergePullRequestBySquash)

-- | The name of the author who created the commit. This information is used
-- as both the author and committer for the commit.
mergePullRequestBySquash_authorName :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe Prelude.Text)
mergePullRequestBySquash_authorName :: (Maybe Text -> f (Maybe Text))
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_authorName = (MergePullRequestBySquash -> Maybe Text)
-> (MergePullRequestBySquash
    -> Maybe Text -> MergePullRequestBySquash)
-> Lens
     MergePullRequestBySquash
     MergePullRequestBySquash
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Maybe Text
authorName :: Maybe Text
$sel:authorName:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
authorName} -> Maybe Text
authorName) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Maybe Text
a -> MergePullRequestBySquash
s {$sel:authorName:MergePullRequestBySquash' :: Maybe Text
authorName = Maybe Text
a} :: MergePullRequestBySquash)

-- | 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.
mergePullRequestBySquash_conflictDetailLevel :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe ConflictDetailLevelTypeEnum)
mergePullRequestBySquash_conflictDetailLevel :: (Maybe ConflictDetailLevelTypeEnum
 -> f (Maybe ConflictDetailLevelTypeEnum))
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_conflictDetailLevel = (MergePullRequestBySquash -> Maybe ConflictDetailLevelTypeEnum)
-> (MergePullRequestBySquash
    -> Maybe ConflictDetailLevelTypeEnum -> MergePullRequestBySquash)
-> Lens
     MergePullRequestBySquash
     MergePullRequestBySquash
     (Maybe ConflictDetailLevelTypeEnum)
     (Maybe ConflictDetailLevelTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
$sel:conflictDetailLevel:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel} -> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Maybe ConflictDetailLevelTypeEnum
a -> MergePullRequestBySquash
s {$sel:conflictDetailLevel:MergePullRequestBySquash' :: Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel = Maybe ConflictDetailLevelTypeEnum
a} :: MergePullRequestBySquash)

-- | The commit message to include in the commit information for the merge.
mergePullRequestBySquash_commitMessage :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe Prelude.Text)
mergePullRequestBySquash_commitMessage :: (Maybe Text -> f (Maybe Text))
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_commitMessage = (MergePullRequestBySquash -> Maybe Text)
-> (MergePullRequestBySquash
    -> Maybe Text -> MergePullRequestBySquash)
-> Lens
     MergePullRequestBySquash
     MergePullRequestBySquash
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Maybe Text
commitMessage :: Maybe Text
$sel:commitMessage:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
commitMessage} -> Maybe Text
commitMessage) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Maybe Text
a -> MergePullRequestBySquash
s {$sel:commitMessage:MergePullRequestBySquash' :: Maybe Text
commitMessage = Maybe Text
a} :: MergePullRequestBySquash)

-- | If AUTOMERGE is the conflict resolution strategy, a list of inputs to
-- use when resolving conflicts during a merge.
mergePullRequestBySquash_conflictResolution :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe ConflictResolution)
mergePullRequestBySquash_conflictResolution :: (Maybe ConflictResolution -> f (Maybe ConflictResolution))
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_conflictResolution = (MergePullRequestBySquash -> Maybe ConflictResolution)
-> (MergePullRequestBySquash
    -> Maybe ConflictResolution -> MergePullRequestBySquash)
-> Lens
     MergePullRequestBySquash
     MergePullRequestBySquash
     (Maybe ConflictResolution)
     (Maybe ConflictResolution)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Maybe ConflictResolution
conflictResolution :: Maybe ConflictResolution
$sel:conflictResolution:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictResolution
conflictResolution} -> Maybe ConflictResolution
conflictResolution) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Maybe ConflictResolution
a -> MergePullRequestBySquash
s {$sel:conflictResolution:MergePullRequestBySquash' :: Maybe ConflictResolution
conflictResolution = Maybe ConflictResolution
a} :: MergePullRequestBySquash)

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

-- | If the commit contains deletions, whether to keep a folder or folder
-- structure if the changes leave the folders empty. If true, a .gitkeep
-- file is created for empty folders. The default is false.
mergePullRequestBySquash_keepEmptyFolders :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe Prelude.Bool)
mergePullRequestBySquash_keepEmptyFolders :: (Maybe Bool -> f (Maybe Bool))
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_keepEmptyFolders = (MergePullRequestBySquash -> Maybe Bool)
-> (MergePullRequestBySquash
    -> Maybe Bool -> MergePullRequestBySquash)
-> Lens
     MergePullRequestBySquash
     MergePullRequestBySquash
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Maybe Bool
keepEmptyFolders :: Maybe Bool
$sel:keepEmptyFolders:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Bool
keepEmptyFolders} -> Maybe Bool
keepEmptyFolders) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Maybe Bool
a -> MergePullRequestBySquash
s {$sel:keepEmptyFolders:MergePullRequestBySquash' :: Maybe Bool
keepEmptyFolders = Maybe Bool
a} :: MergePullRequestBySquash)

-- | The full commit ID of the original or updated commit in the pull request
-- source branch. Pass this value if you want an exception thrown if the
-- current commit ID of the tip of the source branch does not match this
-- commit ID.
mergePullRequestBySquash_sourceCommitId :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe Prelude.Text)
mergePullRequestBySquash_sourceCommitId :: (Maybe Text -> f (Maybe Text))
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_sourceCommitId = (MergePullRequestBySquash -> Maybe Text)
-> (MergePullRequestBySquash
    -> Maybe Text -> MergePullRequestBySquash)
-> Lens
     MergePullRequestBySquash
     MergePullRequestBySquash
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Maybe Text
sourceCommitId :: Maybe Text
$sel:sourceCommitId:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
sourceCommitId} -> Maybe Text
sourceCommitId) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Maybe Text
a -> MergePullRequestBySquash
s {$sel:sourceCommitId:MergePullRequestBySquash' :: Maybe Text
sourceCommitId = Maybe Text
a} :: MergePullRequestBySquash)

-- | The system-generated ID of the pull request. To get this ID, use
-- ListPullRequests.
mergePullRequestBySquash_pullRequestId :: Lens.Lens' MergePullRequestBySquash Prelude.Text
mergePullRequestBySquash_pullRequestId :: (Text -> f Text)
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_pullRequestId = (MergePullRequestBySquash -> Text)
-> (MergePullRequestBySquash -> Text -> MergePullRequestBySquash)
-> Lens MergePullRequestBySquash MergePullRequestBySquash Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Text
pullRequestId :: Text
$sel:pullRequestId:MergePullRequestBySquash' :: MergePullRequestBySquash -> Text
pullRequestId} -> Text
pullRequestId) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Text
a -> MergePullRequestBySquash
s {$sel:pullRequestId:MergePullRequestBySquash' :: Text
pullRequestId = Text
a} :: MergePullRequestBySquash)

-- | The name of the repository where the pull request was created.
mergePullRequestBySquash_repositoryName :: Lens.Lens' MergePullRequestBySquash Prelude.Text
mergePullRequestBySquash_repositoryName :: (Text -> f Text)
-> MergePullRequestBySquash -> f MergePullRequestBySquash
mergePullRequestBySquash_repositoryName = (MergePullRequestBySquash -> Text)
-> (MergePullRequestBySquash -> Text -> MergePullRequestBySquash)
-> Lens MergePullRequestBySquash MergePullRequestBySquash Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquash' {Text
repositoryName :: Text
$sel:repositoryName:MergePullRequestBySquash' :: MergePullRequestBySquash -> Text
repositoryName} -> Text
repositoryName) (\s :: MergePullRequestBySquash
s@MergePullRequestBySquash' {} Text
a -> MergePullRequestBySquash
s {$sel:repositoryName:MergePullRequestBySquash' :: Text
repositoryName = Text
a} :: MergePullRequestBySquash)

instance Core.AWSRequest MergePullRequestBySquash where
  type
    AWSResponse MergePullRequestBySquash =
      MergePullRequestBySquashResponse
  request :: MergePullRequestBySquash -> Request MergePullRequestBySquash
request = Service
-> MergePullRequestBySquash -> Request MergePullRequestBySquash
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy MergePullRequestBySquash
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse MergePullRequestBySquash)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse MergePullRequestBySquash))
-> Logger
-> Service
-> Proxy MergePullRequestBySquash
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse MergePullRequestBySquash)))
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 -> MergePullRequestBySquashResponse
MergePullRequestBySquashResponse'
            (Maybe PullRequest -> Int -> MergePullRequestBySquashResponse)
-> Either String (Maybe PullRequest)
-> Either String (Int -> MergePullRequestBySquashResponse)
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 -> MergePullRequestBySquashResponse)
-> Either String Int
-> Either String MergePullRequestBySquashResponse
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 MergePullRequestBySquash

instance Prelude.NFData MergePullRequestBySquash

instance Core.ToHeaders MergePullRequestBySquash where
  toHeaders :: MergePullRequestBySquash -> ResponseHeaders
toHeaders =
    ResponseHeaders -> MergePullRequestBySquash -> 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.MergePullRequestBySquash" ::
                          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 MergePullRequestBySquash where
  toJSON :: MergePullRequestBySquash -> Value
toJSON MergePullRequestBySquash' {Maybe Bool
Maybe Text
Maybe ConflictDetailLevelTypeEnum
Maybe ConflictResolutionStrategyTypeEnum
Maybe ConflictResolution
Text
repositoryName :: Text
pullRequestId :: Text
sourceCommitId :: Maybe Text
keepEmptyFolders :: Maybe Bool
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolution :: Maybe ConflictResolution
commitMessage :: Maybe Text
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
authorName :: Maybe Text
email :: Maybe Text
$sel:repositoryName:MergePullRequestBySquash' :: MergePullRequestBySquash -> Text
$sel:pullRequestId:MergePullRequestBySquash' :: MergePullRequestBySquash -> Text
$sel:sourceCommitId:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:keepEmptyFolders:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Bool
$sel:conflictResolutionStrategy:MergePullRequestBySquash' :: MergePullRequestBySquash
-> Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictResolution:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictResolution
$sel:commitMessage:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:conflictDetailLevel:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictDetailLevelTypeEnum
$sel:authorName:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:email:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"email" 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
email,
            (Text
"authorName" 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
authorName,
            (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
"commitMessage" 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
commitMessage,
            (Text
"conflictResolution" Text -> ConflictResolution -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConflictResolution -> Pair)
-> Maybe ConflictResolution -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictResolution
conflictResolution,
            (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,
            (Text
"keepEmptyFolders" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
keepEmptyFolders,
            (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 MergePullRequestBySquash where
  toPath :: MergePullRequestBySquash -> ByteString
toPath = ByteString -> MergePullRequestBySquash -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newMergePullRequestBySquashResponse' smart constructor.
data MergePullRequestBySquashResponse = MergePullRequestBySquashResponse'
  { MergePullRequestBySquashResponse -> Maybe PullRequest
pullRequest :: Prelude.Maybe PullRequest,
    -- | The response's http status code.
    MergePullRequestBySquashResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (MergePullRequestBySquashResponse
-> MergePullRequestBySquashResponse -> Bool
(MergePullRequestBySquashResponse
 -> MergePullRequestBySquashResponse -> Bool)
-> (MergePullRequestBySquashResponse
    -> MergePullRequestBySquashResponse -> Bool)
-> Eq MergePullRequestBySquashResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MergePullRequestBySquashResponse
-> MergePullRequestBySquashResponse -> Bool
$c/= :: MergePullRequestBySquashResponse
-> MergePullRequestBySquashResponse -> Bool
== :: MergePullRequestBySquashResponse
-> MergePullRequestBySquashResponse -> Bool
$c== :: MergePullRequestBySquashResponse
-> MergePullRequestBySquashResponse -> Bool
Prelude.Eq, ReadPrec [MergePullRequestBySquashResponse]
ReadPrec MergePullRequestBySquashResponse
Int -> ReadS MergePullRequestBySquashResponse
ReadS [MergePullRequestBySquashResponse]
(Int -> ReadS MergePullRequestBySquashResponse)
-> ReadS [MergePullRequestBySquashResponse]
-> ReadPrec MergePullRequestBySquashResponse
-> ReadPrec [MergePullRequestBySquashResponse]
-> Read MergePullRequestBySquashResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MergePullRequestBySquashResponse]
$creadListPrec :: ReadPrec [MergePullRequestBySquashResponse]
readPrec :: ReadPrec MergePullRequestBySquashResponse
$creadPrec :: ReadPrec MergePullRequestBySquashResponse
readList :: ReadS [MergePullRequestBySquashResponse]
$creadList :: ReadS [MergePullRequestBySquashResponse]
readsPrec :: Int -> ReadS MergePullRequestBySquashResponse
$creadsPrec :: Int -> ReadS MergePullRequestBySquashResponse
Prelude.Read, Int -> MergePullRequestBySquashResponse -> ShowS
[MergePullRequestBySquashResponse] -> ShowS
MergePullRequestBySquashResponse -> String
(Int -> MergePullRequestBySquashResponse -> ShowS)
-> (MergePullRequestBySquashResponse -> String)
-> ([MergePullRequestBySquashResponse] -> ShowS)
-> Show MergePullRequestBySquashResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MergePullRequestBySquashResponse] -> ShowS
$cshowList :: [MergePullRequestBySquashResponse] -> ShowS
show :: MergePullRequestBySquashResponse -> String
$cshow :: MergePullRequestBySquashResponse -> String
showsPrec :: Int -> MergePullRequestBySquashResponse -> ShowS
$cshowsPrec :: Int -> MergePullRequestBySquashResponse -> ShowS
Prelude.Show, (forall x.
 MergePullRequestBySquashResponse
 -> Rep MergePullRequestBySquashResponse x)
-> (forall x.
    Rep MergePullRequestBySquashResponse x
    -> MergePullRequestBySquashResponse)
-> Generic MergePullRequestBySquashResponse
forall x.
Rep MergePullRequestBySquashResponse x
-> MergePullRequestBySquashResponse
forall x.
MergePullRequestBySquashResponse
-> Rep MergePullRequestBySquashResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MergePullRequestBySquashResponse x
-> MergePullRequestBySquashResponse
$cfrom :: forall x.
MergePullRequestBySquashResponse
-> Rep MergePullRequestBySquashResponse x
Prelude.Generic)

-- |
-- Create a value of 'MergePullRequestBySquashResponse' 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:
--
-- 'pullRequest', 'mergePullRequestBySquashResponse_pullRequest' - Undocumented member.
--
-- 'httpStatus', 'mergePullRequestBySquashResponse_httpStatus' - The response's http status code.
newMergePullRequestBySquashResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  MergePullRequestBySquashResponse
newMergePullRequestBySquashResponse :: Int -> MergePullRequestBySquashResponse
newMergePullRequestBySquashResponse Int
pHttpStatus_ =
  MergePullRequestBySquashResponse' :: Maybe PullRequest -> Int -> MergePullRequestBySquashResponse
MergePullRequestBySquashResponse'
    { $sel:pullRequest:MergePullRequestBySquashResponse' :: Maybe PullRequest
pullRequest =
        Maybe PullRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:MergePullRequestBySquashResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
mergePullRequestBySquashResponse_pullRequest :: Lens.Lens' MergePullRequestBySquashResponse (Prelude.Maybe PullRequest)
mergePullRequestBySquashResponse_pullRequest :: (Maybe PullRequest -> f (Maybe PullRequest))
-> MergePullRequestBySquashResponse
-> f MergePullRequestBySquashResponse
mergePullRequestBySquashResponse_pullRequest = (MergePullRequestBySquashResponse -> Maybe PullRequest)
-> (MergePullRequestBySquashResponse
    -> Maybe PullRequest -> MergePullRequestBySquashResponse)
-> Lens
     MergePullRequestBySquashResponse
     MergePullRequestBySquashResponse
     (Maybe PullRequest)
     (Maybe PullRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MergePullRequestBySquashResponse' {Maybe PullRequest
pullRequest :: Maybe PullRequest
$sel:pullRequest:MergePullRequestBySquashResponse' :: MergePullRequestBySquashResponse -> Maybe PullRequest
pullRequest} -> Maybe PullRequest
pullRequest) (\s :: MergePullRequestBySquashResponse
s@MergePullRequestBySquashResponse' {} Maybe PullRequest
a -> MergePullRequestBySquashResponse
s {$sel:pullRequest:MergePullRequestBySquashResponse' :: Maybe PullRequest
pullRequest = Maybe PullRequest
a} :: MergePullRequestBySquashResponse)

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

instance
  Prelude.NFData
    MergePullRequestBySquashResponse