{-# 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.IoTData.GetThingShadow
(
GetThingShadow (..),
newGetThingShadow,
getThingShadow_shadowName,
getThingShadow_thingName,
GetThingShadowResponse (..),
newGetThingShadowResponse,
getThingShadowResponse_payload,
getThingShadowResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTData.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetThingShadow = GetThingShadow'
{
GetThingShadow -> Maybe Text
shadowName :: Prelude.Maybe Prelude.Text,
GetThingShadow -> Text
thingName :: Prelude.Text
}
deriving (GetThingShadow -> GetThingShadow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetThingShadow -> GetThingShadow -> Bool
$c/= :: GetThingShadow -> GetThingShadow -> Bool
== :: GetThingShadow -> GetThingShadow -> Bool
$c== :: GetThingShadow -> GetThingShadow -> Bool
Prelude.Eq, ReadPrec [GetThingShadow]
ReadPrec GetThingShadow
Int -> ReadS GetThingShadow
ReadS [GetThingShadow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetThingShadow]
$creadListPrec :: ReadPrec [GetThingShadow]
readPrec :: ReadPrec GetThingShadow
$creadPrec :: ReadPrec GetThingShadow
readList :: ReadS [GetThingShadow]
$creadList :: ReadS [GetThingShadow]
readsPrec :: Int -> ReadS GetThingShadow
$creadsPrec :: Int -> ReadS GetThingShadow
Prelude.Read, Int -> GetThingShadow -> ShowS
[GetThingShadow] -> ShowS
GetThingShadow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetThingShadow] -> ShowS
$cshowList :: [GetThingShadow] -> ShowS
show :: GetThingShadow -> String
$cshow :: GetThingShadow -> String
showsPrec :: Int -> GetThingShadow -> ShowS
$cshowsPrec :: Int -> GetThingShadow -> ShowS
Prelude.Show, forall x. Rep GetThingShadow x -> GetThingShadow
forall x. GetThingShadow -> Rep GetThingShadow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetThingShadow x -> GetThingShadow
$cfrom :: forall x. GetThingShadow -> Rep GetThingShadow x
Prelude.Generic)
newGetThingShadow ::
Prelude.Text ->
GetThingShadow
newGetThingShadow :: Text -> GetThingShadow
newGetThingShadow Text
pThingName_ =
GetThingShadow'
{ $sel:shadowName:GetThingShadow' :: Maybe Text
shadowName = forall a. Maybe a
Prelude.Nothing,
$sel:thingName:GetThingShadow' :: Text
thingName = Text
pThingName_
}
getThingShadow_shadowName :: Lens.Lens' GetThingShadow (Prelude.Maybe Prelude.Text)
getThingShadow_shadowName :: Lens' GetThingShadow (Maybe Text)
getThingShadow_shadowName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetThingShadow' {Maybe Text
shadowName :: Maybe Text
$sel:shadowName:GetThingShadow' :: GetThingShadow -> Maybe Text
shadowName} -> Maybe Text
shadowName) (\s :: GetThingShadow
s@GetThingShadow' {} Maybe Text
a -> GetThingShadow
s {$sel:shadowName:GetThingShadow' :: Maybe Text
shadowName = Maybe Text
a} :: GetThingShadow)
getThingShadow_thingName :: Lens.Lens' GetThingShadow Prelude.Text
getThingShadow_thingName :: Lens' GetThingShadow Text
getThingShadow_thingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetThingShadow' {Text
thingName :: Text
$sel:thingName:GetThingShadow' :: GetThingShadow -> Text
thingName} -> Text
thingName) (\s :: GetThingShadow
s@GetThingShadow' {} Text
a -> GetThingShadow
s {$sel:thingName:GetThingShadow' :: Text
thingName = Text
a} :: GetThingShadow)
instance Core.AWSRequest GetThingShadow where
type
AWSResponse GetThingShadow =
GetThingShadowResponse
request :: (Service -> Service) -> GetThingShadow -> Request GetThingShadow
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 GetThingShadow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetThingShadow)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int
-> ResponseHeaders -> ByteString -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveBytes
( \Int
s ResponseHeaders
h ByteString
x ->
Maybe ByteString -> Int -> GetThingShadowResponse
GetThingShadowResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. a -> Maybe a
Prelude.Just (coerce :: forall a b. Coercible a b => a -> b
Prelude.coerce ByteString
x)))
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 GetThingShadow where
hashWithSalt :: Int -> GetThingShadow -> Int
hashWithSalt Int
_salt GetThingShadow' {Maybe Text
Text
thingName :: Text
shadowName :: Maybe Text
$sel:thingName:GetThingShadow' :: GetThingShadow -> Text
$sel:shadowName:GetThingShadow' :: GetThingShadow -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
shadowName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
thingName
instance Prelude.NFData GetThingShadow where
rnf :: GetThingShadow -> ()
rnf GetThingShadow' {Maybe Text
Text
thingName :: Text
shadowName :: Maybe Text
$sel:thingName:GetThingShadow' :: GetThingShadow -> Text
$sel:shadowName:GetThingShadow' :: GetThingShadow -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
shadowName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
thingName
instance Data.ToHeaders GetThingShadow where
toHeaders :: GetThingShadow -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetThingShadow where
toPath :: GetThingShadow -> ByteString
toPath GetThingShadow' {Maybe Text
Text
thingName :: Text
shadowName :: Maybe Text
$sel:thingName:GetThingShadow' :: GetThingShadow -> Text
$sel:shadowName:GetThingShadow' :: GetThingShadow -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/things/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
thingName, ByteString
"/shadow"]
instance Data.ToQuery GetThingShadow where
toQuery :: GetThingShadow -> QueryString
toQuery GetThingShadow' {Maybe Text
Text
thingName :: Text
shadowName :: Maybe Text
$sel:thingName:GetThingShadow' :: GetThingShadow -> Text
$sel:shadowName:GetThingShadow' :: GetThingShadow -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
shadowName]
data GetThingShadowResponse = GetThingShadowResponse'
{
GetThingShadowResponse -> Maybe ByteString
payload :: Prelude.Maybe Prelude.ByteString,
GetThingShadowResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetThingShadowResponse -> GetThingShadowResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetThingShadowResponse -> GetThingShadowResponse -> Bool
$c/= :: GetThingShadowResponse -> GetThingShadowResponse -> Bool
== :: GetThingShadowResponse -> GetThingShadowResponse -> Bool
$c== :: GetThingShadowResponse -> GetThingShadowResponse -> Bool
Prelude.Eq, Int -> GetThingShadowResponse -> ShowS
[GetThingShadowResponse] -> ShowS
GetThingShadowResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetThingShadowResponse] -> ShowS
$cshowList :: [GetThingShadowResponse] -> ShowS
show :: GetThingShadowResponse -> String
$cshow :: GetThingShadowResponse -> String
showsPrec :: Int -> GetThingShadowResponse -> ShowS
$cshowsPrec :: Int -> GetThingShadowResponse -> ShowS
Prelude.Show, forall x. Rep GetThingShadowResponse x -> GetThingShadowResponse
forall x. GetThingShadowResponse -> Rep GetThingShadowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetThingShadowResponse x -> GetThingShadowResponse
$cfrom :: forall x. GetThingShadowResponse -> Rep GetThingShadowResponse x
Prelude.Generic)
newGetThingShadowResponse ::
Prelude.Int ->
GetThingShadowResponse
newGetThingShadowResponse :: Int -> GetThingShadowResponse
newGetThingShadowResponse Int
pHttpStatus_ =
GetThingShadowResponse'
{ $sel:payload:GetThingShadowResponse' :: Maybe ByteString
payload = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetThingShadowResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getThingShadowResponse_payload :: Lens.Lens' GetThingShadowResponse (Prelude.Maybe Prelude.ByteString)
getThingShadowResponse_payload :: Lens' GetThingShadowResponse (Maybe ByteString)
getThingShadowResponse_payload = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetThingShadowResponse' {Maybe ByteString
payload :: Maybe ByteString
$sel:payload:GetThingShadowResponse' :: GetThingShadowResponse -> Maybe ByteString
payload} -> Maybe ByteString
payload) (\s :: GetThingShadowResponse
s@GetThingShadowResponse' {} Maybe ByteString
a -> GetThingShadowResponse
s {$sel:payload:GetThingShadowResponse' :: Maybe ByteString
payload = Maybe ByteString
a} :: GetThingShadowResponse)
getThingShadowResponse_httpStatus :: Lens.Lens' GetThingShadowResponse Prelude.Int
getThingShadowResponse_httpStatus :: Lens' GetThingShadowResponse Int
getThingShadowResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetThingShadowResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetThingShadowResponse' :: GetThingShadowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetThingShadowResponse
s@GetThingShadowResponse' {} Int
a -> GetThingShadowResponse
s {$sel:httpStatus:GetThingShadowResponse' :: Int
httpStatus = Int
a} :: GetThingShadowResponse)
instance Prelude.NFData GetThingShadowResponse where
rnf :: GetThingShadowResponse -> ()
rnf GetThingShadowResponse' {Int
Maybe ByteString
httpStatus :: Int
payload :: Maybe ByteString
$sel:httpStatus:GetThingShadowResponse' :: GetThingShadowResponse -> Int
$sel:payload:GetThingShadowResponse' :: GetThingShadowResponse -> Maybe ByteString
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ByteString
payload
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus