aws_sdk_iot/types/
_mqtt_context.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct MqttContext {
7 pub username: ::std::option::Option<::std::string::String>,
9 pub password: ::std::option::Option<::aws_smithy_types::Blob>,
11 pub client_id: ::std::option::Option<::std::string::String>,
13}
14impl MqttContext {
15 pub fn username(&self) -> ::std::option::Option<&str> {
17 self.username.as_deref()
18 }
19 pub fn password(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
21 self.password.as_ref()
22 }
23 pub fn client_id(&self) -> ::std::option::Option<&str> {
25 self.client_id.as_deref()
26 }
27}
28impl MqttContext {
29 pub fn builder() -> crate::types::builders::MqttContextBuilder {
31 crate::types::builders::MqttContextBuilder::default()
32 }
33}
34
35#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct MqttContextBuilder {
39 pub(crate) username: ::std::option::Option<::std::string::String>,
40 pub(crate) password: ::std::option::Option<::aws_smithy_types::Blob>,
41 pub(crate) client_id: ::std::option::Option<::std::string::String>,
42}
43impl MqttContextBuilder {
44 pub fn username(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46 self.username = ::std::option::Option::Some(input.into());
47 self
48 }
49 pub fn set_username(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51 self.username = input;
52 self
53 }
54 pub fn get_username(&self) -> &::std::option::Option<::std::string::String> {
56 &self.username
57 }
58 pub fn password(mut self, input: ::aws_smithy_types::Blob) -> Self {
60 self.password = ::std::option::Option::Some(input);
61 self
62 }
63 pub fn set_password(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
65 self.password = input;
66 self
67 }
68 pub fn get_password(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
70 &self.password
71 }
72 pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74 self.client_id = ::std::option::Option::Some(input.into());
75 self
76 }
77 pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79 self.client_id = input;
80 self
81 }
82 pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
84 &self.client_id
85 }
86 pub fn build(self) -> crate::types::MqttContext {
88 crate::types::MqttContext {
89 username: self.username,
90 password: self.password,
91 client_id: self.client_id,
92 }
93 }
94}