aws-sdk-ssm 1.131.0

AWS SDK for Amazon Simple Systems Manager (SSM)
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Details about an individual managed node.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Node {
    /// <p>The UTC timestamp for when the managed node data was last captured.</p>
    pub capture_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>The ID of the managed node.</p>
    pub id: ::std::option::Option<::std::string::String>,
    /// <p>Information about the ownership of the managed node.</p>
    pub owner: ::std::option::Option<crate::types::NodeOwnerInfo>,
    /// <p>The Amazon Web Services Region that a managed node was created in or assigned to.</p>
    pub region: ::std::option::Option<::std::string::String>,
    /// <p>Information about the type of node.</p>
    pub node_type: ::std::option::Option<crate::types::NodeType>,
}
impl Node {
    /// <p>The UTC timestamp for when the managed node data was last captured.</p>
    pub fn capture_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.capture_time.as_ref()
    }
    /// <p>The ID of the managed node.</p>
    pub fn id(&self) -> ::std::option::Option<&str> {
        self.id.as_deref()
    }
    /// <p>Information about the ownership of the managed node.</p>
    pub fn owner(&self) -> ::std::option::Option<&crate::types::NodeOwnerInfo> {
        self.owner.as_ref()
    }
    /// <p>The Amazon Web Services Region that a managed node was created in or assigned to.</p>
    pub fn region(&self) -> ::std::option::Option<&str> {
        self.region.as_deref()
    }
    /// <p>Information about the type of node.</p>
    pub fn node_type(&self) -> ::std::option::Option<&crate::types::NodeType> {
        self.node_type.as_ref()
    }
}
static NODE_MEMBER_CAPTURE_TIME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#Node$CaptureTime", "com.amazonaws.ssm", "Node"),
    ::aws_smithy_schema::ShapeType::Timestamp,
    "CaptureTime",
    0,
);
static NODE_MEMBER_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#Node$Id", "com.amazonaws.ssm", "Node"),
    ::aws_smithy_schema::ShapeType::String,
    "Id",
    1,
);
static NODE_MEMBER_OWNER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#Node$Owner", "com.amazonaws.ssm", "Node"),
    ::aws_smithy_schema::ShapeType::Structure,
    "Owner",
    2,
);
static NODE_MEMBER_REGION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#Node$Region", "com.amazonaws.ssm", "Node"),
    ::aws_smithy_schema::ShapeType::String,
    "Region",
    3,
);
static NODE_MEMBER_NODE_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#Node$NodeType", "com.amazonaws.ssm", "Node"),
    ::aws_smithy_schema::ShapeType::Union,
    "NodeType",
    4,
);
static NODE_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#Node", "com.amazonaws.ssm", "Node"),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &NODE_MEMBER_CAPTURE_TIME,
        &NODE_MEMBER_ID,
        &NODE_MEMBER_OWNER,
        &NODE_MEMBER_REGION,
        &NODE_MEMBER_NODE_TYPE,
    ],
);
impl Node {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &NODE_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for Node {
    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
        Self::SCHEMA
    }

    #[allow(unused_variables, clippy::diverging_sub_expression)]
    fn serialize_members(
        &self,
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        if let Some(ref val) = self.capture_time {
            ser.write_timestamp(&NODE_MEMBER_CAPTURE_TIME, val)?;
        }
        if let Some(ref val) = self.id {
            ser.write_string(&NODE_MEMBER_ID, val)?;
        }
        if let Some(ref val) = self.owner {
            ser.write_struct(&NODE_MEMBER_OWNER, val)?;
        }
        if let Some(ref val) = self.region {
            ser.write_string(&NODE_MEMBER_REGION, val)?;
        }
        if let Some(ref val) = self.node_type {
            ser.write_struct(&NODE_MEMBER_NODE_TYPE, val)?;
        }
        Ok(())
    }
}
impl crate::types::builders::NodeBuilder {
    #[allow(
        unused_variables,
        unreachable_code,
        clippy::single_match,
        clippy::match_single_binding,
        clippy::diverging_sub_expression
    )]
    pub(crate) fn deserialize_members(
        &mut self,
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
        deserializer.read_struct(&NODE_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.capture_time = Some(deser.read_timestamp(member)?);
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.id = Some(deser.read_string(member)?);
                    }
                }
                Some(2) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.owner = Some(crate::types::NodeOwnerInfo::deserialize(deser)?);
                    }
                }
                Some(3) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.region = Some(deser.read_string(member)?);
                    }
                }
                Some(4) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.node_type = Some(crate::types::NodeType::deserialize(deser)?);
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl Node {
    /// Deserializes this structure from a [`ShapeDeserializer`].
    pub fn deserialize(
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
        let mut builder = Self::builder();
        builder.deserialize_members(deserializer)?;
        Ok(builder.build())
    }
}
impl Node {
    /// Creates a new builder-style object to manufacture [`Node`](crate::types::Node).
    pub fn builder() -> crate::types::builders::NodeBuilder {
        crate::types::builders::NodeBuilder::default()
    }
}

/// A builder for [`Node`](crate::types::Node).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct NodeBuilder {
    pub(crate) capture_time: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) owner: ::std::option::Option<crate::types::NodeOwnerInfo>,
    pub(crate) region: ::std::option::Option<::std::string::String>,
    pub(crate) node_type: ::std::option::Option<crate::types::NodeType>,
}
impl NodeBuilder {
    /// <p>The UTC timestamp for when the managed node data was last captured.</p>
    pub fn capture_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.capture_time = ::std::option::Option::Some(input);
        self
    }
    /// <p>The UTC timestamp for when the managed node data was last captured.</p>
    pub fn set_capture_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.capture_time = input;
        self
    }
    /// <p>The UTC timestamp for when the managed node data was last captured.</p>
    pub fn get_capture_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.capture_time
    }
    /// <p>The ID of the managed node.</p>
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the managed node.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The ID of the managed node.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// <p>Information about the ownership of the managed node.</p>
    pub fn owner(mut self, input: crate::types::NodeOwnerInfo) -> Self {
        self.owner = ::std::option::Option::Some(input);
        self
    }
    /// <p>Information about the ownership of the managed node.</p>
    pub fn set_owner(mut self, input: ::std::option::Option<crate::types::NodeOwnerInfo>) -> Self {
        self.owner = input;
        self
    }
    /// <p>Information about the ownership of the managed node.</p>
    pub fn get_owner(&self) -> &::std::option::Option<crate::types::NodeOwnerInfo> {
        &self.owner
    }
    /// <p>The Amazon Web Services Region that a managed node was created in or assigned to.</p>
    pub fn region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.region = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon Web Services Region that a managed node was created in or assigned to.</p>
    pub fn set_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.region = input;
        self
    }
    /// <p>The Amazon Web Services Region that a managed node was created in or assigned to.</p>
    pub fn get_region(&self) -> &::std::option::Option<::std::string::String> {
        &self.region
    }
    /// <p>Information about the type of node.</p>
    pub fn node_type(mut self, input: crate::types::NodeType) -> Self {
        self.node_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>Information about the type of node.</p>
    pub fn set_node_type(mut self, input: ::std::option::Option<crate::types::NodeType>) -> Self {
        self.node_type = input;
        self
    }
    /// <p>Information about the type of node.</p>
    pub fn get_node_type(&self) -> &::std::option::Option<crate::types::NodeType> {
        &self.node_type
    }
    /// Consumes the builder and constructs a [`Node`](crate::types::Node).
    pub fn build(self) -> crate::types::Node {
        crate::types::Node {
            capture_time: self.capture_time,
            id: self.id,
            owner: self.owner,
            region: self.region,
            node_type: self.node_type,
        }
    }
}