aws_sdk_iotdataplane/operation/send_direct_message/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::send_direct_message::_send_direct_message_input::SendDirectMessageInputBuilder;
3
4pub use crate::operation::send_direct_message::_send_direct_message_output::SendDirectMessageOutputBuilder;
5
6impl crate::operation::send_direct_message::builders::SendDirectMessageInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::send_direct_message::SendDirectMessageOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::send_direct_message::SendDirectMessageError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.send_direct_message();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `SendDirectMessage`.
24///
25/// <p>Sends an MQTT message directly to a specific client identified by its client ID.</p>
26/// <p><code>SendDirectMessage</code> targets a single client ID. The receiving client does not need to subscribe to the topic, but the receiver's policy must allow <code>iot:Receive</code> on the specified topic.</p>
27/// <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">SendDirectMessage</a> action.</p>
28/// <p>For more information about messaging costs, see <a href="http://aws.amazon.com/iot-core/pricing/">Amazon Web Services IoT Core pricing</a>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct SendDirectMessageFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::send_direct_message::builders::SendDirectMessageInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::send_direct_message::SendDirectMessageOutput,
38 crate::operation::send_direct_message::SendDirectMessageError,
39 > for SendDirectMessageFluentBuilder
40{
41 fn send(
42 self,
43 config_override: crate::config::Builder,
44 ) -> crate::client::customize::internal::BoxFuture<
45 crate::client::customize::internal::SendResult<
46 crate::operation::send_direct_message::SendDirectMessageOutput,
47 crate::operation::send_direct_message::SendDirectMessageError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl SendDirectMessageFluentBuilder {
54 /// Creates a new `SendDirectMessageFluentBuilder`.
55 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56 Self {
57 handle,
58 inner: ::std::default::Default::default(),
59 config_override: ::std::option::Option::None,
60 }
61 }
62 /// Access the SendDirectMessage as a reference.
63 pub fn as_input(&self) -> &crate::operation::send_direct_message::builders::SendDirectMessageInputBuilder {
64 &self.inner
65 }
66 /// Sends the request and returns the response.
67 ///
68 /// If an error occurs, an `SdkError` will be returned with additional details that
69 /// can be matched against.
70 ///
71 /// By default, any retryable failures will be retried twice. Retry behavior
72 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73 /// set when configuring the client.
74 pub async fn send(
75 self,
76 ) -> ::std::result::Result<
77 crate::operation::send_direct_message::SendDirectMessageOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::send_direct_message::SendDirectMessageError,
80 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81 >,
82 > {
83 let input = self
84 .inner
85 .build()
86 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87 let runtime_plugins = crate::operation::send_direct_message::SendDirectMessage::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 crate::operation::send_direct_message::SendDirectMessage::orchestrate(&runtime_plugins, input).await
93 }
94
95 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96 pub fn customize(
97 self,
98 ) -> crate::client::customize::CustomizableOperation<
99 crate::operation::send_direct_message::SendDirectMessageOutput,
100 crate::operation::send_direct_message::SendDirectMessageError,
101 Self,
102 > {
103 crate::client::customize::CustomizableOperation::new(self)
104 }
105 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106 self.set_config_override(::std::option::Option::Some(config_override.into()));
107 self
108 }
109
110 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111 self.config_override = config_override;
112 self
113 }
114 /// <p>The unique identifier of the MQTT client to send the message to.</p>
115 /// <p>Client IDs must not exceed 128 characters and can't start with a dollar sign ($). MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
116 pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.client_id(input.into());
118 self
119 }
120 /// <p>The unique identifier of the MQTT client to send the message to.</p>
121 /// <p>Client IDs must not exceed 128 characters and can't start with a dollar sign ($). MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
122 pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123 self.inner = self.inner.set_client_id(input);
124 self
125 }
126 /// <p>The unique identifier of the MQTT client to send the message to.</p>
127 /// <p>Client IDs must not exceed 128 characters and can't start with a dollar sign ($). MQTT client IDs must be URL encoded (percent-encoded) when they contain characters that are not valid in HTTP requests, such as spaces, forward slashes (/), and UTF-8 characters. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
128 pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
129 self.inner.get_client_id()
130 }
131 /// <p>The topic of the outbound MQTT Publish message to the receiving client. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
132 pub fn topic(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133 self.inner = self.inner.topic(input.into());
134 self
135 }
136 /// <p>The topic of the outbound MQTT Publish message to the receiving client. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
137 pub fn set_topic(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138 self.inner = self.inner.set_topic(input);
139 self
140 }
141 /// <p>The topic of the outbound MQTT Publish message to the receiving client. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
142 pub fn get_topic(&self) -> &::std::option::Option<::std::string::String> {
143 self.inner.get_topic()
144 }
145 /// <p>The MQTT5 content type property forwarded to the receiving client (for example, <code>application/json</code>).</p>
146 pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147 self.inner = self.inner.content_type(input.into());
148 self
149 }
150 /// <p>The MQTT5 content type property forwarded to the receiving client (for example, <code>application/json</code>).</p>
151 pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.inner = self.inner.set_content_type(input);
153 self
154 }
155 /// <p>The MQTT5 content type property forwarded to the receiving client (for example, <code>application/json</code>).</p>
156 pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
157 self.inner.get_content_type()
158 }
159 /// <p>A UTF-8 encoded string that's used as the topic name for a response message. The response topic describes the topic which the receiver should publish to as part of the request-response flow. The topic must not contain wildcard characters. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
160 pub fn response_topic(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.response_topic(input.into());
162 self
163 }
164 /// <p>A UTF-8 encoded string that's used as the topic name for a response message. The response topic describes the topic which the receiver should publish to as part of the request-response flow. The topic must not contain wildcard characters. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
165 pub fn set_response_topic(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_response_topic(input);
167 self
168 }
169 /// <p>A UTF-8 encoded string that's used as the topic name for a response message. The response topic describes the topic which the receiver should publish to as part of the request-response flow. The topic must not contain wildcard characters. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot-core.html#message-broker-limits">Amazon Web Services IoT Core message broker and protocol limits and quotas</a>.</p>
170 pub fn get_response_topic(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_response_topic()
172 }
173 /// <p>A Boolean value that specifies whether to wait for delivery confirmation from the receiving client.</p>
174 /// <p>When set to <code>true</code>, the API delivers the message at QoS 1 and waits for the client to send a delivery confirmation (PUBACK) before returning a successful response. If delivery confirmation is not received within the specified <code>timeout</code> period, the API returns HTTP 504.</p>
175 /// <p>When set to <code>false</code>, the API delivers the message at QoS 0 and returns after Amazon Web Services IoT Core attempts to deliver the message.</p>
176 /// <p>Valid values: <code>true</code> | <code>false</code></p>
177 /// <p>Default value: <code>false</code></p>
178 pub fn confirmation(mut self, input: bool) -> Self {
179 self.inner = self.inner.confirmation(input);
180 self
181 }
182 /// <p>A Boolean value that specifies whether to wait for delivery confirmation from the receiving client.</p>
183 /// <p>When set to <code>true</code>, the API delivers the message at QoS 1 and waits for the client to send a delivery confirmation (PUBACK) before returning a successful response. If delivery confirmation is not received within the specified <code>timeout</code> period, the API returns HTTP 504.</p>
184 /// <p>When set to <code>false</code>, the API delivers the message at QoS 0 and returns after Amazon Web Services IoT Core attempts to deliver the message.</p>
185 /// <p>Valid values: <code>true</code> | <code>false</code></p>
186 /// <p>Default value: <code>false</code></p>
187 pub fn set_confirmation(mut self, input: ::std::option::Option<bool>) -> Self {
188 self.inner = self.inner.set_confirmation(input);
189 self
190 }
191 /// <p>A Boolean value that specifies whether to wait for delivery confirmation from the receiving client.</p>
192 /// <p>When set to <code>true</code>, the API delivers the message at QoS 1 and waits for the client to send a delivery confirmation (PUBACK) before returning a successful response. If delivery confirmation is not received within the specified <code>timeout</code> period, the API returns HTTP 504.</p>
193 /// <p>When set to <code>false</code>, the API delivers the message at QoS 0 and returns after Amazon Web Services IoT Core attempts to deliver the message.</p>
194 /// <p>Valid values: <code>true</code> | <code>false</code></p>
195 /// <p>Default value: <code>false</code></p>
196 pub fn get_confirmation(&self) -> &::std::option::Option<bool> {
197 self.inner.get_confirmation()
198 }
199 /// <p>An integer that represents the maximum time, in seconds, to wait for a delivery confirmation (PUBACK) from the receiving client after the message has been delivered. This parameter is only used when <code>confirmation</code> is set to <code>true</code>. If <code>confirmation</code> is <code>false</code>, this parameter is ignored.</p>
200 /// <p>The total API response time may be higher than this value due to internal processing. Set your HTTP client timeout to a value greater than this parameter.</p>
201 /// <p>Valid range: 1 to 15 seconds.</p>
202 /// <p>Default value: <code>5</code> seconds.</p>
203 pub fn timeout(mut self, input: i32) -> Self {
204 self.inner = self.inner.timeout(input);
205 self
206 }
207 /// <p>An integer that represents the maximum time, in seconds, to wait for a delivery confirmation (PUBACK) from the receiving client after the message has been delivered. This parameter is only used when <code>confirmation</code> is set to <code>true</code>. If <code>confirmation</code> is <code>false</code>, this parameter is ignored.</p>
208 /// <p>The total API response time may be higher than this value due to internal processing. Set your HTTP client timeout to a value greater than this parameter.</p>
209 /// <p>Valid range: 1 to 15 seconds.</p>
210 /// <p>Default value: <code>5</code> seconds.</p>
211 pub fn set_timeout(mut self, input: ::std::option::Option<i32>) -> Self {
212 self.inner = self.inner.set_timeout(input);
213 self
214 }
215 /// <p>An integer that represents the maximum time, in seconds, to wait for a delivery confirmation (PUBACK) from the receiving client after the message has been delivered. This parameter is only used when <code>confirmation</code> is set to <code>true</code>. If <code>confirmation</code> is <code>false</code>, this parameter is ignored.</p>
216 /// <p>The total API response time may be higher than this value due to internal processing. Set your HTTP client timeout to a value greater than this parameter.</p>
217 /// <p>Valid range: 1 to 15 seconds.</p>
218 /// <p>Default value: <code>5</code> seconds.</p>
219 pub fn get_timeout(&self) -> &::std::option::Option<i32> {
220 self.inner.get_timeout()
221 }
222 /// <p>The message body. MQTT accepts text, binary, and empty (null) message payloads.</p>
223 pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
224 self.inner = self.inner.payload(input);
225 self
226 }
227 /// <p>The message body. MQTT accepts text, binary, and empty (null) message payloads.</p>
228 pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
229 self.inner = self.inner.set_payload(input);
230 self
231 }
232 /// <p>The message body. MQTT accepts text, binary, and empty (null) message payloads.</p>
233 pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
234 self.inner.get_payload()
235 }
236 /// <p>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. <code>userProperties</code> is an HTTP header value in the API.</p>
237 /// <p>For MQTT 3.1.1 clients, user properties are silently dropped.</p>
238 /// <p>The following example <code>userProperties</code> parameter is a JSON string which represents two User Properties. Note that it needs to be base64-encoded:</p>
239 /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
240 pub fn user_properties(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
241 self.inner = self.inner.user_properties(input.into());
242 self
243 }
244 /// <p>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. <code>userProperties</code> is an HTTP header value in the API.</p>
245 /// <p>For MQTT 3.1.1 clients, user properties are silently dropped.</p>
246 /// <p>The following example <code>userProperties</code> parameter is a JSON string which represents two User Properties. Note that it needs to be base64-encoded:</p>
247 /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
248 pub fn set_user_properties(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
249 self.inner = self.inner.set_user_properties(input);
250 self
251 }
252 /// <p>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. <code>userProperties</code> is an HTTP header value in the API.</p>
253 /// <p>For MQTT 3.1.1 clients, user properties are silently dropped.</p>
254 /// <p>The following example <code>userProperties</code> parameter is a JSON string which represents two User Properties. Note that it needs to be base64-encoded:</p>
255 /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
256 pub fn get_user_properties(&self) -> &::std::option::Option<::std::string::String> {
257 self.inner.get_user_properties()
258 }
259 /// <p>An <code>Enum</code> string value that indicates whether the payload is formatted as UTF-8. <code>payloadFormatIndicator</code> is an HTTP header value in the API.</p>
260 pub fn payload_format_indicator(mut self, input: crate::types::PayloadFormatIndicator) -> Self {
261 self.inner = self.inner.payload_format_indicator(input);
262 self
263 }
264 /// <p>An <code>Enum</code> string value that indicates whether the payload is formatted as UTF-8. <code>payloadFormatIndicator</code> is an HTTP header value in the API.</p>
265 pub fn set_payload_format_indicator(mut self, input: ::std::option::Option<crate::types::PayloadFormatIndicator>) -> Self {
266 self.inner = self.inner.set_payload_format_indicator(input);
267 self
268 }
269 /// <p>An <code>Enum</code> string value that indicates whether the payload is formatted as UTF-8. <code>payloadFormatIndicator</code> is an HTTP header value in the API.</p>
270 pub fn get_payload_format_indicator(&self) -> &::std::option::Option<crate::types::PayloadFormatIndicator> {
271 self.inner.get_payload_format_indicator()
272 }
273 /// <p>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. <code>correlationData</code> is an HTTP header value in the API.</p>
274 pub fn correlation_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
275 self.inner = self.inner.correlation_data(input.into());
276 self
277 }
278 /// <p>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. <code>correlationData</code> is an HTTP header value in the API.</p>
279 pub fn set_correlation_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
280 self.inner = self.inner.set_correlation_data(input);
281 self
282 }
283 /// <p>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. <code>correlationData</code> is an HTTP header value in the API.</p>
284 pub fn get_correlation_data(&self) -> &::std::option::Option<::std::string::String> {
285 self.inner.get_correlation_data()
286 }
287}