{-# 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.DeleteUser
-- 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 the specified user from a Simple AD or Microsoft AD directory.
module Amazonka.WorkDocs.DeleteUser
  ( -- * Creating a Request
    DeleteUser (..),
    newDeleteUser,

    -- * Request Lenses
    deleteUser_authenticationToken,
    deleteUser_userId,

    -- * Destructuring the Response
    DeleteUserResponse (..),
    newDeleteUserResponse,
  )
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:/ 'newDeleteUser' smart constructor.
data DeleteUser = DeleteUser'
  { -- | Amazon WorkDocs authentication token. Do not set this field when using
    -- administrative API actions, as in accessing the API using AWS
    -- credentials.
    DeleteUser -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the user.
    DeleteUser -> Text
userId :: Prelude.Text
  }
  deriving (DeleteUser -> DeleteUser -> Bool
(DeleteUser -> DeleteUser -> Bool)
-> (DeleteUser -> DeleteUser -> Bool) -> Eq DeleteUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteUser -> DeleteUser -> Bool
$c/= :: DeleteUser -> DeleteUser -> Bool
== :: DeleteUser -> DeleteUser -> Bool
$c== :: DeleteUser -> DeleteUser -> Bool
Prelude.Eq, Int -> DeleteUser -> ShowS
[DeleteUser] -> ShowS
DeleteUser -> String
(Int -> DeleteUser -> ShowS)
-> (DeleteUser -> String)
-> ([DeleteUser] -> ShowS)
-> Show DeleteUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteUser] -> ShowS
$cshowList :: [DeleteUser] -> ShowS
show :: DeleteUser -> String
$cshow :: DeleteUser -> String
showsPrec :: Int -> DeleteUser -> ShowS
$cshowsPrec :: Int -> DeleteUser -> ShowS
Prelude.Show, (forall x. DeleteUser -> Rep DeleteUser x)
-> (forall x. Rep DeleteUser x -> DeleteUser) -> Generic DeleteUser
forall x. Rep DeleteUser x -> DeleteUser
forall x. DeleteUser -> Rep DeleteUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteUser x -> DeleteUser
$cfrom :: forall x. DeleteUser -> Rep DeleteUser x
Prelude.Generic)

-- |
-- Create a value of 'DeleteUser' 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', 'deleteUser_authenticationToken' - Amazon WorkDocs authentication token. Do not set this field when using
-- administrative API actions, as in accessing the API using AWS
-- credentials.
--
-- 'userId', 'deleteUser_userId' - The ID of the user.
newDeleteUser ::
  -- | 'userId'
  Prelude.Text ->
  DeleteUser
newDeleteUser :: Text -> DeleteUser
newDeleteUser Text
pUserId_ =
  DeleteUser' :: Maybe (Sensitive Text) -> Text -> DeleteUser
DeleteUser'
    { $sel:authenticationToken:DeleteUser' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:userId:DeleteUser' :: Text
userId = Text
pUserId_
    }

-- | Amazon WorkDocs authentication token. Do not set this field when using
-- administrative API actions, as in accessing the API using AWS
-- credentials.
deleteUser_authenticationToken :: Lens.Lens' DeleteUser (Prelude.Maybe Prelude.Text)
deleteUser_authenticationToken :: (Maybe Text -> f (Maybe Text)) -> DeleteUser -> f DeleteUser
deleteUser_authenticationToken = (DeleteUser -> Maybe (Sensitive Text))
-> (DeleteUser -> Maybe (Sensitive Text) -> DeleteUser)
-> Lens
     DeleteUser
     DeleteUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUser' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:DeleteUser' :: DeleteUser -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: DeleteUser
s@DeleteUser' {} Maybe (Sensitive Text)
a -> DeleteUser
s {$sel:authenticationToken:DeleteUser' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: DeleteUser) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> DeleteUser -> f DeleteUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DeleteUser
-> f DeleteUser
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 user.
deleteUser_userId :: Lens.Lens' DeleteUser Prelude.Text
deleteUser_userId :: (Text -> f Text) -> DeleteUser -> f DeleteUser
deleteUser_userId = (DeleteUser -> Text)
-> (DeleteUser -> Text -> DeleteUser)
-> Lens DeleteUser DeleteUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteUser' {Text
userId :: Text
$sel:userId:DeleteUser' :: DeleteUser -> Text
userId} -> Text
userId) (\s :: DeleteUser
s@DeleteUser' {} Text
a -> DeleteUser
s {$sel:userId:DeleteUser' :: Text
userId = Text
a} :: DeleteUser)

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

instance Prelude.Hashable DeleteUser

instance Prelude.NFData DeleteUser

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

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

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

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

instance Prelude.NFData DeleteUserResponse