{-# 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 #-}
module Amazonka.ConnectParticipant.DisconnectParticipant
(
DisconnectParticipant (..),
newDisconnectParticipant,
disconnectParticipant_clientToken,
disconnectParticipant_connectionToken,
DisconnectParticipantResponse (..),
newDisconnectParticipantResponse,
disconnectParticipantResponse_httpStatus,
)
where
import Amazonka.ConnectParticipant.Types
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
data DisconnectParticipant = DisconnectParticipant'
{
DisconnectParticipant -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
DisconnectParticipant -> Text
connectionToken :: Prelude.Text
}
deriving (DisconnectParticipant -> DisconnectParticipant -> Bool
(DisconnectParticipant -> DisconnectParticipant -> Bool)
-> (DisconnectParticipant -> DisconnectParticipant -> Bool)
-> Eq DisconnectParticipant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisconnectParticipant -> DisconnectParticipant -> Bool
$c/= :: DisconnectParticipant -> DisconnectParticipant -> Bool
== :: DisconnectParticipant -> DisconnectParticipant -> Bool
$c== :: DisconnectParticipant -> DisconnectParticipant -> Bool
Prelude.Eq, ReadPrec [DisconnectParticipant]
ReadPrec DisconnectParticipant
Int -> ReadS DisconnectParticipant
ReadS [DisconnectParticipant]
(Int -> ReadS DisconnectParticipant)
-> ReadS [DisconnectParticipant]
-> ReadPrec DisconnectParticipant
-> ReadPrec [DisconnectParticipant]
-> Read DisconnectParticipant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisconnectParticipant]
$creadListPrec :: ReadPrec [DisconnectParticipant]
readPrec :: ReadPrec DisconnectParticipant
$creadPrec :: ReadPrec DisconnectParticipant
readList :: ReadS [DisconnectParticipant]
$creadList :: ReadS [DisconnectParticipant]
readsPrec :: Int -> ReadS DisconnectParticipant
$creadsPrec :: Int -> ReadS DisconnectParticipant
Prelude.Read, Int -> DisconnectParticipant -> ShowS
[DisconnectParticipant] -> ShowS
DisconnectParticipant -> String
(Int -> DisconnectParticipant -> ShowS)
-> (DisconnectParticipant -> String)
-> ([DisconnectParticipant] -> ShowS)
-> Show DisconnectParticipant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisconnectParticipant] -> ShowS
$cshowList :: [DisconnectParticipant] -> ShowS
show :: DisconnectParticipant -> String
$cshow :: DisconnectParticipant -> String
showsPrec :: Int -> DisconnectParticipant -> ShowS
$cshowsPrec :: Int -> DisconnectParticipant -> ShowS
Prelude.Show, (forall x. DisconnectParticipant -> Rep DisconnectParticipant x)
-> (forall x. Rep DisconnectParticipant x -> DisconnectParticipant)
-> Generic DisconnectParticipant
forall x. Rep DisconnectParticipant x -> DisconnectParticipant
forall x. DisconnectParticipant -> Rep DisconnectParticipant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisconnectParticipant x -> DisconnectParticipant
$cfrom :: forall x. DisconnectParticipant -> Rep DisconnectParticipant x
Prelude.Generic)
newDisconnectParticipant ::
Prelude.Text ->
DisconnectParticipant
newDisconnectParticipant :: Text -> DisconnectParticipant
newDisconnectParticipant Text
pConnectionToken_ =
DisconnectParticipant' :: Maybe Text -> Text -> DisconnectParticipant
DisconnectParticipant'
{ $sel:clientToken:DisconnectParticipant' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:connectionToken:DisconnectParticipant' :: Text
connectionToken = Text
pConnectionToken_
}
disconnectParticipant_clientToken :: Lens.Lens' DisconnectParticipant (Prelude.Maybe Prelude.Text)
disconnectParticipant_clientToken :: (Maybe Text -> f (Maybe Text))
-> DisconnectParticipant -> f DisconnectParticipant
disconnectParticipant_clientToken = (DisconnectParticipant -> Maybe Text)
-> (DisconnectParticipant -> Maybe Text -> DisconnectParticipant)
-> Lens
DisconnectParticipant
DisconnectParticipant
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisconnectParticipant' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DisconnectParticipant' :: DisconnectParticipant -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DisconnectParticipant
s@DisconnectParticipant' {} Maybe Text
a -> DisconnectParticipant
s {$sel:clientToken:DisconnectParticipant' :: Maybe Text
clientToken = Maybe Text
a} :: DisconnectParticipant)
disconnectParticipant_connectionToken :: Lens.Lens' DisconnectParticipant Prelude.Text
disconnectParticipant_connectionToken :: (Text -> f Text)
-> DisconnectParticipant -> f DisconnectParticipant
disconnectParticipant_connectionToken = (DisconnectParticipant -> Text)
-> (DisconnectParticipant -> Text -> DisconnectParticipant)
-> Lens DisconnectParticipant DisconnectParticipant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisconnectParticipant' {Text
connectionToken :: Text
$sel:connectionToken:DisconnectParticipant' :: DisconnectParticipant -> Text
connectionToken} -> Text
connectionToken) (\s :: DisconnectParticipant
s@DisconnectParticipant' {} Text
a -> DisconnectParticipant
s {$sel:connectionToken:DisconnectParticipant' :: Text
connectionToken = Text
a} :: DisconnectParticipant)
instance Core.AWSRequest DisconnectParticipant where
type
AWSResponse DisconnectParticipant =
DisconnectParticipantResponse
request :: DisconnectParticipant -> Request DisconnectParticipant
request = Service -> DisconnectParticipant -> Request DisconnectParticipant
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DisconnectParticipant
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisconnectParticipant)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DisconnectParticipant))
-> Logger
-> Service
-> Proxy DisconnectParticipant
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisconnectParticipant)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> DisconnectParticipantResponse
DisconnectParticipantResponse'
(Int -> DisconnectParticipantResponse)
-> Either String Int -> Either String DisconnectParticipantResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DisconnectParticipant
instance Prelude.NFData DisconnectParticipant
instance Core.ToHeaders DisconnectParticipant where
toHeaders :: DisconnectParticipant -> ResponseHeaders
toHeaders DisconnectParticipant' {Maybe Text
Text
connectionToken :: Text
clientToken :: Maybe Text
$sel:connectionToken:DisconnectParticipant' :: DisconnectParticipant -> Text
$sel:clientToken:DisconnectParticipant' :: DisconnectParticipant -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Bearer" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
connectionToken,
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
]
instance Core.ToJSON DisconnectParticipant where
toJSON :: DisconnectParticipant -> Value
toJSON DisconnectParticipant' {Maybe Text
Text
connectionToken :: Text
clientToken :: Maybe Text
$sel:connectionToken:DisconnectParticipant' :: DisconnectParticipant -> Text
$sel:clientToken:DisconnectParticipant' :: DisconnectParticipant -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken]
)
instance Core.ToPath DisconnectParticipant where
toPath :: DisconnectParticipant -> ByteString
toPath = ByteString -> DisconnectParticipant -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/participant/disconnect"
instance Core.ToQuery DisconnectParticipant where
toQuery :: DisconnectParticipant -> QueryString
toQuery = QueryString -> DisconnectParticipant -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DisconnectParticipantResponse = DisconnectParticipantResponse'
{
DisconnectParticipantResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DisconnectParticipantResponse
-> DisconnectParticipantResponse -> Bool
(DisconnectParticipantResponse
-> DisconnectParticipantResponse -> Bool)
-> (DisconnectParticipantResponse
-> DisconnectParticipantResponse -> Bool)
-> Eq DisconnectParticipantResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisconnectParticipantResponse
-> DisconnectParticipantResponse -> Bool
$c/= :: DisconnectParticipantResponse
-> DisconnectParticipantResponse -> Bool
== :: DisconnectParticipantResponse
-> DisconnectParticipantResponse -> Bool
$c== :: DisconnectParticipantResponse
-> DisconnectParticipantResponse -> Bool
Prelude.Eq, ReadPrec [DisconnectParticipantResponse]
ReadPrec DisconnectParticipantResponse
Int -> ReadS DisconnectParticipantResponse
ReadS [DisconnectParticipantResponse]
(Int -> ReadS DisconnectParticipantResponse)
-> ReadS [DisconnectParticipantResponse]
-> ReadPrec DisconnectParticipantResponse
-> ReadPrec [DisconnectParticipantResponse]
-> Read DisconnectParticipantResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisconnectParticipantResponse]
$creadListPrec :: ReadPrec [DisconnectParticipantResponse]
readPrec :: ReadPrec DisconnectParticipantResponse
$creadPrec :: ReadPrec DisconnectParticipantResponse
readList :: ReadS [DisconnectParticipantResponse]
$creadList :: ReadS [DisconnectParticipantResponse]
readsPrec :: Int -> ReadS DisconnectParticipantResponse
$creadsPrec :: Int -> ReadS DisconnectParticipantResponse
Prelude.Read, Int -> DisconnectParticipantResponse -> ShowS
[DisconnectParticipantResponse] -> ShowS
DisconnectParticipantResponse -> String
(Int -> DisconnectParticipantResponse -> ShowS)
-> (DisconnectParticipantResponse -> String)
-> ([DisconnectParticipantResponse] -> ShowS)
-> Show DisconnectParticipantResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisconnectParticipantResponse] -> ShowS
$cshowList :: [DisconnectParticipantResponse] -> ShowS
show :: DisconnectParticipantResponse -> String
$cshow :: DisconnectParticipantResponse -> String
showsPrec :: Int -> DisconnectParticipantResponse -> ShowS
$cshowsPrec :: Int -> DisconnectParticipantResponse -> ShowS
Prelude.Show, (forall x.
DisconnectParticipantResponse
-> Rep DisconnectParticipantResponse x)
-> (forall x.
Rep DisconnectParticipantResponse x
-> DisconnectParticipantResponse)
-> Generic DisconnectParticipantResponse
forall x.
Rep DisconnectParticipantResponse x
-> DisconnectParticipantResponse
forall x.
DisconnectParticipantResponse
-> Rep DisconnectParticipantResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisconnectParticipantResponse x
-> DisconnectParticipantResponse
$cfrom :: forall x.
DisconnectParticipantResponse
-> Rep DisconnectParticipantResponse x
Prelude.Generic)
newDisconnectParticipantResponse ::
Prelude.Int ->
DisconnectParticipantResponse
newDisconnectParticipantResponse :: Int -> DisconnectParticipantResponse
newDisconnectParticipantResponse Int
pHttpStatus_ =
DisconnectParticipantResponse' :: Int -> DisconnectParticipantResponse
DisconnectParticipantResponse'
{ $sel:httpStatus:DisconnectParticipantResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
disconnectParticipantResponse_httpStatus :: Lens.Lens' DisconnectParticipantResponse Prelude.Int
disconnectParticipantResponse_httpStatus :: (Int -> f Int)
-> DisconnectParticipantResponse -> f DisconnectParticipantResponse
disconnectParticipantResponse_httpStatus = (DisconnectParticipantResponse -> Int)
-> (DisconnectParticipantResponse
-> Int -> DisconnectParticipantResponse)
-> Lens
DisconnectParticipantResponse DisconnectParticipantResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisconnectParticipantResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisconnectParticipantResponse' :: DisconnectParticipantResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisconnectParticipantResponse
s@DisconnectParticipantResponse' {} Int
a -> DisconnectParticipantResponse
s {$sel:httpStatus:DisconnectParticipantResponse' :: Int
httpStatus = Int
a} :: DisconnectParticipantResponse)
instance Prelude.NFData DisconnectParticipantResponse