aws_sdk_pinpoint/types/_message_header.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the name and value pair of an email header to add to your email. You can have up to 15 MessageHeaders. A header can contain information such as the sender, receiver, route, or timestamp.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct MessageHeader {
7 /// <p>The name of the message header. The header name can contain up to 126 characters.</p>
8 pub name: ::std::option::Option<::std::string::String>,
9 /// <p>The value of the message header. The header value can contain up to 870 characters, including the length of any rendered attributes. For example if you add the {CreationDate} attribute, it renders as YYYY-MM-DDTHH:MM:SS.SSSZ and is 24 characters in length.</p>
10 pub value: ::std::option::Option<::std::string::String>,
11}
12impl MessageHeader {
13 /// <p>The name of the message header. The header name can contain up to 126 characters.</p>
14 pub fn name(&self) -> ::std::option::Option<&str> {
15 self.name.as_deref()
16 }
17 /// <p>The value of the message header. The header value can contain up to 870 characters, including the length of any rendered attributes. For example if you add the {CreationDate} attribute, it renders as YYYY-MM-DDTHH:MM:SS.SSSZ and is 24 characters in length.</p>
18 pub fn value(&self) -> ::std::option::Option<&str> {
19 self.value.as_deref()
20 }
21}
22impl MessageHeader {
23 /// Creates a new builder-style object to manufacture [`MessageHeader`](crate::types::MessageHeader).
24 pub fn builder() -> crate::types::builders::MessageHeaderBuilder {
25 crate::types::builders::MessageHeaderBuilder::default()
26 }
27}
28
29/// A builder for [`MessageHeader`](crate::types::MessageHeader).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct MessageHeaderBuilder {
33 pub(crate) name: ::std::option::Option<::std::string::String>,
34 pub(crate) value: ::std::option::Option<::std::string::String>,
35}
36impl MessageHeaderBuilder {
37 /// <p>The name of the message header. The header name can contain up to 126 characters.</p>
38 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
39 self.name = ::std::option::Option::Some(input.into());
40 self
41 }
42 /// <p>The name of the message header. The header name can contain up to 126 characters.</p>
43 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
44 self.name = input;
45 self
46 }
47 /// <p>The name of the message header. The header name can contain up to 126 characters.</p>
48 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
49 &self.name
50 }
51 /// <p>The value of the message header. The header value can contain up to 870 characters, including the length of any rendered attributes. For example if you add the {CreationDate} attribute, it renders as YYYY-MM-DDTHH:MM:SS.SSSZ and is 24 characters in length.</p>
52 pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
53 self.value = ::std::option::Option::Some(input.into());
54 self
55 }
56 /// <p>The value of the message header. The header value can contain up to 870 characters, including the length of any rendered attributes. For example if you add the {CreationDate} attribute, it renders as YYYY-MM-DDTHH:MM:SS.SSSZ and is 24 characters in length.</p>
57 pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
58 self.value = input;
59 self
60 }
61 /// <p>The value of the message header. The header value can contain up to 870 characters, including the length of any rendered attributes. For example if you add the {CreationDate} attribute, it renders as YYYY-MM-DDTHH:MM:SS.SSSZ and is 24 characters in length.</p>
62 pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
63 &self.value
64 }
65 /// Consumes the builder and constructs a [`MessageHeader`](crate::types::MessageHeader).
66 pub fn build(self) -> crate::types::MessageHeader {
67 crate::types::MessageHeader {
68 name: self.name,
69 value: self.value,
70 }
71 }
72}