aws_sdk_connectcases/operation/get_template/
_get_template_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetTemplateOutput {
6    /// <p>A unique identifier of a template.</p>
7    pub template_id: ::std::string::String,
8    /// <p>The Amazon Resource Name (ARN) of the template.</p>
9    pub template_arn: ::std::string::String,
10    /// <p>The name of the template.</p>
11    pub name: ::std::string::String,
12    /// <p>A brief description of the template.</p>
13    pub description: ::std::option::Option<::std::string::String>,
14    /// <p>Configuration of layouts associated to the template.</p>
15    pub layout_configuration: ::std::option::Option<crate::types::LayoutConfiguration>,
16    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
17    pub required_fields: ::std::option::Option<::std::vec::Vec<crate::types::RequiredField>>,
18    /// <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>
19    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>>,
20    /// <p>The status of the template.</p>
21    pub status: crate::types::TemplateStatus,
22    /// <p>Denotes whether or not the resource has been deleted.</p>
23    pub deleted: bool,
24    /// <p>Timestamp at which the resource was created.</p>
25    pub created_time: ::std::option::Option<::aws_smithy_types::DateTime>,
26    /// <p>Timestamp at which the resource was created or last modified.</p>
27    pub last_modified_time: ::std::option::Option<::aws_smithy_types::DateTime>,
28    /// <p>A list of case rules (also known as <a href="https://docs.aws.amazon.com/connect/latest/adminguide/case-field-conditions.html">case field conditions</a>) on a template.</p>
29    pub rules: ::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>>,
30    _request_id: Option<String>,
31}
32impl GetTemplateOutput {
33    /// <p>A unique identifier of a template.</p>
34    pub fn template_id(&self) -> &str {
35        use std::ops::Deref;
36        self.template_id.deref()
37    }
38    /// <p>The Amazon Resource Name (ARN) of the template.</p>
39    pub fn template_arn(&self) -> &str {
40        use std::ops::Deref;
41        self.template_arn.deref()
42    }
43    /// <p>The name of the template.</p>
44    pub fn name(&self) -> &str {
45        use std::ops::Deref;
46        self.name.deref()
47    }
48    /// <p>A brief description of the template.</p>
49    pub fn description(&self) -> ::std::option::Option<&str> {
50        self.description.as_deref()
51    }
52    /// <p>Configuration of layouts associated to the template.</p>
53    pub fn layout_configuration(&self) -> ::std::option::Option<&crate::types::LayoutConfiguration> {
54        self.layout_configuration.as_ref()
55    }
56    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
57    ///
58    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.required_fields.is_none()`.
59    pub fn required_fields(&self) -> &[crate::types::RequiredField] {
60        self.required_fields.as_deref().unwrap_or_default()
61    }
62    /// <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>
63    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>> {
64        self.tags.as_ref()
65    }
66    /// <p>The status of the template.</p>
67    pub fn status(&self) -> &crate::types::TemplateStatus {
68        &self.status
69    }
70    /// <p>Denotes whether or not the resource has been deleted.</p>
71    pub fn deleted(&self) -> bool {
72        self.deleted
73    }
74    /// <p>Timestamp at which the resource was created.</p>
75    pub fn created_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
76        self.created_time.as_ref()
77    }
78    /// <p>Timestamp at which the resource was created or last modified.</p>
79    pub fn last_modified_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
80        self.last_modified_time.as_ref()
81    }
82    /// <p>A list of case rules (also known as <a href="https://docs.aws.amazon.com/connect/latest/adminguide/case-field-conditions.html">case field conditions</a>) on a template.</p>
83    ///
84    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.rules.is_none()`.
85    pub fn rules(&self) -> &[crate::types::TemplateRule] {
86        self.rules.as_deref().unwrap_or_default()
87    }
88}
89impl ::aws_types::request_id::RequestId for GetTemplateOutput {
90    fn request_id(&self) -> Option<&str> {
91        self._request_id.as_deref()
92    }
93}
94impl GetTemplateOutput {
95    /// Creates a new builder-style object to manufacture [`GetTemplateOutput`](crate::operation::get_template::GetTemplateOutput).
96    pub fn builder() -> crate::operation::get_template::builders::GetTemplateOutputBuilder {
97        crate::operation::get_template::builders::GetTemplateOutputBuilder::default()
98    }
99}
100
101/// A builder for [`GetTemplateOutput`](crate::operation::get_template::GetTemplateOutput).
102#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
103#[non_exhaustive]
104pub struct GetTemplateOutputBuilder {
105    pub(crate) template_id: ::std::option::Option<::std::string::String>,
106    pub(crate) template_arn: ::std::option::Option<::std::string::String>,
107    pub(crate) name: ::std::option::Option<::std::string::String>,
108    pub(crate) description: ::std::option::Option<::std::string::String>,
109    pub(crate) layout_configuration: ::std::option::Option<crate::types::LayoutConfiguration>,
110    pub(crate) required_fields: ::std::option::Option<::std::vec::Vec<crate::types::RequiredField>>,
111    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>>,
112    pub(crate) status: ::std::option::Option<crate::types::TemplateStatus>,
113    pub(crate) deleted: ::std::option::Option<bool>,
114    pub(crate) created_time: ::std::option::Option<::aws_smithy_types::DateTime>,
115    pub(crate) last_modified_time: ::std::option::Option<::aws_smithy_types::DateTime>,
116    pub(crate) rules: ::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>>,
117    _request_id: Option<String>,
118}
119impl GetTemplateOutputBuilder {
120    /// <p>A unique identifier of a template.</p>
121    /// This field is required.
122    pub fn template_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.template_id = ::std::option::Option::Some(input.into());
124        self
125    }
126    /// <p>A unique identifier of a template.</p>
127    pub fn set_template_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128        self.template_id = input;
129        self
130    }
131    /// <p>A unique identifier of a template.</p>
132    pub fn get_template_id(&self) -> &::std::option::Option<::std::string::String> {
133        &self.template_id
134    }
135    /// <p>The Amazon Resource Name (ARN) of the template.</p>
136    /// This field is required.
137    pub fn template_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.template_arn = ::std::option::Option::Some(input.into());
139        self
140    }
141    /// <p>The Amazon Resource Name (ARN) of the template.</p>
142    pub fn set_template_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.template_arn = input;
144        self
145    }
146    /// <p>The Amazon Resource Name (ARN) of the template.</p>
147    pub fn get_template_arn(&self) -> &::std::option::Option<::std::string::String> {
148        &self.template_arn
149    }
150    /// <p>The name of the template.</p>
151    /// This field is required.
152    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.name = ::std::option::Option::Some(input.into());
154        self
155    }
156    /// <p>The name of the template.</p>
157    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.name = input;
159        self
160    }
161    /// <p>The name of the template.</p>
162    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
163        &self.name
164    }
165    /// <p>A brief description of the template.</p>
166    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.description = ::std::option::Option::Some(input.into());
168        self
169    }
170    /// <p>A brief description of the template.</p>
171    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.description = input;
173        self
174    }
175    /// <p>A brief description of the template.</p>
176    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
177        &self.description
178    }
179    /// <p>Configuration of layouts associated to the template.</p>
180    pub fn layout_configuration(mut self, input: crate::types::LayoutConfiguration) -> Self {
181        self.layout_configuration = ::std::option::Option::Some(input);
182        self
183    }
184    /// <p>Configuration of layouts associated to the template.</p>
185    pub fn set_layout_configuration(mut self, input: ::std::option::Option<crate::types::LayoutConfiguration>) -> Self {
186        self.layout_configuration = input;
187        self
188    }
189    /// <p>Configuration of layouts associated to the template.</p>
190    pub fn get_layout_configuration(&self) -> &::std::option::Option<crate::types::LayoutConfiguration> {
191        &self.layout_configuration
192    }
193    /// Appends an item to `required_fields`.
194    ///
195    /// To override the contents of this collection use [`set_required_fields`](Self::set_required_fields).
196    ///
197    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
198    pub fn required_fields(mut self, input: crate::types::RequiredField) -> Self {
199        let mut v = self.required_fields.unwrap_or_default();
200        v.push(input);
201        self.required_fields = ::std::option::Option::Some(v);
202        self
203    }
204    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
205    pub fn set_required_fields(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RequiredField>>) -> Self {
206        self.required_fields = input;
207        self
208    }
209    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
210    pub fn get_required_fields(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RequiredField>> {
211        &self.required_fields
212    }
213    /// Adds a key-value pair to `tags`.
214    ///
215    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
216    ///
217    /// <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>
218    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: ::std::option::Option<::std::string::String>) -> Self {
219        let mut hash_map = self.tags.unwrap_or_default();
220        hash_map.insert(k.into(), v);
221        self.tags = ::std::option::Option::Some(hash_map);
222        self
223    }
224    /// <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>
225    pub fn set_tags(
226        mut self,
227        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>>,
228    ) -> Self {
229        self.tags = input;
230        self
231    }
232    /// <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>
233    pub fn get_tags(
234        &self,
235    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::option::Option<::std::string::String>>> {
236        &self.tags
237    }
238    /// <p>The status of the template.</p>
239    /// This field is required.
240    pub fn status(mut self, input: crate::types::TemplateStatus) -> Self {
241        self.status = ::std::option::Option::Some(input);
242        self
243    }
244    /// <p>The status of the template.</p>
245    pub fn set_status(mut self, input: ::std::option::Option<crate::types::TemplateStatus>) -> Self {
246        self.status = input;
247        self
248    }
249    /// <p>The status of the template.</p>
250    pub fn get_status(&self) -> &::std::option::Option<crate::types::TemplateStatus> {
251        &self.status
252    }
253    /// <p>Denotes whether or not the resource has been deleted.</p>
254    pub fn deleted(mut self, input: bool) -> Self {
255        self.deleted = ::std::option::Option::Some(input);
256        self
257    }
258    /// <p>Denotes whether or not the resource has been deleted.</p>
259    pub fn set_deleted(mut self, input: ::std::option::Option<bool>) -> Self {
260        self.deleted = input;
261        self
262    }
263    /// <p>Denotes whether or not the resource has been deleted.</p>
264    pub fn get_deleted(&self) -> &::std::option::Option<bool> {
265        &self.deleted
266    }
267    /// <p>Timestamp at which the resource was created.</p>
268    pub fn created_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
269        self.created_time = ::std::option::Option::Some(input);
270        self
271    }
272    /// <p>Timestamp at which the resource was created.</p>
273    pub fn set_created_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
274        self.created_time = input;
275        self
276    }
277    /// <p>Timestamp at which the resource was created.</p>
278    pub fn get_created_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
279        &self.created_time
280    }
281    /// <p>Timestamp at which the resource was created or last modified.</p>
282    pub fn last_modified_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
283        self.last_modified_time = ::std::option::Option::Some(input);
284        self
285    }
286    /// <p>Timestamp at which the resource was created or last modified.</p>
287    pub fn set_last_modified_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
288        self.last_modified_time = input;
289        self
290    }
291    /// <p>Timestamp at which the resource was created or last modified.</p>
292    pub fn get_last_modified_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
293        &self.last_modified_time
294    }
295    /// Appends an item to `rules`.
296    ///
297    /// To override the contents of this collection use [`set_rules`](Self::set_rules).
298    ///
299    /// <p>A list of case rules (also known as <a href="https://docs.aws.amazon.com/connect/latest/adminguide/case-field-conditions.html">case field conditions</a>) on a template.</p>
300    pub fn rules(mut self, input: crate::types::TemplateRule) -> Self {
301        let mut v = self.rules.unwrap_or_default();
302        v.push(input);
303        self.rules = ::std::option::Option::Some(v);
304        self
305    }
306    /// <p>A list of case rules (also known as <a href="https://docs.aws.amazon.com/connect/latest/adminguide/case-field-conditions.html">case field conditions</a>) on a template.</p>
307    pub fn set_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>>) -> Self {
308        self.rules = input;
309        self
310    }
311    /// <p>A list of case rules (also known as <a href="https://docs.aws.amazon.com/connect/latest/adminguide/case-field-conditions.html">case field conditions</a>) on a template.</p>
312    pub fn get_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>> {
313        &self.rules
314    }
315    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
316        self._request_id = Some(request_id.into());
317        self
318    }
319
320    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
321        self._request_id = request_id;
322        self
323    }
324    /// Consumes the builder and constructs a [`GetTemplateOutput`](crate::operation::get_template::GetTemplateOutput).
325    /// This method will fail if any of the following fields are not set:
326    /// - [`template_id`](crate::operation::get_template::builders::GetTemplateOutputBuilder::template_id)
327    /// - [`template_arn`](crate::operation::get_template::builders::GetTemplateOutputBuilder::template_arn)
328    /// - [`name`](crate::operation::get_template::builders::GetTemplateOutputBuilder::name)
329    /// - [`status`](crate::operation::get_template::builders::GetTemplateOutputBuilder::status)
330    pub fn build(self) -> ::std::result::Result<crate::operation::get_template::GetTemplateOutput, ::aws_smithy_types::error::operation::BuildError> {
331        ::std::result::Result::Ok(crate::operation::get_template::GetTemplateOutput {
332            template_id: self.template_id.ok_or_else(|| {
333                ::aws_smithy_types::error::operation::BuildError::missing_field(
334                    "template_id",
335                    "template_id was not specified but it is required when building GetTemplateOutput",
336                )
337            })?,
338            template_arn: self.template_arn.ok_or_else(|| {
339                ::aws_smithy_types::error::operation::BuildError::missing_field(
340                    "template_arn",
341                    "template_arn was not specified but it is required when building GetTemplateOutput",
342                )
343            })?,
344            name: self.name.ok_or_else(|| {
345                ::aws_smithy_types::error::operation::BuildError::missing_field(
346                    "name",
347                    "name was not specified but it is required when building GetTemplateOutput",
348                )
349            })?,
350            description: self.description,
351            layout_configuration: self.layout_configuration,
352            required_fields: self.required_fields,
353            tags: self.tags,
354            status: self.status.ok_or_else(|| {
355                ::aws_smithy_types::error::operation::BuildError::missing_field(
356                    "status",
357                    "status was not specified but it is required when building GetTemplateOutput",
358                )
359            })?,
360            deleted: self.deleted.unwrap_or_default(),
361            created_time: self.created_time,
362            last_modified_time: self.last_modified_time,
363            rules: self.rules,
364            _request_id: self._request_id,
365        })
366    }
367}