{-# 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.AlexaBusiness.GetRoom
(
GetRoom (..),
newGetRoom,
getRoom_roomArn,
GetRoomResponse (..),
newGetRoomResponse,
getRoomResponse_room,
getRoomResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.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 GetRoom = GetRoom'
{
GetRoom -> Maybe Text
roomArn :: Prelude.Maybe Prelude.Text
}
deriving (GetRoom -> GetRoom -> Bool
(GetRoom -> GetRoom -> Bool)
-> (GetRoom -> GetRoom -> Bool) -> Eq GetRoom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoom -> GetRoom -> Bool
$c/= :: GetRoom -> GetRoom -> Bool
== :: GetRoom -> GetRoom -> Bool
$c== :: GetRoom -> GetRoom -> Bool
Prelude.Eq, ReadPrec [GetRoom]
ReadPrec GetRoom
Int -> ReadS GetRoom
ReadS [GetRoom]
(Int -> ReadS GetRoom)
-> ReadS [GetRoom]
-> ReadPrec GetRoom
-> ReadPrec [GetRoom]
-> Read GetRoom
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoom]
$creadListPrec :: ReadPrec [GetRoom]
readPrec :: ReadPrec GetRoom
$creadPrec :: ReadPrec GetRoom
readList :: ReadS [GetRoom]
$creadList :: ReadS [GetRoom]
readsPrec :: Int -> ReadS GetRoom
$creadsPrec :: Int -> ReadS GetRoom
Prelude.Read, Int -> GetRoom -> ShowS
[GetRoom] -> ShowS
GetRoom -> String
(Int -> GetRoom -> ShowS)
-> (GetRoom -> String) -> ([GetRoom] -> ShowS) -> Show GetRoom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoom] -> ShowS
$cshowList :: [GetRoom] -> ShowS
show :: GetRoom -> String
$cshow :: GetRoom -> String
showsPrec :: Int -> GetRoom -> ShowS
$cshowsPrec :: Int -> GetRoom -> ShowS
Prelude.Show, (forall x. GetRoom -> Rep GetRoom x)
-> (forall x. Rep GetRoom x -> GetRoom) -> Generic GetRoom
forall x. Rep GetRoom x -> GetRoom
forall x. GetRoom -> Rep GetRoom x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoom x -> GetRoom
$cfrom :: forall x. GetRoom -> Rep GetRoom x
Prelude.Generic)
newGetRoom ::
GetRoom
newGetRoom :: GetRoom
newGetRoom = GetRoom' :: Maybe Text -> GetRoom
GetRoom' {$sel:roomArn:GetRoom' :: Maybe Text
roomArn = Maybe Text
forall a. Maybe a
Prelude.Nothing}
getRoom_roomArn :: Lens.Lens' GetRoom (Prelude.Maybe Prelude.Text)
getRoom_roomArn :: (Maybe Text -> f (Maybe Text)) -> GetRoom -> f GetRoom
getRoom_roomArn = (GetRoom -> Maybe Text)
-> (GetRoom -> Maybe Text -> GetRoom)
-> Lens GetRoom GetRoom (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoom' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:GetRoom' :: GetRoom -> Maybe Text
roomArn} -> Maybe Text
roomArn) (\s :: GetRoom
s@GetRoom' {} Maybe Text
a -> GetRoom
s {$sel:roomArn:GetRoom' :: Maybe Text
roomArn = Maybe Text
a} :: GetRoom)
instance Core.AWSRequest GetRoom where
type AWSResponse GetRoom = GetRoomResponse
request :: GetRoom -> Request GetRoom
request = Service -> GetRoom -> Request GetRoom
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetRoom
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRoom)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRoom))
-> Logger
-> Service
-> Proxy GetRoom
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRoom)))
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 -> GetRoomResponse
GetRoomResponse'
(Maybe Room -> Int -> GetRoomResponse)
-> Either String (Maybe Room)
-> Either String (Int -> GetRoomResponse)
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 -> GetRoomResponse)
-> Either String Int -> Either String GetRoomResponse
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 GetRoom
instance Prelude.NFData GetRoom
instance Core.ToHeaders GetRoom where
toHeaders :: GetRoom -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRoom -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AlexaForBusiness.GetRoom" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetRoom where
toJSON :: GetRoom -> Value
toJSON GetRoom' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:GetRoom' :: GetRoom -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"RoomArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roomArn]
)
instance Core.ToPath GetRoom where
toPath :: GetRoom -> ByteString
toPath = ByteString -> GetRoom -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRoom where
toQuery :: GetRoom -> QueryString
toQuery = QueryString -> GetRoom -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRoomResponse = GetRoomResponse'
{
GetRoomResponse -> Maybe Room
room :: Prelude.Maybe Room,
GetRoomResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRoomResponse -> GetRoomResponse -> Bool
(GetRoomResponse -> GetRoomResponse -> Bool)
-> (GetRoomResponse -> GetRoomResponse -> Bool)
-> Eq GetRoomResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRoomResponse -> GetRoomResponse -> Bool
$c/= :: GetRoomResponse -> GetRoomResponse -> Bool
== :: GetRoomResponse -> GetRoomResponse -> Bool
$c== :: GetRoomResponse -> GetRoomResponse -> Bool
Prelude.Eq, ReadPrec [GetRoomResponse]
ReadPrec GetRoomResponse
Int -> ReadS GetRoomResponse
ReadS [GetRoomResponse]
(Int -> ReadS GetRoomResponse)
-> ReadS [GetRoomResponse]
-> ReadPrec GetRoomResponse
-> ReadPrec [GetRoomResponse]
-> Read GetRoomResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRoomResponse]
$creadListPrec :: ReadPrec [GetRoomResponse]
readPrec :: ReadPrec GetRoomResponse
$creadPrec :: ReadPrec GetRoomResponse
readList :: ReadS [GetRoomResponse]
$creadList :: ReadS [GetRoomResponse]
readsPrec :: Int -> ReadS GetRoomResponse
$creadsPrec :: Int -> ReadS GetRoomResponse
Prelude.Read, Int -> GetRoomResponse -> ShowS
[GetRoomResponse] -> ShowS
GetRoomResponse -> String
(Int -> GetRoomResponse -> ShowS)
-> (GetRoomResponse -> String)
-> ([GetRoomResponse] -> ShowS)
-> Show GetRoomResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRoomResponse] -> ShowS
$cshowList :: [GetRoomResponse] -> ShowS
show :: GetRoomResponse -> String
$cshow :: GetRoomResponse -> String
showsPrec :: Int -> GetRoomResponse -> ShowS
$cshowsPrec :: Int -> GetRoomResponse -> ShowS
Prelude.Show, (forall x. GetRoomResponse -> Rep GetRoomResponse x)
-> (forall x. Rep GetRoomResponse x -> GetRoomResponse)
-> Generic GetRoomResponse
forall x. Rep GetRoomResponse x -> GetRoomResponse
forall x. GetRoomResponse -> Rep GetRoomResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRoomResponse x -> GetRoomResponse
$cfrom :: forall x. GetRoomResponse -> Rep GetRoomResponse x
Prelude.Generic)
newGetRoomResponse ::
Prelude.Int ->
GetRoomResponse
newGetRoomResponse :: Int -> GetRoomResponse
newGetRoomResponse Int
pHttpStatus_ =
GetRoomResponse' :: Maybe Room -> Int -> GetRoomResponse
GetRoomResponse'
{ $sel:room:GetRoomResponse' :: Maybe Room
room = Maybe Room
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRoomResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRoomResponse_room :: Lens.Lens' GetRoomResponse (Prelude.Maybe Room)
getRoomResponse_room :: (Maybe Room -> f (Maybe Room))
-> GetRoomResponse -> f GetRoomResponse
getRoomResponse_room = (GetRoomResponse -> Maybe Room)
-> (GetRoomResponse -> Maybe Room -> GetRoomResponse)
-> Lens GetRoomResponse GetRoomResponse (Maybe Room) (Maybe Room)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoomResponse' {Maybe Room
room :: Maybe Room
$sel:room:GetRoomResponse' :: GetRoomResponse -> Maybe Room
room} -> Maybe Room
room) (\s :: GetRoomResponse
s@GetRoomResponse' {} Maybe Room
a -> GetRoomResponse
s {$sel:room:GetRoomResponse' :: Maybe Room
room = Maybe Room
a} :: GetRoomResponse)
getRoomResponse_httpStatus :: Lens.Lens' GetRoomResponse Prelude.Int
getRoomResponse_httpStatus :: (Int -> f Int) -> GetRoomResponse -> f GetRoomResponse
getRoomResponse_httpStatus = (GetRoomResponse -> Int)
-> (GetRoomResponse -> Int -> GetRoomResponse)
-> Lens GetRoomResponse GetRoomResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRoomResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRoomResponse' :: GetRoomResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRoomResponse
s@GetRoomResponse' {} Int
a -> GetRoomResponse
s {$sel:httpStatus:GetRoomResponse' :: Int
httpStatus = Int
a} :: GetRoomResponse)
instance Prelude.NFData GetRoomResponse