aws-sdk-amplify 1.111.0

AWS SDK for AWS Amplify
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Describes an execution job for an Amplify app.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Job {
    /// <p>Describes the summary for an execution job for an Amplify app.</p>
    pub summary: ::std::option::Option<crate::types::JobSummary>,
    /// <p>The execution steps for an execution job, for an Amplify app.</p>
    pub steps: ::std::vec::Vec<crate::types::Step>,
}
impl Job {
    /// <p>Describes the summary for an execution job for an Amplify app.</p>
    pub fn summary(&self) -> ::std::option::Option<&crate::types::JobSummary> {
        self.summary.as_ref()
    }
    /// <p>The execution steps for an execution job, for an Amplify app.</p>
    pub fn steps(&self) -> &[crate::types::Step] {
        use std::ops::Deref;
        self.steps.deref()
    }
}
impl Job {
    /// Creates a new builder-style object to manufacture [`Job`](crate::types::Job).
    pub fn builder() -> crate::types::builders::JobBuilder {
        crate::types::builders::JobBuilder::default()
    }
}

/// A builder for [`Job`](crate::types::Job).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct JobBuilder {
    pub(crate) summary: ::std::option::Option<crate::types::JobSummary>,
    pub(crate) steps: ::std::option::Option<::std::vec::Vec<crate::types::Step>>,
}
impl JobBuilder {
    /// <p>Describes the summary for an execution job for an Amplify app.</p>
    /// This field is required.
    pub fn summary(mut self, input: crate::types::JobSummary) -> Self {
        self.summary = ::std::option::Option::Some(input);
        self
    }
    /// <p>Describes the summary for an execution job for an Amplify app.</p>
    pub fn set_summary(mut self, input: ::std::option::Option<crate::types::JobSummary>) -> Self {
        self.summary = input;
        self
    }
    /// <p>Describes the summary for an execution job for an Amplify app.</p>
    pub fn get_summary(&self) -> &::std::option::Option<crate::types::JobSummary> {
        &self.summary
    }
    /// Appends an item to `steps`.
    ///
    /// To override the contents of this collection use [`set_steps`](Self::set_steps).
    ///
    /// <p>The execution steps for an execution job, for an Amplify app.</p>
    pub fn steps(mut self, input: crate::types::Step) -> Self {
        let mut v = self.steps.unwrap_or_default();
        v.push(input);
        self.steps = ::std::option::Option::Some(v);
        self
    }
    /// <p>The execution steps for an execution job, for an Amplify app.</p>
    pub fn set_steps(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Step>>) -> Self {
        self.steps = input;
        self
    }
    /// <p>The execution steps for an execution job, for an Amplify app.</p>
    pub fn get_steps(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Step>> {
        &self.steps
    }
    /// Consumes the builder and constructs a [`Job`](crate::types::Job).
    /// This method will fail if any of the following fields are not set:
    /// - [`steps`](crate::types::builders::JobBuilder::steps)
    pub fn build(self) -> ::std::result::Result<crate::types::Job, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Job {
            summary: self.summary,
            steps: self.steps.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "steps",
                    "steps was not specified but it is required when building Job",
                )
            })?,
        })
    }
}