/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/PublishRequest.java

https://gitlab.com/github-cloud-corp/aws-sdk-java · Java · 1451 lines · 114 code · 51 blank · 1286 comment · 6 complexity · 2b05d9c6574fbdec416d5f3526051533 MD5 · raw file

  1. /*
  2. * Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"). You may not
  5. * use this file except in compliance with the License. A copy of the License is
  6. * located at
  7. *
  8. * http://aws.amazon.com/apache2.0
  9. *
  10. * or in the "license" file accompanying this file. This file is distributed on
  11. * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. * express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. package com.amazonaws.services.sns.model;
  16. import java.io.Serializable;
  17. import com.amazonaws.AmazonWebServiceRequest;
  18. /**
  19. * <p>
  20. * Input for Publish action.
  21. * </p>
  22. */
  23. public class PublishRequest extends AmazonWebServiceRequest implements
  24. Serializable, Cloneable {
  25. /**
  26. * <p>
  27. * The topic you want to publish to.
  28. * </p>
  29. * <p>
  30. * If you don't specify a value for the <code>TopicArn</code> parameter, you
  31. * must specify a value for the <code>PhoneNumber</code> or
  32. * <code>TargetArn</code> parameters.
  33. * </p>
  34. */
  35. private String topicArn;
  36. /**
  37. * <p>
  38. * Either TopicArn or EndpointArn, but not both.
  39. * </p>
  40. * <p>
  41. * If you don't specify a value for the <code>TargetArn</code> parameter,
  42. * you must specify a value for the <code>PhoneNumber</code> or
  43. * <code>TopicArn</code> parameters.
  44. * </p>
  45. */
  46. private String targetArn;
  47. /**
  48. * <p>
  49. * The phone number to which you want to deliver an SMS message. Use E.164
  50. * format.
  51. * </p>
  52. * <p>
  53. * If you don't specify a value for the <code>PhoneNumber</code> parameter,
  54. * you must specify a value for the <code>TargetArn</code> or
  55. * <code>TopicArn</code> parameters.
  56. * </p>
  57. */
  58. private String phoneNumber;
  59. /**
  60. * <p>
  61. * The message you want to send to the topic.
  62. * </p>
  63. * <p>
  64. * If you want to send the same message to all transport protocols, include
  65. * the text of the message as a String value.
  66. * </p>
  67. * <p>
  68. * If you want to send different messages for each transport protocol, set
  69. * the value of the <code>MessageStructure</code> parameter to
  70. * <code>json</code> and use a JSON object for the <code>Message</code>
  71. * parameter. See the Examples section for the format of the JSON object.
  72. * </p>
  73. * <p>
  74. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB in
  75. * size (262144 bytes, not 262144 characters).
  76. * </p>
  77. * <p>
  78. * JSON-specific constraints:
  79. * </p>
  80. * <ul>
  81. * <li>
  82. * <p>
  83. * Keys in the JSON object that correspond to supported transport protocols
  84. * must have simple JSON string values.
  85. * </p>
  86. * </li>
  87. * <li>
  88. * <p>
  89. * The values will be parsed (unescaped) before they are used in outgoing
  90. * messages.
  91. * </p>
  92. * </li>
  93. * <li>
  94. * <p>
  95. * Outbound notifications are JSON encoded (meaning that the characters will
  96. * be reescaped for sending).
  97. * </p>
  98. * </li>
  99. * <li>
  100. * <p>
  101. * Values have a minimum length of 0 (the empty string, "", is allowed).
  102. * </p>
  103. * </li>
  104. * <li>
  105. * <p>
  106. * Values have a maximum length bounded by the overall message size (so,
  107. * including multiple protocols may limit message sizes).
  108. * </p>
  109. * </li>
  110. * <li>
  111. * <p>
  112. * Non-string values will cause the key to be ignored.
  113. * </p>
  114. * </li>
  115. * <li>
  116. * <p>
  117. * Keys that do not correspond to supported transport protocols are ignored.
  118. * </p>
  119. * </li>
  120. * <li>
  121. * <p>
  122. * Duplicate keys are not allowed.
  123. * </p>
  124. * </li>
  125. * <li>
  126. * <p>
  127. * Failure to parse or validate any key or value in the message will cause
  128. * the <code>Publish</code> call to return an error (no partial delivery).
  129. * </p>
  130. * </li>
  131. * </ul>
  132. */
  133. private String message;
  134. /**
  135. * <p>
  136. * Optional parameter to be used as the "Subject" line when the message is
  137. * delivered to email endpoints. This field will also be included, if
  138. * present, in the standard JSON messages delivered to other endpoints.
  139. * </p>
  140. * <p>
  141. * Constraints: Subjects must be ASCII text that begins with a letter,
  142. * number, or punctuation mark; must not include line breaks or control
  143. * characters; and must be less than 100 characters long.
  144. * </p>
  145. */
  146. private String subject;
  147. /**
  148. * <p>
  149. * Set <code>MessageStructure</code> to <code>json</code> if you want to
  150. * send a different message for each protocol. For example, using one
  151. * publish action, you can send a short message to your SMS subscribers and
  152. * a longer message to your email subscribers. If you set
  153. * <code>MessageStructure</code> to <code>json</code>, the value of the
  154. * <code>Message</code> parameter must:
  155. * </p>
  156. * <ul>
  157. * <li>
  158. * <p>
  159. * be a syntactically valid JSON object; and
  160. * </p>
  161. * </li>
  162. * <li>
  163. * <p>
  164. * contain at least a top-level JSON key of "default" with a value that is a
  165. * string.
  166. * </p>
  167. * </li>
  168. * </ul>
  169. * <p>
  170. * You can define other top-level keys that define the message you want to
  171. * send to a specific transport protocol (e.g., "http").
  172. * </p>
  173. * <p>
  174. * For information about sending different messages for each protocol using
  175. * the AWS Management Console, go to <a href=
  176. * "http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol"
  177. * >Create Different Messages for Each Protocol</a> in the <i>Amazon Simple
  178. * Notification Service Getting Started Guide</i>.
  179. * </p>
  180. * <p>
  181. * Valid value: <code>json</code>
  182. * </p>
  183. */
  184. private String messageStructure;
  185. /**
  186. * <p>
  187. * Message attributes for Publish action.
  188. * </p>
  189. */
  190. private com.amazonaws.internal.SdkInternalMap<String, MessageAttributeValue> messageAttributes;
  191. /**
  192. * Default constructor for PublishRequest object. Callers should use the
  193. * setter or fluent setter (with...) methods to initialize the object after
  194. * creating it.
  195. */
  196. public PublishRequest() {
  197. }
  198. /**
  199. * Constructs a new PublishRequest object. Callers should use the setter or
  200. * fluent setter (with...) methods to initialize any additional object
  201. * members.
  202. *
  203. * @param topicArn
  204. * The topic you want to publish to.</p>
  205. * <p>
  206. * If you don't specify a value for the <code>TopicArn</code>
  207. * parameter, you must specify a value for the
  208. * <code>PhoneNumber</code> or <code>TargetArn</code> parameters.
  209. * @param message
  210. * The message you want to send to the topic.
  211. * </p>
  212. * <p>
  213. * If you want to send the same message to all transport protocols,
  214. * include the text of the message as a String value.
  215. * </p>
  216. * <p>
  217. * If you want to send different messages for each transport
  218. * protocol, set the value of the <code>MessageStructure</code>
  219. * parameter to <code>json</code> and use a JSON object for the
  220. * <code>Message</code> parameter. See the Examples section for the
  221. * format of the JSON object.
  222. * </p>
  223. * <p>
  224. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB
  225. * in size (262144 bytes, not 262144 characters).
  226. * </p>
  227. * <p>
  228. * JSON-specific constraints:
  229. * </p>
  230. * <ul>
  231. * <li>
  232. * <p>
  233. * Keys in the JSON object that correspond to supported transport
  234. * protocols must have simple JSON string values.
  235. * </p>
  236. * </li>
  237. * <li>
  238. * <p>
  239. * The values will be parsed (unescaped) before they are used in
  240. * outgoing messages.
  241. * </p>
  242. * </li>
  243. * <li>
  244. * <p>
  245. * Outbound notifications are JSON encoded (meaning that the
  246. * characters will be reescaped for sending).
  247. * </p>
  248. * </li>
  249. * <li>
  250. * <p>
  251. * Values have a minimum length of 0 (the empty string, "", is
  252. * allowed).
  253. * </p>
  254. * </li>
  255. * <li>
  256. * <p>
  257. * Values have a maximum length bounded by the overall message size
  258. * (so, including multiple protocols may limit message sizes).
  259. * </p>
  260. * </li>
  261. * <li>
  262. * <p>
  263. * Non-string values will cause the key to be ignored.
  264. * </p>
  265. * </li>
  266. * <li>
  267. * <p>
  268. * Keys that do not correspond to supported transport protocols are
  269. * ignored.
  270. * </p>
  271. * </li>
  272. * <li>
  273. * <p>
  274. * Duplicate keys are not allowed.
  275. * </p>
  276. * </li>
  277. * <li>
  278. * <p>
  279. * Failure to parse or validate any key or value in the message will
  280. * cause the <code>Publish</code> call to return an error (no partial
  281. * delivery).
  282. * </p>
  283. * </li>
  284. */
  285. public PublishRequest(String topicArn, String message) {
  286. setTopicArn(topicArn);
  287. setMessage(message);
  288. }
  289. /**
  290. * Constructs a new PublishRequest object. Callers should use the setter or
  291. * fluent setter (with...) methods to initialize any additional object
  292. * members.
  293. *
  294. * @param topicArn
  295. * The topic you want to publish to.</p>
  296. * <p>
  297. * If you don't specify a value for the <code>TopicArn</code>
  298. * parameter, you must specify a value for the
  299. * <code>PhoneNumber</code> or <code>TargetArn</code> parameters.
  300. * @param message
  301. * The message you want to send to the topic.
  302. * </p>
  303. * <p>
  304. * If you want to send the same message to all transport protocols,
  305. * include the text of the message as a String value.
  306. * </p>
  307. * <p>
  308. * If you want to send different messages for each transport
  309. * protocol, set the value of the <code>MessageStructure</code>
  310. * parameter to <code>json</code> and use a JSON object for the
  311. * <code>Message</code> parameter. See the Examples section for the
  312. * format of the JSON object.
  313. * </p>
  314. * <p>
  315. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB
  316. * in size (262144 bytes, not 262144 characters).
  317. * </p>
  318. * <p>
  319. * JSON-specific constraints:
  320. * </p>
  321. * <ul>
  322. * <li>
  323. * <p>
  324. * Keys in the JSON object that correspond to supported transport
  325. * protocols must have simple JSON string values.
  326. * </p>
  327. * </li>
  328. * <li>
  329. * <p>
  330. * The values will be parsed (unescaped) before they are used in
  331. * outgoing messages.
  332. * </p>
  333. * </li>
  334. * <li>
  335. * <p>
  336. * Outbound notifications are JSON encoded (meaning that the
  337. * characters will be reescaped for sending).
  338. * </p>
  339. * </li>
  340. * <li>
  341. * <p>
  342. * Values have a minimum length of 0 (the empty string, "", is
  343. * allowed).
  344. * </p>
  345. * </li>
  346. * <li>
  347. * <p>
  348. * Values have a maximum length bounded by the overall message size
  349. * (so, including multiple protocols may limit message sizes).
  350. * </p>
  351. * </li>
  352. * <li>
  353. * <p>
  354. * Non-string values will cause the key to be ignored.
  355. * </p>
  356. * </li>
  357. * <li>
  358. * <p>
  359. * Keys that do not correspond to supported transport protocols are
  360. * ignored.
  361. * </p>
  362. * </li>
  363. * <li>
  364. * <p>
  365. * Duplicate keys are not allowed.
  366. * </p>
  367. * </li>
  368. * <li>
  369. * <p>
  370. * Failure to parse or validate any key or value in the message will
  371. * cause the <code>Publish</code> call to return an error (no partial
  372. * delivery).
  373. * </p>
  374. * </li>
  375. * @param subject
  376. * Optional parameter to be used as the "Subject" line when the
  377. * message is delivered to email endpoints. This field will also be
  378. * included, if present, in the standard JSON messages delivered to
  379. * other endpoints.</p>
  380. * <p>
  381. * Constraints: Subjects must be ASCII text that begins with a
  382. * letter, number, or punctuation mark; must not include line breaks
  383. * or control characters; and must be less than 100 characters long.
  384. */
  385. public PublishRequest(String topicArn, String message, String subject) {
  386. setTopicArn(topicArn);
  387. setMessage(message);
  388. setSubject(subject);
  389. }
  390. /**
  391. * <p>
  392. * The topic you want to publish to.
  393. * </p>
  394. * <p>
  395. * If you don't specify a value for the <code>TopicArn</code> parameter, you
  396. * must specify a value for the <code>PhoneNumber</code> or
  397. * <code>TargetArn</code> parameters.
  398. * </p>
  399. *
  400. * @param topicArn
  401. * The topic you want to publish to.</p>
  402. * <p>
  403. * If you don't specify a value for the <code>TopicArn</code>
  404. * parameter, you must specify a value for the
  405. * <code>PhoneNumber</code> or <code>TargetArn</code> parameters.
  406. */
  407. public void setTopicArn(String topicArn) {
  408. this.topicArn = topicArn;
  409. }
  410. /**
  411. * <p>
  412. * The topic you want to publish to.
  413. * </p>
  414. * <p>
  415. * If you don't specify a value for the <code>TopicArn</code> parameter, you
  416. * must specify a value for the <code>PhoneNumber</code> or
  417. * <code>TargetArn</code> parameters.
  418. * </p>
  419. *
  420. * @return The topic you want to publish to.</p>
  421. * <p>
  422. * If you don't specify a value for the <code>TopicArn</code>
  423. * parameter, you must specify a value for the
  424. * <code>PhoneNumber</code> or <code>TargetArn</code> parameters.
  425. */
  426. public String getTopicArn() {
  427. return this.topicArn;
  428. }
  429. /**
  430. * <p>
  431. * The topic you want to publish to.
  432. * </p>
  433. * <p>
  434. * If you don't specify a value for the <code>TopicArn</code> parameter, you
  435. * must specify a value for the <code>PhoneNumber</code> or
  436. * <code>TargetArn</code> parameters.
  437. * </p>
  438. *
  439. * @param topicArn
  440. * The topic you want to publish to.</p>
  441. * <p>
  442. * If you don't specify a value for the <code>TopicArn</code>
  443. * parameter, you must specify a value for the
  444. * <code>PhoneNumber</code> or <code>TargetArn</code> parameters.
  445. * @return Returns a reference to this object so that method calls can be
  446. * chained together.
  447. */
  448. public PublishRequest withTopicArn(String topicArn) {
  449. setTopicArn(topicArn);
  450. return this;
  451. }
  452. /**
  453. * <p>
  454. * Either TopicArn or EndpointArn, but not both.
  455. * </p>
  456. * <p>
  457. * If you don't specify a value for the <code>TargetArn</code> parameter,
  458. * you must specify a value for the <code>PhoneNumber</code> or
  459. * <code>TopicArn</code> parameters.
  460. * </p>
  461. *
  462. * @param targetArn
  463. * Either TopicArn or EndpointArn, but not both.</p>
  464. * <p>
  465. * If you don't specify a value for the <code>TargetArn</code>
  466. * parameter, you must specify a value for the
  467. * <code>PhoneNumber</code> or <code>TopicArn</code> parameters.
  468. */
  469. public void setTargetArn(String targetArn) {
  470. this.targetArn = targetArn;
  471. }
  472. /**
  473. * <p>
  474. * Either TopicArn or EndpointArn, but not both.
  475. * </p>
  476. * <p>
  477. * If you don't specify a value for the <code>TargetArn</code> parameter,
  478. * you must specify a value for the <code>PhoneNumber</code> or
  479. * <code>TopicArn</code> parameters.
  480. * </p>
  481. *
  482. * @return Either TopicArn or EndpointArn, but not both.</p>
  483. * <p>
  484. * If you don't specify a value for the <code>TargetArn</code>
  485. * parameter, you must specify a value for the
  486. * <code>PhoneNumber</code> or <code>TopicArn</code> parameters.
  487. */
  488. public String getTargetArn() {
  489. return this.targetArn;
  490. }
  491. /**
  492. * <p>
  493. * Either TopicArn or EndpointArn, but not both.
  494. * </p>
  495. * <p>
  496. * If you don't specify a value for the <code>TargetArn</code> parameter,
  497. * you must specify a value for the <code>PhoneNumber</code> or
  498. * <code>TopicArn</code> parameters.
  499. * </p>
  500. *
  501. * @param targetArn
  502. * Either TopicArn or EndpointArn, but not both.</p>
  503. * <p>
  504. * If you don't specify a value for the <code>TargetArn</code>
  505. * parameter, you must specify a value for the
  506. * <code>PhoneNumber</code> or <code>TopicArn</code> parameters.
  507. * @return Returns a reference to this object so that method calls can be
  508. * chained together.
  509. */
  510. public PublishRequest withTargetArn(String targetArn) {
  511. setTargetArn(targetArn);
  512. return this;
  513. }
  514. /**
  515. * <p>
  516. * The phone number to which you want to deliver an SMS message. Use E.164
  517. * format.
  518. * </p>
  519. * <p>
  520. * If you don't specify a value for the <code>PhoneNumber</code> parameter,
  521. * you must specify a value for the <code>TargetArn</code> or
  522. * <code>TopicArn</code> parameters.
  523. * </p>
  524. *
  525. * @param phoneNumber
  526. * The phone number to which you want to deliver an SMS message. Use
  527. * E.164 format.</p>
  528. * <p>
  529. * If you don't specify a value for the <code>PhoneNumber</code>
  530. * parameter, you must specify a value for the <code>TargetArn</code>
  531. * or <code>TopicArn</code> parameters.
  532. */
  533. public void setPhoneNumber(String phoneNumber) {
  534. this.phoneNumber = phoneNumber;
  535. }
  536. /**
  537. * <p>
  538. * The phone number to which you want to deliver an SMS message. Use E.164
  539. * format.
  540. * </p>
  541. * <p>
  542. * If you don't specify a value for the <code>PhoneNumber</code> parameter,
  543. * you must specify a value for the <code>TargetArn</code> or
  544. * <code>TopicArn</code> parameters.
  545. * </p>
  546. *
  547. * @return The phone number to which you want to deliver an SMS message. Use
  548. * E.164 format.</p>
  549. * <p>
  550. * If you don't specify a value for the <code>PhoneNumber</code>
  551. * parameter, you must specify a value for the
  552. * <code>TargetArn</code> or <code>TopicArn</code> parameters.
  553. */
  554. public String getPhoneNumber() {
  555. return this.phoneNumber;
  556. }
  557. /**
  558. * <p>
  559. * The phone number to which you want to deliver an SMS message. Use E.164
  560. * format.
  561. * </p>
  562. * <p>
  563. * If you don't specify a value for the <code>PhoneNumber</code> parameter,
  564. * you must specify a value for the <code>TargetArn</code> or
  565. * <code>TopicArn</code> parameters.
  566. * </p>
  567. *
  568. * @param phoneNumber
  569. * The phone number to which you want to deliver an SMS message. Use
  570. * E.164 format.</p>
  571. * <p>
  572. * If you don't specify a value for the <code>PhoneNumber</code>
  573. * parameter, you must specify a value for the <code>TargetArn</code>
  574. * or <code>TopicArn</code> parameters.
  575. * @return Returns a reference to this object so that method calls can be
  576. * chained together.
  577. */
  578. public PublishRequest withPhoneNumber(String phoneNumber) {
  579. setPhoneNumber(phoneNumber);
  580. return this;
  581. }
  582. /**
  583. * <p>
  584. * The message you want to send to the topic.
  585. * </p>
  586. * <p>
  587. * If you want to send the same message to all transport protocols, include
  588. * the text of the message as a String value.
  589. * </p>
  590. * <p>
  591. * If you want to send different messages for each transport protocol, set
  592. * the value of the <code>MessageStructure</code> parameter to
  593. * <code>json</code> and use a JSON object for the <code>Message</code>
  594. * parameter. See the Examples section for the format of the JSON object.
  595. * </p>
  596. * <p>
  597. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB in
  598. * size (262144 bytes, not 262144 characters).
  599. * </p>
  600. * <p>
  601. * JSON-specific constraints:
  602. * </p>
  603. * <ul>
  604. * <li>
  605. * <p>
  606. * Keys in the JSON object that correspond to supported transport protocols
  607. * must have simple JSON string values.
  608. * </p>
  609. * </li>
  610. * <li>
  611. * <p>
  612. * The values will be parsed (unescaped) before they are used in outgoing
  613. * messages.
  614. * </p>
  615. * </li>
  616. * <li>
  617. * <p>
  618. * Outbound notifications are JSON encoded (meaning that the characters will
  619. * be reescaped for sending).
  620. * </p>
  621. * </li>
  622. * <li>
  623. * <p>
  624. * Values have a minimum length of 0 (the empty string, "", is allowed).
  625. * </p>
  626. * </li>
  627. * <li>
  628. * <p>
  629. * Values have a maximum length bounded by the overall message size (so,
  630. * including multiple protocols may limit message sizes).
  631. * </p>
  632. * </li>
  633. * <li>
  634. * <p>
  635. * Non-string values will cause the key to be ignored.
  636. * </p>
  637. * </li>
  638. * <li>
  639. * <p>
  640. * Keys that do not correspond to supported transport protocols are ignored.
  641. * </p>
  642. * </li>
  643. * <li>
  644. * <p>
  645. * Duplicate keys are not allowed.
  646. * </p>
  647. * </li>
  648. * <li>
  649. * <p>
  650. * Failure to parse or validate any key or value in the message will cause
  651. * the <code>Publish</code> call to return an error (no partial delivery).
  652. * </p>
  653. * </li>
  654. * </ul>
  655. *
  656. * @param message
  657. * The message you want to send to the topic.</p>
  658. * <p>
  659. * If you want to send the same message to all transport protocols,
  660. * include the text of the message as a String value.
  661. * </p>
  662. * <p>
  663. * If you want to send different messages for each transport
  664. * protocol, set the value of the <code>MessageStructure</code>
  665. * parameter to <code>json</code> and use a JSON object for the
  666. * <code>Message</code> parameter. See the Examples section for the
  667. * format of the JSON object.
  668. * </p>
  669. * <p>
  670. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB
  671. * in size (262144 bytes, not 262144 characters).
  672. * </p>
  673. * <p>
  674. * JSON-specific constraints:
  675. * </p>
  676. * <ul>
  677. * <li>
  678. * <p>
  679. * Keys in the JSON object that correspond to supported transport
  680. * protocols must have simple JSON string values.
  681. * </p>
  682. * </li>
  683. * <li>
  684. * <p>
  685. * The values will be parsed (unescaped) before they are used in
  686. * outgoing messages.
  687. * </p>
  688. * </li>
  689. * <li>
  690. * <p>
  691. * Outbound notifications are JSON encoded (meaning that the
  692. * characters will be reescaped for sending).
  693. * </p>
  694. * </li>
  695. * <li>
  696. * <p>
  697. * Values have a minimum length of 0 (the empty string, "", is
  698. * allowed).
  699. * </p>
  700. * </li>
  701. * <li>
  702. * <p>
  703. * Values have a maximum length bounded by the overall message size
  704. * (so, including multiple protocols may limit message sizes).
  705. * </p>
  706. * </li>
  707. * <li>
  708. * <p>
  709. * Non-string values will cause the key to be ignored.
  710. * </p>
  711. * </li>
  712. * <li>
  713. * <p>
  714. * Keys that do not correspond to supported transport protocols are
  715. * ignored.
  716. * </p>
  717. * </li>
  718. * <li>
  719. * <p>
  720. * Duplicate keys are not allowed.
  721. * </p>
  722. * </li>
  723. * <li>
  724. * <p>
  725. * Failure to parse or validate any key or value in the message will
  726. * cause the <code>Publish</code> call to return an error (no partial
  727. * delivery).
  728. * </p>
  729. * </li>
  730. */
  731. public void setMessage(String message) {
  732. this.message = message;
  733. }
  734. /**
  735. * <p>
  736. * The message you want to send to the topic.
  737. * </p>
  738. * <p>
  739. * If you want to send the same message to all transport protocols, include
  740. * the text of the message as a String value.
  741. * </p>
  742. * <p>
  743. * If you want to send different messages for each transport protocol, set
  744. * the value of the <code>MessageStructure</code> parameter to
  745. * <code>json</code> and use a JSON object for the <code>Message</code>
  746. * parameter. See the Examples section for the format of the JSON object.
  747. * </p>
  748. * <p>
  749. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB in
  750. * size (262144 bytes, not 262144 characters).
  751. * </p>
  752. * <p>
  753. * JSON-specific constraints:
  754. * </p>
  755. * <ul>
  756. * <li>
  757. * <p>
  758. * Keys in the JSON object that correspond to supported transport protocols
  759. * must have simple JSON string values.
  760. * </p>
  761. * </li>
  762. * <li>
  763. * <p>
  764. * The values will be parsed (unescaped) before they are used in outgoing
  765. * messages.
  766. * </p>
  767. * </li>
  768. * <li>
  769. * <p>
  770. * Outbound notifications are JSON encoded (meaning that the characters will
  771. * be reescaped for sending).
  772. * </p>
  773. * </li>
  774. * <li>
  775. * <p>
  776. * Values have a minimum length of 0 (the empty string, "", is allowed).
  777. * </p>
  778. * </li>
  779. * <li>
  780. * <p>
  781. * Values have a maximum length bounded by the overall message size (so,
  782. * including multiple protocols may limit message sizes).
  783. * </p>
  784. * </li>
  785. * <li>
  786. * <p>
  787. * Non-string values will cause the key to be ignored.
  788. * </p>
  789. * </li>
  790. * <li>
  791. * <p>
  792. * Keys that do not correspond to supported transport protocols are ignored.
  793. * </p>
  794. * </li>
  795. * <li>
  796. * <p>
  797. * Duplicate keys are not allowed.
  798. * </p>
  799. * </li>
  800. * <li>
  801. * <p>
  802. * Failure to parse or validate any key or value in the message will cause
  803. * the <code>Publish</code> call to return an error (no partial delivery).
  804. * </p>
  805. * </li>
  806. * </ul>
  807. *
  808. * @return The message you want to send to the topic.</p>
  809. * <p>
  810. * If you want to send the same message to all transport protocols,
  811. * include the text of the message as a String value.
  812. * </p>
  813. * <p>
  814. * If you want to send different messages for each transport
  815. * protocol, set the value of the <code>MessageStructure</code>
  816. * parameter to <code>json</code> and use a JSON object for the
  817. * <code>Message</code> parameter. See the Examples section for the
  818. * format of the JSON object.
  819. * </p>
  820. * <p>
  821. * Constraints: Messages must be UTF-8 encoded strings at most 256
  822. * KB in size (262144 bytes, not 262144 characters).
  823. * </p>
  824. * <p>
  825. * JSON-specific constraints:
  826. * </p>
  827. * <ul>
  828. * <li>
  829. * <p>
  830. * Keys in the JSON object that correspond to supported transport
  831. * protocols must have simple JSON string values.
  832. * </p>
  833. * </li>
  834. * <li>
  835. * <p>
  836. * The values will be parsed (unescaped) before they are used in
  837. * outgoing messages.
  838. * </p>
  839. * </li>
  840. * <li>
  841. * <p>
  842. * Outbound notifications are JSON encoded (meaning that the
  843. * characters will be reescaped for sending).
  844. * </p>
  845. * </li>
  846. * <li>
  847. * <p>
  848. * Values have a minimum length of 0 (the empty string, "", is
  849. * allowed).
  850. * </p>
  851. * </li>
  852. * <li>
  853. * <p>
  854. * Values have a maximum length bounded by the overall message size
  855. * (so, including multiple protocols may limit message sizes).
  856. * </p>
  857. * </li>
  858. * <li>
  859. * <p>
  860. * Non-string values will cause the key to be ignored.
  861. * </p>
  862. * </li>
  863. * <li>
  864. * <p>
  865. * Keys that do not correspond to supported transport protocols are
  866. * ignored.
  867. * </p>
  868. * </li>
  869. * <li>
  870. * <p>
  871. * Duplicate keys are not allowed.
  872. * </p>
  873. * </li>
  874. * <li>
  875. * <p>
  876. * Failure to parse or validate any key or value in the message will
  877. * cause the <code>Publish</code> call to return an error (no
  878. * partial delivery).
  879. * </p>
  880. * </li>
  881. */
  882. public String getMessage() {
  883. return this.message;
  884. }
  885. /**
  886. * <p>
  887. * The message you want to send to the topic.
  888. * </p>
  889. * <p>
  890. * If you want to send the same message to all transport protocols, include
  891. * the text of the message as a String value.
  892. * </p>
  893. * <p>
  894. * If you want to send different messages for each transport protocol, set
  895. * the value of the <code>MessageStructure</code> parameter to
  896. * <code>json</code> and use a JSON object for the <code>Message</code>
  897. * parameter. See the Examples section for the format of the JSON object.
  898. * </p>
  899. * <p>
  900. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB in
  901. * size (262144 bytes, not 262144 characters).
  902. * </p>
  903. * <p>
  904. * JSON-specific constraints:
  905. * </p>
  906. * <ul>
  907. * <li>
  908. * <p>
  909. * Keys in the JSON object that correspond to supported transport protocols
  910. * must have simple JSON string values.
  911. * </p>
  912. * </li>
  913. * <li>
  914. * <p>
  915. * The values will be parsed (unescaped) before they are used in outgoing
  916. * messages.
  917. * </p>
  918. * </li>
  919. * <li>
  920. * <p>
  921. * Outbound notifications are JSON encoded (meaning that the characters will
  922. * be reescaped for sending).
  923. * </p>
  924. * </li>
  925. * <li>
  926. * <p>
  927. * Values have a minimum length of 0 (the empty string, "", is allowed).
  928. * </p>
  929. * </li>
  930. * <li>
  931. * <p>
  932. * Values have a maximum length bounded by the overall message size (so,
  933. * including multiple protocols may limit message sizes).
  934. * </p>
  935. * </li>
  936. * <li>
  937. * <p>
  938. * Non-string values will cause the key to be ignored.
  939. * </p>
  940. * </li>
  941. * <li>
  942. * <p>
  943. * Keys that do not correspond to supported transport protocols are ignored.
  944. * </p>
  945. * </li>
  946. * <li>
  947. * <p>
  948. * Duplicate keys are not allowed.
  949. * </p>
  950. * </li>
  951. * <li>
  952. * <p>
  953. * Failure to parse or validate any key or value in the message will cause
  954. * the <code>Publish</code> call to return an error (no partial delivery).
  955. * </p>
  956. * </li>
  957. * </ul>
  958. *
  959. * @param message
  960. * The message you want to send to the topic.</p>
  961. * <p>
  962. * If you want to send the same message to all transport protocols,
  963. * include the text of the message as a String value.
  964. * </p>
  965. * <p>
  966. * If you want to send different messages for each transport
  967. * protocol, set the value of the <code>MessageStructure</code>
  968. * parameter to <code>json</code> and use a JSON object for the
  969. * <code>Message</code> parameter. See the Examples section for the
  970. * format of the JSON object.
  971. * </p>
  972. * <p>
  973. * Constraints: Messages must be UTF-8 encoded strings at most 256 KB
  974. * in size (262144 bytes, not 262144 characters).
  975. * </p>
  976. * <p>
  977. * JSON-specific constraints:
  978. * </p>
  979. * <ul>
  980. * <li>
  981. * <p>
  982. * Keys in the JSON object that correspond to supported transport
  983. * protocols must have simple JSON string values.
  984. * </p>
  985. * </li>
  986. * <li>
  987. * <p>
  988. * The values will be parsed (unescaped) before they are used in
  989. * outgoing messages.
  990. * </p>
  991. * </li>
  992. * <li>
  993. * <p>
  994. * Outbound notifications are JSON encoded (meaning that the
  995. * characters will be reescaped for sending).
  996. * </p>
  997. * </li>
  998. * <li>
  999. * <p>
  1000. * Values have a minimum length of 0 (the empty string, "", is
  1001. * allowed).
  1002. * </p>
  1003. * </li>
  1004. * <li>
  1005. * <p>
  1006. * Values have a maximum length bounded by the overall message size
  1007. * (so, including multiple protocols may limit message sizes).
  1008. * </p>
  1009. * </li>
  1010. * <li>
  1011. * <p>
  1012. * Non-string values will cause the key to be ignored.
  1013. * </p>
  1014. * </li>
  1015. * <li>
  1016. * <p>
  1017. * Keys that do not correspond to supported transport protocols are
  1018. * ignored.
  1019. * </p>
  1020. * </li>
  1021. * <li>
  1022. * <p>
  1023. * Duplicate keys are not allowed.
  1024. * </p>
  1025. * </li>
  1026. * <li>
  1027. * <p>
  1028. * Failure to parse or validate any key or value in the message will
  1029. * cause the <code>Publish</code> call to return an error (no partial
  1030. * delivery).
  1031. * </p>
  1032. * </li>
  1033. * @return Returns a reference to this object so that method calls can be
  1034. * chained together.
  1035. */
  1036. public PublishRequest withMessage(String message) {
  1037. setMessage(message);
  1038. return this;
  1039. }
  1040. /**
  1041. * <p>
  1042. * Optional parameter to be used as the "Subject" line when the message is
  1043. * delivered to email endpoints. This field will also be included, if
  1044. * present, in the standard JSON messages delivered to other endpoints.
  1045. * </p>
  1046. * <p>
  1047. * Constraints: Subjects must be ASCII text that begins with a letter,
  1048. * number, or punctuation mark; must not include line breaks or control
  1049. * characters; and must be less than 100 characters long.
  1050. * </p>
  1051. *
  1052. * @param subject
  1053. * Optional parameter to be used as the "Subject" line when the
  1054. * message is delivered to email endpoints. This field will also be
  1055. * included, if present, in the standard JSON messages delivered to
  1056. * other endpoints.</p>
  1057. * <p>
  1058. * Constraints: Subjects must be ASCII text that begins with a
  1059. * letter, number, or punctuation mark; must not include line breaks
  1060. * or control characters; and must be less than 100 characters long.
  1061. */
  1062. public void setSubject(String subject) {
  1063. this.subject = subject;
  1064. }
  1065. /**
  1066. * <p>
  1067. * Optional parameter to be used as the "Subject" line when the message is
  1068. * delivered to email endpoints. This field will also be included, if
  1069. * present, in the standard JSON messages delivered to other endpoints.
  1070. * </p>
  1071. * <p>
  1072. * Constraints: Subjects must be ASCII text that begins with a letter,
  1073. * number, or punctuation mark; must not include line breaks or control
  1074. * characters; and must be less than 100 characters long.
  1075. * </p>
  1076. *
  1077. * @return Optional parameter to be used as the "Subject" line when the
  1078. * message is delivered to email endpoints. This field will also be
  1079. * included, if present, in the standard JSON messages delivered to
  1080. * other endpoints.</p>
  1081. * <p>
  1082. * Constraints: Subjects must be ASCII text that begins with a
  1083. * letter, number, or punctuation mark; must not include line breaks
  1084. * or control characters; and must be less than 100 characters long.
  1085. */
  1086. public String getSubject() {
  1087. return this.subject;
  1088. }
  1089. /**
  1090. * <p>
  1091. * Optional parameter to be used as the "Subject" line when the message is
  1092. * delivered to email endpoints. This field will also be included, if
  1093. * present, in the standard JSON messages delivered to other endpoints.
  1094. * </p>
  1095. * <p>
  1096. * Constraints: Subjects must be ASCII text that begins with a letter,
  1097. * number, or punctuation mark; must not include line breaks or control
  1098. * characters; and must be less than 100 characters long.
  1099. * </p>
  1100. *
  1101. * @param subject
  1102. * Optional parameter to be used as the "Subject" line when the
  1103. * message is delivered to email endpoints. This field will also be
  1104. * included, if present, in the standard JSON messages delivered to
  1105. * other endpoints.</p>
  1106. * <p>
  1107. * Constraints: Subjects must be ASCII text that begins with a
  1108. * letter, number, or punctuation mark; must not include line breaks
  1109. * or control characters; and must be less than 100 characters long.
  1110. * @return Returns a reference to this object so that method calls can be
  1111. * chained together.
  1112. */
  1113. public PublishRequest withSubject(String subject) {
  1114. setSubject(subject);
  1115. return this;
  1116. }
  1117. /**
  1118. * <p>
  1119. * Set <code>MessageStructure</code> to <code>json</code> if you want to
  1120. * send a different message for each protocol. For example, using one
  1121. * publish action, you can send a short message to your SMS subscribers and
  1122. * a longer message to your email subscribers. If you set
  1123. * <code>MessageStructure</code> to <code>json</code>, the value of the
  1124. * <code>Message</code> parameter must:
  1125. * </p>
  1126. * <ul>
  1127. * <li>
  1128. * <p>
  1129. * be a syntactically valid JSON object; and
  1130. * </p>
  1131. * </li>
  1132. * <li>
  1133. * <p>
  1134. * contain at least a top-level JSON key of "default" with a value that is a
  1135. * string.
  1136. * </p>
  1137. * </li>
  1138. * </ul>
  1139. * <p>
  1140. * You can define other top-level keys that define the message you want to
  1141. * send to a specific transport protocol (e.g., "http").
  1142. * </p>
  1143. * <p>
  1144. * For information about sending different messages for each protocol using
  1145. * the AWS Management Console, go to <a href=
  1146. * "http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol"
  1147. * >Create Different Messages for Each Protocol</a> in the <i>Amazon Simple
  1148. * Notification Service Getting Started Guide</i>.
  1149. * </p>
  1150. * <p>
  1151. * Valid value: <code>json</code>
  1152. * </p>
  1153. *
  1154. * @param messageStructure
  1155. * Set <code>MessageStructure</code> to <code>json</code> if you want
  1156. * to send a different message for each protocol. For example, using
  1157. * one publish action, you can send a short message to your SMS
  1158. * subscribers and a longer message to your email subscribers. If you
  1159. * set <code>MessageStructure</code> to <code>json</code>, the value
  1160. * of the <code>Message</code> parameter must: </p>
  1161. * <ul>
  1162. * <li>
  1163. * <p>
  1164. * be a syntactically valid JSON object; and
  1165. * </p>
  1166. * </li>
  1167. * <li>
  1168. * <p>
  1169. * contain at least a top-level JSON key of "default" with a value
  1170. * that is a string.
  1171. * </p>
  1172. * </li>
  1173. * </ul>
  1174. * <p>
  1175. * You can define other top-level keys that define the message you
  1176. * want to send to a specific transport protocol (e.g., "http").
  1177. * </p>
  1178. * <p>
  1179. * For information about sending different messages for each protocol
  1180. * using the AWS Management Console, go to <a href=
  1181. * "http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol"
  1182. * >Create Different Messages for Each Protocol</a> in the <i>Amazon
  1183. * Simple Notification Service Getting Started Guide</i>.
  1184. * </p>
  1185. * <p>
  1186. * Valid value: <code>json</code>
  1187. */
  1188. public void setMessageStructure(String messageStructure) {
  1189. this.messageStructure = messageStructure;
  1190. }
  1191. /**
  1192. * <p>
  1193. * Set <code>MessageStructure</code> to <code>json</code> if you want to
  1194. * send a different message for each protocol. For example, using one
  1195. * publish action, you can send a short message to your SMS subscribers and
  1196. * a longer message to your email subscribers. If you set
  1197. * <code>MessageStructure</code> to <code>json</code>, the value of the
  1198. * <code>Message</code> parameter must:
  1199. * </p>
  1200. * <ul>
  1201. * <li>
  1202. * <p>
  1203. * be a syntactically valid JSON object; and
  1204. * </p>
  1205. * </li>
  1206. * <li>
  1207. * <p>
  1208. * contain at least a top-level JSON key of "default" with a value that is a
  1209. * string.
  1210. * </p>
  1211. * </li>
  1212. * </ul>
  1213. * <p>
  1214. * You can define other top-level keys that define the message you want to
  1215. * send to a specific transport protocol (e.g., "http").
  1216. * </p>
  1217. * <p>
  1218. * For information about sending different messages for each protocol using
  1219. * the AWS Management Console, go to <a href=
  1220. * "http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol"
  1221. * >Create Different Messages for Each Protocol</a> in the <i>Amazon Simple
  1222. * Notification Service Getting Started Guide</i>.
  1223. * </p>
  1224. * <p>
  1225. * Valid value: <code>json</code>
  1226. * </p>
  1227. *
  1228. * @return Set <code>MessageStructure</code> to <code>json</code> if you
  1229. * want to send a different message for each protocol. For example,
  1230. * using one publish action, you can send a short message to your
  1231. * SMS subscribers and a longer message to your email subscribers.
  1232. * If you set <code>MessageStructure</code> to <code>json</code>,
  1233. * the value of the <code>Message</code> parameter must: </p>
  1234. * <ul>
  1235. * <li>
  1236. * <p>
  1237. * be a syntactically valid JSON object; and
  1238. * </p>
  1239. * </li>
  1240. * <li>
  1241. * <p>
  1242. * contain at least a top-level JSON key of "default" with a value
  1243. * that is a string.
  1244. * </p>
  1245. * </li>
  1246. * </ul>
  1247. * <p>
  1248. * You can define other top-level keys that define the message you
  1249. * want to send to a specific transport protocol (e.g., "http").
  1250. * </p>
  1251. * <p>
  1252. * For information about sending different messages for each
  1253. * protocol using the AWS Management Console, go to <a href=
  1254. * "http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol"
  1255. * >Create Different Messages for Each Protocol</a> in the <i>Amazon
  1256. * Simple Notification Service Getting Started Guide</i>.
  1257. * </p>
  1258. * <p>
  1259. * Valid value: <code>json</code>
  1260. */
  1261. public String getMessageStructure() {
  1262. return this.messageStructure;
  1263. }
  1264. /**
  1265. * <p>
  1266. * Set <code>MessageStructure</code> to <code>json</code> if you want to
  1267. * send a different message for each protocol. For example, using one
  1268. * publish action, you can send a short message to your SMS subscribers and
  1269. * a longer message to your email subscribers. If you set
  1270. * <code>MessageStructure</code> to <code>json</code>, the value of the
  1271. * <code>Message</code> parameter must:
  1272. * </p>
  1273. * <ul>
  1274. * <li>
  1275. * <p>
  1276. * be a syntactically valid JSON object; and
  1277. * </p>
  1278. * </li>
  1279. * <li>
  1280. * <p>
  1281. * contain at least a top-level JSON key of "default" with a value that is a
  1282. * string.
  1283. * </p>
  1284. * </li>
  1285. * </ul>
  1286. * <p>
  1287. * You can define other top-level keys that define the message you want to
  1288. * send to a specific transport protocol (e.g., "http").
  1289. * </p>
  1290. * <p>
  1291. * For information about sending different messages for each protocol using
  1292. * the AWS Management Console, go to <a href=
  1293. * "http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol"
  1294. * >Create Different Messages for Each Protocol</a> in the <i>Amazon Simple
  1295. * Notification Service Getting Started Guide</i>.
  1296. * </p>
  1297. * <p>
  1298. * Valid value: <code>json</code>
  1299. * </p>
  1300. *
  1301. * @param messageStructure
  1302. * Set <code>MessageStructure</code> to <code>json</code> if you want
  1303. * to send a different message for each protocol. For example, using
  1304. * one publish action, you can send a short message to your SMS
  1305. * subscribers and a longer message to your email subscribers. If you
  1306. * set <code>MessageStructure</code> to <code>json</code>, the value
  1307. * of the <code>Message</code> parameter must: </p>
  1308. * <ul>
  1309. * <li>
  1310. * <p>
  1311. * be a syntactically valid JSON object; and
  1312. * </p>
  1313. * </li>
  1314. * <li>
  1315. * <p>
  1316. * contain at least a top-level JSON key of "default" with a value
  1317. * that is a string.
  1318. * </p>
  1319. * </li>
  1320. * </ul>
  1321. * <p>
  1322. * You can define other top-level keys that define the message you
  1323. * want to send to a specific transport protocol (e.g., "http").
  1324. * </p>
  1325. * <p>
  1326. * For information about sending different messages for each protocol
  1327. * using the AWS Management Console, go to <a href=
  1328. * "http://docs.aws.amazon.com/sns/latest/gsg/Publish.html#sns-message-formatting-by-protocol"
  1329. * >Create Different Messages for Each Protocol</a> in the <i>Amazon
  1330. * Simple Notification Service Getting Started Guide</i>.
  1331. * </p>
  1332. * <p>
  1333. * Valid value: <code>json</code>
  1334. * @return Returns a reference to this object so that method calls can be
  1335. * chained together.
  1336. */
  1337. public PublishRequest withMessageStructure(String messageStructure) {
  1338. setMessageStructure(messageStructure);
  1339. return this;
  1340. }
  1341. /**
  1342. * <p>
  1343. * Message attributes for Publish action.
  1344. * </p>
  1345. *
  1346. * @return Message attributes for Publish action.
  1347. */
  1348. public java.util.Map<String, MessageAttributeValue> getMessageAttributes() {
  1349. if (messageAttributes == null) {
  1350. messageAttributes = new com.amazonaws.internal.SdkInternalMap<String, MessageAttributeValue>();
  1351. }
  1352. return messageAttributes;
  1353. }
  1354. /**
  1355. * <p>
  1356. * Message attributes for Publish action.
  1357. * </p>
  1358. *
  1359. * @param messageAttributes
  1360. * Message attributes for Publish action.
  1361. */
  1362. public void setMessageAttributes(
  1363. java.util.Map<String, MessageAttributeValue> messageAttributes) {
  1364. this.messageAttributes = messageAttributes == null ? null
  1365. : new com.amazonaws.internal.SdkInternalMap<String, MessageAttributeValue>(
  1366. messageAttributes);
  1367. }
  1368. /**
  1369. * <p>
  1370. * Message attributes for Publish action.
  1371. * </p>
  1372. *
  1373. * @param messageAttributes
  1374. * Message attributes for Publish action.
  1375. * @return Returns a reference to this object so that method calls can be
  1376. * chained together.
  1377. */
  1378. public PublishRequest withMessageAttributes(
  1379. java.util.Map<String, MessageAttributeValue> messageAttributes) {
  1380. setMessageAttributes(messageAttributes);
  1381. return this;
  1382. }
  1383. public PublishRequest addMessageAttributesEntry(String key,
  1384. MessageAttributeValue value) {
  1385. if (null == this.messageAttributes) {
  1386. this.messageAttributes = new com.amazonaws.internal.SdkInternalMap<String, MessageAttributeValue>();
  1387. }
  1388. if (this.messageAttributes.containsKey(key))
  1389. throw new IllegalArgumentException("Duplicated keys ("
  1390. + key.toString() + ") are provided.");
  1391. this.messageAttributes.put(key, value);
  1392. return this;
  1393. }
  1394. /**
  1395. * Removes all the entries added into MessageAttributes. &lt;p> Returns a
  1396. * reference to this object so that method calls can be chained together.
  1397. */
  1398. public PublishRequest clearMessageAttributesEntries() {
  1399. this.messageAttributes = null;
  1400. r