aws_sdk_eventbridge/operation/put_rule/
_put_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 PutRuleInput {
6    /// <p>The name of the rule that you are creating or updating.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)".</p>
9    pub schedule_expression: ::std::option::Option<::std::string::String>,
10    /// <p>The event pattern. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
11    pub event_pattern: ::std::option::Option<::std::string::String>,
12    /// <p>The state of the rule.</p>
13    /// <p>Valid values include:</p>
14    /// <ul>
15    /// <li>
16    /// <p><code>DISABLED</code>: The rule is disabled. EventBridge does not match any events against the rule.</p></li>
17    /// <li>
18    /// <p><code>ENABLED</code>: The rule is enabled. EventBridge matches events against the rule, <i>except</i> for Amazon Web Services management events delivered through CloudTrail.</p></li>
19    /// <li>
20    /// <p><code>ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS</code>: The rule is enabled for all events, including Amazon Web Services management events delivered through CloudTrail.</p>
21    /// <p>Management events provide visibility into management operations that are performed on resources in your Amazon Web Services account. These are also known as control plane operations. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html#logging-management-events">Logging management events</a> in the <i>CloudTrail User Guide</i>, and <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event.html#eb-service-event-cloudtrail">Filtering management events from Amazon Web Services services</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
22    /// <p>This value is only valid for rules on the <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is-how-it-works-concepts.html#eb-bus-concepts-buses">default</a> event bus or <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-event-bus.html">custom event buses</a>. It does not apply to <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-saas.html">partner event buses</a>.</p></li>
23    /// </ul>
24    pub state: ::std::option::Option<crate::types::RuleState>,
25    /// <p>A description of the rule.</p>
26    pub description: ::std::option::Option<::std::string::String>,
27    /// <p>The Amazon Resource Name (ARN) of the IAM role associated with the rule.</p>
28    /// <p>If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a <code>RoleArn</code> with proper permissions in the <code>Target</code> structure, instead of here in this parameter.</p>
29    pub role_arn: ::std::option::Option<::std::string::String>,
30    /// <p>The list of key-value pairs to associate with the rule.</p>
31    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
32    /// <p>The name or ARN of the event bus to associate with this rule. If you omit this, the default event bus is used.</p>
33    pub event_bus_name: ::std::option::Option<::std::string::String>,
34}
35impl PutRuleInput {
36    /// <p>The name of the rule that you are creating or updating.</p>
37    pub fn name(&self) -> ::std::option::Option<&str> {
38        self.name.as_deref()
39    }
40    /// <p>The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)".</p>
41    pub fn schedule_expression(&self) -> ::std::option::Option<&str> {
42        self.schedule_expression.as_deref()
43    }
44    /// <p>The event pattern. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
45    pub fn event_pattern(&self) -> ::std::option::Option<&str> {
46        self.event_pattern.as_deref()
47    }
48    /// <p>The state of the rule.</p>
49    /// <p>Valid values include:</p>
50    /// <ul>
51    /// <li>
52    /// <p><code>DISABLED</code>: The rule is disabled. EventBridge does not match any events against the rule.</p></li>
53    /// <li>
54    /// <p><code>ENABLED</code>: The rule is enabled. EventBridge matches events against the rule, <i>except</i> for Amazon Web Services management events delivered through CloudTrail.</p></li>
55    /// <li>
56    /// <p><code>ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS</code>: The rule is enabled for all events, including Amazon Web Services management events delivered through CloudTrail.</p>
57    /// <p>Management events provide visibility into management operations that are performed on resources in your Amazon Web Services account. These are also known as control plane operations. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html#logging-management-events">Logging management events</a> in the <i>CloudTrail User Guide</i>, and <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event.html#eb-service-event-cloudtrail">Filtering management events from Amazon Web Services services</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
58    /// <p>This value is only valid for rules on the <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is-how-it-works-concepts.html#eb-bus-concepts-buses">default</a> event bus or <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-event-bus.html">custom event buses</a>. It does not apply to <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-saas.html">partner event buses</a>.</p></li>
59    /// </ul>
60    pub fn state(&self) -> ::std::option::Option<&crate::types::RuleState> {
61        self.state.as_ref()
62    }
63    /// <p>A description of the rule.</p>
64    pub fn description(&self) -> ::std::option::Option<&str> {
65        self.description.as_deref()
66    }
67    /// <p>The Amazon Resource Name (ARN) of the IAM role associated with the rule.</p>
68    /// <p>If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a <code>RoleArn</code> with proper permissions in the <code>Target</code> structure, instead of here in this parameter.</p>
69    pub fn role_arn(&self) -> ::std::option::Option<&str> {
70        self.role_arn.as_deref()
71    }
72    /// <p>The list of key-value pairs to associate with the rule.</p>
73    ///
74    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
75    pub fn tags(&self) -> &[crate::types::Tag] {
76        self.tags.as_deref().unwrap_or_default()
77    }
78    /// <p>The name or ARN of the event bus to associate with this rule. If you omit this, the default event bus is used.</p>
79    pub fn event_bus_name(&self) -> ::std::option::Option<&str> {
80        self.event_bus_name.as_deref()
81    }
82}
83impl PutRuleInput {
84    /// Creates a new builder-style object to manufacture [`PutRuleInput`](crate::operation::put_rule::PutRuleInput).
85    pub fn builder() -> crate::operation::put_rule::builders::PutRuleInputBuilder {
86        crate::operation::put_rule::builders::PutRuleInputBuilder::default()
87    }
88}
89
90/// A builder for [`PutRuleInput`](crate::operation::put_rule::PutRuleInput).
91#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
92#[non_exhaustive]
93pub struct PutRuleInputBuilder {
94    pub(crate) name: ::std::option::Option<::std::string::String>,
95    pub(crate) schedule_expression: ::std::option::Option<::std::string::String>,
96    pub(crate) event_pattern: ::std::option::Option<::std::string::String>,
97    pub(crate) state: ::std::option::Option<crate::types::RuleState>,
98    pub(crate) description: ::std::option::Option<::std::string::String>,
99    pub(crate) role_arn: ::std::option::Option<::std::string::String>,
100    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
101    pub(crate) event_bus_name: ::std::option::Option<::std::string::String>,
102}
103impl PutRuleInputBuilder {
104    /// <p>The name of the rule that you are creating or updating.</p>
105    /// This field is required.
106    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        self.name = ::std::option::Option::Some(input.into());
108        self
109    }
110    /// <p>The name of the rule that you are creating or updating.</p>
111    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.name = input;
113        self
114    }
115    /// <p>The name of the rule that you are creating or updating.</p>
116    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
117        &self.name
118    }
119    /// <p>The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)".</p>
120    pub fn schedule_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.schedule_expression = ::std::option::Option::Some(input.into());
122        self
123    }
124    /// <p>The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)".</p>
125    pub fn set_schedule_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.schedule_expression = input;
127        self
128    }
129    /// <p>The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)".</p>
130    pub fn get_schedule_expression(&self) -> &::std::option::Option<::std::string::String> {
131        &self.schedule_expression
132    }
133    /// <p>The event pattern. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
134    pub fn event_pattern(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.event_pattern = ::std::option::Option::Some(input.into());
136        self
137    }
138    /// <p>The event pattern. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
139    pub fn set_event_pattern(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.event_pattern = input;
141        self
142    }
143    /// <p>The event pattern. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
144    pub fn get_event_pattern(&self) -> &::std::option::Option<::std::string::String> {
145        &self.event_pattern
146    }
147    /// <p>The state of the rule.</p>
148    /// <p>Valid values include:</p>
149    /// <ul>
150    /// <li>
151    /// <p><code>DISABLED</code>: The rule is disabled. EventBridge does not match any events against the rule.</p></li>
152    /// <li>
153    /// <p><code>ENABLED</code>: The rule is enabled. EventBridge matches events against the rule, <i>except</i> for Amazon Web Services management events delivered through CloudTrail.</p></li>
154    /// <li>
155    /// <p><code>ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS</code>: The rule is enabled for all events, including Amazon Web Services management events delivered through CloudTrail.</p>
156    /// <p>Management events provide visibility into management operations that are performed on resources in your Amazon Web Services account. These are also known as control plane operations. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html#logging-management-events">Logging management events</a> in the <i>CloudTrail User Guide</i>, and <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event.html#eb-service-event-cloudtrail">Filtering management events from Amazon Web Services services</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
157    /// <p>This value is only valid for rules on the <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is-how-it-works-concepts.html#eb-bus-concepts-buses">default</a> event bus or <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-event-bus.html">custom event buses</a>. It does not apply to <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-saas.html">partner event buses</a>.</p></li>
158    /// </ul>
159    pub fn state(mut self, input: crate::types::RuleState) -> Self {
160        self.state = ::std::option::Option::Some(input);
161        self
162    }
163    /// <p>The state of the rule.</p>
164    /// <p>Valid values include:</p>
165    /// <ul>
166    /// <li>
167    /// <p><code>DISABLED</code>: The rule is disabled. EventBridge does not match any events against the rule.</p></li>
168    /// <li>
169    /// <p><code>ENABLED</code>: The rule is enabled. EventBridge matches events against the rule, <i>except</i> for Amazon Web Services management events delivered through CloudTrail.</p></li>
170    /// <li>
171    /// <p><code>ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS</code>: The rule is enabled for all events, including Amazon Web Services management events delivered through CloudTrail.</p>
172    /// <p>Management events provide visibility into management operations that are performed on resources in your Amazon Web Services account. These are also known as control plane operations. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html#logging-management-events">Logging management events</a> in the <i>CloudTrail User Guide</i>, and <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event.html#eb-service-event-cloudtrail">Filtering management events from Amazon Web Services services</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
173    /// <p>This value is only valid for rules on the <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is-how-it-works-concepts.html#eb-bus-concepts-buses">default</a> event bus or <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-event-bus.html">custom event buses</a>. It does not apply to <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-saas.html">partner event buses</a>.</p></li>
174    /// </ul>
175    pub fn set_state(mut self, input: ::std::option::Option<crate::types::RuleState>) -> Self {
176        self.state = input;
177        self
178    }
179    /// <p>The state of the rule.</p>
180    /// <p>Valid values include:</p>
181    /// <ul>
182    /// <li>
183    /// <p><code>DISABLED</code>: The rule is disabled. EventBridge does not match any events against the rule.</p></li>
184    /// <li>
185    /// <p><code>ENABLED</code>: The rule is enabled. EventBridge matches events against the rule, <i>except</i> for Amazon Web Services management events delivered through CloudTrail.</p></li>
186    /// <li>
187    /// <p><code>ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS</code>: The rule is enabled for all events, including Amazon Web Services management events delivered through CloudTrail.</p>
188    /// <p>Management events provide visibility into management operations that are performed on resources in your Amazon Web Services account. These are also known as control plane operations. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html#logging-management-events">Logging management events</a> in the <i>CloudTrail User Guide</i>, and <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event.html#eb-service-event-cloudtrail">Filtering management events from Amazon Web Services services</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
189    /// <p>This value is only valid for rules on the <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is-how-it-works-concepts.html#eb-bus-concepts-buses">default</a> event bus or <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-event-bus.html">custom event buses</a>. It does not apply to <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-saas.html">partner event buses</a>.</p></li>
190    /// </ul>
191    pub fn get_state(&self) -> &::std::option::Option<crate::types::RuleState> {
192        &self.state
193    }
194    /// <p>A description of the rule.</p>
195    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
196        self.description = ::std::option::Option::Some(input.into());
197        self
198    }
199    /// <p>A description of the rule.</p>
200    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
201        self.description = input;
202        self
203    }
204    /// <p>A description of the rule.</p>
205    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
206        &self.description
207    }
208    /// <p>The Amazon Resource Name (ARN) of the IAM role associated with the rule.</p>
209    /// <p>If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a <code>RoleArn</code> with proper permissions in the <code>Target</code> structure, instead of here in this parameter.</p>
210    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
211        self.role_arn = ::std::option::Option::Some(input.into());
212        self
213    }
214    /// <p>The Amazon Resource Name (ARN) of the IAM role associated with the rule.</p>
215    /// <p>If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a <code>RoleArn</code> with proper permissions in the <code>Target</code> structure, instead of here in this parameter.</p>
216    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
217        self.role_arn = input;
218        self
219    }
220    /// <p>The Amazon Resource Name (ARN) of the IAM role associated with the rule.</p>
221    /// <p>If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a <code>RoleArn</code> with proper permissions in the <code>Target</code> structure, instead of here in this parameter.</p>
222    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
223        &self.role_arn
224    }
225    /// Appends an item to `tags`.
226    ///
227    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
228    ///
229    /// <p>The list of key-value pairs to associate with the rule.</p>
230    pub fn tags(mut self, input: crate::types::Tag) -> Self {
231        let mut v = self.tags.unwrap_or_default();
232        v.push(input);
233        self.tags = ::std::option::Option::Some(v);
234        self
235    }
236    /// <p>The list of key-value pairs to associate with the rule.</p>
237    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
238        self.tags = input;
239        self
240    }
241    /// <p>The list of key-value pairs to associate with the rule.</p>
242    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
243        &self.tags
244    }
245    /// <p>The name or ARN of the event bus to associate with this rule. If you omit this, the default event bus is used.</p>
246    pub fn event_bus_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
247        self.event_bus_name = ::std::option::Option::Some(input.into());
248        self
249    }
250    /// <p>The name or ARN of the event bus to associate with this rule. If you omit this, the default event bus is used.</p>
251    pub fn set_event_bus_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
252        self.event_bus_name = input;
253        self
254    }
255    /// <p>The name or ARN of the event bus to associate with this rule. If you omit this, the default event bus is used.</p>
256    pub fn get_event_bus_name(&self) -> &::std::option::Option<::std::string::String> {
257        &self.event_bus_name
258    }
259    /// Consumes the builder and constructs a [`PutRuleInput`](crate::operation::put_rule::PutRuleInput).
260    pub fn build(self) -> ::std::result::Result<crate::operation::put_rule::PutRuleInput, ::aws_smithy_types::error::operation::BuildError> {
261        ::std::result::Result::Ok(crate::operation::put_rule::PutRuleInput {
262            name: self.name,
263            schedule_expression: self.schedule_expression,
264            event_pattern: self.event_pattern,
265            state: self.state,
266            description: self.description,
267            role_arn: self.role_arn,
268            tags: self.tags,
269            event_bus_name: self.event_bus_name,
270        })
271    }
272}