{-# 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.UpdateRoom
(
UpdateRoom (..),
newUpdateRoom,
updateRoom_name,
updateRoom_accountId,
updateRoom_roomId,
UpdateRoomResponse (..),
newUpdateRoomResponse,
updateRoomResponse_room,
updateRoomResponse_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 UpdateRoom = UpdateRoom'
{
UpdateRoom -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Core.Sensitive Prelude.Text),
UpdateRoom -> Text
accountId :: Prelude.Text,
UpdateRoom -> Text
roomId :: Prelude.Text
}
deriving (UpdateRoom -> UpdateRoom -> Bool
(UpdateRoom -> UpdateRoom -> Bool)
-> (UpdateRoom -> UpdateRoom -> Bool) -> Eq UpdateRoom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoom -> UpdateRoom -> Bool
$c/= :: UpdateRoom -> UpdateRoom -> Bool
== :: UpdateRoom -> UpdateRoom -> Bool
$c== :: UpdateRoom -> UpdateRoom -> Bool
Prelude.Eq, Int -> UpdateRoom -> ShowS
[UpdateRoom] -> ShowS
UpdateRoom -> String
(Int -> UpdateRoom -> ShowS)
-> (UpdateRoom -> String)
-> ([UpdateRoom] -> ShowS)
-> Show UpdateRoom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoom] -> ShowS
$cshowList :: [UpdateRoom] -> ShowS
show :: UpdateRoom -> String
$cshow :: UpdateRoom -> String
showsPrec :: Int -> UpdateRoom -> ShowS
$cshowsPrec :: Int -> UpdateRoom -> ShowS
Prelude.Show, (forall x. UpdateRoom -> Rep UpdateRoom x)
-> (forall x. Rep UpdateRoom x -> UpdateRoom) -> Generic UpdateRoom
forall x. Rep UpdateRoom x -> UpdateRoom
forall x. UpdateRoom -> Rep UpdateRoom x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoom x -> UpdateRoom
$cfrom :: forall x. UpdateRoom -> Rep UpdateRoom x
Prelude.Generic)
newUpdateRoom ::
Prelude.Text ->
Prelude.Text ->
UpdateRoom
newUpdateRoom :: Text -> Text -> UpdateRoom
newUpdateRoom Text
pAccountId_ Text
pRoomId_ =
UpdateRoom' :: Maybe (Sensitive Text) -> Text -> Text -> UpdateRoom
UpdateRoom'
{ $sel:name:UpdateRoom' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:accountId:UpdateRoom' :: Text
accountId = Text
pAccountId_,
$sel:roomId:UpdateRoom' :: Text
roomId = Text
pRoomId_
}
updateRoom_name :: Lens.Lens' UpdateRoom (Prelude.Maybe Prelude.Text)
updateRoom_name :: (Maybe Text -> f (Maybe Text)) -> UpdateRoom -> f UpdateRoom
updateRoom_name = (UpdateRoom -> Maybe (Sensitive Text))
-> (UpdateRoom -> Maybe (Sensitive Text) -> UpdateRoom)
-> Lens
UpdateRoom
UpdateRoom
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoom' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:UpdateRoom' :: UpdateRoom -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: UpdateRoom
s@UpdateRoom' {} Maybe (Sensitive Text)
a -> UpdateRoom
s {$sel:name:UpdateRoom' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: UpdateRoom) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> UpdateRoom -> f UpdateRoom)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UpdateRoom
-> f UpdateRoom
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
updateRoom_accountId :: Lens.Lens' UpdateRoom Prelude.Text
updateRoom_accountId :: (Text -> f Text) -> UpdateRoom -> f UpdateRoom
updateRoom_accountId = (UpdateRoom -> Text)
-> (UpdateRoom -> Text -> UpdateRoom)
-> Lens UpdateRoom UpdateRoom Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoom' {Text
accountId :: Text
$sel:accountId:UpdateRoom' :: UpdateRoom -> Text
accountId} -> Text
accountId) (\s :: UpdateRoom
s@UpdateRoom' {} Text
a -> UpdateRoom
s {$sel:accountId:UpdateRoom' :: Text
accountId = Text
a} :: UpdateRoom)
updateRoom_roomId :: Lens.Lens' UpdateRoom Prelude.Text
updateRoom_roomId :: (Text -> f Text) -> UpdateRoom -> f UpdateRoom
updateRoom_roomId = (UpdateRoom -> Text)
-> (UpdateRoom -> Text -> UpdateRoom)
-> Lens UpdateRoom UpdateRoom Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoom' {Text
roomId :: Text
$sel:roomId:UpdateRoom' :: UpdateRoom -> Text
roomId} -> Text
roomId) (\s :: UpdateRoom
s@UpdateRoom' {} Text
a -> UpdateRoom
s {$sel:roomId:UpdateRoom' :: Text
roomId = Text
a} :: UpdateRoom)
instance Core.AWSRequest UpdateRoom where
type AWSResponse UpdateRoom = UpdateRoomResponse
request :: UpdateRoom -> Request UpdateRoom
request = Service -> UpdateRoom -> Request UpdateRoom
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRoom
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRoom)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRoom))
-> Logger
-> Service
-> Proxy UpdateRoom
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRoom)))
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 Room -> Int -> UpdateRoomResponse
UpdateRoomResponse'
(Maybe Room -> Int -> UpdateRoomResponse)
-> Either String (Maybe Room)
-> Either String (Int -> UpdateRoomResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Room)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Room")
Either String (Int -> UpdateRoomResponse)
-> Either String Int -> Either String UpdateRoomResponse
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 UpdateRoom
instance Prelude.NFData UpdateRoom
instance Core.ToHeaders UpdateRoom where
toHeaders :: UpdateRoom -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateRoom -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdateRoom where
toJSON :: UpdateRoom -> Value
toJSON UpdateRoom' {Maybe (Sensitive Text)
Text
roomId :: Text
accountId :: Text
name :: Maybe (Sensitive Text)
$sel:roomId:UpdateRoom' :: UpdateRoom -> Text
$sel:accountId:UpdateRoom' :: UpdateRoom -> Text
$sel:name:UpdateRoom' :: UpdateRoom -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Name" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
name]
)
instance Core.ToPath UpdateRoom where
toPath :: UpdateRoom -> ByteString
toPath UpdateRoom' {Maybe (Sensitive Text)
Text
roomId :: Text
accountId :: Text
name :: Maybe (Sensitive Text)
$sel:roomId:UpdateRoom' :: UpdateRoom -> Text
$sel:accountId:UpdateRoom' :: UpdateRoom -> Text
$sel:name:UpdateRoom' :: UpdateRoom -> Maybe (Sensitive 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
]
instance Core.ToQuery UpdateRoom where
toQuery :: UpdateRoom -> QueryString
toQuery = QueryString -> UpdateRoom -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateRoomResponse = UpdateRoomResponse'
{
UpdateRoomResponse -> Maybe Room
room :: Prelude.Maybe Room,
UpdateRoomResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRoomResponse -> UpdateRoomResponse -> Bool
(UpdateRoomResponse -> UpdateRoomResponse -> Bool)
-> (UpdateRoomResponse -> UpdateRoomResponse -> Bool)
-> Eq UpdateRoomResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoomResponse -> UpdateRoomResponse -> Bool
$c/= :: UpdateRoomResponse -> UpdateRoomResponse -> Bool
== :: UpdateRoomResponse -> UpdateRoomResponse -> Bool
$c== :: UpdateRoomResponse -> UpdateRoomResponse -> Bool
Prelude.Eq, Int -> UpdateRoomResponse -> ShowS
[UpdateRoomResponse] -> ShowS
UpdateRoomResponse -> String
(Int -> UpdateRoomResponse -> ShowS)
-> (UpdateRoomResponse -> String)
-> ([UpdateRoomResponse] -> ShowS)
-> Show UpdateRoomResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoomResponse] -> ShowS
$cshowList :: [UpdateRoomResponse] -> ShowS
show :: UpdateRoomResponse -> String
$cshow :: UpdateRoomResponse -> String
showsPrec :: Int -> UpdateRoomResponse -> ShowS
$cshowsPrec :: Int -> UpdateRoomResponse -> ShowS
Prelude.Show, (forall x. UpdateRoomResponse -> Rep UpdateRoomResponse x)
-> (forall x. Rep UpdateRoomResponse x -> UpdateRoomResponse)
-> Generic UpdateRoomResponse
forall x. Rep UpdateRoomResponse x -> UpdateRoomResponse
forall x. UpdateRoomResponse -> Rep UpdateRoomResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoomResponse x -> UpdateRoomResponse
$cfrom :: forall x. UpdateRoomResponse -> Rep UpdateRoomResponse x
Prelude.Generic)
newUpdateRoomResponse ::
Prelude.Int ->
UpdateRoomResponse
newUpdateRoomResponse :: Int -> UpdateRoomResponse
newUpdateRoomResponse Int
pHttpStatus_ =
UpdateRoomResponse' :: Maybe Room -> Int -> UpdateRoomResponse
UpdateRoomResponse'
{ $sel:room:UpdateRoomResponse' :: Maybe Room
room = Maybe Room
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateRoomResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateRoomResponse_room :: Lens.Lens' UpdateRoomResponse (Prelude.Maybe Room)
updateRoomResponse_room :: (Maybe Room -> f (Maybe Room))
-> UpdateRoomResponse -> f UpdateRoomResponse
updateRoomResponse_room = (UpdateRoomResponse -> Maybe Room)
-> (UpdateRoomResponse -> Maybe Room -> UpdateRoomResponse)
-> Lens
UpdateRoomResponse UpdateRoomResponse (Maybe Room) (Maybe Room)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomResponse' {Maybe Room
room :: Maybe Room
$sel:room:UpdateRoomResponse' :: UpdateRoomResponse -> Maybe Room
room} -> Maybe Room
room) (\s :: UpdateRoomResponse
s@UpdateRoomResponse' {} Maybe Room
a -> UpdateRoomResponse
s {$sel:room:UpdateRoomResponse' :: Maybe Room
room = Maybe Room
a} :: UpdateRoomResponse)
updateRoomResponse_httpStatus :: Lens.Lens' UpdateRoomResponse Prelude.Int
updateRoomResponse_httpStatus :: (Int -> f Int) -> UpdateRoomResponse -> f UpdateRoomResponse
updateRoomResponse_httpStatus = (UpdateRoomResponse -> Int)
-> (UpdateRoomResponse -> Int -> UpdateRoomResponse)
-> Lens UpdateRoomResponse UpdateRoomResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoomResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRoomResponse' :: UpdateRoomResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRoomResponse
s@UpdateRoomResponse' {} Int
a -> UpdateRoomResponse
s {$sel:httpStatus:UpdateRoomResponse' :: Int
httpStatus = Int
a} :: UpdateRoomResponse)
instance Prelude.NFData UpdateRoomResponse