{-# 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.Chime.CreateChannelModerator
(
CreateChannelModerator (..),
newCreateChannelModerator,
createChannelModerator_chimeBearer,
createChannelModerator_channelArn,
createChannelModerator_channelModeratorArn,
CreateChannelModeratorResponse (..),
newCreateChannelModeratorResponse,
createChannelModeratorResponse_channelModerator,
createChannelModeratorResponse_channelArn,
createChannelModeratorResponse_httpStatus,
)
where
import Amazonka.Chime.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 CreateChannelModerator = CreateChannelModerator'
{
CreateChannelModerator -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
CreateChannelModerator -> Text
channelArn :: Prelude.Text,
CreateChannelModerator -> Text
channelModeratorArn :: Prelude.Text
}
deriving (CreateChannelModerator -> CreateChannelModerator -> Bool
(CreateChannelModerator -> CreateChannelModerator -> Bool)
-> (CreateChannelModerator -> CreateChannelModerator -> Bool)
-> Eq CreateChannelModerator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateChannelModerator -> CreateChannelModerator -> Bool
$c/= :: CreateChannelModerator -> CreateChannelModerator -> Bool
== :: CreateChannelModerator -> CreateChannelModerator -> Bool
$c== :: CreateChannelModerator -> CreateChannelModerator -> Bool
Prelude.Eq, ReadPrec [CreateChannelModerator]
ReadPrec CreateChannelModerator
Int -> ReadS CreateChannelModerator
ReadS [CreateChannelModerator]
(Int -> ReadS CreateChannelModerator)
-> ReadS [CreateChannelModerator]
-> ReadPrec CreateChannelModerator
-> ReadPrec [CreateChannelModerator]
-> Read CreateChannelModerator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateChannelModerator]
$creadListPrec :: ReadPrec [CreateChannelModerator]
readPrec :: ReadPrec CreateChannelModerator
$creadPrec :: ReadPrec CreateChannelModerator
readList :: ReadS [CreateChannelModerator]
$creadList :: ReadS [CreateChannelModerator]
readsPrec :: Int -> ReadS CreateChannelModerator
$creadsPrec :: Int -> ReadS CreateChannelModerator
Prelude.Read, Int -> CreateChannelModerator -> ShowS
[CreateChannelModerator] -> ShowS
CreateChannelModerator -> String
(Int -> CreateChannelModerator -> ShowS)
-> (CreateChannelModerator -> String)
-> ([CreateChannelModerator] -> ShowS)
-> Show CreateChannelModerator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateChannelModerator] -> ShowS
$cshowList :: [CreateChannelModerator] -> ShowS
show :: CreateChannelModerator -> String
$cshow :: CreateChannelModerator -> String
showsPrec :: Int -> CreateChannelModerator -> ShowS
$cshowsPrec :: Int -> CreateChannelModerator -> ShowS
Prelude.Show, (forall x. CreateChannelModerator -> Rep CreateChannelModerator x)
-> (forall x.
Rep CreateChannelModerator x -> CreateChannelModerator)
-> Generic CreateChannelModerator
forall x. Rep CreateChannelModerator x -> CreateChannelModerator
forall x. CreateChannelModerator -> Rep CreateChannelModerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateChannelModerator x -> CreateChannelModerator
$cfrom :: forall x. CreateChannelModerator -> Rep CreateChannelModerator x
Prelude.Generic)
newCreateChannelModerator ::
Prelude.Text ->
Prelude.Text ->
CreateChannelModerator
newCreateChannelModerator :: Text -> Text -> CreateChannelModerator
newCreateChannelModerator
Text
pChannelArn_
Text
pChannelModeratorArn_ =
CreateChannelModerator' :: Maybe Text -> Text -> Text -> CreateChannelModerator
CreateChannelModerator'
{ $sel:chimeBearer:CreateChannelModerator' :: Maybe Text
chimeBearer =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:CreateChannelModerator' :: Text
channelArn = Text
pChannelArn_,
$sel:channelModeratorArn:CreateChannelModerator' :: Text
channelModeratorArn = Text
pChannelModeratorArn_
}
createChannelModerator_chimeBearer :: Lens.Lens' CreateChannelModerator (Prelude.Maybe Prelude.Text)
createChannelModerator_chimeBearer :: (Maybe Text -> f (Maybe Text))
-> CreateChannelModerator -> f CreateChannelModerator
createChannelModerator_chimeBearer = (CreateChannelModerator -> Maybe Text)
-> (CreateChannelModerator -> Maybe Text -> CreateChannelModerator)
-> Lens
CreateChannelModerator
CreateChannelModerator
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelModerator' {Maybe Text
chimeBearer :: Maybe Text
$sel:chimeBearer:CreateChannelModerator' :: CreateChannelModerator -> Maybe Text
chimeBearer} -> Maybe Text
chimeBearer) (\s :: CreateChannelModerator
s@CreateChannelModerator' {} Maybe Text
a -> CreateChannelModerator
s {$sel:chimeBearer:CreateChannelModerator' :: Maybe Text
chimeBearer = Maybe Text
a} :: CreateChannelModerator)
createChannelModerator_channelArn :: Lens.Lens' CreateChannelModerator Prelude.Text
createChannelModerator_channelArn :: (Text -> f Text)
-> CreateChannelModerator -> f CreateChannelModerator
createChannelModerator_channelArn = (CreateChannelModerator -> Text)
-> (CreateChannelModerator -> Text -> CreateChannelModerator)
-> Lens CreateChannelModerator CreateChannelModerator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelModerator' {Text
channelArn :: Text
$sel:channelArn:CreateChannelModerator' :: CreateChannelModerator -> Text
channelArn} -> Text
channelArn) (\s :: CreateChannelModerator
s@CreateChannelModerator' {} Text
a -> CreateChannelModerator
s {$sel:channelArn:CreateChannelModerator' :: Text
channelArn = Text
a} :: CreateChannelModerator)
createChannelModerator_channelModeratorArn :: Lens.Lens' CreateChannelModerator Prelude.Text
createChannelModerator_channelModeratorArn :: (Text -> f Text)
-> CreateChannelModerator -> f CreateChannelModerator
createChannelModerator_channelModeratorArn = (CreateChannelModerator -> Text)
-> (CreateChannelModerator -> Text -> CreateChannelModerator)
-> Lens CreateChannelModerator CreateChannelModerator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelModerator' {Text
channelModeratorArn :: Text
$sel:channelModeratorArn:CreateChannelModerator' :: CreateChannelModerator -> Text
channelModeratorArn} -> Text
channelModeratorArn) (\s :: CreateChannelModerator
s@CreateChannelModerator' {} Text
a -> CreateChannelModerator
s {$sel:channelModeratorArn:CreateChannelModerator' :: Text
channelModeratorArn = Text
a} :: CreateChannelModerator)
instance Core.AWSRequest CreateChannelModerator where
type
AWSResponse CreateChannelModerator =
CreateChannelModeratorResponse
request :: CreateChannelModerator -> Request CreateChannelModerator
request = Service -> CreateChannelModerator -> Request CreateChannelModerator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateChannelModerator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateChannelModerator)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateChannelModerator))
-> Logger
-> Service
-> Proxy CreateChannelModerator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateChannelModerator)))
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 Identity
-> Maybe Text -> Int -> CreateChannelModeratorResponse
CreateChannelModeratorResponse'
(Maybe Identity
-> Maybe Text -> Int -> CreateChannelModeratorResponse)
-> Either String (Maybe Identity)
-> Either
String (Maybe Text -> Int -> CreateChannelModeratorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Identity)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChannelModerator")
Either String (Maybe Text -> Int -> CreateChannelModeratorResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateChannelModeratorResponse)
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 -> CreateChannelModeratorResponse)
-> Either String Int
-> Either String CreateChannelModeratorResponse
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 CreateChannelModerator
instance Prelude.NFData CreateChannelModerator
instance Core.ToHeaders CreateChannelModerator where
toHeaders :: CreateChannelModerator -> ResponseHeaders
toHeaders CreateChannelModerator' {Maybe Text
Text
channelModeratorArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:channelModeratorArn:CreateChannelModerator' :: CreateChannelModerator -> Text
$sel:channelArn:CreateChannelModerator' :: CreateChannelModerator -> Text
$sel:chimeBearer:CreateChannelModerator' :: CreateChannelModerator -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-chime-bearer" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
chimeBearer]
instance Core.ToJSON CreateChannelModerator where
toJSON :: CreateChannelModerator -> Value
toJSON CreateChannelModerator' {Maybe Text
Text
channelModeratorArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:channelModeratorArn:CreateChannelModerator' :: CreateChannelModerator -> Text
$sel:channelArn:CreateChannelModerator' :: CreateChannelModerator -> Text
$sel:chimeBearer:CreateChannelModerator' :: CreateChannelModerator -> Maybe Text
..} =
[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
"ChannelModeratorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
channelModeratorArn)
]
)
instance Core.ToPath CreateChannelModerator where
toPath :: CreateChannelModerator -> ByteString
toPath CreateChannelModerator' {Maybe Text
Text
channelModeratorArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:channelModeratorArn:CreateChannelModerator' :: CreateChannelModerator -> Text
$sel:channelArn:CreateChannelModerator' :: CreateChannelModerator -> Text
$sel:chimeBearer:CreateChannelModerator' :: CreateChannelModerator -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelArn, ByteString
"/moderators"]
instance Core.ToQuery CreateChannelModerator where
toQuery :: CreateChannelModerator -> QueryString
toQuery = QueryString -> CreateChannelModerator -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateChannelModeratorResponse = CreateChannelModeratorResponse'
{
CreateChannelModeratorResponse -> Maybe Identity
channelModerator :: Prelude.Maybe Identity,
CreateChannelModeratorResponse -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
CreateChannelModeratorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateChannelModeratorResponse
-> CreateChannelModeratorResponse -> Bool
(CreateChannelModeratorResponse
-> CreateChannelModeratorResponse -> Bool)
-> (CreateChannelModeratorResponse
-> CreateChannelModeratorResponse -> Bool)
-> Eq CreateChannelModeratorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateChannelModeratorResponse
-> CreateChannelModeratorResponse -> Bool
$c/= :: CreateChannelModeratorResponse
-> CreateChannelModeratorResponse -> Bool
== :: CreateChannelModeratorResponse
-> CreateChannelModeratorResponse -> Bool
$c== :: CreateChannelModeratorResponse
-> CreateChannelModeratorResponse -> Bool
Prelude.Eq, Int -> CreateChannelModeratorResponse -> ShowS
[CreateChannelModeratorResponse] -> ShowS
CreateChannelModeratorResponse -> String
(Int -> CreateChannelModeratorResponse -> ShowS)
-> (CreateChannelModeratorResponse -> String)
-> ([CreateChannelModeratorResponse] -> ShowS)
-> Show CreateChannelModeratorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateChannelModeratorResponse] -> ShowS
$cshowList :: [CreateChannelModeratorResponse] -> ShowS
show :: CreateChannelModeratorResponse -> String
$cshow :: CreateChannelModeratorResponse -> String
showsPrec :: Int -> CreateChannelModeratorResponse -> ShowS
$cshowsPrec :: Int -> CreateChannelModeratorResponse -> ShowS
Prelude.Show, (forall x.
CreateChannelModeratorResponse
-> Rep CreateChannelModeratorResponse x)
-> (forall x.
Rep CreateChannelModeratorResponse x
-> CreateChannelModeratorResponse)
-> Generic CreateChannelModeratorResponse
forall x.
Rep CreateChannelModeratorResponse x
-> CreateChannelModeratorResponse
forall x.
CreateChannelModeratorResponse
-> Rep CreateChannelModeratorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateChannelModeratorResponse x
-> CreateChannelModeratorResponse
$cfrom :: forall x.
CreateChannelModeratorResponse
-> Rep CreateChannelModeratorResponse x
Prelude.Generic)
newCreateChannelModeratorResponse ::
Prelude.Int ->
CreateChannelModeratorResponse
newCreateChannelModeratorResponse :: Int -> CreateChannelModeratorResponse
newCreateChannelModeratorResponse Int
pHttpStatus_ =
CreateChannelModeratorResponse' :: Maybe Identity
-> Maybe Text -> Int -> CreateChannelModeratorResponse
CreateChannelModeratorResponse'
{ $sel:channelModerator:CreateChannelModeratorResponse' :: Maybe Identity
channelModerator =
Maybe Identity
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:CreateChannelModeratorResponse' :: Maybe Text
channelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateChannelModeratorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createChannelModeratorResponse_channelModerator :: Lens.Lens' CreateChannelModeratorResponse (Prelude.Maybe Identity)
createChannelModeratorResponse_channelModerator :: (Maybe Identity -> f (Maybe Identity))
-> CreateChannelModeratorResponse
-> f CreateChannelModeratorResponse
createChannelModeratorResponse_channelModerator = (CreateChannelModeratorResponse -> Maybe Identity)
-> (CreateChannelModeratorResponse
-> Maybe Identity -> CreateChannelModeratorResponse)
-> Lens
CreateChannelModeratorResponse
CreateChannelModeratorResponse
(Maybe Identity)
(Maybe Identity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelModeratorResponse' {Maybe Identity
channelModerator :: Maybe Identity
$sel:channelModerator:CreateChannelModeratorResponse' :: CreateChannelModeratorResponse -> Maybe Identity
channelModerator} -> Maybe Identity
channelModerator) (\s :: CreateChannelModeratorResponse
s@CreateChannelModeratorResponse' {} Maybe Identity
a -> CreateChannelModeratorResponse
s {$sel:channelModerator:CreateChannelModeratorResponse' :: Maybe Identity
channelModerator = Maybe Identity
a} :: CreateChannelModeratorResponse)
createChannelModeratorResponse_channelArn :: Lens.Lens' CreateChannelModeratorResponse (Prelude.Maybe Prelude.Text)
createChannelModeratorResponse_channelArn :: (Maybe Text -> f (Maybe Text))
-> CreateChannelModeratorResponse
-> f CreateChannelModeratorResponse
createChannelModeratorResponse_channelArn = (CreateChannelModeratorResponse -> Maybe Text)
-> (CreateChannelModeratorResponse
-> Maybe Text -> CreateChannelModeratorResponse)
-> Lens
CreateChannelModeratorResponse
CreateChannelModeratorResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelModeratorResponse' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:CreateChannelModeratorResponse' :: CreateChannelModeratorResponse -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: CreateChannelModeratorResponse
s@CreateChannelModeratorResponse' {} Maybe Text
a -> CreateChannelModeratorResponse
s {$sel:channelArn:CreateChannelModeratorResponse' :: Maybe Text
channelArn = Maybe Text
a} :: CreateChannelModeratorResponse)
createChannelModeratorResponse_httpStatus :: Lens.Lens' CreateChannelModeratorResponse Prelude.Int
createChannelModeratorResponse_httpStatus :: (Int -> f Int)
-> CreateChannelModeratorResponse
-> f CreateChannelModeratorResponse
createChannelModeratorResponse_httpStatus = (CreateChannelModeratorResponse -> Int)
-> (CreateChannelModeratorResponse
-> Int -> CreateChannelModeratorResponse)
-> Lens
CreateChannelModeratorResponse
CreateChannelModeratorResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelModeratorResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateChannelModeratorResponse' :: CreateChannelModeratorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateChannelModeratorResponse
s@CreateChannelModeratorResponse' {} Int
a -> CreateChannelModeratorResponse
s {$sel:httpStatus:CreateChannelModeratorResponse' :: Int
httpStatus = Int
a} :: CreateChannelModeratorResponse)
instance
Prelude.NFData
CreateChannelModeratorResponse