Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat(lambda-events): mark public structs/enums as #[non_exhaustive]
  • Loading branch information
Mara Pindaru committed Oct 8, 2025
commit 888c414051645b4f8f654a462e7f8236b8fca920
1 change: 1 addition & 0 deletions lambda-events/src/encodings/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ use std::{borrow::Cow, mem::take, ops::Deref, pin::Pin, task::Poll};
///
/// For more information about API Gateway's body types,
/// refer to [this documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html).
#[non_exhaustive]
#[derive(Debug, Default, Eq, PartialEq)]
pub enum Body {
/// An empty body
Expand Down
1 change: 1 addition & 0 deletions lambda-events/src/encodings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub use self::http::*;
pub type Error = Box<dyn std::error::Error + Send + Sync>;

/// Binary data encoded in base64.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct Base64Data(
#[serde(deserialize_with = "deserialize_base64")]
Expand Down
4 changes: 4 additions & 0 deletions lambda-events/src/encodings/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use serde::{
use std::ops::{Deref, DerefMut};

/// Timestamp with millisecond precision.
#[non_exhaustive]
#[derive(Clone, Default, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct MillisecondTimestamp(
#[serde(deserialize_with = "deserialize_milliseconds")]
Expand All @@ -29,6 +30,7 @@ impl DerefMut for MillisecondTimestamp {
}

/// Timestamp with second precision.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct SecondTimestamp(
#[serde(deserialize_with = "deserialize_seconds")]
Expand All @@ -51,6 +53,7 @@ impl DerefMut for SecondTimestamp {
}

/// Duration with second precision.
#[non_exhaustive]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct SecondDuration(
#[serde(deserialize_with = "deserialize_duration_seconds")]
Expand All @@ -73,6 +76,7 @@ impl DerefMut for SecondDuration {
}

/// Duration with minute precision.
#[non_exhaustive]
#[derive(Clone, Default, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct MinuteDuration(
#[serde(deserialize_with = "deserialize_duration_minutes")]
Expand Down
3 changes: 3 additions & 0 deletions lambda-events/src/event/activemq/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::collections::HashMap;

use crate::custom_serde::deserialize_lambda_map;

#[non_exhaustive]
#[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActiveMqEvent {
Expand All @@ -22,6 +23,7 @@ pub struct ActiveMqEvent {
pub other: serde_json::Map<String, Value>,
}

#[non_exhaustive]
#[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActiveMqMessage {
Expand Down Expand Up @@ -59,6 +61,7 @@ pub struct ActiveMqMessage {
pub other: serde_json::Map<String, Value>,
}

#[non_exhaustive]
#[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActiveMqDestination {
Expand Down
3 changes: 3 additions & 0 deletions lambda-events/src/event/alb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;

/// `AlbTargetGroupRequest` contains data originating from the ALB Lambda target group integration
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AlbTargetGroupRequest {
Expand Down Expand Up @@ -44,6 +45,7 @@ pub struct AlbTargetGroupRequest {
}

/// `AlbTargetGroupRequestContext` contains the information to identify the load balancer invoking the lambda
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AlbTargetGroupRequestContext {
Expand All @@ -58,6 +60,7 @@ pub struct AlbTargetGroupRequestContext {
}

/// `ElbContext` contains the information to identify the ARN invoking the lambda
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ElbContext {
Expand Down
27 changes: 27 additions & 0 deletions lambda-events/src/event/apigw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use serde_json::Value;
use std::collections::HashMap;

/// `ApiGatewayProxyRequest` contains data coming from the API Gateway proxy
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayProxyRequest {
Expand Down Expand Up @@ -82,6 +83,7 @@ pub struct ApiGatewayProxyResponse {

/// `ApiGatewayProxyRequestContext` contains the information to identify the AWS account and resources invoking the
/// Lambda function. It also includes Cognito identity information for the caller.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayProxyRequestContext {
Expand Down Expand Up @@ -134,6 +136,7 @@ pub struct ApiGatewayProxyRequestContext {
}

/// `ApiGatewayV2httpRequest` contains data coming from the new HTTP API Gateway
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2httpRequest {
Expand Down Expand Up @@ -191,6 +194,7 @@ pub struct ApiGatewayV2httpRequest {
}

/// `ApiGatewayV2httpRequestContext` contains the information to identify the AWS account and resources invoking the Lambda function.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2httpRequestContext {
Expand Down Expand Up @@ -230,6 +234,7 @@ pub struct ApiGatewayV2httpRequestContext {
}

/// `ApiGatewayRequestAuthorizer` contains authorizer information for the request context.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct ApiGatewayRequestAuthorizer {
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -254,6 +259,7 @@ pub struct ApiGatewayRequestAuthorizer {
}

/// `ApiGatewayRequestAuthorizerJwtDescription` contains JWT authorizer information for the request context.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayRequestAuthorizerJwtDescription {
Expand All @@ -272,6 +278,7 @@ pub struct ApiGatewayRequestAuthorizerJwtDescription {
}

/// `ApiGatewayRequestAuthorizerIamDescription` contains IAM information for the request context.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayRequestAuthorizerIamDescription {
Expand Down Expand Up @@ -299,6 +306,7 @@ pub struct ApiGatewayRequestAuthorizerIamDescription {
}

/// `ApiGatewayRequestAuthorizerCognitoIdentity` contains Cognito identity information for the request context.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayRequestAuthorizerCognitoIdentity {
Expand All @@ -317,6 +325,7 @@ pub struct ApiGatewayRequestAuthorizerCognitoIdentity {
}

/// `ApiGatewayV2httpRequestContextHttpDescription` contains HTTP information for the request context.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2httpRequestContextHttpDescription {
Expand Down Expand Up @@ -365,6 +374,7 @@ pub struct ApiGatewayV2httpResponse {
}

/// `ApiGatewayRequestIdentity` contains identity information for the request caller.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayRequestIdentity {
Expand Down Expand Up @@ -405,6 +415,7 @@ pub struct ApiGatewayRequestIdentity {
}

/// `ApiGatewayWebsocketProxyRequest` contains data coming from the API Gateway proxy
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayWebsocketProxyRequest {
Expand Down Expand Up @@ -453,6 +464,7 @@ pub struct ApiGatewayWebsocketProxyRequest {
/// `ApiGatewayWebsocketProxyRequestContext` contains the information to identify
/// the AWS account and resources invoking the Lambda function. It also includes
/// Cognito identity information for the caller.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayWebsocketProxyRequestContext {
Expand Down Expand Up @@ -522,6 +534,7 @@ pub struct ApiGatewayWebsocketProxyRequestContext {
}

/// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentity` contains identity information for the request caller including certificate information if using mTLS.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentity {
Expand All @@ -543,6 +556,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentity {
}

/// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert` contains certificate information for the request caller if using mTLS.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert {
Expand All @@ -567,6 +581,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert {
}

/// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity` contains certificate validity information for the request caller if using mTLS.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity {
Expand All @@ -584,6 +599,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidit
}

/// `ApiGatewayV2httpRequestContextAuthentication` contains authentication context information for the request caller including client certificate information if using mTLS.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2httpRequestContextAuthentication {
Expand All @@ -599,6 +615,7 @@ pub struct ApiGatewayV2httpRequestContextAuthentication {
}

/// `ApiGatewayV2httpRequestContextAuthenticationClientCert` contains client certificate information for the request caller if using mTLS.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2httpRequestContextAuthenticationClientCert {
Expand All @@ -623,6 +640,7 @@ pub struct ApiGatewayV2httpRequestContextAuthenticationClientCert {
}

/// `ApiGatewayV2httpRequestContextAuthenticationClientCertValidity` contains client certificate validity information for the request caller if using mTLS.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2httpRequestContextAuthenticationClientCertValidity {
Expand All @@ -639,6 +657,7 @@ pub struct ApiGatewayV2httpRequestContextAuthenticationClientCertValidity {
pub other: serde_json::Map<String, Value>,
}

#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2CustomAuthorizerV1RequestTypeRequestContext {
Expand Down Expand Up @@ -669,6 +688,7 @@ pub struct ApiGatewayV2CustomAuthorizerV1RequestTypeRequestContext {
pub other: serde_json::Map<String, Value>,
}

#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2CustomAuthorizerV1Request {
Expand Down Expand Up @@ -711,6 +731,7 @@ pub struct ApiGatewayV2CustomAuthorizerV1Request {
pub other: serde_json::Map<String, Value>,
}

#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2CustomAuthorizerV2Request {
Expand Down Expand Up @@ -755,6 +776,7 @@ pub struct ApiGatewayV2CustomAuthorizerV2Request {

/// `ApiGatewayCustomAuthorizerContext` represents the expected format of an API Gateway custom authorizer response.
/// Deprecated. Code should be updated to use the Authorizer map from APIGatewayRequestIdentity. Ex: Authorizer["principalId"]
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayCustomAuthorizerContext {
Expand All @@ -773,6 +795,7 @@ pub struct ApiGatewayCustomAuthorizerContext {
}

/// `ApiGatewayCustomAuthorizerRequestTypeRequestContext` represents the expected format of an API Gateway custom authorizer response.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayCustomAuthorizerRequestTypeRequestContext {
Expand Down Expand Up @@ -808,6 +831,7 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestContext {
}

/// `ApiGatewayCustomAuthorizerRequest` contains data coming in to a custom API Gateway authorizer function.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayCustomAuthorizerRequest {
Expand All @@ -828,6 +852,7 @@ pub struct ApiGatewayCustomAuthorizerRequest {
}

/// `ApiGatewayCustomAuthorizerRequestTypeRequest` contains data coming in to a custom API Gateway authorizer function.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayCustomAuthorizerRequestTypeRequest {
Expand Down Expand Up @@ -895,6 +920,7 @@ where
}

/// `ApiGatewayV2CustomAuthorizerSimpleResponse` represents the simple format of an API Gateway V2 authorization response.
#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2CustomAuthorizerSimpleResponse<T1 = Value>
Expand All @@ -914,6 +940,7 @@ where
pub other: serde_json::Map<String, Value>,
}

#[non_exhaustive]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiGatewayV2CustomAuthorizerIamPolicyResponse<T1 = Value>
Expand Down
Loading
Loading