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.

/// <p>An object representing a container instance or task attachment.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Attachment {
    /// <p>The unique identifier for the attachment.</p>
    pub id: ::std::option::Option<::std::string::String>,
    /// <p>The type of the attachment, such as <code>ElasticNetworkInterface</code>, <code>Service Connect</code>, and <code>AmazonElasticBlockStorage</code>.</p>
    pub r#type: ::std::option::Option<::std::string::String>,
    /// <p>The status of the attachment. Valid values are <code>PRECREATED</code>, <code>CREATED</code>, <code>ATTACHING</code>, <code>ATTACHED</code>, <code>DETACHING</code>, <code>DETACHED</code>, <code>DELETED</code>, and <code>FAILED</code>.</p>
    pub status: ::std::option::Option<::std::string::String>,
    /// <p>Details of the attachment.</p>
    /// <p>For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.</p>
    /// <p>For Service Connect services, this includes <code>portName</code>, <code>clientAliases</code>, <code>discoveryName</code>, and <code>ingressPortOverride</code>.</p>
    /// <p>For Elastic Block Storage, this includes <code>roleArn</code>, <code>deleteOnTermination</code>, <code>volumeName</code>, <code>volumeId</code>, and <code>statusReason</code> (only when the attachment fails to create or attach).</p>
    pub details: ::std::option::Option<::std::vec::Vec<crate::types::KeyValuePair>>,
}
impl Attachment {
    /// <p>The unique identifier for the attachment.</p>
    pub fn id(&self) -> ::std::option::Option<&str> {
        self.id.as_deref()
    }
    /// <p>The type of the attachment, such as <code>ElasticNetworkInterface</code>, <code>Service Connect</code>, and <code>AmazonElasticBlockStorage</code>.</p>
    pub fn r#type(&self) -> ::std::option::Option<&str> {
        self.r#type.as_deref()
    }
    /// <p>The status of the attachment. Valid values are <code>PRECREATED</code>, <code>CREATED</code>, <code>ATTACHING</code>, <code>ATTACHED</code>, <code>DETACHING</code>, <code>DETACHED</code>, <code>DELETED</code>, and <code>FAILED</code>.</p>
    pub fn status(&self) -> ::std::option::Option<&str> {
        self.status.as_deref()
    }
    /// <p>Details of the attachment.</p>
    /// <p>For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.</p>
    /// <p>For Service Connect services, this includes <code>portName</code>, <code>clientAliases</code>, <code>discoveryName</code>, and <code>ingressPortOverride</code>.</p>
    /// <p>For Elastic Block Storage, this includes <code>roleArn</code>, <code>deleteOnTermination</code>, <code>volumeName</code>, <code>volumeId</code>, and <code>statusReason</code> (only when the attachment fails to create or attach).</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 `.details.is_none()`.
    pub fn details(&self) -> &[crate::types::KeyValuePair] {
        self.details.as_deref().unwrap_or_default()
    }
}
impl Attachment {
    /// Creates a new builder-style object to manufacture [`Attachment`](crate::types::Attachment).
    pub fn builder() -> crate::types::builders::AttachmentBuilder {
        crate::types::builders::AttachmentBuilder::default()
    }
}

/// A builder for [`Attachment`](crate::types::Attachment).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AttachmentBuilder {
    pub(crate) id: ::std::option::Option<::std::string::String>,
    pub(crate) r#type: ::std::option::Option<::std::string::String>,
    pub(crate) status: ::std::option::Option<::std::string::String>,
    pub(crate) details: ::std::option::Option<::std::vec::Vec<crate::types::KeyValuePair>>,
}
impl AttachmentBuilder {
    /// <p>The unique identifier for the attachment.</p>
    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique identifier for the attachment.</p>
    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.id = input;
        self
    }
    /// <p>The unique identifier for the attachment.</p>
    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.id
    }
    /// <p>The type of the attachment, such as <code>ElasticNetworkInterface</code>, <code>Service Connect</code>, and <code>AmazonElasticBlockStorage</code>.</p>
    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.r#type = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The type of the attachment, such as <code>ElasticNetworkInterface</code>, <code>Service Connect</code>, and <code>AmazonElasticBlockStorage</code>.</p>
    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The type of the attachment, such as <code>ElasticNetworkInterface</code>, <code>Service Connect</code>, and <code>AmazonElasticBlockStorage</code>.</p>
    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.r#type
    }
    /// <p>The status of the attachment. Valid values are <code>PRECREATED</code>, <code>CREATED</code>, <code>ATTACHING</code>, <code>ATTACHED</code>, <code>DETACHING</code>, <code>DETACHED</code>, <code>DELETED</code>, and <code>FAILED</code>.</p>
    pub fn status(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.status = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The status of the attachment. Valid values are <code>PRECREATED</code>, <code>CREATED</code>, <code>ATTACHING</code>, <code>ATTACHED</code>, <code>DETACHING</code>, <code>DETACHED</code>, <code>DELETED</code>, and <code>FAILED</code>.</p>
    pub fn set_status(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.status = input;
        self
    }
    /// <p>The status of the attachment. Valid values are <code>PRECREATED</code>, <code>CREATED</code>, <code>ATTACHING</code>, <code>ATTACHED</code>, <code>DETACHING</code>, <code>DETACHED</code>, <code>DELETED</code>, and <code>FAILED</code>.</p>
    pub fn get_status(&self) -> &::std::option::Option<::std::string::String> {
        &self.status
    }
    /// Appends an item to `details`.
    ///
    /// To override the contents of this collection use [`set_details`](Self::set_details).
    ///
    /// <p>Details of the attachment.</p>
    /// <p>For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.</p>
    /// <p>For Service Connect services, this includes <code>portName</code>, <code>clientAliases</code>, <code>discoveryName</code>, and <code>ingressPortOverride</code>.</p>
    /// <p>For Elastic Block Storage, this includes <code>roleArn</code>, <code>deleteOnTermination</code>, <code>volumeName</code>, <code>volumeId</code>, and <code>statusReason</code> (only when the attachment fails to create or attach).</p>
    pub fn details(mut self, input: crate::types::KeyValuePair) -> Self {
        let mut v = self.details.unwrap_or_default();
        v.push(input);
        self.details = ::std::option::Option::Some(v);
        self
    }
    /// <p>Details of the attachment.</p>
    /// <p>For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.</p>
    /// <p>For Service Connect services, this includes <code>portName</code>, <code>clientAliases</code>, <code>discoveryName</code>, and <code>ingressPortOverride</code>.</p>
    /// <p>For Elastic Block Storage, this includes <code>roleArn</code>, <code>deleteOnTermination</code>, <code>volumeName</code>, <code>volumeId</code>, and <code>statusReason</code> (only when the attachment fails to create or attach).</p>
    pub fn set_details(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::KeyValuePair>>) -> Self {
        self.details = input;
        self
    }
    /// <p>Details of the attachment.</p>
    /// <p>For elastic network interfaces, this includes the network interface ID, the MAC address, the subnet ID, and the private IPv4 address.</p>
    /// <p>For Service Connect services, this includes <code>portName</code>, <code>clientAliases</code>, <code>discoveryName</code>, and <code>ingressPortOverride</code>.</p>
    /// <p>For Elastic Block Storage, this includes <code>roleArn</code>, <code>deleteOnTermination</code>, <code>volumeName</code>, <code>volumeId</code>, and <code>statusReason</code> (only when the attachment fails to create or attach).</p>
    pub fn get_details(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::KeyValuePair>> {
        &self.details
    }
    /// Consumes the builder and constructs a [`Attachment`](crate::types::Attachment).
    pub fn build(self) -> crate::types::Attachment {
        crate::types::Attachment {
            id: self.id,
            r#type: self.r#type,
            status: self.status,
            details: self.details,
        }
    }
}