aws-sdk-devopsagent 1.4.0

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

/// Represents a goal with all its properties and metadata
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Goal {
    /// The unique identifier for the agent space containing this goal
    pub agent_space_arn: ::std::string::String,
    /// The unique identifier for this goal
    pub goal_id: ::std::string::String,
    /// The title of the goal
    pub title: ::std::string::String,
    /// Content of the goal
    pub content: ::std::option::Option<crate::types::GoalContent>,
    /// Current status of the goal itself
    pub status: crate::types::GoalStatus,
    /// Type of goal based on its origin
    pub goal_type: crate::types::GoalType,
    /// Timestamp when this goal was created
    pub created_at: ::aws_smithy_types::DateTime,
    /// Timestamp when this goal was last updated
    pub updated_at: ::aws_smithy_types::DateTime,
    /// Timestamp when the goal was last evaluated
    pub last_evaluated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// ID of the most recent task associated with this goal
    pub last_task_id: ::std::option::Option<::std::string::String>,
    /// ID of the most recent successful task associated with this goal
    pub last_successful_task_id: ::std::option::Option<::std::string::String>,
    /// Version number for optimistic locking
    pub version: i32,
    /// Goal Schedule. Allows to schedule the goal to run periodically, as well as disable a goal temporarily
    pub evaluation_schedule: ::std::option::Option<crate::types::GoalSchedule>,
}
impl Goal {
    /// The unique identifier for the agent space containing this goal
    pub fn agent_space_arn(&self) -> &str {
        use std::ops::Deref;
        self.agent_space_arn.deref()
    }
    /// The unique identifier for this goal
    pub fn goal_id(&self) -> &str {
        use std::ops::Deref;
        self.goal_id.deref()
    }
    /// The title of the goal
    pub fn title(&self) -> &str {
        use std::ops::Deref;
        self.title.deref()
    }
    /// Content of the goal
    pub fn content(&self) -> ::std::option::Option<&crate::types::GoalContent> {
        self.content.as_ref()
    }
    /// Current status of the goal itself
    pub fn status(&self) -> &crate::types::GoalStatus {
        &self.status
    }
    /// Type of goal based on its origin
    pub fn goal_type(&self) -> &crate::types::GoalType {
        &self.goal_type
    }
    /// Timestamp when this goal was created
    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
        &self.created_at
    }
    /// Timestamp when this goal was last updated
    pub fn updated_at(&self) -> &::aws_smithy_types::DateTime {
        &self.updated_at
    }
    /// Timestamp when the goal was last evaluated
    pub fn last_evaluated_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.last_evaluated_at.as_ref()
    }
    /// ID of the most recent task associated with this goal
    pub fn last_task_id(&self) -> ::std::option::Option<&str> {
        self.last_task_id.as_deref()
    }
    /// ID of the most recent successful task associated with this goal
    pub fn last_successful_task_id(&self) -> ::std::option::Option<&str> {
        self.last_successful_task_id.as_deref()
    }
    /// Version number for optimistic locking
    pub fn version(&self) -> i32 {
        self.version
    }
    /// Goal Schedule. Allows to schedule the goal to run periodically, as well as disable a goal temporarily
    pub fn evaluation_schedule(&self) -> ::std::option::Option<&crate::types::GoalSchedule> {
        self.evaluation_schedule.as_ref()
    }
}
impl Goal {
    /// Creates a new builder-style object to manufacture [`Goal`](crate::types::Goal).
    pub fn builder() -> crate::types::builders::GoalBuilder {
        crate::types::builders::GoalBuilder::default()
    }
}

/// A builder for [`Goal`](crate::types::Goal).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GoalBuilder {
    pub(crate) agent_space_arn: ::std::option::Option<::std::string::String>,
    pub(crate) goal_id: ::std::option::Option<::std::string::String>,
    pub(crate) title: ::std::option::Option<::std::string::String>,
    pub(crate) content: ::std::option::Option<crate::types::GoalContent>,
    pub(crate) status: ::std::option::Option<crate::types::GoalStatus>,
    pub(crate) goal_type: ::std::option::Option<crate::types::GoalType>,
    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) last_evaluated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) last_task_id: ::std::option::Option<::std::string::String>,
    pub(crate) last_successful_task_id: ::std::option::Option<::std::string::String>,
    pub(crate) version: ::std::option::Option<i32>,
    pub(crate) evaluation_schedule: ::std::option::Option<crate::types::GoalSchedule>,
}
impl GoalBuilder {
    /// The unique identifier for the agent space containing this goal
    /// This field is required.
    pub fn agent_space_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.agent_space_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// The unique identifier for the agent space containing this goal
    pub fn set_agent_space_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.agent_space_arn = input;
        self
    }
    /// The unique identifier for the agent space containing this goal
    pub fn get_agent_space_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.agent_space_arn
    }
    /// The unique identifier for this goal
    /// This field is required.
    pub fn goal_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.goal_id = ::std::option::Option::Some(input.into());
        self
    }
    /// The unique identifier for this goal
    pub fn set_goal_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.goal_id = input;
        self
    }
    /// The unique identifier for this goal
    pub fn get_goal_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.goal_id
    }
    /// The title of the goal
    /// This field is required.
    pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.title = ::std::option::Option::Some(input.into());
        self
    }
    /// The title of the goal
    pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.title = input;
        self
    }
    /// The title of the goal
    pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
        &self.title
    }
    /// Content of the goal
    /// This field is required.
    pub fn content(mut self, input: crate::types::GoalContent) -> Self {
        self.content = ::std::option::Option::Some(input);
        self
    }
    /// Content of the goal
    pub fn set_content(mut self, input: ::std::option::Option<crate::types::GoalContent>) -> Self {
        self.content = input;
        self
    }
    /// Content of the goal
    pub fn get_content(&self) -> &::std::option::Option<crate::types::GoalContent> {
        &self.content
    }
    /// Current status of the goal itself
    /// This field is required.
    pub fn status(mut self, input: crate::types::GoalStatus) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// Current status of the goal itself
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::GoalStatus>) -> Self {
        self.status = input;
        self
    }
    /// Current status of the goal itself
    pub fn get_status(&self) -> &::std::option::Option<crate::types::GoalStatus> {
        &self.status
    }
    /// Type of goal based on its origin
    /// This field is required.
    pub fn goal_type(mut self, input: crate::types::GoalType) -> Self {
        self.goal_type = ::std::option::Option::Some(input);
        self
    }
    /// Type of goal based on its origin
    pub fn set_goal_type(mut self, input: ::std::option::Option<crate::types::GoalType>) -> Self {
        self.goal_type = input;
        self
    }
    /// Type of goal based on its origin
    pub fn get_goal_type(&self) -> &::std::option::Option<crate::types::GoalType> {
        &self.goal_type
    }
    /// Timestamp when this goal was created
    /// This field is required.
    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.created_at = ::std::option::Option::Some(input);
        self
    }
    /// Timestamp when this goal was created
    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.created_at = input;
        self
    }
    /// Timestamp when this goal was created
    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.created_at
    }
    /// Timestamp when this goal was last updated
    /// This field is required.
    pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.updated_at = ::std::option::Option::Some(input);
        self
    }
    /// Timestamp when this goal was last updated
    pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.updated_at = input;
        self
    }
    /// Timestamp when this goal was last updated
    pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.updated_at
    }
    /// Timestamp when the goal was last evaluated
    pub fn last_evaluated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.last_evaluated_at = ::std::option::Option::Some(input);
        self
    }
    /// Timestamp when the goal was last evaluated
    pub fn set_last_evaluated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.last_evaluated_at = input;
        self
    }
    /// Timestamp when the goal was last evaluated
    pub fn get_last_evaluated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.last_evaluated_at
    }
    /// ID of the most recent task associated with this goal
    pub fn last_task_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.last_task_id = ::std::option::Option::Some(input.into());
        self
    }
    /// ID of the most recent task associated with this goal
    pub fn set_last_task_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.last_task_id = input;
        self
    }
    /// ID of the most recent task associated with this goal
    pub fn get_last_task_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.last_task_id
    }
    /// ID of the most recent successful task associated with this goal
    pub fn last_successful_task_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.last_successful_task_id = ::std::option::Option::Some(input.into());
        self
    }
    /// ID of the most recent successful task associated with this goal
    pub fn set_last_successful_task_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.last_successful_task_id = input;
        self
    }
    /// ID of the most recent successful task associated with this goal
    pub fn get_last_successful_task_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.last_successful_task_id
    }
    /// Version number for optimistic locking
    /// This field is required.
    pub fn version(mut self, input: i32) -> Self {
        self.version = ::std::option::Option::Some(input);
        self
    }
    /// Version number for optimistic locking
    pub fn set_version(mut self, input: ::std::option::Option<i32>) -> Self {
        self.version = input;
        self
    }
    /// Version number for optimistic locking
    pub fn get_version(&self) -> &::std::option::Option<i32> {
        &self.version
    }
    /// Goal Schedule. Allows to schedule the goal to run periodically, as well as disable a goal temporarily
    pub fn evaluation_schedule(mut self, input: crate::types::GoalSchedule) -> Self {
        self.evaluation_schedule = ::std::option::Option::Some(input);
        self
    }
    /// Goal Schedule. Allows to schedule the goal to run periodically, as well as disable a goal temporarily
    pub fn set_evaluation_schedule(mut self, input: ::std::option::Option<crate::types::GoalSchedule>) -> Self {
        self.evaluation_schedule = input;
        self
    }
    /// Goal Schedule. Allows to schedule the goal to run periodically, as well as disable a goal temporarily
    pub fn get_evaluation_schedule(&self) -> &::std::option::Option<crate::types::GoalSchedule> {
        &self.evaluation_schedule
    }
    /// Consumes the builder and constructs a [`Goal`](crate::types::Goal).
    /// This method will fail if any of the following fields are not set:
    /// - [`agent_space_arn`](crate::types::builders::GoalBuilder::agent_space_arn)
    /// - [`goal_id`](crate::types::builders::GoalBuilder::goal_id)
    /// - [`title`](crate::types::builders::GoalBuilder::title)
    /// - [`status`](crate::types::builders::GoalBuilder::status)
    /// - [`created_at`](crate::types::builders::GoalBuilder::created_at)
    /// - [`updated_at`](crate::types::builders::GoalBuilder::updated_at)
    /// - [`version`](crate::types::builders::GoalBuilder::version)
    pub fn build(self) -> ::std::result::Result<crate::types::Goal, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Goal {
            agent_space_arn: self.agent_space_arn.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "agent_space_arn",
                    "agent_space_arn was not specified but it is required when building Goal",
                )
            })?,
            goal_id: self.goal_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "goal_id",
                    "goal_id was not specified but it is required when building Goal",
                )
            })?,
            title: self.title.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "title",
                    "title was not specified but it is required when building Goal",
                )
            })?,
            content: self.content,
            status: self.status.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "status",
                    "status was not specified but it is required when building Goal",
                )
            })?,
            goal_type: self.goal_type.unwrap_or(
                "ONCALL_REPORT"
                    .parse::<crate::types::GoalType>()
                    .expect("static value validated to member"),
            ),
            created_at: self.created_at.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "created_at",
                    "created_at was not specified but it is required when building Goal",
                )
            })?,
            updated_at: self.updated_at.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "updated_at",
                    "updated_at was not specified but it is required when building Goal",
                )
            })?,
            last_evaluated_at: self.last_evaluated_at,
            last_task_id: self.last_task_id,
            last_successful_task_id: self.last_successful_task_id,
            version: self.version.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "version",
                    "version was not specified but it is required when building Goal",
                )
            })?,
            evaluation_schedule: self.evaluation_schedule,
        })
    }
}