{-# 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-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)
--
-- 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.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:/ '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 (Core.Sensitive Prelude.Text),
    -- | The ID of the user.
    DeactivateUser -> Text
userId :: Prelude.Text
  }
  deriving (DeactivateUser -> DeactivateUser -> Bool
(DeactivateUser -> DeactivateUser -> Bool)
-> (DeactivateUser -> DeactivateUser -> Bool) -> Eq DeactivateUser
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
(Int -> DeactivateUser -> ShowS)
-> (DeactivateUser -> String)
-> ([DeactivateUser] -> ShowS)
-> Show DeactivateUser
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. DeactivateUser -> Rep DeactivateUser x)
-> (forall x. Rep DeactivateUser x -> DeactivateUser)
-> Generic DeactivateUser
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' :: Maybe (Sensitive Text) -> Text -> DeactivateUser
DeactivateUser'
    { $sel:authenticationToken:DeactivateUser' :: Maybe (Sensitive Text)
authenticationToken =
        Maybe (Sensitive Text)
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 :: (Maybe Text -> f (Maybe Text))
-> DeactivateUser -> f DeactivateUser
deactivateUser_authenticationToken = (DeactivateUser -> Maybe (Sensitive Text))
-> (DeactivateUser -> Maybe (Sensitive Text) -> DeactivateUser)
-> Lens
     DeactivateUser
     DeactivateUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> DeactivateUser -> f DeactivateUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DeactivateUser
-> f DeactivateUser
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.
deactivateUser_userId :: Lens.Lens' DeactivateUser Prelude.Text
deactivateUser_userId :: (Text -> f Text) -> DeactivateUser -> f DeactivateUser
deactivateUser_userId = (DeactivateUser -> Text)
-> (DeactivateUser -> Text -> DeactivateUser)
-> Lens DeactivateUser DeactivateUser Text Text
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 :: DeactivateUser -> Request DeactivateUser
request = Service -> DeactivateUser -> Request DeactivateUser
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeactivateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeactivateUser)))
response =
    AWSResponse DeactivateUser
-> Logger
-> Service
-> Proxy DeactivateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeactivateUser)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeactivateUser
DeactivateUserResponse
DeactivateUserResponse'

instance Prelude.Hashable DeactivateUser

instance Prelude.NFData DeactivateUser

instance Core.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)
..} =
    [[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 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)
..} =
    [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, ByteString
"/activation"]

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

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