Skip to main content

rustack_events_model/
input.rs

1//! EventBridge input types for Phase 0 through Phase 3 operations.
2//!
3//! All input structs use `PascalCase` JSON field naming to match the EventBridge
4//! wire protocol (`awsJson1_1`). Optional fields are omitted when `None`.
5
6use serde::{Deserialize, Serialize};
7use serde_json::Value;
8
9use crate::types::{Condition, DeadLetterConfig, Tag, Target};
10
11// ===========================================================================
12// Phase 0
13// ===========================================================================
14
15// ---------------------------------------------------------------------------
16// CreateEventBus
17// ---------------------------------------------------------------------------
18
19/// Input for the `CreateEventBus` operation.
20#[derive(Debug, Clone, Default, Serialize, Deserialize)]
21#[serde(rename_all = "PascalCase")]
22pub struct CreateEventBusInput {
23    /// The name of the new event bus.
24    pub name: String,
25
26    /// A description of the event bus.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub description: Option<String>,
29
30    /// Tags to associate with the event bus.
31    #[serde(default, skip_serializing_if = "Vec::is_empty")]
32    pub tags: Vec<Tag>,
33
34    /// The name of the partner event source to associate with the event bus.
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub event_source_name: Option<String>,
37
38    /// Dead-letter queue configuration.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub dead_letter_config: Option<DeadLetterConfig>,
41
42    /// The KMS key identifier for encryption.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub kms_key_identifier: Option<String>,
45}
46
47// ---------------------------------------------------------------------------
48// DeleteEventBus
49// ---------------------------------------------------------------------------
50
51/// Input for the `DeleteEventBus` operation.
52#[derive(Debug, Clone, Default, Serialize, Deserialize)]
53#[serde(rename_all = "PascalCase")]
54pub struct DeleteEventBusInput {
55    /// The name of the event bus to delete.
56    pub name: String,
57}
58
59// ---------------------------------------------------------------------------
60// DescribeEventBus
61// ---------------------------------------------------------------------------
62
63/// Input for the `DescribeEventBus` operation.
64#[derive(Debug, Clone, Default, Serialize, Deserialize)]
65#[serde(rename_all = "PascalCase")]
66pub struct DescribeEventBusInput {
67    /// The name of the event bus to describe. Defaults to the default event bus.
68    #[serde(skip_serializing_if = "Option::is_none")]
69    pub name: Option<String>,
70}
71
72// ---------------------------------------------------------------------------
73// ListEventBuses
74// ---------------------------------------------------------------------------
75
76/// Input for the `ListEventBuses` operation.
77#[derive(Debug, Clone, Default, Serialize, Deserialize)]
78#[serde(rename_all = "PascalCase")]
79pub struct ListEventBusesInput {
80    /// Prefix to filter event bus names.
81    #[serde(skip_serializing_if = "Option::is_none")]
82    pub name_prefix: Option<String>,
83
84    /// The token for the next set of results.
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub next_token: Option<String>,
87
88    /// The maximum number of results to return.
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub limit: Option<i32>,
91}
92
93// ---------------------------------------------------------------------------
94// PutRule
95// ---------------------------------------------------------------------------
96
97/// Input for the `PutRule` operation.
98#[derive(Debug, Clone, Default, Serialize, Deserialize)]
99#[serde(rename_all = "PascalCase")]
100pub struct PutRuleInput {
101    /// The name of the rule.
102    pub name: String,
103
104    /// The event pattern in JSON format.
105    #[serde(skip_serializing_if = "Option::is_none")]
106    pub event_pattern: Option<String>,
107
108    /// The schedule expression (e.g., `"rate(5 minutes)"`).
109    #[serde(skip_serializing_if = "Option::is_none")]
110    pub schedule_expression: Option<String>,
111
112    /// The state of the rule (`ENABLED` or `DISABLED`).
113    #[serde(skip_serializing_if = "Option::is_none")]
114    pub state: Option<String>,
115
116    /// A description of the rule.
117    #[serde(skip_serializing_if = "Option::is_none")]
118    pub description: Option<String>,
119
120    /// The IAM role ARN associated with the rule.
121    #[serde(skip_serializing_if = "Option::is_none")]
122    pub role_arn: Option<String>,
123
124    /// Tags to associate with the rule.
125    #[serde(default, skip_serializing_if = "Vec::is_empty")]
126    pub tags: Vec<Tag>,
127
128    /// The name of the event bus to associate with the rule.
129    #[serde(skip_serializing_if = "Option::is_none")]
130    pub event_bus_name: Option<String>,
131}
132
133// ---------------------------------------------------------------------------
134// DeleteRule
135// ---------------------------------------------------------------------------
136
137/// Input for the `DeleteRule` operation.
138#[derive(Debug, Clone, Default, Serialize, Deserialize)]
139#[serde(rename_all = "PascalCase")]
140pub struct DeleteRuleInput {
141    /// The name of the rule to delete.
142    pub name: String,
143
144    /// The name of the event bus associated with the rule.
145    #[serde(skip_serializing_if = "Option::is_none")]
146    pub event_bus_name: Option<String>,
147
148    /// Whether to force-delete a managed rule.
149    #[serde(skip_serializing_if = "Option::is_none")]
150    pub force: Option<bool>,
151}
152
153// ---------------------------------------------------------------------------
154// DescribeRule
155// ---------------------------------------------------------------------------
156
157/// Input for the `DescribeRule` operation.
158#[derive(Debug, Clone, Default, Serialize, Deserialize)]
159#[serde(rename_all = "PascalCase")]
160pub struct DescribeRuleInput {
161    /// The name of the rule to describe.
162    pub name: String,
163
164    /// The name of the event bus associated with the rule.
165    #[serde(skip_serializing_if = "Option::is_none")]
166    pub event_bus_name: Option<String>,
167}
168
169// ---------------------------------------------------------------------------
170// ListRules
171// ---------------------------------------------------------------------------
172
173/// Input for the `ListRules` operation.
174#[derive(Debug, Clone, Default, Serialize, Deserialize)]
175#[serde(rename_all = "PascalCase")]
176pub struct ListRulesInput {
177    /// Prefix to filter rule names.
178    #[serde(skip_serializing_if = "Option::is_none")]
179    pub name_prefix: Option<String>,
180
181    /// The name of the event bus associated with the rules.
182    #[serde(skip_serializing_if = "Option::is_none")]
183    pub event_bus_name: Option<String>,
184
185    /// The token for the next set of results.
186    #[serde(skip_serializing_if = "Option::is_none")]
187    pub next_token: Option<String>,
188
189    /// The maximum number of results to return.
190    #[serde(skip_serializing_if = "Option::is_none")]
191    pub limit: Option<i32>,
192}
193
194// ---------------------------------------------------------------------------
195// EnableRule
196// ---------------------------------------------------------------------------
197
198/// Input for the `EnableRule` operation.
199#[derive(Debug, Clone, Default, Serialize, Deserialize)]
200#[serde(rename_all = "PascalCase")]
201pub struct EnableRuleInput {
202    /// The name of the rule to enable.
203    pub name: String,
204
205    /// The name of the event bus associated with the rule.
206    #[serde(skip_serializing_if = "Option::is_none")]
207    pub event_bus_name: Option<String>,
208}
209
210// ---------------------------------------------------------------------------
211// DisableRule
212// ---------------------------------------------------------------------------
213
214/// Input for the `DisableRule` operation.
215#[derive(Debug, Clone, Default, Serialize, Deserialize)]
216#[serde(rename_all = "PascalCase")]
217pub struct DisableRuleInput {
218    /// The name of the rule to disable.
219    pub name: String,
220
221    /// The name of the event bus associated with the rule.
222    #[serde(skip_serializing_if = "Option::is_none")]
223    pub event_bus_name: Option<String>,
224}
225
226// ---------------------------------------------------------------------------
227// PutTargets
228// ---------------------------------------------------------------------------
229
230/// Input for the `PutTargets` operation.
231#[derive(Debug, Clone, Default, Serialize, Deserialize)]
232#[serde(rename_all = "PascalCase")]
233pub struct PutTargetsInput {
234    /// The name of the rule to add targets to.
235    pub rule: String,
236
237    /// The targets to add to the rule.
238    #[serde(default)]
239    pub targets: Vec<Target>,
240
241    /// The name of the event bus associated with the rule.
242    #[serde(skip_serializing_if = "Option::is_none")]
243    pub event_bus_name: Option<String>,
244}
245
246// ---------------------------------------------------------------------------
247// RemoveTargets
248// ---------------------------------------------------------------------------
249
250/// Input for the `RemoveTargets` operation.
251#[derive(Debug, Clone, Default, Serialize, Deserialize)]
252#[serde(rename_all = "PascalCase")]
253pub struct RemoveTargetsInput {
254    /// The name of the rule to remove targets from.
255    pub rule: String,
256
257    /// The IDs of the targets to remove.
258    #[serde(default)]
259    pub ids: Vec<String>,
260
261    /// The name of the event bus associated with the rule.
262    #[serde(skip_serializing_if = "Option::is_none")]
263    pub event_bus_name: Option<String>,
264
265    /// Whether to force-remove targets from a managed rule.
266    #[serde(skip_serializing_if = "Option::is_none")]
267    pub force: Option<bool>,
268}
269
270// ---------------------------------------------------------------------------
271// ListTargetsByRule
272// ---------------------------------------------------------------------------
273
274/// Input for the `ListTargetsByRule` operation.
275#[derive(Debug, Clone, Default, Serialize, Deserialize)]
276#[serde(rename_all = "PascalCase")]
277pub struct ListTargetsByRuleInput {
278    /// The name of the rule whose targets to list.
279    pub rule: String,
280
281    /// The name of the event bus associated with the rule.
282    #[serde(skip_serializing_if = "Option::is_none")]
283    pub event_bus_name: Option<String>,
284
285    /// The token for the next set of results.
286    #[serde(skip_serializing_if = "Option::is_none")]
287    pub next_token: Option<String>,
288
289    /// The maximum number of results to return.
290    #[serde(skip_serializing_if = "Option::is_none")]
291    pub limit: Option<i32>,
292}
293
294// ---------------------------------------------------------------------------
295// PutEvents
296// ---------------------------------------------------------------------------
297
298/// Input for the `PutEvents` operation.
299#[derive(Debug, Clone, Default, Serialize, Deserialize)]
300#[serde(rename_all = "PascalCase")]
301pub struct PutEventsInput {
302    /// The entries to publish to the event bus.
303    #[serde(default)]
304    pub entries: Vec<PutEventsRequestEntry>,
305
306    /// The URL subdomain of the endpoint.
307    #[serde(skip_serializing_if = "Option::is_none")]
308    pub endpoint_id: Option<String>,
309}
310
311/// An event entry for the `PutEvents` operation.
312#[derive(Debug, Clone, Default, Serialize, Deserialize)]
313#[serde(rename_all = "PascalCase")]
314pub struct PutEventsRequestEntry {
315    /// The source of the event.
316    #[serde(skip_serializing_if = "Option::is_none")]
317    pub source: Option<String>,
318
319    /// The detail type of the event.
320    #[serde(rename = "DetailType", skip_serializing_if = "Option::is_none")]
321    pub detail_type: Option<String>,
322
323    /// The event detail as a JSON string.
324    #[serde(skip_serializing_if = "Option::is_none")]
325    pub detail: Option<String>,
326
327    /// AWS resources involved in the event.
328    #[serde(default, skip_serializing_if = "Vec::is_empty")]
329    pub resources: Vec<String>,
330
331    /// The timestamp of the event.
332    #[serde(skip_serializing_if = "Option::is_none")]
333    pub time: Option<String>,
334
335    /// The event bus to publish the event to.
336    #[serde(skip_serializing_if = "Option::is_none")]
337    pub event_bus_name: Option<String>,
338
339    /// An AWS X-Ray trace header.
340    #[serde(skip_serializing_if = "Option::is_none")]
341    pub trace_header: Option<String>,
342}
343
344// ---------------------------------------------------------------------------
345// TestEventPattern
346// ---------------------------------------------------------------------------
347
348/// Input for the `TestEventPattern` operation.
349#[derive(Debug, Clone, Default, Serialize, Deserialize)]
350#[serde(rename_all = "PascalCase")]
351pub struct TestEventPatternInput {
352    /// The event pattern to test.
353    pub event_pattern: String,
354
355    /// The event to test against the pattern, in JSON format.
356    pub event: String,
357}
358
359// ===========================================================================
360// Phase 1
361// ===========================================================================
362
363// ---------------------------------------------------------------------------
364// TagResource
365// ---------------------------------------------------------------------------
366
367/// Input for the `TagResource` operation.
368#[derive(Debug, Clone, Default, Serialize, Deserialize)]
369#[serde(rename_all = "PascalCase")]
370pub struct TagResourceInput {
371    /// The ARN of the resource to tag.
372    #[serde(rename = "ResourceARN")]
373    pub resource_arn: String,
374
375    /// The tags to associate with the resource.
376    #[serde(default)]
377    pub tags: Vec<Tag>,
378}
379
380// ---------------------------------------------------------------------------
381// UntagResource
382// ---------------------------------------------------------------------------
383
384/// Input for the `UntagResource` operation.
385#[derive(Debug, Clone, Default, Serialize, Deserialize)]
386#[serde(rename_all = "PascalCase")]
387pub struct UntagResourceInput {
388    /// The ARN of the resource to untag.
389    #[serde(rename = "ResourceARN")]
390    pub resource_arn: String,
391
392    /// The tag keys to remove.
393    #[serde(default)]
394    pub tag_keys: Vec<String>,
395}
396
397// ---------------------------------------------------------------------------
398// ListTagsForResource
399// ---------------------------------------------------------------------------
400
401/// Input for the `ListTagsForResource` operation.
402#[derive(Debug, Clone, Default, Serialize, Deserialize)]
403#[serde(rename_all = "PascalCase")]
404pub struct ListTagsForResourceInput {
405    /// The ARN of the resource whose tags to list.
406    #[serde(rename = "ResourceARN")]
407    pub resource_arn: String,
408}
409
410// ---------------------------------------------------------------------------
411// PutPermission
412// ---------------------------------------------------------------------------
413
414/// Input for the `PutPermission` operation.
415#[derive(Debug, Clone, Default, Serialize, Deserialize)]
416#[serde(rename_all = "PascalCase")]
417pub struct PutPermissionInput {
418    /// The name of the event bus to modify.
419    #[serde(skip_serializing_if = "Option::is_none")]
420    pub event_bus_name: Option<String>,
421
422    /// The action to allow (e.g., `events:PutEvents`).
423    #[serde(skip_serializing_if = "Option::is_none")]
424    pub action: Option<String>,
425
426    /// The AWS account ID or `*` for all accounts.
427    #[serde(skip_serializing_if = "Option::is_none")]
428    pub principal: Option<String>,
429
430    /// An identifier for the statement in the policy.
431    #[serde(skip_serializing_if = "Option::is_none")]
432    pub statement_id: Option<String>,
433
434    /// A condition for the permission.
435    #[serde(skip_serializing_if = "Option::is_none")]
436    pub condition: Option<Condition>,
437
438    /// A full JSON policy to set on the event bus.
439    #[serde(skip_serializing_if = "Option::is_none")]
440    pub policy: Option<String>,
441}
442
443// ---------------------------------------------------------------------------
444// RemovePermission
445// ---------------------------------------------------------------------------
446
447/// Input for the `RemovePermission` operation.
448#[derive(Debug, Clone, Default, Serialize, Deserialize)]
449#[serde(rename_all = "PascalCase")]
450pub struct RemovePermissionInput {
451    /// The name of the event bus to modify.
452    #[serde(skip_serializing_if = "Option::is_none")]
453    pub event_bus_name: Option<String>,
454
455    /// The statement ID of the permission to remove.
456    #[serde(skip_serializing_if = "Option::is_none")]
457    pub statement_id: Option<String>,
458
459    /// Whether to remove all permissions from the event bus.
460    #[serde(skip_serializing_if = "Option::is_none")]
461    pub remove_all_permissions: Option<bool>,
462}
463
464// ---------------------------------------------------------------------------
465// ListRuleNamesByTarget
466// ---------------------------------------------------------------------------
467
468/// Input for the `ListRuleNamesByTarget` operation.
469#[derive(Debug, Clone, Default, Serialize, Deserialize)]
470#[serde(rename_all = "PascalCase")]
471pub struct ListRuleNamesByTargetInput {
472    /// The ARN of the target to list rules for.
473    pub target_arn: String,
474
475    /// The name of the event bus associated with the rules.
476    #[serde(skip_serializing_if = "Option::is_none")]
477    pub event_bus_name: Option<String>,
478
479    /// The token for the next set of results.
480    #[serde(skip_serializing_if = "Option::is_none")]
481    pub next_token: Option<String>,
482
483    /// The maximum number of results to return.
484    #[serde(skip_serializing_if = "Option::is_none")]
485    pub limit: Option<i32>,
486}
487
488// ===========================================================================
489// Phase 2
490// ===========================================================================
491
492// ---------------------------------------------------------------------------
493// UpdateEventBus
494// ---------------------------------------------------------------------------
495
496/// Input for the `UpdateEventBus` operation.
497#[derive(Debug, Clone, Default, Serialize, Deserialize)]
498#[serde(rename_all = "PascalCase")]
499pub struct UpdateEventBusInput {
500    /// The name of the event bus to update.
501    #[serde(skip_serializing_if = "Option::is_none")]
502    pub name: Option<String>,
503
504    /// The updated description.
505    #[serde(skip_serializing_if = "Option::is_none")]
506    pub description: Option<String>,
507
508    /// The updated dead-letter queue configuration.
509    #[serde(skip_serializing_if = "Option::is_none")]
510    pub dead_letter_config: Option<DeadLetterConfig>,
511
512    /// The updated KMS key identifier.
513    #[serde(skip_serializing_if = "Option::is_none")]
514    pub kms_key_identifier: Option<String>,
515}
516
517// ===========================================================================
518// Phase 3 (stubs)
519// ===========================================================================
520
521/// Generic input wrapper for stub operations that pass through raw JSON.
522#[derive(Debug, Clone, Default, Serialize, Deserialize)]
523#[serde(transparent)]
524pub struct GenericInput {
525    /// The raw JSON value.
526    pub value: Value,
527}