aws-sdk-ecs 1.128.0

AWS SDK for Amazon EC2 Container Service
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 UpdateTaskProtectionInput {
    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.</p>
    pub cluster: ::std::option::Option<::std::string::String>,
    /// <p>A list of up to 10 task IDs or full ARN entries.</p>
    pub tasks: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>Specify <code>true</code> to mark a task for protection and <code>false</code> to unset protection, making it eligible for termination.</p>
    pub protection_enabled: ::std::option::Option<bool>,
    /// <p>If you set <code>protectionEnabled</code> to <code>true</code>, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, <code>protectionEnabled</code> will be reset to <code>false</code>.</p>
    /// <p>If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).</p>
    pub expires_in_minutes: ::std::option::Option<i32>,
}
impl UpdateTaskProtectionInput {
    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.</p>
    pub fn cluster(&self) -> ::std::option::Option<&str> {
        self.cluster.as_deref()
    }
    /// <p>A list of up to 10 task IDs or full ARN entries.</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 `.tasks.is_none()`.
    pub fn tasks(&self) -> &[::std::string::String] {
        self.tasks.as_deref().unwrap_or_default()
    }
    /// <p>Specify <code>true</code> to mark a task for protection and <code>false</code> to unset protection, making it eligible for termination.</p>
    pub fn protection_enabled(&self) -> ::std::option::Option<bool> {
        self.protection_enabled
    }
    /// <p>If you set <code>protectionEnabled</code> to <code>true</code>, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, <code>protectionEnabled</code> will be reset to <code>false</code>.</p>
    /// <p>If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).</p>
    pub fn expires_in_minutes(&self) -> ::std::option::Option<i32> {
        self.expires_in_minutes
    }
}
impl UpdateTaskProtectionInput {
    /// Creates a new builder-style object to manufacture [`UpdateTaskProtectionInput`](crate::operation::update_task_protection::UpdateTaskProtectionInput).
    pub fn builder() -> crate::operation::update_task_protection::builders::UpdateTaskProtectionInputBuilder {
        crate::operation::update_task_protection::builders::UpdateTaskProtectionInputBuilder::default()
    }
}

/// A builder for [`UpdateTaskProtectionInput`](crate::operation::update_task_protection::UpdateTaskProtectionInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct UpdateTaskProtectionInputBuilder {
    pub(crate) cluster: ::std::option::Option<::std::string::String>,
    pub(crate) tasks: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) protection_enabled: ::std::option::Option<bool>,
    pub(crate) expires_in_minutes: ::std::option::Option<i32>,
}
impl UpdateTaskProtectionInputBuilder {
    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.</p>
    /// This field is required.
    pub fn cluster(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.cluster = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.</p>
    pub fn set_cluster(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.cluster = input;
        self
    }
    /// <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.</p>
    pub fn get_cluster(&self) -> &::std::option::Option<::std::string::String> {
        &self.cluster
    }
    /// Appends an item to `tasks`.
    ///
    /// To override the contents of this collection use [`set_tasks`](Self::set_tasks).
    ///
    /// <p>A list of up to 10 task IDs or full ARN entries.</p>
    pub fn tasks(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.tasks.unwrap_or_default();
        v.push(input.into());
        self.tasks = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of up to 10 task IDs or full ARN entries.</p>
    pub fn set_tasks(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.tasks = input;
        self
    }
    /// <p>A list of up to 10 task IDs or full ARN entries.</p>
    pub fn get_tasks(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.tasks
    }
    /// <p>Specify <code>true</code> to mark a task for protection and <code>false</code> to unset protection, making it eligible for termination.</p>
    /// This field is required.
    pub fn protection_enabled(mut self, input: bool) -> Self {
        self.protection_enabled = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specify <code>true</code> to mark a task for protection and <code>false</code> to unset protection, making it eligible for termination.</p>
    pub fn set_protection_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
        self.protection_enabled = input;
        self
    }
    /// <p>Specify <code>true</code> to mark a task for protection and <code>false</code> to unset protection, making it eligible for termination.</p>
    pub fn get_protection_enabled(&self) -> &::std::option::Option<bool> {
        &self.protection_enabled
    }
    /// <p>If you set <code>protectionEnabled</code> to <code>true</code>, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, <code>protectionEnabled</code> will be reset to <code>false</code>.</p>
    /// <p>If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).</p>
    pub fn expires_in_minutes(mut self, input: i32) -> Self {
        self.expires_in_minutes = ::std::option::Option::Some(input);
        self
    }
    /// <p>If you set <code>protectionEnabled</code> to <code>true</code>, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, <code>protectionEnabled</code> will be reset to <code>false</code>.</p>
    /// <p>If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).</p>
    pub fn set_expires_in_minutes(mut self, input: ::std::option::Option<i32>) -> Self {
        self.expires_in_minutes = input;
        self
    }
    /// <p>If you set <code>protectionEnabled</code> to <code>true</code>, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, <code>protectionEnabled</code> will be reset to <code>false</code>.</p>
    /// <p>If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).</p>
    pub fn get_expires_in_minutes(&self) -> &::std::option::Option<i32> {
        &self.expires_in_minutes
    }
    /// Consumes the builder and constructs a [`UpdateTaskProtectionInput`](crate::operation::update_task_protection::UpdateTaskProtectionInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::update_task_protection::UpdateTaskProtectionInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::update_task_protection::UpdateTaskProtectionInput {
            cluster: self.cluster,
            tasks: self.tasks,
            protection_enabled: self.protection_enabled,
            expires_in_minutes: self.expires_in_minutes,
        })
    }
}