{-# 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.DeactivateUser
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deactivates the specified user, which revokes the user\'s access to
-- Amazon WorkDocs.
module Amazonka.WorkDocs.DeactivateUser
  ( -- * Creating a Request
    DeactivateUser (..),
    newDeactivateUser,

    -- * Request Lenses
    deactivateUser_authenticationToken,
    deactivateUser_userId,

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

-- |
-- Create a value of 'DeactivateUser' 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', 'deactivateUser_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'userId', 'deactivateUser_userId' - The ID of the user.
newDeactivateUser ::
  -- | 'userId'
  Prelude.Text ->
  DeactivateUser
newDeactivateUser :: Text -> DeactivateUser
newDeactivateUser Text
pUserId_ =
  DeactivateUser'
    { $sel:authenticationToken:DeactivateUser' :: Maybe (Sensitive Text)
authenticationToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:userId:DeactivateUser' :: Text
userId = Text
pUserId_
    }

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

instance Core.AWSRequest DeactivateUser where
  type
    AWSResponse DeactivateUser =
      DeactivateUserResponse
  request :: (Service -> Service) -> DeactivateUser -> Request DeactivateUser
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 DeactivateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeactivateUser)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeactivateUserResponse
DeactivateUserResponse'

instance Prelude.Hashable DeactivateUser where
  hashWithSalt :: Int -> DeactivateUser -> Int
hashWithSalt Int
_salt DeactivateUser' {Maybe (Sensitive Text)
Text
userId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:userId:DeactivateUser' :: DeactivateUser -> Text
$sel:authenticationToken:DeactivateUser' :: DeactivateUser -> 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
userId

instance Prelude.NFData DeactivateUser where
  rnf :: DeactivateUser -> ()
rnf DeactivateUser' {Maybe (Sensitive Text)
Text
userId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:userId:DeactivateUser' :: DeactivateUser -> Text
$sel:authenticationToken:DeactivateUser' :: DeactivateUser -> 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
userId

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

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

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

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

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