aws-sdk-xray 1.94.0

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

/// <p>An alias for an edge.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Alias {
    /// <p>The canonical name of the alias.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>A list of names for the alias, including the canonical name.</p>
    pub names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The type of the alias.</p>
    pub r#type: ::std::option::Option<::std::string::String>,
}
impl Alias {
    /// <p>The canonical name of the alias.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>A list of names for the alias, including the canonical name.</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 `.names.is_none()`.
    pub fn names(&self) -> &[::std::string::String] {
        self.names.as_deref().unwrap_or_default()
    }
    /// <p>The type of the alias.</p>
    pub fn r#type(&self) -> ::std::option::Option<&str> {
        self.r#type.as_deref()
    }
}
impl Alias {
    /// Creates a new builder-style object to manufacture [`Alias`](crate::types::Alias).
    pub fn builder() -> crate::types::builders::AliasBuilder {
        crate::types::builders::AliasBuilder::default()
    }
}

/// A builder for [`Alias`](crate::types::Alias).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AliasBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) r#type: ::std::option::Option<::std::string::String>,
}
impl AliasBuilder {
    /// <p>The canonical name of the alias.</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The canonical name of the alias.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The canonical name of the alias.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// Appends an item to `names`.
    ///
    /// To override the contents of this collection use [`set_names`](Self::set_names).
    ///
    /// <p>A list of names for the alias, including the canonical name.</p>
    pub fn names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.names.unwrap_or_default();
        v.push(input.into());
        self.names = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of names for the alias, including the canonical name.</p>
    pub fn set_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.names = input;
        self
    }
    /// <p>A list of names for the alias, including the canonical name.</p>
    pub fn get_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.names
    }
    /// <p>The type of the alias.</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 alias.</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 alias.</p>
    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
        &self.r#type
    }
    /// Consumes the builder and constructs a [`Alias`](crate::types::Alias).
    pub fn build(self) -> crate::types::Alias {
        crate::types::Alias {
            name: self.name,
            names: self.names,
            r#type: self.r#type,
        }
    }
}