aws-sdk-iotdataplane 1.99.0

AWS SDK for AWS IoT Data Plane
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The output from the GetRetainedMessage operation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct GetRetainedMessageOutput {
    /// <p>The topic name to which the retained message was published.</p>
    pub topic: ::std::option::Option<::std::string::String>,
    /// <p>The Base64-encoded message payload of the retained message body.</p>
    pub payload: ::std::option::Option<::aws_smithy_types::Blob>,
    /// <p>The quality of service (QoS) level used to publish the retained message.</p>
    pub qos: i32,
    /// <p>The Epoch date and time, in milliseconds, when the retained message was stored by IoT.</p>
    pub last_modified_time: i64,
    /// <p>A base64-encoded JSON string that includes an array of JSON objects, or null if the retained message doesn't include any user properties.</p>
    /// <p>The following example <code>userProperties</code> parameter is a JSON string that represents two user properties. Note that it will be base64-encoded:</p>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub user_properties: ::std::option::Option<::aws_smithy_types::Blob>,
    _request_id: Option<String>,
}
impl GetRetainedMessageOutput {
    /// <p>The topic name to which the retained message was published.</p>
    pub fn topic(&self) -> ::std::option::Option<&str> {
        self.topic.as_deref()
    }
    /// <p>The Base64-encoded message payload of the retained message body.</p>
    pub fn payload(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
        self.payload.as_ref()
    }
    /// <p>The quality of service (QoS) level used to publish the retained message.</p>
    pub fn qos(&self) -> i32 {
        self.qos
    }
    /// <p>The Epoch date and time, in milliseconds, when the retained message was stored by IoT.</p>
    pub fn last_modified_time(&self) -> i64 {
        self.last_modified_time
    }
    /// <p>A base64-encoded JSON string that includes an array of JSON objects, or null if the retained message doesn't include any user properties.</p>
    /// <p>The following example <code>userProperties</code> parameter is a JSON string that represents two user properties. Note that it will be base64-encoded:</p>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub fn user_properties(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
        self.user_properties.as_ref()
    }
}
impl ::aws_types::request_id::RequestId for GetRetainedMessageOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl GetRetainedMessageOutput {
    /// Creates a new builder-style object to manufacture [`GetRetainedMessageOutput`](crate::operation::get_retained_message::GetRetainedMessageOutput).
    pub fn builder() -> crate::operation::get_retained_message::builders::GetRetainedMessageOutputBuilder {
        crate::operation::get_retained_message::builders::GetRetainedMessageOutputBuilder::default()
    }
}

/// A builder for [`GetRetainedMessageOutput`](crate::operation::get_retained_message::GetRetainedMessageOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GetRetainedMessageOutputBuilder {
    pub(crate) topic: ::std::option::Option<::std::string::String>,
    pub(crate) payload: ::std::option::Option<::aws_smithy_types::Blob>,
    pub(crate) qos: ::std::option::Option<i32>,
    pub(crate) last_modified_time: ::std::option::Option<i64>,
    pub(crate) user_properties: ::std::option::Option<::aws_smithy_types::Blob>,
    _request_id: Option<String>,
}
impl GetRetainedMessageOutputBuilder {
    /// <p>The topic name to which the retained message was published.</p>
    pub fn topic(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.topic = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The topic name to which the retained message was published.</p>
    pub fn set_topic(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.topic = input;
        self
    }
    /// <p>The topic name to which the retained message was published.</p>
    pub fn get_topic(&self) -> &::std::option::Option<::std::string::String> {
        &self.topic
    }
    /// <p>The Base64-encoded message payload of the retained message body.</p>
    pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
        self.payload = ::std::option::Option::Some(input);
        self
    }
    /// <p>The Base64-encoded message payload of the retained message body.</p>
    pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
        self.payload = input;
        self
    }
    /// <p>The Base64-encoded message payload of the retained message body.</p>
    pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
        &self.payload
    }
    /// <p>The quality of service (QoS) level used to publish the retained message.</p>
    pub fn qos(mut self, input: i32) -> Self {
        self.qos = ::std::option::Option::Some(input);
        self
    }
    /// <p>The quality of service (QoS) level used to publish the retained message.</p>
    pub fn set_qos(mut self, input: ::std::option::Option<i32>) -> Self {
        self.qos = input;
        self
    }
    /// <p>The quality of service (QoS) level used to publish the retained message.</p>
    pub fn get_qos(&self) -> &::std::option::Option<i32> {
        &self.qos
    }
    /// <p>The Epoch date and time, in milliseconds, when the retained message was stored by IoT.</p>
    pub fn last_modified_time(mut self, input: i64) -> Self {
        self.last_modified_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>The Epoch date and time, in milliseconds, when the retained message was stored by IoT.</p>
    pub fn set_last_modified_time(mut self, input: ::std::option::Option<i64>) -> Self {
        self.last_modified_time = input;
        self
    }
    /// <p>The Epoch date and time, in milliseconds, when the retained message was stored by IoT.</p>
    pub fn get_last_modified_time(&self) -> &::std::option::Option<i64> {
        &self.last_modified_time
    }
    /// <p>A base64-encoded JSON string that includes an array of JSON objects, or null if the retained message doesn't include any user properties.</p>
    /// <p>The following example <code>userProperties</code> parameter is a JSON string that represents two user properties. Note that it will be base64-encoded:</p>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub fn user_properties(mut self, input: ::aws_smithy_types::Blob) -> Self {
        self.user_properties = ::std::option::Option::Some(input);
        self
    }
    /// <p>A base64-encoded JSON string that includes an array of JSON objects, or null if the retained message doesn't include any user properties.</p>
    /// <p>The following example <code>userProperties</code> parameter is a JSON string that represents two user properties. Note that it will be base64-encoded:</p>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub fn set_user_properties(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
        self.user_properties = input;
        self
    }
    /// <p>A base64-encoded JSON string that includes an array of JSON objects, or null if the retained message doesn't include any user properties.</p>
    /// <p>The following example <code>userProperties</code> parameter is a JSON string that represents two user properties. Note that it will be base64-encoded:</p>
    /// <p><code>\[{"deviceName": "alpha"}, {"deviceCnt": "45"}\]</code></p>
    pub fn get_user_properties(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
        &self.user_properties
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`GetRetainedMessageOutput`](crate::operation::get_retained_message::GetRetainedMessageOutput).
    pub fn build(self) -> crate::operation::get_retained_message::GetRetainedMessageOutput {
        crate::operation::get_retained_message::GetRetainedMessageOutput {
            topic: self.topic,
            payload: self.payload,
            qos: self.qos.unwrap_or_default(),
            last_modified_time: self.last_modified_time.unwrap_or_default(),
            user_properties: self.user_properties,
            _request_id: self._request_id,
        }
    }
}