{-# 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.CreateParticipantConnection
(
CreateParticipantConnection (..),
newCreateParticipantConnection,
createParticipantConnection_type,
createParticipantConnection_participantToken,
CreateParticipantConnectionResponse (..),
newCreateParticipantConnectionResponse,
createParticipantConnectionResponse_connectionCredentials,
createParticipantConnectionResponse_websocket,
createParticipantConnectionResponse_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 CreateParticipantConnection = CreateParticipantConnection'
{
CreateParticipantConnection -> NonEmpty ConnectionType
type' :: Prelude.NonEmpty ConnectionType,
CreateParticipantConnection -> Text
participantToken :: Prelude.Text
}
deriving (CreateParticipantConnection -> CreateParticipantConnection -> Bool
(CreateParticipantConnection
-> CreateParticipantConnection -> Bool)
-> (CreateParticipantConnection
-> CreateParticipantConnection -> Bool)
-> Eq CreateParticipantConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateParticipantConnection -> CreateParticipantConnection -> Bool
$c/= :: CreateParticipantConnection -> CreateParticipantConnection -> Bool
== :: CreateParticipantConnection -> CreateParticipantConnection -> Bool
$c== :: CreateParticipantConnection -> CreateParticipantConnection -> Bool
Prelude.Eq, ReadPrec [CreateParticipantConnection]
ReadPrec CreateParticipantConnection
Int -> ReadS CreateParticipantConnection
ReadS [CreateParticipantConnection]
(Int -> ReadS CreateParticipantConnection)
-> ReadS [CreateParticipantConnection]
-> ReadPrec CreateParticipantConnection
-> ReadPrec [CreateParticipantConnection]
-> Read CreateParticipantConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateParticipantConnection]
$creadListPrec :: ReadPrec [CreateParticipantConnection]
readPrec :: ReadPrec CreateParticipantConnection
$creadPrec :: ReadPrec CreateParticipantConnection
readList :: ReadS [CreateParticipantConnection]
$creadList :: ReadS [CreateParticipantConnection]
readsPrec :: Int -> ReadS CreateParticipantConnection
$creadsPrec :: Int -> ReadS CreateParticipantConnection
Prelude.Read, Int -> CreateParticipantConnection -> ShowS
[CreateParticipantConnection] -> ShowS
CreateParticipantConnection -> String
(Int -> CreateParticipantConnection -> ShowS)
-> (CreateParticipantConnection -> String)
-> ([CreateParticipantConnection] -> ShowS)
-> Show CreateParticipantConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateParticipantConnection] -> ShowS
$cshowList :: [CreateParticipantConnection] -> ShowS
show :: CreateParticipantConnection -> String
$cshow :: CreateParticipantConnection -> String
showsPrec :: Int -> CreateParticipantConnection -> ShowS
$cshowsPrec :: Int -> CreateParticipantConnection -> ShowS
Prelude.Show, (forall x.
CreateParticipantConnection -> Rep CreateParticipantConnection x)
-> (forall x.
Rep CreateParticipantConnection x -> CreateParticipantConnection)
-> Generic CreateParticipantConnection
forall x.
Rep CreateParticipantConnection x -> CreateParticipantConnection
forall x.
CreateParticipantConnection -> Rep CreateParticipantConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateParticipantConnection x -> CreateParticipantConnection
$cfrom :: forall x.
CreateParticipantConnection -> Rep CreateParticipantConnection x
Prelude.Generic)
newCreateParticipantConnection ::
Prelude.NonEmpty ConnectionType ->
Prelude.Text ->
CreateParticipantConnection
newCreateParticipantConnection :: NonEmpty ConnectionType -> Text -> CreateParticipantConnection
newCreateParticipantConnection
NonEmpty ConnectionType
pType_
Text
pParticipantToken_ =
CreateParticipantConnection' :: NonEmpty ConnectionType -> Text -> CreateParticipantConnection
CreateParticipantConnection'
{ $sel:type':CreateParticipantConnection' :: NonEmpty ConnectionType
type' =
Tagged
(NonEmpty ConnectionType) (Identity (NonEmpty ConnectionType))
-> Tagged
(NonEmpty ConnectionType) (Identity (NonEmpty ConnectionType))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty ConnectionType) (Identity (NonEmpty ConnectionType))
-> Tagged
(NonEmpty ConnectionType) (Identity (NonEmpty ConnectionType)))
-> NonEmpty ConnectionType -> NonEmpty ConnectionType
forall t b. AReview t b -> b -> t
Lens.# NonEmpty ConnectionType
pType_,
$sel:participantToken:CreateParticipantConnection' :: Text
participantToken = Text
pParticipantToken_
}
createParticipantConnection_type :: Lens.Lens' CreateParticipantConnection (Prelude.NonEmpty ConnectionType)
createParticipantConnection_type :: (NonEmpty ConnectionType -> f (NonEmpty ConnectionType))
-> CreateParticipantConnection -> f CreateParticipantConnection
createParticipantConnection_type = (CreateParticipantConnection -> NonEmpty ConnectionType)
-> (CreateParticipantConnection
-> NonEmpty ConnectionType -> CreateParticipantConnection)
-> Lens
CreateParticipantConnection
CreateParticipantConnection
(NonEmpty ConnectionType)
(NonEmpty ConnectionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateParticipantConnection' {NonEmpty ConnectionType
type' :: NonEmpty ConnectionType
$sel:type':CreateParticipantConnection' :: CreateParticipantConnection -> NonEmpty ConnectionType
type'} -> NonEmpty ConnectionType
type') (\s :: CreateParticipantConnection
s@CreateParticipantConnection' {} NonEmpty ConnectionType
a -> CreateParticipantConnection
s {$sel:type':CreateParticipantConnection' :: NonEmpty ConnectionType
type' = NonEmpty ConnectionType
a} :: CreateParticipantConnection) ((NonEmpty ConnectionType -> f (NonEmpty ConnectionType))
-> CreateParticipantConnection -> f CreateParticipantConnection)
-> ((NonEmpty ConnectionType -> f (NonEmpty ConnectionType))
-> NonEmpty ConnectionType -> f (NonEmpty ConnectionType))
-> (NonEmpty ConnectionType -> f (NonEmpty ConnectionType))
-> CreateParticipantConnection
-> f CreateParticipantConnection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ConnectionType -> f (NonEmpty ConnectionType))
-> NonEmpty ConnectionType -> f (NonEmpty ConnectionType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createParticipantConnection_participantToken :: Lens.Lens' CreateParticipantConnection Prelude.Text
createParticipantConnection_participantToken :: (Text -> f Text)
-> CreateParticipantConnection -> f CreateParticipantConnection
createParticipantConnection_participantToken = (CreateParticipantConnection -> Text)
-> (CreateParticipantConnection
-> Text -> CreateParticipantConnection)
-> Lens
CreateParticipantConnection CreateParticipantConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateParticipantConnection' {Text
participantToken :: Text
$sel:participantToken:CreateParticipantConnection' :: CreateParticipantConnection -> Text
participantToken} -> Text
participantToken) (\s :: CreateParticipantConnection
s@CreateParticipantConnection' {} Text
a -> CreateParticipantConnection
s {$sel:participantToken:CreateParticipantConnection' :: Text
participantToken = Text
a} :: CreateParticipantConnection)
instance Core.AWSRequest CreateParticipantConnection where
type
AWSResponse CreateParticipantConnection =
CreateParticipantConnectionResponse
request :: CreateParticipantConnection -> Request CreateParticipantConnection
request = Service
-> CreateParticipantConnection
-> Request CreateParticipantConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateParticipantConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateParticipantConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateParticipantConnection))
-> Logger
-> Service
-> Proxy CreateParticipantConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateParticipantConnection)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe ConnectionCredentials
-> Maybe Websocket -> Int -> CreateParticipantConnectionResponse
CreateParticipantConnectionResponse'
(Maybe ConnectionCredentials
-> Maybe Websocket -> Int -> CreateParticipantConnectionResponse)
-> Either String (Maybe ConnectionCredentials)
-> Either
String
(Maybe Websocket -> Int -> CreateParticipantConnectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ConnectionCredentials)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConnectionCredentials")
Either
String
(Maybe Websocket -> Int -> CreateParticipantConnectionResponse)
-> Either String (Maybe Websocket)
-> Either String (Int -> CreateParticipantConnectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Websocket)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Websocket")
Either String (Int -> CreateParticipantConnectionResponse)
-> Either String Int
-> Either String CreateParticipantConnectionResponse
forall (f :: * -> *) a b. Applicative f => 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 CreateParticipantConnection
instance Prelude.NFData CreateParticipantConnection
instance Core.ToHeaders CreateParticipantConnection where
toHeaders :: CreateParticipantConnection -> ResponseHeaders
toHeaders CreateParticipantConnection' {NonEmpty ConnectionType
Text
participantToken :: Text
type' :: NonEmpty ConnectionType
$sel:participantToken:CreateParticipantConnection' :: CreateParticipantConnection -> Text
$sel:type':CreateParticipantConnection' :: CreateParticipantConnection -> NonEmpty ConnectionType
..} =
[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
participantToken,
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 CreateParticipantConnection where
toJSON :: CreateParticipantConnection -> Value
toJSON CreateParticipantConnection' {NonEmpty ConnectionType
Text
participantToken :: Text
type' :: NonEmpty ConnectionType
$sel:participantToken:CreateParticipantConnection' :: CreateParticipantConnection -> Text
$sel:type':CreateParticipantConnection' :: CreateParticipantConnection -> NonEmpty ConnectionType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> NonEmpty ConnectionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty ConnectionType
type')]
)
instance Core.ToPath CreateParticipantConnection where
toPath :: CreateParticipantConnection -> ByteString
toPath = ByteString -> CreateParticipantConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/participant/connection"
instance Core.ToQuery CreateParticipantConnection where
toQuery :: CreateParticipantConnection -> QueryString
toQuery = QueryString -> CreateParticipantConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateParticipantConnectionResponse = CreateParticipantConnectionResponse'
{
CreateParticipantConnectionResponse -> Maybe ConnectionCredentials
connectionCredentials :: Prelude.Maybe ConnectionCredentials,
CreateParticipantConnectionResponse -> Maybe Websocket
websocket :: Prelude.Maybe Websocket,
CreateParticipantConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateParticipantConnectionResponse
-> CreateParticipantConnectionResponse -> Bool
(CreateParticipantConnectionResponse
-> CreateParticipantConnectionResponse -> Bool)
-> (CreateParticipantConnectionResponse
-> CreateParticipantConnectionResponse -> Bool)
-> Eq CreateParticipantConnectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateParticipantConnectionResponse
-> CreateParticipantConnectionResponse -> Bool
$c/= :: CreateParticipantConnectionResponse
-> CreateParticipantConnectionResponse -> Bool
== :: CreateParticipantConnectionResponse
-> CreateParticipantConnectionResponse -> Bool
$c== :: CreateParticipantConnectionResponse
-> CreateParticipantConnectionResponse -> Bool
Prelude.Eq, ReadPrec [CreateParticipantConnectionResponse]
ReadPrec CreateParticipantConnectionResponse
Int -> ReadS CreateParticipantConnectionResponse
ReadS [CreateParticipantConnectionResponse]
(Int -> ReadS CreateParticipantConnectionResponse)
-> ReadS [CreateParticipantConnectionResponse]
-> ReadPrec CreateParticipantConnectionResponse
-> ReadPrec [CreateParticipantConnectionResponse]
-> Read CreateParticipantConnectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateParticipantConnectionResponse]
$creadListPrec :: ReadPrec [CreateParticipantConnectionResponse]
readPrec :: ReadPrec CreateParticipantConnectionResponse
$creadPrec :: ReadPrec CreateParticipantConnectionResponse
readList :: ReadS [CreateParticipantConnectionResponse]
$creadList :: ReadS [CreateParticipantConnectionResponse]
readsPrec :: Int -> ReadS CreateParticipantConnectionResponse
$creadsPrec :: Int -> ReadS CreateParticipantConnectionResponse
Prelude.Read, Int -> CreateParticipantConnectionResponse -> ShowS
[CreateParticipantConnectionResponse] -> ShowS
CreateParticipantConnectionResponse -> String
(Int -> CreateParticipantConnectionResponse -> ShowS)
-> (CreateParticipantConnectionResponse -> String)
-> ([CreateParticipantConnectionResponse] -> ShowS)
-> Show CreateParticipantConnectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateParticipantConnectionResponse] -> ShowS
$cshowList :: [CreateParticipantConnectionResponse] -> ShowS
show :: CreateParticipantConnectionResponse -> String
$cshow :: CreateParticipantConnectionResponse -> String
showsPrec :: Int -> CreateParticipantConnectionResponse -> ShowS
$cshowsPrec :: Int -> CreateParticipantConnectionResponse -> ShowS
Prelude.Show, (forall x.
CreateParticipantConnectionResponse
-> Rep CreateParticipantConnectionResponse x)
-> (forall x.
Rep CreateParticipantConnectionResponse x
-> CreateParticipantConnectionResponse)
-> Generic CreateParticipantConnectionResponse
forall x.
Rep CreateParticipantConnectionResponse x
-> CreateParticipantConnectionResponse
forall x.
CreateParticipantConnectionResponse
-> Rep CreateParticipantConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateParticipantConnectionResponse x
-> CreateParticipantConnectionResponse
$cfrom :: forall x.
CreateParticipantConnectionResponse
-> Rep CreateParticipantConnectionResponse x
Prelude.Generic)
newCreateParticipantConnectionResponse ::
Prelude.Int ->
CreateParticipantConnectionResponse
newCreateParticipantConnectionResponse :: Int -> CreateParticipantConnectionResponse
newCreateParticipantConnectionResponse Int
pHttpStatus_ =
CreateParticipantConnectionResponse' :: Maybe ConnectionCredentials
-> Maybe Websocket -> Int -> CreateParticipantConnectionResponse
CreateParticipantConnectionResponse'
{ $sel:connectionCredentials:CreateParticipantConnectionResponse' :: Maybe ConnectionCredentials
connectionCredentials =
Maybe ConnectionCredentials
forall a. Maybe a
Prelude.Nothing,
$sel:websocket:CreateParticipantConnectionResponse' :: Maybe Websocket
websocket = Maybe Websocket
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateParticipantConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createParticipantConnectionResponse_connectionCredentials :: Lens.Lens' CreateParticipantConnectionResponse (Prelude.Maybe ConnectionCredentials)
createParticipantConnectionResponse_connectionCredentials :: (Maybe ConnectionCredentials -> f (Maybe ConnectionCredentials))
-> CreateParticipantConnectionResponse
-> f CreateParticipantConnectionResponse
createParticipantConnectionResponse_connectionCredentials = (CreateParticipantConnectionResponse
-> Maybe ConnectionCredentials)
-> (CreateParticipantConnectionResponse
-> Maybe ConnectionCredentials
-> CreateParticipantConnectionResponse)
-> Lens
CreateParticipantConnectionResponse
CreateParticipantConnectionResponse
(Maybe ConnectionCredentials)
(Maybe ConnectionCredentials)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateParticipantConnectionResponse' {Maybe ConnectionCredentials
connectionCredentials :: Maybe ConnectionCredentials
$sel:connectionCredentials:CreateParticipantConnectionResponse' :: CreateParticipantConnectionResponse -> Maybe ConnectionCredentials
connectionCredentials} -> Maybe ConnectionCredentials
connectionCredentials) (\s :: CreateParticipantConnectionResponse
s@CreateParticipantConnectionResponse' {} Maybe ConnectionCredentials
a -> CreateParticipantConnectionResponse
s {$sel:connectionCredentials:CreateParticipantConnectionResponse' :: Maybe ConnectionCredentials
connectionCredentials = Maybe ConnectionCredentials
a} :: CreateParticipantConnectionResponse)
createParticipantConnectionResponse_websocket :: Lens.Lens' CreateParticipantConnectionResponse (Prelude.Maybe Websocket)
createParticipantConnectionResponse_websocket :: (Maybe Websocket -> f (Maybe Websocket))
-> CreateParticipantConnectionResponse
-> f CreateParticipantConnectionResponse
createParticipantConnectionResponse_websocket = (CreateParticipantConnectionResponse -> Maybe Websocket)
-> (CreateParticipantConnectionResponse
-> Maybe Websocket -> CreateParticipantConnectionResponse)
-> Lens
CreateParticipantConnectionResponse
CreateParticipantConnectionResponse
(Maybe Websocket)
(Maybe Websocket)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateParticipantConnectionResponse' {Maybe Websocket
websocket :: Maybe Websocket
$sel:websocket:CreateParticipantConnectionResponse' :: CreateParticipantConnectionResponse -> Maybe Websocket
websocket} -> Maybe Websocket
websocket) (\s :: CreateParticipantConnectionResponse
s@CreateParticipantConnectionResponse' {} Maybe Websocket
a -> CreateParticipantConnectionResponse
s {$sel:websocket:CreateParticipantConnectionResponse' :: Maybe Websocket
websocket = Maybe Websocket
a} :: CreateParticipantConnectionResponse)
createParticipantConnectionResponse_httpStatus :: Lens.Lens' CreateParticipantConnectionResponse Prelude.Int
createParticipantConnectionResponse_httpStatus :: (Int -> f Int)
-> CreateParticipantConnectionResponse
-> f CreateParticipantConnectionResponse
createParticipantConnectionResponse_httpStatus = (CreateParticipantConnectionResponse -> Int)
-> (CreateParticipantConnectionResponse
-> Int -> CreateParticipantConnectionResponse)
-> Lens
CreateParticipantConnectionResponse
CreateParticipantConnectionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateParticipantConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateParticipantConnectionResponse' :: CreateParticipantConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateParticipantConnectionResponse
s@CreateParticipantConnectionResponse' {} Int
a -> CreateParticipantConnectionResponse
s {$sel:httpStatus:CreateParticipantConnectionResponse' :: Int
httpStatus = Int
a} :: CreateParticipantConnectionResponse)
instance
Prelude.NFData
CreateParticipantConnectionResponse