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.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ListAssociationsOutput {
    /// <p>The associations.</p>
    pub associations: ::std::option::Option<::std::vec::Vec<crate::types::Association>>,
    /// <p>The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.</p>
    pub next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ListAssociationsOutput {
    /// <p>The associations.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.associations.is_none()`.
    pub fn associations(&self) -> &[crate::types::Association] {
        self.associations.as_deref().unwrap_or_default()
    }
    /// <p>The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.</p>
    pub fn next_token(&self) -> ::std::option::Option<&str> {
        self.next_token.as_deref()
    }
}
static LISTASSOCIATIONSOUTPUT_MEMBER_ASSOCIATIONS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#AssociationList$member", "com.amazonaws.ssm", "AssociationList"),
    ::aws_smithy_schema::ShapeType::Structure,
    "member",
    0,
)
.with_xml_name("Association");
static LISTASSOCIATIONSOUTPUT_MEMBER_ASSOCIATIONS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#ListAssociationsOutput$Associations",
        "com.amazonaws.ssm.synthetic",
        "ListAssociationsOutput",
    ),
    ::aws_smithy_schema::ShapeType::List,
    "Associations",
    0,
)
.with_list_member(&LISTASSOCIATIONSOUTPUT_MEMBER_ASSOCIATIONS_MEMBER);
static LISTASSOCIATIONSOUTPUT_MEMBER_NEXT_TOKEN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#ListAssociationsOutput$NextToken",
        "com.amazonaws.ssm.synthetic",
        "ListAssociationsOutput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "NextToken",
    1,
);
static LISTASSOCIATIONSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#ListAssociationsOutput",
        "com.amazonaws.ssm.synthetic",
        "ListAssociationsOutput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[&LISTASSOCIATIONSOUTPUT_MEMBER_ASSOCIATIONS, &LISTASSOCIATIONSOUTPUT_MEMBER_NEXT_TOKEN],
)
.with_original_name("ListAssociationsResult");
impl ListAssociationsOutput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &LISTASSOCIATIONSOUTPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for ListAssociationsOutput {
    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.associations {
            ser.write_list(
                &LISTASSOCIATIONSOUTPUT_MEMBER_ASSOCIATIONS,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_struct(crate::types::Association::SCHEMA, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        if let Some(ref val) = self.next_token {
            ser.write_string(&LISTASSOCIATIONSOUTPUT_MEMBER_NEXT_TOKEN, val)?;
        }
        Ok(())
    }
}
impl crate::operation::list_associations::builders::ListAssociationsOutputBuilder {
    #[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(&LISTASSOCIATIONSOUTPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.associations = Some({
                            let mut container = Vec::new();
                            deser.read_list(member, &mut |deser| {
                                container.push(crate::types::Association::deserialize(deser)?);
                                Ok(())
                            })?;
                            container
                        });
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.next_token = Some(deser.read_string(member)?);
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl ListAssociationsOutput {
    /// 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 ::aws_types::request_id::RequestId for ListAssociationsOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ListAssociationsOutput {
    /// Creates a new builder-style object to manufacture [`ListAssociationsOutput`](crate::operation::list_associations::ListAssociationsOutput).
    pub fn builder() -> crate::operation::list_associations::builders::ListAssociationsOutputBuilder {
        crate::operation::list_associations::builders::ListAssociationsOutputBuilder::default()
    }
}

/// A builder for [`ListAssociationsOutput`](crate::operation::list_associations::ListAssociationsOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ListAssociationsOutputBuilder {
    pub(crate) associations: ::std::option::Option<::std::vec::Vec<crate::types::Association>>,
    pub(crate) next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ListAssociationsOutputBuilder {
    /// Appends an item to `associations`.
    ///
    /// To override the contents of this collection use [`set_associations`](Self::set_associations).
    ///
    /// <p>The associations.</p>
    pub fn associations(mut self, input: crate::types::Association) -> Self {
        let mut v = self.associations.unwrap_or_default();
        v.push(input);
        self.associations = ::std::option::Option::Some(v);
        self
    }
    /// <p>The associations.</p>
    pub fn set_associations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Association>>) -> Self {
        self.associations = input;
        self
    }
    /// <p>The associations.</p>
    pub fn get_associations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Association>> {
        &self.associations
    }
    /// <p>The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.</p>
    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.next_token = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.next_token = input;
        self
    }
    /// <p>The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.</p>
    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.next_token
    }
    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 [`ListAssociationsOutput`](crate::operation::list_associations::ListAssociationsOutput).
    pub fn build(self) -> crate::operation::list_associations::ListAssociationsOutput {
        crate::operation::list_associations::ListAssociationsOutput {
            associations: self.associations,
            next_token: self.next_token,
            _request_id: self._request_id,
        }
    }
}