aws-sdk-iotdataplane 1.103.0

AWS SDK for AWS IoT Data Plane
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::send_direct_message::_send_direct_message_input::SendDirectMessageInputBuilder;

pub use crate::operation::send_direct_message::_send_direct_message_output::SendDirectMessageOutputBuilder;

impl crate::operation::send_direct_message::builders::SendDirectMessageInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::send_direct_message::SendDirectMessageOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::send_direct_message::SendDirectMessageError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.send_direct_message();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `SendDirectMessage`.
///
/// <p>Sends an MQTT message directly to a specific client identified by its client ID.</p>
/// <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>
/// <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>
/// <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>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct SendDirectMessageFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::send_direct_message::builders::SendDirectMessageInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::send_direct_message::SendDirectMessageOutput,
        crate::operation::send_direct_message::SendDirectMessageError,
    > for SendDirectMessageFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::send_direct_message::SendDirectMessageOutput,
            crate::operation::send_direct_message::SendDirectMessageError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl SendDirectMessageFluentBuilder {
    /// Creates a new `SendDirectMessageFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the SendDirectMessage as a reference.
    pub fn as_input(&self) -> &crate::operation::send_direct_message::builders::SendDirectMessageInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::send_direct_message::SendDirectMessageOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::send_direct_message::SendDirectMessageError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::send_direct_message::SendDirectMessage::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::send_direct_message::SendDirectMessage::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::send_direct_message::SendDirectMessageOutput,
        crate::operation::send_direct_message::SendDirectMessageError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <p>The unique identifier of the MQTT client to send the message to.</p>
    /// <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>
    pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.client_id(input.into());
        self
    }
    /// <p>The unique identifier of the MQTT client to send the message to.</p>
    /// <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>
    pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_client_id(input);
        self
    }
    /// <p>The unique identifier of the MQTT client to send the message to.</p>
    /// <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>
    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_client_id()
    }
    /// <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>
    pub fn topic(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.topic(input.into());
        self
    }
    /// <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>
    pub fn set_topic(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_topic(input);
        self
    }
    /// <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>
    pub fn get_topic(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_topic()
    }
    /// <p>The MQTT5 content type property forwarded to the receiving client (for example, <code>application/json</code>).</p>
    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.content_type(input.into());
        self
    }
    /// <p>The MQTT5 content type property forwarded to the receiving client (for example, <code>application/json</code>).</p>
    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_content_type(input);
        self
    }
    /// <p>The MQTT5 content type property forwarded to the receiving client (for example, <code>application/json</code>).</p>
    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_content_type()
    }
    /// <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>
    pub fn response_topic(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.response_topic(input.into());
        self
    }
    /// <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>
    pub fn set_response_topic(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_response_topic(input);
        self
    }
    /// <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>
    pub fn get_response_topic(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_response_topic()
    }
    /// <p>A Boolean value that specifies whether to wait for delivery confirmation from the receiving client.</p>
    /// <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>
    /// <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>
    /// <p>Valid values: <code>true</code> | <code>false</code></p>
    /// <p>Default value: <code>false</code></p>
    pub fn confirmation(mut self, input: bool) -> Self {
        self.inner = self.inner.confirmation(input);
        self
    }
    /// <p>A Boolean value that specifies whether to wait for delivery confirmation from the receiving client.</p>
    /// <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>
    /// <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>
    /// <p>Valid values: <code>true</code> | <code>false</code></p>
    /// <p>Default value: <code>false</code></p>
    pub fn set_confirmation(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_confirmation(input);
        self
    }
    /// <p>A Boolean value that specifies whether to wait for delivery confirmation from the receiving client.</p>
    /// <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>
    /// <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>
    /// <p>Valid values: <code>true</code> | <code>false</code></p>
    /// <p>Default value: <code>false</code></p>
    pub fn get_confirmation(&self) -> &::std::option::Option<bool> {
        self.inner.get_confirmation()
    }
    /// <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>
    /// <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>
    /// <p>Valid range: 1 to 15 seconds.</p>
    /// <p>Default value: <code>5</code> seconds.</p>
    pub fn timeout(mut self, input: i32) -> Self {
        self.inner = self.inner.timeout(input);
        self
    }
    /// <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>
    /// <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>
    /// <p>Valid range: 1 to 15 seconds.</p>
    /// <p>Default value: <code>5</code> seconds.</p>
    pub fn set_timeout(mut self, input: ::std::option::Option<i32>) -> Self {
        self.inner = self.inner.set_timeout(input);
        self
    }
    /// <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>
    /// <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>
    /// <p>Valid range: 1 to 15 seconds.</p>
    /// <p>Default value: <code>5</code> seconds.</p>
    pub fn get_timeout(&self) -> &::std::option::Option<i32> {
        self.inner.get_timeout()
    }
    /// <p>The message body. MQTT accepts text, binary, and empty (null) message payloads.</p>
    pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
        self.inner = self.inner.payload(input);
        self
    }
    /// <p>The message body. MQTT accepts text, binary, and empty (null) message payloads.</p>
    pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
        self.inner = self.inner.set_payload(input);
        self
    }
    /// <p>The message body. MQTT accepts text, binary, and empty (null) message payloads.</p>
    pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
        self.inner.get_payload()
    }
    /// <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>
    /// <p>For MQTT 3.1.1 clients, user properties are silently dropped.</p>
    /// <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>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub fn user_properties(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.user_properties(input.into());
        self
    }
    /// <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>
    /// <p>For MQTT 3.1.1 clients, user properties are silently dropped.</p>
    /// <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>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub fn set_user_properties(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_user_properties(input);
        self
    }
    /// <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>
    /// <p>For MQTT 3.1.1 clients, user properties are silently dropped.</p>
    /// <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>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub fn get_user_properties(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_user_properties()
    }
    /// <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>
    pub fn payload_format_indicator(mut self, input: crate::types::PayloadFormatIndicator) -> Self {
        self.inner = self.inner.payload_format_indicator(input);
        self
    }
    /// <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>
    pub fn set_payload_format_indicator(mut self, input: ::std::option::Option<crate::types::PayloadFormatIndicator>) -> Self {
        self.inner = self.inner.set_payload_format_indicator(input);
        self
    }
    /// <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>
    pub fn get_payload_format_indicator(&self) -> &::std::option::Option<crate::types::PayloadFormatIndicator> {
        self.inner.get_payload_format_indicator()
    }
    /// <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>
    pub fn correlation_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.correlation_data(input.into());
        self
    }
    /// <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>
    pub fn set_correlation_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_correlation_data(input);
        self
    }
    /// <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>
    pub fn get_correlation_data(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_correlation_data()
    }
}