{-# 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-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)
--
-- 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.Lens as Lens
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 (Core.Sensitive Prelude.Text),
    -- | The ID of the document.
    DeleteDocument -> Text
documentId :: Prelude.Text
  }
  deriving (DeleteDocument -> DeleteDocument -> Bool
(DeleteDocument -> DeleteDocument -> Bool)
-> (DeleteDocument -> DeleteDocument -> Bool) -> Eq DeleteDocument
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
(Int -> DeleteDocument -> ShowS)
-> (DeleteDocument -> String)
-> ([DeleteDocument] -> ShowS)
-> Show DeleteDocument
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. DeleteDocument -> Rep DeleteDocument x)
-> (forall x. Rep DeleteDocument x -> DeleteDocument)
-> Generic DeleteDocument
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' :: Maybe (Sensitive Text) -> Text -> DeleteDocument
DeleteDocument'
    { $sel:authenticationToken:DeleteDocument' :: Maybe (Sensitive Text)
authenticationToken =
        Maybe (Sensitive Text)
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteDocument -> f DeleteDocument
deleteDocument_authenticationToken = (DeleteDocument -> Maybe (Sensitive Text))
-> (DeleteDocument -> Maybe (Sensitive Text) -> DeleteDocument)
-> Lens
     DeleteDocument
     DeleteDocument
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> DeleteDocument -> f DeleteDocument)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DeleteDocument
-> f DeleteDocument
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The ID of the document.
deleteDocument_documentId :: Lens.Lens' DeleteDocument Prelude.Text
deleteDocument_documentId :: (Text -> f Text) -> DeleteDocument -> f DeleteDocument
deleteDocument_documentId = (DeleteDocument -> Text)
-> (DeleteDocument -> Text -> DeleteDocument)
-> Lens DeleteDocument DeleteDocument Text Text
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 :: DeleteDocument -> Request DeleteDocument
request = Service -> DeleteDocument -> Request DeleteDocument
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDocument)))
response =
    AWSResponse DeleteDocument
-> Logger
-> Service
-> Proxy DeleteDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDocument)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteDocument
DeleteDocumentResponse
DeleteDocumentResponse'

instance Prelude.Hashable DeleteDocument

instance Prelude.NFData DeleteDocument

instance Core.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)
..} =
    [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe (Sensitive Text)
authenticationToken,
        HeaderName
"Content-Type"
          HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Core.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)
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/api/v1/documents/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
documentId]

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

-- | /See:/ 'newDeleteDocumentResponse' smart constructor.
data DeleteDocumentResponse = DeleteDocumentResponse'
  {
  }
  deriving (DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
(DeleteDocumentResponse -> DeleteDocumentResponse -> Bool)
-> (DeleteDocumentResponse -> DeleteDocumentResponse -> Bool)
-> Eq DeleteDocumentResponse
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]
(Int -> ReadS DeleteDocumentResponse)
-> ReadS [DeleteDocumentResponse]
-> ReadPrec DeleteDocumentResponse
-> ReadPrec [DeleteDocumentResponse]
-> Read 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
(Int -> DeleteDocumentResponse -> ShowS)
-> (DeleteDocumentResponse -> String)
-> ([DeleteDocumentResponse] -> ShowS)
-> Show DeleteDocumentResponse
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. DeleteDocumentResponse -> Rep DeleteDocumentResponse x)
-> (forall x.
    Rep DeleteDocumentResponse x -> DeleteDocumentResponse)
-> Generic DeleteDocumentResponse
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