Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Publishes an MQTT message.
Requires permission to access the Publish action.
For more information about MQTT messages, see MQTT Protocol in the IoT Developer Guide.
For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.
Synopsis
- data Publish = Publish' {}
- newPublish :: Text -> Publish
- publish_contentType :: Lens' Publish (Maybe Text)
- publish_correlationData :: Lens' Publish (Maybe Text)
- publish_messageExpiry :: Lens' Publish (Maybe Integer)
- publish_payload :: Lens' Publish (Maybe ByteString)
- publish_payloadFormatIndicator :: Lens' Publish (Maybe PayloadFormatIndicator)
- publish_qos :: Lens' Publish (Maybe Natural)
- publish_responseTopic :: Lens' Publish (Maybe Text)
- publish_retain :: Lens' Publish (Maybe Bool)
- publish_userProperties :: Lens' Publish (Maybe Text)
- publish_topic :: Lens' Publish Text
- data PublishResponse = PublishResponse' {
- newPublishResponse :: PublishResponse
Creating a Request
The input for the Publish operation.
See: newPublish
smart constructor.
Publish' | |
|
Instances
Create a value of Publish
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:contentType:Publish'
, publish_contentType
- A UTF-8 encoded string that describes the content of the publishing
message.
$sel:correlationData:Publish'
, publish_correlationData
- The base64-encoded binary data used by the sender of the request message
to identify which request the response message is for when it's
received. correlationData
is an HTTP header value in the API.
$sel:messageExpiry:Publish'
, publish_messageExpiry
- A user-defined integer value that represents the message expiry interval
in seconds. If absent, the message doesn't expire. For more information
about the limits of messageExpiry
, see
Amazon Web Services IoT Core message broker and protocol limits and quotas
from the Amazon Web Services Reference Guide.
$sel:payload:Publish'
, publish_payload
- The message body. MQTT accepts text, binary, and empty (null) message
payloads.
Publishing an empty (null) payload with retain = true
deletes the
retained message identified by topic from Amazon Web Services IoT
Core.
$sel:payloadFormatIndicator:Publish'
, publish_payloadFormatIndicator
- An Enum
string value that indicates whether the payload is formatted
as UTF-8. payloadFormatIndicator
is an HTTP header value in the API.
Publish
, publish_qos
- The Quality of Service (QoS) level. The default QoS level is 0.
$sel:responseTopic:Publish'
, publish_responseTopic
- A UTF-8 encoded string that's used as the topic name for a response
message. The response topic is used to describe the topic which the
receiver should publish to as part of the request-response flow. The
topic must not contain wildcard characters.
$sel:retain:Publish'
, publish_retain
- A Boolean value that determines whether to set the RETAIN flag when the
message is published.
Setting the RETAIN flag causes the message to be retained and sent to new subscribers to the topic.
Valid values: true
| false
Default value: false
$sel:userProperties:Publish'
, publish_userProperties
- A JSON string that contains an array of JSON objects. If you don’t use
Amazon Web Services SDK or CLI, you must encode the JSON string to
base64 format before adding it to the HTTP header. userProperties
is
an HTTP header value in the API.
The following example userProperties
parameter is a JSON string which
represents two User Properties. Note that it needs to be base64-encoded:
[{"deviceName": "alpha"}, {"deviceCnt": "45"}]
Publish
, publish_topic
- The name of the MQTT topic.
Request Lenses
publish_contentType :: Lens' Publish (Maybe Text) Source #
A UTF-8 encoded string that describes the content of the publishing message.
publish_correlationData :: Lens' Publish (Maybe Text) Source #
The base64-encoded binary data used by the sender of the request message
to identify which request the response message is for when it's
received. correlationData
is an HTTP header value in the API.
publish_messageExpiry :: Lens' Publish (Maybe Integer) Source #
A user-defined integer value that represents the message expiry interval
in seconds. If absent, the message doesn't expire. For more information
about the limits of messageExpiry
, see
Amazon Web Services IoT Core message broker and protocol limits and quotas
from the Amazon Web Services Reference Guide.
publish_payload :: Lens' Publish (Maybe ByteString) Source #
The message body. MQTT accepts text, binary, and empty (null) message payloads.
Publishing an empty (null) payload with retain = true
deletes the
retained message identified by topic from Amazon Web Services IoT
Core.
publish_payloadFormatIndicator :: Lens' Publish (Maybe PayloadFormatIndicator) Source #
An Enum
string value that indicates whether the payload is formatted
as UTF-8. payloadFormatIndicator
is an HTTP header value in the API.
publish_qos :: Lens' Publish (Maybe Natural) Source #
The Quality of Service (QoS) level. The default QoS level is 0.
publish_responseTopic :: Lens' Publish (Maybe Text) Source #
A UTF-8 encoded string that's used as the topic name for a response message. The response topic is used to describe the topic which the receiver should publish to as part of the request-response flow. The topic must not contain wildcard characters.
publish_retain :: Lens' Publish (Maybe Bool) Source #
A Boolean value that determines whether to set the RETAIN flag when the message is published.
Setting the RETAIN flag causes the message to be retained and sent to new subscribers to the topic.
Valid values: true
| false
Default value: false
publish_userProperties :: Lens' Publish (Maybe Text) Source #
A JSON string that contains an array of JSON objects. If you don’t use
Amazon Web Services SDK or CLI, you must encode the JSON string to
base64 format before adding it to the HTTP header. userProperties
is
an HTTP header value in the API.
The following example userProperties
parameter is a JSON string which
represents two User Properties. Note that it needs to be base64-encoded:
[{"deviceName": "alpha"}, {"deviceCnt": "45"}]
Destructuring the Response
data PublishResponse Source #
See: newPublishResponse
smart constructor.
Instances
Generic PublishResponse Source # | |
Defined in Amazonka.IoTData.Publish type Rep PublishResponse :: Type -> Type # from :: PublishResponse -> Rep PublishResponse x # to :: Rep PublishResponse x -> PublishResponse # | |
Read PublishResponse Source # | |
Defined in Amazonka.IoTData.Publish | |
Show PublishResponse Source # | |
Defined in Amazonka.IoTData.Publish showsPrec :: Int -> PublishResponse -> ShowS # show :: PublishResponse -> String # showList :: [PublishResponse] -> ShowS # | |
NFData PublishResponse Source # | |
Defined in Amazonka.IoTData.Publish rnf :: PublishResponse -> () # | |
Eq PublishResponse Source # | |
Defined in Amazonka.IoTData.Publish (==) :: PublishResponse -> PublishResponse -> Bool # (/=) :: PublishResponse -> PublishResponse -> Bool # | |
type Rep PublishResponse Source # | |
newPublishResponse :: PublishResponse Source #
Create a value of PublishResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.