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 StopAutomationExecutionInput {
    /// <p>The execution ID of the Automation to stop.</p>
    pub automation_execution_id: ::std::option::Option<::std::string::String>,
    /// <p>The stop request type. Valid types include the following: Cancel and Complete. The default type is Cancel.</p>
    pub r#type: ::std::option::Option<crate::types::StopType>,
}
impl StopAutomationExecutionInput {
    /// <p>The execution ID of the Automation to stop.</p>
    pub fn automation_execution_id(&self) -> ::std::option::Option<&str> {
        self.automation_execution_id.as_deref()
    }
    /// <p>The stop request type. Valid types include the following: Cancel and Complete. The default type is Cancel.</p>
    pub fn r#type(&self) -> ::std::option::Option<&crate::types::StopType> {
        self.r#type.as_ref()
    }
}
static STOPAUTOMATIONEXECUTIONINPUT_MEMBER_AUTOMATION_EXECUTION_ID: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#StopAutomationExecutionInput$AutomationExecutionId",
        "com.amazonaws.ssm.synthetic",
        "StopAutomationExecutionInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "AutomationExecutionId",
    0,
);
static STOPAUTOMATIONEXECUTIONINPUT_MEMBER_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#StopAutomationExecutionInput$Type",
        "com.amazonaws.ssm.synthetic",
        "StopAutomationExecutionInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "Type",
    1,
);
static STOPAUTOMATIONEXECUTIONINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#StopAutomationExecutionInput",
        "com.amazonaws.ssm.synthetic",
        "StopAutomationExecutionInput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &STOPAUTOMATIONEXECUTIONINPUT_MEMBER_AUTOMATION_EXECUTION_ID,
        &STOPAUTOMATIONEXECUTIONINPUT_MEMBER_TYPE,
    ],
)
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
.with_original_name("StopAutomationExecutionRequest");
impl StopAutomationExecutionInput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &STOPAUTOMATIONEXECUTIONINPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for StopAutomationExecutionInput {
    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.automation_execution_id {
            ser.write_string(&STOPAUTOMATIONEXECUTIONINPUT_MEMBER_AUTOMATION_EXECUTION_ID, val)?;
        }
        if let Some(ref val) = self.r#type {
            ser.write_string(&STOPAUTOMATIONEXECUTIONINPUT_MEMBER_TYPE, val.as_str())?;
        }
        Ok(())
    }
}
impl crate::operation::stop_automation_execution::builders::StopAutomationExecutionInputBuilder {
    #[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(&STOPAUTOMATIONEXECUTIONINPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.automation_execution_id = Some(deser.read_string(member)?);
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.r#type = Some(crate::types::StopType::from(deser.read_string(member)?.as_str()));
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl StopAutomationExecutionInput {
    /// 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)?;
        builder.automation_execution_id = builder.automation_execution_id.or(Some(String::new()));
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
    }
}
impl StopAutomationExecutionInput {
    /// Creates a new builder-style object to manufacture [`StopAutomationExecutionInput`](crate::operation::stop_automation_execution::StopAutomationExecutionInput).
    pub fn builder() -> crate::operation::stop_automation_execution::builders::StopAutomationExecutionInputBuilder {
        crate::operation::stop_automation_execution::builders::StopAutomationExecutionInputBuilder::default()
    }
}

/// A builder for [`StopAutomationExecutionInput`](crate::operation::stop_automation_execution::StopAutomationExecutionInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct StopAutomationExecutionInputBuilder {
    pub(crate) automation_execution_id: ::std::option::Option<::std::string::String>,
    pub(crate) r#type: ::std::option::Option<crate::types::StopType>,
}
impl StopAutomationExecutionInputBuilder {
    /// <p>The execution ID of the Automation to stop.</p>
    /// This field is required.
    pub fn automation_execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.automation_execution_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The execution ID of the Automation to stop.</p>
    pub fn set_automation_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.automation_execution_id = input;
        self
    }
    /// <p>The execution ID of the Automation to stop.</p>
    pub fn get_automation_execution_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.automation_execution_id
    }
    /// <p>The stop request type. Valid types include the following: Cancel and Complete. The default type is Cancel.</p>
    pub fn r#type(mut self, input: crate::types::StopType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The stop request type. Valid types include the following: Cancel and Complete. The default type is Cancel.</p>
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::StopType>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The stop request type. Valid types include the following: Cancel and Complete. The default type is Cancel.</p>
    pub fn get_type(&self) -> &::std::option::Option<crate::types::StopType> {
        &self.r#type
    }
    /// Consumes the builder and constructs a [`StopAutomationExecutionInput`](crate::operation::stop_automation_execution::StopAutomationExecutionInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<
        crate::operation::stop_automation_execution::StopAutomationExecutionInput,
        ::aws_smithy_types::error::operation::BuildError,
    > {
        ::std::result::Result::Ok(crate::operation::stop_automation_execution::StopAutomationExecutionInput {
            automation_execution_id: self.automation_execution_id,
            r#type: self.r#type,
        })
    }
}