aws-sdk-iotdataplane 1.102.0

AWS SDK for AWS IoT Data Plane
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct GetConnectionOutput {
    /// <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>
    pub connected: bool,
    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
    pub thing_name: ::std::option::Option<::std::string::String>,
    /// <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>
    pub clean_session: bool,
    /// <p>The IP address of the client that initiated the connection.</p>
    pub source_ip: ::std::option::Option<::std::string::String>,
    /// <p>The client's source port.</p>
    pub source_port: i32,
    /// <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>
    pub target_ip: ::std::option::Option<::std::string::String>,
    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
    pub target_port: i32,
    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
    pub keep_alive_duration: i32,
    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
    pub connected_since: i64,
    /// <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>
    pub disconnected_since: i64,
    /// <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>
    pub disconnect_reason: ::std::option::Option<::std::string::String>,
    /// <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>
    pub session_expiry: i64,
    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
    pub client_id: ::std::option::Option<::std::string::String>,
    /// <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>
    pub vpc_endpoint_id: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl GetConnectionOutput {
    /// <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>
    pub fn connected(&self) -> bool {
        self.connected
    }
    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
    pub fn thing_name(&self) -> ::std::option::Option<&str> {
        self.thing_name.as_deref()
    }
    /// <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>
    pub fn clean_session(&self) -> bool {
        self.clean_session
    }
    /// <p>The IP address of the client that initiated the connection.</p>
    pub fn source_ip(&self) -> ::std::option::Option<&str> {
        self.source_ip.as_deref()
    }
    /// <p>The client's source port.</p>
    pub fn source_port(&self) -> i32 {
        self.source_port
    }
    /// <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>
    pub fn target_ip(&self) -> ::std::option::Option<&str> {
        self.target_ip.as_deref()
    }
    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
    pub fn target_port(&self) -> i32 {
        self.target_port
    }
    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
    pub fn keep_alive_duration(&self) -> i32 {
        self.keep_alive_duration
    }
    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
    pub fn connected_since(&self) -> i64 {
        self.connected_since
    }
    /// <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>
    pub fn disconnected_since(&self) -> i64 {
        self.disconnected_since
    }
    /// <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>
    pub fn disconnect_reason(&self) -> ::std::option::Option<&str> {
        self.disconnect_reason.as_deref()
    }
    /// <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>
    pub fn session_expiry(&self) -> i64 {
        self.session_expiry
    }
    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
    pub fn client_id(&self) -> ::std::option::Option<&str> {
        self.client_id.as_deref()
    }
    /// <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>
    pub fn vpc_endpoint_id(&self) -> ::std::option::Option<&str> {
        self.vpc_endpoint_id.as_deref()
    }
}
impl ::aws_types::request_id::RequestId for GetConnectionOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl GetConnectionOutput {
    /// Creates a new builder-style object to manufacture [`GetConnectionOutput`](crate::operation::get_connection::GetConnectionOutput).
    pub fn builder() -> crate::operation::get_connection::builders::GetConnectionOutputBuilder {
        crate::operation::get_connection::builders::GetConnectionOutputBuilder::default()
    }
}

/// A builder for [`GetConnectionOutput`](crate::operation::get_connection::GetConnectionOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GetConnectionOutputBuilder {
    pub(crate) connected: ::std::option::Option<bool>,
    pub(crate) thing_name: ::std::option::Option<::std::string::String>,
    pub(crate) clean_session: ::std::option::Option<bool>,
    pub(crate) source_ip: ::std::option::Option<::std::string::String>,
    pub(crate) source_port: ::std::option::Option<i32>,
    pub(crate) target_ip: ::std::option::Option<::std::string::String>,
    pub(crate) target_port: ::std::option::Option<i32>,
    pub(crate) keep_alive_duration: ::std::option::Option<i32>,
    pub(crate) connected_since: ::std::option::Option<i64>,
    pub(crate) disconnected_since: ::std::option::Option<i64>,
    pub(crate) disconnect_reason: ::std::option::Option<::std::string::String>,
    pub(crate) session_expiry: ::std::option::Option<i64>,
    pub(crate) client_id: ::std::option::Option<::std::string::String>,
    pub(crate) vpc_endpoint_id: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl GetConnectionOutputBuilder {
    /// <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>
    pub fn connected(mut self, input: bool) -> Self {
        self.connected = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_connected(mut self, input: ::std::option::Option<bool>) -> Self {
        self.connected = input;
        self
    }
    /// <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>
    pub fn get_connected(&self) -> &::std::option::Option<bool> {
        &self.connected
    }
    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
    pub fn thing_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.thing_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
    pub fn set_thing_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.thing_name = input;
        self
    }
    /// <p>The name of the thing associated with the principal of the MQTT client, if applicable.</p>
    pub fn get_thing_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.thing_name
    }
    /// <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>
    pub fn clean_session(mut self, input: bool) -> Self {
        self.clean_session = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_clean_session(mut self, input: ::std::option::Option<bool>) -> Self {
        self.clean_session = input;
        self
    }
    /// <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>
    pub fn get_clean_session(&self) -> &::std::option::Option<bool> {
        &self.clean_session
    }
    /// <p>The IP address of the client that initiated the connection.</p>
    pub fn source_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.source_ip = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The IP address of the client that initiated the connection.</p>
    pub fn set_source_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.source_ip = input;
        self
    }
    /// <p>The IP address of the client that initiated the connection.</p>
    pub fn get_source_ip(&self) -> &::std::option::Option<::std::string::String> {
        &self.source_ip
    }
    /// <p>The client's source port.</p>
    pub fn source_port(mut self, input: i32) -> Self {
        self.source_port = ::std::option::Option::Some(input);
        self
    }
    /// <p>The client's source port.</p>
    pub fn set_source_port(mut self, input: ::std::option::Option<i32>) -> Self {
        self.source_port = input;
        self
    }
    /// <p>The client's source port.</p>
    pub fn get_source_port(&self) -> &::std::option::Option<i32> {
        &self.source_port
    }
    /// <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>
    pub fn target_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.target_ip = ::std::option::Option::Some(input.into());
        self
    }
    /// <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>
    pub fn set_target_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.target_ip = input;
        self
    }
    /// <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>
    pub fn get_target_ip(&self) -> &::std::option::Option<::std::string::String> {
        &self.target_ip
    }
    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
    pub fn target_port(mut self, input: i32) -> Self {
        self.target_port = ::std::option::Option::Some(input);
        self
    }
    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
    pub fn set_target_port(mut self, input: ::std::option::Option<i32>) -> Self {
        self.target_port = input;
        self
    }
    /// <p>The port number of the Amazon Web Services IoT Core endpoint that the client connected to.</p>
    pub fn get_target_port(&self) -> &::std::option::Option<i32> {
        &self.target_port
    }
    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
    pub fn keep_alive_duration(mut self, input: i32) -> Self {
        self.keep_alive_duration = ::std::option::Option::Some(input);
        self
    }
    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
    pub fn set_keep_alive_duration(mut self, input: ::std::option::Option<i32>) -> Self {
        self.keep_alive_duration = input;
        self
    }
    /// <p>The keep-alive interval in seconds that the client specified when establishing the connection.</p>
    pub fn get_keep_alive_duration(&self) -> &::std::option::Option<i32> {
        &self.keep_alive_duration
    }
    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
    pub fn connected_since(mut self, input: i64) -> Self {
        self.connected_since = ::std::option::Option::Some(input);
        self
    }
    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
    pub fn set_connected_since(mut self, input: ::std::option::Option<i64>) -> Self {
        self.connected_since = input;
        self
    }
    /// <p>Unix timestamp (in milliseconds) indicating when the client connected. Present only when connected is true.</p>
    pub fn get_connected_since(&self) -> &::std::option::Option<i64> {
        &self.connected_since
    }
    /// <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>
    pub fn disconnected_since(mut self, input: i64) -> Self {
        self.disconnected_since = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_disconnected_since(mut self, input: ::std::option::Option<i64>) -> Self {
        self.disconnected_since = input;
        self
    }
    /// <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>
    pub fn get_disconnected_since(&self) -> &::std::option::Option<i64> {
        &self.disconnected_since
    }
    /// <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>
    pub fn disconnect_reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.disconnect_reason = ::std::option::Option::Some(input.into());
        self
    }
    /// <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>
    pub fn set_disconnect_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.disconnect_reason = input;
        self
    }
    /// <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>
    pub fn get_disconnect_reason(&self) -> &::std::option::Option<::std::string::String> {
        &self.disconnect_reason
    }
    /// <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>
    pub fn session_expiry(mut self, input: i64) -> Self {
        self.session_expiry = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_session_expiry(mut self, input: ::std::option::Option<i64>) -> Self {
        self.session_expiry = input;
        self
    }
    /// <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>
    pub fn get_session_expiry(&self) -> &::std::option::Option<i64> {
        &self.session_expiry
    }
    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
    pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.client_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
    pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.client_id = input;
        self
    }
    /// <p>The unique identifier of the MQTT client. This is the same client ID that was used when the client established the connection.</p>
    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.client_id
    }
    /// <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>
    pub fn vpc_endpoint_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.vpc_endpoint_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <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>
    pub fn set_vpc_endpoint_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.vpc_endpoint_id = input;
        self
    }
    /// <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>
    pub fn get_vpc_endpoint_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.vpc_endpoint_id
    }
    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 [`GetConnectionOutput`](crate::operation::get_connection::GetConnectionOutput).
    pub fn build(self) -> crate::operation::get_connection::GetConnectionOutput {
        crate::operation::get_connection::GetConnectionOutput {
            connected: self.connected.unwrap_or_default(),
            thing_name: self.thing_name,
            clean_session: self.clean_session.unwrap_or_default(),
            source_ip: self.source_ip,
            source_port: self.source_port.unwrap_or_default(),
            target_ip: self.target_ip,
            target_port: self.target_port.unwrap_or_default(),
            keep_alive_duration: self.keep_alive_duration.unwrap_or_default(),
            connected_since: self.connected_since.unwrap_or_default(),
            disconnected_since: self.disconnected_since.unwrap_or_default(),
            disconnect_reason: self.disconnect_reason,
            session_expiry: self.session_expiry.unwrap_or_default(),
            client_id: self.client_id,
            vpc_endpoint_id: self.vpc_endpoint_id,
            _request_id: self._request_id,
        }
    }
}