{-# 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.GetBot
(
GetBot (..),
newGetBot,
getBot_accountId,
getBot_botId,
GetBotResponse (..),
newGetBotResponse,
getBotResponse_bot,
getBotResponse_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 GetBot = GetBot'
{
GetBot -> Text
accountId :: Prelude.Text,
GetBot -> Text
botId :: Prelude.Text
}
deriving (GetBot -> GetBot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBot -> GetBot -> Bool
$c/= :: GetBot -> GetBot -> Bool
== :: GetBot -> GetBot -> Bool
$c== :: GetBot -> GetBot -> Bool
Prelude.Eq, ReadPrec [GetBot]
ReadPrec GetBot
Int -> ReadS GetBot
ReadS [GetBot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBot]
$creadListPrec :: ReadPrec [GetBot]
readPrec :: ReadPrec GetBot
$creadPrec :: ReadPrec GetBot
readList :: ReadS [GetBot]
$creadList :: ReadS [GetBot]
readsPrec :: Int -> ReadS GetBot
$creadsPrec :: Int -> ReadS GetBot
Prelude.Read, Int -> GetBot -> ShowS
[GetBot] -> ShowS
GetBot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBot] -> ShowS
$cshowList :: [GetBot] -> ShowS
show :: GetBot -> String
$cshow :: GetBot -> String
showsPrec :: Int -> GetBot -> ShowS
$cshowsPrec :: Int -> GetBot -> ShowS
Prelude.Show, forall x. Rep GetBot x -> GetBot
forall x. GetBot -> Rep GetBot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBot x -> GetBot
$cfrom :: forall x. GetBot -> Rep GetBot x
Prelude.Generic)
newGetBot ::
Prelude.Text ->
Prelude.Text ->
GetBot
newGetBot :: Text -> Text -> GetBot
newGetBot Text
pAccountId_ Text
pBotId_ =
GetBot' {$sel:accountId:GetBot' :: Text
accountId = Text
pAccountId_, $sel:botId:GetBot' :: Text
botId = Text
pBotId_}
getBot_accountId :: Lens.Lens' GetBot Prelude.Text
getBot_accountId :: Lens' GetBot Text
getBot_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBot' {Text
accountId :: Text
$sel:accountId:GetBot' :: GetBot -> Text
accountId} -> Text
accountId) (\s :: GetBot
s@GetBot' {} Text
a -> GetBot
s {$sel:accountId:GetBot' :: Text
accountId = Text
a} :: GetBot)
getBot_botId :: Lens.Lens' GetBot Prelude.Text
getBot_botId :: Lens' GetBot Text
getBot_botId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBot' {Text
botId :: Text
$sel:botId:GetBot' :: GetBot -> Text
botId} -> Text
botId) (\s :: GetBot
s@GetBot' {} Text
a -> GetBot
s {$sel:botId:GetBot' :: Text
botId = Text
a} :: GetBot)
instance Core.AWSRequest GetBot where
type AWSResponse GetBot = GetBotResponse
request :: (Service -> Service) -> GetBot -> Request GetBot
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetBot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBot)))
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 Bot -> Int -> GetBotResponse
GetBotResponse'
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
"Bot")
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 GetBot where
hashWithSalt :: Int -> GetBot -> Int
hashWithSalt Int
_salt GetBot' {Text
botId :: Text
accountId :: Text
$sel:botId:GetBot' :: GetBot -> Text
$sel:accountId:GetBot' :: GetBot -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botId
instance Prelude.NFData GetBot where
rnf :: GetBot -> ()
rnf GetBot' {Text
botId :: Text
accountId :: Text
$sel:botId:GetBot' :: GetBot -> Text
$sel:accountId:GetBot' :: GetBot -> 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
botId
instance Data.ToHeaders GetBot where
toHeaders :: GetBot -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetBot where
toPath :: GetBot -> ByteString
toPath GetBot' {Text
botId :: Text
accountId :: Text
$sel:botId:GetBot' :: GetBot -> Text
$sel:accountId:GetBot' :: GetBot -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
accountId,
ByteString
"/bots/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
botId
]
instance Data.ToQuery GetBot where
toQuery :: GetBot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetBotResponse = GetBotResponse'
{
GetBotResponse -> Maybe Bot
bot :: Prelude.Maybe Bot,
GetBotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBotResponse -> GetBotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBotResponse -> GetBotResponse -> Bool
$c/= :: GetBotResponse -> GetBotResponse -> Bool
== :: GetBotResponse -> GetBotResponse -> Bool
$c== :: GetBotResponse -> GetBotResponse -> Bool
Prelude.Eq, Int -> GetBotResponse -> ShowS
[GetBotResponse] -> ShowS
GetBotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBotResponse] -> ShowS
$cshowList :: [GetBotResponse] -> ShowS
show :: GetBotResponse -> String
$cshow :: GetBotResponse -> String
showsPrec :: Int -> GetBotResponse -> ShowS
$cshowsPrec :: Int -> GetBotResponse -> ShowS
Prelude.Show, forall x. Rep GetBotResponse x -> GetBotResponse
forall x. GetBotResponse -> Rep GetBotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBotResponse x -> GetBotResponse
$cfrom :: forall x. GetBotResponse -> Rep GetBotResponse x
Prelude.Generic)
newGetBotResponse ::
Prelude.Int ->
GetBotResponse
newGetBotResponse :: Int -> GetBotResponse
newGetBotResponse Int
pHttpStatus_ =
GetBotResponse'
{ $sel:bot:GetBotResponse' :: Maybe Bot
bot = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBotResponse_bot :: Lens.Lens' GetBotResponse (Prelude.Maybe Bot)
getBotResponse_bot :: Lens' GetBotResponse (Maybe Bot)
getBotResponse_bot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotResponse' {Maybe Bot
bot :: Maybe Bot
$sel:bot:GetBotResponse' :: GetBotResponse -> Maybe Bot
bot} -> Maybe Bot
bot) (\s :: GetBotResponse
s@GetBotResponse' {} Maybe Bot
a -> GetBotResponse
s {$sel:bot:GetBotResponse' :: Maybe Bot
bot = Maybe Bot
a} :: GetBotResponse)
getBotResponse_httpStatus :: Lens.Lens' GetBotResponse Prelude.Int
getBotResponse_httpStatus :: Lens' GetBotResponse Int
getBotResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBotResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBotResponse' :: GetBotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBotResponse
s@GetBotResponse' {} Int
a -> GetBotResponse
s {$sel:httpStatus:GetBotResponse' :: Int
httpStatus = Int
a} :: GetBotResponse)
instance Prelude.NFData GetBotResponse where
rnf :: GetBotResponse -> ()
rnf GetBotResponse' {Int
Maybe Bot
httpStatus :: Int
bot :: Maybe Bot
$sel:httpStatus:GetBotResponse' :: GetBotResponse -> Int
$sel:bot:GetBotResponse' :: GetBotResponse -> Maybe Bot
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bot
bot
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus