{-# 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.UpdateRoomMembership
(
UpdateRoomMembership (..),
newUpdateRoomMembership,
updateRoomMembership_role,
updateRoomMembership_accountId,
updateRoomMembership_roomId,
updateRoomMembership_memberId,
UpdateRoomMembershipResponse (..),
newUpdateRoomMembershipResponse,
updateRoomMembershipResponse_roomMembership,
updateRoomMembershipResponse_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 UpdateRoomMembership = UpdateRoomMembership'
{
UpdateRoomMembership -> Maybe RoomMembershipRole
role' :: Prelude.Maybe RoomMembershipRole,
UpdateRoomMembership -> Text
accountId :: Prelude.Text,
UpdateRoomMembership -> Text
roomId :: Prelude.Text,
UpdateRoomMembership -> Text
memberId :: Prelude.Text
}
deriving (UpdateRoomMembership -> UpdateRoomMembership -> Bool
(UpdateRoomMembership -> UpdateRoomMembership -> Bool)
-> (UpdateRoomMembership -> UpdateRoomMembership -> Bool)
-> Eq UpdateRoomMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoomMembership -> UpdateRoomMembership -> Bool
$c/= :: UpdateRoomMembership -> UpdateRoomMembership -> Bool
== :: UpdateRoomMembership -> UpdateRoomMembership -> Bool
$c== :: UpdateRoomMembership -> UpdateRoomMembership -> Bool
Prelude.Eq, ReadPrec [UpdateRoomMembership]
ReadPrec UpdateRoomMembership
Int -> ReadS UpdateRoomMembership
ReadS [UpdateRoomMembership]
(Int -> ReadS UpdateRoomMembership)
-> ReadS [UpdateRoomMembership]
-> ReadPrec UpdateRoomMembership
-> ReadPrec [UpdateRoomMembership]
-> Read UpdateRoomMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoomMembership]
$creadListPrec :: ReadPrec [UpdateRoomMembership]
readPrec :: ReadPrec UpdateRoomMembership
$creadPrec :: ReadPrec UpdateRoomMembership
readList :: ReadS [UpdateRoomMembership]
$creadList :: ReadS [UpdateRoomMembership]
readsPrec :: Int -> ReadS UpdateRoomMembership
$creadsPrec :: Int -> ReadS UpdateRoomMembership
Prelude.Read, Int -> UpdateRoomMembership -> ShowS
[UpdateRoomMembership] -> ShowS
UpdateRoomMembership -> String
(Int -> UpdateRoomMembership -> ShowS)
-> (UpdateRoomMembership -> String)
-> ([UpdateRoomMembership] -> ShowS)
-> Show UpdateRoomMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoomMembership] -> ShowS
$cshowList :: [UpdateRoomMembership] -> ShowS
show :: UpdateRoomMembership -> String
$cshow :: UpdateRoomMembership -> String
showsPrec :: Int -> UpdateRoomMembership -> ShowS
$cshowsPrec :: Int -> UpdateRoomMembership -> ShowS
Prelude.Show, (forall x. UpdateRoomMembership -> Rep UpdateRoomMembership x)
-> (forall x. Rep UpdateRoomMembership x -> UpdateRoomMembership)
-> Generic UpdateRoomMembership
forall x. Rep UpdateRoomMembership x -> UpdateRoomMembership
forall x. UpdateRoomMembership -> Rep UpdateRoomMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoomMembership x -> UpdateRoomMembership
$cfrom :: forall x. UpdateRoomMembership -> Rep UpdateRoomMembership x
Prelude.Generic)
newUpdateRoomMembership ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpdateRoomMembership
newUpdateRoomMembership :: Text -> Text -> Text -> UpdateRoomMembership
newUpdateRoomMembership
Text
pAccountId_
Text
pRoomId_
Text
pMemberId_ =
UpdateRoomMembership' :: Maybe RoomMembershipRole
-> Text -> Text -> Text -> UpdateRoomMembership
UpdateRoomMembership'
{ $sel:role':UpdateRoomMembership' :: Maybe RoomMembershipRole
role' = Maybe RoomMembershipRole
forall a. Maybe a
Prelude.Nothing,
$sel:accountId:UpdateRoomMembership' :: Text
accountId = Text
pAccountId_,
$sel:roomId:UpdateRoomMembership' :: Text
roomId = Text
pRoomId_,
$sel:memberId:UpdateRoomMembership' :: Text
memberId = Text
pMemberId_
}
updateRoomMembership_role :: Lens.Lens' UpdateRoomMembership (Prelude.Maybe RoomMembershipRole)
updateRoomMembership_role :: (Maybe RoomMembershipRole -> f (Maybe RoomMembershipRole))
-> UpdateRoomMembership -> f UpdateRoomMembership
updateRoomMembership_role = (UpdateRoomMembership -> Maybe RoomMembershipRole)
-> (UpdateRoomMembership
-> Maybe RoomMembershipRole -> UpdateRoomMembership)
-> Lens
UpdateRoomMembership
UpdateRoomMembership
(Maybe RoomMembershipRole)
(Maybe RoomMembershipRole)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomMembership' {Maybe RoomMembershipRole
role' :: Maybe RoomMembershipRole
$sel:role':UpdateRoomMembership' :: UpdateRoomMembership -> Maybe RoomMembershipRole
role'} -> Maybe RoomMembershipRole
role') (\s :: UpdateRoomMembership
s@UpdateRoomMembership' {} Maybe RoomMembershipRole
a -> UpdateRoomMembership
s {$sel:role':UpdateRoomMembership' :: Maybe RoomMembershipRole
role' = Maybe RoomMembershipRole
a} :: UpdateRoomMembership)
updateRoomMembership_accountId :: Lens.Lens' UpdateRoomMembership Prelude.Text
updateRoomMembership_accountId :: (Text -> f Text) -> UpdateRoomMembership -> f UpdateRoomMembership
updateRoomMembership_accountId = (UpdateRoomMembership -> Text)
-> (UpdateRoomMembership -> Text -> UpdateRoomMembership)
-> Lens UpdateRoomMembership UpdateRoomMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomMembership' {Text
accountId :: Text
$sel:accountId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
accountId} -> Text
accountId) (\s :: UpdateRoomMembership
s@UpdateRoomMembership' {} Text
a -> UpdateRoomMembership
s {$sel:accountId:UpdateRoomMembership' :: Text
accountId = Text
a} :: UpdateRoomMembership)
updateRoomMembership_roomId :: Lens.Lens' UpdateRoomMembership Prelude.Text
updateRoomMembership_roomId :: (Text -> f Text) -> UpdateRoomMembership -> f UpdateRoomMembership
updateRoomMembership_roomId = (UpdateRoomMembership -> Text)
-> (UpdateRoomMembership -> Text -> UpdateRoomMembership)
-> Lens UpdateRoomMembership UpdateRoomMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomMembership' {Text
roomId :: Text
$sel:roomId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
roomId} -> Text
roomId) (\s :: UpdateRoomMembership
s@UpdateRoomMembership' {} Text
a -> UpdateRoomMembership
s {$sel:roomId:UpdateRoomMembership' :: Text
roomId = Text
a} :: UpdateRoomMembership)
updateRoomMembership_memberId :: Lens.Lens' UpdateRoomMembership Prelude.Text
updateRoomMembership_memberId :: (Text -> f Text) -> UpdateRoomMembership -> f UpdateRoomMembership
updateRoomMembership_memberId = (UpdateRoomMembership -> Text)
-> (UpdateRoomMembership -> Text -> UpdateRoomMembership)
-> Lens UpdateRoomMembership UpdateRoomMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomMembership' {Text
memberId :: Text
$sel:memberId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
memberId} -> Text
memberId) (\s :: UpdateRoomMembership
s@UpdateRoomMembership' {} Text
a -> UpdateRoomMembership
s {$sel:memberId:UpdateRoomMembership' :: Text
memberId = Text
a} :: UpdateRoomMembership)
instance Core.AWSRequest UpdateRoomMembership where
type
AWSResponse UpdateRoomMembership =
UpdateRoomMembershipResponse
request :: UpdateRoomMembership -> Request UpdateRoomMembership
request = Service -> UpdateRoomMembership -> Request UpdateRoomMembership
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRoomMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRoomMembership)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRoomMembership))
-> Logger
-> Service
-> Proxy UpdateRoomMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRoomMembership)))
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 RoomMembership -> Int -> UpdateRoomMembershipResponse
UpdateRoomMembershipResponse'
(Maybe RoomMembership -> Int -> UpdateRoomMembershipResponse)
-> Either String (Maybe RoomMembership)
-> Either String (Int -> UpdateRoomMembershipResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RoomMembership)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RoomMembership")
Either String (Int -> UpdateRoomMembershipResponse)
-> Either String Int -> Either String UpdateRoomMembershipResponse
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 UpdateRoomMembership
instance Prelude.NFData UpdateRoomMembership
instance Core.ToHeaders UpdateRoomMembership where
toHeaders :: UpdateRoomMembership -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateRoomMembership -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdateRoomMembership where
toJSON :: UpdateRoomMembership -> Value
toJSON UpdateRoomMembership' {Maybe RoomMembershipRole
Text
memberId :: Text
roomId :: Text
accountId :: Text
role' :: Maybe RoomMembershipRole
$sel:memberId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
$sel:roomId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
$sel:accountId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
$sel:role':UpdateRoomMembership' :: UpdateRoomMembership -> Maybe RoomMembershipRole
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Role" Text -> RoomMembershipRole -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RoomMembershipRole -> Pair)
-> Maybe RoomMembershipRole -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RoomMembershipRole
role']
)
instance Core.ToPath UpdateRoomMembership where
toPath :: UpdateRoomMembership -> ByteString
toPath UpdateRoomMembership' {Maybe RoomMembershipRole
Text
memberId :: Text
roomId :: Text
accountId :: Text
role' :: Maybe RoomMembershipRole
$sel:memberId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
$sel:roomId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
$sel:accountId:UpdateRoomMembership' :: UpdateRoomMembership -> Text
$sel:role':UpdateRoomMembership' :: UpdateRoomMembership -> Maybe RoomMembershipRole
..} =
[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/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
memberId
]
instance Core.ToQuery UpdateRoomMembership where
toQuery :: UpdateRoomMembership -> QueryString
toQuery = QueryString -> UpdateRoomMembership -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateRoomMembershipResponse = UpdateRoomMembershipResponse'
{
UpdateRoomMembershipResponse -> Maybe RoomMembership
roomMembership :: Prelude.Maybe RoomMembership,
UpdateRoomMembershipResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRoomMembershipResponse
-> UpdateRoomMembershipResponse -> Bool
(UpdateRoomMembershipResponse
-> UpdateRoomMembershipResponse -> Bool)
-> (UpdateRoomMembershipResponse
-> UpdateRoomMembershipResponse -> Bool)
-> Eq UpdateRoomMembershipResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoomMembershipResponse
-> UpdateRoomMembershipResponse -> Bool
$c/= :: UpdateRoomMembershipResponse
-> UpdateRoomMembershipResponse -> Bool
== :: UpdateRoomMembershipResponse
-> UpdateRoomMembershipResponse -> Bool
$c== :: UpdateRoomMembershipResponse
-> UpdateRoomMembershipResponse -> Bool
Prelude.Eq, Int -> UpdateRoomMembershipResponse -> ShowS
[UpdateRoomMembershipResponse] -> ShowS
UpdateRoomMembershipResponse -> String
(Int -> UpdateRoomMembershipResponse -> ShowS)
-> (UpdateRoomMembershipResponse -> String)
-> ([UpdateRoomMembershipResponse] -> ShowS)
-> Show UpdateRoomMembershipResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoomMembershipResponse] -> ShowS
$cshowList :: [UpdateRoomMembershipResponse] -> ShowS
show :: UpdateRoomMembershipResponse -> String
$cshow :: UpdateRoomMembershipResponse -> String
showsPrec :: Int -> UpdateRoomMembershipResponse -> ShowS
$cshowsPrec :: Int -> UpdateRoomMembershipResponse -> ShowS
Prelude.Show, (forall x.
UpdateRoomMembershipResponse -> Rep UpdateRoomMembershipResponse x)
-> (forall x.
Rep UpdateRoomMembershipResponse x -> UpdateRoomMembershipResponse)
-> Generic UpdateRoomMembershipResponse
forall x.
Rep UpdateRoomMembershipResponse x -> UpdateRoomMembershipResponse
forall x.
UpdateRoomMembershipResponse -> Rep UpdateRoomMembershipResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateRoomMembershipResponse x -> UpdateRoomMembershipResponse
$cfrom :: forall x.
UpdateRoomMembershipResponse -> Rep UpdateRoomMembershipResponse x
Prelude.Generic)
newUpdateRoomMembershipResponse ::
Prelude.Int ->
UpdateRoomMembershipResponse
newUpdateRoomMembershipResponse :: Int -> UpdateRoomMembershipResponse
newUpdateRoomMembershipResponse Int
pHttpStatus_ =
UpdateRoomMembershipResponse' :: Maybe RoomMembership -> Int -> UpdateRoomMembershipResponse
UpdateRoomMembershipResponse'
{ $sel:roomMembership:UpdateRoomMembershipResponse' :: Maybe RoomMembership
roomMembership =
Maybe RoomMembership
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateRoomMembershipResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateRoomMembershipResponse_roomMembership :: Lens.Lens' UpdateRoomMembershipResponse (Prelude.Maybe RoomMembership)
updateRoomMembershipResponse_roomMembership :: (Maybe RoomMembership -> f (Maybe RoomMembership))
-> UpdateRoomMembershipResponse -> f UpdateRoomMembershipResponse
updateRoomMembershipResponse_roomMembership = (UpdateRoomMembershipResponse -> Maybe RoomMembership)
-> (UpdateRoomMembershipResponse
-> Maybe RoomMembership -> UpdateRoomMembershipResponse)
-> Lens
UpdateRoomMembershipResponse
UpdateRoomMembershipResponse
(Maybe RoomMembership)
(Maybe RoomMembership)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomMembershipResponse' {Maybe RoomMembership
roomMembership :: Maybe RoomMembership
$sel:roomMembership:UpdateRoomMembershipResponse' :: UpdateRoomMembershipResponse -> Maybe RoomMembership
roomMembership} -> Maybe RoomMembership
roomMembership) (\s :: UpdateRoomMembershipResponse
s@UpdateRoomMembershipResponse' {} Maybe RoomMembership
a -> UpdateRoomMembershipResponse
s {$sel:roomMembership:UpdateRoomMembershipResponse' :: Maybe RoomMembership
roomMembership = Maybe RoomMembership
a} :: UpdateRoomMembershipResponse)
updateRoomMembershipResponse_httpStatus :: Lens.Lens' UpdateRoomMembershipResponse Prelude.Int
updateRoomMembershipResponse_httpStatus :: (Int -> f Int)
-> UpdateRoomMembershipResponse -> f UpdateRoomMembershipResponse
updateRoomMembershipResponse_httpStatus = (UpdateRoomMembershipResponse -> Int)
-> (UpdateRoomMembershipResponse
-> Int -> UpdateRoomMembershipResponse)
-> Lens
UpdateRoomMembershipResponse UpdateRoomMembershipResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomMembershipResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRoomMembershipResponse' :: UpdateRoomMembershipResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRoomMembershipResponse
s@UpdateRoomMembershipResponse' {} Int
a -> UpdateRoomMembershipResponse
s {$sel:httpStatus:UpdateRoomMembershipResponse' :: Int
httpStatus = Int
a} :: UpdateRoomMembershipResponse)
instance Prelude.NFData UpdateRoomMembershipResponse