Skip to main content

aws_sdk_iotdataplane/operation/get_connection/
_get_connection_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetConnectionOutput {
6    /// <p>The connection state of the client. Returns <code>true</code> if the client is currently connected, or <code>false</code> if the client is not connected.</p>
7    pub connected: bool,
8    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
9    pub thing_name: ::std::option::Option<::std::string::String>,
10    /// <p>Indicates whether the client is using a clean session. Returns <code>true</code> for clean sessions or <code>false</code> for persistent sessions.</p>
11    pub clean_session: bool,
12    /// <p>The IP address of the client that initiated the connection.</p>
13    pub source_ip: ::std::option::Option<::std::string::String>,
14    /// <p>The client's source port.</p>
15    pub source_port: i32,
16    /// <p>The IP address of the Amazon Web Services IoT Core endpoint that the client connected to. For clients connected to VPC endpoints, this is the private IP address of the network interface the client is connected to.</p>
17    pub target_ip: ::std::option::Option<::std::string::String>,
18    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
19    pub target_port: i32,
20    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
21    pub keep_alive_duration: i32,
22    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
23    pub connected_since: i64,
24    /// <p>Unix timestamp (in milliseconds) indicating when the client disconnected. Present only when connected is false. This information is available for 30 minutes after the client disconnects.</p>
25    pub disconnected_since: i64,
26    /// <p>The reason for the last disconnection, if the client is currently disconnected. See the <a href="https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html#connect-disconnect">developer guide</a> for valid disconnect reasons.</p>
27    pub disconnect_reason: ::std::option::Option<::std::string::String>,
28    /// <p>The session expiry interval in seconds for the MQTT client connection. This is configured by the user. This value indicates how long the session will remain active after the client disconnects.</p>
29    pub session_expiry: i64,
30    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
31    pub client_id: ::std::option::Option<::std::string::String>,
32    /// <p>The ID of the VPC endpoint. Present for clients connected to IoT Core via a <a href="https://docs.aws.amazon.com/iot/latest/developerguide/IoTCore-VPC.html">VPC endpoint</a>.</p>
33    pub vpc_endpoint_id: ::std::option::Option<::std::string::String>,
34    _request_id: Option<String>,
35}
36impl GetConnectionOutput {
37    /// <p>The connection state of the client. Returns <code>true</code> if the client is currently connected, or <code>false</code> if the client is not connected.</p>
38    pub fn connected(&self) -> bool {
39        self.connected
40    }
41    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
42    pub fn thing_name(&self) -> ::std::option::Option<&str> {
43        self.thing_name.as_deref()
44    }
45    /// <p>Indicates whether the client is using a clean session. Returns <code>true</code> for clean sessions or <code>false</code> for persistent sessions.</p>
46    pub fn clean_session(&self) -> bool {
47        self.clean_session
48    }
49    /// <p>The IP address of the client that initiated the connection.</p>
50    pub fn source_ip(&self) -> ::std::option::Option<&str> {
51        self.source_ip.as_deref()
52    }
53    /// <p>The client's source port.</p>
54    pub fn source_port(&self) -> i32 {
55        self.source_port
56    }
57    /// <p>The IP address of the Amazon Web Services IoT Core endpoint that the client connected to. For clients connected to VPC endpoints, this is the private IP address of the network interface the client is connected to.</p>
58    pub fn target_ip(&self) -> ::std::option::Option<&str> {
59        self.target_ip.as_deref()
60    }
61    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
62    pub fn target_port(&self) -> i32 {
63        self.target_port
64    }
65    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
66    pub fn keep_alive_duration(&self) -> i32 {
67        self.keep_alive_duration
68    }
69    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
70    pub fn connected_since(&self) -> i64 {
71        self.connected_since
72    }
73    /// <p>Unix timestamp (in milliseconds) indicating when the client disconnected. Present only when connected is false. This information is available for 30 minutes after the client disconnects.</p>
74    pub fn disconnected_since(&self) -> i64 {
75        self.disconnected_since
76    }
77    /// <p>The reason for the last disconnection, if the client is currently disconnected. See the <a href="https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html#connect-disconnect">developer guide</a> for valid disconnect reasons.</p>
78    pub fn disconnect_reason(&self) -> ::std::option::Option<&str> {
79        self.disconnect_reason.as_deref()
80    }
81    /// <p>The session expiry interval in seconds for the MQTT client connection. This is configured by the user. This value indicates how long the session will remain active after the client disconnects.</p>
82    pub fn session_expiry(&self) -> i64 {
83        self.session_expiry
84    }
85    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
86    pub fn client_id(&self) -> ::std::option::Option<&str> {
87        self.client_id.as_deref()
88    }
89    /// <p>The ID of the VPC endpoint. Present for clients connected to IoT Core via a <a href="https://docs.aws.amazon.com/iot/latest/developerguide/IoTCore-VPC.html">VPC endpoint</a>.</p>
90    pub fn vpc_endpoint_id(&self) -> ::std::option::Option<&str> {
91        self.vpc_endpoint_id.as_deref()
92    }
93}
94impl ::aws_types::request_id::RequestId for GetConnectionOutput {
95    fn request_id(&self) -> Option<&str> {
96        self._request_id.as_deref()
97    }
98}
99impl GetConnectionOutput {
100    /// Creates a new builder-style object to manufacture [`GetConnectionOutput`](crate::operation::get_connection::GetConnectionOutput).
101    pub fn builder() -> crate::operation::get_connection::builders::GetConnectionOutputBuilder {
102        crate::operation::get_connection::builders::GetConnectionOutputBuilder::default()
103    }
104}
105
106/// A builder for [`GetConnectionOutput`](crate::operation::get_connection::GetConnectionOutput).
107#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
108#[non_exhaustive]
109pub struct GetConnectionOutputBuilder {
110    pub(crate) connected: ::std::option::Option<bool>,
111    pub(crate) thing_name: ::std::option::Option<::std::string::String>,
112    pub(crate) clean_session: ::std::option::Option<bool>,
113    pub(crate) source_ip: ::std::option::Option<::std::string::String>,
114    pub(crate) source_port: ::std::option::Option<i32>,
115    pub(crate) target_ip: ::std::option::Option<::std::string::String>,
116    pub(crate) target_port: ::std::option::Option<i32>,
117    pub(crate) keep_alive_duration: ::std::option::Option<i32>,
118    pub(crate) connected_since: ::std::option::Option<i64>,
119    pub(crate) disconnected_since: ::std::option::Option<i64>,
120    pub(crate) disconnect_reason: ::std::option::Option<::std::string::String>,
121    pub(crate) session_expiry: ::std::option::Option<i64>,
122    pub(crate) client_id: ::std::option::Option<::std::string::String>,
123    pub(crate) vpc_endpoint_id: ::std::option::Option<::std::string::String>,
124    _request_id: Option<String>,
125}
126impl GetConnectionOutputBuilder {
127    /// <p>The connection state of the client. Returns <code>true</code> if the client is currently connected, or <code>false</code> if the client is not connected.</p>
128    pub fn connected(mut self, input: bool) -> Self {
129        self.connected = ::std::option::Option::Some(input);
130        self
131    }
132    /// <p>The connection state of the client. Returns <code>true</code> if the client is currently connected, or <code>false</code> if the client is not connected.</p>
133    pub fn set_connected(mut self, input: ::std::option::Option<bool>) -> Self {
134        self.connected = input;
135        self
136    }
137    /// <p>The connection state of the client. Returns <code>true</code> if the client is currently connected, or <code>false</code> if the client is not connected.</p>
138    pub fn get_connected(&self) -> &::std::option::Option<bool> {
139        &self.connected
140    }
141    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
142    pub fn thing_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.thing_name = ::std::option::Option::Some(input.into());
144        self
145    }
146    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
147    pub fn set_thing_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.thing_name = input;
149        self
150    }
151    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
152    pub fn get_thing_name(&self) -> &::std::option::Option<::std::string::String> {
153        &self.thing_name
154    }
155    /// <p>Indicates whether the client is using a clean session. Returns <code>true</code> for clean sessions or <code>false</code> for persistent sessions.</p>
156    pub fn clean_session(mut self, input: bool) -> Self {
157        self.clean_session = ::std::option::Option::Some(input);
158        self
159    }
160    /// <p>Indicates whether the client is using a clean session. Returns <code>true</code> for clean sessions or <code>false</code> for persistent sessions.</p>
161    pub fn set_clean_session(mut self, input: ::std::option::Option<bool>) -> Self {
162        self.clean_session = input;
163        self
164    }
165    /// <p>Indicates whether the client is using a clean session. Returns <code>true</code> for clean sessions or <code>false</code> for persistent sessions.</p>
166    pub fn get_clean_session(&self) -> &::std::option::Option<bool> {
167        &self.clean_session
168    }
169    /// <p>The IP address of the client that initiated the connection.</p>
170    pub fn source_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171        self.source_ip = ::std::option::Option::Some(input.into());
172        self
173    }
174    /// <p>The IP address of the client that initiated the connection.</p>
175    pub fn set_source_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
176        self.source_ip = input;
177        self
178    }
179    /// <p>The IP address of the client that initiated the connection.</p>
180    pub fn get_source_ip(&self) -> &::std::option::Option<::std::string::String> {
181        &self.source_ip
182    }
183    /// <p>The client's source port.</p>
184    pub fn source_port(mut self, input: i32) -> Self {
185        self.source_port = ::std::option::Option::Some(input);
186        self
187    }
188    /// <p>The client's source port.</p>
189    pub fn set_source_port(mut self, input: ::std::option::Option<i32>) -> Self {
190        self.source_port = input;
191        self
192    }
193    /// <p>The client's source port.</p>
194    pub fn get_source_port(&self) -> &::std::option::Option<i32> {
195        &self.source_port
196    }
197    /// <p>The IP address of the Amazon Web Services IoT Core endpoint that the client connected to. For clients connected to VPC endpoints, this is the private IP address of the network interface the client is connected to.</p>
198    pub fn target_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
199        self.target_ip = ::std::option::Option::Some(input.into());
200        self
201    }
202    /// <p>The IP address of the Amazon Web Services IoT Core endpoint that the client connected to. For clients connected to VPC endpoints, this is the private IP address of the network interface the client is connected to.</p>
203    pub fn set_target_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204        self.target_ip = input;
205        self
206    }
207    /// <p>The IP address of the Amazon Web Services IoT Core endpoint that the client connected to. For clients connected to VPC endpoints, this is the private IP address of the network interface the client is connected to.</p>
208    pub fn get_target_ip(&self) -> &::std::option::Option<::std::string::String> {
209        &self.target_ip
210    }
211    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
212    pub fn target_port(mut self, input: i32) -> Self {
213        self.target_port = ::std::option::Option::Some(input);
214        self
215    }
216    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
217    pub fn set_target_port(mut self, input: ::std::option::Option<i32>) -> Self {
218        self.target_port = input;
219        self
220    }
221    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
222    pub fn get_target_port(&self) -> &::std::option::Option<i32> {
223        &self.target_port
224    }
225    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
226    pub fn keep_alive_duration(mut self, input: i32) -> Self {
227        self.keep_alive_duration = ::std::option::Option::Some(input);
228        self
229    }
230    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
231    pub fn set_keep_alive_duration(mut self, input: ::std::option::Option<i32>) -> Self {
232        self.keep_alive_duration = input;
233        self
234    }
235    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
236    pub fn get_keep_alive_duration(&self) -> &::std::option::Option<i32> {
237        &self.keep_alive_duration
238    }
239    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
240    pub fn connected_since(mut self, input: i64) -> Self {
241        self.connected_since = ::std::option::Option::Some(input);
242        self
243    }
244    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
245    pub fn set_connected_since(mut self, input: ::std::option::Option<i64>) -> Self {
246        self.connected_since = input;
247        self
248    }
249    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
250    pub fn get_connected_since(&self) -> &::std::option::Option<i64> {
251        &self.connected_since
252    }
253    /// <p>Unix timestamp (in milliseconds) indicating when the client disconnected. Present only when connected is false. This information is available for 30 minutes after the client disconnects.</p>
254    pub fn disconnected_since(mut self, input: i64) -> Self {
255        self.disconnected_since = ::std::option::Option::Some(input);
256        self
257    }
258    /// <p>Unix timestamp (in milliseconds) indicating when the client disconnected. Present only when connected is false. This information is available for 30 minutes after the client disconnects.</p>
259    pub fn set_disconnected_since(mut self, input: ::std::option::Option<i64>) -> Self {
260        self.disconnected_since = input;
261        self
262    }
263    /// <p>Unix timestamp (in milliseconds) indicating when the client disconnected. Present only when connected is false. This information is available for 30 minutes after the client disconnects.</p>
264    pub fn get_disconnected_since(&self) -> &::std::option::Option<i64> {
265        &self.disconnected_since
266    }
267    /// <p>The reason for the last disconnection, if the client is currently disconnected. See the <a href="https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html#connect-disconnect">developer guide</a> for valid disconnect reasons.</p>
268    pub fn disconnect_reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
269        self.disconnect_reason = ::std::option::Option::Some(input.into());
270        self
271    }
272    /// <p>The reason for the last disconnection, if the client is currently disconnected. See the <a href="https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html#connect-disconnect">developer guide</a> for valid disconnect reasons.</p>
273    pub fn set_disconnect_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
274        self.disconnect_reason = input;
275        self
276    }
277    /// <p>The reason for the last disconnection, if the client is currently disconnected. See the <a href="https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html#connect-disconnect">developer guide</a> for valid disconnect reasons.</p>
278    pub fn get_disconnect_reason(&self) -> &::std::option::Option<::std::string::String> {
279        &self.disconnect_reason
280    }
281    /// <p>The session expiry interval in seconds for the MQTT client connection. This is configured by the user. This value indicates how long the session will remain active after the client disconnects.</p>
282    pub fn session_expiry(mut self, input: i64) -> Self {
283        self.session_expiry = ::std::option::Option::Some(input);
284        self
285    }
286    /// <p>The session expiry interval in seconds for the MQTT client connection. This is configured by the user. This value indicates how long the session will remain active after the client disconnects.</p>
287    pub fn set_session_expiry(mut self, input: ::std::option::Option<i64>) -> Self {
288        self.session_expiry = input;
289        self
290    }
291    /// <p>The session expiry interval in seconds for the MQTT client connection. This is configured by the user. This value indicates how long the session will remain active after the client disconnects.</p>
292    pub fn get_session_expiry(&self) -> &::std::option::Option<i64> {
293        &self.session_expiry
294    }
295    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
296    pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
297        self.client_id = ::std::option::Option::Some(input.into());
298        self
299    }
300    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
301    pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
302        self.client_id = input;
303        self
304    }
305    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
306    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
307        &self.client_id
308    }
309    /// <p>The ID of the VPC endpoint. Present for clients connected to IoT Core via a <a href="https://docs.aws.amazon.com/iot/latest/developerguide/IoTCore-VPC.html">VPC endpoint</a>.</p>
310    pub fn vpc_endpoint_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
311        self.vpc_endpoint_id = ::std::option::Option::Some(input.into());
312        self
313    }
314    /// <p>The ID of the VPC endpoint. Present for clients connected to IoT Core via a <a href="https://docs.aws.amazon.com/iot/latest/developerguide/IoTCore-VPC.html">VPC endpoint</a>.</p>
315    pub fn set_vpc_endpoint_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
316        self.vpc_endpoint_id = input;
317        self
318    }
319    /// <p>The ID of the VPC endpoint. Present for clients connected to IoT Core via a <a href="https://docs.aws.amazon.com/iot/latest/developerguide/IoTCore-VPC.html">VPC endpoint</a>.</p>
320    pub fn get_vpc_endpoint_id(&self) -> &::std::option::Option<::std::string::String> {
321        &self.vpc_endpoint_id
322    }
323    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
324        self._request_id = Some(request_id.into());
325        self
326    }
327
328    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
329        self._request_id = request_id;
330        self
331    }
332    /// Consumes the builder and constructs a [`GetConnectionOutput`](crate::operation::get_connection::GetConnectionOutput).
333    pub fn build(self) -> crate::operation::get_connection::GetConnectionOutput {
334        crate::operation::get_connection::GetConnectionOutput {
335            connected: self.connected.unwrap_or_default(),
336            thing_name: self.thing_name,
337            clean_session: self.clean_session.unwrap_or_default(),
338            source_ip: self.source_ip,
339            source_port: self.source_port.unwrap_or_default(),
340            target_ip: self.target_ip,
341            target_port: self.target_port.unwrap_or_default(),
342            keep_alive_duration: self.keep_alive_duration.unwrap_or_default(),
343            connected_since: self.connected_since.unwrap_or_default(),
344            disconnected_since: self.disconnected_since.unwrap_or_default(),
345            disconnect_reason: self.disconnect_reason,
346            session_expiry: self.session_expiry.unwrap_or_default(),
347            client_id: self.client_id,
348            vpc_endpoint_id: self.vpc_endpoint_id,
349            _request_id: self._request_id,
350        }
351    }
352}