{-# 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.DeleteFolder
-- 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 folder and its contents.
module Amazonka.WorkDocs.DeleteFolder
  ( -- * Creating a Request
    DeleteFolder (..),
    newDeleteFolder,

    -- * Request Lenses
    deleteFolder_authenticationToken,
    deleteFolder_folderId,

    -- * Destructuring the Response
    DeleteFolderResponse (..),
    newDeleteFolderResponse,
  )
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:/ 'newDeleteFolder' smart constructor.
data DeleteFolder = DeleteFolder'
  { -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    DeleteFolder -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the folder.
    DeleteFolder -> Text
folderId :: Prelude.Text
  }
  deriving (DeleteFolder -> DeleteFolder -> Bool
(DeleteFolder -> DeleteFolder -> Bool)
-> (DeleteFolder -> DeleteFolder -> Bool) -> Eq DeleteFolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFolder -> DeleteFolder -> Bool
$c/= :: DeleteFolder -> DeleteFolder -> Bool
== :: DeleteFolder -> DeleteFolder -> Bool
$c== :: DeleteFolder -> DeleteFolder -> Bool
Prelude.Eq, Int -> DeleteFolder -> ShowS
[DeleteFolder] -> ShowS
DeleteFolder -> String
(Int -> DeleteFolder -> ShowS)
-> (DeleteFolder -> String)
-> ([DeleteFolder] -> ShowS)
-> Show DeleteFolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFolder] -> ShowS
$cshowList :: [DeleteFolder] -> ShowS
show :: DeleteFolder -> String
$cshow :: DeleteFolder -> String
showsPrec :: Int -> DeleteFolder -> ShowS
$cshowsPrec :: Int -> DeleteFolder -> ShowS
Prelude.Show, (forall x. DeleteFolder -> Rep DeleteFolder x)
-> (forall x. Rep DeleteFolder x -> DeleteFolder)
-> Generic DeleteFolder
forall x. Rep DeleteFolder x -> DeleteFolder
forall x. DeleteFolder -> Rep DeleteFolder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFolder x -> DeleteFolder
$cfrom :: forall x. DeleteFolder -> Rep DeleteFolder x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFolder' 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', 'deleteFolder_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'folderId', 'deleteFolder_folderId' - The ID of the folder.
newDeleteFolder ::
  -- | 'folderId'
  Prelude.Text ->
  DeleteFolder
newDeleteFolder :: Text -> DeleteFolder
newDeleteFolder Text
pFolderId_ =
  DeleteFolder' :: Maybe (Sensitive Text) -> Text -> DeleteFolder
DeleteFolder'
    { $sel:authenticationToken:DeleteFolder' :: Maybe (Sensitive Text)
authenticationToken =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:folderId:DeleteFolder' :: Text
folderId = Text
pFolderId_
    }

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
deleteFolder_authenticationToken :: Lens.Lens' DeleteFolder (Prelude.Maybe Prelude.Text)
deleteFolder_authenticationToken :: (Maybe Text -> f (Maybe Text)) -> DeleteFolder -> f DeleteFolder
deleteFolder_authenticationToken = (DeleteFolder -> Maybe (Sensitive Text))
-> (DeleteFolder -> Maybe (Sensitive Text) -> DeleteFolder)
-> Lens
     DeleteFolder
     DeleteFolder
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFolder' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:DeleteFolder' :: DeleteFolder -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: DeleteFolder
s@DeleteFolder' {} Maybe (Sensitive Text)
a -> DeleteFolder
s {$sel:authenticationToken:DeleteFolder' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: DeleteFolder) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> DeleteFolder -> f DeleteFolder)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DeleteFolder
-> f DeleteFolder
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 folder.
deleteFolder_folderId :: Lens.Lens' DeleteFolder Prelude.Text
deleteFolder_folderId :: (Text -> f Text) -> DeleteFolder -> f DeleteFolder
deleteFolder_folderId = (DeleteFolder -> Text)
-> (DeleteFolder -> Text -> DeleteFolder)
-> Lens DeleteFolder DeleteFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFolder' {Text
folderId :: Text
$sel:folderId:DeleteFolder' :: DeleteFolder -> Text
folderId} -> Text
folderId) (\s :: DeleteFolder
s@DeleteFolder' {} Text
a -> DeleteFolder
s {$sel:folderId:DeleteFolder' :: Text
folderId = Text
a} :: DeleteFolder)

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

instance Prelude.Hashable DeleteFolder

instance Prelude.NFData DeleteFolder

instance Core.ToHeaders DeleteFolder where
  toHeaders :: DeleteFolder -> [Header]
toHeaders DeleteFolder' {Maybe (Sensitive Text)
Text
folderId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:folderId:DeleteFolder' :: DeleteFolder -> Text
$sel:authenticationToken:DeleteFolder' :: DeleteFolder -> 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 DeleteFolder where
  toPath :: DeleteFolder -> ByteString
toPath DeleteFolder' {Maybe (Sensitive Text)
Text
folderId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:folderId:DeleteFolder' :: DeleteFolder -> Text
$sel:authenticationToken:DeleteFolder' :: DeleteFolder -> Maybe (Sensitive Text)
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/api/v1/folders/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
folderId]

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

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

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

instance Prelude.NFData DeleteFolderResponse