{-# 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.ChimeSDKMessaging.ChannelFlowCallback
(
ChannelFlowCallback (..),
newChannelFlowCallback,
channelFlowCallback_deleteResource,
channelFlowCallback_callbackId,
channelFlowCallback_channelArn,
channelFlowCallback_channelMessage,
ChannelFlowCallbackResponse (..),
newChannelFlowCallbackResponse,
channelFlowCallbackResponse_callbackId,
channelFlowCallbackResponse_channelArn,
channelFlowCallbackResponse_httpStatus,
)
where
import Amazonka.ChimeSDKMessaging.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 ChannelFlowCallback = ChannelFlowCallback'
{
ChannelFlowCallback -> Maybe Bool
deleteResource :: Prelude.Maybe Prelude.Bool,
ChannelFlowCallback -> Text
callbackId :: Prelude.Text,
ChannelFlowCallback -> Text
channelArn :: Prelude.Text,
ChannelFlowCallback -> ChannelMessageCallback
channelMessage :: ChannelMessageCallback
}
deriving (ChannelFlowCallback -> ChannelFlowCallback -> Bool
(ChannelFlowCallback -> ChannelFlowCallback -> Bool)
-> (ChannelFlowCallback -> ChannelFlowCallback -> Bool)
-> Eq ChannelFlowCallback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelFlowCallback -> ChannelFlowCallback -> Bool
$c/= :: ChannelFlowCallback -> ChannelFlowCallback -> Bool
== :: ChannelFlowCallback -> ChannelFlowCallback -> Bool
$c== :: ChannelFlowCallback -> ChannelFlowCallback -> Bool
Prelude.Eq, Int -> ChannelFlowCallback -> ShowS
[ChannelFlowCallback] -> ShowS
ChannelFlowCallback -> String
(Int -> ChannelFlowCallback -> ShowS)
-> (ChannelFlowCallback -> String)
-> ([ChannelFlowCallback] -> ShowS)
-> Show ChannelFlowCallback
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelFlowCallback] -> ShowS
$cshowList :: [ChannelFlowCallback] -> ShowS
show :: ChannelFlowCallback -> String
$cshow :: ChannelFlowCallback -> String
showsPrec :: Int -> ChannelFlowCallback -> ShowS
$cshowsPrec :: Int -> ChannelFlowCallback -> ShowS
Prelude.Show, (forall x. ChannelFlowCallback -> Rep ChannelFlowCallback x)
-> (forall x. Rep ChannelFlowCallback x -> ChannelFlowCallback)
-> Generic ChannelFlowCallback
forall x. Rep ChannelFlowCallback x -> ChannelFlowCallback
forall x. ChannelFlowCallback -> Rep ChannelFlowCallback x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelFlowCallback x -> ChannelFlowCallback
$cfrom :: forall x. ChannelFlowCallback -> Rep ChannelFlowCallback x
Prelude.Generic)
newChannelFlowCallback ::
Prelude.Text ->
Prelude.Text ->
ChannelMessageCallback ->
ChannelFlowCallback
newChannelFlowCallback :: Text -> Text -> ChannelMessageCallback -> ChannelFlowCallback
newChannelFlowCallback
Text
pCallbackId_
Text
pChannelArn_
ChannelMessageCallback
pChannelMessage_ =
ChannelFlowCallback' :: Maybe Bool
-> Text -> Text -> ChannelMessageCallback -> ChannelFlowCallback
ChannelFlowCallback'
{ $sel:deleteResource:ChannelFlowCallback' :: Maybe Bool
deleteResource =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:callbackId:ChannelFlowCallback' :: Text
callbackId = Text
pCallbackId_,
$sel:channelArn:ChannelFlowCallback' :: Text
channelArn = Text
pChannelArn_,
$sel:channelMessage:ChannelFlowCallback' :: ChannelMessageCallback
channelMessage = ChannelMessageCallback
pChannelMessage_
}
channelFlowCallback_deleteResource :: Lens.Lens' ChannelFlowCallback (Prelude.Maybe Prelude.Bool)
channelFlowCallback_deleteResource :: (Maybe Bool -> f (Maybe Bool))
-> ChannelFlowCallback -> f ChannelFlowCallback
channelFlowCallback_deleteResource = (ChannelFlowCallback -> Maybe Bool)
-> (ChannelFlowCallback -> Maybe Bool -> ChannelFlowCallback)
-> Lens
ChannelFlowCallback ChannelFlowCallback (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlowCallback' {Maybe Bool
deleteResource :: Maybe Bool
$sel:deleteResource:ChannelFlowCallback' :: ChannelFlowCallback -> Maybe Bool
deleteResource} -> Maybe Bool
deleteResource) (\s :: ChannelFlowCallback
s@ChannelFlowCallback' {} Maybe Bool
a -> ChannelFlowCallback
s {$sel:deleteResource:ChannelFlowCallback' :: Maybe Bool
deleteResource = Maybe Bool
a} :: ChannelFlowCallback)
channelFlowCallback_callbackId :: Lens.Lens' ChannelFlowCallback Prelude.Text
channelFlowCallback_callbackId :: (Text -> f Text) -> ChannelFlowCallback -> f ChannelFlowCallback
channelFlowCallback_callbackId = (ChannelFlowCallback -> Text)
-> (ChannelFlowCallback -> Text -> ChannelFlowCallback)
-> Lens ChannelFlowCallback ChannelFlowCallback Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlowCallback' {Text
callbackId :: Text
$sel:callbackId:ChannelFlowCallback' :: ChannelFlowCallback -> Text
callbackId} -> Text
callbackId) (\s :: ChannelFlowCallback
s@ChannelFlowCallback' {} Text
a -> ChannelFlowCallback
s {$sel:callbackId:ChannelFlowCallback' :: Text
callbackId = Text
a} :: ChannelFlowCallback)
channelFlowCallback_channelArn :: Lens.Lens' ChannelFlowCallback Prelude.Text
channelFlowCallback_channelArn :: (Text -> f Text) -> ChannelFlowCallback -> f ChannelFlowCallback
channelFlowCallback_channelArn = (ChannelFlowCallback -> Text)
-> (ChannelFlowCallback -> Text -> ChannelFlowCallback)
-> Lens ChannelFlowCallback ChannelFlowCallback Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlowCallback' {Text
channelArn :: Text
$sel:channelArn:ChannelFlowCallback' :: ChannelFlowCallback -> Text
channelArn} -> Text
channelArn) (\s :: ChannelFlowCallback
s@ChannelFlowCallback' {} Text
a -> ChannelFlowCallback
s {$sel:channelArn:ChannelFlowCallback' :: Text
channelArn = Text
a} :: ChannelFlowCallback)
channelFlowCallback_channelMessage :: Lens.Lens' ChannelFlowCallback ChannelMessageCallback
channelFlowCallback_channelMessage :: (ChannelMessageCallback -> f ChannelMessageCallback)
-> ChannelFlowCallback -> f ChannelFlowCallback
channelFlowCallback_channelMessage = (ChannelFlowCallback -> ChannelMessageCallback)
-> (ChannelFlowCallback
-> ChannelMessageCallback -> ChannelFlowCallback)
-> Lens
ChannelFlowCallback
ChannelFlowCallback
ChannelMessageCallback
ChannelMessageCallback
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlowCallback' {ChannelMessageCallback
channelMessage :: ChannelMessageCallback
$sel:channelMessage:ChannelFlowCallback' :: ChannelFlowCallback -> ChannelMessageCallback
channelMessage} -> ChannelMessageCallback
channelMessage) (\s :: ChannelFlowCallback
s@ChannelFlowCallback' {} ChannelMessageCallback
a -> ChannelFlowCallback
s {$sel:channelMessage:ChannelFlowCallback' :: ChannelMessageCallback
channelMessage = ChannelMessageCallback
a} :: ChannelFlowCallback)
instance Core.AWSRequest ChannelFlowCallback where
type
AWSResponse ChannelFlowCallback =
ChannelFlowCallbackResponse
request :: ChannelFlowCallback -> Request ChannelFlowCallback
request = Service -> ChannelFlowCallback -> Request ChannelFlowCallback
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ChannelFlowCallback
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ChannelFlowCallback)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ChannelFlowCallback))
-> Logger
-> Service
-> Proxy ChannelFlowCallback
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ChannelFlowCallback)))
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 Text -> Maybe Text -> Int -> ChannelFlowCallbackResponse
ChannelFlowCallbackResponse'
(Maybe Text -> Maybe Text -> Int -> ChannelFlowCallbackResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ChannelFlowCallbackResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CallbackId")
Either String (Maybe Text -> Int -> ChannelFlowCallbackResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ChannelFlowCallbackResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChannelArn")
Either String (Int -> ChannelFlowCallbackResponse)
-> Either String Int -> Either String ChannelFlowCallbackResponse
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 ChannelFlowCallback
instance Prelude.NFData ChannelFlowCallback
instance Core.ToHeaders ChannelFlowCallback where
toHeaders :: ChannelFlowCallback -> ResponseHeaders
toHeaders = ResponseHeaders -> ChannelFlowCallback -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON ChannelFlowCallback where
toJSON :: ChannelFlowCallback -> Value
toJSON ChannelFlowCallback' {Maybe Bool
Text
ChannelMessageCallback
channelMessage :: ChannelMessageCallback
channelArn :: Text
callbackId :: Text
deleteResource :: Maybe Bool
$sel:channelMessage:ChannelFlowCallback' :: ChannelFlowCallback -> ChannelMessageCallback
$sel:channelArn:ChannelFlowCallback' :: ChannelFlowCallback -> Text
$sel:callbackId:ChannelFlowCallback' :: ChannelFlowCallback -> Text
$sel:deleteResource:ChannelFlowCallback' :: ChannelFlowCallback -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DeleteResource" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
deleteResource,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"CallbackId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
callbackId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ChannelMessage" Text -> ChannelMessageCallback -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChannelMessageCallback
channelMessage)
]
)
instance Core.ToPath ChannelFlowCallback where
toPath :: ChannelFlowCallback -> ByteString
toPath ChannelFlowCallback' {Maybe Bool
Text
ChannelMessageCallback
channelMessage :: ChannelMessageCallback
channelArn :: Text
callbackId :: Text
deleteResource :: Maybe Bool
$sel:channelMessage:ChannelFlowCallback' :: ChannelFlowCallback -> ChannelMessageCallback
$sel:channelArn:ChannelFlowCallback' :: ChannelFlowCallback -> Text
$sel:callbackId:ChannelFlowCallback' :: ChannelFlowCallback -> Text
$sel:deleteResource:ChannelFlowCallback' :: ChannelFlowCallback -> Maybe Bool
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelArn]
instance Core.ToQuery ChannelFlowCallback where
toQuery :: ChannelFlowCallback -> QueryString
toQuery =
QueryString -> ChannelFlowCallback -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=channel-flow-callback"])
data ChannelFlowCallbackResponse = ChannelFlowCallbackResponse'
{
ChannelFlowCallbackResponse -> Maybe Text
callbackId :: Prelude.Maybe Prelude.Text,
ChannelFlowCallbackResponse -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
ChannelFlowCallbackResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ChannelFlowCallbackResponse -> ChannelFlowCallbackResponse -> Bool
(ChannelFlowCallbackResponse
-> ChannelFlowCallbackResponse -> Bool)
-> (ChannelFlowCallbackResponse
-> ChannelFlowCallbackResponse -> Bool)
-> Eq ChannelFlowCallbackResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelFlowCallbackResponse -> ChannelFlowCallbackResponse -> Bool
$c/= :: ChannelFlowCallbackResponse -> ChannelFlowCallbackResponse -> Bool
== :: ChannelFlowCallbackResponse -> ChannelFlowCallbackResponse -> Bool
$c== :: ChannelFlowCallbackResponse -> ChannelFlowCallbackResponse -> Bool
Prelude.Eq, ReadPrec [ChannelFlowCallbackResponse]
ReadPrec ChannelFlowCallbackResponse
Int -> ReadS ChannelFlowCallbackResponse
ReadS [ChannelFlowCallbackResponse]
(Int -> ReadS ChannelFlowCallbackResponse)
-> ReadS [ChannelFlowCallbackResponse]
-> ReadPrec ChannelFlowCallbackResponse
-> ReadPrec [ChannelFlowCallbackResponse]
-> Read ChannelFlowCallbackResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelFlowCallbackResponse]
$creadListPrec :: ReadPrec [ChannelFlowCallbackResponse]
readPrec :: ReadPrec ChannelFlowCallbackResponse
$creadPrec :: ReadPrec ChannelFlowCallbackResponse
readList :: ReadS [ChannelFlowCallbackResponse]
$creadList :: ReadS [ChannelFlowCallbackResponse]
readsPrec :: Int -> ReadS ChannelFlowCallbackResponse
$creadsPrec :: Int -> ReadS ChannelFlowCallbackResponse
Prelude.Read, Int -> ChannelFlowCallbackResponse -> ShowS
[ChannelFlowCallbackResponse] -> ShowS
ChannelFlowCallbackResponse -> String
(Int -> ChannelFlowCallbackResponse -> ShowS)
-> (ChannelFlowCallbackResponse -> String)
-> ([ChannelFlowCallbackResponse] -> ShowS)
-> Show ChannelFlowCallbackResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelFlowCallbackResponse] -> ShowS
$cshowList :: [ChannelFlowCallbackResponse] -> ShowS
show :: ChannelFlowCallbackResponse -> String
$cshow :: ChannelFlowCallbackResponse -> String
showsPrec :: Int -> ChannelFlowCallbackResponse -> ShowS
$cshowsPrec :: Int -> ChannelFlowCallbackResponse -> ShowS
Prelude.Show, (forall x.
ChannelFlowCallbackResponse -> Rep ChannelFlowCallbackResponse x)
-> (forall x.
Rep ChannelFlowCallbackResponse x -> ChannelFlowCallbackResponse)
-> Generic ChannelFlowCallbackResponse
forall x.
Rep ChannelFlowCallbackResponse x -> ChannelFlowCallbackResponse
forall x.
ChannelFlowCallbackResponse -> Rep ChannelFlowCallbackResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChannelFlowCallbackResponse x -> ChannelFlowCallbackResponse
$cfrom :: forall x.
ChannelFlowCallbackResponse -> Rep ChannelFlowCallbackResponse x
Prelude.Generic)
newChannelFlowCallbackResponse ::
Prelude.Int ->
ChannelFlowCallbackResponse
newChannelFlowCallbackResponse :: Int -> ChannelFlowCallbackResponse
newChannelFlowCallbackResponse Int
pHttpStatus_ =
ChannelFlowCallbackResponse' :: Maybe Text -> Maybe Text -> Int -> ChannelFlowCallbackResponse
ChannelFlowCallbackResponse'
{ $sel:callbackId:ChannelFlowCallbackResponse' :: Maybe Text
callbackId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:ChannelFlowCallbackResponse' :: Maybe Text
channelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ChannelFlowCallbackResponse' :: Int
httpStatus = Int
pHttpStatus_
}
channelFlowCallbackResponse_callbackId :: Lens.Lens' ChannelFlowCallbackResponse (Prelude.Maybe Prelude.Text)
channelFlowCallbackResponse_callbackId :: (Maybe Text -> f (Maybe Text))
-> ChannelFlowCallbackResponse -> f ChannelFlowCallbackResponse
channelFlowCallbackResponse_callbackId = (ChannelFlowCallbackResponse -> Maybe Text)
-> (ChannelFlowCallbackResponse
-> Maybe Text -> ChannelFlowCallbackResponse)
-> Lens
ChannelFlowCallbackResponse
ChannelFlowCallbackResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlowCallbackResponse' {Maybe Text
callbackId :: Maybe Text
$sel:callbackId:ChannelFlowCallbackResponse' :: ChannelFlowCallbackResponse -> Maybe Text
callbackId} -> Maybe Text
callbackId) (\s :: ChannelFlowCallbackResponse
s@ChannelFlowCallbackResponse' {} Maybe Text
a -> ChannelFlowCallbackResponse
s {$sel:callbackId:ChannelFlowCallbackResponse' :: Maybe Text
callbackId = Maybe Text
a} :: ChannelFlowCallbackResponse)
channelFlowCallbackResponse_channelArn :: Lens.Lens' ChannelFlowCallbackResponse (Prelude.Maybe Prelude.Text)
channelFlowCallbackResponse_channelArn :: (Maybe Text -> f (Maybe Text))
-> ChannelFlowCallbackResponse -> f ChannelFlowCallbackResponse
channelFlowCallbackResponse_channelArn = (ChannelFlowCallbackResponse -> Maybe Text)
-> (ChannelFlowCallbackResponse
-> Maybe Text -> ChannelFlowCallbackResponse)
-> Lens
ChannelFlowCallbackResponse
ChannelFlowCallbackResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlowCallbackResponse' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:ChannelFlowCallbackResponse' :: ChannelFlowCallbackResponse -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: ChannelFlowCallbackResponse
s@ChannelFlowCallbackResponse' {} Maybe Text
a -> ChannelFlowCallbackResponse
s {$sel:channelArn:ChannelFlowCallbackResponse' :: Maybe Text
channelArn = Maybe Text
a} :: ChannelFlowCallbackResponse)
channelFlowCallbackResponse_httpStatus :: Lens.Lens' ChannelFlowCallbackResponse Prelude.Int
channelFlowCallbackResponse_httpStatus :: (Int -> f Int)
-> ChannelFlowCallbackResponse -> f ChannelFlowCallbackResponse
channelFlowCallbackResponse_httpStatus = (ChannelFlowCallbackResponse -> Int)
-> (ChannelFlowCallbackResponse
-> Int -> ChannelFlowCallbackResponse)
-> Lens
ChannelFlowCallbackResponse ChannelFlowCallbackResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlowCallbackResponse' {Int
httpStatus :: Int
$sel:httpStatus:ChannelFlowCallbackResponse' :: ChannelFlowCallbackResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ChannelFlowCallbackResponse
s@ChannelFlowCallbackResponse' {} Int
a -> ChannelFlowCallbackResponse
s {$sel:httpStatus:ChannelFlowCallbackResponse' :: Int
httpStatus = Int
a} :: ChannelFlowCallbackResponse)
instance Prelude.NFData ChannelFlowCallbackResponse