aws-sdk-ecs 1.124.0

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

/// <p>The <code>ulimit</code> settings to pass to the container.</p>
/// <p>Amazon ECS tasks hosted on Fargate use the default resource limit values set by the operating system with the exception of the <code>nofile</code> resource limit parameter which Fargate overrides. The <code>nofile</code> resource limit sets a restriction on the number of open files that a container can use. The default <code>nofile</code> soft limit is <code> 65535</code> and the default hard limit is <code>65535</code>.</p>
/// <p>You can specify the <code>ulimit</code> settings for a container in a task definition.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Ulimit {
    /// <p>The <code>type</code> of the <code>ulimit</code>.</p>
    pub name: crate::types::UlimitName,
    /// <p>The soft limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub soft_limit: i32,
    /// <p>The hard limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub hard_limit: i32,
}
impl Ulimit {
    /// <p>The <code>type</code> of the <code>ulimit</code>.</p>
    pub fn name(&self) -> &crate::types::UlimitName {
        &self.name
    }
    /// <p>The soft limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub fn soft_limit(&self) -> i32 {
        self.soft_limit
    }
    /// <p>The hard limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub fn hard_limit(&self) -> i32 {
        self.hard_limit
    }
}
impl Ulimit {
    /// Creates a new builder-style object to manufacture [`Ulimit`](crate::types::Ulimit).
    pub fn builder() -> crate::types::builders::UlimitBuilder {
        crate::types::builders::UlimitBuilder::default()
    }
}

/// A builder for [`Ulimit`](crate::types::Ulimit).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct UlimitBuilder {
    pub(crate) name: ::std::option::Option<crate::types::UlimitName>,
    pub(crate) soft_limit: ::std::option::Option<i32>,
    pub(crate) hard_limit: ::std::option::Option<i32>,
}
impl UlimitBuilder {
    /// <p>The <code>type</code> of the <code>ulimit</code>.</p>
    /// This field is required.
    pub fn name(mut self, input: crate::types::UlimitName) -> Self {
        self.name = ::std::option::Option::Some(input);
        self
    }
    /// <p>The <code>type</code> of the <code>ulimit</code>.</p>
    pub fn set_name(mut self, input: ::std::option::Option<crate::types::UlimitName>) -> Self {
        self.name = input;
        self
    }
    /// <p>The <code>type</code> of the <code>ulimit</code>.</p>
    pub fn get_name(&self) -> &::std::option::Option<crate::types::UlimitName> {
        &self.name
    }
    /// <p>The soft limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    /// This field is required.
    pub fn soft_limit(mut self, input: i32) -> Self {
        self.soft_limit = ::std::option::Option::Some(input);
        self
    }
    /// <p>The soft limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub fn set_soft_limit(mut self, input: ::std::option::Option<i32>) -> Self {
        self.soft_limit = input;
        self
    }
    /// <p>The soft limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub fn get_soft_limit(&self) -> &::std::option::Option<i32> {
        &self.soft_limit
    }
    /// <p>The hard limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    /// This field is required.
    pub fn hard_limit(mut self, input: i32) -> Self {
        self.hard_limit = ::std::option::Option::Some(input);
        self
    }
    /// <p>The hard limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub fn set_hard_limit(mut self, input: ::std::option::Option<i32>) -> Self {
        self.hard_limit = input;
        self
    }
    /// <p>The hard limit for the <code>ulimit</code> type. The value can be specified in bytes, seconds, or as a count, depending on the <code>type</code> of the <code>ulimit</code>.</p>
    pub fn get_hard_limit(&self) -> &::std::option::Option<i32> {
        &self.hard_limit
    }
    /// Consumes the builder and constructs a [`Ulimit`](crate::types::Ulimit).
    /// This method will fail if any of the following fields are not set:
    /// - [`name`](crate::types::builders::UlimitBuilder::name)
    pub fn build(self) -> ::std::result::Result<crate::types::Ulimit, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Ulimit {
            name: self.name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "name",
                    "name was not specified but it is required when building Ulimit",
                )
            })?,
            soft_limit: self.soft_limit.unwrap_or_default(),
            hard_limit: self.hard_limit.unwrap_or_default(),
        })
    }
}