aws_sdk_glue/operation/create_trigger/
_create_trigger_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 CreateTriggerInput {
6    /// <p>The name of the trigger.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the workflow associated with the trigger.</p>
9    pub workflow_name: ::std::option::Option<::std::string::String>,
10    /// <p>The type of the new trigger.</p>
11    pub r#type: ::std::option::Option<crate::types::TriggerType>,
12    /// <p>A <code>cron</code> expression used to specify the schedule (see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html">Time-Based Schedules for Jobs and Crawlers</a>. For example, to run something every day at 12:15 UTC, you would specify: <code>cron(15 12 * * ? *)</code>.</p>
13    /// <p>This field is required when the trigger type is SCHEDULED.</p>
14    pub schedule: ::std::option::Option<::std::string::String>,
15    /// <p>A predicate to specify when the new trigger should fire.</p>
16    /// <p>This field is required when the trigger type is <code>CONDITIONAL</code>.</p>
17    pub predicate: ::std::option::Option<crate::types::Predicate>,
18    /// <p>The actions initiated by this trigger when it fires.</p>
19    pub actions: ::std::option::Option<::std::vec::Vec<crate::types::Action>>,
20    /// <p>A description of the new trigger.</p>
21    pub description: ::std::option::Option<::std::string::String>,
22    /// <p>Set to <code>true</code> to start <code>SCHEDULED</code> and <code>CONDITIONAL</code> triggers when created. True is not supported for <code>ON_DEMAND</code> triggers.</p>
23    pub start_on_creation: ::std::option::Option<bool>,
24    /// <p>The tags to use with this trigger. You may use tags to limit access to the trigger. For more information about tags in Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">Amazon Web Services Tags in Glue</a> in the developer guide.</p>
25    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
26    /// <p>Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires.</p>
27    pub event_batching_condition: ::std::option::Option<crate::types::EventBatchingCondition>,
28}
29impl CreateTriggerInput {
30    /// <p>The name of the trigger.</p>
31    pub fn name(&self) -> ::std::option::Option<&str> {
32        self.name.as_deref()
33    }
34    /// <p>The name of the workflow associated with the trigger.</p>
35    pub fn workflow_name(&self) -> ::std::option::Option<&str> {
36        self.workflow_name.as_deref()
37    }
38    /// <p>The type of the new trigger.</p>
39    pub fn r#type(&self) -> ::std::option::Option<&crate::types::TriggerType> {
40        self.r#type.as_ref()
41    }
42    /// <p>A <code>cron</code> expression used to specify the schedule (see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html">Time-Based Schedules for Jobs and Crawlers</a>. For example, to run something every day at 12:15 UTC, you would specify: <code>cron(15 12 * * ? *)</code>.</p>
43    /// <p>This field is required when the trigger type is SCHEDULED.</p>
44    pub fn schedule(&self) -> ::std::option::Option<&str> {
45        self.schedule.as_deref()
46    }
47    /// <p>A predicate to specify when the new trigger should fire.</p>
48    /// <p>This field is required when the trigger type is <code>CONDITIONAL</code>.</p>
49    pub fn predicate(&self) -> ::std::option::Option<&crate::types::Predicate> {
50        self.predicate.as_ref()
51    }
52    /// <p>The actions initiated by this trigger when it fires.</p>
53    ///
54    /// 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()`.
55    pub fn actions(&self) -> &[crate::types::Action] {
56        self.actions.as_deref().unwrap_or_default()
57    }
58    /// <p>A description of the new trigger.</p>
59    pub fn description(&self) -> ::std::option::Option<&str> {
60        self.description.as_deref()
61    }
62    /// <p>Set to <code>true</code> to start <code>SCHEDULED</code> and <code>CONDITIONAL</code> triggers when created. True is not supported for <code>ON_DEMAND</code> triggers.</p>
63    pub fn start_on_creation(&self) -> ::std::option::Option<bool> {
64        self.start_on_creation
65    }
66    /// <p>The tags to use with this trigger. You may use tags to limit access to the trigger. For more information about tags in Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">Amazon Web Services Tags in Glue</a> in the developer guide.</p>
67    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
68        self.tags.as_ref()
69    }
70    /// <p>Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires.</p>
71    pub fn event_batching_condition(&self) -> ::std::option::Option<&crate::types::EventBatchingCondition> {
72        self.event_batching_condition.as_ref()
73    }
74}
75impl CreateTriggerInput {
76    /// Creates a new builder-style object to manufacture [`CreateTriggerInput`](crate::operation::create_trigger::CreateTriggerInput).
77    pub fn builder() -> crate::operation::create_trigger::builders::CreateTriggerInputBuilder {
78        crate::operation::create_trigger::builders::CreateTriggerInputBuilder::default()
79    }
80}
81
82/// A builder for [`CreateTriggerInput`](crate::operation::create_trigger::CreateTriggerInput).
83#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
84#[non_exhaustive]
85pub struct CreateTriggerInputBuilder {
86    pub(crate) name: ::std::option::Option<::std::string::String>,
87    pub(crate) workflow_name: ::std::option::Option<::std::string::String>,
88    pub(crate) r#type: ::std::option::Option<crate::types::TriggerType>,
89    pub(crate) schedule: ::std::option::Option<::std::string::String>,
90    pub(crate) predicate: ::std::option::Option<crate::types::Predicate>,
91    pub(crate) actions: ::std::option::Option<::std::vec::Vec<crate::types::Action>>,
92    pub(crate) description: ::std::option::Option<::std::string::String>,
93    pub(crate) start_on_creation: ::std::option::Option<bool>,
94    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
95    pub(crate) event_batching_condition: ::std::option::Option<crate::types::EventBatchingCondition>,
96}
97impl CreateTriggerInputBuilder {
98    /// <p>The name of the trigger.</p>
99    /// This field is required.
100    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
101        self.name = ::std::option::Option::Some(input.into());
102        self
103    }
104    /// <p>The name of the trigger.</p>
105    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
106        self.name = input;
107        self
108    }
109    /// <p>The name of the trigger.</p>
110    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
111        &self.name
112    }
113    /// <p>The name of the workflow associated with the trigger.</p>
114    pub fn workflow_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.workflow_name = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The name of the workflow associated with the trigger.</p>
119    pub fn set_workflow_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.workflow_name = input;
121        self
122    }
123    /// <p>The name of the workflow associated with the trigger.</p>
124    pub fn get_workflow_name(&self) -> &::std::option::Option<::std::string::String> {
125        &self.workflow_name
126    }
127    /// <p>The type of the new trigger.</p>
128    /// This field is required.
129    pub fn r#type(mut self, input: crate::types::TriggerType) -> Self {
130        self.r#type = ::std::option::Option::Some(input);
131        self
132    }
133    /// <p>The type of the new trigger.</p>
134    pub fn set_type(mut self, input: ::std::option::Option<crate::types::TriggerType>) -> Self {
135        self.r#type = input;
136        self
137    }
138    /// <p>The type of the new trigger.</p>
139    pub fn get_type(&self) -> &::std::option::Option<crate::types::TriggerType> {
140        &self.r#type
141    }
142    /// <p>A <code>cron</code> expression used to specify the schedule (see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html">Time-Based Schedules for Jobs and Crawlers</a>. For example, to run something every day at 12:15 UTC, you would specify: <code>cron(15 12 * * ? *)</code>.</p>
143    /// <p>This field is required when the trigger type is SCHEDULED.</p>
144    pub fn schedule(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.schedule = ::std::option::Option::Some(input.into());
146        self
147    }
148    /// <p>A <code>cron</code> expression used to specify the schedule (see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html">Time-Based Schedules for Jobs and Crawlers</a>. For example, to run something every day at 12:15 UTC, you would specify: <code>cron(15 12 * * ? *)</code>.</p>
149    /// <p>This field is required when the trigger type is SCHEDULED.</p>
150    pub fn set_schedule(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.schedule = input;
152        self
153    }
154    /// <p>A <code>cron</code> expression used to specify the schedule (see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html">Time-Based Schedules for Jobs and Crawlers</a>. For example, to run something every day at 12:15 UTC, you would specify: <code>cron(15 12 * * ? *)</code>.</p>
155    /// <p>This field is required when the trigger type is SCHEDULED.</p>
156    pub fn get_schedule(&self) -> &::std::option::Option<::std::string::String> {
157        &self.schedule
158    }
159    /// <p>A predicate to specify when the new trigger should fire.</p>
160    /// <p>This field is required when the trigger type is <code>CONDITIONAL</code>.</p>
161    pub fn predicate(mut self, input: crate::types::Predicate) -> Self {
162        self.predicate = ::std::option::Option::Some(input);
163        self
164    }
165    /// <p>A predicate to specify when the new trigger should fire.</p>
166    /// <p>This field is required when the trigger type is <code>CONDITIONAL</code>.</p>
167    pub fn set_predicate(mut self, input: ::std::option::Option<crate::types::Predicate>) -> Self {
168        self.predicate = input;
169        self
170    }
171    /// <p>A predicate to specify when the new trigger should fire.</p>
172    /// <p>This field is required when the trigger type is <code>CONDITIONAL</code>.</p>
173    pub fn get_predicate(&self) -> &::std::option::Option<crate::types::Predicate> {
174        &self.predicate
175    }
176    /// Appends an item to `actions`.
177    ///
178    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
179    ///
180    /// <p>The actions initiated by this trigger when it fires.</p>
181    pub fn actions(mut self, input: crate::types::Action) -> Self {
182        let mut v = self.actions.unwrap_or_default();
183        v.push(input);
184        self.actions = ::std::option::Option::Some(v);
185        self
186    }
187    /// <p>The actions initiated by this trigger when it fires.</p>
188    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Action>>) -> Self {
189        self.actions = input;
190        self
191    }
192    /// <p>The actions initiated by this trigger when it fires.</p>
193    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Action>> {
194        &self.actions
195    }
196    /// <p>A description of the new trigger.</p>
197    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.description = ::std::option::Option::Some(input.into());
199        self
200    }
201    /// <p>A description of the new trigger.</p>
202    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
203        self.description = input;
204        self
205    }
206    /// <p>A description of the new trigger.</p>
207    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
208        &self.description
209    }
210    /// <p>Set to <code>true</code> to start <code>SCHEDULED</code> and <code>CONDITIONAL</code> triggers when created. True is not supported for <code>ON_DEMAND</code> triggers.</p>
211    pub fn start_on_creation(mut self, input: bool) -> Self {
212        self.start_on_creation = ::std::option::Option::Some(input);
213        self
214    }
215    /// <p>Set to <code>true</code> to start <code>SCHEDULED</code> and <code>CONDITIONAL</code> triggers when created. True is not supported for <code>ON_DEMAND</code> triggers.</p>
216    pub fn set_start_on_creation(mut self, input: ::std::option::Option<bool>) -> Self {
217        self.start_on_creation = input;
218        self
219    }
220    /// <p>Set to <code>true</code> to start <code>SCHEDULED</code> and <code>CONDITIONAL</code> triggers when created. True is not supported for <code>ON_DEMAND</code> triggers.</p>
221    pub fn get_start_on_creation(&self) -> &::std::option::Option<bool> {
222        &self.start_on_creation
223    }
224    /// Adds a key-value pair to `tags`.
225    ///
226    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
227    ///
228    /// <p>The tags to use with this trigger. You may use tags to limit access to the trigger. For more information about tags in Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">Amazon Web Services Tags in Glue</a> in the developer guide.</p>
229    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
230        let mut hash_map = self.tags.unwrap_or_default();
231        hash_map.insert(k.into(), v.into());
232        self.tags = ::std::option::Option::Some(hash_map);
233        self
234    }
235    /// <p>The tags to use with this trigger. You may use tags to limit access to the trigger. For more information about tags in Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">Amazon Web Services Tags in Glue</a> in the developer guide.</p>
236    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
237        self.tags = input;
238        self
239    }
240    /// <p>The tags to use with this trigger. You may use tags to limit access to the trigger. For more information about tags in Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">Amazon Web Services Tags in Glue</a> in the developer guide.</p>
241    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
242        &self.tags
243    }
244    /// <p>Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires.</p>
245    pub fn event_batching_condition(mut self, input: crate::types::EventBatchingCondition) -> Self {
246        self.event_batching_condition = ::std::option::Option::Some(input);
247        self
248    }
249    /// <p>Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires.</p>
250    pub fn set_event_batching_condition(mut self, input: ::std::option::Option<crate::types::EventBatchingCondition>) -> Self {
251        self.event_batching_condition = input;
252        self
253    }
254    /// <p>Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires.</p>
255    pub fn get_event_batching_condition(&self) -> &::std::option::Option<crate::types::EventBatchingCondition> {
256        &self.event_batching_condition
257    }
258    /// Consumes the builder and constructs a [`CreateTriggerInput`](crate::operation::create_trigger::CreateTriggerInput).
259    pub fn build(
260        self,
261    ) -> ::std::result::Result<crate::operation::create_trigger::CreateTriggerInput, ::aws_smithy_types::error::operation::BuildError> {
262        ::std::result::Result::Ok(crate::operation::create_trigger::CreateTriggerInput {
263            name: self.name,
264            workflow_name: self.workflow_name,
265            r#type: self.r#type,
266            schedule: self.schedule,
267            predicate: self.predicate,
268            actions: self.actions,
269            description: self.description,
270            start_on_creation: self.start_on_creation,
271            tags: self.tags,
272            event_batching_condition: self.event_batching_condition,
273        })
274    }
275}