1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Describes an action to republish to another topic.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct RepublishAction {
/// <p>The ARN of the IAM role that grants access.</p>
pub role_arn: ::std::string::String,
/// <p>The name of the MQTT topic.</p>
pub topic: ::std::string::String,
/// <p>The Quality of Service (QoS) level to use when republishing messages. The default value is 0.</p>
pub qos: ::std::option::Option<i32>,
/// <p>MQTT Version 5.0 headers information. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html"> MQTT</a> from the Amazon Web Services IoT Core Developer Guide.</p>
pub headers: ::std::option::Option<crate::types::MqttHeaders>,
}
impl RepublishAction {
/// <p>The ARN of the IAM role that grants access.</p>
pub fn role_arn(&self) -> &str {
use std::ops::Deref;
self.role_arn.deref()
}
/// <p>The name of the MQTT topic.</p>
pub fn topic(&self) -> &str {
use std::ops::Deref;
self.topic.deref()
}
/// <p>The Quality of Service (QoS) level to use when republishing messages. The default value is 0.</p>
pub fn qos(&self) -> ::std::option::Option<i32> {
self.qos
}
/// <p>MQTT Version 5.0 headers information. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html"> MQTT</a> from the Amazon Web Services IoT Core Developer Guide.</p>
pub fn headers(&self) -> ::std::option::Option<&crate::types::MqttHeaders> {
self.headers.as_ref()
}
}
impl RepublishAction {
/// Creates a new builder-style object to manufacture [`RepublishAction`](crate::types::RepublishAction).
pub fn builder() -> crate::types::builders::RepublishActionBuilder {
crate::types::builders::RepublishActionBuilder::default()
}
}
/// A builder for [`RepublishAction`](crate::types::RepublishAction).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct RepublishActionBuilder {
pub(crate) role_arn: ::std::option::Option<::std::string::String>,
pub(crate) topic: ::std::option::Option<::std::string::String>,
pub(crate) qos: ::std::option::Option<i32>,
pub(crate) headers: ::std::option::Option<crate::types::MqttHeaders>,
}
impl RepublishActionBuilder {
/// <p>The ARN of the IAM role that grants access.</p>
/// This field is required.
pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.role_arn = ::std::option::Option::Some(input.into());
self
}
/// <p>The ARN of the IAM role that grants access.</p>
pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.role_arn = input;
self
}
/// <p>The ARN of the IAM role that grants access.</p>
pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
&self.role_arn
}
/// <p>The name of the MQTT topic.</p>
/// This field is required.
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 name of the MQTT topic.</p>
pub fn set_topic(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.topic = input;
self
}
/// <p>The name of the MQTT topic.</p>
pub fn get_topic(&self) -> &::std::option::Option<::std::string::String> {
&self.topic
}
/// <p>The Quality of Service (QoS) level to use when republishing messages. The default value is 0.</p>
pub fn qos(mut self, input: i32) -> Self {
self.qos = ::std::option::Option::Some(input);
self
}
/// <p>The Quality of Service (QoS) level to use when republishing messages. The default value is 0.</p>
pub fn set_qos(mut self, input: ::std::option::Option<i32>) -> Self {
self.qos = input;
self
}
/// <p>The Quality of Service (QoS) level to use when republishing messages. The default value is 0.</p>
pub fn get_qos(&self) -> &::std::option::Option<i32> {
&self.qos
}
/// <p>MQTT Version 5.0 headers information. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html"> MQTT</a> from the Amazon Web Services IoT Core Developer Guide.</p>
pub fn headers(mut self, input: crate::types::MqttHeaders) -> Self {
self.headers = ::std::option::Option::Some(input);
self
}
/// <p>MQTT Version 5.0 headers information. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html"> MQTT</a> from the Amazon Web Services IoT Core Developer Guide.</p>
pub fn set_headers(mut self, input: ::std::option::Option<crate::types::MqttHeaders>) -> Self {
self.headers = input;
self
}
/// <p>MQTT Version 5.0 headers information. For more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html"> MQTT</a> from the Amazon Web Services IoT Core Developer Guide.</p>
pub fn get_headers(&self) -> &::std::option::Option<crate::types::MqttHeaders> {
&self.headers
}
/// Consumes the builder and constructs a [`RepublishAction`](crate::types::RepublishAction).
/// This method will fail if any of the following fields are not set:
/// - [`role_arn`](crate::types::builders::RepublishActionBuilder::role_arn)
/// - [`topic`](crate::types::builders::RepublishActionBuilder::topic)
pub fn build(self) -> ::std::result::Result<crate::types::RepublishAction, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::RepublishAction {
role_arn: self.role_arn.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"role_arn",
"role_arn was not specified but it is required when building RepublishAction",
)
})?,
topic: self.topic.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"topic",
"topic was not specified but it is required when building RepublishAction",
)
})?,
qos: self.qos,
headers: self.headers,
})
}
}