Skip to main content

aws_sdk_connect/types/
_task_action_definition.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Information about the task action.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct TaskActionDefinition {
7    /// <p>The name. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
8    pub name: ::std::string::String,
9    /// <p>The description. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
10    pub description: ::std::option::Option<::std::string::String>,
11    /// <p>The identifier of the flow.</p>
12    pub contact_flow_id: ::std::string::String,
13    /// <p>Information about the reference when the <code>referenceType</code> is <code>URL</code>. Otherwise, null. (Supports variable injection in the <code>Value</code> field.)</p>
14    pub references: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Reference>>,
15}
16impl TaskActionDefinition {
17    /// <p>The name. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
18    pub fn name(&self) -> &str {
19        use std::ops::Deref;
20        self.name.deref()
21    }
22    /// <p>The description. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
23    pub fn description(&self) -> ::std::option::Option<&str> {
24        self.description.as_deref()
25    }
26    /// <p>The identifier of the flow.</p>
27    pub fn contact_flow_id(&self) -> &str {
28        use std::ops::Deref;
29        self.contact_flow_id.deref()
30    }
31    /// <p>Information about the reference when the <code>referenceType</code> is <code>URL</code>. Otherwise, null. (Supports variable injection in the <code>Value</code> field.)</p>
32    pub fn references(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::Reference>> {
33        self.references.as_ref()
34    }
35}
36impl TaskActionDefinition {
37    /// Creates a new builder-style object to manufacture [`TaskActionDefinition`](crate::types::TaskActionDefinition).
38    pub fn builder() -> crate::types::builders::TaskActionDefinitionBuilder {
39        crate::types::builders::TaskActionDefinitionBuilder::default()
40    }
41}
42
43/// A builder for [`TaskActionDefinition`](crate::types::TaskActionDefinition).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct TaskActionDefinitionBuilder {
47    pub(crate) name: ::std::option::Option<::std::string::String>,
48    pub(crate) description: ::std::option::Option<::std::string::String>,
49    pub(crate) contact_flow_id: ::std::option::Option<::std::string::String>,
50    pub(crate) references: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Reference>>,
51}
52impl TaskActionDefinitionBuilder {
53    /// <p>The name. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
54    /// This field is required.
55    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.name = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The name. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
60    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.name = input;
62        self
63    }
64    /// <p>The name. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
65    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
66        &self.name
67    }
68    /// <p>The description. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
69    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.description = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// <p>The description. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
74    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75        self.description = input;
76        self
77    }
78    /// <p>The description. Supports variable injection. For more information, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens-variable-injection.html">JSONPath reference</a> in the <i>Amazon Connect Administrators Guide</i>.</p>
79    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
80        &self.description
81    }
82    /// <p>The identifier of the flow.</p>
83    /// This field is required.
84    pub fn contact_flow_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85        self.contact_flow_id = ::std::option::Option::Some(input.into());
86        self
87    }
88    /// <p>The identifier of the flow.</p>
89    pub fn set_contact_flow_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90        self.contact_flow_id = input;
91        self
92    }
93    /// <p>The identifier of the flow.</p>
94    pub fn get_contact_flow_id(&self) -> &::std::option::Option<::std::string::String> {
95        &self.contact_flow_id
96    }
97    /// Adds a key-value pair to `references`.
98    ///
99    /// To override the contents of this collection use [`set_references`](Self::set_references).
100    ///
101    /// <p>Information about the reference when the <code>referenceType</code> is <code>URL</code>. Otherwise, null. (Supports variable injection in the <code>Value</code> field.)</p>
102    pub fn references(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::Reference) -> Self {
103        let mut hash_map = self.references.unwrap_or_default();
104        hash_map.insert(k.into(), v);
105        self.references = ::std::option::Option::Some(hash_map);
106        self
107    }
108    /// <p>Information about the reference when the <code>referenceType</code> is <code>URL</code>. Otherwise, null. (Supports variable injection in the <code>Value</code> field.)</p>
109    pub fn set_references(
110        mut self,
111        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Reference>>,
112    ) -> Self {
113        self.references = input;
114        self
115    }
116    /// <p>Information about the reference when the <code>referenceType</code> is <code>URL</code>. Otherwise, null. (Supports variable injection in the <code>Value</code> field.)</p>
117    pub fn get_references(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::Reference>> {
118        &self.references
119    }
120    /// Consumes the builder and constructs a [`TaskActionDefinition`](crate::types::TaskActionDefinition).
121    /// This method will fail if any of the following fields are not set:
122    /// - [`name`](crate::types::builders::TaskActionDefinitionBuilder::name)
123    /// - [`contact_flow_id`](crate::types::builders::TaskActionDefinitionBuilder::contact_flow_id)
124    pub fn build(self) -> ::std::result::Result<crate::types::TaskActionDefinition, ::aws_smithy_types::error::operation::BuildError> {
125        ::std::result::Result::Ok(crate::types::TaskActionDefinition {
126            name: self.name.ok_or_else(|| {
127                ::aws_smithy_types::error::operation::BuildError::missing_field(
128                    "name",
129                    "name was not specified but it is required when building TaskActionDefinition",
130                )
131            })?,
132            description: self.description,
133            contact_flow_id: self.contact_flow_id.ok_or_else(|| {
134                ::aws_smithy_types::error::operation::BuildError::missing_field(
135                    "contact_flow_id",
136                    "contact_flow_id was not specified but it is required when building TaskActionDefinition",
137                )
138            })?,
139            references: self.references,
140        })
141    }
142}