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 CreateAssociationBatchOutput {
    /// <p>Information about the associations that succeeded.</p>
    pub successful: ::std::option::Option<::std::vec::Vec<crate::types::AssociationDescription>>,
    /// <p>Information about the associations that failed.</p>
    pub failed: ::std::option::Option<::std::vec::Vec<crate::types::FailedCreateAssociation>>,
    _request_id: Option<String>,
}
impl CreateAssociationBatchOutput {
    /// <p>Information about the associations that succeeded.</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 `.successful.is_none()`.
    pub fn successful(&self) -> &[crate::types::AssociationDescription] {
        self.successful.as_deref().unwrap_or_default()
    }
    /// <p>Information about the associations that failed.</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 `.failed.is_none()`.
    pub fn failed(&self) -> &[crate::types::FailedCreateAssociation] {
        self.failed.as_deref().unwrap_or_default()
    }
}
static CREATEASSOCIATIONBATCHOUTPUT_MEMBER_SUCCESSFUL_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm#AssociationDescriptionList$member",
        "com.amazonaws.ssm",
        "AssociationDescriptionList",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    "member",
    0,
)
.with_xml_name("AssociationDescription");
static CREATEASSOCIATIONBATCHOUTPUT_MEMBER_SUCCESSFUL: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#CreateAssociationBatchOutput$Successful",
        "com.amazonaws.ssm.synthetic",
        "CreateAssociationBatchOutput",
    ),
    ::aws_smithy_schema::ShapeType::List,
    "Successful",
    0,
)
.with_list_member(&CREATEASSOCIATIONBATCHOUTPUT_MEMBER_SUCCESSFUL_MEMBER);
static CREATEASSOCIATIONBATCHOUTPUT_MEMBER_FAILED_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm#FailedCreateAssociationList$member",
        "com.amazonaws.ssm",
        "FailedCreateAssociationList",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    "member",
    0,
)
.with_xml_name("FailedCreateAssociationEntry");
static CREATEASSOCIATIONBATCHOUTPUT_MEMBER_FAILED: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#CreateAssociationBatchOutput$Failed",
        "com.amazonaws.ssm.synthetic",
        "CreateAssociationBatchOutput",
    ),
    ::aws_smithy_schema::ShapeType::List,
    "Failed",
    1,
)
.with_list_member(&CREATEASSOCIATIONBATCHOUTPUT_MEMBER_FAILED_MEMBER);
static CREATEASSOCIATIONBATCHOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#CreateAssociationBatchOutput",
        "com.amazonaws.ssm.synthetic",
        "CreateAssociationBatchOutput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &CREATEASSOCIATIONBATCHOUTPUT_MEMBER_SUCCESSFUL,
        &CREATEASSOCIATIONBATCHOUTPUT_MEMBER_FAILED,
    ],
)
.with_original_name("CreateAssociationBatchResult");
impl CreateAssociationBatchOutput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CREATEASSOCIATIONBATCHOUTPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for CreateAssociationBatchOutput {
    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.successful {
            ser.write_list(
                &CREATEASSOCIATIONBATCHOUTPUT_MEMBER_SUCCESSFUL,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_struct(crate::types::AssociationDescription::SCHEMA, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        if let Some(ref val) = self.failed {
            ser.write_list(
                &CREATEASSOCIATIONBATCHOUTPUT_MEMBER_FAILED,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_struct(crate::types::FailedCreateAssociation::SCHEMA, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        Ok(())
    }
}
impl crate::operation::create_association_batch::builders::CreateAssociationBatchOutputBuilder {
    #[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(&CREATEASSOCIATIONBATCHOUTPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.successful = Some({
                            let mut container = Vec::new();
                            deser.read_list(member, &mut |deser| {
                                container.push(crate::types::AssociationDescription::deserialize(deser)?);
                                Ok(())
                            })?;
                            container
                        });
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.failed = Some({
                            let mut container = Vec::new();
                            deser.read_list(member, &mut |deser| {
                                container.push(crate::types::FailedCreateAssociation::deserialize(deser)?);
                                Ok(())
                            })?;
                            container
                        });
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

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

/// A builder for [`CreateAssociationBatchOutput`](crate::operation::create_association_batch::CreateAssociationBatchOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreateAssociationBatchOutputBuilder {
    pub(crate) successful: ::std::option::Option<::std::vec::Vec<crate::types::AssociationDescription>>,
    pub(crate) failed: ::std::option::Option<::std::vec::Vec<crate::types::FailedCreateAssociation>>,
    _request_id: Option<String>,
}
impl CreateAssociationBatchOutputBuilder {
    /// Appends an item to `successful`.
    ///
    /// To override the contents of this collection use [`set_successful`](Self::set_successful).
    ///
    /// <p>Information about the associations that succeeded.</p>
    pub fn successful(mut self, input: crate::types::AssociationDescription) -> Self {
        let mut v = self.successful.unwrap_or_default();
        v.push(input);
        self.successful = ::std::option::Option::Some(v);
        self
    }
    /// <p>Information about the associations that succeeded.</p>
    pub fn set_successful(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AssociationDescription>>) -> Self {
        self.successful = input;
        self
    }
    /// <p>Information about the associations that succeeded.</p>
    pub fn get_successful(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AssociationDescription>> {
        &self.successful
    }
    /// Appends an item to `failed`.
    ///
    /// To override the contents of this collection use [`set_failed`](Self::set_failed).
    ///
    /// <p>Information about the associations that failed.</p>
    pub fn failed(mut self, input: crate::types::FailedCreateAssociation) -> Self {
        let mut v = self.failed.unwrap_or_default();
        v.push(input);
        self.failed = ::std::option::Option::Some(v);
        self
    }
    /// <p>Information about the associations that failed.</p>
    pub fn set_failed(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FailedCreateAssociation>>) -> Self {
        self.failed = input;
        self
    }
    /// <p>Information about the associations that failed.</p>
    pub fn get_failed(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FailedCreateAssociation>> {
        &self.failed
    }
    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 [`CreateAssociationBatchOutput`](crate::operation::create_association_batch::CreateAssociationBatchOutput).
    pub fn build(self) -> crate::operation::create_association_batch::CreateAssociationBatchOutput {
        crate::operation::create_association_batch::CreateAssociationBatchOutput {
            successful: self.successful,
            failed: self.failed,
            _request_id: self._request_id,
        }
    }
}