{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
{ $sel:accountId:BatchCreateRoomMembership' :: Text
accountId = Text
pAccountId_,
$sel:roomId:BatchCreateRoomMembership' :: Text
roomId = Text
pRoomId_,
$sel:membershipItemList:BatchCreateRoomMembership' :: [MembershipItem]
membershipItemList = forall a. Monoid a => a
Prelude.mempty
}
batchCreateRoomMembership_accountId :: Lens.Lens' BatchCreateRoomMembership Prelude.Text
batchCreateRoomMembership_accountId :: Lens' BatchCreateRoomMembership Text
batchCreateRoomMembership_accountId = 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 :: Lens' BatchCreateRoomMembership Text
batchCreateRoomMembership_roomId = 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 :: Lens' BatchCreateRoomMembership [MembershipItem]
batchCreateRoomMembership_membershipItemList = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: (Service -> Service)
-> BatchCreateRoomMembership -> Request BatchCreateRoomMembership
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchCreateRoomMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateRoomMembership)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [MemberError] -> Int -> BatchCreateRoomMembershipResponse
BatchCreateRoomMembershipResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Errors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchCreateRoomMembership where
hashWithSalt :: Int -> BatchCreateRoomMembership -> Int
hashWithSalt Int
_salt BatchCreateRoomMembership' {[MembershipItem]
Text
membershipItemList :: [MembershipItem]
roomId :: Text
accountId :: Text
$sel:membershipItemList:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> [MembershipItem]
$sel:roomId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
$sel:accountId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roomId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [MembershipItem]
membershipItemList
instance Prelude.NFData BatchCreateRoomMembership where
rnf :: BatchCreateRoomMembership -> ()
rnf BatchCreateRoomMembership' {[MembershipItem]
Text
membershipItemList :: [MembershipItem]
roomId :: Text
accountId :: Text
$sel:membershipItemList:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> [MembershipItem]
$sel:roomId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
$sel:accountId:BatchCreateRoomMembership' :: BatchCreateRoomMembership -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roomId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [MembershipItem]
membershipItemList
instance Data.ToHeaders BatchCreateRoomMembership where
toHeaders :: BatchCreateRoomMembership -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"MembershipItemList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [MembershipItem]
membershipItemList)
]
)
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
accountId,
ByteString
"/rooms/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
roomId,
ByteString
"/memberships"
]
instance Data.ToQuery BatchCreateRoomMembership where
toQuery :: BatchCreateRoomMembership -> QueryString
toQuery =
forall a b. a -> b -> a
Prelude.const
(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
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]
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
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.
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'
{ $sel:errors:BatchCreateRoomMembershipResponse' :: Maybe [MemberError]
errors =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchCreateRoomMembershipResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchCreateRoomMembershipResponse_errors :: Lens.Lens' BatchCreateRoomMembershipResponse (Prelude.Maybe [MemberError])
batchCreateRoomMembershipResponse_errors :: Lens' BatchCreateRoomMembershipResponse (Maybe [MemberError])
batchCreateRoomMembershipResponse_errors = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' BatchCreateRoomMembershipResponse Int
batchCreateRoomMembershipResponse_httpStatus = 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
where
rnf :: BatchCreateRoomMembershipResponse -> ()
rnf BatchCreateRoomMembershipResponse' {Int
Maybe [MemberError]
httpStatus :: Int
errors :: Maybe [MemberError]
$sel:httpStatus:BatchCreateRoomMembershipResponse' :: BatchCreateRoomMembershipResponse -> Int
$sel:errors:BatchCreateRoomMembershipResponse' :: BatchCreateRoomMembershipResponse -> Maybe [MemberError]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [MemberError]
errors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus