Class PublishRequest
- java.lang.Object
-
- com.amazonaws.AmazonWebServiceRequest
-
- com.amazonaws.services.sns.model.PublishRequest
-
- All Implemented Interfaces:
ReadLimitInfo,Serializable,Cloneable
public class PublishRequest extends AmazonWebServiceRequest implements Serializable, Cloneable
Input for Publish action.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.amazonaws.AmazonWebServiceRequest
NOOP
-
-
Constructor Summary
Constructors Constructor Description PublishRequest()Default constructor for PublishRequest object.PublishRequest(String topicArn, String message)Constructs a new PublishRequest object.PublishRequest(String topicArn, String message, String subject)Constructs a new PublishRequest object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PublishRequestaddMessageAttributesEntry(String key, MessageAttributeValue value)PublishRequestclearMessageAttributesEntries()Removes all the entries added into MessageAttributes.PublishRequestclone()Creates a shallow clone of this request.booleanequals(Object obj)StringgetMessage()The message you want to send to the topic.Map<String,MessageAttributeValue>getMessageAttributes()Message attributes for Publish action.StringgetMessageStructure()SetMessageStructuretojsonif you want to send a different message for each protocol.StringgetSubject()Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.StringgetTargetArn()Either TopicArn or EndpointArn, but not both.StringgetTopicArn()The topic you want to publish to.inthashCode()voidsetMessage(String message)The message you want to send to the topic.voidsetMessageAttributes(Map<String,MessageAttributeValue> messageAttributes)Message attributes for Publish action.voidsetMessageStructure(String messageStructure)SetMessageStructuretojsonif you want to send a different message for each protocol.voidsetSubject(String subject)Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.voidsetTargetArn(String targetArn)Either TopicArn or EndpointArn, but not both.voidsetTopicArn(String topicArn)The topic you want to publish to.StringtoString()Returns a string representation of this object; useful for testing and debugging.PublishRequestwithMessage(String message)The message you want to send to the topic.PublishRequestwithMessageAttributes(Map<String,MessageAttributeValue> messageAttributes)Message attributes for Publish action.PublishRequestwithMessageStructure(String messageStructure)SetMessageStructuretojsonif you want to send a different message for each protocol.PublishRequestwithSubject(String subject)Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints.PublishRequestwithTargetArn(String targetArn)Either TopicArn or EndpointArn, but not both.PublishRequestwithTopicArn(String topicArn)The topic you want to publish to.-
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyBaseTo, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestCredentialsProvider, getRequestMetricCollector, getSdkClientExecutionTimeout, getSdkRequestTimeout, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestCredentialsProvider, setRequestMetricCollector, setSdkClientExecutionTimeout, setSdkRequestTimeout, withGeneralProgressListener, withRequestMetricCollector, withSdkClientExecutionTimeout, withSdkRequestTimeout
-
-
-
-
Constructor Detail
-
PublishRequest
public PublishRequest()
Default constructor for PublishRequest object. Callers should use the setter or fluent setter (with...) methods to initialize the object after creating it.
-
PublishRequest
public PublishRequest(String topicArn, String message)
Constructs a new PublishRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.- Parameters:
topicArn- The topic you want to publish to.message- The message you want to send to the topic.If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message
will cause the
Publishcall to return an error (no partial delivery).
-
PublishRequest
public PublishRequest(String topicArn, String message, String subject)
Constructs a new PublishRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.- Parameters:
topicArn- The topic you want to publish to.message- The message you want to send to the topic.If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message
will cause the
Publishcall to return an error (no partial delivery).
subject- Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.Constraints: Subjects must be ASCII text that begins with a letter, number, or punctuation mark; must not include line breaks or control characters; and must be less than 100 characters long.
-
-
Method Detail
-
setTopicArn
public void setTopicArn(String topicArn)
The topic you want to publish to.
- Parameters:
topicArn- The topic you want to publish to.
-
getTopicArn
public String getTopicArn()
The topic you want to publish to.
- Returns:
- The topic you want to publish to.
-
withTopicArn
public PublishRequest withTopicArn(String topicArn)
The topic you want to publish to.
- Parameters:
topicArn- The topic you want to publish to.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setTargetArn
public void setTargetArn(String targetArn)
Either TopicArn or EndpointArn, but not both.
- Parameters:
targetArn- Either TopicArn or EndpointArn, but not both.
-
getTargetArn
public String getTargetArn()
Either TopicArn or EndpointArn, but not both.
- Returns:
- Either TopicArn or EndpointArn, but not both.
-
withTargetArn
public PublishRequest withTargetArn(String targetArn)
Either TopicArn or EndpointArn, but not both.
- Parameters:
targetArn- Either TopicArn or EndpointArn, but not both.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setMessage
public void setMessage(String message)
The message you want to send to the topic.
If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message will
cause the
Publishcall to return an error (no partial delivery).
- Parameters:
message- The message you want to send to the topic.If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message
will cause the
Publishcall to return an error (no partial delivery).
-
getMessage
public String getMessage()
The message you want to send to the topic.
If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message will
cause the
Publishcall to return an error (no partial delivery).
- Returns:
- The message you want to send to the topic.
If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message
will cause the
Publishcall to return an error (no partial delivery).
-
withMessage
public PublishRequest withMessage(String message)
The message you want to send to the topic.
If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message will
cause the
Publishcall to return an error (no partial delivery).
- Parameters:
message- The message you want to send to the topic.If you want to send the same message to all transport protocols, include the text of the message as a String value.
If you want to send different messages for each transport protocol, set the value of the
MessageStructureparameter tojsonand use a JSON object for theMessageparameter. See the Examples section for the format of the JSON object.Constraints: Messages must be UTF-8 encoded strings at most 256 KB in size (262144 bytes, not 262144 characters).
JSON-specific constraints:
- Keys in the JSON object that correspond to supported transport protocols must have simple JSON string values.
- The values will be parsed (unescaped) before they are used in outgoing messages.
- Outbound notifications are JSON encoded (meaning that the characters will be reescaped for sending).
- Values have a minimum length of 0 (the empty string, "", is allowed).
- Values have a maximum length bounded by the overall message size (so, including multiple protocols may limit message sizes).
- Non-string values will cause the key to be ignored.
- Keys that do not correspond to supported transport protocols are ignored.
- Duplicate keys are not allowed.
- Failure to parse or validate any key or value in the message
will cause the
Publishcall to return an error (no partial delivery).
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setSubject
public void setSubject(String subject)
Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.
Constraints: Subjects must be ASCII text that begins with a letter, number, or punctuation mark; must not include line breaks or control characters; and must be less than 100 characters long.
- Parameters:
subject- Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.Constraints: Subjects must be ASCII text that begins with a letter, number, or punctuation mark; must not include line breaks or control characters; and must be less than 100 characters long.
-
getSubject
public String getSubject()
Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.
Constraints: Subjects must be ASCII text that begins with a letter, number, or punctuation mark; must not include line breaks or control characters; and must be less than 100 characters long.
- Returns:
- Optional parameter to be used as the "Subject" line when the
message is delivered to email endpoints. This field will also be
included, if present, in the standard JSON messages delivered to
other endpoints.
Constraints: Subjects must be ASCII text that begins with a letter, number, or punctuation mark; must not include line breaks or control characters; and must be less than 100 characters long.
-
withSubject
public PublishRequest withSubject(String subject)
Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.
Constraints: Subjects must be ASCII text that begins with a letter, number, or punctuation mark; must not include line breaks or control characters; and must be less than 100 characters long.
- Parameters:
subject- Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints.Constraints: Subjects must be ASCII text that begins with a letter, number, or punctuation mark; must not include line breaks or control characters; and must be less than 100 characters long.
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setMessageStructure
public void setMessageStructure(String messageStructure)
Set
MessageStructuretojsonif you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you setMessageStructuretojson, the value of theMessageparameter must:- be a syntactically valid JSON object; and
- contain at least a top-level JSON key of "default" with a value that is a string.
You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").
For information about sending different messages for each protocol using the AWS Management Console, go to Create Different Messages for Each Protocol in the Amazon Simple Notification Service Getting Started Guide.
Valid value:
json- Parameters:
messageStructure- SetMessageStructuretojsonif you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you setMessageStructuretojson, the value of theMessageparameter must:- be a syntactically valid JSON object; and
- contain at least a top-level JSON key of "default" with a value that is a string.
You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").
For information about sending different messages for each protocol using the AWS Management Console, go to Create Different Messages for Each Protocol in the Amazon Simple Notification Service Getting Started Guide.
Valid value:
json
-
getMessageStructure
public String getMessageStructure()
Set
MessageStructuretojsonif you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you setMessageStructuretojson, the value of theMessageparameter must:- be a syntactically valid JSON object; and
- contain at least a top-level JSON key of "default" with a value that is a string.
You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").
For information about sending different messages for each protocol using the AWS Management Console, go to Create Different Messages for Each Protocol in the Amazon Simple Notification Service Getting Started Guide.
Valid value:
json- Returns:
- Set
MessageStructuretojsonif you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you setMessageStructuretojson, the value of theMessageparameter must:- be a syntactically valid JSON object; and
- contain at least a top-level JSON key of "default" with a value that is a string.
You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").
For information about sending different messages for each protocol using the AWS Management Console, go to Create Different Messages for Each Protocol in the Amazon Simple Notification Service Getting Started Guide.
Valid value:
json
-
withMessageStructure
public PublishRequest withMessageStructure(String messageStructure)
Set
MessageStructuretojsonif you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you setMessageStructuretojson, the value of theMessageparameter must:- be a syntactically valid JSON object; and
- contain at least a top-level JSON key of "default" with a value that is a string.
You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").
For information about sending different messages for each protocol using the AWS Management Console, go to Create Different Messages for Each Protocol in the Amazon Simple Notification Service Getting Started Guide.
Valid value:
json- Parameters:
messageStructure- SetMessageStructuretojsonif you want to send a different message for each protocol. For example, using one publish action, you can send a short message to your SMS subscribers and a longer message to your email subscribers. If you setMessageStructuretojson, the value of theMessageparameter must:- be a syntactically valid JSON object; and
- contain at least a top-level JSON key of "default" with a value that is a string.
You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").
For information about sending different messages for each protocol using the AWS Management Console, go to Create Different Messages for Each Protocol in the Amazon Simple Notification Service Getting Started Guide.
Valid value:
json- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
getMessageAttributes
public Map<String,MessageAttributeValue> getMessageAttributes()
Message attributes for Publish action.
- Returns:
- Message attributes for Publish action.
-
setMessageAttributes
public void setMessageAttributes(Map<String,MessageAttributeValue> messageAttributes)
Message attributes for Publish action.
- Parameters:
messageAttributes- Message attributes for Publish action.
-
withMessageAttributes
public PublishRequest withMessageAttributes(Map<String,MessageAttributeValue> messageAttributes)
Message attributes for Publish action.
- Parameters:
messageAttributes- Message attributes for Publish action.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
addMessageAttributesEntry
public PublishRequest addMessageAttributesEntry(String key, MessageAttributeValue value)
-
clearMessageAttributesEntries
public PublishRequest clearMessageAttributesEntries()
Removes all the entries added into MessageAttributes. <p> Returns a reference to this object so that method calls can be chained together.
-
toString
public String toString()
Returns a string representation of this object; useful for testing and debugging.- Overrides:
toStringin classObject- Returns:
- A string representation of this object.
- See Also:
Object.toString()
-
clone
public PublishRequest clone()
Description copied from class:AmazonWebServiceRequestCreates a shallow clone of this request. Explicitly does not clone the deep structure of the request object.- Overrides:
clonein classAmazonWebServiceRequest- See Also:
Object.clone()
-
-