aws_sdk_connect/operation/create_rule/
_create_rule_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 CreateRuleInput {
6    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
7    pub instance_id: ::std::option::Option<::std::string::String>,
8    /// <p>A unique name for the rule.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>The event source to trigger the rule.</p>
11    pub trigger_event_source: ::std::option::Option<crate::types::RuleTriggerEventSource>,
12    /// <p>The conditions of the rule.</p>
13    pub function: ::std::option::Option<::std::string::String>,
14    /// <p>A list of actions to be run when the rule is triggered.</p>
15    pub actions: ::std::option::Option<::std::vec::Vec<crate::types::RuleAction>>,
16    /// <p>The publish status of the rule.</p>
17    pub publish_status: ::std::option::Option<crate::types::RulePublishStatus>,
18    /// <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>
19    pub client_token: ::std::option::Option<::std::string::String>,
20}
21impl CreateRuleInput {
22    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
23    pub fn instance_id(&self) -> ::std::option::Option<&str> {
24        self.instance_id.as_deref()
25    }
26    /// <p>A unique name for the rule.</p>
27    pub fn name(&self) -> ::std::option::Option<&str> {
28        self.name.as_deref()
29    }
30    /// <p>The event source to trigger the rule.</p>
31    pub fn trigger_event_source(&self) -> ::std::option::Option<&crate::types::RuleTriggerEventSource> {
32        self.trigger_event_source.as_ref()
33    }
34    /// <p>The conditions of the rule.</p>
35    pub fn function(&self) -> ::std::option::Option<&str> {
36        self.function.as_deref()
37    }
38    /// <p>A list of actions to be run when the rule is triggered.</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 `.actions.is_none()`.
41    pub fn actions(&self) -> &[crate::types::RuleAction] {
42        self.actions.as_deref().unwrap_or_default()
43    }
44    /// <p>The publish status of the rule.</p>
45    pub fn publish_status(&self) -> ::std::option::Option<&crate::types::RulePublishStatus> {
46        self.publish_status.as_ref()
47    }
48    /// <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>
49    pub fn client_token(&self) -> ::std::option::Option<&str> {
50        self.client_token.as_deref()
51    }
52}
53impl CreateRuleInput {
54    /// Creates a new builder-style object to manufacture [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
55    pub fn builder() -> crate::operation::create_rule::builders::CreateRuleInputBuilder {
56        crate::operation::create_rule::builders::CreateRuleInputBuilder::default()
57    }
58}
59
60/// A builder for [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct CreateRuleInputBuilder {
64    pub(crate) instance_id: ::std::option::Option<::std::string::String>,
65    pub(crate) name: ::std::option::Option<::std::string::String>,
66    pub(crate) trigger_event_source: ::std::option::Option<crate::types::RuleTriggerEventSource>,
67    pub(crate) function: ::std::option::Option<::std::string::String>,
68    pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::RuleAction>>,
69    pub(crate) publish_status: ::std::option::Option<crate::types::RulePublishStatus>,
70    pub(crate) client_token: ::std::option::Option<::std::string::String>,
71}
72impl CreateRuleInputBuilder {
73    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
74    /// This field is required.
75    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.instance_id = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
80    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.instance_id = input;
82        self
83    }
84    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
85    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
86        &self.instance_id
87    }
88    /// <p>A unique name for the rule.</p>
89    /// This field is required.
90    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.name = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>A unique name for the rule.</p>
95    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.name = input;
97        self
98    }
99    /// <p>A unique name for the rule.</p>
100    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
101        &self.name
102    }
103    /// <p>The event source to trigger the rule.</p>
104    /// This field is required.
105    pub fn trigger_event_source(mut self, input: crate::types::RuleTriggerEventSource) -> Self {
106        self.trigger_event_source = ::std::option::Option::Some(input);
107        self
108    }
109    /// <p>The event source to trigger the rule.</p>
110    pub fn set_trigger_event_source(mut self, input: ::std::option::Option<crate::types::RuleTriggerEventSource>) -> Self {
111        self.trigger_event_source = input;
112        self
113    }
114    /// <p>The event source to trigger the rule.</p>
115    pub fn get_trigger_event_source(&self) -> &::std::option::Option<crate::types::RuleTriggerEventSource> {
116        &self.trigger_event_source
117    }
118    /// <p>The conditions of the rule.</p>
119    /// This field is required.
120    pub fn function(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.function = ::std::option::Option::Some(input.into());
122        self
123    }
124    /// <p>The conditions of the rule.</p>
125    pub fn set_function(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.function = input;
127        self
128    }
129    /// <p>The conditions of the rule.</p>
130    pub fn get_function(&self) -> &::std::option::Option<::std::string::String> {
131        &self.function
132    }
133    /// Appends an item to `actions`.
134    ///
135    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
136    ///
137    /// <p>A list of actions to be run when the rule is triggered.</p>
138    pub fn actions(mut self, input: crate::types::RuleAction) -> Self {
139        let mut v = self.actions.unwrap_or_default();
140        v.push(input);
141        self.actions = ::std::option::Option::Some(v);
142        self
143    }
144    /// <p>A list of actions to be run when the rule is triggered.</p>
145    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleAction>>) -> Self {
146        self.actions = input;
147        self
148    }
149    /// <p>A list of actions to be run when the rule is triggered.</p>
150    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleAction>> {
151        &self.actions
152    }
153    /// <p>The publish status of the rule.</p>
154    /// This field is required.
155    pub fn publish_status(mut self, input: crate::types::RulePublishStatus) -> Self {
156        self.publish_status = ::std::option::Option::Some(input);
157        self
158    }
159    /// <p>The publish status of the rule.</p>
160    pub fn set_publish_status(mut self, input: ::std::option::Option<crate::types::RulePublishStatus>) -> Self {
161        self.publish_status = input;
162        self
163    }
164    /// <p>The publish status of the rule.</p>
165    pub fn get_publish_status(&self) -> &::std::option::Option<crate::types::RulePublishStatus> {
166        &self.publish_status
167    }
168    /// <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>
169    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170        self.client_token = ::std::option::Option::Some(input.into());
171        self
172    }
173    /// <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>
174    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175        self.client_token = input;
176        self
177    }
178    /// <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>
179    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
180        &self.client_token
181    }
182    /// Consumes the builder and constructs a [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
183    pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
184        ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleInput {
185            instance_id: self.instance_id,
186            name: self.name,
187            trigger_event_source: self.trigger_event_source,
188            function: self.function,
189            actions: self.actions,
190            publish_status: self.publish_status,
191            client_token: self.client_token,
192        })
193    }
194}