aws_sdk_iotanalytics/operation/batch_put_message/_batch_put_message_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct BatchPutMessageInput {
6 /// <p>The name of the channel where the messages are sent.</p>
7 pub channel_name: ::std::option::Option<::std::string::String>,
8 /// <p>The list of messages to be sent. Each message has the format: { "messageId": "string", "payload": "string"}.</p>
9 /// <p>The field names of message payloads (data) that you send to IoT Analytics:</p>
10 /// <ul>
11 /// <li>
12 /// <p>Must contain only alphanumeric characters and undescores (_). No other special characters are allowed.</p></li>
13 /// <li>
14 /// <p>Must begin with an alphabetic character or single underscore (_).</p></li>
15 /// <li>
16 /// <p>Cannot contain hyphens (-).</p></li>
17 /// <li>
18 /// <p>In regular expression terms: "^\[A-Za-z_\](\[A-Za-z0-9\]*|\[A-Za-z0-9\]\[A-Za-z0-9_\]*)$".</p></li>
19 /// <li>
20 /// <p>Cannot be more than 255 characters.</p></li>
21 /// <li>
22 /// <p>Are case insensitive. (Fields named foo and FOO in the same payload are considered duplicates.)</p></li>
23 /// </ul>
24 /// <p>For example, {"temp_01": 29} or {"_temp_01": 29} are valid, but {"temp-01": 29}, {"01_temp": 29} or {"__temp_01": 29} are invalid in message payloads.</p>
25 pub messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
26}
27impl BatchPutMessageInput {
28 /// <p>The name of the channel where the messages are sent.</p>
29 pub fn channel_name(&self) -> ::std::option::Option<&str> {
30 self.channel_name.as_deref()
31 }
32 /// <p>The list of messages to be sent. Each message has the format: { "messageId": "string", "payload": "string"}.</p>
33 /// <p>The field names of message payloads (data) that you send to IoT Analytics:</p>
34 /// <ul>
35 /// <li>
36 /// <p>Must contain only alphanumeric characters and undescores (_). No other special characters are allowed.</p></li>
37 /// <li>
38 /// <p>Must begin with an alphabetic character or single underscore (_).</p></li>
39 /// <li>
40 /// <p>Cannot contain hyphens (-).</p></li>
41 /// <li>
42 /// <p>In regular expression terms: "^\[A-Za-z_\](\[A-Za-z0-9\]*|\[A-Za-z0-9\]\[A-Za-z0-9_\]*)$".</p></li>
43 /// <li>
44 /// <p>Cannot be more than 255 characters.</p></li>
45 /// <li>
46 /// <p>Are case insensitive. (Fields named foo and FOO in the same payload are considered duplicates.)</p></li>
47 /// </ul>
48 /// <p>For example, {"temp_01": 29} or {"_temp_01": 29} are valid, but {"temp-01": 29}, {"01_temp": 29} or {"__temp_01": 29} are invalid in message payloads.</p>
49 ///
50 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.messages.is_none()`.
51 pub fn messages(&self) -> &[crate::types::Message] {
52 self.messages.as_deref().unwrap_or_default()
53 }
54}
55impl BatchPutMessageInput {
56 /// Creates a new builder-style object to manufacture [`BatchPutMessageInput`](crate::operation::batch_put_message::BatchPutMessageInput).
57 pub fn builder() -> crate::operation::batch_put_message::builders::BatchPutMessageInputBuilder {
58 crate::operation::batch_put_message::builders::BatchPutMessageInputBuilder::default()
59 }
60}
61
62/// A builder for [`BatchPutMessageInput`](crate::operation::batch_put_message::BatchPutMessageInput).
63#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
64#[non_exhaustive]
65pub struct BatchPutMessageInputBuilder {
66 pub(crate) channel_name: ::std::option::Option<::std::string::String>,
67 pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
68}
69impl BatchPutMessageInputBuilder {
70 /// <p>The name of the channel where the messages are sent.</p>
71 /// This field is required.
72 pub fn channel_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
73 self.channel_name = ::std::option::Option::Some(input.into());
74 self
75 }
76 /// <p>The name of the channel where the messages are sent.</p>
77 pub fn set_channel_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
78 self.channel_name = input;
79 self
80 }
81 /// <p>The name of the channel where the messages are sent.</p>
82 pub fn get_channel_name(&self) -> &::std::option::Option<::std::string::String> {
83 &self.channel_name
84 }
85 /// Appends an item to `messages`.
86 ///
87 /// To override the contents of this collection use [`set_messages`](Self::set_messages).
88 ///
89 /// <p>The list of messages to be sent. Each message has the format: { "messageId": "string", "payload": "string"}.</p>
90 /// <p>The field names of message payloads (data) that you send to IoT Analytics:</p>
91 /// <ul>
92 /// <li>
93 /// <p>Must contain only alphanumeric characters and undescores (_). No other special characters are allowed.</p></li>
94 /// <li>
95 /// <p>Must begin with an alphabetic character or single underscore (_).</p></li>
96 /// <li>
97 /// <p>Cannot contain hyphens (-).</p></li>
98 /// <li>
99 /// <p>In regular expression terms: "^\[A-Za-z_\](\[A-Za-z0-9\]*|\[A-Za-z0-9\]\[A-Za-z0-9_\]*)$".</p></li>
100 /// <li>
101 /// <p>Cannot be more than 255 characters.</p></li>
102 /// <li>
103 /// <p>Are case insensitive. (Fields named foo and FOO in the same payload are considered duplicates.)</p></li>
104 /// </ul>
105 /// <p>For example, {"temp_01": 29} or {"_temp_01": 29} are valid, but {"temp-01": 29}, {"01_temp": 29} or {"__temp_01": 29} are invalid in message payloads.</p>
106 pub fn messages(mut self, input: crate::types::Message) -> Self {
107 let mut v = self.messages.unwrap_or_default();
108 v.push(input);
109 self.messages = ::std::option::Option::Some(v);
110 self
111 }
112 /// <p>The list of messages to be sent. Each message has the format: { "messageId": "string", "payload": "string"}.</p>
113 /// <p>The field names of message payloads (data) that you send to IoT Analytics:</p>
114 /// <ul>
115 /// <li>
116 /// <p>Must contain only alphanumeric characters and undescores (_). No other special characters are allowed.</p></li>
117 /// <li>
118 /// <p>Must begin with an alphabetic character or single underscore (_).</p></li>
119 /// <li>
120 /// <p>Cannot contain hyphens (-).</p></li>
121 /// <li>
122 /// <p>In regular expression terms: "^\[A-Za-z_\](\[A-Za-z0-9\]*|\[A-Za-z0-9\]\[A-Za-z0-9_\]*)$".</p></li>
123 /// <li>
124 /// <p>Cannot be more than 255 characters.</p></li>
125 /// <li>
126 /// <p>Are case insensitive. (Fields named foo and FOO in the same payload are considered duplicates.)</p></li>
127 /// </ul>
128 /// <p>For example, {"temp_01": 29} or {"_temp_01": 29} are valid, but {"temp-01": 29}, {"01_temp": 29} or {"__temp_01": 29} are invalid in message payloads.</p>
129 pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
130 self.messages = input;
131 self
132 }
133 /// <p>The list of messages to be sent. Each message has the format: { "messageId": "string", "payload": "string"}.</p>
134 /// <p>The field names of message payloads (data) that you send to IoT Analytics:</p>
135 /// <ul>
136 /// <li>
137 /// <p>Must contain only alphanumeric characters and undescores (_). No other special characters are allowed.</p></li>
138 /// <li>
139 /// <p>Must begin with an alphabetic character or single underscore (_).</p></li>
140 /// <li>
141 /// <p>Cannot contain hyphens (-).</p></li>
142 /// <li>
143 /// <p>In regular expression terms: "^\[A-Za-z_\](\[A-Za-z0-9\]*|\[A-Za-z0-9\]\[A-Za-z0-9_\]*)$".</p></li>
144 /// <li>
145 /// <p>Cannot be more than 255 characters.</p></li>
146 /// <li>
147 /// <p>Are case insensitive. (Fields named foo and FOO in the same payload are considered duplicates.)</p></li>
148 /// </ul>
149 /// <p>For example, {"temp_01": 29} or {"_temp_01": 29} are valid, but {"temp-01": 29}, {"01_temp": 29} or {"__temp_01": 29} are invalid in message payloads.</p>
150 pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
151 &self.messages
152 }
153 /// Consumes the builder and constructs a [`BatchPutMessageInput`](crate::operation::batch_put_message::BatchPutMessageInput).
154 pub fn build(
155 self,
156 ) -> ::std::result::Result<crate::operation::batch_put_message::BatchPutMessageInput, ::aws_smithy_types::error::operation::BuildError> {
157 ::std::result::Result::Ok(crate::operation::batch_put_message::BatchPutMessageInput {
158 channel_name: self.channel_name,
159 messages: self.messages,
160 })
161 }
162}