{-# 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.Publish
(
Publish (..),
newPublish,
publish_retain,
publish_payload,
publish_qos,
publish_topic,
PublishResponse (..),
newPublishResponse,
)
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 Publish = Publish'
{
Publish -> Maybe Bool
retain :: Prelude.Maybe Prelude.Bool,
Publish -> Maybe ByteString
payload :: Prelude.Maybe Prelude.ByteString,
Publish -> Maybe Natural
qos :: Prelude.Maybe Prelude.Natural,
Publish -> Text
topic :: Prelude.Text
}
deriving (Publish -> Publish -> Bool
(Publish -> Publish -> Bool)
-> (Publish -> Publish -> Bool) -> Eq Publish
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Publish -> Publish -> Bool
$c/= :: Publish -> Publish -> Bool
== :: Publish -> Publish -> Bool
$c== :: Publish -> Publish -> Bool
Prelude.Eq, ReadPrec [Publish]
ReadPrec Publish
Int -> ReadS Publish
ReadS [Publish]
(Int -> ReadS Publish)
-> ReadS [Publish]
-> ReadPrec Publish
-> ReadPrec [Publish]
-> Read Publish
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Publish]
$creadListPrec :: ReadPrec [Publish]
readPrec :: ReadPrec Publish
$creadPrec :: ReadPrec Publish
readList :: ReadS [Publish]
$creadList :: ReadS [Publish]
readsPrec :: Int -> ReadS Publish
$creadsPrec :: Int -> ReadS Publish
Prelude.Read, Int -> Publish -> ShowS
[Publish] -> ShowS
Publish -> String
(Int -> Publish -> ShowS)
-> (Publish -> String) -> ([Publish] -> ShowS) -> Show Publish
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Publish] -> ShowS
$cshowList :: [Publish] -> ShowS
show :: Publish -> String
$cshow :: Publish -> String
showsPrec :: Int -> Publish -> ShowS
$cshowsPrec :: Int -> Publish -> ShowS
Prelude.Show, (forall x. Publish -> Rep Publish x)
-> (forall x. Rep Publish x -> Publish) -> Generic Publish
forall x. Rep Publish x -> Publish
forall x. Publish -> Rep Publish x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Publish x -> Publish
$cfrom :: forall x. Publish -> Rep Publish x
Prelude.Generic)
newPublish ::
Prelude.Text ->
Publish
newPublish :: Text -> Publish
newPublish Text
pTopic_ =
Publish' :: Maybe Bool -> Maybe ByteString -> Maybe Natural -> Text -> Publish
Publish'
{ $sel:retain:Publish' :: Maybe Bool
retain = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:payload:Publish' :: Maybe ByteString
payload = Maybe ByteString
forall a. Maybe a
Prelude.Nothing,
$sel:qos:Publish' :: Maybe Natural
qos = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:topic:Publish' :: Text
topic = Text
pTopic_
}
publish_retain :: Lens.Lens' Publish (Prelude.Maybe Prelude.Bool)
publish_retain :: (Maybe Bool -> f (Maybe Bool)) -> Publish -> f Publish
publish_retain = (Publish -> Maybe Bool)
-> (Publish -> Maybe Bool -> Publish)
-> Lens Publish Publish (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Publish' {Maybe Bool
retain :: Maybe Bool
$sel:retain:Publish' :: Publish -> Maybe Bool
retain} -> Maybe Bool
retain) (\s :: Publish
s@Publish' {} Maybe Bool
a -> Publish
s {$sel:retain:Publish' :: Maybe Bool
retain = Maybe Bool
a} :: Publish)
publish_payload :: Lens.Lens' Publish (Prelude.Maybe Prelude.ByteString)
publish_payload :: (Maybe ByteString -> f (Maybe ByteString)) -> Publish -> f Publish
publish_payload = (Publish -> Maybe ByteString)
-> (Publish -> Maybe ByteString -> Publish)
-> Lens Publish Publish (Maybe ByteString) (Maybe ByteString)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Publish' {Maybe ByteString
payload :: Maybe ByteString
$sel:payload:Publish' :: Publish -> Maybe ByteString
payload} -> Maybe ByteString
payload) (\s :: Publish
s@Publish' {} Maybe ByteString
a -> Publish
s {$sel:payload:Publish' :: Maybe ByteString
payload = Maybe ByteString
a} :: Publish)
publish_qos :: Lens.Lens' Publish (Prelude.Maybe Prelude.Natural)
publish_qos :: (Maybe Natural -> f (Maybe Natural)) -> Publish -> f Publish
publish_qos = (Publish -> Maybe Natural)
-> (Publish -> Maybe Natural -> Publish)
-> Lens Publish Publish (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Publish' {Maybe Natural
qos :: Maybe Natural
$sel:qos:Publish' :: Publish -> Maybe Natural
qos} -> Maybe Natural
qos) (\s :: Publish
s@Publish' {} Maybe Natural
a -> Publish
s {$sel:qos:Publish' :: Maybe Natural
qos = Maybe Natural
a} :: Publish)
publish_topic :: Lens.Lens' Publish Prelude.Text
publish_topic :: (Text -> f Text) -> Publish -> f Publish
publish_topic = (Publish -> Text)
-> (Publish -> Text -> Publish) -> Lens Publish Publish Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Publish' {Text
topic :: Text
$sel:topic:Publish' :: Publish -> Text
topic} -> Text
topic) (\s :: Publish
s@Publish' {} Text
a -> Publish
s {$sel:topic:Publish' :: Text
topic = Text
a} :: Publish)
instance Core.AWSRequest Publish where
type AWSResponse Publish = PublishResponse
request :: Publish -> Request Publish
request = Service -> Publish -> Request Publish
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.postBody Service
defaultService
response :: Logger
-> Service
-> Proxy Publish
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse Publish)))
response = AWSResponse Publish
-> Logger
-> Service
-> Proxy Publish
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse Publish)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse Publish
PublishResponse
PublishResponse'
instance Prelude.Hashable Publish
instance Prelude.NFData Publish
instance Core.ToBody Publish where
toBody :: Publish -> RequestBody
toBody Publish' {Maybe Bool
Maybe Natural
Maybe ByteString
Text
topic :: Text
qos :: Maybe Natural
payload :: Maybe ByteString
retain :: Maybe Bool
$sel:topic:Publish' :: Publish -> Text
$sel:qos:Publish' :: Publish -> Maybe Natural
$sel:payload:Publish' :: Publish -> Maybe ByteString
$sel:retain:Publish' :: Publish -> Maybe Bool
..} = Maybe ByteString -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody Maybe ByteString
payload
instance Core.ToHeaders Publish where
toHeaders :: Publish -> [Header]
toHeaders = [Header] -> Publish -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath Publish where
toPath :: Publish -> ByteString
toPath Publish' {Maybe Bool
Maybe Natural
Maybe ByteString
Text
topic :: Text
qos :: Maybe Natural
payload :: Maybe ByteString
retain :: Maybe Bool
$sel:topic:Publish' :: Publish -> Text
$sel:qos:Publish' :: Publish -> Maybe Natural
$sel:payload:Publish' :: Publish -> Maybe ByteString
$sel:retain:Publish' :: Publish -> Maybe Bool
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/topics/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
topic]
instance Core.ToQuery Publish where
toQuery :: Publish -> QueryString
toQuery Publish' {Maybe Bool
Maybe Natural
Maybe ByteString
Text
topic :: Text
qos :: Maybe Natural
payload :: Maybe ByteString
retain :: Maybe Bool
$sel:topic:Publish' :: Publish -> Text
$sel:qos:Publish' :: Publish -> Maybe Natural
$sel:payload:Publish' :: Publish -> Maybe ByteString
$sel:retain:Publish' :: Publish -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"retain" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
retain, ByteString
"qos" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
qos]
data PublishResponse = PublishResponse'
{
}
deriving (PublishResponse -> PublishResponse -> Bool
(PublishResponse -> PublishResponse -> Bool)
-> (PublishResponse -> PublishResponse -> Bool)
-> Eq PublishResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublishResponse -> PublishResponse -> Bool
$c/= :: PublishResponse -> PublishResponse -> Bool
== :: PublishResponse -> PublishResponse -> Bool
$c== :: PublishResponse -> PublishResponse -> Bool
Prelude.Eq, ReadPrec [PublishResponse]
ReadPrec PublishResponse
Int -> ReadS PublishResponse
ReadS [PublishResponse]
(Int -> ReadS PublishResponse)
-> ReadS [PublishResponse]
-> ReadPrec PublishResponse
-> ReadPrec [PublishResponse]
-> Read PublishResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublishResponse]
$creadListPrec :: ReadPrec [PublishResponse]
readPrec :: ReadPrec PublishResponse
$creadPrec :: ReadPrec PublishResponse
readList :: ReadS [PublishResponse]
$creadList :: ReadS [PublishResponse]
readsPrec :: Int -> ReadS PublishResponse
$creadsPrec :: Int -> ReadS PublishResponse
Prelude.Read, Int -> PublishResponse -> ShowS
[PublishResponse] -> ShowS
PublishResponse -> String
(Int -> PublishResponse -> ShowS)
-> (PublishResponse -> String)
-> ([PublishResponse] -> ShowS)
-> Show PublishResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublishResponse] -> ShowS
$cshowList :: [PublishResponse] -> ShowS
show :: PublishResponse -> String
$cshow :: PublishResponse -> String
showsPrec :: Int -> PublishResponse -> ShowS
$cshowsPrec :: Int -> PublishResponse -> ShowS
Prelude.Show, (forall x. PublishResponse -> Rep PublishResponse x)
-> (forall x. Rep PublishResponse x -> PublishResponse)
-> Generic PublishResponse
forall x. Rep PublishResponse x -> PublishResponse
forall x. PublishResponse -> Rep PublishResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublishResponse x -> PublishResponse
$cfrom :: forall x. PublishResponse -> Rep PublishResponse x
Prelude.Generic)
newPublishResponse ::
PublishResponse
newPublishResponse :: PublishResponse
newPublishResponse = PublishResponse
PublishResponse'
instance Prelude.NFData PublishResponse