aws-sdk-mailmanager 1.79.0

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

/// <p>The SMTP envelope information of the email.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Envelope {
    /// <p>The HELO used by the host from which the email was received.</p>
    pub helo: ::std::option::Option<::std::string::String>,
    /// <p>The RCPT FROM given by the host from which the email was received.</p>
    pub from: ::std::option::Option<::std::string::String>,
    /// <p>All SMTP TO entries given by the host from which the email was received.</p>
    pub to: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Envelope {
    /// <p>The HELO used by the host from which the email was received.</p>
    pub fn helo(&self) -> ::std::option::Option<&str> {
        self.helo.as_deref()
    }
    /// <p>The RCPT FROM given by the host from which the email was received.</p>
    pub fn from(&self) -> ::std::option::Option<&str> {
        self.from.as_deref()
    }
    /// <p>All SMTP TO entries given by the host from which the email was received.</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 `.to.is_none()`.
    pub fn to(&self) -> &[::std::string::String] {
        self.to.as_deref().unwrap_or_default()
    }
}
impl Envelope {
    /// Creates a new builder-style object to manufacture [`Envelope`](crate::types::Envelope).
    pub fn builder() -> crate::types::builders::EnvelopeBuilder {
        crate::types::builders::EnvelopeBuilder::default()
    }
}

/// A builder for [`Envelope`](crate::types::Envelope).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct EnvelopeBuilder {
    pub(crate) helo: ::std::option::Option<::std::string::String>,
    pub(crate) from: ::std::option::Option<::std::string::String>,
    pub(crate) to: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl EnvelopeBuilder {
    /// <p>The HELO used by the host from which the email was received.</p>
    pub fn helo(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.helo = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The HELO used by the host from which the email was received.</p>
    pub fn set_helo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.helo = input;
        self
    }
    /// <p>The HELO used by the host from which the email was received.</p>
    pub fn get_helo(&self) -> &::std::option::Option<::std::string::String> {
        &self.helo
    }
    /// <p>The RCPT FROM given by the host from which the email was received.</p>
    pub fn from(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.from = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The RCPT FROM given by the host from which the email was received.</p>
    pub fn set_from(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.from = input;
        self
    }
    /// <p>The RCPT FROM given by the host from which the email was received.</p>
    pub fn get_from(&self) -> &::std::option::Option<::std::string::String> {
        &self.from
    }
    /// Appends an item to `to`.
    ///
    /// To override the contents of this collection use [`set_to`](Self::set_to).
    ///
    /// <p>All SMTP TO entries given by the host from which the email was received.</p>
    pub fn to(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.to.unwrap_or_default();
        v.push(input.into());
        self.to = ::std::option::Option::Some(v);
        self
    }
    /// <p>All SMTP TO entries given by the host from which the email was received.</p>
    pub fn set_to(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.to = input;
        self
    }
    /// <p>All SMTP TO entries given by the host from which the email was received.</p>
    pub fn get_to(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.to
    }
    /// Consumes the builder and constructs a [`Envelope`](crate::types::Envelope).
    pub fn build(self) -> crate::types::Envelope {
        crate::types::Envelope {
            helo: self.helo,
            from: self.from,
            to: self.to,
        }
    }
}