{-# 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.WorkDocs.DeleteDocument
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Permanently deletes the specified document and its associated metadata.
module Amazonka.WorkDocs.DeleteDocument
  ( -- * Creating a Request
    DeleteDocument (..),
    newDeleteDocument,

    -- * Request Lenses
    deleteDocument_authenticationToken,
    deleteDocument_documentId,

    -- * Destructuring the Response
    DeleteDocumentResponse (..),
    newDeleteDocumentResponse,
  )
where

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
import Amazonka.WorkDocs.Types

-- | /See:/ 'newDeleteDocument' smart constructor.
data DeleteDocument = DeleteDocument'
  { -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    DeleteDocument -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The ID of the document.
    DeleteDocument -> Text
documentId :: Prelude.Text
  }
  deriving (DeleteDocument -> DeleteDocument -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDocument -> DeleteDocument -> Bool
$c/= :: DeleteDocument -> DeleteDocument -> Bool
== :: DeleteDocument -> DeleteDocument -> Bool
$c== :: DeleteDocument -> DeleteDocument -> Bool
Prelude.Eq, Int -> DeleteDocument -> ShowS
[DeleteDocument] -> ShowS
DeleteDocument -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDocument] -> ShowS
$cshowList :: [DeleteDocument] -> ShowS
show :: DeleteDocument -> String
$cshow :: DeleteDocument -> String
showsPrec :: Int -> DeleteDocument -> ShowS
$cshowsPrec :: Int -> DeleteDocument -> ShowS
Prelude.Show, forall x. Rep DeleteDocument x -> DeleteDocument
forall x. DeleteDocument -> Rep DeleteDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDocument x -> DeleteDocument
$cfrom :: forall x. DeleteDocument -> Rep DeleteDocument x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDocument' 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:
--
-- 'authenticationToken', 'deleteDocument_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'documentId', 'deleteDocument_documentId' - The ID of the document.
newDeleteDocument ::
  -- | 'documentId'
  Prelude.Text ->
  DeleteDocument
newDeleteDocument :: Text -> DeleteDocument
newDeleteDocument Text
pDocumentId_ =
  DeleteDocument'
    { $sel:authenticationToken:DeleteDocument' :: Maybe (Sensitive Text)
authenticationToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:documentId:DeleteDocument' :: Text
documentId = Text
pDocumentId_
    }

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
deleteDocument_authenticationToken :: Lens.Lens' DeleteDocument (Prelude.Maybe Prelude.Text)
deleteDocument_authenticationToken :: Lens' DeleteDocument (Maybe Text)
deleteDocument_authenticationToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocument' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:DeleteDocument' :: DeleteDocument -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: DeleteDocument
s@DeleteDocument' {} Maybe (Sensitive Text)
a -> DeleteDocument
s {$sel:authenticationToken:DeleteDocument' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: DeleteDocument) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The ID of the document.
deleteDocument_documentId :: Lens.Lens' DeleteDocument Prelude.Text
deleteDocument_documentId :: Lens' DeleteDocument Text
deleteDocument_documentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocument' {Text
documentId :: Text
$sel:documentId:DeleteDocument' :: DeleteDocument -> Text
documentId} -> Text
documentId) (\s :: DeleteDocument
s@DeleteDocument' {} Text
a -> DeleteDocument
s {$sel:documentId:DeleteDocument' :: Text
documentId = Text
a} :: DeleteDocument)

instance Core.AWSRequest DeleteDocument where
  type
    AWSResponse DeleteDocument =
      DeleteDocumentResponse
  request :: (Service -> Service) -> DeleteDocument -> Request DeleteDocument
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDocument)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteDocumentResponse
DeleteDocumentResponse'

instance Prelude.Hashable DeleteDocument where
  hashWithSalt :: Int -> DeleteDocument -> Int
hashWithSalt Int
_salt DeleteDocument' {Maybe (Sensitive Text)
Text
documentId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:documentId:DeleteDocument' :: DeleteDocument -> Text
$sel:authenticationToken:DeleteDocument' :: DeleteDocument -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
authenticationToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
documentId

instance Prelude.NFData DeleteDocument where
  rnf :: DeleteDocument -> ()
rnf DeleteDocument' {Maybe (Sensitive Text)
Text
documentId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:documentId:DeleteDocument' :: DeleteDocument -> Text
$sel:authenticationToken:DeleteDocument' :: DeleteDocument -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
authenticationToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
documentId

instance Data.ToHeaders DeleteDocument where
  toHeaders :: DeleteDocument -> [Header]
toHeaders DeleteDocument' {Maybe (Sensitive Text)
Text
documentId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:documentId:DeleteDocument' :: DeleteDocument -> Text
$sel:authenticationToken:DeleteDocument' :: DeleteDocument -> Maybe (Sensitive Text)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe (Sensitive Text)
authenticationToken,
        HeaderName
"Content-Type"
          forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Data.ToPath DeleteDocument where
  toPath :: DeleteDocument -> ByteString
toPath DeleteDocument' {Maybe (Sensitive Text)
Text
documentId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:documentId:DeleteDocument' :: DeleteDocument -> Text
$sel:authenticationToken:DeleteDocument' :: DeleteDocument -> Maybe (Sensitive Text)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/api/v1/documents/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
documentId]

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

-- | /See:/ 'newDeleteDocumentResponse' smart constructor.
data DeleteDocumentResponse = DeleteDocumentResponse'
  {
  }
  deriving (DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
$c/= :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
== :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
$c== :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDocumentResponse]
ReadPrec DeleteDocumentResponse
Int -> ReadS DeleteDocumentResponse
ReadS [DeleteDocumentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDocumentResponse]
$creadListPrec :: ReadPrec [DeleteDocumentResponse]
readPrec :: ReadPrec DeleteDocumentResponse
$creadPrec :: ReadPrec DeleteDocumentResponse
readList :: ReadS [DeleteDocumentResponse]
$creadList :: ReadS [DeleteDocumentResponse]
readsPrec :: Int -> ReadS DeleteDocumentResponse
$creadsPrec :: Int -> ReadS DeleteDocumentResponse
Prelude.Read, Int -> DeleteDocumentResponse -> ShowS
[DeleteDocumentResponse] -> ShowS
DeleteDocumentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDocumentResponse] -> ShowS
$cshowList :: [DeleteDocumentResponse] -> ShowS
show :: DeleteDocumentResponse -> String
$cshow :: DeleteDocumentResponse -> String
showsPrec :: Int -> DeleteDocumentResponse -> ShowS
$cshowsPrec :: Int -> DeleteDocumentResponse -> ShowS
Prelude.Show, forall x. Rep DeleteDocumentResponse x -> DeleteDocumentResponse
forall x. DeleteDocumentResponse -> Rep DeleteDocumentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDocumentResponse x -> DeleteDocumentResponse
$cfrom :: forall x. DeleteDocumentResponse -> Rep DeleteDocumentResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDocumentResponse' 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.
newDeleteDocumentResponse ::
  DeleteDocumentResponse
newDeleteDocumentResponse :: DeleteDocumentResponse
newDeleteDocumentResponse = DeleteDocumentResponse
DeleteDocumentResponse'

instance Prelude.NFData DeleteDocumentResponse where
  rnf :: DeleteDocumentResponse -> ()
rnf DeleteDocumentResponse
_ = ()