{-# 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.Chime.LogoutUser
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Logs out the specified user from all of the devices they are currently
-- logged into.
module Amazonka.Chime.LogoutUser
  ( -- * Creating a Request
    LogoutUser (..),
    newLogoutUser,

    -- * Request Lenses
    logoutUser_accountId,
    logoutUser_userId,

    -- * Destructuring the Response
    LogoutUserResponse (..),
    newLogoutUserResponse,

    -- * Response Lenses
    logoutUserResponse_httpStatus,
  )
where

import Amazonka.Chime.Types
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

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

-- |
-- Create a value of 'LogoutUser' 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:
--
-- 'accountId', 'logoutUser_accountId' - The Amazon Chime account ID.
--
-- 'userId', 'logoutUser_userId' - The user ID.
newLogoutUser ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'userId'
  Prelude.Text ->
  LogoutUser
newLogoutUser :: Text -> Text -> LogoutUser
newLogoutUser Text
pAccountId_ Text
pUserId_ =
  LogoutUser'
    { $sel:accountId:LogoutUser' :: Text
accountId = Text
pAccountId_,
      $sel:userId:LogoutUser' :: Text
userId = Text
pUserId_
    }

-- | The Amazon Chime account ID.
logoutUser_accountId :: Lens.Lens' LogoutUser Prelude.Text
logoutUser_accountId :: Lens' LogoutUser Text
logoutUser_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogoutUser' {Text
accountId :: Text
$sel:accountId:LogoutUser' :: LogoutUser -> Text
accountId} -> Text
accountId) (\s :: LogoutUser
s@LogoutUser' {} Text
a -> LogoutUser
s {$sel:accountId:LogoutUser' :: Text
accountId = Text
a} :: LogoutUser)

-- | The user ID.
logoutUser_userId :: Lens.Lens' LogoutUser Prelude.Text
logoutUser_userId :: Lens' LogoutUser Text
logoutUser_userId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogoutUser' {Text
userId :: Text
$sel:userId:LogoutUser' :: LogoutUser -> Text
userId} -> Text
userId) (\s :: LogoutUser
s@LogoutUser' {} Text
a -> LogoutUser
s {$sel:userId:LogoutUser' :: Text
userId = Text
a} :: LogoutUser)

instance Core.AWSRequest LogoutUser where
  type AWSResponse LogoutUser = LogoutUserResponse
  request :: (Service -> Service) -> LogoutUser -> Request LogoutUser
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy LogoutUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse LogoutUser)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> LogoutUserResponse
LogoutUserResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable LogoutUser where
  hashWithSalt :: Int -> LogoutUser -> Int
hashWithSalt Int
_salt LogoutUser' {Text
userId :: Text
accountId :: Text
$sel:userId:LogoutUser' :: LogoutUser -> Text
$sel:accountId:LogoutUser' :: LogoutUser -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userId

instance Prelude.NFData LogoutUser where
  rnf :: LogoutUser -> ()
rnf LogoutUser' {Text
userId :: Text
accountId :: Text
$sel:userId:LogoutUser' :: LogoutUser -> Text
$sel:accountId:LogoutUser' :: LogoutUser -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userId

instance Data.ToHeaders LogoutUser where
  toHeaders :: LogoutUser -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToJSON LogoutUser where
  toJSON :: LogoutUser -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath LogoutUser where
  toPath :: LogoutUser -> ByteString
toPath LogoutUser' {Text
userId :: Text
accountId :: Text
$sel:userId:LogoutUser' :: LogoutUser -> Text
$sel:accountId:LogoutUser' :: LogoutUser -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
accountId,
        ByteString
"/users/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
userId
      ]

instance Data.ToQuery LogoutUser where
  toQuery :: LogoutUser -> QueryString
toQuery =
    forall a b. a -> b -> a
Prelude.const
      (forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=logout"])

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

-- |
-- Create a value of 'LogoutUserResponse' 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:
--
-- 'httpStatus', 'logoutUserResponse_httpStatus' - The response's http status code.
newLogoutUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  LogoutUserResponse
newLogoutUserResponse :: Int -> LogoutUserResponse
newLogoutUserResponse Int
pHttpStatus_ =
  LogoutUserResponse' {$sel:httpStatus:LogoutUserResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
logoutUserResponse_httpStatus :: Lens.Lens' LogoutUserResponse Prelude.Int
logoutUserResponse_httpStatus :: Lens' LogoutUserResponse Int
logoutUserResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogoutUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:LogoutUserResponse' :: LogoutUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: LogoutUserResponse
s@LogoutUserResponse' {} Int
a -> LogoutUserResponse
s {$sel:httpStatus:LogoutUserResponse' :: Int
httpStatus = Int
a} :: LogoutUserResponse)

instance Prelude.NFData LogoutUserResponse where
  rnf :: LogoutUserResponse -> ()
rnf LogoutUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:LogoutUserResponse' :: LogoutUserResponse -> Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus