Skip to main content

aws_sdk_iot/types/
_mqtt_context.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Specifies the MQTT context to use for the test authorizer request</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct MqttContext {
7    /// <p>The value of the <code>username</code> key in an MQTT authorization request.</p>
8    pub username: ::std::option::Option<::std::string::String>,
9    /// <p>The value of the <code>password</code> key in an MQTT authorization request.</p>
10    pub password: ::std::option::Option<::aws_smithy_types::Blob>,
11    /// <p>The value of the <code>clientId</code> key in an MQTT authorization request.</p>
12    pub client_id: ::std::option::Option<::std::string::String>,
13}
14impl MqttContext {
15    /// <p>The value of the <code>username</code> key in an MQTT authorization request.</p>
16    pub fn username(&self) -> ::std::option::Option<&str> {
17        self.username.as_deref()
18    }
19    /// <p>The value of the <code>password</code> key in an MQTT authorization request.</p>
20    pub fn password(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
21        self.password.as_ref()
22    }
23    /// <p>The value of the <code>clientId</code> key in an MQTT authorization request.</p>
24    pub fn client_id(&self) -> ::std::option::Option<&str> {
25        self.client_id.as_deref()
26    }
27}
28impl MqttContext {
29    /// Creates a new builder-style object to manufacture [`MqttContext`](crate::types::MqttContext).
30    pub fn builder() -> crate::types::builders::MqttContextBuilder {
31        crate::types::builders::MqttContextBuilder::default()
32    }
33}
34
35/// A builder for [`MqttContext`](crate::types::MqttContext).
36#[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    /// <p>The value of the <code>username</code> key in an MQTT authorization request.</p>
45    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    /// <p>The value of the <code>username</code> key in an MQTT authorization request.</p>
50    pub fn set_username(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.username = input;
52        self
53    }
54    /// <p>The value of the <code>username</code> key in an MQTT authorization request.</p>
55    pub fn get_username(&self) -> &::std::option::Option<::std::string::String> {
56        &self.username
57    }
58    /// <p>The value of the <code>password</code> key in an MQTT authorization request.</p>
59    pub fn password(mut self, input: ::aws_smithy_types::Blob) -> Self {
60        self.password = ::std::option::Option::Some(input);
61        self
62    }
63    /// <p>The value of the <code>password</code> key in an MQTT authorization request.</p>
64    pub fn set_password(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
65        self.password = input;
66        self
67    }
68    /// <p>The value of the <code>password</code> key in an MQTT authorization request.</p>
69    pub fn get_password(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
70        &self.password
71    }
72    /// <p>The value of the <code>clientId</code> key in an MQTT authorization request.</p>
73    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    /// <p>The value of the <code>clientId</code> key in an MQTT authorization request.</p>
78    pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.client_id = input;
80        self
81    }
82    /// <p>The value of the <code>clientId</code> key in an MQTT authorization request.</p>
83    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
84        &self.client_id
85    }
86    /// Consumes the builder and constructs a [`MqttContext`](crate::types::MqttContext).
87    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}