{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_authorName,
    mergePullRequestBySquash_commitMessage,
    mergePullRequestBySquash_conflictDetailLevel,
    mergePullRequestBySquash_conflictResolution,
    mergePullRequestBySquash_conflictResolutionStrategy,
    mergePullRequestBySquash_email,
    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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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 commit message to include in the commit information for the merge.
    MergePullRequestBySquash -> Maybe Text
commitMessage :: 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,
    -- | 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,
    -- | 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,
    -- | 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
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]
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
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.
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:
--
-- '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.
--
-- 'commitMessage', 'mergePullRequestBySquash_commitMessage' - The commit message to include in the commit information for the merge.
--
-- '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.
--
-- '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.
--
-- 'email', 'mergePullRequestBySquash_email' - The email address of the person merging the branches. This information
-- is used in the commit information for the merge.
--
-- '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'
      { $sel:authorName:MergePullRequestBySquash' :: Maybe Text
authorName =
          forall a. Maybe a
Prelude.Nothing,
        $sel:commitMessage:MergePullRequestBySquash' :: Maybe Text
commitMessage = forall a. Maybe a
Prelude.Nothing,
        $sel:conflictDetailLevel:MergePullRequestBySquash' :: Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel = forall a. Maybe a
Prelude.Nothing,
        $sel:conflictResolution:MergePullRequestBySquash' :: Maybe ConflictResolution
conflictResolution = forall a. Maybe a
Prelude.Nothing,
        $sel:conflictResolutionStrategy:MergePullRequestBySquash' :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy = forall a. Maybe a
Prelude.Nothing,
        $sel:email:MergePullRequestBySquash' :: Maybe Text
email = forall a. Maybe a
Prelude.Nothing,
        $sel:keepEmptyFolders:MergePullRequestBySquash' :: Maybe Bool
keepEmptyFolders = forall a. Maybe a
Prelude.Nothing,
        $sel:sourceCommitId:MergePullRequestBySquash' :: Maybe Text
sourceCommitId = forall a. Maybe a
Prelude.Nothing,
        $sel:pullRequestId:MergePullRequestBySquash' :: Text
pullRequestId = Text
pPullRequestId_,
        $sel:repositoryName:MergePullRequestBySquash' :: Text
repositoryName = Text
pRepositoryName_
      }

-- | 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 :: Lens' MergePullRequestBySquash (Maybe Text)
mergePullRequestBySquash_authorName = 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 commit message to include in the commit information for the merge.
mergePullRequestBySquash_commitMessage :: Lens.Lens' MergePullRequestBySquash (Prelude.Maybe Prelude.Text)
mergePullRequestBySquash_commitMessage :: Lens' MergePullRequestBySquash (Maybe Text)
mergePullRequestBySquash_commitMessage = 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)

-- | 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 :: Lens' MergePullRequestBySquash (Maybe ConflictDetailLevelTypeEnum)
mergePullRequestBySquash_conflictDetailLevel = 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)

-- | 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 :: Lens' MergePullRequestBySquash (Maybe ConflictResolution)
mergePullRequestBySquash_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 :: Lens'
  MergePullRequestBySquash (Maybe ConflictResolutionStrategyTypeEnum)
mergePullRequestBySquash_conflictResolutionStrategy = 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)

-- | 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 :: Lens' MergePullRequestBySquash (Maybe Text)
mergePullRequestBySquash_email = 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)

-- | 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 :: Lens' MergePullRequestBySquash (Maybe Bool)
mergePullRequestBySquash_keepEmptyFolders = 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 :: Lens' MergePullRequestBySquash (Maybe Text)
mergePullRequestBySquash_sourceCommitId = 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 :: Lens' MergePullRequestBySquash Text
mergePullRequestBySquash_pullRequestId = 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 :: Lens' MergePullRequestBySquash Text
mergePullRequestBySquash_repositoryName = 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 :: (Service -> Service)
-> MergePullRequestBySquash -> Request MergePullRequestBySquash
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy MergePullRequestBySquash
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse MergePullRequestBySquash)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe PullRequest -> Int -> MergePullRequestBySquashResponse
MergePullRequestBySquashResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"pullRequest")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable MergePullRequestBySquash where
  hashWithSalt :: Int -> MergePullRequestBySquash -> Int
hashWithSalt Int
_salt MergePullRequestBySquash' {Maybe Bool
Maybe Text
Maybe ConflictDetailLevelTypeEnum
Maybe ConflictResolutionStrategyTypeEnum
Maybe ConflictResolution
Text
repositoryName :: Text
pullRequestId :: Text
sourceCommitId :: Maybe Text
keepEmptyFolders :: Maybe Bool
email :: Maybe Text
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolution :: Maybe ConflictResolution
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
commitMessage :: Maybe Text
authorName :: 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:email:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:conflictResolutionStrategy:MergePullRequestBySquash' :: MergePullRequestBySquash
-> Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictResolution:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictResolution
$sel:conflictDetailLevel:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictDetailLevelTypeEnum
$sel:commitMessage:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:authorName:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
commitMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConflictResolution
conflictResolution
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
email
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
keepEmptyFolders
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceCommitId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pullRequestId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repositoryName

instance Prelude.NFData MergePullRequestBySquash where
  rnf :: MergePullRequestBySquash -> ()
rnf MergePullRequestBySquash' {Maybe Bool
Maybe Text
Maybe ConflictDetailLevelTypeEnum
Maybe ConflictResolutionStrategyTypeEnum
Maybe ConflictResolution
Text
repositoryName :: Text
pullRequestId :: Text
sourceCommitId :: Maybe Text
keepEmptyFolders :: Maybe Bool
email :: Maybe Text
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolution :: Maybe ConflictResolution
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
commitMessage :: Maybe Text
authorName :: 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:email:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:conflictResolutionStrategy:MergePullRequestBySquash' :: MergePullRequestBySquash
-> Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictResolution:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictResolution
$sel:conflictDetailLevel:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictDetailLevelTypeEnum
$sel:commitMessage:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:authorName:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
commitMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConflictResolution
conflictResolution
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
email
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
keepEmptyFolders
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceCommitId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
pullRequestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repositoryName

instance Data.ToHeaders MergePullRequestBySquash where
  toHeaders :: MergePullRequestBySquash -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"CodeCommit_20150413.MergePullRequestBySquash" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.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
email :: Maybe Text
conflictResolutionStrategy :: Maybe ConflictResolutionStrategyTypeEnum
conflictResolution :: Maybe ConflictResolution
conflictDetailLevel :: Maybe ConflictDetailLevelTypeEnum
commitMessage :: Maybe Text
authorName :: 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:email:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:conflictResolutionStrategy:MergePullRequestBySquash' :: MergePullRequestBySquash
-> Maybe ConflictResolutionStrategyTypeEnum
$sel:conflictResolution:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictResolution
$sel:conflictDetailLevel:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe ConflictDetailLevelTypeEnum
$sel:commitMessage:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
$sel:authorName:MergePullRequestBySquash' :: MergePullRequestBySquash -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"authorName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authorName,
            (Key
"commitMessage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
commitMessage,
            (Key
"conflictDetailLevel" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictDetailLevelTypeEnum
conflictDetailLevel,
            (Key
"conflictResolution" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictResolution
conflictResolution,
            (Key
"conflictResolutionStrategy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConflictResolutionStrategyTypeEnum
conflictResolutionStrategy,
            (Key
"email" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
email,
            (Key
"keepEmptyFolders" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
keepEmptyFolders,
            (Key
"sourceCommitId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceCommitId,
            forall a. a -> Maybe a
Prelude.Just (Key
"pullRequestId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
pullRequestId),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"repositoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
repositoryName)
          ]
      )

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

instance Data.ToQuery MergePullRequestBySquash where
  toQuery :: MergePullRequestBySquash -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:pullRequest:MergePullRequestBySquashResponse' :: Maybe PullRequest
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 :: Lens' MergePullRequestBySquashResponse (Maybe PullRequest)
mergePullRequestBySquashResponse_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 :: Lens' MergePullRequestBySquashResponse Int
mergePullRequestBySquashResponse_httpStatus = 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
  where
  rnf :: MergePullRequestBySquashResponse -> ()
rnf MergePullRequestBySquashResponse' {Int
Maybe PullRequest
httpStatus :: Int
pullRequest :: Maybe PullRequest
$sel:httpStatus:MergePullRequestBySquashResponse' :: MergePullRequestBySquashResponse -> Int
$sel:pullRequest:MergePullRequestBySquashResponse' :: MergePullRequestBySquashResponse -> Maybe PullRequest
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PullRequest
pullRequest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus