amazonka-iot-dataplane-2.0: Amazon IoT Data Plane SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.IoTData.Publish

Description

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

Creating a Request

data Publish Source #

The input for the Publish operation.

See: newPublish smart constructor.

Constructors

Publish' 

Fields

  • contentType :: Maybe Text

    A UTF-8 encoded string that describes the content of the publishing message.

  • correlationData :: Maybe Text

    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.

  • messageExpiry :: Maybe Integer

    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.

  • payload :: Maybe ByteString

    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.

  • payloadFormatIndicator :: Maybe PayloadFormatIndicator

    An Enum string value that indicates whether the payload is formatted as UTF-8. payloadFormatIndicator is an HTTP header value in the API.

  • qos :: Maybe Natural

    The Quality of Service (QoS) level. The default QoS level is 0.

  • responseTopic :: Maybe Text

    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.

  • retain :: Maybe Bool

    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

  • userProperties :: Maybe Text

    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"}]
  • topic :: Text

    The name of the MQTT topic.

Instances

Instances details
ToBody Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

ToHeaders Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Methods

toHeaders :: Publish -> [Header] #

ToPath Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Methods

toPath :: Publish -> ByteString #

ToQuery Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

AWSRequest Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Associated Types

type AWSResponse Publish #

Generic Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Associated Types

type Rep Publish :: Type -> Type #

Methods

from :: Publish -> Rep Publish x #

to :: Rep Publish x -> Publish #

Read Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Show Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

NFData Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Methods

rnf :: Publish -> () #

Eq Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Methods

(==) :: Publish -> Publish -> Bool #

(/=) :: Publish -> Publish -> Bool #

Hashable Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Methods

hashWithSalt :: Int -> Publish -> Int #

hash :: Publish -> Int #

type AWSResponse Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

type Rep Publish Source # 
Instance details

Defined in Amazonka.IoTData.Publish

newPublish Source #

Arguments

:: Text

Publish

-> Publish 

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"}]

publish_topic :: Lens' Publish Text Source #

The name of the MQTT topic.

Destructuring the Response

data PublishResponse Source #

See: newPublishResponse smart constructor.

Constructors

PublishResponse' 

Instances

Instances details
Generic PublishResponse Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Associated Types

type Rep PublishResponse :: Type -> Type #

Read PublishResponse Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Show PublishResponse Source # 
Instance details

Defined in Amazonka.IoTData.Publish

NFData PublishResponse Source # 
Instance details

Defined in Amazonka.IoTData.Publish

Methods

rnf :: PublishResponse -> () #

Eq PublishResponse Source # 
Instance details

Defined in Amazonka.IoTData.Publish

type Rep PublishResponse Source # 
Instance details

Defined in Amazonka.IoTData.Publish

type Rep PublishResponse = D1 ('MetaData "PublishResponse" "Amazonka.IoTData.Publish" "amazonka-iot-dataplane-2.0-Fdc9p3E1INX2O9pOv9RFV7" 'False) (C1 ('MetaCons "PublishResponse'" 'PrefixI 'False) (U1 :: Type -> Type))

newPublishResponse :: PublishResponse Source #

Create a value of PublishResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.