Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lambda-events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,7 @@ streams = []
documentdb = []
eventbridge = ["chrono", "serde_with"]

catch-all-fields = []

[package.metadata.docs.rs]
all-features = true
all-features = true
20 changes: 20 additions & 0 deletions lambda-events/src/event/activemq/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use serde::{Deserialize, Serialize};
#[cfg(feature = "catch-all-fields")]
use serde_json::Value;
use std::collections::HashMap;

use crate::custom_serde::deserialize_lambda_map;
Expand All @@ -11,6 +13,12 @@ pub struct ActiveMqEvent {
#[serde(default)]
pub event_source_arn: Option<String>,
pub messages: Vec<ActiveMqMessage>,
/// Catchall to catch any additional fields that were present but not expected by this struct.
/// Enabled with Cargo feature `catch-all-fields`.
/// If `catch-all-fields` is disabled, any additional fields that are present will be ignored.
#[cfg(feature = "catch-all-fields")]
#[serde(flatten)]
pub other: serde_json::Map<String, Value>,
}

#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
Expand Down Expand Up @@ -41,13 +49,25 @@ pub struct ActiveMqMessage {
#[serde(deserialize_with = "deserialize_lambda_map")]
#[serde(default)]
pub properties: HashMap<String, String>,
/// Catchall to catch any additional fields that were present but not expected by this struct.
/// Enabled with Cargo feature `catch-all-fields`.
/// If `catch-all-fields` is disabled, any additional fields that are present will be ignored.
#[cfg(feature = "catch-all-fields")]
#[serde(flatten)]
pub other: serde_json::Map<String, Value>,
}

#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActiveMqDestination {
#[serde(default)]
pub physical_name: Option<String>,
/// Catchall to catch any additional fields that were present but not expected by this struct.
/// Enabled with Cargo feature `catch-all-fields`.
/// If `catch-all-fields` is disabled, any additional fields that are present will be ignored.
#[cfg(feature = "catch-all-fields")]
#[serde(flatten)]
pub other: serde_json::Map<String, Value>,
}

#[cfg(test)]
Expand Down
26 changes: 26 additions & 0 deletions lambda-events/src/event/alb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use crate::{
use http::{HeaderMap, Method};
use query_map::QueryMap;
use serde::{Deserialize, Serialize};
#[cfg(feature = "catch-all-fields")]
use serde_json::Value;

/// `AlbTargetGroupRequest` contains data originating from the ALB Lambda target group integration
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
Expand All @@ -30,13 +32,25 @@ pub struct AlbTargetGroupRequest {
#[serde(default, deserialize_with = "deserialize_nullish_boolean")]
pub is_base64_encoded: bool,
pub body: Option<String>,
/// Catchall to catch any additional fields that were present but not expected by this struct.
/// Enabled with Cargo feature `catch-all-fields`.
/// If `catch-all-fields` is disabled, any additional fields that are present will be ignored.
#[cfg(feature = "catch-all-fields")]
#[serde(flatten)]
pub other: serde_json::Map<String, Value>,
}

/// `AlbTargetGroupRequestContext` contains the information to identify the load balancer invoking the lambda
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AlbTargetGroupRequestContext {
pub elb: ElbContext,
/// Catchall to catch any additional fields that were present but not expected by this struct.
/// Enabled with Cargo feature `catch-all-fields`.
/// If `catch-all-fields` is disabled, any additional fields that are present will be ignored.
#[cfg(feature = "catch-all-fields")]
#[serde(flatten)]
pub other: serde_json::Map<String, Value>,
}

/// `ElbContext` contains the information to identify the ARN invoking the lambda
Expand All @@ -46,6 +60,12 @@ pub struct ElbContext {
/// nolint: stylecheck
#[serde(default)]
pub target_group_arn: Option<String>,
/// Catchall to catch any additional fields that were present but not expected by this struct.
/// Enabled with Cargo feature `catch-all-fields`.
/// If `catch-all-fields` is disabled, any additional fields that are present will be ignored.
#[cfg(feature = "catch-all-fields")]
#[serde(flatten)]
pub other: serde_json::Map<String, Value>,
}

/// `AlbTargetGroupResponse` configures the response to be returned by the ALB Lambda target group for the request
Expand All @@ -65,6 +85,12 @@ pub struct AlbTargetGroupResponse {
pub body: Option<Body>,
#[serde(default, deserialize_with = "deserialize_nullish_boolean")]
pub is_base64_encoded: bool,
/// Catchall to catch any additional fields that were present but not expected by this struct.
/// Enabled with Cargo feature `catch-all-fields`.
/// If `catch-all-fields` is disabled, any additional fields that are present will be ignored.
#[cfg(feature = "catch-all-fields")]
#[serde(flatten)]
pub other: serde_json::Map<String, Value>,
}

#[cfg(test)]
Expand Down
Loading