{-# 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.UpdateThingShadow
(
UpdateThingShadow (..),
newUpdateThingShadow,
updateThingShadow_shadowName,
updateThingShadow_thingName,
updateThingShadow_payload,
UpdateThingShadowResponse (..),
newUpdateThingShadowResponse,
updateThingShadowResponse_payload,
updateThingShadowResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTData.Types
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 UpdateThingShadow = UpdateThingShadow'
{
UpdateThingShadow -> Maybe Text
shadowName :: Prelude.Maybe Prelude.Text,
UpdateThingShadow -> Text
thingName :: Prelude.Text,
UpdateThingShadow -> ByteString
payload :: Prelude.ByteString
}
deriving (UpdateThingShadow -> UpdateThingShadow -> Bool
(UpdateThingShadow -> UpdateThingShadow -> Bool)
-> (UpdateThingShadow -> UpdateThingShadow -> Bool)
-> Eq UpdateThingShadow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateThingShadow -> UpdateThingShadow -> Bool
$c/= :: UpdateThingShadow -> UpdateThingShadow -> Bool
== :: UpdateThingShadow -> UpdateThingShadow -> Bool
$c== :: UpdateThingShadow -> UpdateThingShadow -> Bool
Prelude.Eq, Int -> UpdateThingShadow -> ShowS
[UpdateThingShadow] -> ShowS
UpdateThingShadow -> String
(Int -> UpdateThingShadow -> ShowS)
-> (UpdateThingShadow -> String)
-> ([UpdateThingShadow] -> ShowS)
-> Show UpdateThingShadow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateThingShadow] -> ShowS
$cshowList :: [UpdateThingShadow] -> ShowS
show :: UpdateThingShadow -> String
$cshow :: UpdateThingShadow -> String
showsPrec :: Int -> UpdateThingShadow -> ShowS
$cshowsPrec :: Int -> UpdateThingShadow -> ShowS
Prelude.Show, (forall x. UpdateThingShadow -> Rep UpdateThingShadow x)
-> (forall x. Rep UpdateThingShadow x -> UpdateThingShadow)
-> Generic UpdateThingShadow
forall x. Rep UpdateThingShadow x -> UpdateThingShadow
forall x. UpdateThingShadow -> Rep UpdateThingShadow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateThingShadow x -> UpdateThingShadow
$cfrom :: forall x. UpdateThingShadow -> Rep UpdateThingShadow x
Prelude.Generic)
newUpdateThingShadow ::
Prelude.Text ->
Prelude.ByteString ->
UpdateThingShadow
newUpdateThingShadow :: Text -> ByteString -> UpdateThingShadow
newUpdateThingShadow Text
pThingName_ ByteString
pPayload_ =
UpdateThingShadow' :: Maybe Text -> Text -> ByteString -> UpdateThingShadow
UpdateThingShadow'
{ $sel:shadowName:UpdateThingShadow' :: Maybe Text
shadowName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:thingName:UpdateThingShadow' :: Text
thingName = Text
pThingName_,
$sel:payload:UpdateThingShadow' :: ByteString
payload = ByteString
pPayload_
}
updateThingShadow_shadowName :: Lens.Lens' UpdateThingShadow (Prelude.Maybe Prelude.Text)
updateThingShadow_shadowName :: (Maybe Text -> f (Maybe Text))
-> UpdateThingShadow -> f UpdateThingShadow
updateThingShadow_shadowName = (UpdateThingShadow -> Maybe Text)
-> (UpdateThingShadow -> Maybe Text -> UpdateThingShadow)
-> Lens
UpdateThingShadow UpdateThingShadow (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingShadow' {Maybe Text
shadowName :: Maybe Text
$sel:shadowName:UpdateThingShadow' :: UpdateThingShadow -> Maybe Text
shadowName} -> Maybe Text
shadowName) (\s :: UpdateThingShadow
s@UpdateThingShadow' {} Maybe Text
a -> UpdateThingShadow
s {$sel:shadowName:UpdateThingShadow' :: Maybe Text
shadowName = Maybe Text
a} :: UpdateThingShadow)
updateThingShadow_thingName :: Lens.Lens' UpdateThingShadow Prelude.Text
updateThingShadow_thingName :: (Text -> f Text) -> UpdateThingShadow -> f UpdateThingShadow
updateThingShadow_thingName = (UpdateThingShadow -> Text)
-> (UpdateThingShadow -> Text -> UpdateThingShadow)
-> Lens UpdateThingShadow UpdateThingShadow Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingShadow' {Text
thingName :: Text
$sel:thingName:UpdateThingShadow' :: UpdateThingShadow -> Text
thingName} -> Text
thingName) (\s :: UpdateThingShadow
s@UpdateThingShadow' {} Text
a -> UpdateThingShadow
s {$sel:thingName:UpdateThingShadow' :: Text
thingName = Text
a} :: UpdateThingShadow)
updateThingShadow_payload :: Lens.Lens' UpdateThingShadow Prelude.ByteString
updateThingShadow_payload :: (ByteString -> f ByteString)
-> UpdateThingShadow -> f UpdateThingShadow
updateThingShadow_payload = (UpdateThingShadow -> ByteString)
-> (UpdateThingShadow -> ByteString -> UpdateThingShadow)
-> Lens UpdateThingShadow UpdateThingShadow ByteString ByteString
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingShadow' {ByteString
payload :: ByteString
$sel:payload:UpdateThingShadow' :: UpdateThingShadow -> ByteString
payload} -> ByteString
payload) (\s :: UpdateThingShadow
s@UpdateThingShadow' {} ByteString
a -> UpdateThingShadow
s {$sel:payload:UpdateThingShadow' :: ByteString
payload = ByteString
a} :: UpdateThingShadow)
instance Core.AWSRequest UpdateThingShadow where
type
AWSResponse UpdateThingShadow =
UpdateThingShadowResponse
request :: UpdateThingShadow -> Request UpdateThingShadow
request = Service -> UpdateThingShadow -> Request UpdateThingShadow
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.postBody Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateThingShadow
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateThingShadow)))
response =
(Int
-> ResponseHeaders
-> ByteString
-> Either String (AWSResponse UpdateThingShadow))
-> Logger
-> Service
-> Proxy UpdateThingShadow
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateThingShadow)))
forall (m :: * -> *) a.
MonadResource m =>
(Int
-> ResponseHeaders -> ByteString -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveBytes
( \Int
s ResponseHeaders
h ByteString
x ->
Maybe ByteString -> Int -> UpdateThingShadowResponse
UpdateThingShadowResponse'
(Maybe ByteString -> Int -> UpdateThingShadowResponse)
-> Either String (Maybe ByteString)
-> Either String (Int -> UpdateThingShadowResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Maybe ByteString -> Either String (Maybe ByteString)
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (ByteString -> Maybe ByteString
forall a. a -> Maybe a
Prelude.Just (ByteString -> ByteString
Prelude.coerce ByteString
x)))
Either String (Int -> UpdateThingShadowResponse)
-> Either String Int -> Either String UpdateThingShadowResponse
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 UpdateThingShadow
instance Prelude.NFData UpdateThingShadow
instance Core.ToBody UpdateThingShadow where
toBody :: UpdateThingShadow -> RequestBody
toBody UpdateThingShadow' {Maybe Text
ByteString
Text
payload :: ByteString
thingName :: Text
shadowName :: Maybe Text
$sel:payload:UpdateThingShadow' :: UpdateThingShadow -> ByteString
$sel:thingName:UpdateThingShadow' :: UpdateThingShadow -> Text
$sel:shadowName:UpdateThingShadow' :: UpdateThingShadow -> Maybe Text
..} = ByteString -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody ByteString
payload
instance Core.ToHeaders UpdateThingShadow where
toHeaders :: UpdateThingShadow -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateThingShadow -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath UpdateThingShadow where
toPath :: UpdateThingShadow -> ByteString
toPath UpdateThingShadow' {Maybe Text
ByteString
Text
payload :: ByteString
thingName :: Text
shadowName :: Maybe Text
$sel:payload:UpdateThingShadow' :: UpdateThingShadow -> ByteString
$sel:thingName:UpdateThingShadow' :: UpdateThingShadow -> Text
$sel:shadowName:UpdateThingShadow' :: UpdateThingShadow -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/things/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
thingName, ByteString
"/shadow"]
instance Core.ToQuery UpdateThingShadow where
toQuery :: UpdateThingShadow -> QueryString
toQuery UpdateThingShadow' {Maybe Text
ByteString
Text
payload :: ByteString
thingName :: Text
shadowName :: Maybe Text
$sel:payload:UpdateThingShadow' :: UpdateThingShadow -> ByteString
$sel:thingName:UpdateThingShadow' :: UpdateThingShadow -> Text
$sel:shadowName:UpdateThingShadow' :: UpdateThingShadow -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"name" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
shadowName]
data UpdateThingShadowResponse = UpdateThingShadowResponse'
{
UpdateThingShadowResponse -> Maybe ByteString
payload :: Prelude.Maybe Prelude.ByteString,
UpdateThingShadowResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateThingShadowResponse -> UpdateThingShadowResponse -> Bool
(UpdateThingShadowResponse -> UpdateThingShadowResponse -> Bool)
-> (UpdateThingShadowResponse -> UpdateThingShadowResponse -> Bool)
-> Eq UpdateThingShadowResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateThingShadowResponse -> UpdateThingShadowResponse -> Bool
$c/= :: UpdateThingShadowResponse -> UpdateThingShadowResponse -> Bool
== :: UpdateThingShadowResponse -> UpdateThingShadowResponse -> Bool
$c== :: UpdateThingShadowResponse -> UpdateThingShadowResponse -> Bool
Prelude.Eq, Int -> UpdateThingShadowResponse -> ShowS
[UpdateThingShadowResponse] -> ShowS
UpdateThingShadowResponse -> String
(Int -> UpdateThingShadowResponse -> ShowS)
-> (UpdateThingShadowResponse -> String)
-> ([UpdateThingShadowResponse] -> ShowS)
-> Show UpdateThingShadowResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateThingShadowResponse] -> ShowS
$cshowList :: [UpdateThingShadowResponse] -> ShowS
show :: UpdateThingShadowResponse -> String
$cshow :: UpdateThingShadowResponse -> String
showsPrec :: Int -> UpdateThingShadowResponse -> ShowS
$cshowsPrec :: Int -> UpdateThingShadowResponse -> ShowS
Prelude.Show, (forall x.
UpdateThingShadowResponse -> Rep UpdateThingShadowResponse x)
-> (forall x.
Rep UpdateThingShadowResponse x -> UpdateThingShadowResponse)
-> Generic UpdateThingShadowResponse
forall x.
Rep UpdateThingShadowResponse x -> UpdateThingShadowResponse
forall x.
UpdateThingShadowResponse -> Rep UpdateThingShadowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateThingShadowResponse x -> UpdateThingShadowResponse
$cfrom :: forall x.
UpdateThingShadowResponse -> Rep UpdateThingShadowResponse x
Prelude.Generic)
newUpdateThingShadowResponse ::
Prelude.Int ->
UpdateThingShadowResponse
newUpdateThingShadowResponse :: Int -> UpdateThingShadowResponse
newUpdateThingShadowResponse Int
pHttpStatus_ =
UpdateThingShadowResponse' :: Maybe ByteString -> Int -> UpdateThingShadowResponse
UpdateThingShadowResponse'
{ $sel:payload:UpdateThingShadowResponse' :: Maybe ByteString
payload =
Maybe ByteString
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateThingShadowResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateThingShadowResponse_payload :: Lens.Lens' UpdateThingShadowResponse (Prelude.Maybe Prelude.ByteString)
updateThingShadowResponse_payload :: (Maybe ByteString -> f (Maybe ByteString))
-> UpdateThingShadowResponse -> f UpdateThingShadowResponse
updateThingShadowResponse_payload = (UpdateThingShadowResponse -> Maybe ByteString)
-> (UpdateThingShadowResponse
-> Maybe ByteString -> UpdateThingShadowResponse)
-> Lens
UpdateThingShadowResponse
UpdateThingShadowResponse
(Maybe ByteString)
(Maybe ByteString)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingShadowResponse' {Maybe ByteString
payload :: Maybe ByteString
$sel:payload:UpdateThingShadowResponse' :: UpdateThingShadowResponse -> Maybe ByteString
payload} -> Maybe ByteString
payload) (\s :: UpdateThingShadowResponse
s@UpdateThingShadowResponse' {} Maybe ByteString
a -> UpdateThingShadowResponse
s {$sel:payload:UpdateThingShadowResponse' :: Maybe ByteString
payload = Maybe ByteString
a} :: UpdateThingShadowResponse)
updateThingShadowResponse_httpStatus :: Lens.Lens' UpdateThingShadowResponse Prelude.Int
updateThingShadowResponse_httpStatus :: (Int -> f Int)
-> UpdateThingShadowResponse -> f UpdateThingShadowResponse
updateThingShadowResponse_httpStatus = (UpdateThingShadowResponse -> Int)
-> (UpdateThingShadowResponse -> Int -> UpdateThingShadowResponse)
-> Lens UpdateThingShadowResponse UpdateThingShadowResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateThingShadowResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateThingShadowResponse' :: UpdateThingShadowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateThingShadowResponse
s@UpdateThingShadowResponse' {} Int
a -> UpdateThingShadowResponse
s {$sel:httpStatus:UpdateThingShadowResponse' :: Int
httpStatus = Int
a} :: UpdateThingShadowResponse)
instance Prelude.NFData UpdateThingShadowResponse