From a5e76e6e7377f4ec4951be8099786b1e49163f07 Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Thu, 15 Jan 2026 11:32:22 +0000 Subject: [PATCH 1/3] Add builder pattern support for event response types Add derived builders to events. Builders are conditionally compiled with the "builders" feature flag. --- lambda-events/Cargo.toml | 2 + .../examples/comprehensive-builders.rs | 59 +++++++ .../lambda-runtime-authorizer-builder.rs | 149 ++++++++++++++++++ .../lambda-runtime-sqs-batch-builder.rs | 141 +++++++++++++++++ lambda-events/src/event/activemq/mod.rs | 11 ++ lambda-events/src/event/alb/mod.rs | 14 ++ lambda-events/src/event/apigw/mod.rs | 95 +++++++++++ lambda-events/src/event/appsync/mod.rs | 38 +++++ lambda-events/src/event/autoscaling/mod.rs | 5 + .../src/event/bedrock_agent_runtime/mod.rs | 20 +++ lambda-events/src/event/chime_bot/mod.rs | 14 ++ lambda-events/src/event/clientvpn/mod.rs | 8 + lambda-events/src/event/cloudformation/mod.rs | 14 ++ .../src/event/cloudformation/provider.rs | 14 ++ .../src/event/cloudwatch_alarms/mod.rs | 41 +++++ .../src/event/cloudwatch_events/cloudtrail.rs | 23 +++ .../src/event/cloudwatch_events/codedeploy.rs | 11 ++ .../event/cloudwatch_events/codepipeline.rs | 14 ++ .../src/event/cloudwatch_events/ec2.rs | 5 + .../src/event/cloudwatch_events/emr.rs | 14 ++ .../src/event/cloudwatch_events/gamelift.rs | 38 +++++ .../src/event/cloudwatch_events/glue.rs | 26 +++ .../src/event/cloudwatch_events/health.rs | 11 ++ .../src/event/cloudwatch_events/kms.rs | 5 + .../src/event/cloudwatch_events/macie.rs | 56 +++++++ .../src/event/cloudwatch_events/mod.rs | 5 + .../src/event/cloudwatch_events/opsworks.rs | 14 ++ .../src/event/cloudwatch_events/signin.rs | 14 ++ .../src/event/cloudwatch_events/sms.rs | 5 + .../src/event/cloudwatch_events/ssm.rs | 44 ++++++ .../src/event/cloudwatch_events/tag.rs | 4 + .../event/cloudwatch_events/trustedadvisor.rs | 5 + .../src/event/cloudwatch_logs/mod.rs | 13 ++ lambda-events/src/event/code_commit/mod.rs | 14 ++ lambda-events/src/event/codebuild/mod.rs | 29 ++++ lambda-events/src/event/codedeploy/mod.rs | 11 ++ .../src/event/codepipeline_cloudwatch/mod.rs | 11 ++ .../src/event/codepipeline_job/mod.rs | 35 ++++ lambda-events/src/event/cognito/mod.rs | 130 +++++++++++++++ lambda-events/src/event/config/mod.rs | 5 + lambda-events/src/event/connect/mod.rs | 17 ++ .../event/documentdb/events/commom_types.rs | 23 ++- .../event/documentdb/events/delete_event.rs | 5 + .../documentdb/events/drop_database_event.rs | 5 + .../src/event/documentdb/events/drop_event.rs | 5 + .../event/documentdb/events/insert_event.rs | 5 + .../documentdb/events/invalidate_event.rs | 5 + .../event/documentdb/events/rename_event.rs | 5 + .../event/documentdb/events/replace_event.rs | 5 + .../event/documentdb/events/update_event.rs | 11 ++ lambda-events/src/event/documentdb/mod.rs | 8 + lambda-events/src/event/dynamodb/mod.rs | 20 +++ lambda-events/src/event/ecr_scan/mod.rs | 11 ++ lambda-events/src/event/eventbridge/mod.rs | 5 + lambda-events/src/event/firehose/mod.rs | 20 +++ lambda-events/src/event/iam/mod.rs | 8 + lambda-events/src/event/iot/mod.rs | 23 +++ lambda-events/src/event/iot_1_click/mod.rs | 17 ++ lambda-events/src/event/iot_button/mod.rs | 5 + lambda-events/src/event/iot_deprecated/mod.rs | 8 + lambda-events/src/event/kafka/mod.rs | 8 + lambda-events/src/event/kinesis/analytics.rs | 14 ++ lambda-events/src/event/kinesis/event.rs | 17 ++ .../src/event/lambda_function_urls/mod.rs | 20 +++ lambda-events/src/event/lex/mod.rs | 29 ++++ lambda-events/src/event/rabbitmq/mod.rs | 11 ++ lambda-events/src/event/s3/batch_job.rs | 17 ++ lambda-events/src/event/s3/event.rs | 23 +++ lambda-events/src/event/s3/object_lambda.rs | 32 ++++ lambda-events/src/event/secretsmanager/mod.rs | 5 + lambda-events/src/event/ses/mod.rs | 32 ++++ lambda-events/src/event/sns/mod.rs | 41 +++++ lambda-events/src/event/sqs/mod.rs | 35 ++++ lambda-events/src/event/streams/mod.rs | 20 +++ 74 files changed, 1680 insertions(+), 2 deletions(-) create mode 100644 lambda-events/examples/comprehensive-builders.rs create mode 100644 lambda-events/examples/lambda-runtime-authorizer-builder.rs create mode 100644 lambda-events/examples/lambda-runtime-sqs-batch-builder.rs diff --git a/lambda-events/Cargo.toml b/lambda-events/Cargo.toml index ae2d948a..01d7e5c8 100644 --- a/lambda-events/Cargo.toml +++ b/lambda-events/Cargo.toml @@ -20,6 +20,7 @@ edition = "2021" base64 = { workspace = true } bytes = { workspace = true, features = ["serde"], optional = true } chrono = { workspace = true, optional = true } +derive_builder = { version = "0.20", optional = true } flate2 = { version = "1.0.24", optional = true } http = { workspace = true, optional = true } http-body = { workspace = true, optional = true } @@ -126,6 +127,7 @@ documentdb = [] eventbridge = ["chrono", "serde_with"] catch-all-fields = [] +builders = ["derive_builder"] [package.metadata.docs.rs] all-features = true diff --git a/lambda-events/examples/comprehensive-builders.rs b/lambda-events/examples/comprehensive-builders.rs new file mode 100644 index 00000000..1052496e --- /dev/null +++ b/lambda-events/examples/comprehensive-builders.rs @@ -0,0 +1,59 @@ +// Example demonstrating builder pattern usage for AWS Lambda events +#[cfg(feature = "builders")] +use aws_lambda_events::event::{ + dynamodb::EventBuilder as DynamoDbEventBuilder, + kinesis::KinesisEventBuilder, + s3::S3EventBuilder, + secretsmanager::SecretsManagerSecretRotationEventBuilder, + sns::SnsEventBuilder, + sqs::SqsEventBuilder, +}; + +#[cfg(feature = "builders")] +fn main() { + + // S3 Event - Object storage notifications + let s3_event = S3EventBuilder::default() + .records(vec![]) + .build() + .unwrap(); + + // Kinesis Event - Stream processing + let kinesis_event = KinesisEventBuilder::default() + .records(vec![]) + .build() + .unwrap(); + + // DynamoDB Event - Database change streams + let dynamodb_event = DynamoDbEventBuilder::default() + .records(vec![]) + .build() + .unwrap(); + + // SNS Event - Pub/sub messaging + let sns_event = SnsEventBuilder::default() + .records(vec![]) + .build() + .unwrap(); + + // SQS Event - Queue messaging + let sqs_event = SqsEventBuilder::default() + .records(vec![]) + .build() + .unwrap(); + + // Secrets Manager Event - Secret rotation + let secrets_event = SecretsManagerSecretRotationEventBuilder::default() + .step("createSecret") + .secret_id("test-secret") + .client_request_token("token-123") + .build() + .unwrap(); + +} + +#[cfg(not(feature = "builders"))] +fn main() { + println!("This example requires the 'builders' feature to be enabled."); + println!("Run with: cargo run --example comprehensive-builders --all-features"); +} diff --git a/lambda-events/examples/lambda-runtime-authorizer-builder.rs b/lambda-events/examples/lambda-runtime-authorizer-builder.rs new file mode 100644 index 00000000..15188503 --- /dev/null +++ b/lambda-events/examples/lambda-runtime-authorizer-builder.rs @@ -0,0 +1,149 @@ +// Example showing how builders solve the Default trait requirement problem +// when using lambda_runtime with API Gateway custom authorizers +// +// ❌ OLD WAY (with Default requirement): +// #[derive(Default)] +// struct MyContext { +// // Had to use Option just for Default +// some_thing: Option, +// } +// +// let mut output = Response::default(); +// output.is_authorized = true; +// output.context = MyContext { +// some_thing: Some(thing), // ❌ Unnecessary Some() +// }; +// +// ✅ NEW WAY (with Builder pattern): +// struct MyContext { +// // No Option needed! +// some_thing: ThirdPartyThing, +// } +// +// let output = ResponseBuilder::default() +// .is_authorized(true) +// .context(context) +// .build()?; +// +// Benefits: +// • No Option wrapper for fields that always exist +// • Type-safe construction +// • Works seamlessly with lambda_runtime::LambdaEvent +// • Cleaner, more idiomatic Rust code + +#[cfg(feature = "builders")] +use aws_lambda_events::event::apigw::{ + ApiGatewayV2CustomAuthorizerSimpleResponse, + ApiGatewayV2CustomAuthorizerSimpleResponseBuilder, + ApiGatewayV2CustomAuthorizerV2Request, +}; +#[cfg(feature = "builders")] +use lambda_runtime::{Error, LambdaEvent}; +#[cfg(feature = "builders")] +use serde::{Deserialize, Serialize}; + +#[cfg(feature = "builders")] +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SomeThirdPartyThingWithoutDefaultValue { + pub api_key: String, + pub endpoint: String, + pub timeout_ms: u64, +} + +// ❌ OLD WAY: Had to use Option to satisfy Default requirement +#[cfg(feature = "builders")] +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct MyContextOldWay { + // NOT IDEAL: Need to wrap with Option just for Default + some_thing_always_exists: Option, +} + +// ✅ NEW WAY: No Option needed with builder pattern! +#[cfg(feature = "builders")] +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct MyContext { + // IDEAL: Can use the actual type directly! + some_thing_always_exists: SomeThirdPartyThingWithoutDefaultValue, + user_id: String, + permissions: Vec, +} + +// ❌ OLD IMPLEMENTATION: Using Default +#[cfg(feature = "builders")] +pub async fn function_handler_old_way( + _event: LambdaEvent, +) -> Result, Error> { + let mut output: ApiGatewayV2CustomAuthorizerSimpleResponse = + ApiGatewayV2CustomAuthorizerSimpleResponse::default(); + + output.is_authorized = true; + output.context = MyContextOldWay { + // ❌ Had to wrap in Some() even though it always exists + some_thing_always_exists: Some(SomeThirdPartyThingWithoutDefaultValue { + api_key: "secret-key-123".to_string(), + endpoint: "https://api.example.com".to_string(), + timeout_ms: 5000, + }), + }; + + Ok(output) +} + +// ✅ NEW IMPLEMENTATION: Using Builder +#[cfg(feature = "builders")] +pub async fn function_handler( + _event: LambdaEvent, +) -> Result, Error> { + let context = MyContext { + // ✅ No Option wrapper needed! + some_thing_always_exists: SomeThirdPartyThingWithoutDefaultValue { + api_key: "secret-key-123".to_string(), + endpoint: "https://api.example.com".to_string(), + timeout_ms: 5000, + }, + user_id: "user-123".to_string(), + permissions: vec!["read".to_string(), "write".to_string()], + }; + + // ✅ Clean builder pattern - no Default required! + let output = ApiGatewayV2CustomAuthorizerSimpleResponseBuilder::default() + .is_authorized(true) + .context(context) + .build() + .map_err(|e| format!("Failed to build response: {}", e))?; + + Ok(output) +} + +#[cfg(feature = "builders")] +fn main() { + let context = MyContext { + some_thing_always_exists: SomeThirdPartyThingWithoutDefaultValue { + api_key: "secret-key-123".to_string(), + endpoint: "https://api.example.com".to_string(), + timeout_ms: 5000, + }, + user_id: "user-123".to_string(), + permissions: vec!["read".to_string(), "write".to_string()], + }; + + let response = ApiGatewayV2CustomAuthorizerSimpleResponseBuilder::::default() + .is_authorized(true) + .context(context) + .build() + .unwrap(); + + println!("✅ Built authorizer response for user: {}", response.context.user_id); + println!(" Authorized: {}", response.is_authorized); + println!(" Permissions: {:?}", response.context.permissions); + println!( + " Third-party endpoint: {}", + response.context.some_thing_always_exists.endpoint + ); +} + +#[cfg(not(feature = "builders"))] +fn main() { + println!("This example requires the 'builders' feature to be enabled."); + println!("Run with: cargo run --example lambda-runtime-authorizer-builder --features builders"); +} diff --git a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs new file mode 100644 index 00000000..0899cdd4 --- /dev/null +++ b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs @@ -0,0 +1,141 @@ +// Example showing how builders simplify SQS batch response construction +// when handling partial batch failures +// +// ❌ OLD WAY (with Default): +// for record in event.payload.records { +// match process_record(&record).await { +// Err(_) => { +// let mut item = BatchItemFailure::default(); +// item.item_identifier = record.message_id.unwrap(); +// batch_item_failures.push(item) +// } +// } +// } +// let mut response = SqsBatchResponse::default(); +// response.batch_item_failures = batch_item_failures; +// +// ✅ NEW WAY (with Builder): +// for record in event.payload.records { +// match process_record(&record).await { +// Err(_) => { +// let item = BatchItemFailureBuilder::default() +// .item_identifier(record.message_id.unwrap()) +// .build()?; +// batch_item_failures.push(item) +// } +// } +// } +// let response = SqsBatchResponseBuilder::default() +// .batch_item_failures(batch_item_failures) +// .build()?; +// +// Benefits: +// • Immutable construction (no mut needed) +// • Cleaner, more functional style +// • Type-safe field assignment +// • Works seamlessly with lambda_runtime::LambdaEvent + +#[cfg(feature = "builders")] +use aws_lambda_events::event::sqs::{ + BatchItemFailure, BatchItemFailureBuilder, SqsBatchResponse, SqsBatchResponseBuilder, SqsEvent, +}; +#[cfg(feature = "builders")] +use lambda_runtime::{Error, LambdaEvent}; + +// Simulate processing a record +#[cfg(feature = "builders")] +#[allow(dead_code)] +async fn process_record(record: &aws_lambda_events::event::sqs::SqsMessage) -> Result<(), String> { + // Simulate some processing logic + if let Some(body) = &record.body { + if body.contains("error") { + return Err(format!("Failed to process message: {}", body)); + } + } + Ok(()) +} + +// ❌ OLD WAY: Using Default and manual field assignment +#[cfg(feature = "builders")] +#[allow(dead_code)] +async fn function_handler_old_way(event: LambdaEvent) -> Result { + let mut batch_item_failures = Vec::new(); + + for record in event.payload.records { + match process_record(&record).await { + Ok(_) => (), + Err(_) => { + let mut item = BatchItemFailure::default(); + item.item_identifier = record.message_id.unwrap(); + + batch_item_failures.push(item) + } + } + } + + let mut response = SqsBatchResponse::default(); + response.batch_item_failures = batch_item_failures; + + Ok(response) +} + +// ✅ NEW WAY: Using Builder pattern +#[cfg(feature = "builders")] +#[allow(dead_code)] +async fn function_handler(event: LambdaEvent) -> Result { + let mut batch_item_failures = Vec::new(); + + for record in event.payload.records { + match process_record(&record).await { + Ok(_) => (), + Err(_) => { + // ✅ Clean builder construction + let item = BatchItemFailureBuilder::default() + .item_identifier(record.message_id.unwrap()) + .build() + .unwrap(); + + batch_item_failures.push(item) + } + } + } + + // ✅ Clean response construction with builder + let response = SqsBatchResponseBuilder::default() + .batch_item_failures(batch_item_failures) + .build() + .map_err(|e| format!("Failed to build response: {}", e))?; + + Ok(response) +} + +#[cfg(feature = "builders")] +fn main() { + // Demonstrate builder usage with sample data + let failures = vec![ + BatchItemFailureBuilder::default() + .item_identifier("msg-123".to_string()) + .build() + .unwrap(), + BatchItemFailureBuilder::default() + .item_identifier("msg-456".to_string()) + .build() + .unwrap(), + ]; + + let response = SqsBatchResponseBuilder::default() + .batch_item_failures(failures) + .build() + .unwrap(); + + println!("✅ Built SQS batch response with {} failed items", response.batch_item_failures.len()); + for failure in &response.batch_item_failures { + println!(" Failed message: {}", failure.item_identifier); + } +} + +#[cfg(not(feature = "builders"))] +fn main() { + println!("This example requires the 'builders' feature to be enabled."); + println!("Run with: cargo run --example lambda-runtime-sqs-batch-builder --features builders"); +} diff --git a/lambda-events/src/event/activemq/mod.rs b/lambda-events/src/event/activemq/mod.rs index 60ef8568..17c62846 100644 --- a/lambda-events/src/event/activemq/mod.rs +++ b/lambda-events/src/event/activemq/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -6,6 +8,8 @@ use std::collections::HashMap; use crate::custom_serde::deserialize_lambda_map; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActiveMqEvent { @@ -20,10 +24,13 @@ pub struct ActiveMqEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActiveMqMessage { @@ -58,10 +65,13 @@ pub struct ActiveMqMessage { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActiveMqDestination { @@ -73,6 +83,7 @@ pub struct ActiveMqDestination { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/alb/mod.rs b/lambda-events/src/event/alb/mod.rs index 1829bf01..dfb21a0b 100644 --- a/lambda-events/src/event/alb/mod.rs +++ b/lambda-events/src/event/alb/mod.rs @@ -5,6 +5,8 @@ use crate::{ }, encodings::Body, }; +#[cfg(feature = "builders")] +use derive_builder::Builder; use http::{HeaderMap, Method}; use query_map::QueryMap; use serde::{Deserialize, Serialize}; @@ -13,6 +15,8 @@ use serde_json::Value; /// `AlbTargetGroupRequest` contains data originating from the ALB Lambda target group integration #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AlbTargetGroupRequest { @@ -41,11 +45,14 @@ pub struct AlbTargetGroupRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AlbTargetGroupRequestContext` contains the information to identify the load balancer invoking the lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AlbTargetGroupRequestContext { @@ -56,11 +63,14 @@ pub struct AlbTargetGroupRequestContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ElbContext` contains the information to identify the ARN invoking the lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ElbContext { @@ -73,11 +83,14 @@ pub struct ElbContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AlbTargetGroupResponse` configures the response to be returned by the ALB Lambda target group for the request #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AlbTargetGroupResponse { @@ -100,6 +113,7 @@ pub struct AlbTargetGroupResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/apigw/mod.rs b/lambda-events/src/event/apigw/mod.rs index 015eff40..7d50a330 100644 --- a/lambda-events/src/event/apigw/mod.rs +++ b/lambda-events/src/event/apigw/mod.rs @@ -6,6 +6,8 @@ use crate::{ encodings::Body, iam::IamPolicyStatement, }; +#[cfg(feature = "builders")] +use derive_builder::Builder; use http::{HeaderMap, Method}; use query_map::QueryMap; use serde::{de::DeserializeOwned, ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer}; @@ -14,6 +16,8 @@ use std::collections::HashMap; /// `ApiGatewayProxyRequest` contains data coming from the API Gateway proxy #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayProxyRequest { @@ -54,11 +58,14 @@ pub struct ApiGatewayProxyRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayProxyResponse` configures the response to be returned by API Gateway for the request #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayProxyResponse { @@ -79,12 +86,15 @@ pub struct ApiGatewayProxyResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `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] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayProxyRequestContext { @@ -133,11 +143,14 @@ pub struct ApiGatewayProxyRequestContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2httpRequest` contains data coming from the new HTTP API Gateway #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2httpRequest { @@ -191,11 +204,14 @@ pub struct ApiGatewayV2httpRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2httpRequestContext` contains the information to identify the AWS account and resources invoking the Lambda function. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2httpRequestContext { @@ -231,11 +247,14 @@ pub struct ApiGatewayV2httpRequestContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayRequestAuthorizer` contains authorizer information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct ApiGatewayRequestAuthorizer { #[serde(skip_serializing_if = "Option::is_none")] @@ -256,11 +275,14 @@ pub struct ApiGatewayRequestAuthorizer { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayRequestAuthorizerJwtDescription` contains JWT authorizer information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayRequestAuthorizerJwtDescription { @@ -275,11 +297,14 @@ pub struct ApiGatewayRequestAuthorizerJwtDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayRequestAuthorizerIamDescription` contains IAM information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayRequestAuthorizerIamDescription { @@ -303,11 +328,14 @@ pub struct ApiGatewayRequestAuthorizerIamDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayRequestAuthorizerCognitoIdentity` contains Cognito identity information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayRequestAuthorizerCognitoIdentity { @@ -322,11 +350,14 @@ pub struct ApiGatewayRequestAuthorizerCognitoIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2httpRequestContextHttpDescription` contains HTTP information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2httpRequestContextHttpDescription { @@ -346,11 +377,14 @@ pub struct ApiGatewayV2httpRequestContextHttpDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2httpResponse` configures the response to be returned by API Gateway V2 for the request #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2httpResponse { @@ -372,11 +406,14 @@ pub struct ApiGatewayV2httpResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayRequestIdentity` contains identity information for the request caller. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayRequestIdentity { @@ -413,11 +450,14 @@ pub struct ApiGatewayRequestIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayWebsocketProxyRequest` contains data coming from the API Gateway proxy #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayWebsocketProxyRequest { @@ -460,6 +500,7 @@ pub struct ApiGatewayWebsocketProxyRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -467,6 +508,8 @@ pub struct ApiGatewayWebsocketProxyRequest { /// the AWS account and resources invoking the Lambda function. It also includes /// Cognito identity information for the caller. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayWebsocketProxyRequestContext { @@ -532,11 +575,14 @@ pub struct ApiGatewayWebsocketProxyRequestContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentity` contains identity information for the request caller including certificate information if using mTLS. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentity { @@ -554,11 +600,14 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert` contains certificate information for the request caller if using mTLS. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert { @@ -579,11 +628,14 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity` contains certificate validity information for the request caller if using mTLS. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidity { @@ -597,11 +649,14 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestIdentityClientCertValidit #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2httpRequestContextAuthentication` contains authentication context information for the request caller including client certificate information if using mTLS. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2httpRequestContextAuthentication { @@ -613,11 +668,14 @@ pub struct ApiGatewayV2httpRequestContextAuthentication { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2httpRequestContextAuthenticationClientCert` contains client certificate information for the request caller if using mTLS. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2httpRequestContextAuthenticationClientCert { @@ -638,11 +696,14 @@ pub struct ApiGatewayV2httpRequestContextAuthenticationClientCert { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2httpRequestContextAuthenticationClientCertValidity` contains client certificate validity information for the request caller if using mTLS. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2httpRequestContextAuthenticationClientCertValidity { @@ -656,10 +717,13 @@ pub struct ApiGatewayV2httpRequestContextAuthenticationClientCertValidity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2CustomAuthorizerV1RequestTypeRequestContext { @@ -687,10 +751,13 @@ pub struct ApiGatewayV2CustomAuthorizerV1RequestTypeRequestContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2CustomAuthorizerV1Request { @@ -730,10 +797,13 @@ pub struct ApiGatewayV2CustomAuthorizerV1Request { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2CustomAuthorizerV2Request { @@ -773,12 +843,15 @@ pub struct ApiGatewayV2CustomAuthorizerV2Request { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `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] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerContext { @@ -793,11 +866,14 @@ pub struct ApiGatewayCustomAuthorizerContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerRequestTypeRequestContext` represents the expected format of an API Gateway custom authorizer response. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerRequestTypeRequestContext { @@ -829,11 +905,14 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequestContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerRequest` contains data coming in to a custom API Gateway authorizer function. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerRequest { @@ -850,11 +929,14 @@ pub struct ApiGatewayCustomAuthorizerRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerRequestTypeRequest` contains data coming in to a custom API Gateway authorizer function. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerRequestTypeRequest { @@ -895,11 +977,14 @@ pub struct ApiGatewayCustomAuthorizerRequestTypeRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerResponse` represents the expected format of an API Gateway authorization response. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayCustomAuthorizerResponse @@ -919,11 +1004,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayV2CustomAuthorizerSimpleResponse` represents the simple format of an API Gateway V2 authorization response. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2CustomAuthorizerSimpleResponse @@ -940,10 +1028,13 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApiGatewayV2CustomAuthorizerIamPolicyResponse @@ -962,11 +1053,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ApiGatewayCustomAuthorizerPolicy` represents an IAM policy #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct ApiGatewayCustomAuthorizerPolicy { @@ -979,6 +1073,7 @@ pub struct ApiGatewayCustomAuthorizerPolicy { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/appsync/mod.rs b/lambda-events/src/event/appsync/mod.rs index 223c706b..2348b1ee 100644 --- a/lambda-events/src/event/appsync/mod.rs +++ b/lambda-events/src/event/appsync/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -6,6 +8,8 @@ use crate::custom_serde::deserialize_lambda_map; /// Deprecated: `AppSyncResolverTemplate` does not represent resolver events sent by AppSync. Instead directly model your input schema, or use `map[string]string`, `json.RawMessage`,` interface{}`, etc.. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncResolverTemplate @@ -24,11 +28,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncIamIdentity` contains information about the caller authed via IAM. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncIamIdentity { @@ -53,11 +60,14 @@ pub struct AppSyncIamIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncCognitoIdentity` contains information about the caller authed via Cognito. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncCognitoIdentity @@ -84,6 +94,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -91,6 +102,8 @@ pub type AppSyncOperation = String; /// `AppSyncLambdaAuthorizerRequest` contains an authorization request from AppSync. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncLambdaAuthorizerRequest { @@ -103,12 +116,15 @@ pub struct AppSyncLambdaAuthorizerRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncLambdaAuthorizerRequestContext` contains the parameters of the AppSync invocation which triggered /// this authorization request. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncLambdaAuthorizerRequestContext @@ -137,11 +153,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncLambdaAuthorizerResponse` represents the expected format of an authorization response to AppSync. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncLambdaAuthorizerResponse @@ -162,6 +181,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -178,6 +198,8 @@ where /// See also: /// - [AppSync resolver mapping template context reference](https://docs.aws.amazon.com/appsync/latest/devguide/resolver-context-reference.html) #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] pub struct AppSyncDirectResolverEvent where @@ -202,12 +224,15 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncRequest` contains request-related metadata for a resolver invocation, /// including client-sent headers and optional custom domain name. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncRequest { @@ -223,11 +248,14 @@ pub struct AppSyncRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncInfo` contains metadata about the current GraphQL field being resolved. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncInfo @@ -248,11 +276,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncPrevResult` contains the result of the previous step in a pipeline resolver. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] pub struct AppSyncPrevResult where @@ -266,6 +297,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -289,6 +321,8 @@ impl Default for AppSyncIdentity { /// `AppSyncIdentityOIDC` represents identity information when using OIDC-based authorization. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] pub struct AppSyncIdentityOIDC where @@ -304,11 +338,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AppSyncIdentityLambda` represents identity information when using AWS Lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AppSyncIdentityLambda @@ -323,6 +360,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/autoscaling/mod.rs b/lambda-events/src/event/autoscaling/mod.rs index 9a0eda8a..83b2e7ea 100644 --- a/lambda-events/src/event/autoscaling/mod.rs +++ b/lambda-events/src/event/autoscaling/mod.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -7,6 +9,8 @@ use crate::custom_serde::deserialize_lambda_map; /// `AutoScalingEvent` struct is used to parse the json for auto scaling event types // #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct AutoScalingEvent @@ -48,6 +52,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/bedrock_agent_runtime/mod.rs b/lambda-events/src/event/bedrock_agent_runtime/mod.rs index ce119914..ff725a72 100644 --- a/lambda-events/src/event/bedrock_agent_runtime/mod.rs +++ b/lambda-events/src/event/bedrock_agent_runtime/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use std::collections::HashMap; /// The Event sent to Lambda from Agents for Amazon Bedrock. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AgentEvent { @@ -38,10 +42,13 @@ pub struct AgentEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct RequestBody { @@ -53,10 +60,13 @@ pub struct RequestBody { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Content { @@ -68,10 +78,13 @@ pub struct Content { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Property { @@ -87,10 +100,13 @@ pub struct Property { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Parameter { @@ -106,10 +122,13 @@ pub struct Parameter { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Agent { @@ -127,6 +146,7 @@ pub struct Agent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/chime_bot/mod.rs b/lambda-events/src/event/chime_bot/mod.rs index 7a0990ef..6494eb82 100644 --- a/lambda-events/src/event/chime_bot/mod.rs +++ b/lambda-events/src/event/chime_bot/mod.rs @@ -1,9 +1,13 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChimeBotEvent { @@ -26,10 +30,13 @@ pub struct ChimeBotEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChimeBotEventSender { @@ -45,10 +52,13 @@ pub struct ChimeBotEventSender { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChimeBotEventDiscussion { @@ -64,10 +74,13 @@ pub struct ChimeBotEventDiscussion { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChimeBotEventInboundHttpsEndpoint { @@ -83,5 +96,6 @@ pub struct ChimeBotEventInboundHttpsEndpoint { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/clientvpn/mod.rs b/lambda-events/src/event/clientvpn/mod.rs index 3d6152c9..60f02316 100644 --- a/lambda-events/src/event/clientvpn/mod.rs +++ b/lambda-events/src/event/clientvpn/mod.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ClientVpnConnectionHandlerRequest { @@ -38,10 +42,13 @@ pub struct ClientVpnConnectionHandlerRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ClientVpnConnectionHandlerResponse { @@ -60,6 +67,7 @@ pub struct ClientVpnConnectionHandlerResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudformation/mod.rs b/lambda-events/src/event/cloudformation/mod.rs index 3ea66e30..31da2a70 100644 --- a/lambda-events/src/event/cloudformation/mod.rs +++ b/lambda-events/src/event/cloudformation/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -27,6 +29,8 @@ impl Default for CloudFormationCustomResourceRequest { } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CreateRequest @@ -49,10 +53,13 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct UpdateRequest @@ -79,10 +86,13 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct DeleteRequest @@ -106,10 +116,13 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CloudFormationCustomResourceResponse { @@ -127,6 +140,7 @@ pub struct CloudFormationCustomResourceResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudformation/provider.rs b/lambda-events/src/event/cloudformation/provider.rs index 34e8136f..a988ca83 100644 --- a/lambda-events/src/event/cloudformation/provider.rs +++ b/lambda-events/src/event/cloudformation/provider.rs @@ -4,6 +4,8 @@ //! //! See for details. +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -30,6 +32,8 @@ impl Default for CloudFormationCustomResourceRequest { } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CreateRequest @@ -42,6 +46,8 @@ where } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct UpdateRequest @@ -60,6 +66,8 @@ where } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct DeleteRequest @@ -74,6 +82,8 @@ where } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CommonRequestParams @@ -92,10 +102,13 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CloudFormationCustomResourceResponse @@ -112,6 +125,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_alarms/mod.rs b/lambda-events/src/event/cloudwatch_alarms/mod.rs index 46c9503a..54a26769 100644 --- a/lambda-events/src/event/cloudwatch_alarms/mod.rs +++ b/lambda-events/src/event/cloudwatch_alarms/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use std::collections::HashMap; use chrono::{DateTime, Utc}; @@ -13,6 +15,8 @@ use serde_json::Value; /// For examples of events that come via CloudWatch Alarms, /// see #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchAlarm @@ -40,6 +44,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -52,6 +57,8 @@ pub type CloudWatchCompositeAlarm = CloudWatchAlarm; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchAlarmData @@ -74,10 +81,13 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchAlarmState @@ -99,10 +109,13 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchMetricAlarmConfiguration { @@ -116,10 +129,13 @@ pub struct CloudWatchMetricAlarmConfiguration { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchMetricDefinition { @@ -133,10 +149,13 @@ pub struct CloudWatchMetricDefinition { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchMetricStatDefinition { @@ -152,10 +171,13 @@ pub struct CloudWatchMetricStatDefinition { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchMetricStatMetricDefinition { @@ -169,10 +191,13 @@ pub struct CloudWatchMetricStatMetricDefinition { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchCompositeAlarmConfiguration { @@ -186,6 +211,7 @@ pub struct CloudWatchCompositeAlarmConfiguration { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -214,6 +240,8 @@ impl Default for CloudWatchAlarmStateReasonData { } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchAlarmStateReasonDataMetric { @@ -242,10 +270,13 @@ pub struct CloudWatchAlarmStateReasonDataMetric { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchAlarmStateEvaluatedDatapoint { @@ -262,10 +293,13 @@ pub struct CloudWatchAlarmStateEvaluatedDatapoint { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ClodWatchAlarmStateReasonDataComposite { @@ -277,10 +311,13 @@ pub struct ClodWatchAlarmStateReasonDataComposite { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchAlarmStateTriggeringAlarm { @@ -292,10 +329,13 @@ pub struct CloudWatchAlarmStateTriggeringAlarm { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchAlarmStateTriggeringAlarmState { @@ -308,6 +348,7 @@ pub struct CloudWatchAlarmStateTriggeringAlarmState { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/cloudtrail.rs b/lambda-events/src/event/cloudwatch_events/cloudtrail.rs index 70275c4f..bed1d400 100644 --- a/lambda-events/src/event/cloudwatch_events/cloudtrail.rs +++ b/lambda-events/src/event/cloudwatch_events/cloudtrail.rs @@ -1,8 +1,12 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AWSAPICall { @@ -30,10 +34,13 @@ pub struct AWSAPICall { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SessionIssuer { @@ -48,10 +55,13 @@ pub struct SessionIssuer { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct WebIdFederationData { @@ -63,10 +73,13 @@ pub struct WebIdFederationData { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Attributes { @@ -78,10 +91,13 @@ pub struct Attributes { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SessionContext { @@ -96,10 +112,13 @@ pub struct SessionContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct OnBehalfOf { @@ -111,11 +130,14 @@ pub struct OnBehalfOf { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } // https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UserIdentity { @@ -134,6 +156,7 @@ pub struct UserIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/codedeploy.rs b/lambda-events/src/event/cloudwatch_events/codedeploy.rs index f01a5bba..a456e3a6 100644 --- a/lambda-events/src/event/cloudwatch_events/codedeploy.rs +++ b/lambda-events/src/event/cloudwatch_events/codedeploy.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct StateChangeNotification { @@ -18,10 +22,13 @@ pub struct StateChangeNotification { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct DeploymentStateChangeNotification { @@ -38,10 +45,13 @@ pub struct DeploymentStateChangeNotification { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct InstanceStateChangeNotification { @@ -56,5 +66,6 @@ pub struct InstanceStateChangeNotification { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/codepipeline.rs b/lambda-events/src/event/cloudwatch_events/codepipeline.rs index 89f2029c..05679700 100644 --- a/lambda-events/src/event/cloudwatch_events/codepipeline.rs +++ b/lambda-events/src/event/cloudwatch_events/codepipeline.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct PipelineExecutionStateChange { @@ -17,10 +21,13 @@ pub struct PipelineExecutionStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct StageExecutionStateChange { @@ -36,10 +43,13 @@ pub struct StageExecutionStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActionExecutionStateChange { @@ -59,10 +69,13 @@ pub struct ActionExecutionStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActionExecutionStateChangeType { @@ -76,5 +89,6 @@ pub struct ActionExecutionStateChangeType { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/ec2.rs b/lambda-events/src/event/cloudwatch_events/ec2.rs index 378b64f1..c414477a 100644 --- a/lambda-events/src/event/cloudwatch_events/ec2.rs +++ b/lambda-events/src/event/cloudwatch_events/ec2.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct InstanceStateChange { @@ -15,5 +19,6 @@ pub struct InstanceStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/emr.rs b/lambda-events/src/event/cloudwatch_events/emr.rs index f30d5334..7c46b727 100644 --- a/lambda-events/src/event/cloudwatch_events/emr.rs +++ b/lambda-events/src/event/cloudwatch_events/emr.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AutoScalingPolicyStateChange { @@ -17,10 +21,13 @@ pub struct AutoScalingPolicyStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ClusterStateChange { @@ -36,10 +43,13 @@ pub struct ClusterStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct InstanceGroupStateChange { @@ -59,10 +69,13 @@ pub struct InstanceGroupStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct StepStatusChange { @@ -79,5 +92,6 @@ pub struct StepStatusChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/gamelift.rs b/lambda-events/src/event/cloudwatch_events/gamelift.rs index 95678329..395d7df4 100644 --- a/lambda-events/src/event/cloudwatch_events/gamelift.rs +++ b/lambda-events/src/event/cloudwatch_events/gamelift.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use crate::custom_serde::deserialize_nullish_boolean; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MatchmakingSearching { @@ -18,10 +22,13 @@ pub struct MatchmakingSearching { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Ticket { @@ -34,10 +41,13 @@ pub struct Ticket { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Player { @@ -52,10 +62,13 @@ pub struct Player { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct GameSessionInfo { @@ -66,10 +79,13 @@ pub struct GameSessionInfo { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct PotentialMatchCreated { @@ -86,10 +102,13 @@ pub struct PotentialMatchCreated { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct RuleEvaluationMetric { @@ -102,10 +121,13 @@ pub struct RuleEvaluationMetric { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AcceptMatch { @@ -119,10 +141,13 @@ pub struct AcceptMatch { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AcceptMatchCompleted { @@ -137,10 +162,13 @@ pub struct AcceptMatchCompleted { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MatchmakingSucceeded { @@ -154,10 +182,13 @@ pub struct MatchmakingSucceeded { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MatchmakingTimedOut { @@ -173,10 +204,13 @@ pub struct MatchmakingTimedOut { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MatchmakingCancelled { @@ -192,10 +226,13 @@ pub struct MatchmakingCancelled { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MatchmakingFailed { @@ -212,5 +249,6 @@ pub struct MatchmakingFailed { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/glue.rs b/lambda-events/src/event/cloudwatch_events/glue.rs index 69d428b2..3b63680d 100644 --- a/lambda-events/src/event/cloudwatch_events/glue.rs +++ b/lambda-events/src/event/cloudwatch_events/glue.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct JobRunStateChange { @@ -17,10 +21,13 @@ pub struct JobRunStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CrawlerStarted { @@ -35,10 +42,13 @@ pub struct CrawlerStarted { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CrawlerSucceeded { @@ -63,10 +73,13 @@ pub struct CrawlerSucceeded { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CrawlerFailed { @@ -82,10 +95,13 @@ pub struct CrawlerFailed { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct JobRunStatus { @@ -102,10 +118,13 @@ pub struct JobRunStatus { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct NotificationCondition { @@ -117,10 +136,13 @@ pub struct NotificationCondition { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct DataCatalogTableStateChange { @@ -134,10 +156,13 @@ pub struct DataCatalogTableStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct DataCatalogDatabaseStateChange { @@ -150,5 +175,6 @@ pub struct DataCatalogDatabaseStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/health.rs b/lambda-events/src/event/cloudwatch_events/health.rs index af5ebfc4..4cbb325f 100644 --- a/lambda-events/src/event/cloudwatch_events/health.rs +++ b/lambda-events/src/event/cloudwatch_events/health.rs @@ -1,9 +1,13 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::collections::HashMap; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Event { @@ -21,10 +25,13 @@ pub struct Event { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EventDescription { @@ -36,10 +43,13 @@ pub struct EventDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Entity { @@ -51,5 +61,6 @@ pub struct Entity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/kms.rs b/lambda-events/src/event/cloudwatch_events/kms.rs index c96d2be5..62a66267 100644 --- a/lambda-events/src/event/cloudwatch_events/kms.rs +++ b/lambda-events/src/event/cloudwatch_events/kms.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CMKEvent { @@ -14,5 +18,6 @@ pub struct CMKEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/macie.rs b/lambda-events/src/event/cloudwatch_events/macie.rs index 7a1a989b..cac8cb62 100644 --- a/lambda-events/src/event/cloudwatch_events/macie.rs +++ b/lambda-events/src/event/cloudwatch_events/macie.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] @@ -5,6 +7,8 @@ use serde_json::Value; use std::collections::HashMap; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Alert { @@ -28,6 +32,7 @@ pub struct Alert { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -36,6 +41,8 @@ pub type BucketWritableAlert = Alert; pub type BucketContainsHighRiskObjectAlert = Alert; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Trigger { @@ -53,10 +60,13 @@ pub struct Trigger { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct BucketScanSummary { @@ -83,10 +93,13 @@ pub struct BucketScanSummary { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Ip { @@ -102,10 +115,13 @@ pub struct Ip { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct TimeRange { @@ -118,10 +134,13 @@ pub struct TimeRange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Location { @@ -133,10 +152,13 @@ pub struct Location { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActionInfo { @@ -150,10 +172,13 @@ pub struct ActionInfo { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct BucketWritableSummary { @@ -175,10 +200,13 @@ pub struct BucketWritableSummary { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Bucket { @@ -190,10 +218,13 @@ pub struct Bucket { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Acl { @@ -205,10 +236,13 @@ pub struct Acl { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SecretBucketName { @@ -222,10 +256,13 @@ pub struct SecretBucketName { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Owner { @@ -239,10 +276,13 @@ pub struct Owner { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Grant { @@ -256,10 +296,13 @@ pub struct Grant { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Grantee { @@ -272,10 +315,13 @@ pub struct Grantee { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct BucketContainsHighRiskObjectSummary { @@ -301,10 +347,13 @@ pub struct BucketContainsHighRiskObjectSummary { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AlertUpdated { @@ -327,10 +376,13 @@ pub struct AlertUpdated { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UpdatedTrigger { @@ -343,10 +395,13 @@ pub struct UpdatedTrigger { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct FeatureInfo { @@ -364,5 +419,6 @@ pub struct FeatureInfo { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/mod.rs b/lambda-events/src/event/cloudwatch_events/mod.rs index 91f7e7fd..f867386a 100644 --- a/lambda-events/src/event/cloudwatch_events/mod.rs +++ b/lambda-events/src/event/cloudwatch_events/mod.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -22,6 +24,8 @@ pub mod trustedadvisor; /// `CloudWatchEvent` is the outer structure of an event sent via CloudWatch Events. /// For examples of events that come via CloudWatch Events, see #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CloudWatchEvent @@ -53,5 +57,6 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/opsworks.rs b/lambda-events/src/event/cloudwatch_events/opsworks.rs index 7c26baaf..518a1adc 100644 --- a/lambda-events/src/event/cloudwatch_events/opsworks.rs +++ b/lambda-events/src/event/cloudwatch_events/opsworks.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct InstanceStateChange { @@ -24,10 +28,13 @@ pub struct InstanceStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CommandStateChange { @@ -43,10 +50,13 @@ pub struct CommandStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct DeploymentStateChange { @@ -65,10 +75,13 @@ pub struct DeploymentStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Alert { @@ -84,5 +97,6 @@ pub struct Alert { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/signin.rs b/lambda-events/src/event/cloudwatch_events/signin.rs index 458787bd..888bcffc 100644 --- a/lambda-events/src/event/cloudwatch_events/signin.rs +++ b/lambda-events/src/event/cloudwatch_events/signin.rs @@ -1,7 +1,11 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SignIn { @@ -26,10 +30,13 @@ pub struct SignIn { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UserIdentity { @@ -43,10 +50,13 @@ pub struct UserIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ResponseElements { @@ -58,10 +68,13 @@ pub struct ResponseElements { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct AdditionalEventData { @@ -77,5 +90,6 @@ pub struct AdditionalEventData { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/sms.rs b/lambda-events/src/event/cloudwatch_events/sms.rs index e3bfeeb4..7b919707 100644 --- a/lambda-events/src/event/cloudwatch_events/sms.rs +++ b/lambda-events/src/event/cloudwatch_events/sms.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct JobStateChange { @@ -20,5 +24,6 @@ pub struct JobStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/ssm.rs b/lambda-events/src/event/cloudwatch_events/ssm.rs index 1bf81ed2..87f00a41 100644 --- a/lambda-events/src/event/cloudwatch_events/ssm.rs +++ b/lambda-events/src/event/cloudwatch_events/ssm.rs @@ -1,9 +1,13 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::collections::HashMap; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EC2AutomationStepStatusChange { @@ -31,10 +35,13 @@ pub struct EC2AutomationStepStatusChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EC2AutomationExecutionStatusChange { @@ -60,10 +67,13 @@ pub struct EC2AutomationExecutionStatusChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct StateChange { @@ -76,10 +86,13 @@ pub struct StateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConfigurationComplianceStateChange { @@ -102,10 +115,13 @@ pub struct ConfigurationComplianceStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MaintenanceWindowTargetRegistration { @@ -120,10 +136,13 @@ pub struct MaintenanceWindowTargetRegistration { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MaintenanceWindowExecutionStateChange { @@ -142,10 +161,13 @@ pub struct MaintenanceWindowExecutionStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MaintenanceWindowTaskExecutionStateChange { @@ -166,10 +188,13 @@ pub struct MaintenanceWindowTaskExecutionStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MaintenanceWindowTaskTargetInvocationStateChange { @@ -194,10 +219,13 @@ pub struct MaintenanceWindowTaskTargetInvocationStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct MaintenanceWindowStateChange { @@ -210,10 +238,13 @@ pub struct MaintenanceWindowStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ParameterStoreStateChange { @@ -227,10 +258,13 @@ pub struct ParameterStoreStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EC2CommandStatusChange { @@ -250,10 +284,13 @@ pub struct EC2CommandStatusChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EC2CommandInvocationStatusChange { @@ -272,10 +309,13 @@ pub struct EC2CommandInvocationStatusChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EC2StateManagerAssociationStateChange { @@ -309,10 +349,13 @@ pub struct EC2StateManagerAssociationStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EC2StateManagerInstanceAssociationStateChange { @@ -348,5 +391,6 @@ pub struct EC2StateManagerInstanceAssociationStateChange { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/tag.rs b/lambda-events/src/event/cloudwatch_events/tag.rs index e6d3b96f..0ca3f095 100644 --- a/lambda-events/src/event/cloudwatch_events/tag.rs +++ b/lambda-events/src/event/cloudwatch_events/tag.rs @@ -1,3 +1,4 @@ +use derive_builder::Builder; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::collections::HashMap; @@ -5,6 +6,8 @@ use std::collections::HashMap; use serde::{Deserialize, Serialize}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct TagChangeOnResource { @@ -21,5 +24,6 @@ pub struct TagChangeOnResource { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs b/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs index fdaf4a82..010c0dc7 100644 --- a/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs +++ b/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs @@ -1,9 +1,13 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::collections::HashMap; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CheckItemRefreshNotification { @@ -21,5 +25,6 @@ pub struct CheckItemRefreshNotification { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cloudwatch_logs/mod.rs b/lambda-events/src/event/cloudwatch_logs/mod.rs index e494918a..a3f35bfe 100644 --- a/lambda-events/src/event/cloudwatch_logs/mod.rs +++ b/lambda-events/src/event/cloudwatch_logs/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{ de::{Error, MapAccess, Visitor}, ser::{Error as SeError, SerializeStruct}, @@ -11,6 +13,8 @@ use std::{fmt, io::BufReader}; /// `LogsEvent` represents the raw event sent by CloudWatch #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct LogsEvent { /// `aws_logs` is gzipped and base64 encoded, it needs a custom deserializer @@ -22,11 +26,14 @@ pub struct LogsEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `AwsLogs` is an unmarshaled, ungzipped, CloudWatch logs event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct AwsLogs { /// `data` is the log data after is decompressed @@ -35,6 +42,8 @@ pub struct AwsLogs { /// `LogData` represents the logs group event information #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct LogData { @@ -56,11 +65,14 @@ pub struct LogData { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `LogEntry` represents a log entry from cloudwatch logs #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct LogEntry { /// Unique id for the entry @@ -75,6 +87,7 @@ pub struct LogEntry { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/code_commit/mod.rs b/lambda-events/src/event/code_commit/mod.rs index 126d7160..0a2cff6e 100644 --- a/lambda-events/src/event/code_commit/mod.rs +++ b/lambda-events/src/event/code_commit/mod.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,6 +9,8 @@ use crate::custom_serde::deserialize_nullish_boolean; /// `CodeCommitEvent` represents a CodeCommit event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeCommitEvent { @@ -18,6 +22,7 @@ pub struct CodeCommitEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -25,6 +30,8 @@ pub type CodeCommitEventTime = DateTime; /// `CodeCommitRecord` represents a CodeCommit record #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeCommitRecord { @@ -61,11 +68,14 @@ pub struct CodeCommitRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeCommitCodeCommit` represents a CodeCommit object in a record #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeCommitCodeCommit { @@ -79,11 +89,14 @@ pub struct CodeCommitCodeCommit { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeCommitReference` represents a Reference object in a CodeCommit object #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeCommitReference { @@ -99,6 +112,7 @@ pub struct CodeCommitReference { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/codebuild/mod.rs b/lambda-events/src/event/codebuild/mod.rs index 27a0e060..475e3339 100644 --- a/lambda-events/src/event/codebuild/mod.rs +++ b/lambda-events/src/event/codebuild/mod.rs @@ -3,6 +3,8 @@ use crate::{ encodings::{MinuteDuration, SecondDuration}, }; use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -13,6 +15,8 @@ pub type CodeBuildPhaseType = String; /// `CodeBuildEvent` is documented at: /// #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildEvent { @@ -51,11 +55,14 @@ pub struct CodeBuildEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildEventDetail` represents the all details related to the code build event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildEventDetail { @@ -99,11 +106,14 @@ pub struct CodeBuildEventDetail { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildEventAdditionalInformation` represents additional information to the code build event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildEventAdditionalInformation { @@ -132,11 +142,14 @@ pub struct CodeBuildEventAdditionalInformation { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildArtifact` represents the artifact provided to build #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildArtifact { @@ -154,11 +167,14 @@ pub struct CodeBuildArtifact { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildEnvironment` represents the environment for a build #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildEnvironment { @@ -179,11 +195,14 @@ pub struct CodeBuildEnvironment { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildEnvironmentVariable` encapsulate environment variables for the code build #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildEnvironmentVariable { @@ -202,11 +221,14 @@ pub struct CodeBuildEnvironmentVariable { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildSource` represent the code source will be build #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildSource { @@ -220,11 +242,14 @@ pub struct CodeBuildSource { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildLogs` gives the log details of a code build #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildLogs { @@ -243,11 +268,14 @@ pub struct CodeBuildLogs { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodeBuildPhase` represents the phase of a build and its details #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeBuildPhase @@ -277,6 +305,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/codedeploy/mod.rs b/lambda-events/src/event/codedeploy/mod.rs index debe2bf5..74369326 100644 --- a/lambda-events/src/event/codedeploy/mod.rs +++ b/lambda-events/src/event/codedeploy/mod.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,6 +10,8 @@ pub type CodeDeployDeploymentState = String; /// `CodeDeployEvent` is documented at: /// #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeDeployEvent { @@ -47,10 +51,13 @@ pub struct CodeDeployEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodeDeployEventDetail { @@ -80,10 +87,13 @@ pub struct CodeDeployEventDetail { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "PascalCase")] pub struct CodeDeployLifecycleEvent { @@ -95,6 +105,7 @@ pub struct CodeDeployLifecycleEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/codepipeline_cloudwatch/mod.rs b/lambda-events/src/event/codepipeline_cloudwatch/mod.rs index 087d1452..0d6cb65b 100644 --- a/lambda-events/src/event/codepipeline_cloudwatch/mod.rs +++ b/lambda-events/src/event/codepipeline_cloudwatch/mod.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -12,6 +14,8 @@ pub type CodePipelineActionState = String; /// CodePipelineEvent is documented at: /// #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineCloudWatchEvent { @@ -51,10 +55,13 @@ pub struct CodePipelineCloudWatchEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineEventDetail { @@ -79,10 +86,13 @@ pub struct CodePipelineEventDetail { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineEventDetailType { @@ -100,6 +110,7 @@ pub struct CodePipelineEventDetailType { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/codepipeline_job/mod.rs b/lambda-events/src/event/codepipeline_job/mod.rs index 83dfce65..5085f96d 100644 --- a/lambda-events/src/event/codepipeline_job/mod.rs +++ b/lambda-events/src/event/codepipeline_job/mod.rs @@ -1,9 +1,13 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; /// `CodePipelineJobEvent` contains data from an event sent from AWS CodePipeline #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineJobEvent { @@ -15,11 +19,14 @@ pub struct CodePipelineJobEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineJob` represents a job from an AWS CodePipeline event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineJob { @@ -34,11 +41,14 @@ pub struct CodePipelineJob { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineData` represents a job from an AWS CodePipeline event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineData { @@ -55,11 +65,14 @@ pub struct CodePipelineData { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineActionConfiguration` represents an Action Configuration #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineActionConfiguration { @@ -70,11 +83,14 @@ pub struct CodePipelineActionConfiguration { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineConfiguration` represents a configuration for an Action Configuration #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineConfiguration { @@ -90,11 +106,14 @@ pub struct CodePipelineConfiguration { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineInputArtifact` represents an input artifact #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineInputArtifact { @@ -108,11 +127,14 @@ pub struct CodePipelineInputArtifact { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineInputLocation` represents a input location #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineInputLocation { @@ -126,11 +148,14 @@ pub struct CodePipelineInputLocation { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineS3Location` represents an s3 input location #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineS3Location { @@ -144,11 +169,14 @@ pub struct CodePipelineS3Location { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineOutputArtifact` represents an output artifact #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineOutputArtifact { @@ -162,11 +190,14 @@ pub struct CodePipelineOutputArtifact { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineOutputLocation` represents a output location #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineOutputLocation { @@ -180,11 +211,14 @@ pub struct CodePipelineOutputLocation { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CodePipelineArtifactCredentials` represents CodePipeline artifact credentials #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct CodePipelineArtifactCredentials { @@ -200,6 +234,7 @@ pub struct CodePipelineArtifactCredentials { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/cognito/mod.rs b/lambda-events/src/event/cognito/mod.rs index d656bb59..1f323b91 100644 --- a/lambda-events/src/event/cognito/mod.rs +++ b/lambda-events/src/event/cognito/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -6,6 +8,8 @@ use crate::custom_serde::{deserialize_lambda_map, deserialize_nullish_boolean}; /// `CognitoEvent` contains data from an event sent from AWS Cognito Sync #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEvent { @@ -29,11 +33,14 @@ pub struct CognitoEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoDatasetRecord` represents a record from an AWS Cognito Sync event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoDatasetRecord { @@ -49,12 +56,15 @@ pub struct CognitoDatasetRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreSignup` is sent by AWS Cognito User Pools when a user attempts to register /// (sign up), allowing a Lambda to perform custom validation to accept or deny the registration request #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreSignup { @@ -69,6 +79,7 @@ pub struct CognitoEventUserPoolsPreSignup { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -87,6 +98,8 @@ pub enum CognitoEventUserPoolsPreSignupTriggerSource { /// `CognitoEventUserPoolsPreAuthentication` is sent by AWS Cognito User Pools when a user submits their information /// to be authenticated, allowing you to perform custom validations to accept or deny the sign in request. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreAuthentication { @@ -102,6 +115,7 @@ pub struct CognitoEventUserPoolsPreAuthentication { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -116,6 +130,8 @@ pub enum CognitoEventUserPoolsPreAuthenticationTriggerSource { /// `CognitoEventUserPoolsPostConfirmation` is sent by AWS Cognito User Pools after a user is confirmed, /// allowing the Lambda to send custom messages or add custom logic. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPostConfirmation @@ -136,6 +152,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -152,6 +169,8 @@ pub enum CognitoEventUserPoolsPostConfirmationTriggerSource { /// `CognitoEventUserPoolsPreTokenGen` is sent by AWS Cognito User Pools when a user attempts to retrieve /// credentials, allowing a Lambda to perform insert, suppress or override claims #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreTokenGen { @@ -166,6 +185,7 @@ pub struct CognitoEventUserPoolsPreTokenGen { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -188,6 +208,8 @@ pub enum CognitoEventUserPoolsPreTokenGenTriggerSource { /// `CognitoEventUserPoolsPostAuthentication` is sent by AWS Cognito User Pools after a user is authenticated, /// allowing the Lambda to add custom logic. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPostAuthentication { @@ -203,6 +225,7 @@ pub struct CognitoEventUserPoolsPostAuthentication { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -217,6 +240,8 @@ pub enum CognitoEventUserPoolsPostAuthenticationTriggerSource { /// `CognitoEventUserPoolsMigrateUser` is sent by AWS Cognito User Pools when a user does not exist in the /// user pool at the time of sign-in with a password, or in the forgot-password flow. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsMigrateUser { @@ -233,6 +258,7 @@ pub struct CognitoEventUserPoolsMigrateUser { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -248,6 +274,8 @@ pub enum CognitoEventUserPoolsMigrateUserTriggerSource { /// `CognitoEventUserPoolsCallerContext` contains information about the caller #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsCallerContext { @@ -262,11 +290,14 @@ pub struct CognitoEventUserPoolsCallerContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsHeader` contains common data from events sent by AWS Cognito User Pools #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsHeader { @@ -288,6 +319,8 @@ pub struct CognitoEventUserPoolsHeader { /// `CognitoEventUserPoolsPreSignupRequest` contains the request portion of a PreSignup event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreSignupRequest { @@ -306,11 +339,14 @@ pub struct CognitoEventUserPoolsPreSignupRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreSignupResponse` contains the response portion of a PreSignup event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreSignupResponse { @@ -323,11 +359,14 @@ pub struct CognitoEventUserPoolsPreSignupResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreAuthenticationRequest` contains the request portion of a PreAuthentication event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreAuthenticationRequest { @@ -343,11 +382,14 @@ pub struct CognitoEventUserPoolsPreAuthenticationRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreAuthenticationResponse` contains the response portion of a PreAuthentication event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct CognitoEventUserPoolsPreAuthenticationResponse { /// Catchall to catch any additional fields that were present but not explicitly defined by this struct. @@ -356,10 +398,13 @@ pub struct CognitoEventUserPoolsPreAuthenticationResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPostConfirmationRequest` contains the request portion of a PostConfirmation event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPostConfirmationRequest { @@ -375,11 +420,14 @@ pub struct CognitoEventUserPoolsPostConfirmationRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPostConfirmationResponse` contains the response portion of a PostConfirmation event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct CognitoEventUserPoolsPostConfirmationResponse { /// Catchall to catch any additional fields that were present but not explicitly defined by this struct. @@ -388,11 +436,14 @@ pub struct CognitoEventUserPoolsPostConfirmationResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreTokenGenRequest` contains request portion of PreTokenGen event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreTokenGenRequest { @@ -409,11 +460,14 @@ pub struct CognitoEventUserPoolsPreTokenGenRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreTokenGenResponse` contains the response portion of a PreTokenGen event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreTokenGenResponse { @@ -424,12 +478,15 @@ pub struct CognitoEventUserPoolsPreTokenGenResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreTokenGenV2` is sent by AWS Cognito User Pools when a user attempts to retrieve /// credentials, allowing a Lambda to perform insert, suppress or override claims. This is the Version 2 Payload #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreTokenGenV2 { @@ -444,11 +501,14 @@ pub struct CognitoEventUserPoolsPreTokenGenV2 { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPreTokenGenRequestV2` contains request portion of PreTokenGenV2 event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreTokenGenRequestV2 { @@ -466,10 +526,13 @@ pub struct CognitoEventUserPoolsPreTokenGenRequestV2 { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPreTokenGenResponseV2 { @@ -480,11 +543,14 @@ pub struct CognitoEventUserPoolsPreTokenGenResponseV2 { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ClaimsAndScopeOverrideDetailsV2` allows lambda to add, suppress or override claims in the token #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ClaimsAndScopeOverrideDetailsV2 { @@ -497,11 +563,14 @@ pub struct ClaimsAndScopeOverrideDetailsV2 { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoIdTokenGenerationV2` allows lambda to customize the ID Token before generation #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoIdTokenGenerationV2 { @@ -513,11 +582,14 @@ pub struct CognitoIdTokenGenerationV2 { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoAccessTokenGenerationV2` allows lambda to customize the Access Token before generation #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoAccessTokenGenerationV2 { @@ -531,11 +603,14 @@ pub struct CognitoAccessTokenGenerationV2 { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPostAuthenticationRequest` contains the request portion of a PostAuthentication event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsPostAuthenticationRequest { @@ -552,11 +627,14 @@ pub struct CognitoEventUserPoolsPostAuthenticationRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsPostAuthenticationResponse` contains the response portion of a PostAuthentication event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct CognitoEventUserPoolsPostAuthenticationResponse { /// Catchall to catch any additional fields that were present but not explicitly defined by this struct. @@ -565,10 +643,13 @@ pub struct CognitoEventUserPoolsPostAuthenticationResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsMigrateUserRequest` contains the request portion of a MigrateUser event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsMigrateUserRequest { @@ -586,11 +667,14 @@ pub struct CognitoEventUserPoolsMigrateUserRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsMigrateUserResponse` contains the response portion of a MigrateUser event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsMigrateUserResponse { @@ -611,11 +695,14 @@ pub struct CognitoEventUserPoolsMigrateUserResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ClaimsOverrideDetails` allows lambda to add, suppress or override claims in the token #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ClaimsOverrideDetails { @@ -630,11 +717,14 @@ pub struct ClaimsOverrideDetails { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `GroupConfiguration` allows lambda to override groups, roles and set a preferred role #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct GroupConfiguration { @@ -647,12 +737,15 @@ pub struct GroupConfiguration { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsChallengeResult` represents a challenge that is presented to the user in the authentication /// process that is underway, along with the corresponding result. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsChallengeResult { @@ -667,11 +760,14 @@ pub struct CognitoEventUserPoolsChallengeResult { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsDefineAuthChallengeRequest` defines auth challenge request parameters #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsDefineAuthChallengeRequest { @@ -690,11 +786,14 @@ pub struct CognitoEventUserPoolsDefineAuthChallengeRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsDefineAuthChallengeResponse` defines auth challenge response parameters #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsDefineAuthChallengeResponse { @@ -710,11 +809,14 @@ pub struct CognitoEventUserPoolsDefineAuthChallengeResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsDefineAuthChallenge` sent by AWS Cognito User Pools to initiate custom authentication flow #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsDefineAuthChallenge { @@ -730,6 +832,7 @@ pub struct CognitoEventUserPoolsDefineAuthChallenge { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -743,6 +846,8 @@ pub enum CognitoEventUserPoolsDefineAuthChallengeTriggerSource { /// `CognitoEventUserPoolsCreateAuthChallengeRequest` defines create auth challenge request parameters #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsCreateAuthChallengeRequest { @@ -763,11 +868,14 @@ pub struct CognitoEventUserPoolsCreateAuthChallengeRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsCreateAuthChallengeResponse` defines create auth challenge response parameters #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsCreateAuthChallengeResponse { @@ -785,11 +893,14 @@ pub struct CognitoEventUserPoolsCreateAuthChallengeResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsCreateAuthChallenge` sent by AWS Cognito User Pools to create a challenge to present to the user #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsCreateAuthChallenge { @@ -805,6 +916,7 @@ pub struct CognitoEventUserPoolsCreateAuthChallenge { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -818,6 +930,8 @@ pub enum CognitoEventUserPoolsCreateAuthChallengeTriggerSource { /// `CognitoEventUserPoolsVerifyAuthChallengeRequest` defines verify auth challenge request parameters #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsVerifyAuthChallengeRequest @@ -844,11 +958,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsVerifyAuthChallengeResponse` defines verify auth challenge response parameters #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsVerifyAuthChallengeResponse { @@ -860,12 +977,15 @@ pub struct CognitoEventUserPoolsVerifyAuthChallengeResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsVerifyAuthChallenge` sent by AWS Cognito User Pools to verify if the response from the end user /// for a custom Auth Challenge is valid or not #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsVerifyAuthChallenge { @@ -881,6 +1001,7 @@ pub struct CognitoEventUserPoolsVerifyAuthChallenge { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -895,6 +1016,8 @@ pub enum CognitoEventUserPoolsVerifyAuthChallengeTriggerSource { /// `CognitoEventUserPoolsCustomMessage` is sent by AWS Cognito User Pools before a verification or MFA message is sent, /// allowing a user to customize the message dynamically. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsCustomMessage { @@ -909,6 +1032,7 @@ pub struct CognitoEventUserPoolsCustomMessage { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -934,6 +1058,8 @@ pub enum CognitoEventUserPoolsCustomMessageTriggerSource { /// `CognitoEventUserPoolsCustomMessageRequest` contains the request portion of a CustomMessage event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsCustomMessageRequest @@ -958,11 +1084,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `CognitoEventUserPoolsCustomMessageResponse` contains the response portion of a CustomMessage event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct CognitoEventUserPoolsCustomMessageResponse { @@ -978,6 +1107,7 @@ pub struct CognitoEventUserPoolsCustomMessageResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/config/mod.rs b/lambda-events/src/event/config/mod.rs index dda9afa3..d2a1a573 100644 --- a/lambda-events/src/event/config/mod.rs +++ b/lambda-events/src/event/config/mod.rs @@ -1,9 +1,13 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; /// `ConfigEvent` contains data from an event sent from AWS Config #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConfigEvent { @@ -43,6 +47,7 @@ pub struct ConfigEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/connect/mod.rs b/lambda-events/src/event/connect/mod.rs index b5f5fe3d..d1ac4b5f 100644 --- a/lambda-events/src/event/connect/mod.rs +++ b/lambda-events/src/event/connect/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,6 +9,8 @@ use crate::custom_serde::deserialize_lambda_map; /// `ConnectEvent` contains the data structure for a Connect event. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConnectEvent { @@ -22,11 +26,14 @@ pub struct ConnectEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ConnectDetails` holds the details of a Connect event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConnectDetails { @@ -43,11 +50,14 @@ pub struct ConnectDetails { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ConnectContactData` holds all of the contact information for the user that invoked the Connect event. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConnectContactData { @@ -87,11 +97,14 @@ pub struct ConnectContactData { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ConnectEndpoint` represents routing information. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConnectEndpoint { @@ -107,11 +120,14 @@ pub struct ConnectEndpoint { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ConnectQueue` represents a queue object. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ConnectQueue { @@ -127,6 +143,7 @@ pub struct ConnectQueue { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/commom_types.rs b/lambda-events/src/event/documentdb/events/commom_types.rs index 9624901d..7c8e29c6 100644 --- a/lambda-events/src/event/documentdb/events/commom_types.rs +++ b/lambda-events/src/event/documentdb/events/commom_types.rs @@ -1,11 +1,14 @@ -use std::collections::HashMap; - +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; use serde_json::Value; +use std::collections::HashMap; pub type AnyDocument = HashMap; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct DatabaseCollection { @@ -18,10 +21,13 @@ pub struct DatabaseCollection { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct DocumentId { #[serde(rename = "_data")] @@ -32,10 +38,13 @@ pub struct DocumentId { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct DocumentKeyIdOid { #[serde(rename = "$oid")] @@ -46,10 +55,13 @@ pub struct DocumentKeyIdOid { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct DocumentKeyId { #[serde(rename = "_id")] @@ -60,10 +72,13 @@ pub struct DocumentKeyId { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct InnerTimestamp { t: usize, @@ -74,10 +89,13 @@ pub struct InnerTimestamp { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct Timestamp { #[serde(rename = "$timestamp")] @@ -88,5 +106,6 @@ pub struct Timestamp { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/delete_event.rs b/lambda-events/src/event/documentdb/events/delete_event.rs index 1c2e6afe..af5171bc 100644 --- a/lambda-events/src/event/documentdb/events/delete_event.rs +++ b/lambda-events/src/event/documentdb/events/delete_event.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentKeyId, Timestamp}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeDeleteEvent { @@ -26,5 +30,6 @@ pub struct ChangeDeleteEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/drop_database_event.rs b/lambda-events/src/event/documentdb/events/drop_database_event.rs index 2506f9cb..3858c610 100644 --- a/lambda-events/src/event/documentdb/events/drop_database_event.rs +++ b/lambda-events/src/event/documentdb/events/drop_database_event.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, Timestamp}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeDropDatabaseEvent { @@ -25,5 +29,6 @@ pub struct ChangeDropDatabaseEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/drop_event.rs b/lambda-events/src/event/documentdb/events/drop_event.rs index 42bb566b..8fbfbf0d 100644 --- a/lambda-events/src/event/documentdb/events/drop_event.rs +++ b/lambda-events/src/event/documentdb/events/drop_event.rs @@ -1,9 +1,13 @@ use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, Timestamp}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeDropEvent { @@ -24,5 +28,6 @@ pub struct ChangeDropEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/insert_event.rs b/lambda-events/src/event/documentdb/events/insert_event.rs index 0c139220..a14f6275 100644 --- a/lambda-events/src/event/documentdb/events/insert_event.rs +++ b/lambda-events/src/event/documentdb/events/insert_event.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentKeyId, Timestamp}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeInsertEvent { @@ -26,5 +30,6 @@ pub struct ChangeInsertEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/invalidate_event.rs b/lambda-events/src/event/documentdb/events/invalidate_event.rs index f721013e..da81b762 100644 --- a/lambda-events/src/event/documentdb/events/invalidate_event.rs +++ b/lambda-events/src/event/documentdb/events/invalidate_event.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use super::commom_types::{DocumentId, Timestamp}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeInvalidateEvent { @@ -19,5 +23,6 @@ pub struct ChangeInvalidateEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/rename_event.rs b/lambda-events/src/event/documentdb/events/rename_event.rs index 75797aca..86122312 100644 --- a/lambda-events/src/event/documentdb/events/rename_event.rs +++ b/lambda-events/src/event/documentdb/events/rename_event.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, Timestamp}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeRenameEvent { @@ -27,5 +31,6 @@ pub struct ChangeRenameEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/replace_event.rs b/lambda-events/src/event/documentdb/events/replace_event.rs index 0ff6ffba..e33fab04 100644 --- a/lambda-events/src/event/documentdb/events/replace_event.rs +++ b/lambda-events/src/event/documentdb/events/replace_event.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentKeyId, Timestamp}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeReplaceEvent { @@ -26,5 +30,6 @@ pub struct ChangeReplaceEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/events/update_event.rs b/lambda-events/src/event/documentdb/events/update_event.rs index 8f6a48a9..ac6b70cb 100644 --- a/lambda-events/src/event/documentdb/events/update_event.rs +++ b/lambda-events/src/event/documentdb/events/update_event.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -5,6 +7,8 @@ use serde_json::Value; use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentKeyId, Timestamp}; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UpdateTruncate { @@ -16,10 +20,13 @@ pub struct UpdateTruncate { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UpdateDescription { @@ -32,10 +39,13 @@ pub struct UpdateDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ChangeUpdateEvent { @@ -58,5 +68,6 @@ pub struct ChangeUpdateEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/documentdb/mod.rs b/lambda-events/src/event/documentdb/mod.rs index c802db62..f46130eb 100644 --- a/lambda-events/src/event/documentdb/mod.rs +++ b/lambda-events/src/event/documentdb/mod.rs @@ -5,6 +5,8 @@ use self::events::{ insert_event::ChangeInsertEvent, invalidate_event::ChangeInvalidateEvent, rename_event::ChangeRenameEvent, replace_event::ChangeReplaceEvent, update_event::ChangeUpdateEvent, }; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -24,6 +26,8 @@ pub enum ChangeEvent { } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] pub struct DocumentDbInnerEvent { pub event: ChangeEvent, @@ -33,10 +37,13 @@ pub struct DocumentDbInnerEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct DocumentDbEvent { @@ -51,6 +58,7 @@ pub struct DocumentDbEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/dynamodb/mod.rs b/lambda-events/src/event/dynamodb/mod.rs index 5b2b2db5..ce6e7fc9 100644 --- a/lambda-events/src/event/dynamodb/mod.rs +++ b/lambda-events/src/event/dynamodb/mod.rs @@ -4,6 +4,8 @@ use crate::{ time_window::*, }; use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -124,6 +126,8 @@ impl fmt::Display for KeyType { /// The `Event` stream event handled to Lambda /// #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct Event { #[serde(rename = "Records")] @@ -134,12 +138,15 @@ pub struct Event { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `TimeWindowEvent` represents an Amazon Dynamodb event when using time windows /// ref. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct TimeWindowEvent { @@ -155,11 +162,14 @@ pub struct TimeWindowEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `TimeWindowEventResponse` is the outer structure to report batch item failures for DynamoDBTimeWindowEvent. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct TimeWindowEventResponse { @@ -173,11 +183,14 @@ pub struct TimeWindowEventResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// EventRecord stores information about each record of a DynamoDb stream event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct EventRecord { @@ -241,10 +254,13 @@ pub struct EventRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UserIdentity { @@ -258,12 +274,15 @@ pub struct UserIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `DynamoDbStreamRecord` represents a description of a single data modification that was performed on an item /// in a DynamoDB table. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct StreamRecord { @@ -307,6 +326,7 @@ pub struct StreamRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/ecr_scan/mod.rs b/lambda-events/src/event/ecr_scan/mod.rs index b28678f4..f42f8adf 100644 --- a/lambda-events/src/event/ecr_scan/mod.rs +++ b/lambda-events/src/event/ecr_scan/mod.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct EcrScanEvent { @@ -29,10 +33,13 @@ pub struct EcrScanEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct EcrScanEventDetailType { @@ -55,10 +62,13 @@ pub struct EcrScanEventDetailType { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct EcrScanEventFindingSeverityCounts { @@ -86,6 +96,7 @@ pub struct EcrScanEventFindingSeverityCounts { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/eventbridge/mod.rs b/lambda-events/src/event/eventbridge/mod.rs index 824de1ef..eedb1b27 100644 --- a/lambda-events/src/event/eventbridge/mod.rs +++ b/lambda-events/src/event/eventbridge/mod.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -7,6 +9,8 @@ use serde_json::Value; /// /// See for structure details. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(bound(deserialize = "T1: DeserializeOwned"))] #[serde(rename_all = "kebab-case")] @@ -37,6 +41,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/firehose/mod.rs b/lambda-events/src/event/firehose/mod.rs index d0dec03d..ddab9ee9 100644 --- a/lambda-events/src/event/firehose/mod.rs +++ b/lambda-events/src/event/firehose/mod.rs @@ -2,6 +2,8 @@ use crate::{ custom_serde::deserialize_lambda_map, encodings::{Base64Data, MillisecondTimestamp}, }; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -9,6 +11,8 @@ use std::collections::HashMap; /// `KinesisFirehoseEvent` represents the input event from Amazon Kinesis Firehose. It is used as the input parameter. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisFirehoseEvent { @@ -29,10 +33,13 @@ pub struct KinesisFirehoseEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisFirehoseEventRecord { @@ -48,10 +55,13 @@ pub struct KinesisFirehoseEventRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisFirehoseResponse { @@ -62,10 +72,13 @@ pub struct KinesisFirehoseResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisFirehoseResponseRecord { @@ -82,10 +95,13 @@ pub struct KinesisFirehoseResponseRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisFirehoseResponseRecordMetadata { @@ -98,10 +114,13 @@ pub struct KinesisFirehoseResponseRecordMetadata { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisFirehoseRecordMetadata { @@ -119,6 +138,7 @@ pub struct KinesisFirehoseRecordMetadata { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/iam/mod.rs b/lambda-events/src/event/iam/mod.rs index fd190950..ba123fda 100644 --- a/lambda-events/src/event/iam/mod.rs +++ b/lambda-events/src/event/iam/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::{borrow::Cow, collections::HashMap, fmt}; @@ -9,6 +11,8 @@ use serde::{ /// `IamPolicyDocument` represents an IAM policy document. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "PascalCase")] pub struct IamPolicyDocument { @@ -21,11 +25,14 @@ pub struct IamPolicyDocument { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `IamPolicyStatement` represents one statement from IAM policy with action, effect and resource #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct IamPolicyStatement { @@ -44,6 +51,7 @@ pub struct IamPolicyStatement { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/iot/mod.rs b/lambda-events/src/event/iot/mod.rs index e1d7b504..9e6055d9 100644 --- a/lambda-events/src/event/iot/mod.rs +++ b/lambda-events/src/event/iot/mod.rs @@ -1,4 +1,6 @@ use crate::{custom_serde::serialize_headers, encodings::Base64Data, iam::IamPolicyDocument}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use http::HeaderMap; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] @@ -7,6 +9,8 @@ use serde_json::Value; /// `IoTCoreCustomAuthorizerRequest` represents the request to an IoT Core custom authorizer. /// See #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCoreCustomAuthorizerRequest { @@ -22,10 +26,13 @@ pub struct IoTCoreCustomAuthorizerRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCoreProtocolData { @@ -38,10 +45,13 @@ pub struct IoTCoreProtocolData { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCoreTlsContext { @@ -53,10 +63,13 @@ pub struct IoTCoreTlsContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCoreHttpContext { @@ -71,10 +84,13 @@ pub struct IoTCoreHttpContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCoreMqttContext { @@ -89,10 +105,13 @@ pub struct IoTCoreMqttContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCoreConnectionMetadata { @@ -104,12 +123,15 @@ pub struct IoTCoreConnectionMetadata { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `IoTCoreCustomAuthorizerResponse` represents the response from an IoT Core custom authorizer. /// See #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCoreCustomAuthorizerResponse { @@ -125,6 +147,7 @@ pub struct IoTCoreCustomAuthorizerResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/iot_1_click/mod.rs b/lambda-events/src/event/iot_1_click/mod.rs index a88041c0..790dd02b 100644 --- a/lambda-events/src/event/iot_1_click/mod.rs +++ b/lambda-events/src/event/iot_1_click/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,6 +10,8 @@ use crate::custom_serde::deserialize_lambda_map; /// `IoTOneClickEvent` represents a click event published by clicking button type /// device. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTOneClickEvent { @@ -20,10 +24,13 @@ pub struct IoTOneClickEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTOneClickDeviceEvent { @@ -34,10 +41,13 @@ pub struct IoTOneClickDeviceEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTOneClickButtonClicked { @@ -51,10 +61,13 @@ pub struct IoTOneClickButtonClicked { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTOneClickDeviceInfo { @@ -72,10 +85,13 @@ pub struct IoTOneClickDeviceInfo { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTOneClickPlacementInfo { @@ -95,6 +111,7 @@ pub struct IoTOneClickPlacementInfo { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/iot_button/mod.rs b/lambda-events/src/event/iot_button/mod.rs index 70a24f9d..39ce413e 100644 --- a/lambda-events/src/event/iot_button/mod.rs +++ b/lambda-events/src/event/iot_button/mod.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTButtonEvent { @@ -18,6 +22,7 @@ pub struct IoTButtonEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/iot_deprecated/mod.rs b/lambda-events/src/event/iot_deprecated/mod.rs index 22b13db9..50f45e5c 100644 --- a/lambda-events/src/event/iot_deprecated/mod.rs +++ b/lambda-events/src/event/iot_deprecated/mod.rs @@ -1,4 +1,6 @@ use crate::iot::*; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -6,6 +8,8 @@ use serde_json::Value; /// `IoTCustomAuthorizerRequest` contains data coming in to a custom IoT device gateway authorizer function. /// Deprecated: Use IoTCoreCustomAuthorizerRequest instead. `IoTCustomAuthorizerRequest` does not correctly model the request schema #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCustomAuthorizerRequest { @@ -23,6 +27,7 @@ pub struct IoTCustomAuthorizerRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -35,6 +40,8 @@ pub type IoTTlsContext = IoTCoreTlsContext; /// `IoTCustomAuthorizerResponse` represents the expected format of an IoT device gateway authorization response. /// Deprecated: Use IoTCoreCustomAuthorizerResponse. `IoTCustomAuthorizerResponse` does not correctly model the response schema. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct IoTCustomAuthorizerResponse { @@ -50,5 +57,6 @@ pub struct IoTCustomAuthorizerResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/kafka/mod.rs b/lambda-events/src/event/kafka/mod.rs index ecd02d87..46370206 100644 --- a/lambda-events/src/event/kafka/mod.rs +++ b/lambda-events/src/event/kafka/mod.rs @@ -1,10 +1,14 @@ use crate::{custom_serde::deserialize_lambda_map, encodings::MillisecondTimestamp}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::collections::HashMap; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KafkaEvent { @@ -23,10 +27,13 @@ pub struct KafkaEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KafkaRecord { @@ -46,6 +53,7 @@ pub struct KafkaRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/kinesis/analytics.rs b/lambda-events/src/event/kinesis/analytics.rs index 9ca62f69..bbbf6342 100644 --- a/lambda-events/src/event/kinesis/analytics.rs +++ b/lambda-events/src/event/kinesis/analytics.rs @@ -1,9 +1,13 @@ use crate::encodings::Base64Data; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisAnalyticsOutputDeliveryEvent { @@ -18,10 +22,13 @@ pub struct KinesisAnalyticsOutputDeliveryEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisAnalyticsOutputDeliveryEventRecord { @@ -34,10 +41,13 @@ pub struct KinesisAnalyticsOutputDeliveryEventRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisAnalyticsOutputDeliveryResponse { @@ -48,10 +58,13 @@ pub struct KinesisAnalyticsOutputDeliveryResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisAnalyticsOutputDeliveryResponseRecord { @@ -66,5 +79,6 @@ pub struct KinesisAnalyticsOutputDeliveryResponseRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/kinesis/event.rs b/lambda-events/src/event/kinesis/event.rs index 215e9288..64452ff7 100644 --- a/lambda-events/src/event/kinesis/event.rs +++ b/lambda-events/src/event/kinesis/event.rs @@ -2,11 +2,15 @@ use crate::{ encodings::{Base64Data, SecondTimestamp}, time_window::{TimeWindowEventResponseProperties, TimeWindowProperties}, }; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Default, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisEvent { @@ -18,12 +22,15 @@ pub struct KinesisEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `KinesisTimeWindowEvent` represents an Amazon Dynamodb event when using time windows /// ref. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisTimeWindowEvent { @@ -39,11 +46,14 @@ pub struct KinesisTimeWindowEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `KinesisTimeWindowEventResponse` is the outer structure to report batch item failures for KinesisTimeWindowEvent. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisTimeWindowEventResponse { @@ -57,10 +67,13 @@ pub struct KinesisTimeWindowEventResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisEventRecord { @@ -90,10 +103,13 @@ pub struct KinesisEventRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisRecord { @@ -113,6 +129,7 @@ pub struct KinesisRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/lambda_function_urls/mod.rs b/lambda-events/src/event/lambda_function_urls/mod.rs index f5771623..43fc7077 100644 --- a/lambda-events/src/event/lambda_function_urls/mod.rs +++ b/lambda-events/src/event/lambda_function_urls/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use http::HeaderMap; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] @@ -8,6 +10,8 @@ use crate::custom_serde::{deserialize_lambda_map, serialize_headers}; /// `LambdaFunctionUrlRequest` contains data coming from the HTTP request to a Lambda Function URL. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LambdaFunctionUrlRequest { @@ -34,11 +38,14 @@ pub struct LambdaFunctionUrlRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `LambdaFunctionUrlRequestContext` contains the information to identify the AWS account and resources invoking the Lambda function. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LambdaFunctionUrlRequestContext { @@ -67,11 +74,14 @@ pub struct LambdaFunctionUrlRequestContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `LambdaFunctionUrlRequestContextAuthorizerDescription` contains authorizer information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LambdaFunctionUrlRequestContextAuthorizerDescription { @@ -82,11 +92,14 @@ pub struct LambdaFunctionUrlRequestContextAuthorizerDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `LambdaFunctionUrlRequestContextAuthorizerIamDescription` contains IAM information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LambdaFunctionUrlRequestContextAuthorizerIamDescription { @@ -106,11 +119,14 @@ pub struct LambdaFunctionUrlRequestContextAuthorizerIamDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `LambdaFunctionUrlRequestContextHttpDescription` contains HTTP information for the request context. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LambdaFunctionUrlRequestContextHttpDescription { @@ -130,11 +146,14 @@ pub struct LambdaFunctionUrlRequestContextHttpDescription { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `LambdaFunctionUrlResponse` configures the HTTP response to be returned by Lambda Function URL for the request. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LambdaFunctionUrlResponse { @@ -152,5 +171,6 @@ pub struct LambdaFunctionUrlResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/lex/mod.rs b/lambda-events/src/event/lex/mod.rs index b64279d7..4ab061aa 100644 --- a/lambda-events/src/event/lex/mod.rs +++ b/lambda-events/src/event/lex/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -6,6 +8,8 @@ use std::collections::HashMap; use crate::custom_serde::deserialize_lambda_map; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LexEvent { @@ -29,10 +33,13 @@ pub struct LexEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LexBot { @@ -45,10 +52,13 @@ pub struct LexBot { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LexCurrentIntent { @@ -65,10 +75,13 @@ pub struct LexCurrentIntent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LexAlternativeIntents { @@ -85,10 +98,13 @@ pub struct LexAlternativeIntents { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SlotDetail { @@ -100,10 +116,13 @@ pub struct SlotDetail { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LexDialogAction { @@ -122,6 +141,7 @@ pub struct LexDialogAction { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -130,6 +150,8 @@ pub type SessionAttributes = HashMap; pub type Slots = HashMap>; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LexResponse { @@ -141,10 +163,13 @@ pub struct LexResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LexResponseCard { @@ -157,10 +182,13 @@ pub struct LexResponseCard { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Attachment { @@ -175,6 +203,7 @@ pub struct Attachment { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/rabbitmq/mod.rs b/lambda-events/src/event/rabbitmq/mod.rs index 5b75e3c2..61069418 100644 --- a/lambda-events/src/event/rabbitmq/mod.rs +++ b/lambda-events/src/event/rabbitmq/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -5,6 +7,8 @@ use std::collections::HashMap; use crate::custom_serde::deserialize_lambda_map; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct RabbitMqEvent { @@ -22,10 +26,13 @@ pub struct RabbitMqEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct RabbitMqMessage { @@ -39,10 +46,13 @@ pub struct RabbitMqMessage { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct RabbitMqBasicProperties @@ -79,6 +89,7 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/s3/batch_job.rs b/lambda-events/src/event/s3/batch_job.rs index 9b8f419b..43a16bb4 100644 --- a/lambda-events/src/event/s3/batch_job.rs +++ b/lambda-events/src/event/s3/batch_job.rs @@ -1,9 +1,13 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; /// `S3BatchJobEvent` encapsulates the detail of a s3 batch job #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3BatchJobEvent { @@ -19,11 +23,14 @@ pub struct S3BatchJobEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `S3BatchJob` whichs have the job id #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3BatchJob { @@ -35,11 +42,14 @@ pub struct S3BatchJob { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `S3BatchJobTask` represents one task in the s3 batch job and have all task details #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3BatchJobTask { @@ -57,11 +67,14 @@ pub struct S3BatchJobTask { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `S3BatchJobResponse` is the response of a iven s3 batch job with the results #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3BatchJobResponse { @@ -78,11 +91,14 @@ pub struct S3BatchJobResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `S3BatchJobResult` represents the result of a given task #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3BatchJobResult { @@ -98,5 +114,6 @@ pub struct S3BatchJobResult { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/s3/event.rs b/lambda-events/src/event/s3/event.rs index 68b9aee7..44627391 100644 --- a/lambda-events/src/event/s3/event.rs +++ b/lambda-events/src/event/s3/event.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,6 +10,8 @@ use crate::custom_serde::deserialize_lambda_map; /// `S3Event` which wrap an array of `S3Event`Record #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3Event { @@ -19,11 +23,14 @@ pub struct S3Event { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `S3EventRecord` which wrap record data #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3EventRecord { @@ -49,10 +56,13 @@ pub struct S3EventRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3UserIdentity { @@ -64,10 +74,13 @@ pub struct S3UserIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3RequestParameters { @@ -80,10 +93,13 @@ pub struct S3RequestParameters { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3Entity { @@ -100,10 +116,13 @@ pub struct S3Entity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3Bucket { @@ -119,10 +138,13 @@ pub struct S3Bucket { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3Object { @@ -143,6 +165,7 @@ pub struct S3Object { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/s3/object_lambda.rs b/lambda-events/src/event/s3/object_lambda.rs index be52e1f8..2d64a5e0 100644 --- a/lambda-events/src/event/s3/object_lambda.rs +++ b/lambda-events/src/event/s3/object_lambda.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use http::HeaderMap; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -8,6 +10,8 @@ use crate::custom_serde::{deserialize_headers, serialize_headers}; /// `S3ObjectLambdaEvent` contains data coming from S3 object lambdas /// See: #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct S3ObjectLambdaEvent

@@ -31,12 +35,15 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `GetObjectContext` contains the input and output details /// for connections to Amazon S3 and S3 Object Lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct GetObjectContext { @@ -49,12 +56,15 @@ pub struct GetObjectContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `HeadObjectContext` /// for connections to Amazon S3 and S3 Object Lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct HeadObjectContext { @@ -65,12 +75,15 @@ pub struct HeadObjectContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ListObjectsContext` /// for connections to Amazon S3 and S3 Object Lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ListObjectsContext { @@ -81,12 +94,15 @@ pub struct ListObjectsContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `ListObjectsV2Context` /// for connections to Amazon S3 and S3 Object Lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct ListObjectsV2Context { @@ -97,11 +113,14 @@ pub struct ListObjectsV2Context { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `Configuration` contains information about the Object Lambda access point #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct Configuration

@@ -119,11 +138,14 @@ where #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `UserRequest` contains information about the original call to S3 Object Lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UserRequest { @@ -137,11 +159,14 @@ pub struct UserRequest { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `UserIdentity` contains details about the identity that made the call to S3 Object Lambda #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct UserIdentity { @@ -157,10 +182,13 @@ pub struct UserIdentity { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SessionContext { @@ -173,10 +201,13 @@ pub struct SessionContext { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SessionIssuer { @@ -191,6 +222,7 @@ pub struct SessionIssuer { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/secretsmanager/mod.rs b/lambda-events/src/event/secretsmanager/mod.rs index 9502d654..930b5418 100644 --- a/lambda-events/src/event/secretsmanager/mod.rs +++ b/lambda-events/src/event/secretsmanager/mod.rs @@ -1,8 +1,12 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "PascalCase")] pub struct SecretsManagerSecretRotationEvent { @@ -15,6 +19,7 @@ pub struct SecretsManagerSecretRotationEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/ses/mod.rs b/lambda-events/src/event/ses/mod.rs index 31a55ea3..cb249a45 100644 --- a/lambda-events/src/event/ses/mod.rs +++ b/lambda-events/src/event/ses/mod.rs @@ -1,10 +1,14 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; /// `SimpleEmailEvent` is the outer structure of an event sent via SES. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailEvent { @@ -16,10 +20,13 @@ pub struct SimpleEmailEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailRecord { @@ -34,10 +41,13 @@ pub struct SimpleEmailRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailService { @@ -50,10 +60,13 @@ pub struct SimpleEmailService { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailMessage { @@ -72,10 +85,13 @@ pub struct SimpleEmailMessage { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailReceipt { @@ -96,10 +112,13 @@ pub struct SimpleEmailReceipt { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailHeader { @@ -113,10 +132,13 @@ pub struct SimpleEmailHeader { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailCommonHeaders { @@ -136,6 +158,7 @@ pub struct SimpleEmailCommonHeaders { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -144,6 +167,8 @@ pub struct SimpleEmailCommonHeaders { /// present for the Lambda Type, and the BucketName and ObjectKey fields are only /// present for the S3 Type. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailReceiptAction { @@ -165,10 +190,13 @@ pub struct SimpleEmailReceiptAction { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailVerdict { @@ -180,6 +208,7 @@ pub struct SimpleEmailVerdict { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -187,6 +216,8 @@ pub type SimpleEmailDispositionValue = String; /// `SimpleEmailDisposition` disposition return for SES to control rule functions #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SimpleEmailDisposition { @@ -197,6 +228,7 @@ pub struct SimpleEmailDisposition { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/sns/mod.rs b/lambda-events/src/event/sns/mod.rs index d40dd45c..c853ecab 100644 --- a/lambda-events/src/event/sns/mod.rs +++ b/lambda-events/src/event/sns/mod.rs @@ -1,4 +1,6 @@ use chrono::{DateTime, Utc}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -10,6 +12,8 @@ use crate::custom_serde::{deserialize_lambda_map, deserialize_nullish_boolean}; /// /// [https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html](https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html) #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct SnsEvent { @@ -21,11 +25,14 @@ pub struct SnsEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// SnsRecord stores information about each record of a SNS event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct SnsRecord { @@ -47,11 +54,14 @@ pub struct SnsRecord { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// SnsMessage stores information about each record of a SNS event #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct SnsMessage { @@ -104,6 +114,7 @@ pub struct SnsMessage { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -111,6 +122,8 @@ pub struct SnsMessage { /// /// [https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html](https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html) #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] #[serde(bound(deserialize = "T: DeserializeOwned"))] @@ -123,11 +136,14 @@ pub struct SnsEventObj { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// Alternative to `SnsRecord`, used alongside `SnsEventObj` and `SnsMessageObj` when deserializing nested objects from within SNS messages) #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] #[serde(bound(deserialize = "T: DeserializeOwned"))] @@ -150,11 +166,14 @@ pub struct SnsRecordObj { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// Alternate version of `SnsMessage` to use in conjunction with `SnsEventObj` and `SnsRecordObj` for deserializing the message into a struct of type `T` #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[serde_with::serde_as] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] @@ -211,6 +230,7 @@ pub struct SnsMessageObj { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -220,6 +240,8 @@ pub struct SnsMessageObj { /// /// Additional details can be found in the [SNS Developer Guide](https://docs.aws.amazon.com/sns/latest/dg/sns-message-attributes.html) #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct MessageAttribute { /// The data type of the attribute. Per the [SNS Developer Guide](https://docs.aws.amazon.com/sns/latest/dg/sns-message-attributes.html), lambda notifications, this will only be **String** or **Binary**. @@ -236,10 +258,13 @@ pub struct MessageAttribute { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CloudWatchAlarmPayload { @@ -260,10 +285,13 @@ pub struct CloudWatchAlarmPayload { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CloudWatchAlarmTrigger { @@ -288,10 +316,13 @@ pub struct CloudWatchAlarmTrigger { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CloudWatchMetricDataQuery { @@ -308,10 +339,13 @@ pub struct CloudWatchMetricDataQuery { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CloudWatchMetricStat { @@ -325,10 +359,13 @@ pub struct CloudWatchMetricStat { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct CloudWatchMetric { @@ -342,10 +379,13 @@ pub struct CloudWatchMetric { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct CloudWatchDimension { pub name: String, @@ -356,6 +396,7 @@ pub struct CloudWatchDimension { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/sqs/mod.rs b/lambda-events/src/event/sqs/mod.rs index c53f77ef..20335492 100644 --- a/lambda-events/src/event/sqs/mod.rs +++ b/lambda-events/src/event/sqs/mod.rs @@ -1,4 +1,6 @@ use crate::{custom_serde::deserialize_lambda_map, encodings::Base64Data}; +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -6,6 +8,8 @@ use std::collections::HashMap; /// The Event sent to Lambda from SQS. Contains 1 or more individual SQS Messages #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SqsEvent { @@ -17,11 +21,14 @@ pub struct SqsEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// An individual SQS Message, its metadata, and Message Attributes #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SqsMessage { @@ -55,11 +62,14 @@ pub struct SqsMessage { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// Alternative to `SqsEvent` to be used alongside `SqsMessageObj` when you need to deserialize a nested object into a struct of type `T` within the SQS Message rather than just using the raw SQS Message string #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] #[serde(bound(deserialize = "T: DeserializeOwned"))] @@ -73,11 +83,14 @@ pub struct SqsEventObj { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// Alternative to `SqsMessage` to be used alongside `SqsEventObj` when you need to deserialize a nested object into a struct of type `T` within the SQS Message rather than just using the raw SQS Message string #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[serde_with::serde_as] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(bound(deserialize = "T: DeserializeOwned"))] @@ -116,10 +129,13 @@ pub struct SqsMessageObj { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SqsMessageAttribute { @@ -137,10 +153,13 @@ pub struct SqsMessageAttribute { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SqsBatchResponse { @@ -151,6 +170,7 @@ pub struct SqsBatchResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -267,6 +287,8 @@ impl SqsBatchResponse { } #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct BatchItemFailure { @@ -277,11 +299,14 @@ pub struct BatchItemFailure { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// The Event sent to Lambda from the SQS API. Contains 1 or more individual SQS Messages #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] #[serde(bound(deserialize = "T: DeserializeOwned"))] @@ -294,11 +319,14 @@ pub struct SqsApiEventObj { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// The Event sent to Lambda from SQS API. Contains 1 or more individual SQS Messages #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct SqsApiEvent { @@ -309,6 +337,7 @@ pub struct SqsApiEvent { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -316,6 +345,8 @@ pub struct SqsApiEvent { /// deserialize a nested object into a struct of type T within the SQS Message rather /// than just using the raw SQS Message string #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[serde_with::serde_as] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(bound(deserialize = "T: DeserializeOwned"))] @@ -346,11 +377,14 @@ pub struct SqsApiMessageObj { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// An individual SQS API Message, its metadata, and Message Attributes #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "PascalCase")] pub struct SqsApiMessage { @@ -377,6 +411,7 @@ pub struct SqsApiMessage { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } diff --git a/lambda-events/src/event/streams/mod.rs b/lambda-events/src/event/streams/mod.rs index 0e174564..87f94887 100644 --- a/lambda-events/src/event/streams/mod.rs +++ b/lambda-events/src/event/streams/mod.rs @@ -1,9 +1,13 @@ +#[cfg(feature = "builders")] +use derive_builder::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; /// `KinesisEventResponse` is the outer structure to report batch item failures for KinesisEvent. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisEventResponse { @@ -14,6 +18,7 @@ pub struct KinesisEventResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } @@ -67,6 +72,8 @@ impl KinesisEventResponse { /// `KinesisBatchItemFailure` is the individual record which failed processing. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct KinesisBatchItemFailure { @@ -78,11 +85,14 @@ pub struct KinesisBatchItemFailure { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `DynamoDbEventResponse` is the outer structure to report batch item failures for DynamoDBEvent. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct DynamoDbEventResponse { @@ -93,11 +103,14 @@ pub struct DynamoDbEventResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `DynamoDbBatchItemFailure` is the individual record which failed processing. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct DynamoDbBatchItemFailure { @@ -109,11 +122,14 @@ pub struct DynamoDbBatchItemFailure { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `SqsEventResponse` is the outer structure to report batch item failures for SQSEvent. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SqsEventResponse { @@ -124,11 +140,14 @@ pub struct SqsEventResponse { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } /// `SqsBatchItemFailure` is the individual record which failed processing. #[non_exhaustive] +#[cfg_attr(feature = "builders", derive(Builder))] +#[cfg_attr(feature = "builders", builder(setter(into, strip_option)))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SqsBatchItemFailure { @@ -140,6 +159,7 @@ pub struct SqsBatchItemFailure { #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] #[serde(flatten)] + #[cfg_attr(feature = "builders", builder(default))] pub other: serde_json::Map, } From 3902588f50b16724e98cdd8fb44ecc4fb1b29a75 Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:41:31 +0000 Subject: [PATCH 2/3] fmt+fix feature flag --- .../examples/comprehensive-builders.rs | 35 ++++--------------- .../lambda-runtime-authorizer-builder.rs | 3 +- .../lambda-runtime-sqs-batch-builder.rs | 21 ++++++----- .../src/event/cloudwatch_events/tag.rs | 1 + 4 files changed, 21 insertions(+), 39 deletions(-) diff --git a/lambda-events/examples/comprehensive-builders.rs b/lambda-events/examples/comprehensive-builders.rs index 1052496e..f6d9d323 100644 --- a/lambda-events/examples/comprehensive-builders.rs +++ b/lambda-events/examples/comprehensive-builders.rs @@ -1,46 +1,26 @@ // Example demonstrating builder pattern usage for AWS Lambda events #[cfg(feature = "builders")] use aws_lambda_events::event::{ - dynamodb::EventBuilder as DynamoDbEventBuilder, - kinesis::KinesisEventBuilder, - s3::S3EventBuilder, - secretsmanager::SecretsManagerSecretRotationEventBuilder, - sns::SnsEventBuilder, - sqs::SqsEventBuilder, + dynamodb::EventBuilder as DynamoDbEventBuilder, kinesis::KinesisEventBuilder, s3::S3EventBuilder, + secretsmanager::SecretsManagerSecretRotationEventBuilder, sns::SnsEventBuilder, sqs::SqsEventBuilder, }; #[cfg(feature = "builders")] fn main() { - // S3 Event - Object storage notifications - let s3_event = S3EventBuilder::default() - .records(vec![]) - .build() - .unwrap(); + let s3_event = S3EventBuilder::default().records(vec![]).build().unwrap(); // Kinesis Event - Stream processing - let kinesis_event = KinesisEventBuilder::default() - .records(vec![]) - .build() - .unwrap(); + let kinesis_event = KinesisEventBuilder::default().records(vec![]).build().unwrap(); // DynamoDB Event - Database change streams - let dynamodb_event = DynamoDbEventBuilder::default() - .records(vec![]) - .build() - .unwrap(); + let dynamodb_event = DynamoDbEventBuilder::default().records(vec![]).build().unwrap(); // SNS Event - Pub/sub messaging - let sns_event = SnsEventBuilder::default() - .records(vec![]) - .build() - .unwrap(); + let sns_event = SnsEventBuilder::default().records(vec![]).build().unwrap(); // SQS Event - Queue messaging - let sqs_event = SqsEventBuilder::default() - .records(vec![]) - .build() - .unwrap(); + let sqs_event = SqsEventBuilder::default().records(vec![]).build().unwrap(); // Secrets Manager Event - Secret rotation let secrets_event = SecretsManagerSecretRotationEventBuilder::default() @@ -49,7 +29,6 @@ fn main() { .client_request_token("token-123") .build() .unwrap(); - } #[cfg(not(feature = "builders"))] diff --git a/lambda-events/examples/lambda-runtime-authorizer-builder.rs b/lambda-events/examples/lambda-runtime-authorizer-builder.rs index 15188503..9937df4f 100644 --- a/lambda-events/examples/lambda-runtime-authorizer-builder.rs +++ b/lambda-events/examples/lambda-runtime-authorizer-builder.rs @@ -33,8 +33,7 @@ #[cfg(feature = "builders")] use aws_lambda_events::event::apigw::{ - ApiGatewayV2CustomAuthorizerSimpleResponse, - ApiGatewayV2CustomAuthorizerSimpleResponseBuilder, + ApiGatewayV2CustomAuthorizerSimpleResponse, ApiGatewayV2CustomAuthorizerSimpleResponseBuilder, ApiGatewayV2CustomAuthorizerV2Request, }; #[cfg(feature = "builders")] diff --git a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs index 0899cdd4..e4dcc5c0 100644 --- a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs +++ b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs @@ -60,22 +60,22 @@ async fn process_record(record: &aws_lambda_events::event::sqs::SqsMessage) -> R #[allow(dead_code)] async fn function_handler_old_way(event: LambdaEvent) -> Result { let mut batch_item_failures = Vec::new(); - + for record in event.payload.records { match process_record(&record).await { Ok(_) => (), Err(_) => { let mut item = BatchItemFailure::default(); item.item_identifier = record.message_id.unwrap(); - + batch_item_failures.push(item) } } } - + let mut response = SqsBatchResponse::default(); response.batch_item_failures = batch_item_failures; - + Ok(response) } @@ -84,7 +84,7 @@ async fn function_handler_old_way(event: LambdaEvent) -> Result) -> Result { let mut batch_item_failures = Vec::new(); - + for record in event.payload.records { match process_record(&record).await { Ok(_) => (), @@ -94,18 +94,18 @@ async fn function_handler(event: LambdaEvent) -> Result Date: Thu, 15 Jan 2026 12:43:46 +0000 Subject: [PATCH 3/3] Update readme --- README.md | 74 +++++++++++++++++++++++++++++++++++++++++ lambda-events/README.md | 44 ++++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/README.md b/README.md index 3e0370be..6ff25c9b 100644 --- a/README.md +++ b/README.md @@ -449,6 +449,80 @@ By default, the log level to emit events is `INFO`. Log at `TRACE` level for mor This project includes Lambda event struct definitions, [`aws_lambda_events`](https://crates.io/crates/aws_lambda_events). This crate can be leveraged to provide strongly-typed Lambda event structs. You can create your own custom event objects and their corresponding structs as well. +### Builder pattern for event responses + +The `aws_lambda_events` crate provides an optional `builders` feature that adds builder pattern support for constructing event responses. This is particularly useful when working with custom context types that don't implement `Default`. + +Enable the builders feature in your `Cargo.toml`: + +```toml +[dependencies] +aws_lambda_events = { version = "*", features = ["builders"] } +``` + +Example with API Gateway custom authorizers: + +```rust +use aws_lambda_events::event::apigw::{ + ApiGatewayV2CustomAuthorizerSimpleResponseBuilder, + ApiGatewayV2CustomAuthorizerV2Request, +}; +use lambda_runtime::{Error, LambdaEvent}; + +struct MyContext { + user_id: String, + permissions: Vec, +} + +async fn handler( + event: LambdaEvent, +) -> Result, Error> { + let context = MyContext { + user_id: "user-123".to_string(), + permissions: vec!["read".to_string()], + }; + + let response = ApiGatewayV2CustomAuthorizerSimpleResponseBuilder::default() + .is_authorized(true) + .context(context) + .build()?; + + Ok(response) +} +``` + +Example with SQS batch responses: + +```rust +use aws_lambda_events::event::sqs::{ + BatchItemFailureBuilder, + SqsBatchResponseBuilder, + SqsEvent, +}; +use lambda_runtime::{Error, LambdaEvent}; + +async fn handler(event: LambdaEvent) -> Result { + let mut failures = Vec::new(); + + for record in event.payload.records { + if let Err(_) = process_record(&record).await { + let failure = BatchItemFailureBuilder::default() + .item_identifier(record.message_id.unwrap()) + .build()?; + failures.push(failure); + } + } + + let response = SqsBatchResponseBuilder::default() + .batch_item_failures(failures) + .build()?; + + Ok(response) +} +``` + +See the [examples directory](https://github.com/aws/aws-lambda-rust-runtime/tree/main/lambda-events/examples) for more builder pattern examples. + ### Custom event objects To serialize and deserialize events and responses, we suggest using the [`serde`](https://github.com/serde-rs/serde) library. To receive custom events, annotate your structure with Serde's macros: diff --git a/lambda-events/README.md b/lambda-events/README.md index b091916f..ebf197ea 100644 --- a/lambda-events/README.md +++ b/lambda-events/README.md @@ -27,6 +27,50 @@ This crate divides all Lambda Events into features named after the service that cargo add aws_lambda_events --no-default-features --features apigw,alb ``` +### Builder pattern support + +The crate provides an optional `builders` feature that adds builder pattern support for event types. This enables type-safe, immutable construction of event responses without requiring `Default` trait implementations on custom context types. + +Enable the builders feature: + +``` +cargo add aws_lambda_events --features builders +``` + +Example using builders with API Gateway custom authorizers: + +```rust +use aws_lambda_events::event::apigw::{ + ApiGatewayV2CustomAuthorizerSimpleResponseBuilder, + ApiGatewayV2CustomAuthorizerV2Request, +}; +use lambda_runtime::{Error, LambdaEvent}; + +// Context type without Default implementation +struct MyContext { + user_id: String, + permissions: Vec, +} + +async fn handler( + event: LambdaEvent, +) -> Result, Error> { + let context = MyContext { + user_id: "user-123".to_string(), + permissions: vec!["read".to_string()], + }; + + let response = ApiGatewayV2CustomAuthorizerSimpleResponseBuilder::default() + .is_authorized(true) + .context(context) + .build()?; + + Ok(response) +} +``` + +See the [examples directory](https://github.com/aws/aws-lambda-rust-runtime/tree/main/lambda-events/examples) for more builder pattern examples. + ## History The AWS Lambda Events crate was created by [Christian Legnitto](https://github.com/LegNeato). Without all his work and dedication, this project could have not been possible.