{-# 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.BatchCreateRoomMembership
(
BatchCreateRoomMembership (..),
newBatchCreateRoomMembership,
batchCreateRoomMembership_accountId,
batchCreateRoomMembership_roomId,
batchCreateRoomMembership_membershipItemList,
BatchCreateRoomMembershipResponse (..),
newBatchCreateRoomMembershipResponse,
batchCreateRoomMembershipResponse_errors,
batchCreateRoomMembershipResponse_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 BatchCreateRoomMembership = BatchCreateRoomMembership'
{
BatchCreateRoomMembership -> Text
accountId :: Prelude.Text,
BatchCreateRoomMembership -> Text
roomId :: Prelude.Text,
BatchCreateRoomMembership -> [MembershipItem]
membershipItemList :: [MembershipItem]
}
deriving (BatchCreateRoomMembership -> BatchCreateRoomMembership -> Bool
(BatchCreateRoomMembership -> BatchCreateRoomMembership -> Bool)
-> (BatchCreateRoomMembership -> BatchCreateRoomMembership -> Bool)
-> Eq BatchCreateRoomMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateRoomMembership -> BatchCreateRoomMembership -> Bool
$c/= :: BatchCreateRoomMembership -> BatchCreateRoomMembership -> Bool
== :: BatchCreateRoomMembership -> BatchCreateRoomMembership -> Bool
$c== :: BatchCreateRoomMembership -> BatchCreateRoomMembership -> Bool
Prelude.Eq, ReadPrec [BatchCreateRoomMembership]
ReadPrec BatchCreateRoomMembership
Int -> ReadS BatchCreateRoomMembership
ReadS [BatchCreateRoomMembership]
(Int -> ReadS BatchCreateRoomMembership)
-> ReadS [BatchCreateRoomMembership]
-> ReadPrec BatchCreateRoomMembership
-> ReadPrec [BatchCreateRoomMembership]
-> Read BatchCreateRoomMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateRoomMembership]
$creadListPrec :: ReadPrec [BatchCreateRoomMembership]
readPrec :: ReadPrec BatchCreateRoomMembership
$creadPrec :: ReadPrec BatchCreateRoomMembership
readList :: ReadS [BatchCreateRoomMembership]
$creadList :: ReadS [BatchCreateRoomMembership]
readsPrec :: Int -> ReadS BatchCreateRoomMembership
$creadsPrec :: Int -> ReadS BatchCreateRoomMembership
Prelude.Read, Int -> BatchCreateRoomMembership -> ShowS
[BatchCreateRoomMembership] -> ShowS
BatchCreateRoomMembership -> String
(Int -> BatchCreateRoomMembership -> ShowS)
-> (BatchCreateRoomMembership -> String)
-> ([BatchCreateRoomMembership] -> ShowS)
-> Show BatchCreateRoomMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateRoomMembership] -> ShowS
$cshowList :: [BatchCreateRoomMembership] -> ShowS
show :: BatchCreateRoomMembership -> String
$cshow :: BatchCreateRoomMembership -> String
showsPrec :: Int -> BatchCreateRoomMembership -> ShowS
$cshowsPrec :: Int -> BatchCreateRoomMembership -> ShowS
Prelude.Show, (forall x.
BatchCreateRoomMembership -> Rep BatchCreateRoomMembership x)
-> (forall x.
Rep BatchCreateRoomMembership x -> BatchCreateRoomMembership)
-> Generic BatchCreateRoomMembership
forall x.
Rep BatchCreateRoomMembership x -> BatchCreateRoomMembership
forall x.
BatchCreateRoomMembership -> Rep BatchCreateRoomMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateRoomMembership x -> BatchCreateRoomMembership
$cfrom :: forall x.
BatchCreateRoomMembership -> Rep BatchCreateRoomMembership x
Prelude.Generic)
newBatchCreateRoomMembership ::
Prelude.Text ->
Prelude.Text ->
BatchCreateRoomMembership
newBatchCreateRoomMembership :: Text -> Text -> BatchCreateRoomMembership
newBatchCreateRoomMembership Text
pAccountId_ Text
pRoomId_ =
BatchCreateRoomMembership' :: Text -> Text -> [MembershipItem] -> BatchCreateRoomMembership
BatchCreateRoomMembership'
{ $sel:accountId:BatchCreateRoomMembership' :: Text
accountId = Text
pAccountId_,
$sel:roomId:BatchCreateRoomMembership' :: Text
roomId = Text
pRoomId_,
$sel:membershipItemList:BatchCreateRoomMembership' :: [MembershipItem]
membershipItemList = [MembershipItem]
forall a. Monoid a => a
Prelude.mempty
}
batchCreateRoomMembership_accountId :: Lens.Lens' BatchCreateRoomMembership Prelude.Text
batchCreateRoomMembership_accountId :: (Text -> f Text)
-> BatchCreateRoomMembership -> f BatchCreateRoomMembership
batchCreateRoomMembership_accountId = (BatchCreateRoomMembership -> Text)
-> (BatchCreateRoomMembership -> Text -> BatchCreateRoomMembership)
-> Lens
BatchCreateRoomMembership BatchCreateRoomMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateRoomMembership' {Text
accountId :: Text
$sel:accountId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
accountId} -> Text
accountId) (\s :: BatchCreateRoomMembership
s@BatchCreateRoomMembership' {} Text
a -> BatchCreateRoomMembership
s {$sel:accountId:BatchCreateRoomMembership' :: Text
accountId = Text
a} :: BatchCreateRoomMembership)
batchCreateRoomMembership_roomId :: Lens.Lens' BatchCreateRoomMembership Prelude.Text
batchCreateRoomMembership_roomId :: (Text -> f Text)
-> BatchCreateRoomMembership -> f BatchCreateRoomMembership
batchCreateRoomMembership_roomId = (BatchCreateRoomMembership -> Text)
-> (BatchCreateRoomMembership -> Text -> BatchCreateRoomMembership)
-> Lens
BatchCreateRoomMembership BatchCreateRoomMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateRoomMembership' {Text
roomId :: Text
$sel:roomId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
roomId} -> Text
roomId) (\s :: BatchCreateRoomMembership
s@BatchCreateRoomMembership' {} Text
a -> BatchCreateRoomMembership
s {$sel:roomId:BatchCreateRoomMembership' :: Text
roomId = Text
a} :: BatchCreateRoomMembership)
batchCreateRoomMembership_membershipItemList :: Lens.Lens' BatchCreateRoomMembership [MembershipItem]
batchCreateRoomMembership_membershipItemList :: ([MembershipItem] -> f [MembershipItem])
-> BatchCreateRoomMembership -> f BatchCreateRoomMembership
batchCreateRoomMembership_membershipItemList = (BatchCreateRoomMembership -> [MembershipItem])
-> (BatchCreateRoomMembership
-> [MembershipItem] -> BatchCreateRoomMembership)
-> Lens
BatchCreateRoomMembership
BatchCreateRoomMembership
[MembershipItem]
[MembershipItem]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateRoomMembership' {[MembershipItem]
membershipItemList :: [MembershipItem]
$sel:membershipItemList:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> [MembershipItem]
membershipItemList} -> [MembershipItem]
membershipItemList) (\s :: BatchCreateRoomMembership
s@BatchCreateRoomMembership' {} [MembershipItem]
a -> BatchCreateRoomMembership
s {$sel:membershipItemList:BatchCreateRoomMembership' :: [MembershipItem]
membershipItemList = [MembershipItem]
a} :: BatchCreateRoomMembership) (([MembershipItem] -> f [MembershipItem])
-> BatchCreateRoomMembership -> f BatchCreateRoomMembership)
-> (([MembershipItem] -> f [MembershipItem])
-> [MembershipItem] -> f [MembershipItem])
-> ([MembershipItem] -> f [MembershipItem])
-> BatchCreateRoomMembership
-> f BatchCreateRoomMembership
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MembershipItem] -> f [MembershipItem])
-> [MembershipItem] -> f [MembershipItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchCreateRoomMembership where
type
AWSResponse BatchCreateRoomMembership =
BatchCreateRoomMembershipResponse
request :: BatchCreateRoomMembership -> Request BatchCreateRoomMembership
request = Service
-> BatchCreateRoomMembership -> Request BatchCreateRoomMembership
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchCreateRoomMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateRoomMembership)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchCreateRoomMembership))
-> Logger
-> Service
-> Proxy BatchCreateRoomMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateRoomMembership)))
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 [MemberError] -> Int -> BatchCreateRoomMembershipResponse
BatchCreateRoomMembershipResponse'
(Maybe [MemberError] -> Int -> BatchCreateRoomMembershipResponse)
-> Either String (Maybe [MemberError])
-> Either String (Int -> BatchCreateRoomMembershipResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [MemberError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Errors" Either String (Maybe (Maybe [MemberError]))
-> Maybe [MemberError] -> Either String (Maybe [MemberError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MemberError]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchCreateRoomMembershipResponse)
-> Either String Int
-> Either String BatchCreateRoomMembershipResponse
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 BatchCreateRoomMembership
instance Prelude.NFData BatchCreateRoomMembership
instance Core.ToHeaders BatchCreateRoomMembership where
toHeaders :: BatchCreateRoomMembership -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchCreateRoomMembership -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON BatchCreateRoomMembership where
toJSON :: BatchCreateRoomMembership -> Value
toJSON BatchCreateRoomMembership' {[MembershipItem]
Text
membershipItemList :: [MembershipItem]
roomId :: Text
accountId :: Text
$sel:membershipItemList:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> [MembershipItem]
$sel:roomId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
$sel:accountId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> 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
"MembershipItemList" Text -> [MembershipItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [MembershipItem]
membershipItemList)
]
)
instance Core.ToPath BatchCreateRoomMembership where
toPath :: BatchCreateRoomMembership -> ByteString
toPath BatchCreateRoomMembership' {[MembershipItem]
Text
membershipItemList :: [MembershipItem]
roomId :: Text
accountId :: Text
$sel:membershipItemList:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> [MembershipItem]
$sel:roomId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
$sel:accountId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
ByteString
"/rooms/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
roomId,
ByteString
"/memberships"
]
instance Core.ToQuery BatchCreateRoomMembership where
toQuery :: BatchCreateRoomMembership -> QueryString
toQuery =
QueryString -> BatchCreateRoomMembership -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=batch-create"])
data BatchCreateRoomMembershipResponse = BatchCreateRoomMembershipResponse'
{
BatchCreateRoomMembershipResponse -> Maybe [MemberError]
errors :: Prelude.Maybe [MemberError],
BatchCreateRoomMembershipResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchCreateRoomMembershipResponse
-> BatchCreateRoomMembershipResponse -> Bool
(BatchCreateRoomMembershipResponse
-> BatchCreateRoomMembershipResponse -> Bool)
-> (BatchCreateRoomMembershipResponse
-> BatchCreateRoomMembershipResponse -> Bool)
-> Eq BatchCreateRoomMembershipResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateRoomMembershipResponse
-> BatchCreateRoomMembershipResponse -> Bool
$c/= :: BatchCreateRoomMembershipResponse
-> BatchCreateRoomMembershipResponse -> Bool
== :: BatchCreateRoomMembershipResponse
-> BatchCreateRoomMembershipResponse -> Bool
$c== :: BatchCreateRoomMembershipResponse
-> BatchCreateRoomMembershipResponse -> Bool
Prelude.Eq, ReadPrec [BatchCreateRoomMembershipResponse]
ReadPrec BatchCreateRoomMembershipResponse
Int -> ReadS BatchCreateRoomMembershipResponse
ReadS [BatchCreateRoomMembershipResponse]
(Int -> ReadS BatchCreateRoomMembershipResponse)
-> ReadS [BatchCreateRoomMembershipResponse]
-> ReadPrec BatchCreateRoomMembershipResponse
-> ReadPrec [BatchCreateRoomMembershipResponse]
-> Read BatchCreateRoomMembershipResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateRoomMembershipResponse]
$creadListPrec :: ReadPrec [BatchCreateRoomMembershipResponse]
readPrec :: ReadPrec BatchCreateRoomMembershipResponse
$creadPrec :: ReadPrec BatchCreateRoomMembershipResponse
readList :: ReadS [BatchCreateRoomMembershipResponse]
$creadList :: ReadS [BatchCreateRoomMembershipResponse]
readsPrec :: Int -> ReadS BatchCreateRoomMembershipResponse
$creadsPrec :: Int -> ReadS BatchCreateRoomMembershipResponse
Prelude.Read, Int -> BatchCreateRoomMembershipResponse -> ShowS
[BatchCreateRoomMembershipResponse] -> ShowS
BatchCreateRoomMembershipResponse -> String
(Int -> BatchCreateRoomMembershipResponse -> ShowS)
-> (BatchCreateRoomMembershipResponse -> String)
-> ([BatchCreateRoomMembershipResponse] -> ShowS)
-> Show BatchCreateRoomMembershipResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateRoomMembershipResponse] -> ShowS
$cshowList :: [BatchCreateRoomMembershipResponse] -> ShowS
show :: BatchCreateRoomMembershipResponse -> String
$cshow :: BatchCreateRoomMembershipResponse -> String
showsPrec :: Int -> BatchCreateRoomMembershipResponse -> ShowS
$cshowsPrec :: Int -> BatchCreateRoomMembershipResponse -> ShowS
Prelude.Show, (forall x.
BatchCreateRoomMembershipResponse
-> Rep BatchCreateRoomMembershipResponse x)
-> (forall x.
Rep BatchCreateRoomMembershipResponse x
-> BatchCreateRoomMembershipResponse)
-> Generic BatchCreateRoomMembershipResponse
forall x.
Rep BatchCreateRoomMembershipResponse x
-> BatchCreateRoomMembershipResponse
forall x.
BatchCreateRoomMembershipResponse
-> Rep BatchCreateRoomMembershipResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateRoomMembershipResponse x
-> BatchCreateRoomMembershipResponse
$cfrom :: forall x.
BatchCreateRoomMembershipResponse
-> Rep BatchCreateRoomMembershipResponse x
Prelude.Generic)
newBatchCreateRoomMembershipResponse ::
Prelude.Int ->
BatchCreateRoomMembershipResponse
newBatchCreateRoomMembershipResponse :: Int -> BatchCreateRoomMembershipResponse
newBatchCreateRoomMembershipResponse Int
pHttpStatus_ =
BatchCreateRoomMembershipResponse' :: Maybe [MemberError] -> Int -> BatchCreateRoomMembershipResponse
BatchCreateRoomMembershipResponse'
{ $sel:errors:BatchCreateRoomMembershipResponse' :: Maybe [MemberError]
errors =
Maybe [MemberError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchCreateRoomMembershipResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchCreateRoomMembershipResponse_errors :: Lens.Lens' BatchCreateRoomMembershipResponse (Prelude.Maybe [MemberError])
batchCreateRoomMembershipResponse_errors :: (Maybe [MemberError] -> f (Maybe [MemberError]))
-> BatchCreateRoomMembershipResponse
-> f BatchCreateRoomMembershipResponse
batchCreateRoomMembershipResponse_errors = (BatchCreateRoomMembershipResponse -> Maybe [MemberError])
-> (BatchCreateRoomMembershipResponse
-> Maybe [MemberError] -> BatchCreateRoomMembershipResponse)
-> Lens
BatchCreateRoomMembershipResponse
BatchCreateRoomMembershipResponse
(Maybe [MemberError])
(Maybe [MemberError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateRoomMembershipResponse' {Maybe [MemberError]
errors :: Maybe [MemberError]
$sel:errors:BatchCreateRoomMembershipResponse' :: BatchCreateRoomMembershipResponse -> Maybe [MemberError]
errors} -> Maybe [MemberError]
errors) (\s :: BatchCreateRoomMembershipResponse
s@BatchCreateRoomMembershipResponse' {} Maybe [MemberError]
a -> BatchCreateRoomMembershipResponse
s {$sel:errors:BatchCreateRoomMembershipResponse' :: Maybe [MemberError]
errors = Maybe [MemberError]
a} :: BatchCreateRoomMembershipResponse) ((Maybe [MemberError] -> f (Maybe [MemberError]))
-> BatchCreateRoomMembershipResponse
-> f BatchCreateRoomMembershipResponse)
-> ((Maybe [MemberError] -> f (Maybe [MemberError]))
-> Maybe [MemberError] -> f (Maybe [MemberError]))
-> (Maybe [MemberError] -> f (Maybe [MemberError]))
-> BatchCreateRoomMembershipResponse
-> f BatchCreateRoomMembershipResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MemberError] [MemberError] [MemberError] [MemberError]
-> Iso
(Maybe [MemberError])
(Maybe [MemberError])
(Maybe [MemberError])
(Maybe [MemberError])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [MemberError] [MemberError] [MemberError] [MemberError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchCreateRoomMembershipResponse_httpStatus :: Lens.Lens' BatchCreateRoomMembershipResponse Prelude.Int
batchCreateRoomMembershipResponse_httpStatus :: (Int -> f Int)
-> BatchCreateRoomMembershipResponse
-> f BatchCreateRoomMembershipResponse
batchCreateRoomMembershipResponse_httpStatus = (BatchCreateRoomMembershipResponse -> Int)
-> (BatchCreateRoomMembershipResponse
-> Int -> BatchCreateRoomMembershipResponse)
-> Lens
BatchCreateRoomMembershipResponse
BatchCreateRoomMembershipResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateRoomMembershipResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchCreateRoomMembershipResponse' :: BatchCreateRoomMembershipResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchCreateRoomMembershipResponse
s@BatchCreateRoomMembershipResponse' {} Int
a -> BatchCreateRoomMembershipResponse
s {$sel:httpStatus:BatchCreateRoomMembershipResponse' :: Int
httpStatus = Int
a} :: BatchCreateRoomMembershipResponse)
instance
Prelude.NFData
BatchCreateRoomMembershipResponse