aws_sdk_connectcases/types/
_search_related_items_response_item.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A list of items that represent RelatedItems.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct SearchRelatedItemsResponseItem {
7    /// <p>Unique identifier of a related item.</p>
8    pub related_item_id: ::std::string::String,
9    /// <p>Type of a related item.</p>
10    pub r#type: crate::types::RelatedItemType,
11    /// <p>Time at which a related item was associated with a case.</p>
12    pub association_time: ::aws_smithy_types::DateTime,
13    /// <p>Represents the content of a particular type of related item.</p>
14    pub content: ::std::option::Option<crate::types::RelatedItemContent>,
15    /// <p>A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.</p>
16    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>>,
17    /// <p>Represents the creator of the related item.</p>
18    pub performed_by: ::std::option::Option<crate::types::UserUnion>,
19}
20impl SearchRelatedItemsResponseItem {
21    /// <p>Unique identifier of a related item.</p>
22    pub fn related_item_id(&self) -> &str {
23        use std::ops::Deref;
24        self.related_item_id.deref()
25    }
26    /// <p>Type of a related item.</p>
27    pub fn r#type(&self) -> &crate::types::RelatedItemType {
28        &self.r#type
29    }
30    /// <p>Time at which a related item was associated with a case.</p>
31    pub fn association_time(&self) -> &::aws_smithy_types::DateTime {
32        &self.association_time
33    }
34    /// <p>Represents the content of a particular type of related item.</p>
35    pub fn content(&self) -> ::std::option::Option<&crate::types::RelatedItemContent> {
36        self.content.as_ref()
37    }
38    /// <p>A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.</p>
39    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>> {
40        self.tags.as_ref()
41    }
42    /// <p>Represents the creator of the related item.</p>
43    pub fn performed_by(&self) -> ::std::option::Option<&crate::types::UserUnion> {
44        self.performed_by.as_ref()
45    }
46}
47impl SearchRelatedItemsResponseItem {
48    /// Creates a new builder-style object to manufacture [`SearchRelatedItemsResponseItem`](crate::types::SearchRelatedItemsResponseItem).
49    pub fn builder() -> crate::types::builders::SearchRelatedItemsResponseItemBuilder {
50        crate::types::builders::SearchRelatedItemsResponseItemBuilder::default()
51    }
52}
53
54/// A builder for [`SearchRelatedItemsResponseItem`](crate::types::SearchRelatedItemsResponseItem).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct SearchRelatedItemsResponseItemBuilder {
58    pub(crate) related_item_id: ::std::option::Option<::std::string::String>,
59    pub(crate) r#type: ::std::option::Option<crate::types::RelatedItemType>,
60    pub(crate) association_time: ::std::option::Option<::aws_smithy_types::DateTime>,
61    pub(crate) content: ::std::option::Option<crate::types::RelatedItemContent>,
62    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>>,
63    pub(crate) performed_by: ::std::option::Option<crate::types::UserUnion>,
64}
65impl SearchRelatedItemsResponseItemBuilder {
66    /// <p>Unique identifier of a related item.</p>
67    /// This field is required.
68    pub fn related_item_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.related_item_id = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>Unique identifier of a related item.</p>
73    pub fn set_related_item_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.related_item_id = input;
75        self
76    }
77    /// <p>Unique identifier of a related item.</p>
78    pub fn get_related_item_id(&self) -> &::std::option::Option<::std::string::String> {
79        &self.related_item_id
80    }
81    /// <p>Type of a related item.</p>
82    /// This field is required.
83    pub fn r#type(mut self, input: crate::types::RelatedItemType) -> Self {
84        self.r#type = ::std::option::Option::Some(input);
85        self
86    }
87    /// <p>Type of a related item.</p>
88    pub fn set_type(mut self, input: ::std::option::Option<crate::types::RelatedItemType>) -> Self {
89        self.r#type = input;
90        self
91    }
92    /// <p>Type of a related item.</p>
93    pub fn get_type(&self) -> &::std::option::Option<crate::types::RelatedItemType> {
94        &self.r#type
95    }
96    /// <p>Time at which a related item was associated with a case.</p>
97    /// This field is required.
98    pub fn association_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
99        self.association_time = ::std::option::Option::Some(input);
100        self
101    }
102    /// <p>Time at which a related item was associated with a case.</p>
103    pub fn set_association_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
104        self.association_time = input;
105        self
106    }
107    /// <p>Time at which a related item was associated with a case.</p>
108    pub fn get_association_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
109        &self.association_time
110    }
111    /// <p>Represents the content of a particular type of related item.</p>
112    /// This field is required.
113    pub fn content(mut self, input: crate::types::RelatedItemContent) -> Self {
114        self.content = ::std::option::Option::Some(input);
115        self
116    }
117    /// <p>Represents the content of a particular type of related item.</p>
118    pub fn set_content(mut self, input: ::std::option::Option<crate::types::RelatedItemContent>) -> Self {
119        self.content = input;
120        self
121    }
122    /// <p>Represents the content of a particular type of related item.</p>
123    pub fn get_content(&self) -> &::std::option::Option<crate::types::RelatedItemContent> {
124        &self.content
125    }
126    /// Adds a key-value pair to `tags`.
127    ///
128    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
129    ///
130    /// <p>A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.</p>
131    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: ::std::option::Option<::std::string::String>) -> Self {
132        let mut hash_map = self.tags.unwrap_or_default();
133        hash_map.insert(k.into(), v);
134        self.tags = ::std::option::Option::Some(hash_map);
135        self
136    }
137    /// <p>A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.</p>
138    pub fn set_tags(
139        mut self,
140        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>>,
141    ) -> Self {
142        self.tags = input;
143        self
144    }
145    /// <p>A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.</p>
146    pub fn get_tags(
147        &self,
148    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>> {
149        &self.tags
150    }
151    /// <p>Represents the creator of the related item.</p>
152    pub fn performed_by(mut self, input: crate::types::UserUnion) -> Self {
153        self.performed_by = ::std::option::Option::Some(input);
154        self
155    }
156    /// <p>Represents the creator of the related item.</p>
157    pub fn set_performed_by(mut self, input: ::std::option::Option<crate::types::UserUnion>) -> Self {
158        self.performed_by = input;
159        self
160    }
161    /// <p>Represents the creator of the related item.</p>
162    pub fn get_performed_by(&self) -> &::std::option::Option<crate::types::UserUnion> {
163        &self.performed_by
164    }
165    /// Consumes the builder and constructs a [`SearchRelatedItemsResponseItem`](crate::types::SearchRelatedItemsResponseItem).
166    /// This method will fail if any of the following fields are not set:
167    /// - [`related_item_id`](crate::types::builders::SearchRelatedItemsResponseItemBuilder::related_item_id)
168    /// - [`r#type`](crate::types::builders::SearchRelatedItemsResponseItemBuilder::type)
169    /// - [`association_time`](crate::types::builders::SearchRelatedItemsResponseItemBuilder::association_time)
170    pub fn build(self) -> ::std::result::Result<crate::types::SearchRelatedItemsResponseItem, ::aws_smithy_types::error::operation::BuildError> {
171        ::std::result::Result::Ok(crate::types::SearchRelatedItemsResponseItem {
172            related_item_id: self.related_item_id.ok_or_else(|| {
173                ::aws_smithy_types::error::operation::BuildError::missing_field(
174                    "related_item_id",
175                    "related_item_id was not specified but it is required when building SearchRelatedItemsResponseItem",
176                )
177            })?,
178            r#type: self.r#type.ok_or_else(|| {
179                ::aws_smithy_types::error::operation::BuildError::missing_field(
180                    "r#type",
181                    "r#type was not specified but it is required when building SearchRelatedItemsResponseItem",
182                )
183            })?,
184            association_time: self.association_time.ok_or_else(|| {
185                ::aws_smithy_types::error::operation::BuildError::missing_field(
186                    "association_time",
187                    "association_time was not specified but it is required when building SearchRelatedItemsResponseItem",
188                )
189            })?,
190            content: self.content,
191            tags: self.tags,
192            performed_by: self.performed_by,
193        })
194    }
195}