aws-sdk-ses 1.96.0

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

/// <p>Represents textual data, plus an optional character set specification.</p>
/// <p>By default, the text must be 7-bit ASCII, due to the constraints of the SMTP protocol. If the text must contain any other characters, then you must also specify a character set. Examples include UTF-8, ISO-8859-1, and Shift_JIS.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Content {
    /// <p>The textual data of the content.</p>
    pub data: ::std::string::String,
    /// <p>The character set of the content.</p>
    pub charset: ::std::option::Option<::std::string::String>,
}
impl Content {
    /// <p>The textual data of the content.</p>
    pub fn data(&self) -> &str {
        use std::ops::Deref;
        self.data.deref()
    }
    /// <p>The character set of the content.</p>
    pub fn charset(&self) -> ::std::option::Option<&str> {
        self.charset.as_deref()
    }
}
impl Content {
    /// Creates a new builder-style object to manufacture [`Content`](crate::types::Content).
    pub fn builder() -> crate::types::builders::ContentBuilder {
        crate::types::builders::ContentBuilder::default()
    }
}

/// A builder for [`Content`](crate::types::Content).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ContentBuilder {
    pub(crate) data: ::std::option::Option<::std::string::String>,
    pub(crate) charset: ::std::option::Option<::std::string::String>,
}
impl ContentBuilder {
    /// <p>The textual data of the content.</p>
    /// This field is required.
    pub fn data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.data = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The textual data of the content.</p>
    pub fn set_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.data = input;
        self
    }
    /// <p>The textual data of the content.</p>
    pub fn get_data(&self) -> &::std::option::Option<::std::string::String> {
        &self.data
    }
    /// <p>The character set of the content.</p>
    pub fn charset(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.charset = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The character set of the content.</p>
    pub fn set_charset(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.charset = input;
        self
    }
    /// <p>The character set of the content.</p>
    pub fn get_charset(&self) -> &::std::option::Option<::std::string::String> {
        &self.charset
    }
    /// Consumes the builder and constructs a [`Content`](crate::types::Content).
    /// This method will fail if any of the following fields are not set:
    /// - [`data`](crate::types::builders::ContentBuilder::data)
    pub fn build(self) -> ::std::result::Result<crate::types::Content, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Content {
            data: self.data.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "data",
                    "data was not specified but it is required when building Content",
                )
            })?,
            charset: self.charset,
        })
    }
}