aws_sdk_connectcases/operation/create_case/
_create_case_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 CreateCaseInput {
6    /// <p>The unique identifier of the Cases domain.</p>
7    pub domain_id: ::std::option::Option<::std::string::String>,
8    /// <p>A unique identifier of a template.</p>
9    pub template_id: ::std::option::Option<::std::string::String>,
10    /// <p>An array of objects with field ID (matching ListFields/DescribeField) and value union data.</p>
11    pub fields: ::std::option::Option<::std::vec::Vec<crate::types::FieldValue>>,
12    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
13    pub client_token: ::std::option::Option<::std::string::String>,
14    /// <p>Represents the entity that performed the action.</p>
15    pub performed_by: ::std::option::Option<crate::types::UserUnion>,
16}
17impl CreateCaseInput {
18    /// <p>The unique identifier of the Cases domain.</p>
19    pub fn domain_id(&self) -> ::std::option::Option<&str> {
20        self.domain_id.as_deref()
21    }
22    /// <p>A unique identifier of a template.</p>
23    pub fn template_id(&self) -> ::std::option::Option<&str> {
24        self.template_id.as_deref()
25    }
26    /// <p>An array of objects with field ID (matching ListFields/DescribeField) and value union data.</p>
27    ///
28    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.fields.is_none()`.
29    pub fn fields(&self) -> &[crate::types::FieldValue] {
30        self.fields.as_deref().unwrap_or_default()
31    }
32    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
33    pub fn client_token(&self) -> ::std::option::Option<&str> {
34        self.client_token.as_deref()
35    }
36    /// <p>Represents the entity that performed the action.</p>
37    pub fn performed_by(&self) -> ::std::option::Option<&crate::types::UserUnion> {
38        self.performed_by.as_ref()
39    }
40}
41impl CreateCaseInput {
42    /// Creates a new builder-style object to manufacture [`CreateCaseInput`](crate::operation::create_case::CreateCaseInput).
43    pub fn builder() -> crate::operation::create_case::builders::CreateCaseInputBuilder {
44        crate::operation::create_case::builders::CreateCaseInputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateCaseInput`](crate::operation::create_case::CreateCaseInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateCaseInputBuilder {
52    pub(crate) domain_id: ::std::option::Option<::std::string::String>,
53    pub(crate) template_id: ::std::option::Option<::std::string::String>,
54    pub(crate) fields: ::std::option::Option<::std::vec::Vec<crate::types::FieldValue>>,
55    pub(crate) client_token: ::std::option::Option<::std::string::String>,
56    pub(crate) performed_by: ::std::option::Option<crate::types::UserUnion>,
57}
58impl CreateCaseInputBuilder {
59    /// <p>The unique identifier of the Cases domain.</p>
60    /// This field is required.
61    pub fn domain_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.domain_id = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The unique identifier of the Cases domain.</p>
66    pub fn set_domain_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.domain_id = input;
68        self
69    }
70    /// <p>The unique identifier of the Cases domain.</p>
71    pub fn get_domain_id(&self) -> &::std::option::Option<::std::string::String> {
72        &self.domain_id
73    }
74    /// <p>A unique identifier of a template.</p>
75    /// This field is required.
76    pub fn template_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.template_id = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>A unique identifier of a template.</p>
81    pub fn set_template_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.template_id = input;
83        self
84    }
85    /// <p>A unique identifier of a template.</p>
86    pub fn get_template_id(&self) -> &::std::option::Option<::std::string::String> {
87        &self.template_id
88    }
89    /// Appends an item to `fields`.
90    ///
91    /// To override the contents of this collection use [`set_fields`](Self::set_fields).
92    ///
93    /// <p>An array of objects with field ID (matching ListFields/DescribeField) and value union data.</p>
94    pub fn fields(mut self, input: crate::types::FieldValue) -> Self {
95        let mut v = self.fields.unwrap_or_default();
96        v.push(input);
97        self.fields = ::std::option::Option::Some(v);
98        self
99    }
100    /// <p>An array of objects with field ID (matching ListFields/DescribeField) and value union data.</p>
101    pub fn set_fields(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FieldValue>>) -> Self {
102        self.fields = input;
103        self
104    }
105    /// <p>An array of objects with field ID (matching ListFields/DescribeField) and value union data.</p>
106    pub fn get_fields(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FieldValue>> {
107        &self.fields
108    }
109    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
110    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.client_token = ::std::option::Option::Some(input.into());
112        self
113    }
114    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
115    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.client_token = input;
117        self
118    }
119    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
120    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
121        &self.client_token
122    }
123    /// <p>Represents the entity that performed the action.</p>
124    pub fn performed_by(mut self, input: crate::types::UserUnion) -> Self {
125        self.performed_by = ::std::option::Option::Some(input);
126        self
127    }
128    /// <p>Represents the entity that performed the action.</p>
129    pub fn set_performed_by(mut self, input: ::std::option::Option<crate::types::UserUnion>) -> Self {
130        self.performed_by = input;
131        self
132    }
133    /// <p>Represents the entity that performed the action.</p>
134    pub fn get_performed_by(&self) -> &::std::option::Option<crate::types::UserUnion> {
135        &self.performed_by
136    }
137    /// Consumes the builder and constructs a [`CreateCaseInput`](crate::operation::create_case::CreateCaseInput).
138    pub fn build(self) -> ::std::result::Result<crate::operation::create_case::CreateCaseInput, ::aws_smithy_types::error::operation::BuildError> {
139        ::std::result::Result::Ok(crate::operation::create_case::CreateCaseInput {
140            domain_id: self.domain_id,
141            template_id: self.template_id,
142            fields: self.fields,
143            client_token: self.client_token,
144            performed_by: self.performed_by,
145        })
146    }
147}