aws_sdk_connectcases/operation/create_template/
_create_template_input.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 CreateTemplateInput {
6    /// <p>The unique identifier of the Cases domain.</p>
7    pub domain_id: ::std::option::Option<::std::string::String>,
8    /// <p>A name for the template. It must be unique per domain.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>A brief description of the template.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>Configuration of layouts associated to the template.</p>
13    pub layout_configuration: ::std::option::Option<crate::types::LayoutConfiguration>,
14    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
15    pub required_fields: ::std::option::Option<::std::vec::Vec<crate::types::RequiredField>>,
16    /// <p>The status of the template.</p>
17    pub status: ::std::option::Option<crate::types::TemplateStatus>,
18    /// <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>
19    pub rules: ::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>>,
20}
21impl CreateTemplateInput {
22    /// <p>The unique identifier of the Cases domain.</p>
23    pub fn domain_id(&self) -> ::std::option::Option<&str> {
24        self.domain_id.as_deref()
25    }
26    /// <p>A name for the template. It must be unique per domain.</p>
27    pub fn name(&self) -> ::std::option::Option<&str> {
28        self.name.as_deref()
29    }
30    /// <p>A brief description of the template.</p>
31    pub fn description(&self) -> ::std::option::Option<&str> {
32        self.description.as_deref()
33    }
34    /// <p>Configuration of layouts associated to the template.</p>
35    pub fn layout_configuration(&self) -> ::std::option::Option<&crate::types::LayoutConfiguration> {
36        self.layout_configuration.as_ref()
37    }
38    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
39    ///
40    /// 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()`.
41    pub fn required_fields(&self) -> &[crate::types::RequiredField] {
42        self.required_fields.as_deref().unwrap_or_default()
43    }
44    /// <p>The status of the template.</p>
45    pub fn status(&self) -> ::std::option::Option<&crate::types::TemplateStatus> {
46        self.status.as_ref()
47    }
48    /// <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>
49    ///
50    /// 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()`.
51    pub fn rules(&self) -> &[crate::types::TemplateRule] {
52        self.rules.as_deref().unwrap_or_default()
53    }
54}
55impl CreateTemplateInput {
56    /// Creates a new builder-style object to manufacture [`CreateTemplateInput`](crate::operation::create_template::CreateTemplateInput).
57    pub fn builder() -> crate::operation::create_template::builders::CreateTemplateInputBuilder {
58        crate::operation::create_template::builders::CreateTemplateInputBuilder::default()
59    }
60}
61
62/// A builder for [`CreateTemplateInput`](crate::operation::create_template::CreateTemplateInput).
63#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
64#[non_exhaustive]
65pub struct CreateTemplateInputBuilder {
66    pub(crate) domain_id: ::std::option::Option<::std::string::String>,
67    pub(crate) name: ::std::option::Option<::std::string::String>,
68    pub(crate) description: ::std::option::Option<::std::string::String>,
69    pub(crate) layout_configuration: ::std::option::Option<crate::types::LayoutConfiguration>,
70    pub(crate) required_fields: ::std::option::Option<::std::vec::Vec<crate::types::RequiredField>>,
71    pub(crate) status: ::std::option::Option<crate::types::TemplateStatus>,
72    pub(crate) rules: ::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>>,
73}
74impl CreateTemplateInputBuilder {
75    /// <p>The unique identifier of the Cases domain.</p>
76    /// This field is required.
77    pub fn domain_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.domain_id = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <p>The unique identifier of the Cases domain.</p>
82    pub fn set_domain_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.domain_id = input;
84        self
85    }
86    /// <p>The unique identifier of the Cases domain.</p>
87    pub fn get_domain_id(&self) -> &::std::option::Option<::std::string::String> {
88        &self.domain_id
89    }
90    /// <p>A name for the template. It must be unique per domain.</p>
91    /// This field is required.
92    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93        self.name = ::std::option::Option::Some(input.into());
94        self
95    }
96    /// <p>A name for the template. It must be unique per domain.</p>
97    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98        self.name = input;
99        self
100    }
101    /// <p>A name for the template. It must be unique per domain.</p>
102    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
103        &self.name
104    }
105    /// <p>A brief description of the template.</p>
106    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        self.description = ::std::option::Option::Some(input.into());
108        self
109    }
110    /// <p>A brief description of the template.</p>
111    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.description = input;
113        self
114    }
115    /// <p>A brief description of the template.</p>
116    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
117        &self.description
118    }
119    /// <p>Configuration of layouts associated to the template.</p>
120    pub fn layout_configuration(mut self, input: crate::types::LayoutConfiguration) -> Self {
121        self.layout_configuration = ::std::option::Option::Some(input);
122        self
123    }
124    /// <p>Configuration of layouts associated to the template.</p>
125    pub fn set_layout_configuration(mut self, input: ::std::option::Option<crate::types::LayoutConfiguration>) -> Self {
126        self.layout_configuration = input;
127        self
128    }
129    /// <p>Configuration of layouts associated to the template.</p>
130    pub fn get_layout_configuration(&self) -> &::std::option::Option<crate::types::LayoutConfiguration> {
131        &self.layout_configuration
132    }
133    /// Appends an item to `required_fields`.
134    ///
135    /// To override the contents of this collection use [`set_required_fields`](Self::set_required_fields).
136    ///
137    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
138    pub fn required_fields(mut self, input: crate::types::RequiredField) -> Self {
139        let mut v = self.required_fields.unwrap_or_default();
140        v.push(input);
141        self.required_fields = ::std::option::Option::Some(v);
142        self
143    }
144    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
145    pub fn set_required_fields(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RequiredField>>) -> Self {
146        self.required_fields = input;
147        self
148    }
149    /// <p>A list of fields that must contain a value for a case to be successfully created with this template.</p>
150    pub fn get_required_fields(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RequiredField>> {
151        &self.required_fields
152    }
153    /// <p>The status of the template.</p>
154    pub fn status(mut self, input: crate::types::TemplateStatus) -> Self {
155        self.status = ::std::option::Option::Some(input);
156        self
157    }
158    /// <p>The status of the template.</p>
159    pub fn set_status(mut self, input: ::std::option::Option<crate::types::TemplateStatus>) -> Self {
160        self.status = input;
161        self
162    }
163    /// <p>The status of the template.</p>
164    pub fn get_status(&self) -> &::std::option::Option<crate::types::TemplateStatus> {
165        &self.status
166    }
167    /// Appends an item to `rules`.
168    ///
169    /// To override the contents of this collection use [`set_rules`](Self::set_rules).
170    ///
171    /// <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>
172    pub fn rules(mut self, input: crate::types::TemplateRule) -> Self {
173        let mut v = self.rules.unwrap_or_default();
174        v.push(input);
175        self.rules = ::std::option::Option::Some(v);
176        self
177    }
178    /// <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>
179    pub fn set_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>>) -> Self {
180        self.rules = input;
181        self
182    }
183    /// <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>
184    pub fn get_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TemplateRule>> {
185        &self.rules
186    }
187    /// Consumes the builder and constructs a [`CreateTemplateInput`](crate::operation::create_template::CreateTemplateInput).
188    pub fn build(
189        self,
190    ) -> ::std::result::Result<crate::operation::create_template::CreateTemplateInput, ::aws_smithy_types::error::operation::BuildError> {
191        ::std::result::Result::Ok(crate::operation::create_template::CreateTemplateInput {
192            domain_id: self.domain_id,
193            name: self.name,
194            description: self.description,
195            layout_configuration: self.layout_configuration,
196            required_fields: self.required_fields,
197            status: self.status,
198            rules: self.rules,
199        })
200    }
201}