{-# 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.GetRetainedMessage
(
GetRetainedMessage (..),
newGetRetainedMessage,
getRetainedMessage_topic,
GetRetainedMessageResponse (..),
newGetRetainedMessageResponse,
getRetainedMessageResponse_lastModifiedTime,
getRetainedMessageResponse_payload,
getRetainedMessageResponse_topic,
getRetainedMessageResponse_qos,
getRetainedMessageResponse_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 GetRetainedMessage = GetRetainedMessage'
{
GetRetainedMessage -> Text
topic :: Prelude.Text
}
deriving (GetRetainedMessage -> GetRetainedMessage -> Bool
(GetRetainedMessage -> GetRetainedMessage -> Bool)
-> (GetRetainedMessage -> GetRetainedMessage -> Bool)
-> Eq GetRetainedMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRetainedMessage -> GetRetainedMessage -> Bool
$c/= :: GetRetainedMessage -> GetRetainedMessage -> Bool
== :: GetRetainedMessage -> GetRetainedMessage -> Bool
$c== :: GetRetainedMessage -> GetRetainedMessage -> Bool
Prelude.Eq, ReadPrec [GetRetainedMessage]
ReadPrec GetRetainedMessage
Int -> ReadS GetRetainedMessage
ReadS [GetRetainedMessage]
(Int -> ReadS GetRetainedMessage)
-> ReadS [GetRetainedMessage]
-> ReadPrec GetRetainedMessage
-> ReadPrec [GetRetainedMessage]
-> Read GetRetainedMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRetainedMessage]
$creadListPrec :: ReadPrec [GetRetainedMessage]
readPrec :: ReadPrec GetRetainedMessage
$creadPrec :: ReadPrec GetRetainedMessage
readList :: ReadS [GetRetainedMessage]
$creadList :: ReadS [GetRetainedMessage]
readsPrec :: Int -> ReadS GetRetainedMessage
$creadsPrec :: Int -> ReadS GetRetainedMessage
Prelude.Read, Int -> GetRetainedMessage -> ShowS
[GetRetainedMessage] -> ShowS
GetRetainedMessage -> String
(Int -> GetRetainedMessage -> ShowS)
-> (GetRetainedMessage -> String)
-> ([GetRetainedMessage] -> ShowS)
-> Show GetRetainedMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRetainedMessage] -> ShowS
$cshowList :: [GetRetainedMessage] -> ShowS
show :: GetRetainedMessage -> String
$cshow :: GetRetainedMessage -> String
showsPrec :: Int -> GetRetainedMessage -> ShowS
$cshowsPrec :: Int -> GetRetainedMessage -> ShowS
Prelude.Show, (forall x. GetRetainedMessage -> Rep GetRetainedMessage x)
-> (forall x. Rep GetRetainedMessage x -> GetRetainedMessage)
-> Generic GetRetainedMessage
forall x. Rep GetRetainedMessage x -> GetRetainedMessage
forall x. GetRetainedMessage -> Rep GetRetainedMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRetainedMessage x -> GetRetainedMessage
$cfrom :: forall x. GetRetainedMessage -> Rep GetRetainedMessage x
Prelude.Generic)
newGetRetainedMessage ::
Prelude.Text ->
GetRetainedMessage
newGetRetainedMessage :: Text -> GetRetainedMessage
newGetRetainedMessage Text
pTopic_ =
GetRetainedMessage' :: Text -> GetRetainedMessage
GetRetainedMessage' {$sel:topic:GetRetainedMessage' :: Text
topic = Text
pTopic_}
getRetainedMessage_topic :: Lens.Lens' GetRetainedMessage Prelude.Text
getRetainedMessage_topic :: (Text -> f Text) -> GetRetainedMessage -> f GetRetainedMessage
getRetainedMessage_topic = (GetRetainedMessage -> Text)
-> (GetRetainedMessage -> Text -> GetRetainedMessage)
-> Lens GetRetainedMessage GetRetainedMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRetainedMessage' {Text
topic :: Text
$sel:topic:GetRetainedMessage' :: GetRetainedMessage -> Text
topic} -> Text
topic) (\s :: GetRetainedMessage
s@GetRetainedMessage' {} Text
a -> GetRetainedMessage
s {$sel:topic:GetRetainedMessage' :: Text
topic = Text
a} :: GetRetainedMessage)
instance Core.AWSRequest GetRetainedMessage where
type
AWSResponse GetRetainedMessage =
GetRetainedMessageResponse
request :: GetRetainedMessage -> Request GetRetainedMessage
request = Service -> GetRetainedMessage -> Request GetRetainedMessage
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetRetainedMessage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRetainedMessage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRetainedMessage))
-> Logger
-> Service
-> Proxy GetRetainedMessage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRetainedMessage)))
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 Integer
-> Maybe Base64
-> Maybe Text
-> Maybe Natural
-> Int
-> GetRetainedMessageResponse
GetRetainedMessageResponse'
(Maybe Integer
-> Maybe Base64
-> Maybe Text
-> Maybe Natural
-> Int
-> GetRetainedMessageResponse)
-> Either String (Maybe Integer)
-> Either
String
(Maybe Base64
-> Maybe Text
-> Maybe Natural
-> Int
-> GetRetainedMessageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"lastModifiedTime")
Either
String
(Maybe Base64
-> Maybe Text
-> Maybe Natural
-> Int
-> GetRetainedMessageResponse)
-> Either String (Maybe Base64)
-> Either
String
(Maybe Text -> Maybe Natural -> Int -> GetRetainedMessageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Base64)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"payload")
Either
String
(Maybe Text -> Maybe Natural -> Int -> GetRetainedMessageResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Natural -> Int -> GetRetainedMessageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"topic")
Either String (Maybe Natural -> Int -> GetRetainedMessageResponse)
-> Either String (Maybe Natural)
-> Either String (Int -> GetRetainedMessageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"qos")
Either String (Int -> GetRetainedMessageResponse)
-> Either String Int -> Either String GetRetainedMessageResponse
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 GetRetainedMessage
instance Prelude.NFData GetRetainedMessage
instance Core.ToHeaders GetRetainedMessage where
toHeaders :: GetRetainedMessage -> ResponseHeaders
toHeaders = ResponseHeaders -> GetRetainedMessage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetRetainedMessage where
toPath :: GetRetainedMessage -> ByteString
toPath GetRetainedMessage' {Text
topic :: Text
$sel:topic:GetRetainedMessage' :: GetRetainedMessage -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/retainedMessage/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
topic]
instance Core.ToQuery GetRetainedMessage where
toQuery :: GetRetainedMessage -> QueryString
toQuery = QueryString -> GetRetainedMessage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRetainedMessageResponse = GetRetainedMessageResponse'
{
GetRetainedMessageResponse -> Maybe Integer
lastModifiedTime :: Prelude.Maybe Prelude.Integer,
GetRetainedMessageResponse -> Maybe Base64
payload :: Prelude.Maybe Core.Base64,
GetRetainedMessageResponse -> Maybe Text
topic :: Prelude.Maybe Prelude.Text,
GetRetainedMessageResponse -> Maybe Natural
qos :: Prelude.Maybe Prelude.Natural,
GetRetainedMessageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRetainedMessageResponse -> GetRetainedMessageResponse -> Bool
(GetRetainedMessageResponse -> GetRetainedMessageResponse -> Bool)
-> (GetRetainedMessageResponse
-> GetRetainedMessageResponse -> Bool)
-> Eq GetRetainedMessageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRetainedMessageResponse -> GetRetainedMessageResponse -> Bool
$c/= :: GetRetainedMessageResponse -> GetRetainedMessageResponse -> Bool
== :: GetRetainedMessageResponse -> GetRetainedMessageResponse -> Bool
$c== :: GetRetainedMessageResponse -> GetRetainedMessageResponse -> Bool
Prelude.Eq, ReadPrec [GetRetainedMessageResponse]
ReadPrec GetRetainedMessageResponse
Int -> ReadS GetRetainedMessageResponse
ReadS [GetRetainedMessageResponse]
(Int -> ReadS GetRetainedMessageResponse)
-> ReadS [GetRetainedMessageResponse]
-> ReadPrec GetRetainedMessageResponse
-> ReadPrec [GetRetainedMessageResponse]
-> Read GetRetainedMessageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRetainedMessageResponse]
$creadListPrec :: ReadPrec [GetRetainedMessageResponse]
readPrec :: ReadPrec GetRetainedMessageResponse
$creadPrec :: ReadPrec GetRetainedMessageResponse
readList :: ReadS [GetRetainedMessageResponse]
$creadList :: ReadS [GetRetainedMessageResponse]
readsPrec :: Int -> ReadS GetRetainedMessageResponse
$creadsPrec :: Int -> ReadS GetRetainedMessageResponse
Prelude.Read, Int -> GetRetainedMessageResponse -> ShowS
[GetRetainedMessageResponse] -> ShowS
GetRetainedMessageResponse -> String
(Int -> GetRetainedMessageResponse -> ShowS)
-> (GetRetainedMessageResponse -> String)
-> ([GetRetainedMessageResponse] -> ShowS)
-> Show GetRetainedMessageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRetainedMessageResponse] -> ShowS
$cshowList :: [GetRetainedMessageResponse] -> ShowS
show :: GetRetainedMessageResponse -> String
$cshow :: GetRetainedMessageResponse -> String
showsPrec :: Int -> GetRetainedMessageResponse -> ShowS
$cshowsPrec :: Int -> GetRetainedMessageResponse -> ShowS
Prelude.Show, (forall x.
GetRetainedMessageResponse -> Rep GetRetainedMessageResponse x)
-> (forall x.
Rep GetRetainedMessageResponse x -> GetRetainedMessageResponse)
-> Generic GetRetainedMessageResponse
forall x.
Rep GetRetainedMessageResponse x -> GetRetainedMessageResponse
forall x.
GetRetainedMessageResponse -> Rep GetRetainedMessageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRetainedMessageResponse x -> GetRetainedMessageResponse
$cfrom :: forall x.
GetRetainedMessageResponse -> Rep GetRetainedMessageResponse x
Prelude.Generic)
newGetRetainedMessageResponse ::
Prelude.Int ->
GetRetainedMessageResponse
newGetRetainedMessageResponse :: Int -> GetRetainedMessageResponse
newGetRetainedMessageResponse Int
pHttpStatus_ =
GetRetainedMessageResponse' :: Maybe Integer
-> Maybe Base64
-> Maybe Text
-> Maybe Natural
-> Int
-> GetRetainedMessageResponse
GetRetainedMessageResponse'
{ $sel:lastModifiedTime:GetRetainedMessageResponse' :: Maybe Integer
lastModifiedTime =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:payload:GetRetainedMessageResponse' :: Maybe Base64
payload = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:topic:GetRetainedMessageResponse' :: Maybe Text
topic = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:qos:GetRetainedMessageResponse' :: Maybe Natural
qos = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRetainedMessageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRetainedMessageResponse_lastModifiedTime :: Lens.Lens' GetRetainedMessageResponse (Prelude.Maybe Prelude.Integer)
getRetainedMessageResponse_lastModifiedTime :: (Maybe Integer -> f (Maybe Integer))
-> GetRetainedMessageResponse -> f GetRetainedMessageResponse
getRetainedMessageResponse_lastModifiedTime = (GetRetainedMessageResponse -> Maybe Integer)
-> (GetRetainedMessageResponse
-> Maybe Integer -> GetRetainedMessageResponse)
-> Lens
GetRetainedMessageResponse
GetRetainedMessageResponse
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRetainedMessageResponse' {Maybe Integer
lastModifiedTime :: Maybe Integer
$sel:lastModifiedTime:GetRetainedMessageResponse' :: GetRetainedMessageResponse -> Maybe Integer
lastModifiedTime} -> Maybe Integer
lastModifiedTime) (\s :: GetRetainedMessageResponse
s@GetRetainedMessageResponse' {} Maybe Integer
a -> GetRetainedMessageResponse
s {$sel:lastModifiedTime:GetRetainedMessageResponse' :: Maybe Integer
lastModifiedTime = Maybe Integer
a} :: GetRetainedMessageResponse)
getRetainedMessageResponse_payload :: Lens.Lens' GetRetainedMessageResponse (Prelude.Maybe Prelude.ByteString)
getRetainedMessageResponse_payload :: (Maybe ByteString -> f (Maybe ByteString))
-> GetRetainedMessageResponse -> f GetRetainedMessageResponse
getRetainedMessageResponse_payload = (GetRetainedMessageResponse -> Maybe Base64)
-> (GetRetainedMessageResponse
-> Maybe Base64 -> GetRetainedMessageResponse)
-> Lens
GetRetainedMessageResponse
GetRetainedMessageResponse
(Maybe Base64)
(Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRetainedMessageResponse' {Maybe Base64
payload :: Maybe Base64
$sel:payload:GetRetainedMessageResponse' :: GetRetainedMessageResponse -> Maybe Base64
payload} -> Maybe Base64
payload) (\s :: GetRetainedMessageResponse
s@GetRetainedMessageResponse' {} Maybe Base64
a -> GetRetainedMessageResponse
s {$sel:payload:GetRetainedMessageResponse' :: Maybe Base64
payload = Maybe Base64
a} :: GetRetainedMessageResponse) ((Maybe Base64 -> f (Maybe Base64))
-> GetRetainedMessageResponse -> f GetRetainedMessageResponse)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> GetRetainedMessageResponse
-> f GetRetainedMessageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
(Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64
getRetainedMessageResponse_topic :: Lens.Lens' GetRetainedMessageResponse (Prelude.Maybe Prelude.Text)
getRetainedMessageResponse_topic :: (Maybe Text -> f (Maybe Text))
-> GetRetainedMessageResponse -> f GetRetainedMessageResponse
getRetainedMessageResponse_topic = (GetRetainedMessageResponse -> Maybe Text)
-> (GetRetainedMessageResponse
-> Maybe Text -> GetRetainedMessageResponse)
-> Lens
GetRetainedMessageResponse
GetRetainedMessageResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRetainedMessageResponse' {Maybe Text
topic :: Maybe Text
$sel:topic:GetRetainedMessageResponse' :: GetRetainedMessageResponse -> Maybe Text
topic} -> Maybe Text
topic) (\s :: GetRetainedMessageResponse
s@GetRetainedMessageResponse' {} Maybe Text
a -> GetRetainedMessageResponse
s {$sel:topic:GetRetainedMessageResponse' :: Maybe Text
topic = Maybe Text
a} :: GetRetainedMessageResponse)
getRetainedMessageResponse_qos :: Lens.Lens' GetRetainedMessageResponse (Prelude.Maybe Prelude.Natural)
getRetainedMessageResponse_qos :: (Maybe Natural -> f (Maybe Natural))
-> GetRetainedMessageResponse -> f GetRetainedMessageResponse
getRetainedMessageResponse_qos = (GetRetainedMessageResponse -> Maybe Natural)
-> (GetRetainedMessageResponse
-> Maybe Natural -> GetRetainedMessageResponse)
-> Lens
GetRetainedMessageResponse
GetRetainedMessageResponse
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRetainedMessageResponse' {Maybe Natural
qos :: Maybe Natural
$sel:qos:GetRetainedMessageResponse' :: GetRetainedMessageResponse -> Maybe Natural
qos} -> Maybe Natural
qos) (\s :: GetRetainedMessageResponse
s@GetRetainedMessageResponse' {} Maybe Natural
a -> GetRetainedMessageResponse
s {$sel:qos:GetRetainedMessageResponse' :: Maybe Natural
qos = Maybe Natural
a} :: GetRetainedMessageResponse)
getRetainedMessageResponse_httpStatus :: Lens.Lens' GetRetainedMessageResponse Prelude.Int
getRetainedMessageResponse_httpStatus :: (Int -> f Int)
-> GetRetainedMessageResponse -> f GetRetainedMessageResponse
getRetainedMessageResponse_httpStatus = (GetRetainedMessageResponse -> Int)
-> (GetRetainedMessageResponse
-> Int -> GetRetainedMessageResponse)
-> Lens
GetRetainedMessageResponse GetRetainedMessageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRetainedMessageResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRetainedMessageResponse' :: GetRetainedMessageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRetainedMessageResponse
s@GetRetainedMessageResponse' {} Int
a -> GetRetainedMessageResponse
s {$sel:httpStatus:GetRetainedMessageResponse' :: Int
httpStatus = Int
a} :: GetRetainedMessageResponse)
instance Prelude.NFData GetRetainedMessageResponse