{-# 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.CreateChannelMembership
(
CreateChannelMembership (..),
newCreateChannelMembership,
createChannelMembership_chimeBearer,
createChannelMembership_channelArn,
createChannelMembership_memberArn,
createChannelMembership_type,
CreateChannelMembershipResponse (..),
newCreateChannelMembershipResponse,
createChannelMembershipResponse_channelArn,
createChannelMembershipResponse_member,
createChannelMembershipResponse_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 CreateChannelMembership = CreateChannelMembership'
{
CreateChannelMembership -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
CreateChannelMembership -> Text
channelArn :: Prelude.Text,
CreateChannelMembership -> Text
memberArn :: Prelude.Text,
CreateChannelMembership -> ChannelMembershipType
type' :: ChannelMembershipType
}
deriving (CreateChannelMembership -> CreateChannelMembership -> Bool
(CreateChannelMembership -> CreateChannelMembership -> Bool)
-> (CreateChannelMembership -> CreateChannelMembership -> Bool)
-> Eq CreateChannelMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateChannelMembership -> CreateChannelMembership -> Bool
$c/= :: CreateChannelMembership -> CreateChannelMembership -> Bool
== :: CreateChannelMembership -> CreateChannelMembership -> Bool
$c== :: CreateChannelMembership -> CreateChannelMembership -> Bool
Prelude.Eq, ReadPrec [CreateChannelMembership]
ReadPrec CreateChannelMembership
Int -> ReadS CreateChannelMembership
ReadS [CreateChannelMembership]
(Int -> ReadS CreateChannelMembership)
-> ReadS [CreateChannelMembership]
-> ReadPrec CreateChannelMembership
-> ReadPrec [CreateChannelMembership]
-> Read CreateChannelMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateChannelMembership]
$creadListPrec :: ReadPrec [CreateChannelMembership]
readPrec :: ReadPrec CreateChannelMembership
$creadPrec :: ReadPrec CreateChannelMembership
readList :: ReadS [CreateChannelMembership]
$creadList :: ReadS [CreateChannelMembership]
readsPrec :: Int -> ReadS CreateChannelMembership
$creadsPrec :: Int -> ReadS CreateChannelMembership
Prelude.Read, Int -> CreateChannelMembership -> ShowS
[CreateChannelMembership] -> ShowS
CreateChannelMembership -> String
(Int -> CreateChannelMembership -> ShowS)
-> (CreateChannelMembership -> String)
-> ([CreateChannelMembership] -> ShowS)
-> Show CreateChannelMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateChannelMembership] -> ShowS
$cshowList :: [CreateChannelMembership] -> ShowS
show :: CreateChannelMembership -> String
$cshow :: CreateChannelMembership -> String
showsPrec :: Int -> CreateChannelMembership -> ShowS
$cshowsPrec :: Int -> CreateChannelMembership -> ShowS
Prelude.Show, (forall x.
CreateChannelMembership -> Rep CreateChannelMembership x)
-> (forall x.
Rep CreateChannelMembership x -> CreateChannelMembership)
-> Generic CreateChannelMembership
forall x. Rep CreateChannelMembership x -> CreateChannelMembership
forall x. CreateChannelMembership -> Rep CreateChannelMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateChannelMembership x -> CreateChannelMembership
$cfrom :: forall x. CreateChannelMembership -> Rep CreateChannelMembership x
Prelude.Generic)
newCreateChannelMembership ::
Prelude.Text ->
Prelude.Text ->
ChannelMembershipType ->
CreateChannelMembership
newCreateChannelMembership :: Text -> Text -> ChannelMembershipType -> CreateChannelMembership
newCreateChannelMembership
Text
pChannelArn_
Text
pMemberArn_
ChannelMembershipType
pType_ =
CreateChannelMembership' :: Maybe Text
-> Text -> Text -> ChannelMembershipType -> CreateChannelMembership
CreateChannelMembership'
{ $sel:chimeBearer:CreateChannelMembership' :: Maybe Text
chimeBearer =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:CreateChannelMembership' :: Text
channelArn = Text
pChannelArn_,
$sel:memberArn:CreateChannelMembership' :: Text
memberArn = Text
pMemberArn_,
$sel:type':CreateChannelMembership' :: ChannelMembershipType
type' = ChannelMembershipType
pType_
}
createChannelMembership_chimeBearer :: Lens.Lens' CreateChannelMembership (Prelude.Maybe Prelude.Text)
createChannelMembership_chimeBearer :: (Maybe Text -> f (Maybe Text))
-> CreateChannelMembership -> f CreateChannelMembership
createChannelMembership_chimeBearer = (CreateChannelMembership -> Maybe Text)
-> (CreateChannelMembership
-> Maybe Text -> CreateChannelMembership)
-> Lens
CreateChannelMembership
CreateChannelMembership
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelMembership' {Maybe Text
chimeBearer :: Maybe Text
$sel:chimeBearer:CreateChannelMembership' :: CreateChannelMembership -> Maybe Text
chimeBearer} -> Maybe Text
chimeBearer) (\s :: CreateChannelMembership
s@CreateChannelMembership' {} Maybe Text
a -> CreateChannelMembership
s {$sel:chimeBearer:CreateChannelMembership' :: Maybe Text
chimeBearer = Maybe Text
a} :: CreateChannelMembership)
createChannelMembership_channelArn :: Lens.Lens' CreateChannelMembership Prelude.Text
createChannelMembership_channelArn :: (Text -> f Text)
-> CreateChannelMembership -> f CreateChannelMembership
createChannelMembership_channelArn = (CreateChannelMembership -> Text)
-> (CreateChannelMembership -> Text -> CreateChannelMembership)
-> Lens CreateChannelMembership CreateChannelMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelMembership' {Text
channelArn :: Text
$sel:channelArn:CreateChannelMembership' :: CreateChannelMembership -> Text
channelArn} -> Text
channelArn) (\s :: CreateChannelMembership
s@CreateChannelMembership' {} Text
a -> CreateChannelMembership
s {$sel:channelArn:CreateChannelMembership' :: Text
channelArn = Text
a} :: CreateChannelMembership)
createChannelMembership_memberArn :: Lens.Lens' CreateChannelMembership Prelude.Text
createChannelMembership_memberArn :: (Text -> f Text)
-> CreateChannelMembership -> f CreateChannelMembership
createChannelMembership_memberArn = (CreateChannelMembership -> Text)
-> (CreateChannelMembership -> Text -> CreateChannelMembership)
-> Lens CreateChannelMembership CreateChannelMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelMembership' {Text
memberArn :: Text
$sel:memberArn:CreateChannelMembership' :: CreateChannelMembership -> Text
memberArn} -> Text
memberArn) (\s :: CreateChannelMembership
s@CreateChannelMembership' {} Text
a -> CreateChannelMembership
s {$sel:memberArn:CreateChannelMembership' :: Text
memberArn = Text
a} :: CreateChannelMembership)
createChannelMembership_type :: Lens.Lens' CreateChannelMembership ChannelMembershipType
createChannelMembership_type :: (ChannelMembershipType -> f ChannelMembershipType)
-> CreateChannelMembership -> f CreateChannelMembership
createChannelMembership_type = (CreateChannelMembership -> ChannelMembershipType)
-> (CreateChannelMembership
-> ChannelMembershipType -> CreateChannelMembership)
-> Lens
CreateChannelMembership
CreateChannelMembership
ChannelMembershipType
ChannelMembershipType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelMembership' {ChannelMembershipType
type' :: ChannelMembershipType
$sel:type':CreateChannelMembership' :: CreateChannelMembership -> ChannelMembershipType
type'} -> ChannelMembershipType
type') (\s :: CreateChannelMembership
s@CreateChannelMembership' {} ChannelMembershipType
a -> CreateChannelMembership
s {$sel:type':CreateChannelMembership' :: ChannelMembershipType
type' = ChannelMembershipType
a} :: CreateChannelMembership)
instance Core.AWSRequest CreateChannelMembership where
type
AWSResponse CreateChannelMembership =
CreateChannelMembershipResponse
request :: CreateChannelMembership -> Request CreateChannelMembership
request = Service
-> CreateChannelMembership -> Request CreateChannelMembership
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateChannelMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateChannelMembership)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateChannelMembership))
-> Logger
-> Service
-> Proxy CreateChannelMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateChannelMembership)))
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 Identity -> Int -> CreateChannelMembershipResponse
CreateChannelMembershipResponse'
(Maybe Text
-> Maybe Identity -> Int -> CreateChannelMembershipResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Identity -> Int -> CreateChannelMembershipResponse)
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
"ChannelArn")
Either
String (Maybe Identity -> Int -> CreateChannelMembershipResponse)
-> Either String (Maybe Identity)
-> Either String (Int -> CreateChannelMembershipResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Member")
Either String (Int -> CreateChannelMembershipResponse)
-> Either String Int
-> Either String CreateChannelMembershipResponse
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 CreateChannelMembership
instance Prelude.NFData CreateChannelMembership
instance Core.ToHeaders CreateChannelMembership where
toHeaders :: CreateChannelMembership -> ResponseHeaders
toHeaders CreateChannelMembership' {Maybe Text
Text
ChannelMembershipType
type' :: ChannelMembershipType
memberArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:type':CreateChannelMembership' :: CreateChannelMembership -> ChannelMembershipType
$sel:memberArn:CreateChannelMembership' :: CreateChannelMembership -> Text
$sel:channelArn:CreateChannelMembership' :: CreateChannelMembership -> Text
$sel:chimeBearer:CreateChannelMembership' :: CreateChannelMembership -> 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 CreateChannelMembership where
toJSON :: CreateChannelMembership -> Value
toJSON CreateChannelMembership' {Maybe Text
Text
ChannelMembershipType
type' :: ChannelMembershipType
memberArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:type':CreateChannelMembership' :: CreateChannelMembership -> ChannelMembershipType
$sel:memberArn:CreateChannelMembership' :: CreateChannelMembership -> Text
$sel:channelArn:CreateChannelMembership' :: CreateChannelMembership -> Text
$sel:chimeBearer:CreateChannelMembership' :: CreateChannelMembership -> 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
"MemberArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
memberArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> ChannelMembershipType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChannelMembershipType
type')
]
)
instance Core.ToPath CreateChannelMembership where
toPath :: CreateChannelMembership -> ByteString
toPath CreateChannelMembership' {Maybe Text
Text
ChannelMembershipType
type' :: ChannelMembershipType
memberArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:type':CreateChannelMembership' :: CreateChannelMembership -> ChannelMembershipType
$sel:memberArn:CreateChannelMembership' :: CreateChannelMembership -> Text
$sel:channelArn:CreateChannelMembership' :: CreateChannelMembership -> Text
$sel:chimeBearer:CreateChannelMembership' :: CreateChannelMembership -> 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
"/memberships"]
instance Core.ToQuery CreateChannelMembership where
toQuery :: CreateChannelMembership -> QueryString
toQuery = QueryString -> CreateChannelMembership -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateChannelMembershipResponse = CreateChannelMembershipResponse'
{
CreateChannelMembershipResponse -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
CreateChannelMembershipResponse -> Maybe Identity
member :: Prelude.Maybe Identity,
CreateChannelMembershipResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateChannelMembershipResponse
-> CreateChannelMembershipResponse -> Bool
(CreateChannelMembershipResponse
-> CreateChannelMembershipResponse -> Bool)
-> (CreateChannelMembershipResponse
-> CreateChannelMembershipResponse -> Bool)
-> Eq CreateChannelMembershipResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateChannelMembershipResponse
-> CreateChannelMembershipResponse -> Bool
$c/= :: CreateChannelMembershipResponse
-> CreateChannelMembershipResponse -> Bool
== :: CreateChannelMembershipResponse
-> CreateChannelMembershipResponse -> Bool
$c== :: CreateChannelMembershipResponse
-> CreateChannelMembershipResponse -> Bool
Prelude.Eq, Int -> CreateChannelMembershipResponse -> ShowS
[CreateChannelMembershipResponse] -> ShowS
CreateChannelMembershipResponse -> String
(Int -> CreateChannelMembershipResponse -> ShowS)
-> (CreateChannelMembershipResponse -> String)
-> ([CreateChannelMembershipResponse] -> ShowS)
-> Show CreateChannelMembershipResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateChannelMembershipResponse] -> ShowS
$cshowList :: [CreateChannelMembershipResponse] -> ShowS
show :: CreateChannelMembershipResponse -> String
$cshow :: CreateChannelMembershipResponse -> String
showsPrec :: Int -> CreateChannelMembershipResponse -> ShowS
$cshowsPrec :: Int -> CreateChannelMembershipResponse -> ShowS
Prelude.Show, (forall x.
CreateChannelMembershipResponse
-> Rep CreateChannelMembershipResponse x)
-> (forall x.
Rep CreateChannelMembershipResponse x
-> CreateChannelMembershipResponse)
-> Generic CreateChannelMembershipResponse
forall x.
Rep CreateChannelMembershipResponse x
-> CreateChannelMembershipResponse
forall x.
CreateChannelMembershipResponse
-> Rep CreateChannelMembershipResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateChannelMembershipResponse x
-> CreateChannelMembershipResponse
$cfrom :: forall x.
CreateChannelMembershipResponse
-> Rep CreateChannelMembershipResponse x
Prelude.Generic)
newCreateChannelMembershipResponse ::
Prelude.Int ->
CreateChannelMembershipResponse
newCreateChannelMembershipResponse :: Int -> CreateChannelMembershipResponse
newCreateChannelMembershipResponse Int
pHttpStatus_ =
CreateChannelMembershipResponse' :: Maybe Text
-> Maybe Identity -> Int -> CreateChannelMembershipResponse
CreateChannelMembershipResponse'
{ $sel:channelArn:CreateChannelMembershipResponse' :: Maybe Text
channelArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:member:CreateChannelMembershipResponse' :: Maybe Identity
member = Maybe Identity
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateChannelMembershipResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createChannelMembershipResponse_channelArn :: Lens.Lens' CreateChannelMembershipResponse (Prelude.Maybe Prelude.Text)
createChannelMembershipResponse_channelArn :: (Maybe Text -> f (Maybe Text))
-> CreateChannelMembershipResponse
-> f CreateChannelMembershipResponse
createChannelMembershipResponse_channelArn = (CreateChannelMembershipResponse -> Maybe Text)
-> (CreateChannelMembershipResponse
-> Maybe Text -> CreateChannelMembershipResponse)
-> Lens
CreateChannelMembershipResponse
CreateChannelMembershipResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelMembershipResponse' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:CreateChannelMembershipResponse' :: CreateChannelMembershipResponse -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: CreateChannelMembershipResponse
s@CreateChannelMembershipResponse' {} Maybe Text
a -> CreateChannelMembershipResponse
s {$sel:channelArn:CreateChannelMembershipResponse' :: Maybe Text
channelArn = Maybe Text
a} :: CreateChannelMembershipResponse)
createChannelMembershipResponse_member :: Lens.Lens' CreateChannelMembershipResponse (Prelude.Maybe Identity)
createChannelMembershipResponse_member :: (Maybe Identity -> f (Maybe Identity))
-> CreateChannelMembershipResponse
-> f CreateChannelMembershipResponse
createChannelMembershipResponse_member = (CreateChannelMembershipResponse -> Maybe Identity)
-> (CreateChannelMembershipResponse
-> Maybe Identity -> CreateChannelMembershipResponse)
-> Lens
CreateChannelMembershipResponse
CreateChannelMembershipResponse
(Maybe Identity)
(Maybe Identity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelMembershipResponse' {Maybe Identity
member :: Maybe Identity
$sel:member:CreateChannelMembershipResponse' :: CreateChannelMembershipResponse -> Maybe Identity
member} -> Maybe Identity
member) (\s :: CreateChannelMembershipResponse
s@CreateChannelMembershipResponse' {} Maybe Identity
a -> CreateChannelMembershipResponse
s {$sel:member:CreateChannelMembershipResponse' :: Maybe Identity
member = Maybe Identity
a} :: CreateChannelMembershipResponse)
createChannelMembershipResponse_httpStatus :: Lens.Lens' CreateChannelMembershipResponse Prelude.Int
createChannelMembershipResponse_httpStatus :: (Int -> f Int)
-> CreateChannelMembershipResponse
-> f CreateChannelMembershipResponse
createChannelMembershipResponse_httpStatus = (CreateChannelMembershipResponse -> Int)
-> (CreateChannelMembershipResponse
-> Int -> CreateChannelMembershipResponse)
-> Lens
CreateChannelMembershipResponse
CreateChannelMembershipResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelMembershipResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateChannelMembershipResponse' :: CreateChannelMembershipResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateChannelMembershipResponse
s@CreateChannelMembershipResponse' {} Int
a -> CreateChannelMembershipResponse
s {$sel:httpStatus:CreateChannelMembershipResponse' :: Int
httpStatus = Int
a} :: CreateChannelMembershipResponse)
instance
Prelude.NFData
CreateChannelMembershipResponse