{-# 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.DeleteFile
-- 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)
--
-- Deletes a specified file from a specified branch. A commit is created on
-- the branch that contains the revision. The file still exists in the
-- commits earlier to the commit that contains the deletion.
module Amazonka.CodeCommit.DeleteFile
  ( -- * Creating a Request
    DeleteFile (..),
    newDeleteFile,

    -- * Request Lenses
    deleteFile_email,
    deleteFile_name,
    deleteFile_commitMessage,
    deleteFile_keepEmptyFolders,
    deleteFile_repositoryName,
    deleteFile_branchName,
    deleteFile_filePath,
    deleteFile_parentCommitId,

    -- * Destructuring the Response
    DeleteFileResponse (..),
    newDeleteFileResponse,

    -- * Response Lenses
    deleteFileResponse_httpStatus,
    deleteFileResponse_commitId,
    deleteFileResponse_blobId,
    deleteFileResponse_treeId,
    deleteFileResponse_filePath,
  )
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:/ 'newDeleteFile' smart constructor.
data DeleteFile = DeleteFile'
  { -- | The email address for the commit that deletes the file. If no email
    -- address is specified, the email address is left blank.
    DeleteFile -> Maybe Text
email :: Prelude.Maybe Prelude.Text,
    -- | The name of the author of the commit that deletes the file. If no name
    -- is specified, the user\'s ARN is used as the author name and committer
    -- name.
    DeleteFile -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The commit message you want to include as part of deleting the file.
    -- Commit messages are limited to 256 KB. If no message is specified, a
    -- default message is used.
    DeleteFile -> Maybe Text
commitMessage :: Prelude.Maybe Prelude.Text,
    -- | If a file is the only object in the folder or directory, specifies
    -- whether to delete the folder or directory that contains the file. By
    -- default, empty folders are deleted. This includes empty folders that are
    -- part of the directory structure. For example, if the path to a file is
    -- dir1\/dir2\/dir3\/dir4, and dir2 and dir3 are empty, deleting the last
    -- file in dir4 also deletes the empty folders dir4, dir3, and dir2.
    DeleteFile -> Maybe Bool
keepEmptyFolders :: Prelude.Maybe Prelude.Bool,
    -- | The name of the repository that contains the file to delete.
    DeleteFile -> Text
repositoryName :: Prelude.Text,
    -- | The name of the branch where the commit that deletes the file is made.
    DeleteFile -> Text
branchName :: Prelude.Text,
    -- | The fully qualified path to the file that to be deleted, including the
    -- full name and extension of that file. For example, \/examples\/file.md
    -- is a fully qualified path to a file named file.md in a folder named
    -- examples.
    DeleteFile -> Text
filePath :: Prelude.Text,
    -- | The ID of the commit that is the tip of the branch where you want to
    -- create the commit that deletes the file. This must be the HEAD commit
    -- for the branch. The commit that deletes the file is created from this
    -- commit ID.
    DeleteFile -> Text
parentCommitId :: Prelude.Text
  }
  deriving (DeleteFile -> DeleteFile -> Bool
(DeleteFile -> DeleteFile -> Bool)
-> (DeleteFile -> DeleteFile -> Bool) -> Eq DeleteFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFile -> DeleteFile -> Bool
$c/= :: DeleteFile -> DeleteFile -> Bool
== :: DeleteFile -> DeleteFile -> Bool
$c== :: DeleteFile -> DeleteFile -> Bool
Prelude.Eq, ReadPrec [DeleteFile]
ReadPrec DeleteFile
Int -> ReadS DeleteFile
ReadS [DeleteFile]
(Int -> ReadS DeleteFile)
-> ReadS [DeleteFile]
-> ReadPrec DeleteFile
-> ReadPrec [DeleteFile]
-> Read DeleteFile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFile]
$creadListPrec :: ReadPrec [DeleteFile]
readPrec :: ReadPrec DeleteFile
$creadPrec :: ReadPrec DeleteFile
readList :: ReadS [DeleteFile]
$creadList :: ReadS [DeleteFile]
readsPrec :: Int -> ReadS DeleteFile
$creadsPrec :: Int -> ReadS DeleteFile
Prelude.Read, Int -> DeleteFile -> ShowS
[DeleteFile] -> ShowS
DeleteFile -> String
(Int -> DeleteFile -> ShowS)
-> (DeleteFile -> String)
-> ([DeleteFile] -> ShowS)
-> Show DeleteFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFile] -> ShowS
$cshowList :: [DeleteFile] -> ShowS
show :: DeleteFile -> String
$cshow :: DeleteFile -> String
showsPrec :: Int -> DeleteFile -> ShowS
$cshowsPrec :: Int -> DeleteFile -> ShowS
Prelude.Show, (forall x. DeleteFile -> Rep DeleteFile x)
-> (forall x. Rep DeleteFile x -> DeleteFile) -> Generic DeleteFile
forall x. Rep DeleteFile x -> DeleteFile
forall x. DeleteFile -> Rep DeleteFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFile x -> DeleteFile
$cfrom :: forall x. DeleteFile -> Rep DeleteFile x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFile' 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', 'deleteFile_email' - The email address for the commit that deletes the file. If no email
-- address is specified, the email address is left blank.
--
-- 'name', 'deleteFile_name' - The name of the author of the commit that deletes the file. If no name
-- is specified, the user\'s ARN is used as the author name and committer
-- name.
--
-- 'commitMessage', 'deleteFile_commitMessage' - The commit message you want to include as part of deleting the file.
-- Commit messages are limited to 256 KB. If no message is specified, a
-- default message is used.
--
-- 'keepEmptyFolders', 'deleteFile_keepEmptyFolders' - If a file is the only object in the folder or directory, specifies
-- whether to delete the folder or directory that contains the file. By
-- default, empty folders are deleted. This includes empty folders that are
-- part of the directory structure. For example, if the path to a file is
-- dir1\/dir2\/dir3\/dir4, and dir2 and dir3 are empty, deleting the last
-- file in dir4 also deletes the empty folders dir4, dir3, and dir2.
--
-- 'repositoryName', 'deleteFile_repositoryName' - The name of the repository that contains the file to delete.
--
-- 'branchName', 'deleteFile_branchName' - The name of the branch where the commit that deletes the file is made.
--
-- 'filePath', 'deleteFile_filePath' - The fully qualified path to the file that to be deleted, including the
-- full name and extension of that file. For example, \/examples\/file.md
-- is a fully qualified path to a file named file.md in a folder named
-- examples.
--
-- 'parentCommitId', 'deleteFile_parentCommitId' - The ID of the commit that is the tip of the branch where you want to
-- create the commit that deletes the file. This must be the HEAD commit
-- for the branch. The commit that deletes the file is created from this
-- commit ID.
newDeleteFile ::
  -- | 'repositoryName'
  Prelude.Text ->
  -- | 'branchName'
  Prelude.Text ->
  -- | 'filePath'
  Prelude.Text ->
  -- | 'parentCommitId'
  Prelude.Text ->
  DeleteFile
newDeleteFile :: Text -> Text -> Text -> Text -> DeleteFile
newDeleteFile
  Text
pRepositoryName_
  Text
pBranchName_
  Text
pFilePath_
  Text
pParentCommitId_ =
    DeleteFile' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Text
-> Text
-> Text
-> Text
-> DeleteFile
DeleteFile'
      { $sel:email:DeleteFile' :: Maybe Text
email = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:name:DeleteFile' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:commitMessage:DeleteFile' :: Maybe Text
commitMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:keepEmptyFolders:DeleteFile' :: Maybe Bool
keepEmptyFolders = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:repositoryName:DeleteFile' :: Text
repositoryName = Text
pRepositoryName_,
        $sel:branchName:DeleteFile' :: Text
branchName = Text
pBranchName_,
        $sel:filePath:DeleteFile' :: Text
filePath = Text
pFilePath_,
        $sel:parentCommitId:DeleteFile' :: Text
parentCommitId = Text
pParentCommitId_
      }

-- | The email address for the commit that deletes the file. If no email
-- address is specified, the email address is left blank.
deleteFile_email :: Lens.Lens' DeleteFile (Prelude.Maybe Prelude.Text)
deleteFile_email :: (Maybe Text -> f (Maybe Text)) -> DeleteFile -> f DeleteFile
deleteFile_email = (DeleteFile -> Maybe Text)
-> (DeleteFile -> Maybe Text -> DeleteFile)
-> Lens DeleteFile DeleteFile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Maybe Text
email :: Maybe Text
$sel:email:DeleteFile' :: DeleteFile -> Maybe Text
email} -> Maybe Text
email) (\s :: DeleteFile
s@DeleteFile' {} Maybe Text
a -> DeleteFile
s {$sel:email:DeleteFile' :: Maybe Text
email = Maybe Text
a} :: DeleteFile)

-- | The name of the author of the commit that deletes the file. If no name
-- is specified, the user\'s ARN is used as the author name and committer
-- name.
deleteFile_name :: Lens.Lens' DeleteFile (Prelude.Maybe Prelude.Text)
deleteFile_name :: (Maybe Text -> f (Maybe Text)) -> DeleteFile -> f DeleteFile
deleteFile_name = (DeleteFile -> Maybe Text)
-> (DeleteFile -> Maybe Text -> DeleteFile)
-> Lens DeleteFile DeleteFile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Maybe Text
name :: Maybe Text
$sel:name:DeleteFile' :: DeleteFile -> Maybe Text
name} -> Maybe Text
name) (\s :: DeleteFile
s@DeleteFile' {} Maybe Text
a -> DeleteFile
s {$sel:name:DeleteFile' :: Maybe Text
name = Maybe Text
a} :: DeleteFile)

-- | The commit message you want to include as part of deleting the file.
-- Commit messages are limited to 256 KB. If no message is specified, a
-- default message is used.
deleteFile_commitMessage :: Lens.Lens' DeleteFile (Prelude.Maybe Prelude.Text)
deleteFile_commitMessage :: (Maybe Text -> f (Maybe Text)) -> DeleteFile -> f DeleteFile
deleteFile_commitMessage = (DeleteFile -> Maybe Text)
-> (DeleteFile -> Maybe Text -> DeleteFile)
-> Lens DeleteFile DeleteFile (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Maybe Text
commitMessage :: Maybe Text
$sel:commitMessage:DeleteFile' :: DeleteFile -> Maybe Text
commitMessage} -> Maybe Text
commitMessage) (\s :: DeleteFile
s@DeleteFile' {} Maybe Text
a -> DeleteFile
s {$sel:commitMessage:DeleteFile' :: Maybe Text
commitMessage = Maybe Text
a} :: DeleteFile)

-- | If a file is the only object in the folder or directory, specifies
-- whether to delete the folder or directory that contains the file. By
-- default, empty folders are deleted. This includes empty folders that are
-- part of the directory structure. For example, if the path to a file is
-- dir1\/dir2\/dir3\/dir4, and dir2 and dir3 are empty, deleting the last
-- file in dir4 also deletes the empty folders dir4, dir3, and dir2.
deleteFile_keepEmptyFolders :: Lens.Lens' DeleteFile (Prelude.Maybe Prelude.Bool)
deleteFile_keepEmptyFolders :: (Maybe Bool -> f (Maybe Bool)) -> DeleteFile -> f DeleteFile
deleteFile_keepEmptyFolders = (DeleteFile -> Maybe Bool)
-> (DeleteFile -> Maybe Bool -> DeleteFile)
-> Lens DeleteFile DeleteFile (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Maybe Bool
keepEmptyFolders :: Maybe Bool
$sel:keepEmptyFolders:DeleteFile' :: DeleteFile -> Maybe Bool
keepEmptyFolders} -> Maybe Bool
keepEmptyFolders) (\s :: DeleteFile
s@DeleteFile' {} Maybe Bool
a -> DeleteFile
s {$sel:keepEmptyFolders:DeleteFile' :: Maybe Bool
keepEmptyFolders = Maybe Bool
a} :: DeleteFile)

-- | The name of the repository that contains the file to delete.
deleteFile_repositoryName :: Lens.Lens' DeleteFile Prelude.Text
deleteFile_repositoryName :: (Text -> f Text) -> DeleteFile -> f DeleteFile
deleteFile_repositoryName = (DeleteFile -> Text)
-> (DeleteFile -> Text -> DeleteFile)
-> Lens DeleteFile DeleteFile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Text
repositoryName :: Text
$sel:repositoryName:DeleteFile' :: DeleteFile -> Text
repositoryName} -> Text
repositoryName) (\s :: DeleteFile
s@DeleteFile' {} Text
a -> DeleteFile
s {$sel:repositoryName:DeleteFile' :: Text
repositoryName = Text
a} :: DeleteFile)

-- | The name of the branch where the commit that deletes the file is made.
deleteFile_branchName :: Lens.Lens' DeleteFile Prelude.Text
deleteFile_branchName :: (Text -> f Text) -> DeleteFile -> f DeleteFile
deleteFile_branchName = (DeleteFile -> Text)
-> (DeleteFile -> Text -> DeleteFile)
-> Lens DeleteFile DeleteFile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Text
branchName :: Text
$sel:branchName:DeleteFile' :: DeleteFile -> Text
branchName} -> Text
branchName) (\s :: DeleteFile
s@DeleteFile' {} Text
a -> DeleteFile
s {$sel:branchName:DeleteFile' :: Text
branchName = Text
a} :: DeleteFile)

-- | The fully qualified path to the file that to be deleted, including the
-- full name and extension of that file. For example, \/examples\/file.md
-- is a fully qualified path to a file named file.md in a folder named
-- examples.
deleteFile_filePath :: Lens.Lens' DeleteFile Prelude.Text
deleteFile_filePath :: (Text -> f Text) -> DeleteFile -> f DeleteFile
deleteFile_filePath = (DeleteFile -> Text)
-> (DeleteFile -> Text -> DeleteFile)
-> Lens DeleteFile DeleteFile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Text
filePath :: Text
$sel:filePath:DeleteFile' :: DeleteFile -> Text
filePath} -> Text
filePath) (\s :: DeleteFile
s@DeleteFile' {} Text
a -> DeleteFile
s {$sel:filePath:DeleteFile' :: Text
filePath = Text
a} :: DeleteFile)

-- | The ID of the commit that is the tip of the branch where you want to
-- create the commit that deletes the file. This must be the HEAD commit
-- for the branch. The commit that deletes the file is created from this
-- commit ID.
deleteFile_parentCommitId :: Lens.Lens' DeleteFile Prelude.Text
deleteFile_parentCommitId :: (Text -> f Text) -> DeleteFile -> f DeleteFile
deleteFile_parentCommitId = (DeleteFile -> Text)
-> (DeleteFile -> Text -> DeleteFile)
-> Lens DeleteFile DeleteFile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFile' {Text
parentCommitId :: Text
$sel:parentCommitId:DeleteFile' :: DeleteFile -> Text
parentCommitId} -> Text
parentCommitId) (\s :: DeleteFile
s@DeleteFile' {} Text
a -> DeleteFile
s {$sel:parentCommitId:DeleteFile' :: Text
parentCommitId = Text
a} :: DeleteFile)

instance Core.AWSRequest DeleteFile where
  type AWSResponse DeleteFile = DeleteFileResponse
  request :: DeleteFile -> Request DeleteFile
request = Service -> DeleteFile -> Request DeleteFile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFile)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteFile))
-> Logger
-> Service
-> Proxy DeleteFile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFile)))
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 -> Text -> Text -> Text -> Text -> DeleteFileResponse
DeleteFileResponse'
            (Int -> Text -> Text -> Text -> Text -> DeleteFileResponse)
-> Either String Int
-> Either
     String (Text -> Text -> Text -> Text -> DeleteFileResponse)
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 (Text -> Text -> Text -> Text -> DeleteFileResponse)
-> Either String Text
-> Either String (Text -> Text -> Text -> DeleteFileResponse)
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
"commitId")
            Either String (Text -> Text -> Text -> DeleteFileResponse)
-> Either String Text
-> Either String (Text -> Text -> DeleteFileResponse)
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
"blobId")
            Either String (Text -> Text -> DeleteFileResponse)
-> Either String Text -> Either String (Text -> DeleteFileResponse)
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
"treeId")
            Either String (Text -> DeleteFileResponse)
-> Either String Text -> Either String DeleteFileResponse
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
"filePath")
      )

instance Prelude.Hashable DeleteFile

instance Prelude.NFData DeleteFile

instance Core.ToHeaders DeleteFile where
  toHeaders :: DeleteFile -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteFile -> 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.DeleteFile" ::
                          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 DeleteFile where
  toJSON :: DeleteFile -> Value
toJSON DeleteFile' {Maybe Bool
Maybe Text
Text
parentCommitId :: Text
filePath :: Text
branchName :: Text
repositoryName :: Text
keepEmptyFolders :: Maybe Bool
commitMessage :: Maybe Text
name :: Maybe Text
email :: Maybe Text
$sel:parentCommitId:DeleteFile' :: DeleteFile -> Text
$sel:filePath:DeleteFile' :: DeleteFile -> Text
$sel:branchName:DeleteFile' :: DeleteFile -> Text
$sel:repositoryName:DeleteFile' :: DeleteFile -> Text
$sel:keepEmptyFolders:DeleteFile' :: DeleteFile -> Maybe Bool
$sel:commitMessage:DeleteFile' :: DeleteFile -> Maybe Text
$sel:name:DeleteFile' :: DeleteFile -> Maybe Text
$sel:email:DeleteFile' :: DeleteFile -> 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
"name" 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
name,
            (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
"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,
            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
"branchName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
branchName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"filePath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
filePath),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"parentCommitId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parentCommitId)
          ]
      )

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

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

-- | /See:/ 'newDeleteFileResponse' smart constructor.
data DeleteFileResponse = DeleteFileResponse'
  { -- | The response's http status code.
    DeleteFileResponse -> Int
httpStatus :: Prelude.Int,
    -- | The full commit ID of the commit that contains the change that deletes
    -- the file.
    DeleteFileResponse -> Text
commitId :: Prelude.Text,
    -- | The blob ID removed from the tree as part of deleting the file.
    DeleteFileResponse -> Text
blobId :: Prelude.Text,
    -- | The full SHA-1 pointer of the tree information for the commit that
    -- contains the delete file change.
    DeleteFileResponse -> Text
treeId :: Prelude.Text,
    -- | The fully qualified path to the file to be deleted, including the full
    -- name and extension of that file.
    DeleteFileResponse -> Text
filePath :: Prelude.Text
  }
  deriving (DeleteFileResponse -> DeleteFileResponse -> Bool
(DeleteFileResponse -> DeleteFileResponse -> Bool)
-> (DeleteFileResponse -> DeleteFileResponse -> Bool)
-> Eq DeleteFileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFileResponse -> DeleteFileResponse -> Bool
$c/= :: DeleteFileResponse -> DeleteFileResponse -> Bool
== :: DeleteFileResponse -> DeleteFileResponse -> Bool
$c== :: DeleteFileResponse -> DeleteFileResponse -> Bool
Prelude.Eq, ReadPrec [DeleteFileResponse]
ReadPrec DeleteFileResponse
Int -> ReadS DeleteFileResponse
ReadS [DeleteFileResponse]
(Int -> ReadS DeleteFileResponse)
-> ReadS [DeleteFileResponse]
-> ReadPrec DeleteFileResponse
-> ReadPrec [DeleteFileResponse]
-> Read DeleteFileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFileResponse]
$creadListPrec :: ReadPrec [DeleteFileResponse]
readPrec :: ReadPrec DeleteFileResponse
$creadPrec :: ReadPrec DeleteFileResponse
readList :: ReadS [DeleteFileResponse]
$creadList :: ReadS [DeleteFileResponse]
readsPrec :: Int -> ReadS DeleteFileResponse
$creadsPrec :: Int -> ReadS DeleteFileResponse
Prelude.Read, Int -> DeleteFileResponse -> ShowS
[DeleteFileResponse] -> ShowS
DeleteFileResponse -> String
(Int -> DeleteFileResponse -> ShowS)
-> (DeleteFileResponse -> String)
-> ([DeleteFileResponse] -> ShowS)
-> Show DeleteFileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFileResponse] -> ShowS
$cshowList :: [DeleteFileResponse] -> ShowS
show :: DeleteFileResponse -> String
$cshow :: DeleteFileResponse -> String
showsPrec :: Int -> DeleteFileResponse -> ShowS
$cshowsPrec :: Int -> DeleteFileResponse -> ShowS
Prelude.Show, (forall x. DeleteFileResponse -> Rep DeleteFileResponse x)
-> (forall x. Rep DeleteFileResponse x -> DeleteFileResponse)
-> Generic DeleteFileResponse
forall x. Rep DeleteFileResponse x -> DeleteFileResponse
forall x. DeleteFileResponse -> Rep DeleteFileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFileResponse x -> DeleteFileResponse
$cfrom :: forall x. DeleteFileResponse -> Rep DeleteFileResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFileResponse' 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', 'deleteFileResponse_httpStatus' - The response's http status code.
--
-- 'commitId', 'deleteFileResponse_commitId' - The full commit ID of the commit that contains the change that deletes
-- the file.
--
-- 'blobId', 'deleteFileResponse_blobId' - The blob ID removed from the tree as part of deleting the file.
--
-- 'treeId', 'deleteFileResponse_treeId' - The full SHA-1 pointer of the tree information for the commit that
-- contains the delete file change.
--
-- 'filePath', 'deleteFileResponse_filePath' - The fully qualified path to the file to be deleted, including the full
-- name and extension of that file.
newDeleteFileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'commitId'
  Prelude.Text ->
  -- | 'blobId'
  Prelude.Text ->
  -- | 'treeId'
  Prelude.Text ->
  -- | 'filePath'
  Prelude.Text ->
  DeleteFileResponse
newDeleteFileResponse :: Int -> Text -> Text -> Text -> Text -> DeleteFileResponse
newDeleteFileResponse
  Int
pHttpStatus_
  Text
pCommitId_
  Text
pBlobId_
  Text
pTreeId_
  Text
pFilePath_ =
    DeleteFileResponse' :: Int -> Text -> Text -> Text -> Text -> DeleteFileResponse
DeleteFileResponse'
      { $sel:httpStatus:DeleteFileResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:commitId:DeleteFileResponse' :: Text
commitId = Text
pCommitId_,
        $sel:blobId:DeleteFileResponse' :: Text
blobId = Text
pBlobId_,
        $sel:treeId:DeleteFileResponse' :: Text
treeId = Text
pTreeId_,
        $sel:filePath:DeleteFileResponse' :: Text
filePath = Text
pFilePath_
      }

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

-- | The full commit ID of the commit that contains the change that deletes
-- the file.
deleteFileResponse_commitId :: Lens.Lens' DeleteFileResponse Prelude.Text
deleteFileResponse_commitId :: (Text -> f Text) -> DeleteFileResponse -> f DeleteFileResponse
deleteFileResponse_commitId = (DeleteFileResponse -> Text)
-> (DeleteFileResponse -> Text -> DeleteFileResponse)
-> Lens DeleteFileResponse DeleteFileResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFileResponse' {Text
commitId :: Text
$sel:commitId:DeleteFileResponse' :: DeleteFileResponse -> Text
commitId} -> Text
commitId) (\s :: DeleteFileResponse
s@DeleteFileResponse' {} Text
a -> DeleteFileResponse
s {$sel:commitId:DeleteFileResponse' :: Text
commitId = Text
a} :: DeleteFileResponse)

-- | The blob ID removed from the tree as part of deleting the file.
deleteFileResponse_blobId :: Lens.Lens' DeleteFileResponse Prelude.Text
deleteFileResponse_blobId :: (Text -> f Text) -> DeleteFileResponse -> f DeleteFileResponse
deleteFileResponse_blobId = (DeleteFileResponse -> Text)
-> (DeleteFileResponse -> Text -> DeleteFileResponse)
-> Lens DeleteFileResponse DeleteFileResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFileResponse' {Text
blobId :: Text
$sel:blobId:DeleteFileResponse' :: DeleteFileResponse -> Text
blobId} -> Text
blobId) (\s :: DeleteFileResponse
s@DeleteFileResponse' {} Text
a -> DeleteFileResponse
s {$sel:blobId:DeleteFileResponse' :: Text
blobId = Text
a} :: DeleteFileResponse)

-- | The full SHA-1 pointer of the tree information for the commit that
-- contains the delete file change.
deleteFileResponse_treeId :: Lens.Lens' DeleteFileResponse Prelude.Text
deleteFileResponse_treeId :: (Text -> f Text) -> DeleteFileResponse -> f DeleteFileResponse
deleteFileResponse_treeId = (DeleteFileResponse -> Text)
-> (DeleteFileResponse -> Text -> DeleteFileResponse)
-> Lens DeleteFileResponse DeleteFileResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFileResponse' {Text
treeId :: Text
$sel:treeId:DeleteFileResponse' :: DeleteFileResponse -> Text
treeId} -> Text
treeId) (\s :: DeleteFileResponse
s@DeleteFileResponse' {} Text
a -> DeleteFileResponse
s {$sel:treeId:DeleteFileResponse' :: Text
treeId = Text
a} :: DeleteFileResponse)

-- | The fully qualified path to the file to be deleted, including the full
-- name and extension of that file.
deleteFileResponse_filePath :: Lens.Lens' DeleteFileResponse Prelude.Text
deleteFileResponse_filePath :: (Text -> f Text) -> DeleteFileResponse -> f DeleteFileResponse
deleteFileResponse_filePath = (DeleteFileResponse -> Text)
-> (DeleteFileResponse -> Text -> DeleteFileResponse)
-> Lens DeleteFileResponse DeleteFileResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFileResponse' {Text
filePath :: Text
$sel:filePath:DeleteFileResponse' :: DeleteFileResponse -> Text
filePath} -> Text
filePath) (\s :: DeleteFileResponse
s@DeleteFileResponse' {} Text
a -> DeleteFileResponse
s {$sel:filePath:DeleteFileResponse' :: Text
filePath = Text
a} :: DeleteFileResponse)

instance Prelude.NFData DeleteFileResponse