47 lines
1.3 KiB
Rust
47 lines
1.3 KiB
Rust
//! Amazon EventBridge event types
|
|
//!
|
|
//! These data structures are sent by [Amazon EventBridge][0], encapsulated in
|
|
//! SNS notification messages.
|
|
//!
|
|
//! [0]: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is.html
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// EC2 Instance State-change Notification
|
|
///
|
|
/// EventBridge event emitted when an EC2 instance changes state
|
|
#[derive(Deserialize, Serialize)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub struct Ec2InstanceStateChange {
|
|
pub instance_id: String,
|
|
pub state: String,
|
|
}
|
|
|
|
/// Enumeration of EventBridge detail objects
|
|
///
|
|
/// EventBridge events sent by AWS services include a `detail` property, the
|
|
/// contents of which vary depending on the `detail-type` field.
|
|
#[derive(Deserialize, Serialize)]
|
|
#[serde(untagged)]
|
|
pub enum EventDetail {
|
|
Ec2InstanceStateChange(Ec2InstanceStateChange),
|
|
}
|
|
|
|
/// EventBridge event
|
|
///
|
|
/// See also: [Amazon EventBridge events][0]
|
|
///
|
|
/// [0]: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html
|
|
#[derive(Deserialize, Serialize)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub struct Event {
|
|
pub version: String,
|
|
pub id: String,
|
|
pub detail_type: String,
|
|
pub source: String,
|
|
pub account: String,
|
|
pub time: String,
|
|
pub region: String,
|
|
pub resources: Vec<String>,
|
|
pub detail: EventDetail,
|
|
}
|