Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Remove all autogenerated events. #133

Merged
merged 3 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 60 additions & 16 deletions aws_lambda_events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "AWS Lambda event definitions"
authors = [
"Christian Legnitto <[email protected]>",
"Sam Rijs <[email protected]>",
"David Calavera <[email protected]>"
"David Calavera <[email protected]>",
]
license = "MIT"
homepage = "https://github.com/LegNeato/aws-lambda-events"
Expand All @@ -24,7 +24,10 @@ serde_derive = "^1"
serde_with = { version = "^2", features = ["json"], optional = true }
serde_json = "^1"
bytes = { version = "1", features = ["serde"] }
chrono = { version = "^0.4.4", default-features = false, features = ["serde", "std"] }
chrono = { version = "^0.4.4", default-features = false, features = [
"serde",
"std",
] }
query_map = { version = "^0.6", features = ["serde", "url-query"] }
flate2 = { version = "1.0.24", optional = true }

Expand All @@ -36,42 +39,83 @@ pretty_assertions = "1.3"
# The `generated` features reference features generated by the codegen script.
[features]
default = ["generated", "static"]
static = ["alb", "apigw", "cloudwatch_events", "cloudwatch_logs", "cognito", "dynamodb", "kinesis", "kinesis_analytics", "s3", "s3_batch_job", "sns", "sqs"]
alb = []
apigw = []
cloudwatch_events = []
cloudwatch_logs = ["flate2"]
cognito = []
dynamodb = ["streams"]
kinesis = []
kinesis_analytics = ["kinesis"]
s3 = []
s3_batch_job = ["s3"]
sns = ["serde_with"]
sqs = ["serde_with"]
static = [
"activemq",
"alb",
"apigw",
"appsync",
"autoscaling",
"chime_bot",
"clientvpn",
"cloudwatch_events",
"cloudwatch_logs",
"code_commit",
"codebuild",
"codedeploy",
"codepipeline_cloudwatch",
"codepipeline_job",
"cognito",
"config",
"connect",
"dynamodb",
"ecr_scan",
"firehose",
"iam",
"iot",
"iot_1_click",
"iot_button",
"iot_deprecated",
"kafka",
"kinesis",
"kinesis_analytics",
"lambda_function_urls",
"lex",
"rabbitmq",
"s3",
"s3_batch_job",
"ses",
"sns",
"sqs",
"streams",
]

activemq = []
alb = []
apigw = []
appsync = []
autoscaling = []
chime_bot = []
clientvpn = []
cloudwatch_events = []
cloudwatch_logs = ["flate2"]
code_commit = []
codebuild = []
codedeploy = []
codepipeline = []
codepipeline_cloudwatch = []
codepipeline_job = []
cognito = []
config = []
connect = []
dynamodb = ["streams"]
ecr_scan = []
firehose = []
iam = []
iot = []
iot_1_click = []
iot_button = []
iot_deprecated = []
kafka = []
kinesis = []
kinesis_analytics = ["kinesis"]
lambda_function_urls = []
lex = []
rabbitmq = []
s3 = []
s3_batch_job = ["s3"]
ses = []
sns = ["serde_with"]
sqs = ["serde_with"]
streams = []
generated = ["activemq", "appsync", "autoscaling", "chime_bot", "clientvpn", "code_commit", "codebuild", "codedeploy", "codepipeline_cloudwatch", "codepipeline_job", "config", "connect", "ecr_scan", "firehose", "iot", "iot_1_click", "iot_button", "kafka", "lambda_function_urls", "lex", "rabbitmq", "ses", "streams"]

generated = []
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::custom_serde::*;
use std::collections::HashMap;

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActiveMqEvent {
#[serde(deserialize_with = "deserialize_lambda_string")]
Expand All @@ -12,7 +13,7 @@ pub struct ActiveMqEvent {
pub messages: Vec<ActiveMqMessage>,
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActiveMqMessage {
#[serde(deserialize_with = "deserialize_lambda_string")]
Expand Down Expand Up @@ -43,9 +44,12 @@ pub struct ActiveMqMessage {
pub data: Option<String>,
pub broker_in_time: i64,
pub broker_out_time: i64,
#[serde(deserialize_with = "deserialize_lambda_map")]
#[serde(default)]
pub properties: HashMap<String, String>,
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActiveMqDestination {
#[serde(deserialize_with = "deserialize_lambda_string")]
Expand All @@ -62,7 +66,7 @@ mod test {
#[test]
#[cfg(feature = "activemq")]
fn example_activemq_event() {
let data = include_bytes!("fixtures/example-activemq-event.json");
let data = include_bytes!("../fixtures/example-activemq-event.json");
let parsed: ActiveMqEvent = serde_json::from_slice(data).unwrap();
let output: String = serde_json::to_string(&parsed).unwrap();
let reparsed: ActiveMqEvent = serde_json::from_slice(output.as_bytes()).unwrap();
Expand Down
18 changes: 8 additions & 10 deletions aws_lambda_events/src/alb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ pub struct AlbTargetGroupRequest {
}

/// `AlbTargetGroupRequestContext` contains the information to identify the load balancer invoking the lambda
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AlbTargetGroupRequestContext {
pub elb: ElbContext,
}

/// `ElbContext` contains the information to identify the ARN invoking the lambda
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ElbContext {
/// nolint: stylecheck
Expand All @@ -45,7 +45,7 @@ pub struct ElbContext {
}

/// `AlbTargetGroupResponse` configures the response to be returned by the ALB Lambda target group for the request
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AlbTargetGroupResponse {
pub status_code: i64,
Expand All @@ -72,9 +72,8 @@ mod test {
#[test]
#[cfg(feature = "alb")]
fn example_alb_lambda_target_request_headers_only() {
let data = include_bytes!(
"../generated/fixtures/example-alb-lambda-target-request-headers-only.json"
);
let data =
include_bytes!("../fixtures/example-alb-lambda-target-request-headers-only.json");
let parsed: AlbTargetGroupRequest = serde_json::from_slice(data).unwrap();
let output: String = serde_json::to_string(&parsed).unwrap();
let reparsed: AlbTargetGroupRequest = serde_json::from_slice(output.as_bytes()).unwrap();
Expand All @@ -84,9 +83,8 @@ mod test {
#[test]
#[cfg(feature = "alb")]
fn example_alb_lambda_target_request_multivalue_headers() {
let data = include_bytes!(
"../generated/fixtures/example-alb-lambda-target-request-multivalue-headers.json"
);
let data =
include_bytes!("../fixtures/example-alb-lambda-target-request-multivalue-headers.json");
let parsed: AlbTargetGroupRequest = serde_json::from_slice(data).unwrap();
let output: String = serde_json::to_string(&parsed).unwrap();
let reparsed: AlbTargetGroupRequest = serde_json::from_slice(output.as_bytes()).unwrap();
Expand All @@ -96,7 +94,7 @@ mod test {
#[test]
#[cfg(feature = "alb")]
fn example_alb_lambda_target_response() {
let data = include_bytes!("../generated/fixtures/example-alb-lambda-target-response.json");
let data = include_bytes!("../fixtures/example-alb-lambda-target-response.json");
let parsed: AlbTargetGroupResponse = serde_json::from_slice(data).unwrap();
let output: String = serde_json::to_string(&parsed).unwrap();
let reparsed: AlbTargetGroupResponse = serde_json::from_slice(output.as_bytes()).unwrap();
Expand Down
Loading