From 071ff5401caf8066b93d5387fb8ad305a9a7e78d 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 01/13] 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 c35da0cd..66839025 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,6 +143,7 @@ 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, } @@ -148,6 +159,8 @@ pub struct ApiGatewayProxyRequestContext { /// /// For Custom Authorizer v1 payloads, use the dedicated `ApiGatewayV2CustomAuthorizerV1Request` struct instead. #[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 { @@ -247,11 +260,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 { @@ -287,11 +303,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")] @@ -312,11 +331,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 { @@ -331,11 +353,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 { @@ -359,11 +384,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 { @@ -378,11 +406,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 { @@ -402,11 +433,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 { @@ -428,11 +462,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 { @@ -469,11 +506,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 { @@ -516,6 +556,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, } @@ -523,6 +564,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 { @@ -588,11 +631,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 { @@ -610,11 +656,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 { @@ -635,11 +684,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 { @@ -653,11 +705,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 { @@ -669,11 +724,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 { @@ -694,11 +752,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 { @@ -712,10 +773,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 { @@ -743,10 +807,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 { @@ -786,10 +853,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 { @@ -829,12 +899,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 { @@ -849,11 +922,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 { @@ -885,11 +961,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 { @@ -906,11 +985,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 { @@ -951,11 +1033,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 @@ -975,11 +1060,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 @@ -996,10 +1084,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 @@ -1018,11 +1109,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 { @@ -1035,6 +1129,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 06d9bb91e0d868f7e210c5d79c82a5302160b39b 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 02/13] 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 03/13] 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. From fa2af97ef7b53d74fc59ed2f9c1544b02af9a3f5 Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:17:31 +0000 Subject: [PATCH 04/13] feat: migrate from derive_builder to bon - Replace derive_builder dependency with bon v3 - Remove builder attribute configurations (bon handles automatically) - Update examples to use bon's cleaner API - Add tests for bon builder functionality - Maintain backward compatibility for builders feature Benefits: - Cleaner API: Struct::builder().build() vs StructBuilder::default().build().unwrap() - Automatic Option handling - No need for setter configurations - Better ergonomics --- lambda-events/Cargo.toml | 4 +- .../examples/comprehensive-builders.rs | 24 +++---- .../lambda-runtime-authorizer-builder.rs | 4 +- .../lambda-runtime-sqs-batch-builder.rs | 14 ++-- lambda-events/src/event/activemq/mod.rs | 5 +- lambda-events/src/event/alb/mod.rs | 6 +- lambda-events/src/event/apigw/mod.rs | 33 +--------- lambda-events/src/event/appsync/mod.rs | 14 +--- lambda-events/src/event/autoscaling/mod.rs | 3 +- .../src/event/bedrock_agent_runtime/mod.rs | 8 +-- lambda-events/src/event/chime_bot/mod.rs | 6 +- lambda-events/src/event/clientvpn/mod.rs | 4 +- lambda-events/src/event/cloudformation/mod.rs | 6 +- .../src/event/cloudformation/provider.rs | 7 +- .../src/event/cloudwatch_alarms/mod.rs | 15 +---- .../src/event/cloudwatch_events/cloudtrail.rs | 9 +-- .../src/event/cloudwatch_events/codedeploy.rs | 5 +- .../event/cloudwatch_events/codepipeline.rs | 6 +- .../src/event/cloudwatch_events/ec2.rs | 3 +- .../src/event/cloudwatch_events/emr.rs | 6 +- .../src/event/cloudwatch_events/gamelift.rs | 14 +--- .../src/event/cloudwatch_events/glue.rs | 10 +-- .../src/event/cloudwatch_events/health.rs | 5 +- .../src/event/cloudwatch_events/kms.rs | 3 +- .../src/event/cloudwatch_events/macie.rs | 20 +----- .../src/event/cloudwatch_events/mod.rs | 3 +- .../src/event/cloudwatch_events/opsworks.rs | 6 +- .../src/event/cloudwatch_events/signin.rs | 6 +- .../src/event/cloudwatch_events/sms.rs | 3 +- .../src/event/cloudwatch_events/ssm.rs | 16 +---- .../src/event/cloudwatch_events/tag.rs | 3 +- .../event/cloudwatch_events/trustedadvisor.rs | 3 +- .../src/event/cloudwatch_logs/mod.rs | 6 +- lambda-events/src/event/code_commit/mod.rs | 6 +- lambda-events/src/event/codebuild/mod.rs | 11 +--- lambda-events/src/event/codedeploy/mod.rs | 5 +- .../src/event/codepipeline_cloudwatch/mod.rs | 5 +- .../src/event/codepipeline_job/mod.rs | 13 +--- lambda-events/src/event/cognito/mod.rs | 45 +------------ lambda-events/src/event/config/mod.rs | 3 +- lambda-events/src/event/connect/mod.rs | 7 +- .../event/documentdb/events/commom_types.rs | 8 +-- .../event/documentdb/events/delete_event.rs | 3 +- .../documentdb/events/drop_database_event.rs | 3 +- .../src/event/documentdb/events/drop_event.rs | 3 +- .../event/documentdb/events/insert_event.rs | 3 +- .../documentdb/events/invalidate_event.rs | 3 +- .../event/documentdb/events/rename_event.rs | 3 +- .../event/documentdb/events/replace_event.rs | 3 +- .../event/documentdb/events/update_event.rs | 5 +- lambda-events/src/event/documentdb/mod.rs | 4 +- lambda-events/src/event/dynamodb/mod.rs | 8 +-- lambda-events/src/event/ecr_scan/mod.rs | 5 +- lambda-events/src/event/eventbridge/mod.rs | 3 +- lambda-events/src/event/firehose/mod.rs | 8 +-- lambda-events/src/event/iam/mod.rs | 4 +- lambda-events/src/event/iot/mod.rs | 9 +-- lambda-events/src/event/iot_1_click/mod.rs | 7 +- lambda-events/src/event/iot_button/mod.rs | 3 +- lambda-events/src/event/iot_deprecated/mod.rs | 4 +- lambda-events/src/event/kafka/mod.rs | 4 +- lambda-events/src/event/kinesis/analytics.rs | 6 +- lambda-events/src/event/kinesis/event.rs | 7 +- .../src/event/lambda_function_urls/mod.rs | 8 +-- lambda-events/src/event/lex/mod.rs | 11 +--- lambda-events/src/event/rabbitmq/mod.rs | 5 +- lambda-events/src/event/s3/batch_job.rs | 7 +- lambda-events/src/event/s3/event.rs | 9 +-- lambda-events/src/event/s3/object_lambda.rs | 12 +--- lambda-events/src/event/secretsmanager/mod.rs | 3 +- lambda-events/src/event/ses/mod.rs | 12 +--- lambda-events/src/event/sns/mod.rs | 15 +---- lambda-events/src/event/sqs/mod.rs | 64 +++++++++++++++---- lambda-events/src/event/streams/mod.rs | 8 +-- 74 files changed, 143 insertions(+), 492 deletions(-) diff --git a/lambda-events/Cargo.toml b/lambda-events/Cargo.toml index 01d7e5c8..3d558786 100644 --- a/lambda-events/Cargo.toml +++ b/lambda-events/Cargo.toml @@ -20,7 +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 } +bon = { version = "3", optional = true } flate2 = { version = "1.0.24", optional = true } http = { workspace = true, optional = true } http-body = { workspace = true, optional = true } @@ -127,7 +127,7 @@ documentdb = [] eventbridge = ["chrono", "serde_with"] catch-all-fields = [] -builders = ["derive_builder"] +builders = ["bon"] [package.metadata.docs.rs] all-features = true diff --git a/lambda-events/examples/comprehensive-builders.rs b/lambda-events/examples/comprehensive-builders.rs index f6d9d323..3e957314 100644 --- a/lambda-events/examples/comprehensive-builders.rs +++ b/lambda-events/examples/comprehensive-builders.rs @@ -1,33 +1,33 @@ // 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::Event as DynamoDbEvent, kinesis::KinesisEvent, s3::S3Event, + secretsmanager::SecretsManagerSecretRotationEvent, sns::SnsEvent, sqs::SqsEvent, }; #[cfg(feature = "builders")] fn main() { // S3 Event - Object storage notifications - let s3_event = S3EventBuilder::default().records(vec![]).build().unwrap(); + let s3_event = S3Event::builder().records(vec![]).build(); // Kinesis Event - Stream processing - let kinesis_event = KinesisEventBuilder::default().records(vec![]).build().unwrap(); + let kinesis_event = KinesisEvent::builder().records(vec![]).build(); // DynamoDB Event - Database change streams - let dynamodb_event = DynamoDbEventBuilder::default().records(vec![]).build().unwrap(); + let dynamodb_event = DynamoDbEvent::builder().records(vec![]).build(); // SNS Event - Pub/sub messaging - let sns_event = SnsEventBuilder::default().records(vec![]).build().unwrap(); + let sns_event = SnsEvent::builder().records(vec![]).build(); // SQS Event - Queue messaging - let sqs_event = SqsEventBuilder::default().records(vec![]).build().unwrap(); + let sqs_event = SqsEvent::builder().records(vec![]).build(); // Secrets Manager Event - Secret rotation - let secrets_event = SecretsManagerSecretRotationEventBuilder::default() - .step("createSecret") - .secret_id("test-secret") - .client_request_token("token-123") - .build() + let secrets_event = SecretsManagerSecretRotationEvent::builder() + .step("createSecret".to_string()) + .secret_id("test-secret".to_string()) + .client_request_token("token-123".to_string()) + .build(); .unwrap(); } diff --git a/lambda-events/examples/lambda-runtime-authorizer-builder.rs b/lambda-events/examples/lambda-runtime-authorizer-builder.rs index 9937df4f..ff485cce 100644 --- a/lambda-events/examples/lambda-runtime-authorizer-builder.rs +++ b/lambda-events/examples/lambda-runtime-authorizer-builder.rs @@ -20,7 +20,7 @@ // some_thing: ThirdPartyThing, // } // -// let output = ResponseBuilder::default() +// let output = Response::builder() // .is_authorized(true) // .context(context) // .build()?; @@ -105,7 +105,7 @@ pub async fn function_handler( }; // ✅ Clean builder pattern - no Default required! - let output = ApiGatewayV2CustomAuthorizerSimpleResponseBuilder::default() + let output = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() .is_authorized(true) .context(context) .build() diff --git a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs index e4dcc5c0..3103f134 100644 --- a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs +++ b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs @@ -18,14 +18,14 @@ // for record in event.payload.records { // match process_record(&record).await { // Err(_) => { -// let item = BatchItemFailureBuilder::default() +// let item = BatchItemFailure::builder() // .item_identifier(record.message_id.unwrap()) // .build()?; // batch_item_failures.push(item) // } // } // } -// let response = SqsBatchResponseBuilder::default() +// let response = SqsBatchResponse::builder() // .batch_item_failures(batch_item_failures) // .build()?; // @@ -90,7 +90,7 @@ async fn function_handler(event: LambdaEvent) -> Result (), Err(_) => { // ✅ Clean builder construction - let item = BatchItemFailureBuilder::default() + let item = BatchItemFailure::builder() .item_identifier(record.message_id.unwrap()) .build() .unwrap(); @@ -101,7 +101,7 @@ async fn function_handler(event: LambdaEvent) -> Result) -> Result @@ -1067,7 +1039,6 @@ where /// `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 @@ -1090,7 +1061,6 @@ where #[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 @@ -1116,7 +1086,6 @@ where /// `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 { diff --git a/lambda-events/src/event/appsync/mod.rs b/lambda-events/src/event/appsync/mod.rs index 2348b1ee..87370939 100644 --- a/lambda-events/src/event/appsync/mod.rs +++ b/lambda-events/src/event/appsync/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -9,7 +9,6 @@ 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 @@ -35,7 +34,6 @@ where /// `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 { @@ -67,7 +65,6 @@ pub struct AppSyncIamIdentity { /// `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 @@ -103,7 +100,6 @@ 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 { @@ -124,7 +120,6 @@ pub struct AppSyncLambdaAuthorizerRequest { /// 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 @@ -160,7 +155,6 @@ where /// `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 @@ -199,7 +193,6 @@ where /// - [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 @@ -232,7 +225,6 @@ where /// 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 { @@ -255,7 +247,6 @@ pub struct AppSyncRequest { /// `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 @@ -283,7 +274,6 @@ where /// `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 @@ -322,7 +312,6 @@ 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 @@ -345,7 +334,6 @@ where /// `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 diff --git a/lambda-events/src/event/autoscaling/mod.rs b/lambda-events/src/event/autoscaling/mod.rs index 83b2e7ea..889a05bb 100644 --- a/lambda-events/src/event/autoscaling/mod.rs +++ b/lambda-events/src/event/autoscaling/mod.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -10,7 +10,6 @@ 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 diff --git a/lambda-events/src/event/bedrock_agent_runtime/mod.rs b/lambda-events/src/event/bedrock_agent_runtime/mod.rs index ff725a72..ba67b3fa 100644 --- a/lambda-events/src/event/bedrock_agent_runtime/mod.rs +++ b/lambda-events/src/event/bedrock_agent_runtime/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ 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 { @@ -48,7 +47,6 @@ pub struct AgentEvent { #[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 { @@ -66,7 +64,6 @@ pub struct RequestBody { #[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 { @@ -84,7 +81,6 @@ pub struct Content { #[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 { @@ -106,7 +102,6 @@ pub struct Property { #[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 { @@ -128,7 +123,6 @@ pub struct Parameter { #[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 { diff --git a/lambda-events/src/event/chime_bot/mod.rs b/lambda-events/src/event/chime_bot/mod.rs index 6494eb82..a51db107 100644 --- a/lambda-events/src/event/chime_bot/mod.rs +++ b/lambda-events/src/event/chime_bot/mod.rs @@ -1,13 +1,12 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -36,7 +35,6 @@ pub struct ChimeBotEvent { #[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 { @@ -58,7 +56,6 @@ pub struct ChimeBotEventSender { #[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 { @@ -80,7 +77,6 @@ pub struct ChimeBotEventDiscussion { #[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 { diff --git a/lambda-events/src/event/clientvpn/mod.rs b/lambda-events/src/event/clientvpn/mod.rs index 60f02316..d3a6f2e4 100644 --- a/lambda-events/src/event/clientvpn/mod.rs +++ b/lambda-events/src/event/clientvpn/mod.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -48,7 +47,6 @@ pub struct ClientVpnConnectionHandlerRequest { #[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 { diff --git a/lambda-events/src/event/cloudformation/mod.rs b/lambda-events/src/event/cloudformation/mod.rs index 31da2a70..ac937ac3 100644 --- a/lambda-events/src/event/cloudformation/mod.rs +++ b/lambda-events/src/event/cloudformation/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -30,7 +30,6 @@ 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 @@ -59,7 +58,6 @@ 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 @@ -92,7 +90,6 @@ 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 @@ -122,7 +119,6 @@ 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 CloudFormationCustomResourceResponse { diff --git a/lambda-events/src/event/cloudformation/provider.rs b/lambda-events/src/event/cloudformation/provider.rs index a988ca83..4c9cbc13 100644 --- a/lambda-events/src/event/cloudformation/provider.rs +++ b/lambda-events/src/event/cloudformation/provider.rs @@ -5,7 +5,7 @@ //! See for details. #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -33,7 +33,6 @@ 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 @@ -47,7 +46,6 @@ 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 @@ -67,7 +65,6 @@ 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 @@ -83,7 +80,6 @@ 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 @@ -108,7 +104,6 @@ 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 CloudFormationCustomResourceResponse diff --git a/lambda-events/src/event/cloudwatch_alarms/mod.rs b/lambda-events/src/event/cloudwatch_alarms/mod.rs index 54a26769..aa66a7de 100644 --- a/lambda-events/src/event/cloudwatch_alarms/mod.rs +++ b/lambda-events/src/event/cloudwatch_alarms/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use std::collections::HashMap; use chrono::{DateTime, Utc}; @@ -16,7 +16,6 @@ use serde_json::Value; /// 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 @@ -58,7 +57,6 @@ pub type CloudWatchCompositeAlarm = #[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 @@ -87,7 +85,6 @@ where #[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 @@ -115,7 +112,6 @@ where #[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 { @@ -135,7 +131,6 @@ pub struct CloudWatchMetricAlarmConfiguration { #[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 { @@ -155,7 +150,6 @@ pub struct CloudWatchMetricDefinition { #[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 { @@ -177,7 +171,6 @@ pub struct CloudWatchMetricStatDefinition { #[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 { @@ -197,7 +190,6 @@ pub struct CloudWatchMetricStatMetricDefinition { #[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 { @@ -241,7 +233,6 @@ 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 { @@ -276,7 +267,6 @@ pub struct CloudWatchAlarmStateReasonDataMetric { #[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 { @@ -299,7 +289,6 @@ pub struct CloudWatchAlarmStateEvaluatedDatapoint { #[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 { @@ -317,7 +306,6 @@ pub struct ClodWatchAlarmStateReasonDataComposite { #[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 { @@ -335,7 +323,6 @@ pub struct CloudWatchAlarmStateTriggeringAlarm { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/cloudtrail.rs b/lambda-events/src/event/cloudwatch_events/cloudtrail.rs index bed1d400..609e72f1 100644 --- a/lambda-events/src/event/cloudwatch_events/cloudtrail.rs +++ b/lambda-events/src/event/cloudwatch_events/cloudtrail.rs @@ -1,12 +1,11 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -40,7 +39,6 @@ pub struct AWSAPICall { #[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 { @@ -61,7 +59,6 @@ pub struct SessionIssuer { #[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 { @@ -79,7 +76,6 @@ pub struct WebIdFederationData { #[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 { @@ -97,7 +93,6 @@ pub struct 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 SessionContext { @@ -118,7 +113,6 @@ pub struct SessionContext { #[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 { @@ -137,7 +131,6 @@ pub struct OnBehalfOf { // 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 { diff --git a/lambda-events/src/event/cloudwatch_events/codedeploy.rs b/lambda-events/src/event/cloudwatch_events/codedeploy.rs index a456e3a6..7542844c 100644 --- a/lambda-events/src/event/cloudwatch_events/codedeploy.rs +++ b/lambda-events/src/event/cloudwatch_events/codedeploy.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -28,7 +27,6 @@ pub struct StateChangeNotification { #[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 { @@ -51,7 +49,6 @@ pub struct DeploymentStateChangeNotification { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/codepipeline.rs b/lambda-events/src/event/cloudwatch_events/codepipeline.rs index 05679700..a647281e 100644 --- a/lambda-events/src/event/cloudwatch_events/codepipeline.rs +++ b/lambda-events/src/event/cloudwatch_events/codepipeline.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -27,7 +26,6 @@ pub struct PipelineExecutionStateChange { #[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 { @@ -49,7 +47,6 @@ pub struct StageExecutionStateChange { #[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 { @@ -75,7 +72,6 @@ pub struct ActionExecutionStateChange { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/ec2.rs b/lambda-events/src/event/cloudwatch_events/ec2.rs index c414477a..ba668ac3 100644 --- a/lambda-events/src/event/cloudwatch_events/ec2.rs +++ b/lambda-events/src/event/cloudwatch_events/ec2.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { diff --git a/lambda-events/src/event/cloudwatch_events/emr.rs b/lambda-events/src/event/cloudwatch_events/emr.rs index 7c46b727..d6057381 100644 --- a/lambda-events/src/event/cloudwatch_events/emr.rs +++ b/lambda-events/src/event/cloudwatch_events/emr.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -27,7 +26,6 @@ pub struct AutoScalingPolicyStateChange { #[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 { @@ -49,7 +47,6 @@ pub struct ClusterStateChange { #[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 { @@ -75,7 +72,6 @@ pub struct InstanceGroupStateChange { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/gamelift.rs b/lambda-events/src/event/cloudwatch_events/gamelift.rs index 395d7df4..875ff2ec 100644 --- a/lambda-events/src/event/cloudwatch_events/gamelift.rs +++ b/lambda-events/src/event/cloudwatch_events/gamelift.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ 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 { @@ -28,7 +27,6 @@ pub struct MatchmakingSearching { #[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 { @@ -47,7 +45,6 @@ pub struct Ticket { #[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 { @@ -68,7 +65,6 @@ pub struct Player { #[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 { @@ -85,7 +81,6 @@ pub struct GameSessionInfo { #[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 { @@ -108,7 +103,6 @@ pub struct PotentialMatchCreated { #[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 { @@ -127,7 +121,6 @@ pub struct RuleEvaluationMetric { #[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 { @@ -147,7 +140,6 @@ pub struct AcceptMatch { #[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 { @@ -168,7 +160,6 @@ pub struct AcceptMatchCompleted { #[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 { @@ -188,7 +179,6 @@ pub struct MatchmakingSucceeded { #[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 { @@ -210,7 +200,6 @@ pub struct MatchmakingTimedOut { #[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 { @@ -232,7 +221,6 @@ pub struct MatchmakingCancelled { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/glue.rs b/lambda-events/src/event/cloudwatch_events/glue.rs index 3b63680d..d85eebd9 100644 --- a/lambda-events/src/event/cloudwatch_events/glue.rs +++ b/lambda-events/src/event/cloudwatch_events/glue.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -27,7 +26,6 @@ pub struct JobRunStateChange { #[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 { @@ -48,7 +46,6 @@ pub struct CrawlerStarted { #[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 { @@ -79,7 +76,6 @@ pub struct CrawlerSucceeded { #[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 { @@ -101,7 +97,6 @@ pub struct CrawlerFailed { #[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 { @@ -124,7 +119,6 @@ pub struct JobRunStatus { #[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 { @@ -142,7 +136,6 @@ pub struct NotificationCondition { #[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 { @@ -162,7 +155,6 @@ pub struct DataCatalogTableStateChange { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/health.rs b/lambda-events/src/event/cloudwatch_events/health.rs index 4cbb325f..727c2e54 100644 --- a/lambda-events/src/event/cloudwatch_events/health.rs +++ b/lambda-events/src/event/cloudwatch_events/health.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,7 +7,6 @@ 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 { @@ -31,7 +30,6 @@ pub struct 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 EventDescription { @@ -49,7 +47,6 @@ pub struct EventDescription { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/kms.rs b/lambda-events/src/event/cloudwatch_events/kms.rs index 62a66267..23e12456 100644 --- a/lambda-events/src/event/cloudwatch_events/kms.rs +++ b/lambda-events/src/event/cloudwatch_events/kms.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { diff --git a/lambda-events/src/event/cloudwatch_events/macie.rs b/lambda-events/src/event/cloudwatch_events/macie.rs index cac8cb62..a715070f 100644 --- a/lambda-events/src/event/cloudwatch_events/macie.rs +++ b/lambda-events/src/event/cloudwatch_events/macie.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] @@ -8,7 +8,6 @@ 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 { @@ -42,7 +41,6 @@ pub type BucketContainsHighRiskObjectAlert = Alert #[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 diff --git a/lambda-events/src/event/cloudwatch_events/opsworks.rs b/lambda-events/src/event/cloudwatch_events/opsworks.rs index 518a1adc..aeb210a0 100644 --- a/lambda-events/src/event/cloudwatch_events/opsworks.rs +++ b/lambda-events/src/event/cloudwatch_events/opsworks.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -34,7 +33,6 @@ pub struct InstanceStateChange { #[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 { @@ -56,7 +54,6 @@ pub struct CommandStateChange { #[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 { @@ -81,7 +78,6 @@ pub struct DeploymentStateChange { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/signin.rs b/lambda-events/src/event/cloudwatch_events/signin.rs index 888bcffc..4864f537 100644 --- a/lambda-events/src/event/cloudwatch_events/signin.rs +++ b/lambda-events/src/event/cloudwatch_events/signin.rs @@ -1,11 +1,10 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -36,7 +35,6 @@ pub struct SignIn { #[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 { @@ -56,7 +54,6 @@ pub struct UserIdentity { #[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 { @@ -74,7 +71,6 @@ pub struct ResponseElements { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/sms.rs b/lambda-events/src/event/cloudwatch_events/sms.rs index 7b919707..3a63acae 100644 --- a/lambda-events/src/event/cloudwatch_events/sms.rs +++ b/lambda-events/src/event/cloudwatch_events/sms.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { diff --git a/lambda-events/src/event/cloudwatch_events/ssm.rs b/lambda-events/src/event/cloudwatch_events/ssm.rs index 87f00a41..d71f03e4 100644 --- a/lambda-events/src/event/cloudwatch_events/ssm.rs +++ b/lambda-events/src/event/cloudwatch_events/ssm.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,7 +7,6 @@ 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 { @@ -41,7 +40,6 @@ pub struct EC2AutomationStepStatusChange { #[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 { @@ -73,7 +71,6 @@ pub struct EC2AutomationExecutionStatusChange { #[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 { @@ -92,7 +89,6 @@ pub struct StateChange { #[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 { @@ -121,7 +117,6 @@ pub struct ConfigurationComplianceStateChange { #[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 { @@ -142,7 +137,6 @@ pub struct MaintenanceWindowTargetRegistration { #[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 { @@ -167,7 +161,6 @@ pub struct MaintenanceWindowExecutionStateChange { #[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 { @@ -194,7 +187,6 @@ pub struct MaintenanceWindowTaskExecutionStateChange { #[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 { @@ -225,7 +217,6 @@ pub struct MaintenanceWindowTaskTargetInvocationStateChange { #[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 { @@ -244,7 +235,6 @@ pub struct MaintenanceWindowStateChange { #[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 { @@ -264,7 +254,6 @@ pub struct ParameterStoreStateChange { #[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 { @@ -290,7 +279,6 @@ pub struct EC2CommandStatusChange { #[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 { @@ -315,7 +303,6 @@ pub struct EC2CommandInvocationStatusChange { #[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 { @@ -355,7 +342,6 @@ pub struct EC2StateManagerAssociationStateChange { #[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 { diff --git a/lambda-events/src/event/cloudwatch_events/tag.rs b/lambda-events/src/event/cloudwatch_events/tag.rs index 87eee620..076af690 100644 --- a/lambda-events/src/event/cloudwatch_events/tag.rs +++ b/lambda-events/src/event/cloudwatch_events/tag.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::collections::HashMap; @@ -8,7 +8,6 @@ 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 { diff --git a/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs b/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs index 010c0dc7..f852c923 100644 --- a/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs +++ b/lambda-events/src/event/cloudwatch_events/trustedadvisor.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,7 +7,6 @@ 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 { diff --git a/lambda-events/src/event/cloudwatch_logs/mod.rs b/lambda-events/src/event/cloudwatch_logs/mod.rs index a3f35bfe..70a9361a 100644 --- a/lambda-events/src/event/cloudwatch_logs/mod.rs +++ b/lambda-events/src/event/cloudwatch_logs/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{ de::{Error, MapAccess, Visitor}, ser::{Error as SeError, SerializeStruct}, @@ -14,7 +14,6 @@ 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 @@ -33,7 +32,6 @@ pub struct LogsEvent { /// `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 @@ -43,7 +41,6 @@ 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 { @@ -72,7 +69,6 @@ pub struct LogData { /// `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 diff --git a/lambda-events/src/event/code_commit/mod.rs b/lambda-events/src/event/code_commit/mod.rs index 0a2cff6e..297c3795 100644 --- a/lambda-events/src/event/code_commit/mod.rs +++ b/lambda-events/src/event/code_commit/mod.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -10,7 +10,6 @@ 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 { @@ -31,7 +30,6 @@ 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 { @@ -75,7 +73,6 @@ pub struct CodeCommitRecord { /// `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 { @@ -96,7 +93,6 @@ pub struct CodeCommitCodeCommit { /// `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 { diff --git a/lambda-events/src/event/codebuild/mod.rs b/lambda-events/src/event/codebuild/mod.rs index 475e3339..c9e15956 100644 --- a/lambda-events/src/event/codebuild/mod.rs +++ b/lambda-events/src/event/codebuild/mod.rs @@ -4,7 +4,7 @@ use crate::{ }; use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -16,7 +16,6 @@ pub type CodeBuildPhaseType = String; /// #[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 { @@ -62,7 +61,6 @@ pub struct CodeBuildEvent { /// `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 { @@ -113,7 +111,6 @@ pub struct CodeBuildEventDetail { /// `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 { @@ -149,7 +146,6 @@ pub struct CodeBuildEventAdditionalInformation { /// `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 { @@ -174,7 +170,6 @@ pub struct CodeBuildArtifact { /// `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 { @@ -202,7 +197,6 @@ pub struct CodeBuildEnvironment { /// `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 { @@ -228,7 +222,6 @@ pub struct CodeBuildEnvironmentVariable { /// `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 { @@ -249,7 +242,6 @@ pub struct CodeBuildSource { /// `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 { @@ -275,7 +267,6 @@ pub struct CodeBuildLogs { /// `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 diff --git a/lambda-events/src/event/codedeploy/mod.rs b/lambda-events/src/event/codedeploy/mod.rs index 74369326..d368b3b3 100644 --- a/lambda-events/src/event/codedeploy/mod.rs +++ b/lambda-events/src/event/codedeploy/mod.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -11,7 +11,6 @@ pub type CodeDeployDeploymentState = String; /// #[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 { @@ -57,7 +56,6 @@ pub struct CodeDeployEvent { #[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 { @@ -93,7 +91,6 @@ pub struct CodeDeployEventDetail { #[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 { diff --git a/lambda-events/src/event/codepipeline_cloudwatch/mod.rs b/lambda-events/src/event/codepipeline_cloudwatch/mod.rs index 0d6cb65b..f4bc5001 100644 --- a/lambda-events/src/event/codepipeline_cloudwatch/mod.rs +++ b/lambda-events/src/event/codepipeline_cloudwatch/mod.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -15,7 +15,6 @@ pub type CodePipelineActionState = String; /// #[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 { @@ -61,7 +60,6 @@ pub struct CodePipelineCloudWatchEvent { #[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 { @@ -92,7 +90,6 @@ pub struct CodePipelineEventDetail { #[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 { diff --git a/lambda-events/src/event/codepipeline_job/mod.rs b/lambda-events/src/event/codepipeline_job/mod.rs index 5085f96d..388accca 100644 --- a/lambda-events/src/event/codepipeline_job/mod.rs +++ b/lambda-events/src/event/codepipeline_job/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,7 +7,6 @@ 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 { @@ -26,7 +25,6 @@ pub struct CodePipelineJobEvent { /// `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 { @@ -48,7 +46,6 @@ pub struct CodePipelineJob { /// `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 { @@ -72,7 +69,6 @@ pub struct CodePipelineData { /// `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 { @@ -90,7 +86,6 @@ pub struct CodePipelineActionConfiguration { /// `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 { @@ -113,7 +108,6 @@ pub struct CodePipelineConfiguration { /// `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 { @@ -134,7 +128,6 @@ pub struct CodePipelineInputArtifact { /// `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 { @@ -155,7 +148,6 @@ pub struct CodePipelineInputLocation { /// `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 { @@ -176,7 +168,6 @@ pub struct CodePipelineS3Location { /// `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 { @@ -197,7 +188,6 @@ pub struct CodePipelineOutputArtifact { /// `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 { @@ -218,7 +208,6 @@ pub struct CodePipelineOutputLocation { /// `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 { diff --git a/lambda-events/src/event/cognito/mod.rs b/lambda-events/src/event/cognito/mod.rs index 1f323b91..1e3740fe 100644 --- a/lambda-events/src/event/cognito/mod.rs +++ b/lambda-events/src/event/cognito/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -9,7 +9,6 @@ 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 { @@ -40,7 +39,6 @@ pub struct CognitoEvent { /// `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 { @@ -64,7 +62,6 @@ pub struct CognitoDatasetRecord { /// (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 { @@ -99,7 +96,6 @@ pub enum CognitoEventUserPoolsPreSignupTriggerSource { /// 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 { @@ -131,7 +127,6 @@ pub enum CognitoEventUserPoolsPreAuthenticationTriggerSource { /// 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 @@ -170,7 +165,6 @@ pub enum CognitoEventUserPoolsPostConfirmationTriggerSource { /// 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 { @@ -209,7 +203,6 @@ pub enum CognitoEventUserPoolsPreTokenGenTriggerSource { /// 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 { @@ -241,7 +234,6 @@ pub enum CognitoEventUserPoolsPostAuthenticationTriggerSource { /// 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 { @@ -275,7 +267,6 @@ 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 { @@ -297,7 +288,6 @@ pub struct CognitoEventUserPoolsCallerContext { /// `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 { @@ -320,7 +310,6 @@ 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 { @@ -346,7 +335,6 @@ pub struct CognitoEventUserPoolsPreSignupRequest { /// `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 { @@ -366,7 +354,6 @@ pub struct CognitoEventUserPoolsPreSignupResponse { /// `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 { @@ -389,7 +376,6 @@ pub struct CognitoEventUserPoolsPreAuthenticationRequest { /// `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. @@ -404,7 +390,6 @@ pub struct CognitoEventUserPoolsPreAuthenticationResponse { /// `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 { @@ -427,7 +412,6 @@ pub struct CognitoEventUserPoolsPostConfirmationRequest { /// `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. @@ -443,7 +427,6 @@ pub struct CognitoEventUserPoolsPostConfirmationResponse { /// `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 { @@ -467,7 +450,6 @@ pub struct CognitoEventUserPoolsPreTokenGenRequest { /// `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 { @@ -486,7 +468,6 @@ pub struct CognitoEventUserPoolsPreTokenGenResponse { /// 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 { @@ -508,7 +489,6 @@ pub struct CognitoEventUserPoolsPreTokenGenV2 { /// `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 { @@ -532,7 +512,6 @@ pub struct CognitoEventUserPoolsPreTokenGenRequestV2 { #[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 { @@ -550,7 +529,6 @@ pub struct CognitoEventUserPoolsPreTokenGenResponseV2 { /// `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 { @@ -570,7 +548,6 @@ pub struct ClaimsAndScopeOverrideDetailsV2 { /// `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 { @@ -589,7 +566,6 @@ pub struct CognitoIdTokenGenerationV2 { /// `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 { @@ -610,7 +586,6 @@ pub struct CognitoAccessTokenGenerationV2 { /// `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 { @@ -634,7 +609,6 @@ pub struct CognitoEventUserPoolsPostAuthenticationRequest { /// `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. @@ -649,7 +623,6 @@ pub struct CognitoEventUserPoolsPostAuthenticationResponse { /// `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 { @@ -674,7 +647,6 @@ pub struct CognitoEventUserPoolsMigrateUserRequest { /// `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 { @@ -702,7 +674,6 @@ pub struct CognitoEventUserPoolsMigrateUserResponse { /// `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 { @@ -724,7 +695,6 @@ pub struct ClaimsOverrideDetails { /// `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 { @@ -745,7 +715,6 @@ pub struct GroupConfiguration { /// 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 { @@ -767,7 +736,6 @@ pub struct CognitoEventUserPoolsChallengeResult { /// `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 { @@ -793,7 +761,6 @@ pub struct CognitoEventUserPoolsDefineAuthChallengeRequest { /// `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 { @@ -816,7 +783,6 @@ pub struct CognitoEventUserPoolsDefineAuthChallengeResponse { /// `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 { @@ -847,7 +813,6 @@ 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 { @@ -875,7 +840,6 @@ pub struct CognitoEventUserPoolsCreateAuthChallengeRequest { /// `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 { @@ -900,7 +864,6 @@ pub struct CognitoEventUserPoolsCreateAuthChallengeResponse { /// `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 { @@ -931,7 +894,6 @@ 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 @@ -965,7 +927,6 @@ where /// `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 { @@ -985,7 +946,6 @@ pub struct CognitoEventUserPoolsVerifyAuthChallengeResponse { /// 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 { @@ -1017,7 +977,6 @@ pub enum CognitoEventUserPoolsVerifyAuthChallengeTriggerSource { /// 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 { @@ -1059,7 +1018,6 @@ 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 @@ -1091,7 +1049,6 @@ where /// `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 { diff --git a/lambda-events/src/event/config/mod.rs b/lambda-events/src/event/config/mod.rs index d2a1a573..81cfd438 100644 --- a/lambda-events/src/event/config/mod.rs +++ b/lambda-events/src/event/config/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,7 +7,6 @@ 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 { diff --git a/lambda-events/src/event/connect/mod.rs b/lambda-events/src/event/connect/mod.rs index d1ac4b5f..01c1ace6 100644 --- a/lambda-events/src/event/connect/mod.rs +++ b/lambda-events/src/event/connect/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -10,7 +10,6 @@ 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 { @@ -33,7 +32,6 @@ pub struct ConnectEvent { /// `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 { @@ -57,7 +55,6 @@ pub struct ConnectDetails { /// `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 { @@ -104,7 +101,6 @@ pub struct ConnectContactData { /// `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 { @@ -127,7 +123,6 @@ pub struct ConnectEndpoint { /// `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 { diff --git a/lambda-events/src/event/documentdb/events/commom_types.rs b/lambda-events/src/event/documentdb/events/commom_types.rs index 7c8e29c6..16c31213 100644 --- a/lambda-events/src/event/documentdb/events/commom_types.rs +++ b/lambda-events/src/event/documentdb/events/commom_types.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -8,7 +8,6 @@ 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 { @@ -27,7 +26,6 @@ pub struct DatabaseCollection { #[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")] @@ -44,7 +42,6 @@ pub struct DocumentId { #[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")] @@ -61,7 +58,6 @@ pub struct DocumentKeyIdOid { #[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")] @@ -78,7 +74,6 @@ pub struct DocumentKeyId { #[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, @@ -95,7 +90,6 @@ pub struct InnerTimestamp { #[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")] diff --git a/lambda-events/src/event/documentdb/events/delete_event.rs b/lambda-events/src/event/documentdb/events/delete_event.rs index af5171bc..1bb61dc1 100644 --- a/lambda-events/src/event/documentdb/events/delete_event.rs +++ b/lambda-events/src/event/documentdb/events/delete_event.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentK #[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 { 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 3858c610..d1c12d49 100644 --- a/lambda-events/src/event/documentdb/events/drop_database_event.rs +++ b/lambda-events/src/event/documentdb/events/drop_database_event.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ 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 { diff --git a/lambda-events/src/event/documentdb/events/drop_event.rs b/lambda-events/src/event/documentdb/events/drop_event.rs index 8fbfbf0d..5b01531f 100644 --- a/lambda-events/src/event/documentdb/events/drop_event.rs +++ b/lambda-events/src/event/documentdb/events/drop_event.rs @@ -1,13 +1,12 @@ use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, Timestamp}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { diff --git a/lambda-events/src/event/documentdb/events/insert_event.rs b/lambda-events/src/event/documentdb/events/insert_event.rs index a14f6275..0b560232 100644 --- a/lambda-events/src/event/documentdb/events/insert_event.rs +++ b/lambda-events/src/event/documentdb/events/insert_event.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentK #[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 { diff --git a/lambda-events/src/event/documentdb/events/invalidate_event.rs b/lambda-events/src/event/documentdb/events/invalidate_event.rs index da81b762..9757c220 100644 --- a/lambda-events/src/event/documentdb/events/invalidate_event.rs +++ b/lambda-events/src/event/documentdb/events/invalidate_event.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ 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 { diff --git a/lambda-events/src/event/documentdb/events/rename_event.rs b/lambda-events/src/event/documentdb/events/rename_event.rs index 86122312..b3b31184 100644 --- a/lambda-events/src/event/documentdb/events/rename_event.rs +++ b/lambda-events/src/event/documentdb/events/rename_event.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ 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 { diff --git a/lambda-events/src/event/documentdb/events/replace_event.rs b/lambda-events/src/event/documentdb/events/replace_event.rs index e33fab04..75be2bf4 100644 --- a/lambda-events/src/event/documentdb/events/replace_event.rs +++ b/lambda-events/src/event/documentdb/events/replace_event.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentK #[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 { diff --git a/lambda-events/src/event/documentdb/events/update_event.rs b/lambda-events/src/event/documentdb/events/update_event.rs index ac6b70cb..1a0de1ed 100644 --- a/lambda-events/src/event/documentdb/events/update_event.rs +++ b/lambda-events/src/event/documentdb/events/update_event.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ use super::commom_types::{AnyDocument, DatabaseCollection, DocumentId, DocumentK #[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 { @@ -26,7 +25,6 @@ pub struct UpdateTruncate { #[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 { @@ -45,7 +43,6 @@ pub struct UpdateDescription { #[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 { diff --git a/lambda-events/src/event/documentdb/mod.rs b/lambda-events/src/event/documentdb/mod.rs index f46130eb..a960acf7 100644 --- a/lambda-events/src/event/documentdb/mod.rs +++ b/lambda-events/src/event/documentdb/mod.rs @@ -6,7 +6,7 @@ use self::events::{ replace_event::ChangeReplaceEvent, update_event::ChangeUpdateEvent, }; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -27,7 +27,6 @@ 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, @@ -43,7 +42,6 @@ pub struct DocumentDbInnerEvent { #[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 { diff --git a/lambda-events/src/event/dynamodb/mod.rs b/lambda-events/src/event/dynamodb/mod.rs index ce6e7fc9..ca13df4f 100644 --- a/lambda-events/src/event/dynamodb/mod.rs +++ b/lambda-events/src/event/dynamodb/mod.rs @@ -5,7 +5,7 @@ use crate::{ }; use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -127,7 +127,6 @@ impl fmt::Display for KeyType { /// #[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")] @@ -146,7 +145,6 @@ pub struct Event { /// 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 { @@ -169,7 +167,6 @@ pub struct TimeWindowEvent { /// `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 { @@ -190,7 +187,6 @@ pub struct TimeWindowEventResponse { /// 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 { @@ -260,7 +256,6 @@ pub struct EventRecord { #[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 { @@ -282,7 +277,6 @@ pub struct UserIdentity { /// 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 { diff --git a/lambda-events/src/event/ecr_scan/mod.rs b/lambda-events/src/event/ecr_scan/mod.rs index f42f8adf..588edc7e 100644 --- a/lambda-events/src/event/ecr_scan/mod.rs +++ b/lambda-events/src/event/ecr_scan/mod.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -39,7 +38,6 @@ pub struct EcrScanEvent { #[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 { @@ -68,7 +66,6 @@ pub struct EcrScanEventDetailType { #[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 { diff --git a/lambda-events/src/event/eventbridge/mod.rs b/lambda-events/src/event/eventbridge/mod.rs index eedb1b27..72916669 100644 --- a/lambda-events/src/event/eventbridge/mod.rs +++ b/lambda-events/src/event/eventbridge/mod.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -10,7 +10,6 @@ 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")] diff --git a/lambda-events/src/event/firehose/mod.rs b/lambda-events/src/event/firehose/mod.rs index ddab9ee9..a23c0f3d 100644 --- a/lambda-events/src/event/firehose/mod.rs +++ b/lambda-events/src/event/firehose/mod.rs @@ -3,7 +3,7 @@ use crate::{ encodings::{Base64Data, MillisecondTimestamp}, }; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -12,7 +12,6 @@ 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 { @@ -39,7 +38,6 @@ pub struct KinesisFirehoseEvent { #[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 { @@ -61,7 +59,6 @@ pub struct KinesisFirehoseEventRecord { #[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 { @@ -78,7 +75,6 @@ pub struct KinesisFirehoseResponse { #[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 { @@ -101,7 +97,6 @@ pub struct KinesisFirehoseResponseRecord { #[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 { @@ -120,7 +115,6 @@ pub struct KinesisFirehoseResponseRecordMetadata { #[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 { diff --git a/lambda-events/src/event/iam/mod.rs b/lambda-events/src/event/iam/mod.rs index ba123fda..9a04a8da 100644 --- a/lambda-events/src/event/iam/mod.rs +++ b/lambda-events/src/event/iam/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; #[cfg(feature = "catch-all-fields")] use serde_json::Value; use std::{borrow::Cow, collections::HashMap, fmt}; @@ -12,7 +12,6 @@ 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 { @@ -32,7 +31,6 @@ pub struct IamPolicyDocument { /// `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 { diff --git a/lambda-events/src/event/iot/mod.rs b/lambda-events/src/event/iot/mod.rs index 9e6055d9..81123b6e 100644 --- a/lambda-events/src/event/iot/mod.rs +++ b/lambda-events/src/event/iot/mod.rs @@ -1,6 +1,6 @@ use crate::{custom_serde::serialize_headers, encodings::Base64Data, iam::IamPolicyDocument}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use http::HeaderMap; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] @@ -10,7 +10,6 @@ use serde_json::Value; /// 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 { @@ -32,7 +31,6 @@ pub struct IoTCoreCustomAuthorizerRequest { #[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 { @@ -51,7 +49,6 @@ pub struct IoTCoreProtocolData { #[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 { @@ -69,7 +66,6 @@ pub struct IoTCoreTlsContext { #[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 { @@ -90,7 +86,6 @@ pub struct IoTCoreHttpContext { #[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 { @@ -111,7 +106,6 @@ pub struct IoTCoreMqttContext { #[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 { @@ -131,7 +125,6 @@ pub struct IoTCoreConnectionMetadata { /// 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 { diff --git a/lambda-events/src/event/iot_1_click/mod.rs b/lambda-events/src/event/iot_1_click/mod.rs index 790dd02b..981e1e66 100644 --- a/lambda-events/src/event/iot_1_click/mod.rs +++ b/lambda-events/src/event/iot_1_click/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -11,7 +11,6 @@ use crate::custom_serde::deserialize_lambda_map; /// 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 { @@ -30,7 +29,6 @@ pub struct IoTOneClickEvent { #[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 { @@ -47,7 +45,6 @@ pub struct IoTOneClickDeviceEvent { #[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 { @@ -67,7 +64,6 @@ pub struct IoTOneClickButtonClicked { #[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 { @@ -91,7 +87,6 @@ pub struct IoTOneClickDeviceInfo { #[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 { diff --git a/lambda-events/src/event/iot_button/mod.rs b/lambda-events/src/event/iot_button/mod.rs index 39ce413e..75ad7ca3 100644 --- a/lambda-events/src/event/iot_button/mod.rs +++ b/lambda-events/src/event/iot_button/mod.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { diff --git a/lambda-events/src/event/iot_deprecated/mod.rs b/lambda-events/src/event/iot_deprecated/mod.rs index 50f45e5c..e29bfab1 100644 --- a/lambda-events/src/event/iot_deprecated/mod.rs +++ b/lambda-events/src/event/iot_deprecated/mod.rs @@ -1,6 +1,6 @@ use crate::iot::*; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -9,7 +9,6 @@ use serde_json::Value; /// 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 { @@ -41,7 +40,6 @@ pub type IoTTlsContext = IoTCoreTlsContext; /// 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 { diff --git a/lambda-events/src/event/kafka/mod.rs b/lambda-events/src/event/kafka/mod.rs index 46370206..5b71253c 100644 --- a/lambda-events/src/event/kafka/mod.rs +++ b/lambda-events/src/event/kafka/mod.rs @@ -1,6 +1,6 @@ use crate::{custom_serde::deserialize_lambda_map, encodings::MillisecondTimestamp}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ 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 { @@ -33,7 +32,6 @@ pub struct KafkaEvent { #[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 { diff --git a/lambda-events/src/event/kinesis/analytics.rs b/lambda-events/src/event/kinesis/analytics.rs index bbbf6342..ae438113 100644 --- a/lambda-events/src/event/kinesis/analytics.rs +++ b/lambda-events/src/event/kinesis/analytics.rs @@ -1,13 +1,12 @@ use crate::encodings::Base64Data; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -28,7 +27,6 @@ pub struct KinesisAnalyticsOutputDeliveryEvent { #[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 { @@ -47,7 +45,6 @@ pub struct KinesisAnalyticsOutputDeliveryEventRecord { #[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 { @@ -64,7 +61,6 @@ pub struct KinesisAnalyticsOutputDeliveryResponse { #[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 { diff --git a/lambda-events/src/event/kinesis/event.rs b/lambda-events/src/event/kinesis/event.rs index 64452ff7..09b54eb4 100644 --- a/lambda-events/src/event/kinesis/event.rs +++ b/lambda-events/src/event/kinesis/event.rs @@ -3,14 +3,13 @@ use crate::{ time_window::{TimeWindowEventResponseProperties, TimeWindowProperties}, }; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { @@ -30,7 +29,6 @@ pub struct KinesisEvent { /// 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 { @@ -53,7 +51,6 @@ pub struct KinesisTimeWindowEvent { /// `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 { @@ -73,7 +70,6 @@ pub struct KinesisTimeWindowEventResponse { #[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 { @@ -109,7 +105,6 @@ pub struct KinesisEventRecord { #[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 { diff --git a/lambda-events/src/event/lambda_function_urls/mod.rs b/lambda-events/src/event/lambda_function_urls/mod.rs index 43fc7077..0cf1ceed 100644 --- a/lambda-events/src/event/lambda_function_urls/mod.rs +++ b/lambda-events/src/event/lambda_function_urls/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use http::HeaderMap; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] @@ -11,7 +11,6 @@ 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 { @@ -45,7 +44,6 @@ pub struct LambdaFunctionUrlRequest { /// `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 { @@ -81,7 +79,6 @@ pub struct LambdaFunctionUrlRequestContext { /// `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 { @@ -99,7 +96,6 @@ pub struct LambdaFunctionUrlRequestContextAuthorizerDescription { /// `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 { @@ -126,7 +122,6 @@ pub struct LambdaFunctionUrlRequestContextAuthorizerIamDescription { /// `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 { @@ -153,7 +148,6 @@ pub struct LambdaFunctionUrlRequestContextHttpDescription { /// `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 { diff --git a/lambda-events/src/event/lex/mod.rs b/lambda-events/src/event/lex/mod.rs index 4ab061aa..d48ae117 100644 --- a/lambda-events/src/event/lex/mod.rs +++ b/lambda-events/src/event/lex/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -9,7 +9,6 @@ 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 { @@ -39,7 +38,6 @@ pub struct LexEvent { #[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 { @@ -58,7 +56,6 @@ pub struct LexBot { #[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 { @@ -81,7 +78,6 @@ pub struct LexCurrentIntent { #[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 { @@ -104,7 +100,6 @@ pub struct LexAlternativeIntents { #[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 { @@ -122,7 +117,6 @@ pub struct SlotDetail { #[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 { @@ -151,7 +145,6 @@ 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 { @@ -169,7 +162,6 @@ pub struct LexResponse { #[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 { @@ -188,7 +180,6 @@ pub struct LexResponseCard { #[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 { diff --git a/lambda-events/src/event/rabbitmq/mod.rs b/lambda-events/src/event/rabbitmq/mod.rs index 61069418..e9a07088 100644 --- a/lambda-events/src/event/rabbitmq/mod.rs +++ b/lambda-events/src/event/rabbitmq/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; @@ -8,7 +8,6 @@ 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 { @@ -32,7 +31,6 @@ pub struct RabbitMqEvent { #[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 { @@ -52,7 +50,6 @@ pub struct RabbitMqMessage { #[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 diff --git a/lambda-events/src/event/s3/batch_job.rs b/lambda-events/src/event/s3/batch_job.rs index 43a16bb4..a6d3b12a 100644 --- a/lambda-events/src/event/s3/batch_job.rs +++ b/lambda-events/src/event/s3/batch_job.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,7 +7,6 @@ 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 { @@ -30,7 +29,6 @@ pub struct S3BatchJobEvent { /// `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 { @@ -49,7 +47,6 @@ pub struct S3BatchJob { /// `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 { @@ -74,7 +71,6 @@ pub struct S3BatchJobTask { /// `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 { @@ -98,7 +94,6 @@ pub struct S3BatchJobResponse { /// `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 { diff --git a/lambda-events/src/event/s3/event.rs b/lambda-events/src/event/s3/event.rs index 44627391..5e0dc622 100644 --- a/lambda-events/src/event/s3/event.rs +++ b/lambda-events/src/event/s3/event.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -11,7 +11,6 @@ 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 { @@ -30,7 +29,6 @@ pub struct S3Event { /// `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 { @@ -62,7 +60,6 @@ pub struct S3EventRecord { #[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 { @@ -80,7 +77,6 @@ pub struct S3UserIdentity { #[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 { @@ -99,7 +95,6 @@ pub struct S3RequestParameters { #[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 { @@ -122,7 +117,6 @@ pub struct S3Entity { #[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 { @@ -144,7 +138,6 @@ pub struct S3Bucket { #[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 { diff --git a/lambda-events/src/event/s3/object_lambda.rs b/lambda-events/src/event/s3/object_lambda.rs index 2d64a5e0..8464fcae 100644 --- a/lambda-events/src/event/s3/object_lambda.rs +++ b/lambda-events/src/event/s3/object_lambda.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use http::HeaderMap; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; @@ -11,7 +11,6 @@ use crate::custom_serde::{deserialize_headers, serialize_headers}; /// 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

@@ -43,7 +42,6 @@ where /// 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 { @@ -64,7 +62,6 @@ pub struct GetObjectContext { /// 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 { @@ -83,7 +80,6 @@ pub struct 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 ListObjectsContext { @@ -102,7 +98,6 @@ pub struct 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 ListObjectsV2Context { @@ -120,7 +115,6 @@ pub struct ListObjectsV2Context { /// `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

@@ -145,7 +139,6 @@ where /// `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 { @@ -166,7 +159,6 @@ pub struct UserRequest { /// `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 { @@ -188,7 +180,6 @@ pub struct UserIdentity { #[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 { @@ -207,7 +198,6 @@ pub struct SessionContext { #[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 { diff --git a/lambda-events/src/event/secretsmanager/mod.rs b/lambda-events/src/event/secretsmanager/mod.rs index 930b5418..0507467f 100644 --- a/lambda-events/src/event/secretsmanager/mod.rs +++ b/lambda-events/src/event/secretsmanager/mod.rs @@ -1,12 +1,11 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::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 { diff --git a/lambda-events/src/event/ses/mod.rs b/lambda-events/src/event/ses/mod.rs index cb249a45..bcc1c752 100644 --- a/lambda-events/src/event/ses/mod.rs +++ b/lambda-events/src/event/ses/mod.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -8,7 +8,6 @@ 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 { @@ -26,7 +25,6 @@ pub struct SimpleEmailEvent { #[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 { @@ -47,7 +45,6 @@ pub struct SimpleEmailRecord { #[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 { @@ -66,7 +63,6 @@ pub struct SimpleEmailService { #[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 { @@ -91,7 +87,6 @@ pub struct SimpleEmailMessage { #[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 { @@ -118,7 +113,6 @@ pub struct SimpleEmailReceipt { #[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 { @@ -138,7 +132,6 @@ pub struct SimpleEmailHeader { #[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 { @@ -168,7 +161,6 @@ pub struct SimpleEmailCommonHeaders { /// 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 { @@ -196,7 +188,6 @@ pub struct SimpleEmailReceiptAction { #[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 { @@ -217,7 +208,6 @@ 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 { diff --git a/lambda-events/src/event/sns/mod.rs b/lambda-events/src/event/sns/mod.rs index c853ecab..c15121a0 100644 --- a/lambda-events/src/event/sns/mod.rs +++ b/lambda-events/src/event/sns/mod.rs @@ -1,6 +1,6 @@ use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -13,7 +13,6 @@ 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 { @@ -32,7 +31,6 @@ pub struct SnsEvent { /// 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 { @@ -61,7 +59,6 @@ pub struct SnsRecord { /// 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 { @@ -123,7 +120,6 @@ 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"))] @@ -143,7 +139,6 @@ pub struct SnsEventObj { /// 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"))] @@ -173,7 +168,6 @@ pub struct SnsRecordObj { /// 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")] @@ -241,7 +235,6 @@ 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**. @@ -264,7 +257,6 @@ pub struct MessageAttribute { #[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 { @@ -291,7 +283,6 @@ pub struct CloudWatchAlarmPayload { #[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 { @@ -322,7 +313,6 @@ pub struct CloudWatchAlarmTrigger { #[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 { @@ -345,7 +335,6 @@ pub struct CloudWatchMetricDataQuery { #[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 { @@ -365,7 +354,6 @@ pub struct CloudWatchMetricStat { #[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 { @@ -385,7 +373,6 @@ pub struct CloudWatchMetric { #[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, diff --git a/lambda-events/src/event/sqs/mod.rs b/lambda-events/src/event/sqs/mod.rs index 20335492..2bc00ce5 100644 --- a/lambda-events/src/event/sqs/mod.rs +++ b/lambda-events/src/event/sqs/mod.rs @@ -1,6 +1,6 @@ use crate::{custom_serde::deserialize_lambda_map, encodings::Base64Data}; #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -9,7 +9,6 @@ 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 { @@ -21,14 +20,12 @@ 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 { @@ -69,7 +66,6 @@ pub struct SqsMessage { /// 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"))] @@ -90,7 +86,6 @@ pub struct SqsEventObj { /// 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"))] @@ -135,7 +130,6 @@ pub struct SqsMessageObj { #[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 { @@ -159,7 +153,6 @@ pub struct SqsMessageAttribute { #[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 { @@ -288,7 +281,6 @@ 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 { @@ -306,7 +298,6 @@ pub struct BatchItemFailure { /// 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"))] @@ -326,7 +317,6 @@ pub struct SqsApiEventObj { /// 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 { @@ -346,7 +336,6 @@ pub struct SqsApiEvent { /// 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"))] @@ -384,7 +373,6 @@ pub struct SqsApiMessageObj { /// 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 { @@ -511,4 +499,54 @@ mod test { assert_eq!(response.batch_item_failures.len(), 1); assert_eq!(response.batch_item_failures[0].item_identifier, "msg-4"); } + + #[test] + #[cfg(all(feature = "sqs", feature = "builders"))] + fn test_bon_sqs_event_builder() { + let event = SqsEvent::builder() + .records(vec![ + SqsMessage::builder() + .message_id("test-123".to_string()) + .body("Hello World".to_string()) + .attributes(std::collections::HashMap::new()) + .message_attributes(std::collections::HashMap::new()) + .build() + ]) + .build(); + + assert_eq!(event.records.len(), 1); + assert_eq!(event.records[0].message_id, Some("test-123".to_string())); + assert_eq!(event.records[0].body, Some("Hello World".to_string())); + } + + #[test] + #[cfg(all(feature = "sqs", feature = "builders"))] + fn test_bon_sqs_message_builder() { + let message = SqsMessage::builder() + .message_id("msg-456".to_string()) + .receipt_handle("receipt-handle".to_string()) + .body("Test message body".to_string()) + .attributes(std::collections::HashMap::new()) + .message_attributes(std::collections::HashMap::new()) + .build(); + + assert_eq!(message.message_id, Some("msg-456".to_string())); + assert_eq!(message.receipt_handle, Some("receipt-handle".to_string())); + assert_eq!(message.body, Some("Test message body".to_string())); + } + + #[test] + #[cfg(all(feature = "sqs", feature = "builders"))] + fn test_bon_minimal_builder() { + // Only required fields (non-Option fields with no default) + let message = SqsMessage::builder() + .attributes(std::collections::HashMap::new()) + .message_attributes(std::collections::HashMap::new()) + .build(); + + // All Option fields should be None + assert_eq!(message.message_id, None); + assert_eq!(message.body, None); + assert!(message.attributes.is_empty()); + } } diff --git a/lambda-events/src/event/streams/mod.rs b/lambda-events/src/event/streams/mod.rs index 87f94887..b6be8b1d 100644 --- a/lambda-events/src/event/streams/mod.rs +++ b/lambda-events/src/event/streams/mod.rs @@ -1,5 +1,5 @@ #[cfg(feature = "builders")] -use derive_builder::Builder; +use bon::Builder; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; @@ -7,7 +7,6 @@ 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 { @@ -73,7 +72,6 @@ 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 { @@ -92,7 +90,6 @@ pub struct KinesisBatchItemFailure { /// `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 { @@ -110,7 +107,6 @@ pub struct DynamoDbEventResponse { /// `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 { @@ -129,7 +125,6 @@ pub struct DynamoDbBatchItemFailure { /// `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 { @@ -147,7 +142,6 @@ pub struct SqsEventResponse { /// `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 { From f9fd46825e3ea8942d775704a55b9cafd71327fb Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:20:52 +0000 Subject: [PATCH 05/13] docs: update README to reflect bon migration - Update lambda-events README with bon builder examples - Fix syntax error in comprehensive-builders example - Highlight key benefits of bon over derive_builder --- lambda-events/README.md | 14 ++++++++++---- lambda-events/examples/comprehensive-builders.rs | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lambda-events/README.md b/lambda-events/README.md index ebf197ea..b7e58d3d 100644 --- a/lambda-events/README.md +++ b/lambda-events/README.md @@ -29,7 +29,7 @@ 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. +The crate provides an optional `builders` feature that adds builder pattern support for event types using the [bon](https://crates.io/crates/bon) crate. This enables type-safe, immutable construction of event responses with a clean, ergonomic API. Enable the builders feature: @@ -41,7 +41,7 @@ Example using builders with API Gateway custom authorizers: ```rust use aws_lambda_events::event::apigw::{ - ApiGatewayV2CustomAuthorizerSimpleResponseBuilder, + ApiGatewayV2CustomAuthorizerSimpleResponse, ApiGatewayV2CustomAuthorizerV2Request, }; use lambda_runtime::{Error, LambdaEvent}; @@ -60,15 +60,21 @@ async fn handler( permissions: vec!["read".to_string()], }; - let response = ApiGatewayV2CustomAuthorizerSimpleResponseBuilder::default() + let response = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() .is_authorized(true) .context(context) - .build()?; + .build(); Ok(response) } ``` +Key benefits of bon builders: +- **Clean API**: `Struct::builder().field().build()` - no `.unwrap()` or `?` needed +- **Automatic Option handling**: Optional fields don't need to be explicitly set +- **Type safety**: Compile-time validation of required fields +- **Ergonomic**: Minimal configuration required + See the [examples directory](https://github.com/aws/aws-lambda-rust-runtime/tree/main/lambda-events/examples) for more builder pattern examples. ## History diff --git a/lambda-events/examples/comprehensive-builders.rs b/lambda-events/examples/comprehensive-builders.rs index 3e957314..5657dea7 100644 --- a/lambda-events/examples/comprehensive-builders.rs +++ b/lambda-events/examples/comprehensive-builders.rs @@ -28,7 +28,6 @@ fn main() { .secret_id("test-secret".to_string()) .client_request_token("token-123".to_string()) .build(); - .unwrap(); } #[cfg(not(feature = "builders"))] From 86cd17467ec0d492a9d6541836a413e0aa2e43bf Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:22:06 +0000 Subject: [PATCH 06/13] style: run cargo fmt and clippy --fix - Apply automatic formatting fixes - Fix clippy suggestions --- lambda-events/src/event/autoscaling/mod.rs | 2 +- lambda-events/src/event/chime_bot/mod.rs | 2 +- .../src/event/cloudwatch_events/cloudtrail.rs | 2 +- lambda-events/src/event/cloudwatch_events/mod.rs | 2 +- lambda-events/src/event/code_commit/mod.rs | 2 +- lambda-events/src/event/codebuild/mod.rs | 2 +- lambda-events/src/event/codedeploy/mod.rs | 2 +- .../src/event/codepipeline_cloudwatch/mod.rs | 2 +- lambda-events/src/event/dynamodb/mod.rs | 2 +- lambda-events/src/event/eventbridge/mod.rs | 2 +- lambda-events/src/event/s3/event.rs | 2 +- lambda-events/src/event/ses/mod.rs | 2 +- lambda-events/src/event/sns/mod.rs | 2 +- lambda-events/src/event/sqs/mod.rs | 14 ++++++-------- 14 files changed, 19 insertions(+), 21 deletions(-) diff --git a/lambda-events/src/event/autoscaling/mod.rs b/lambda-events/src/event/autoscaling/mod.rs index 889a05bb..9cd2d8c7 100644 --- a/lambda-events/src/event/autoscaling/mod.rs +++ b/lambda-events/src/event/autoscaling/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; diff --git a/lambda-events/src/event/chime_bot/mod.rs b/lambda-events/src/event/chime_bot/mod.rs index a51db107..92a6d391 100644 --- a/lambda-events/src/event/chime_bot/mod.rs +++ b/lambda-events/src/event/chime_bot/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/cloudwatch_events/cloudtrail.rs b/lambda-events/src/event/cloudwatch_events/cloudtrail.rs index 609e72f1..2b4d8f37 100644 --- a/lambda-events/src/event/cloudwatch_events/cloudtrail.rs +++ b/lambda-events/src/event/cloudwatch_events/cloudtrail.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use serde_json::Value; diff --git a/lambda-events/src/event/cloudwatch_events/mod.rs b/lambda-events/src/event/cloudwatch_events/mod.rs index d0608920..da93b2bc 100644 --- a/lambda-events/src/event/cloudwatch_events/mod.rs +++ b/lambda-events/src/event/cloudwatch_events/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; diff --git a/lambda-events/src/event/code_commit/mod.rs b/lambda-events/src/event/code_commit/mod.rs index 297c3795..d3311261 100644 --- a/lambda-events/src/event/code_commit/mod.rs +++ b/lambda-events/src/event/code_commit/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/codebuild/mod.rs b/lambda-events/src/event/codebuild/mod.rs index c9e15956..26ad4c16 100644 --- a/lambda-events/src/event/codebuild/mod.rs +++ b/lambda-events/src/event/codebuild/mod.rs @@ -2,9 +2,9 @@ use crate::{ custom_serde::{codebuild_time, CodeBuildNumber}, encodings::{MinuteDuration, SecondDuration}, }; -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; diff --git a/lambda-events/src/event/codedeploy/mod.rs b/lambda-events/src/event/codedeploy/mod.rs index d368b3b3..7f3944b8 100644 --- a/lambda-events/src/event/codedeploy/mod.rs +++ b/lambda-events/src/event/codedeploy/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/codepipeline_cloudwatch/mod.rs b/lambda-events/src/event/codepipeline_cloudwatch/mod.rs index f4bc5001..5ffe7a9c 100644 --- a/lambda-events/src/event/codepipeline_cloudwatch/mod.rs +++ b/lambda-events/src/event/codepipeline_cloudwatch/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/dynamodb/mod.rs b/lambda-events/src/event/dynamodb/mod.rs index ca13df4f..4dd8ca7e 100644 --- a/lambda-events/src/event/dynamodb/mod.rs +++ b/lambda-events/src/event/dynamodb/mod.rs @@ -3,9 +3,9 @@ use crate::{ streams::DynamoDbBatchItemFailure, time_window::*, }; -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/eventbridge/mod.rs b/lambda-events/src/event/eventbridge/mod.rs index 72916669..36dc43b0 100644 --- a/lambda-events/src/event/eventbridge/mod.rs +++ b/lambda-events/src/event/eventbridge/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; diff --git a/lambda-events/src/event/s3/event.rs b/lambda-events/src/event/s3/event.rs index 5e0dc622..d93a27f8 100644 --- a/lambda-events/src/event/s3/event.rs +++ b/lambda-events/src/event/s3/event.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/ses/mod.rs b/lambda-events/src/event/ses/mod.rs index bcc1c752..a088f2fe 100644 --- a/lambda-events/src/event/ses/mod.rs +++ b/lambda-events/src/event/ses/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/sns/mod.rs b/lambda-events/src/event/sns/mod.rs index c15121a0..3e752259 100644 --- a/lambda-events/src/event/sns/mod.rs +++ b/lambda-events/src/event/sns/mod.rs @@ -1,6 +1,6 @@ -use chrono::{DateTime, Utc}; #[cfg(feature = "builders")] use bon::Builder; +use chrono::{DateTime, Utc}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; #[cfg(feature = "catch-all-fields")] use serde_json::Value; diff --git a/lambda-events/src/event/sqs/mod.rs b/lambda-events/src/event/sqs/mod.rs index 2bc00ce5..af6f1281 100644 --- a/lambda-events/src/event/sqs/mod.rs +++ b/lambda-events/src/event/sqs/mod.rs @@ -504,14 +504,12 @@ mod test { #[cfg(all(feature = "sqs", feature = "builders"))] fn test_bon_sqs_event_builder() { let event = SqsEvent::builder() - .records(vec![ - SqsMessage::builder() - .message_id("test-123".to_string()) - .body("Hello World".to_string()) - .attributes(std::collections::HashMap::new()) - .message_attributes(std::collections::HashMap::new()) - .build() - ]) + .records(vec![SqsMessage::builder() + .message_id("test-123".to_string()) + .body("Hello World".to_string()) + .attributes(std::collections::HashMap::new()) + .message_attributes(std::collections::HashMap::new()) + .build()]) .build(); assert_eq!(event.records.len(), 1); From 09b581973191ce990ec2fd8a083365bae7552a8b Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:24:04 +0000 Subject: [PATCH 07/13] fix: allow clippy::should_implement_trait for 'sub' fields The 'sub' field represents JWT subject claims in AppSync identity contexts, not mathematical subtraction operations. This is a false positive. --- lambda-events/src/event/appsync/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lambda-events/src/event/appsync/mod.rs b/lambda-events/src/event/appsync/mod.rs index 87370939..ff1b191e 100644 --- a/lambda-events/src/event/appsync/mod.rs +++ b/lambda-events/src/event/appsync/mod.rs @@ -73,6 +73,7 @@ where T1: Serialize, { #[serde(default)] + #[allow(clippy::should_implement_trait)] pub sub: Option, #[serde(default)] pub issuer: Option, @@ -320,6 +321,7 @@ where #[serde(bound = "")] pub claims: T, pub issuer: String, + #[allow(clippy::should_implement_trait)] pub sub: String, /// Catchall to catch any additional fields that were present but not explicitly defined by this struct. /// Enabled with Cargo feature `catch-all-fields`. From 610b5201b7a0211919d64361f66641f1f03ffd97 Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:30:12 +0000 Subject: [PATCH 08/13] fix: move clippy allow to struct level for bon builders Bon generates builder methods that also trigger the should_implement_trait lint --- lambda-events/src/event/appsync/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lambda-events/src/event/appsync/mod.rs b/lambda-events/src/event/appsync/mod.rs index ff1b191e..e00cd3c3 100644 --- a/lambda-events/src/event/appsync/mod.rs +++ b/lambda-events/src/event/appsync/mod.rs @@ -67,13 +67,13 @@ pub struct AppSyncIamIdentity { #[cfg_attr(feature = "builders", derive(Builder))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] +#[allow(clippy::should_implement_trait)] pub struct AppSyncCognitoIdentity where T1: DeserializeOwned, T1: Serialize, { #[serde(default)] - #[allow(clippy::should_implement_trait)] pub sub: Option, #[serde(default)] pub issuer: Option, @@ -314,6 +314,7 @@ impl Default for AppSyncIdentity { #[non_exhaustive] #[cfg_attr(feature = "builders", derive(Builder))] #[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] +#[allow(clippy::should_implement_trait)] pub struct AppSyncIdentityOIDC where T: Serialize + DeserializeOwned, @@ -321,7 +322,6 @@ where #[serde(bound = "")] pub claims: T, pub issuer: String, - #[allow(clippy::should_implement_trait)] pub sub: String, /// Catchall to catch any additional fields that were present but not explicitly defined by this struct. /// Enabled with Cargo feature `catch-all-fields`. From bbd677360b602210d37ec94e89b98cde0b904eed Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:35:12 +0000 Subject: [PATCH 09/13] fix: update examples to work with bon builders - Remove unused Builder imports - Remove .unwrap() and .map_err() calls (bon doesn't return Results) - Handle catch-all-fields feature in comprehensive example - Prefix unused variables with underscore --- .../examples/comprehensive-builders.rs | 19 +++++++++++++------ .../lambda-runtime-authorizer-builder.rs | 10 ++++------ .../lambda-runtime-sqs-batch-builder.rs | 17 ++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lambda-events/examples/comprehensive-builders.rs b/lambda-events/examples/comprehensive-builders.rs index 5657dea7..fcda6d1d 100644 --- a/lambda-events/examples/comprehensive-builders.rs +++ b/lambda-events/examples/comprehensive-builders.rs @@ -8,22 +8,29 @@ use aws_lambda_events::event::{ #[cfg(feature = "builders")] fn main() { // S3 Event - Object storage notifications - let s3_event = S3Event::builder().records(vec![]).build(); + let _s3_event = S3Event::builder().records(vec![]).build(); // Kinesis Event - Stream processing - let kinesis_event = KinesisEvent::builder().records(vec![]).build(); + let _kinesis_event = KinesisEvent::builder().records(vec![]).build(); // DynamoDB Event - Database change streams - let dynamodb_event = DynamoDbEvent::builder().records(vec![]).build(); + let _dynamodb_event = DynamoDbEvent::builder().records(vec![]).build(); // SNS Event - Pub/sub messaging - let sns_event = SnsEvent::builder().records(vec![]).build(); + let _sns_event = SnsEvent::builder().records(vec![]).build(); // SQS Event - Queue messaging - let sqs_event = SqsEvent::builder().records(vec![]).build(); + #[cfg(feature = "catch-all-fields")] + let _sqs_event = SqsEvent::builder() + .records(vec![]) + .other(serde_json::Map::new()) + .build(); + + #[cfg(not(feature = "catch-all-fields"))] + let _sqs_event = SqsEvent::builder().records(vec![]).build(); // Secrets Manager Event - Secret rotation - let secrets_event = SecretsManagerSecretRotationEvent::builder() + let _secrets_event = SecretsManagerSecretRotationEvent::builder() .step("createSecret".to_string()) .secret_id("test-secret".to_string()) .client_request_token("token-123".to_string()) diff --git a/lambda-events/examples/lambda-runtime-authorizer-builder.rs b/lambda-events/examples/lambda-runtime-authorizer-builder.rs index ff485cce..03aa349d 100644 --- a/lambda-events/examples/lambda-runtime-authorizer-builder.rs +++ b/lambda-events/examples/lambda-runtime-authorizer-builder.rs @@ -33,7 +33,7 @@ #[cfg(feature = "builders")] use aws_lambda_events::event::apigw::{ - ApiGatewayV2CustomAuthorizerSimpleResponse, ApiGatewayV2CustomAuthorizerSimpleResponseBuilder, + ApiGatewayV2CustomAuthorizerSimpleResponse, ApiGatewayV2CustomAuthorizerV2Request, }; #[cfg(feature = "builders")] @@ -108,8 +108,7 @@ pub async fn function_handler( let output = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() .is_authorized(true) .context(context) - .build() - .map_err(|e| format!("Failed to build response: {}", e))?; + .build(); Ok(output) } @@ -126,11 +125,10 @@ fn main() { permissions: vec!["read".to_string(), "write".to_string()], }; - let response = ApiGatewayV2CustomAuthorizerSimpleResponseBuilder::::default() + let response = ApiGatewayV2CustomAuthorizerSimpleResponse::::builder() .is_authorized(true) .context(context) - .build() - .unwrap(); + .build(); println!("✅ Built authorizer response for user: {}", response.context.user_id); println!(" Authorized: {}", response.is_authorized); diff --git a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs index 3103f134..67e18098 100644 --- a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs +++ b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs @@ -37,7 +37,7 @@ #[cfg(feature = "builders")] use aws_lambda_events::event::sqs::{ - BatchItemFailure, BatchItemFailureBuilder, SqsBatchResponse, SqsBatchResponseBuilder, SqsEvent, + BatchItemFailure, SqsBatchResponse, SqsEvent, }; #[cfg(feature = "builders")] use lambda_runtime::{Error, LambdaEvent}; @@ -92,8 +92,7 @@ async fn function_handler(event: LambdaEvent) -> Result) -> Result Date: Mon, 19 Jan 2026 14:38:57 +0000 Subject: [PATCH 10/13] style: apply nightly rustfmt formatting --- lambda-events/examples/comprehensive-builders.rs | 2 +- .../examples/lambda-runtime-authorizer-builder.rs | 3 +-- .../examples/lambda-runtime-sqs-batch-builder.rs | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lambda-events/examples/comprehensive-builders.rs b/lambda-events/examples/comprehensive-builders.rs index fcda6d1d..0e275c4f 100644 --- a/lambda-events/examples/comprehensive-builders.rs +++ b/lambda-events/examples/comprehensive-builders.rs @@ -25,7 +25,7 @@ fn main() { .records(vec![]) .other(serde_json::Map::new()) .build(); - + #[cfg(not(feature = "catch-all-fields"))] let _sqs_event = SqsEvent::builder().records(vec![]).build(); diff --git a/lambda-events/examples/lambda-runtime-authorizer-builder.rs b/lambda-events/examples/lambda-runtime-authorizer-builder.rs index 03aa349d..da0ce0c3 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, - ApiGatewayV2CustomAuthorizerV2Request, + ApiGatewayV2CustomAuthorizerSimpleResponse, ApiGatewayV2CustomAuthorizerV2Request, }; #[cfg(feature = "builders")] use lambda_runtime::{Error, LambdaEvent}; diff --git a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs index 67e18098..9a89a2db 100644 --- a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs +++ b/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs @@ -36,9 +36,7 @@ // • Works seamlessly with lambda_runtime::LambdaEvent #[cfg(feature = "builders")] -use aws_lambda_events::event::sqs::{ - BatchItemFailure, SqsBatchResponse, SqsEvent, -}; +use aws_lambda_events::event::sqs::{BatchItemFailure, SqsBatchResponse, SqsEvent}; #[cfg(feature = "builders")] use lambda_runtime::{Error, LambdaEvent}; @@ -119,9 +117,7 @@ fn main() { .build(), ]; - let response = SqsBatchResponse::builder() - .batch_item_failures(failures) - .build(); + let response = SqsBatchResponse::builder().batch_item_failures(failures).build(); println!( "✅ Built SQS batch response with {} failed items", From f40cfa1a623b57f29347ecb86b00554ef266354f Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:56:00 +0000 Subject: [PATCH 11/13] fix: make SqsEvent other field optional in builder --- lambda-events/src/event/sqs/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lambda-events/src/event/sqs/mod.rs b/lambda-events/src/event/sqs/mod.rs index af6f1281..37a122df 100644 --- a/lambda-events/src/event/sqs/mod.rs +++ b/lambda-events/src/event/sqs/mod.rs @@ -19,6 +19,7 @@ pub struct SqsEvent { /// If `catch-all-fields` is disabled, any additional fields that are present will be ignored. #[cfg(feature = "catch-all-fields")] #[cfg_attr(docsrs, doc(cfg(feature = "catch-all-fields")))] + #[cfg_attr(feature = "builders", builder(default))] #[serde(flatten)] pub other: serde_json::Map, } From 1231e8c94e02d4fe747d7e63e917b71efd036076 Mon Sep 17 00:00:00 2001 From: Astraea Quinn S <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:26:57 +0000 Subject: [PATCH 12/13] Fix nits --- Cargo.toml | 1 + lambda-events/README.md | 8 +- .../examples/comprehensive-builders.rs | 44 ------ .../lambda-runtime-authorizer-builder.rs | 145 ------------------ .../lambda-runtime-sqs-batch-builder.rs | 135 ---------------- .../lambda-events-examples/Cargo.toml | 25 +++ .../examples/comprehensive-builders.rs | 103 +++++++++++++ .../lambda-runtime-authorizer-builder.rs | 96 ++++++++++++ .../lambda-runtime-sqs-batch-builder.rs | 64 ++++++++ lambda-events/src/event/sqs/mod.rs | 46 ------ 10 files changed, 290 insertions(+), 377 deletions(-) delete mode 100644 lambda-events/examples/comprehensive-builders.rs delete mode 100644 lambda-events/examples/lambda-runtime-authorizer-builder.rs delete mode 100644 lambda-events/examples/lambda-runtime-sqs-batch-builder.rs create mode 100644 lambda-events/lambda-events-examples/Cargo.toml create mode 100644 lambda-events/lambda-events-examples/examples/comprehensive-builders.rs create mode 100644 lambda-events/lambda-events-examples/examples/lambda-runtime-authorizer-builder.rs create mode 100644 lambda-events/lambda-events-examples/examples/lambda-runtime-sqs-batch-builder.rs diff --git a/Cargo.toml b/Cargo.toml index ef451170..f9995e0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "lambda-runtime", "lambda-extension", "lambda-events", + "lambda-events/lambda-events-examples", ] exclude = ["examples"] diff --git a/lambda-events/README.md b/lambda-events/README.md index b7e58d3d..c1166cb4 100644 --- a/lambda-events/README.md +++ b/lambda-events/README.md @@ -29,7 +29,7 @@ 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 using the [bon](https://crates.io/crates/bon) crate. This enables type-safe, immutable construction of event responses with a clean, ergonomic API. +The crate provides an optional `builders` feature that adds builder pattern support for event types. This enables type-safe, immutable construction of event responses with a clean, ergonomic API. Enable the builders feature: @@ -69,12 +69,6 @@ async fn handler( } ``` -Key benefits of bon builders: -- **Clean API**: `Struct::builder().field().build()` - no `.unwrap()` or `?` needed -- **Automatic Option handling**: Optional fields don't need to be explicitly set -- **Type safety**: Compile-time validation of required fields -- **Ergonomic**: Minimal configuration required - See the [examples directory](https://github.com/aws/aws-lambda-rust-runtime/tree/main/lambda-events/examples) for more builder pattern examples. ## History diff --git a/lambda-events/examples/comprehensive-builders.rs b/lambda-events/examples/comprehensive-builders.rs deleted file mode 100644 index 0e275c4f..00000000 --- a/lambda-events/examples/comprehensive-builders.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Example demonstrating builder pattern usage for AWS Lambda events -#[cfg(feature = "builders")] -use aws_lambda_events::event::{ - dynamodb::Event as DynamoDbEvent, kinesis::KinesisEvent, s3::S3Event, - secretsmanager::SecretsManagerSecretRotationEvent, sns::SnsEvent, sqs::SqsEvent, -}; - -#[cfg(feature = "builders")] -fn main() { - // S3 Event - Object storage notifications - let _s3_event = S3Event::builder().records(vec![]).build(); - - // Kinesis Event - Stream processing - let _kinesis_event = KinesisEvent::builder().records(vec![]).build(); - - // DynamoDB Event - Database change streams - let _dynamodb_event = DynamoDbEvent::builder().records(vec![]).build(); - - // SNS Event - Pub/sub messaging - let _sns_event = SnsEvent::builder().records(vec![]).build(); - - // SQS Event - Queue messaging - #[cfg(feature = "catch-all-fields")] - let _sqs_event = SqsEvent::builder() - .records(vec![]) - .other(serde_json::Map::new()) - .build(); - - #[cfg(not(feature = "catch-all-fields"))] - let _sqs_event = SqsEvent::builder().records(vec![]).build(); - - // Secrets Manager Event - Secret rotation - let _secrets_event = SecretsManagerSecretRotationEvent::builder() - .step("createSecret".to_string()) - .secret_id("test-secret".to_string()) - .client_request_token("token-123".to_string()) - .build(); -} - -#[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 deleted file mode 100644 index da0ce0c3..00000000 --- a/lambda-events/examples/lambda-runtime-authorizer-builder.rs +++ /dev/null @@ -1,145 +0,0 @@ -// 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 = Response::builder() -// .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, 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 = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() - .is_authorized(true) - .context(context) - .build(); - - 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 = ApiGatewayV2CustomAuthorizerSimpleResponse::::builder() - .is_authorized(true) - .context(context) - .build(); - - 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 deleted file mode 100644 index 9a89a2db..00000000 --- a/lambda-events/examples/lambda-runtime-sqs-batch-builder.rs +++ /dev/null @@ -1,135 +0,0 @@ -// 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 = BatchItemFailure::builder() -// .item_identifier(record.message_id.unwrap()) -// .build()?; -// batch_item_failures.push(item) -// } -// } -// } -// let response = SqsBatchResponse::builder() -// .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, SqsBatchResponse, 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 = BatchItemFailure::builder() - .item_identifier(record.message_id.unwrap()) - .build(); - - batch_item_failures.push(item) - } - } - } - - // ✅ Clean response construction with builder - let response = SqsBatchResponse::builder() - .batch_item_failures(batch_item_failures) - .build(); - - Ok(response) -} - -#[cfg(feature = "builders")] -fn main() { - // Demonstrate builder usage with sample data - let failures = vec![ - BatchItemFailure::builder() - .item_identifier("msg-123".to_string()) - .build(), - BatchItemFailure::builder() - .item_identifier("msg-456".to_string()) - .build(), - ]; - - let response = SqsBatchResponse::builder().batch_item_failures(failures).build(); - - 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/lambda-events-examples/Cargo.toml b/lambda-events/lambda-events-examples/Cargo.toml new file mode 100644 index 00000000..216faa08 --- /dev/null +++ b/lambda-events/lambda-events-examples/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "lambda-events-examples" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +aws_lambda_events = { path = "..", features = ["builders"] } +lambda_runtime = { path = "../../lambda-runtime" } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +chrono = { version = "0.4", default-features = false, features = ["clock"] } +serde_dynamo = "4" + +[[example]] +name = "comprehensive-builders" +path = "examples/comprehensive-builders.rs" + +[[example]] +name = "lambda-runtime-authorizer-builder" +path = "examples/lambda-runtime-authorizer-builder.rs" + +[[example]] +name = "lambda-runtime-sqs-batch-builder" +path = "examples/lambda-runtime-sqs-batch-builder.rs" diff --git a/lambda-events/lambda-events-examples/examples/comprehensive-builders.rs b/lambda-events/lambda-events-examples/examples/comprehensive-builders.rs new file mode 100644 index 00000000..14859406 --- /dev/null +++ b/lambda-events/lambda-events-examples/examples/comprehensive-builders.rs @@ -0,0 +1,103 @@ +// Example demonstrating builder pattern usage for AWS Lambda events +use aws_lambda_events::event::{ + dynamodb::{Event as DynamoDbEvent, EventRecord as DynamoDbEventRecord, StreamRecord}, + kinesis::{KinesisEvent, KinesisEventRecord, KinesisRecord, KinesisEncryptionType}, + s3::{S3Event, S3EventRecord, S3Entity, S3Bucket, S3Object, S3RequestParameters, S3UserIdentity}, + secretsmanager::SecretsManagerSecretRotationEvent, + sns::{SnsEvent, SnsRecord, SnsMessage}, + sqs::{SqsEvent, SqsMessage}, +}; +use std::collections::HashMap; + +fn main() { + // S3 Event - Object storage notifications with nested structures + let s3_record = S3EventRecord::builder() + .event_time(chrono::Utc::now()) + .principal_id(S3UserIdentity::builder().build()) + .request_parameters(S3RequestParameters::builder().build()) + .response_elements(HashMap::new()) + .s3(S3Entity::builder() + .bucket(S3Bucket::builder().name("my-bucket".to_string()).build()) + .object(S3Object::builder().key("file.txt".to_string()).size(1024).build()) + .build()) + .build(); + let _s3_event = S3Event::builder().records(vec![s3_record]).build(); + + // Kinesis Event - Stream processing with data + let kinesis_record = KinesisEventRecord::builder() + .kinesis(KinesisRecord::builder() + .data(serde_json::from_str("\"SGVsbG8gV29ybGQ=\"").unwrap()) + .partition_key("key-1".to_string()) + .sequence_number("12345".to_string()) + .approximate_arrival_timestamp(serde_json::from_str("1234567890.0").unwrap()) + .encryption_type(KinesisEncryptionType::None) + .build()) + .build(); + let _kinesis_event = KinesisEvent::builder().records(vec![kinesis_record]).build(); + + // DynamoDB Event - Database change streams with item data + let mut keys = HashMap::new(); + keys.insert("id".to_string(), serde_dynamo::AttributeValue::S("123".to_string())); + + let dynamodb_record = DynamoDbEventRecord::builder() + .aws_region("us-east-1".to_string()) + .change(StreamRecord::builder() + .approximate_creation_date_time(chrono::Utc::now()) + .keys(keys.into()) + .new_image(HashMap::new().into()) + .old_image(HashMap::new().into()) + .size_bytes(100) + .build()) + .event_id("event-123".to_string()) + .event_name("INSERT".to_string()) + .build(); + let _dynamodb_event = DynamoDbEvent::builder().records(vec![dynamodb_record]).build(); + + // SNS Event - Pub/sub messaging with message details + let sns_record = SnsRecord::builder() + .event_source("aws:sns".to_string()) + .event_version("1.0".to_string()) + .event_subscription_arn("arn:aws:sns:us-east-1:123456789012:topic".to_string()) + .sns(SnsMessage::builder() + .message("Hello from SNS".to_string()) + .sns_message_type("Notification".to_string()) + .message_id("msg-123".to_string()) + .topic_arn("arn:aws:sns:us-east-1:123456789012:topic".to_string()) + .timestamp(chrono::Utc::now()) + .signature_version("1".to_string()) + .signature("sig".to_string()) + .signing_cert_url("https://cert.url".to_string()) + .unsubscribe_url("https://unsub.url".to_string()) + .message_attributes(HashMap::new()) + .build()) + .build(); + let _sns_event = SnsEvent::builder().records(vec![sns_record]).build(); + + // SQS Event - Queue messaging with attributes + let mut attrs = HashMap::new(); + attrs.insert("ApproximateReceiveCount".to_string(), "1".to_string()); + attrs.insert("SentTimestamp".to_string(), "1234567890".to_string()); + + let sqs_message = SqsMessage::builder() + .attributes(attrs) + .message_attributes(HashMap::new()) + .body("message body".to_string()) + .message_id("msg-456".to_string()) + .build(); + + #[cfg(feature = "catch-all-fields")] + let _sqs_event = SqsEvent::builder() + .records(vec![sqs_message]) + .other(serde_json::Map::new()) + .build(); + + #[cfg(not(feature = "catch-all-fields"))] + let _sqs_event = SqsEvent::builder().records(vec![sqs_message]).build(); + + // Secrets Manager Event - Secret rotation + let _secrets_event = SecretsManagerSecretRotationEvent::builder() + .step("createSecret".to_string()) + .secret_id("test-secret".to_string()) + .client_request_token("token-123".to_string()) + .build(); +} diff --git a/lambda-events/lambda-events-examples/examples/lambda-runtime-authorizer-builder.rs b/lambda-events/lambda-events-examples/examples/lambda-runtime-authorizer-builder.rs new file mode 100644 index 00000000..f92762c9 --- /dev/null +++ b/lambda-events/lambda-events-examples/examples/lambda-runtime-authorizer-builder.rs @@ -0,0 +1,96 @@ +// Example showing how builders work with generic types and custom context structs +// +// Demonstrates: +// 1. Generic types (ApiGatewayV2CustomAuthorizerSimpleResponse) +// 2. Custom context struct WITHOUT Default implementation +// 3. Custom context struct WITH Default implementation + +use aws_lambda_events::event::apigw::{ + ApiGatewayV2CustomAuthorizerSimpleResponse, ApiGatewayV2CustomAuthorizerV2Request, +}; +use lambda_runtime::{Error, LambdaEvent}; +use serde::{Deserialize, Serialize}; + +// Custom context WITHOUT Default - requires builder pattern +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ContextWithoutDefault { + pub user_id: String, + pub api_key: String, + pub permissions: Vec, +} + +// Custom context WITH Default - works both ways +#[derive(Debug, Default, Clone, Serialize, Deserialize)] +pub struct ContextWithDefault { + pub user_id: String, + pub role: String, +} + +// Handler using context WITHOUT Default - builder pattern required +pub async fn handler_without_default( + _event: LambdaEvent, +) -> Result, Error> { + let context = ContextWithoutDefault { + user_id: "user-123".to_string(), + api_key: "secret-key".to_string(), + permissions: vec!["read".to_string()], + }; + + let response = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() + .is_authorized(true) + .context(context) + .build(); + + Ok(response) +} + +// Handler using context WITH Default - builder pattern still preferred +pub async fn handler_with_default( + _event: LambdaEvent, +) -> Result, Error> { + let context = ContextWithDefault { + user_id: "user-456".to_string(), + role: "admin".to_string(), + }; + + let response = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() + .is_authorized(true) + .context(context) + .build(); + + Ok(response) +} + +fn main() { + // Example 1: Context WITHOUT Default + let context_no_default = ContextWithoutDefault { + user_id: "user-123".to_string(), + api_key: "secret-key".to_string(), + permissions: vec!["read".to_string(), "write".to_string()], + }; + + let response1 = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() + .is_authorized(true) + .context(context_no_default) + .build(); + + println!("Response with context WITHOUT Default:"); + println!(" User: {}", response1.context.user_id); + println!(" Authorized: {}", response1.is_authorized); + + // Example 2: Context WITH Default + let context_with_default = ContextWithDefault { + user_id: "user-456".to_string(), + role: "admin".to_string(), + }; + + let response2 = ApiGatewayV2CustomAuthorizerSimpleResponse::builder() + .is_authorized(false) + .context(context_with_default) + .build(); + + println!("\nResponse with context WITH Default:"); + println!(" User: {}", response2.context.user_id); + println!(" Role: {}", response2.context.role); + println!(" Authorized: {}", response2.is_authorized); +} diff --git a/lambda-events/lambda-events-examples/examples/lambda-runtime-sqs-batch-builder.rs b/lambda-events/lambda-events-examples/examples/lambda-runtime-sqs-batch-builder.rs new file mode 100644 index 00000000..7330402d --- /dev/null +++ b/lambda-events/lambda-events-examples/examples/lambda-runtime-sqs-batch-builder.rs @@ -0,0 +1,64 @@ +// Example showing how builders simplify SQS batch response construction +// when handling partial batch failures + +use aws_lambda_events::event::sqs::{BatchItemFailure, SqsBatchResponse, SqsEvent}; +use lambda_runtime::{Error, LambdaEvent}; + +// Simulate processing a record +#[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(()) +} + +// Lambda handler using builder pattern +#[allow(dead_code)] +pub 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(_) => { + let item = BatchItemFailure::builder() + .item_identifier(record.message_id.unwrap()) + .build(); + + batch_item_failures.push(item) + } + } + } + + let response = SqsBatchResponse::builder() + .batch_item_failures(batch_item_failures) + .build(); + + Ok(response) +} + +fn main() { + // Demonstrate builder usage with sample data + let failures = vec![ + BatchItemFailure::builder() + .item_identifier("msg-123".to_string()) + .build(), + BatchItemFailure::builder() + .item_identifier("msg-456".to_string()) + .build(), + ]; + + let response = SqsBatchResponse::builder().batch_item_failures(failures).build(); + + 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); + } +} diff --git a/lambda-events/src/event/sqs/mod.rs b/lambda-events/src/event/sqs/mod.rs index 37a122df..2312acce 100644 --- a/lambda-events/src/event/sqs/mod.rs +++ b/lambda-events/src/event/sqs/mod.rs @@ -501,51 +501,5 @@ mod test { assert_eq!(response.batch_item_failures[0].item_identifier, "msg-4"); } - #[test] - #[cfg(all(feature = "sqs", feature = "builders"))] - fn test_bon_sqs_event_builder() { - let event = SqsEvent::builder() - .records(vec![SqsMessage::builder() - .message_id("test-123".to_string()) - .body("Hello World".to_string()) - .attributes(std::collections::HashMap::new()) - .message_attributes(std::collections::HashMap::new()) - .build()]) - .build(); - - assert_eq!(event.records.len(), 1); - assert_eq!(event.records[0].message_id, Some("test-123".to_string())); - assert_eq!(event.records[0].body, Some("Hello World".to_string())); - } - #[test] - #[cfg(all(feature = "sqs", feature = "builders"))] - fn test_bon_sqs_message_builder() { - let message = SqsMessage::builder() - .message_id("msg-456".to_string()) - .receipt_handle("receipt-handle".to_string()) - .body("Test message body".to_string()) - .attributes(std::collections::HashMap::new()) - .message_attributes(std::collections::HashMap::new()) - .build(); - - assert_eq!(message.message_id, Some("msg-456".to_string())); - assert_eq!(message.receipt_handle, Some("receipt-handle".to_string())); - assert_eq!(message.body, Some("Test message body".to_string())); - } - - #[test] - #[cfg(all(feature = "sqs", feature = "builders"))] - fn test_bon_minimal_builder() { - // Only required fields (non-Option fields with no default) - let message = SqsMessage::builder() - .attributes(std::collections::HashMap::new()) - .message_attributes(std::collections::HashMap::new()) - .build(); - - // All Option fields should be None - assert_eq!(message.message_id, None); - assert_eq!(message.body, None); - assert!(message.attributes.is_empty()); - } } From ebd69a698cf0cd1540f7447f71e898f81ddc106f Mon Sep 17 00:00:00 2001 From: Astraea <249650883+FullyTyped@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:29:07 +0000 Subject: [PATCH 13/13] Apply suggestion from @FullyTyped --- Cargo.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f9995e0c..ce1f6640 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,10 +7,9 @@ members = [ "lambda-runtime", "lambda-extension", "lambda-events", - "lambda-events/lambda-events-examples", ] -exclude = ["examples"] +exclude = ["examples","lambda-events/lambda-events-examples"] [workspace.dependencies] base64 = "0.22"