├── .github └── workflows │ ├── ci.yaml │ └── format.yml ├── .gitignore ├── Cargo.toml ├── LICENSE ├── README.md └── src ├── activemq └── mod.rs ├── alb └── mod.rs ├── apigw └── mod.rs ├── appsync └── mod.rs ├── autoscaling └── mod.rs ├── chime_bot └── mod.rs ├── clientvpn └── mod.rs ├── cloudwatch_events ├── cloudtrail.rs ├── codedeploy.rs ├── codepipeline.rs ├── ec2.rs ├── emr.rs ├── gamelift.rs ├── glue.rs ├── health.rs ├── kms.rs ├── macie.rs ├── mod.rs ├── opsworks.rs ├── signin.rs ├── sms.rs ├── ssm.rs ├── tag.rs └── trustedadvisor.rs ├── cloudwatch_logs └── mod.rs ├── code_commit └── mod.rs ├── codebuild └── mod.rs ├── codedeploy └── mod.rs ├── codepipeline_cloudwatch └── mod.rs ├── codepipeline_job └── mod.rs ├── cognito └── mod.rs ├── config └── mod.rs ├── connect └── mod.rs ├── custom_serde ├── codebuild_time.rs ├── float_unix_epoch.rs ├── headers.rs ├── http_method.rs └── mod.rs ├── dynamodb ├── attributes.rs └── mod.rs ├── ecr_scan └── mod.rs ├── encodings.rs ├── event.rs ├── firehose └── mod.rs ├── fixtures ├── example-activemq-event.json ├── example-alb-lambda-target-request-headers-only.json ├── example-alb-lambda-target-request-multivalue-headers.json ├── example-alb-lambda-target-response.json ├── example-apigw-console-test-request.json ├── example-apigw-custom-auth-request-type-request.json ├── example-apigw-custom-auth-request.json ├── example-apigw-custom-auth-response.json ├── example-apigw-request.json ├── example-apigw-response.json ├── example-apigw-restapi-openapi-request.json ├── example-apigw-v2-custom-authorizer-v1-request.json ├── example-apigw-v2-custom-authorizer-v2-request-without-cookies.json ├── example-apigw-v2-custom-authorizer-v2-request.json ├── example-apigw-v2-custom-authorizer-websocket-request.json ├── example-apigw-v2-request-iam.json ├── example-apigw-v2-request-jwt-authorizer.json ├── example-apigw-v2-request-lambda-authorizer.json ├── example-apigw-v2-request-no-authorizer.json ├── example-apigw-websocket-request-without-method.json ├── example-apigw-websocket-request.json ├── example-appsync-batchinvoke.json ├── example-appsync-identity-cognito.json ├── example-appsync-identity-iam.json ├── example-appsync-invoke.json ├── example-appsync-lambda-auth-request.json ├── example-appsync-lambda-auth-response.json ├── example-autoscaling-event-launch-successful.json ├── example-autoscaling-event-launch-unsuccessful.json ├── example-autoscaling-event-lifecycle-action.json ├── example-autoscaling-event-terminate-action.json ├── example-autoscaling-event-terminate-successful.json ├── example-autoscaling-event-terminate-unsuccessful.json ├── example-clientvpn-connectionhandler-request.json ├── example-cloudwatch-alarm-sns-payload-multiple-metrics.json ├── example-cloudwatch-alarm-sns-payload-single-metric.json ├── example-cloudwatch_logs-event.json ├── example-code_commit-event.json ├── example-codebuild-phase-change.json ├── example-codebuild-state-change.json ├── example-codedeploy-deployment-event.json ├── example-codedeploy-instance-event.json ├── example-codepipeline-action-execution-stage-change-event.json ├── example-codepipeline-execution-stage-change-event.json ├── example-codepipeline-execution-state-change-event.json ├── example-codepipeline_job-event.json ├── example-cognito-event-userpools-create-auth-challenge.json ├── example-cognito-event-userpools-custommessage.json ├── example-cognito-event-userpools-define-auth-challenge-optional-response-fields.json ├── example-cognito-event-userpools-define-auth-challenge.json ├── example-cognito-event-userpools-migrateuser.json ├── example-cognito-event-userpools-postauthentication.json ├── example-cognito-event-userpools-postconfirmation.json ├── example-cognito-event-userpools-preauthentication.json ├── example-cognito-event-userpools-presignup.json ├── example-cognito-event-userpools-pretokengen-incoming.json ├── example-cognito-event-userpools-pretokengen.json ├── example-cognito-event-userpools-verify-auth-challenge-optional-answer-correct.json ├── example-cognito-event-userpools-verify-auth-challenge.json ├── example-cognito-event.json ├── example-config-event.json ├── example-connect-event-without-queue.json ├── example-connect-event.json ├── example-dynamodb-event-record-with-optional-fields.json ├── example-dynamodb-event.json ├── example-ecr-image-scan-event.json ├── example-firehose-event.json ├── example-iot-custom-auth-request.json ├── example-iot-custom-auth-response.json ├── example-iot_1_click-event.json ├── example-iot_button-event.json ├── example-kafka-event.json ├── example-kinesis-event.json ├── example-kinesis-firehose-event.json ├── example-kinesis-firehose-response.json ├── example-lex-event.json ├── example-lex-response.json ├── example-rabbitmq-event.json ├── example-s3-event-with-decoded.json ├── example-s3-event.json ├── example-s3-object-lambda-event-get-object-assumed-role.json ├── example-s3-object-lambda-event-get-object-iam.json ├── example-s3-object-lambda-event-head-object-iam.json ├── example-s3-object-lambda-event-list-objects-iam.json ├── example-s3-object-lambda-event-list-objects-v2-iam.json ├── example-ses-event.json ├── example-ses-lambda-event.json ├── example-ses-s3-event.json ├── example-ses-sns-event.json ├── example-sns-event-obj.json ├── example-sns-event-pascal-case.json ├── example-sns-event.json ├── example-sqs-batch-response.json ├── example-sqs-event-obj.json └── example-sqs-event.json ├── generated ├── README.md └── mod.rs ├── iam └── mod.rs ├── iot └── mod.rs ├── iot_1_click └── mod.rs ├── iot_button └── mod.rs ├── iot_deprecated └── mod.rs ├── kafka └── mod.rs ├── kinesis ├── analytics.rs ├── event.rs └── mod.rs ├── lambda_function_urls └── mod.rs ├── lex └── mod.rs ├── lib.rs ├── rabbitmq └── mod.rs ├── s3 ├── batch_job.rs ├── event.rs ├── mod.rs └── object_lambda.rs ├── ses └── mod.rs ├── sns └── mod.rs ├── sqs └── mod.rs ├── streams └── mod.rs └── time_window.rs /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | 3 | name: Continuous integration 4 | 5 | jobs: 6 | ci: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | matrix: 10 | rust: 11 | - stable 12 | - beta 13 | - nightly 14 | 15 | steps: 16 | - uses: actions/checkout@v2 17 | 18 | - uses: actions-rs/toolchain@v1 19 | with: 20 | profile: minimal 21 | toolchain: ${{ matrix.rust }} 22 | override: true 23 | components: clippy 24 | 25 | - uses: actions-rs/cargo@v1 26 | with: 27 | command: build 28 | args: --all-features 29 | 30 | - uses: actions-rs/cargo@v1 31 | with: 32 | command: test 33 | args: --all-features 34 | 35 | - uses: actions-rs/cargo@v1 36 | with: 37 | command: clippy 38 | args: --all-features 39 | -------------------------------------------------------------------------------- /.github/workflows/format.yml: -------------------------------------------------------------------------------- 1 | on: push 2 | 3 | name: Rustfmt 4 | 5 | jobs: 6 | format: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: actions-rs/toolchain@v1 11 | with: 12 | toolchain: stable 13 | components: rustfmt 14 | override: true 15 | - uses: mbrobbel/rustfmt-check@master 16 | with: 17 | token: ${{ secrets.GITHUB_TOKEN }} 18 | args: --all -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | target/ 4 | 5 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 6 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 7 | Cargo.lock 8 | 9 | # These are backup files generated by rustfmt 10 | **/*.rs.bk 11 | 12 | # Build artifacts 13 | *.o 14 | 15 | # Test artifacts 16 | *.rmeta 17 | 18 | .idea 19 | *.iml 20 | 21 | # Prevent MacOS ds_store files 22 | **/.DS_Store -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "aws_lambda_events" 3 | version = "0.8.5" 4 | description = "AWS Lambda event definitions" 5 | authors = [ 6 | "Christian Legnitto ", 7 | "Sam Rijs ", 8 | "David Calavera ", 9 | ] 10 | license = "MIT" 11 | homepage = "https://github.com/calavera/aws-lambda-events" 12 | repository = "https://github.com/calavera/aws-lambda-events" 13 | readme = "README.md" 14 | keywords = ["lambda", "aws", "amazon", "events", "S3"] 15 | categories = ["api-bindings", "encoding", "web-programming"] 16 | 17 | [dependencies] 18 | base64 = "0.13" 19 | http = "0.2" 20 | http-body = "0.4" 21 | http-serde = "^1" 22 | serde = "^1" 23 | serde_derive = "^1" 24 | serde_with = { version = "^2", features = ["json"], optional = true } 25 | serde_json = "^1" 26 | serde_dynamo = { version = "^4.1", optional = true } 27 | bytes = { version = "1", features = ["serde"] } 28 | chrono = { version = "0.4.23", default-features = false, features = [ 29 | "clock", 30 | "serde", 31 | "std", 32 | ] } 33 | query_map = { version = "^0.6", features = ["serde", "url-query"] } 34 | flate2 = { version = "1.0.24", optional = true } 35 | 36 | [dev-dependencies] 37 | pretty_assertions = "1.3" 38 | 39 | [features] 40 | default = [ 41 | "activemq", 42 | "alb", 43 | "apigw", 44 | "appsync", 45 | "autoscaling", 46 | "chime_bot", 47 | "clientvpn", 48 | "cloudwatch_events", 49 | "cloudwatch_logs", 50 | "code_commit", 51 | "codebuild", 52 | "codedeploy", 53 | "codepipeline_cloudwatch", 54 | "codepipeline_job", 55 | "cognito", 56 | "config", 57 | "connect", 58 | "dynamodb", 59 | "ecr_scan", 60 | "firehose", 61 | "iam", 62 | "iot", 63 | "iot_1_click", 64 | "iot_button", 65 | "iot_deprecated", 66 | "kafka", 67 | "kinesis", 68 | "kinesis_analytics", 69 | "lambda_function_urls", 70 | "lex", 71 | "rabbitmq", 72 | "s3", 73 | "s3_batch_job", 74 | "ses", 75 | "sns", 76 | "sqs", 77 | "streams", 78 | ] 79 | 80 | activemq = [] 81 | alb = [] 82 | apigw = [] 83 | appsync = [] 84 | autoscaling = [] 85 | chime_bot = [] 86 | clientvpn = [] 87 | cloudwatch_events = [] 88 | cloudwatch_logs = ["flate2"] 89 | code_commit = [] 90 | codebuild = [] 91 | codedeploy = [] 92 | codepipeline = [] 93 | codepipeline_cloudwatch = [] 94 | codepipeline_job = [] 95 | cognito = [] 96 | config = [] 97 | connect = [] 98 | dynamodb = ["streams", "serde_dynamo"] 99 | ecr_scan = [] 100 | firehose = [] 101 | iam = [] 102 | iot = ["iam"] 103 | iot_1_click = [] 104 | iot_button = [] 105 | iot_deprecated = ["iot"] 106 | kafka = [] 107 | kinesis = [] 108 | kinesis_analytics = ["kinesis"] 109 | lambda_function_urls = [] 110 | lex = [] 111 | rabbitmq = [] 112 | s3 = [] 113 | s3_batch_job = ["s3"] 114 | ses = [] 115 | sns = ["serde_with"] 116 | sqs = ["serde_with"] 117 | streams = [] 118 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Sam Rijs and Christian Legnitto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [aws_lambda_events](https://crates.io/crates/aws_lambda_events) 2 | 3 | ℹ️ This project has moved to the AWS Lambda Runtime repository: https://github.com/awslabs/aws-lambda-rust-runtime/tree/main/lambda-events 4 | 5 | [![crates.io][crate-image]][crate-link] 6 | [![Documentation][docs-image]][docs-link] 7 | 8 | [//]: # 'badges' 9 | [crate-image]: https://img.shields.io/crates/v/aws_lambda_events.svg 10 | [crate-link]: https://crates.io/crates/aws_lambda_events 11 | [docs-image]: https://docs.rs/aws_lambda_events/badge.svg 12 | [docs-link]: https://docs.rs/aws_lambda_events 13 | -------------------------------------------------------------------------------- /src/activemq/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::custom_serde::*; 2 | use std::collections::HashMap; 3 | 4 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct ActiveMqEvent { 7 | #[serde(default)] 8 | pub event_source: Option, 9 | #[serde(default)] 10 | pub event_source_arn: Option, 11 | pub messages: Vec, 12 | } 13 | 14 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct ActiveMqMessage { 17 | #[serde(default)] 18 | #[serde(rename = "messageID")] 19 | pub message_id: Option, 20 | #[serde(default)] 21 | pub message_type: Option, 22 | pub timestamp: i64, 23 | pub delivery_mode: i64, 24 | #[serde(default)] 25 | #[serde(rename = "correlationID")] 26 | pub correlation_id: Option, 27 | #[serde(default)] 28 | pub reply_to: Option, 29 | pub destination: ActiveMqDestination, 30 | pub redelivered: bool, 31 | #[serde(default)] 32 | pub type_: Option, 33 | pub expiration: i64, 34 | pub priority: i64, 35 | #[serde(default)] 36 | pub data: Option, 37 | pub broker_in_time: i64, 38 | pub broker_out_time: i64, 39 | #[serde(deserialize_with = "deserialize_lambda_map")] 40 | #[serde(default)] 41 | pub properties: HashMap, 42 | } 43 | 44 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 45 | #[serde(rename_all = "camelCase")] 46 | pub struct ActiveMqDestination { 47 | #[serde(default)] 48 | pub physical_name: Option, 49 | } 50 | 51 | #[cfg(test)] 52 | mod test { 53 | use super::*; 54 | 55 | extern crate serde_json; 56 | 57 | #[test] 58 | #[cfg(feature = "activemq")] 59 | fn example_activemq_event() { 60 | let data = include_bytes!("../fixtures/example-activemq-event.json"); 61 | let parsed: ActiveMqEvent = serde_json::from_slice(data).unwrap(); 62 | let output: String = serde_json::to_string(&parsed).unwrap(); 63 | let reparsed: ActiveMqEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 64 | assert_eq!(parsed, reparsed); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/chime_bot/mod.rs: -------------------------------------------------------------------------------- 1 | use chrono::{DateTime, Utc}; 2 | 3 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 4 | #[serde(rename_all = "camelCase")] 5 | pub struct ChimeBotEvent { 6 | #[serde(rename = "Sender")] 7 | pub sender: ChimeBotEventSender, 8 | #[serde(rename = "Discussion")] 9 | pub discussion: ChimeBotEventDiscussion, 10 | #[serde(default)] 11 | #[serde(rename = "EventType")] 12 | pub event_type: Option, 13 | #[serde(rename = "InboundHttpsEndpoint")] 14 | pub inbound_https_endpoint: Option, 15 | #[serde(rename = "EventTimestamp")] 16 | pub event_timestamp: DateTime, 17 | #[serde(rename = "Message")] 18 | pub message: Option, 19 | } 20 | 21 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 22 | #[serde(rename_all = "camelCase")] 23 | pub struct ChimeBotEventSender { 24 | #[serde(default)] 25 | #[serde(rename = "SenderId")] 26 | pub sender_id: Option, 27 | #[serde(default)] 28 | #[serde(rename = "SenderIdType")] 29 | pub sender_id_type: Option, 30 | } 31 | 32 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 33 | #[serde(rename_all = "camelCase")] 34 | pub struct ChimeBotEventDiscussion { 35 | #[serde(default)] 36 | #[serde(rename = "DiscussionId")] 37 | pub discussion_id: Option, 38 | #[serde(default)] 39 | #[serde(rename = "DiscussionType")] 40 | pub discussion_type: Option, 41 | } 42 | 43 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 44 | #[serde(rename_all = "camelCase")] 45 | pub struct ChimeBotEventInboundHttpsEndpoint { 46 | #[serde(default)] 47 | #[serde(rename = "EndpointType")] 48 | pub endpoint_type: Option, 49 | #[serde(default)] 50 | #[serde(rename = "Url")] 51 | pub url: Option, 52 | } 53 | -------------------------------------------------------------------------------- /src/clientvpn/mod.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 2 | #[serde(rename_all = "camelCase")] 3 | pub struct ClientVpnConnectionHandlerRequest { 4 | #[serde(default)] 5 | #[serde(rename = "connection-id")] 6 | pub connection_id: Option, 7 | #[serde(default)] 8 | #[serde(rename = "endpoint-id")] 9 | pub endpoint_id: Option, 10 | #[serde(default)] 11 | #[serde(rename = "common-name")] 12 | pub common_name: Option, 13 | #[serde(default)] 14 | pub username: Option, 15 | #[serde(default)] 16 | #[serde(rename = "platform")] 17 | pub os_platform: Option, 18 | #[serde(default)] 19 | #[serde(rename = "platform-version")] 20 | pub os_platform_version: Option, 21 | #[serde(default)] 22 | #[serde(rename = "public-ip")] 23 | pub public_ip: Option, 24 | #[serde(default)] 25 | #[serde(rename = "client-openvpn-version")] 26 | pub client_open_vpn_version: Option, 27 | #[serde(default)] 28 | #[serde(rename = "schema-version")] 29 | pub schema_version: Option, 30 | } 31 | 32 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 33 | #[serde(rename_all = "camelCase")] 34 | pub struct ClientVpnConnectionHandlerResponse { 35 | pub allow: bool, 36 | #[serde(default)] 37 | #[serde(rename = "error-msg-on-failed-posture-compliance")] 38 | pub error_msg_on_failed_posture_compliance: Option, 39 | #[serde(rename = "posture-compliance-statuses")] 40 | pub posture_compliance_statuses: Vec, 41 | #[serde(default)] 42 | #[serde(rename = "schema-version")] 43 | pub schema_version: Option, 44 | } 45 | 46 | #[cfg(test)] 47 | mod test { 48 | use super::*; 49 | 50 | extern crate serde_json; 51 | 52 | #[test] 53 | #[cfg(feature = "clientvpn")] 54 | fn example_clientvpn_connectionhandler_request() { 55 | let data = include_bytes!("../fixtures/example-clientvpn-connectionhandler-request.json"); 56 | let parsed: ClientVpnConnectionHandlerRequest = serde_json::from_slice(data).unwrap(); 57 | let output: String = serde_json::to_string(&parsed).unwrap(); 58 | let reparsed: ClientVpnConnectionHandlerRequest = 59 | serde_json::from_slice(output.as_bytes()).unwrap(); 60 | assert_eq!(parsed, reparsed); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/cloudwatch_events/cloudtrail.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | use serde_json::Value; 4 | 5 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 6 | #[serde(rename_all = "camelCase")] 7 | pub struct AWSAPICall { 8 | pub event_version: String, 9 | pub user_identity: UserIdentity, 10 | pub event_time: String, 11 | pub event_source: String, 12 | pub event_name: String, 13 | pub aws_region: String, 14 | #[serde(rename = "sourceIPAddress")] 15 | pub source_ipaddress: String, 16 | pub user_agent: String, 17 | pub request_parameters: I, 18 | pub response_elements: Option, 19 | #[serde(default)] 20 | pub additional_event_data: Option, 21 | #[serde(rename = "requestID")] 22 | pub request_id: String, 23 | #[serde(rename = "eventID")] 24 | pub event_id: String, 25 | pub event_type: String, 26 | } 27 | 28 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 29 | #[serde(rename_all = "camelCase")] 30 | pub struct UserIdentity { 31 | pub r#type: String, 32 | pub principal_id: String, 33 | pub arn: String, 34 | pub account_id: String, 35 | pub session_context: Option, 36 | } 37 | 38 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 39 | #[serde(rename_all = "camelCase")] 40 | pub struct SessionContext { 41 | pub attributes: Attributes, 42 | } 43 | 44 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 45 | #[serde(rename_all = "camelCase")] 46 | pub struct Attributes { 47 | pub mfa_authenticated: String, 48 | pub creation_date: String, 49 | } 50 | -------------------------------------------------------------------------------- /src/cloudwatch_events/codedeploy.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct StateChangeNotification { 7 | pub instance_group_id: String, 8 | pub region: String, 9 | pub application: String, 10 | pub deployment_id: String, 11 | pub state: String, 12 | pub deployment_group: String, 13 | } 14 | 15 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 16 | #[serde(rename_all = "camelCase")] 17 | pub struct DeploymentStateChangeNotification { 18 | pub instance_id: String, 19 | pub region: String, 20 | pub state: String, 21 | pub application: String, 22 | pub deployment_id: String, 23 | pub instance_group_id: String, 24 | pub deployment_group: String, 25 | } 26 | 27 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 28 | #[serde(rename_all = "camelCase")] 29 | pub struct InstanceStateChangeNotification { 30 | pub pipeline: String, 31 | pub version: String, 32 | pub state: String, 33 | #[serde(rename = "execution-id")] 34 | pub execution_id: String, 35 | } 36 | -------------------------------------------------------------------------------- /src/cloudwatch_events/codepipeline.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct PipelineExecutionStateChange { 7 | pub pipeline: String, 8 | pub version: String, 9 | pub state: String, 10 | #[serde(rename = "execution-id")] 11 | pub execution_id: String, 12 | } 13 | 14 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct StageExecutionStateChange { 17 | pub pipeline: String, 18 | pub version: String, 19 | #[serde(rename = "execution-id")] 20 | pub execution_id: String, 21 | pub stage: String, 22 | pub state: String, 23 | } 24 | 25 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 26 | #[serde(rename_all = "camelCase")] 27 | pub struct ActionExecutionStateChange { 28 | pub pipeline: String, 29 | pub version: i64, 30 | #[serde(rename = "execution-id")] 31 | pub execution_id: String, 32 | pub stage: String, 33 | pub action: String, 34 | pub state: String, 35 | pub region: String, 36 | #[serde(rename = "type")] 37 | pub type_field: ActionExecutionStateChangeType, 38 | } 39 | 40 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 41 | #[serde(rename_all = "camelCase")] 42 | pub struct ActionExecutionStateChangeType { 43 | pub owner: String, 44 | pub category: String, 45 | pub provider: String, 46 | pub version: i64, 47 | } 48 | -------------------------------------------------------------------------------- /src/cloudwatch_events/ec2.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct InstanceStateChange { 7 | #[serde(rename = "instance-id")] 8 | pub instance_id: String, 9 | pub state: String, 10 | } 11 | -------------------------------------------------------------------------------- /src/cloudwatch_events/emr.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct AutoScalingPolicyStateChange { 7 | pub resource_id: String, 8 | pub cluster_id: String, 9 | pub state: String, 10 | pub message: String, 11 | pub scaling_resource_type: String, 12 | } 13 | 14 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct ClusterStateChange { 17 | pub severity: String, 18 | pub state_change_reason: String, 19 | pub name: String, 20 | pub cluster_id: String, 21 | pub state: String, 22 | pub message: String, 23 | } 24 | 25 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 26 | #[serde(rename_all = "camelCase")] 27 | pub struct InstanceGroupStateChange { 28 | pub market: String, 29 | pub severity: String, 30 | pub requested_instance_count: String, 31 | pub instance_type: String, 32 | pub instance_group_type: String, 33 | pub instance_group_id: String, 34 | pub cluster_id: String, 35 | pub running_instance_count: String, 36 | pub state: String, 37 | pub message: String, 38 | } 39 | 40 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 41 | #[serde(rename_all = "camelCase")] 42 | pub struct StepStatusChange { 43 | pub severity: String, 44 | pub action_on_failure: String, 45 | pub step_id: String, 46 | pub name: String, 47 | pub cluster_id: String, 48 | pub state: String, 49 | pub message: String, 50 | } 51 | -------------------------------------------------------------------------------- /src/cloudwatch_events/gamelift.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct MatchmakingSearching { 7 | pub tickets: Vec, 8 | pub estimated_wait_millis: String, 9 | pub r#type: String, 10 | pub game_session_info: GameSessionInfo, 11 | } 12 | 13 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 14 | #[serde(rename_all = "camelCase")] 15 | pub struct Ticket { 16 | pub ticket_id: String, 17 | pub start_time: String, 18 | pub players: Vec, 19 | } 20 | 21 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 22 | #[serde(rename_all = "camelCase")] 23 | pub struct Player { 24 | pub player_id: String, 25 | pub team: Option, 26 | pub accepted: Option, 27 | pub player_session_id: Option, 28 | } 29 | 30 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 31 | #[serde(rename_all = "camelCase")] 32 | pub struct GameSessionInfo { 33 | pub players: Vec, 34 | } 35 | 36 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 37 | #[serde(rename_all = "camelCase")] 38 | pub struct PotentialMatchCreated { 39 | pub tickets: Vec, 40 | pub acceptance_timeout: i64, 41 | pub rule_evaluation_metrics: Vec, 42 | pub acceptance_required: bool, 43 | pub r#type: String, 44 | pub game_session_info: GameSessionInfo, 45 | pub match_id: String, 46 | } 47 | 48 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 49 | #[serde(rename_all = "camelCase")] 50 | pub struct RuleEvaluationMetric { 51 | pub rule_name: String, 52 | pub passed_count: i64, 53 | pub failed_count: i64, 54 | } 55 | 56 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 57 | #[serde(rename_all = "camelCase")] 58 | pub struct AcceptMatch { 59 | pub tickets: Vec, 60 | pub r#type: String, 61 | pub game_session_info: GameSessionInfo, 62 | pub match_id: String, 63 | } 64 | 65 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 66 | #[serde(rename_all = "camelCase")] 67 | pub struct AcceptMatchCompleted { 68 | pub tickets: Vec, 69 | pub acceptance: String, 70 | pub r#type: String, 71 | pub game_session_info: GameSessionInfo, 72 | pub match_id: String, 73 | } 74 | 75 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 76 | #[serde(rename_all = "camelCase")] 77 | pub struct MatchmakingSucceeded { 78 | pub tickets: Vec, 79 | pub r#type: String, 80 | pub game_session_info: GameSessionInfo, 81 | pub match_id: String, 82 | } 83 | 84 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 85 | #[serde(rename_all = "camelCase")] 86 | pub struct MatchmakingTimedOut { 87 | pub reason: String, 88 | pub tickets: Vec, 89 | pub rule_evaluation_metrics: Vec, 90 | pub r#type: String, 91 | pub message: String, 92 | pub game_session_info: GameSessionInfo, 93 | } 94 | 95 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 96 | #[serde(rename_all = "camelCase")] 97 | pub struct MatchmakingCancelled { 98 | pub reason: String, 99 | pub tickets: Vec, 100 | pub rule_evaluation_metrics: Vec, 101 | pub r#type: String, 102 | pub message: String, 103 | pub game_session_info: GameSessionInfo, 104 | } 105 | 106 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 107 | #[serde(rename_all = "camelCase")] 108 | pub struct MatchmakingFailed { 109 | pub tickets: Vec, 110 | pub custom_event_data: String, 111 | pub r#type: String, 112 | pub reason: String, 113 | pub message: String, 114 | pub game_session_info: GameSessionInfo, 115 | pub match_id: String, 116 | } 117 | -------------------------------------------------------------------------------- /src/cloudwatch_events/glue.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct JobRunStateChange { 7 | pub job_name: String, 8 | pub severity: String, 9 | pub state: String, 10 | pub job_run_id: String, 11 | pub message: String, 12 | } 13 | 14 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct CrawlerStarted { 17 | pub account_id: String, 18 | pub crawler_name: String, 19 | pub start_time: String, 20 | pub state: String, 21 | pub message: String, 22 | } 23 | 24 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 25 | #[serde(rename_all = "camelCase")] 26 | pub struct CrawlerSucceeded { 27 | pub tables_created: String, 28 | pub warning_message: String, 29 | pub partitions_updated: String, 30 | pub tables_updated: String, 31 | pub message: String, 32 | pub partitions_deleted: String, 33 | pub account_id: String, 34 | #[serde(rename = "runningTime (sec)")] 35 | pub running_time_sec: String, 36 | pub tables_deleted: String, 37 | pub crawler_name: String, 38 | pub completion_date: String, 39 | pub state: String, 40 | pub partitions_created: String, 41 | pub cloud_watch_log_link: String, 42 | } 43 | 44 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 45 | #[serde(rename_all = "camelCase")] 46 | pub struct CrawlerFailed { 47 | pub crawler_name: String, 48 | pub error_message: String, 49 | pub account_id: String, 50 | pub cloud_watch_log_link: String, 51 | pub state: String, 52 | pub message: String, 53 | } 54 | 55 | #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] 56 | #[serde(rename_all = "camelCase")] 57 | pub struct JobRunStatus { 58 | pub job_name: String, 59 | pub severity: String, 60 | pub notification_condition: NotificationCondition, 61 | pub state: String, 62 | pub job_run_id: String, 63 | pub message: String, 64 | pub started_on: String, 65 | } 66 | 67 | #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] 68 | #[serde(rename_all = "camelCase")] 69 | pub struct NotificationCondition { 70 | #[serde(rename = "NotifyDelayAfter")] 71 | pub notify_delay_after: f64, 72 | } 73 | 74 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 75 | #[serde(rename_all = "camelCase")] 76 | pub struct DataCatalogTableStateChange { 77 | pub database_name: String, 78 | pub changed_partitions: Vec, 79 | pub type_of_change: String, 80 | pub table_name: String, 81 | } 82 | 83 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 84 | #[serde(rename_all = "camelCase")] 85 | pub struct DataCatalogDatabaseStateChange { 86 | pub database_name: String, 87 | pub type_of_change: String, 88 | pub changed_tables: Vec, 89 | } 90 | -------------------------------------------------------------------------------- /src/cloudwatch_events/health.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use serde_derive::Deserialize; 4 | use serde_derive::Serialize; 5 | 6 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 7 | #[serde(rename_all = "camelCase")] 8 | pub struct Event { 9 | pub event_arn: String, 10 | pub service: String, 11 | pub event_type_code: String, 12 | pub event_type_category: String, 13 | pub start_time: String, 14 | pub end_time: String, 15 | pub event_description: Vec, 16 | pub affected_entities: Option>, 17 | } 18 | 19 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 20 | #[serde(rename_all = "camelCase")] 21 | pub struct EventDescription { 22 | pub language: String, 23 | pub latest_description: String, 24 | } 25 | 26 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 27 | #[serde(rename_all = "camelCase")] 28 | pub struct Entity { 29 | pub entity_value: String, 30 | pub tags: HashMap, 31 | } 32 | -------------------------------------------------------------------------------- /src/cloudwatch_events/kms.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct CMKEvent { 7 | #[serde(rename = "key-id")] 8 | pub key_id: String, 9 | } 10 | -------------------------------------------------------------------------------- /src/cloudwatch_events/mod.rs: -------------------------------------------------------------------------------- 1 | use chrono::{DateTime, Utc}; 2 | use serde::de::DeserializeOwned; 3 | use serde::ser::Serialize; 4 | use serde_json::Value; 5 | 6 | pub mod cloudtrail; 7 | pub mod codedeploy; 8 | pub mod codepipeline; 9 | pub mod ec2; 10 | pub mod emr; 11 | pub mod gamelift; 12 | pub mod glue; 13 | pub mod health; 14 | pub mod kms; 15 | pub mod macie; 16 | pub mod opsworks; 17 | pub mod signin; 18 | pub mod sms; 19 | pub mod ssm; 20 | pub mod tag; 21 | pub mod trustedadvisor; 22 | 23 | /// `CloudWatchEvent` is the outer structure of an event sent via CloudWatch Events. 24 | /// For examples of events that come via CloudWatch Events, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html 25 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] 26 | #[serde(rename_all = "camelCase")] 27 | pub struct CloudWatchEvent 28 | where 29 | T1: DeserializeOwned, 30 | T1: Serialize, 31 | { 32 | #[serde(default)] 33 | pub version: Option, 34 | #[serde(default)] 35 | pub id: Option, 36 | #[serde(default)] 37 | #[serde(rename = "detail-type")] 38 | pub detail_type: Option, 39 | #[serde(default)] 40 | pub source: Option, 41 | #[serde(default)] 42 | #[serde(rename = "account")] 43 | pub account_id: Option, 44 | pub time: DateTime, 45 | #[serde(default)] 46 | pub region: Option, 47 | pub resources: Vec, 48 | #[serde(bound = "")] 49 | pub detail: Option, 50 | } 51 | -------------------------------------------------------------------------------- /src/cloudwatch_events/opsworks.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct InstanceStateChange { 7 | #[serde(rename = "initiated_by")] 8 | pub initiated_by: String, 9 | pub hostname: String, 10 | #[serde(rename = "stack-id")] 11 | pub stack_id: String, 12 | #[serde(rename = "layer-ids")] 13 | pub layer_ids: Vec, 14 | #[serde(rename = "instance-id")] 15 | pub instance_id: String, 16 | #[serde(rename = "ec2-instance-id")] 17 | pub ec2_instance_id: String, 18 | pub status: String, 19 | } 20 | 21 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 22 | #[serde(rename_all = "camelCase")] 23 | pub struct CommandStateChange { 24 | #[serde(rename = "command-id")] 25 | pub command_id: String, 26 | #[serde(rename = "instance-id")] 27 | pub instance_id: String, 28 | pub r#type: String, 29 | pub status: String, 30 | } 31 | 32 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 33 | #[serde(rename_all = "camelCase")] 34 | pub struct DeploymentStateChange { 35 | pub duration: i64, 36 | #[serde(rename = "stack-id")] 37 | pub stack_id: String, 38 | #[serde(rename = "instance-ids")] 39 | pub instance_ids: Vec, 40 | #[serde(rename = "deployment-id")] 41 | pub deployment_id: String, 42 | pub command: String, 43 | pub status: String, 44 | } 45 | 46 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 47 | #[serde(rename_all = "camelCase")] 48 | pub struct Alert { 49 | #[serde(rename = "stack-id")] 50 | pub stack_id: String, 51 | #[serde(rename = "instance-id")] 52 | pub instance_id: String, 53 | pub r#type: String, 54 | pub message: String, 55 | } 56 | -------------------------------------------------------------------------------- /src/cloudwatch_events/signin.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | use serde_json::Value; 4 | 5 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 6 | #[serde(rename_all = "camelCase")] 7 | pub struct SignIn { 8 | pub event_version: String, 9 | pub user_identity: UserIdentity, 10 | pub event_time: String, 11 | pub event_source: String, 12 | pub event_name: String, 13 | pub aws_region: String, 14 | #[serde(rename = "sourceIPAddress")] 15 | pub source_ipaddress: String, 16 | pub user_agent: String, 17 | pub request_parameters: Value, 18 | pub response_elements: ResponseElements, 19 | pub additional_event_data: AdditionalEventData, 20 | #[serde(rename = "eventID")] 21 | pub event_id: String, 22 | pub event_type: String, 23 | } 24 | 25 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 26 | #[serde(rename_all = "camelCase")] 27 | pub struct UserIdentity { 28 | pub r#type: String, 29 | pub principal_id: String, 30 | pub arn: String, 31 | pub account_id: String, 32 | } 33 | 34 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 35 | #[serde(rename_all = "camelCase")] 36 | pub struct ResponseElements { 37 | #[serde(rename = "ConsoleLogin")] 38 | pub console_login: String, 39 | } 40 | 41 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 42 | #[serde(rename_all = "camelCase")] 43 | pub struct AdditionalEventData { 44 | #[serde(rename = "LoginTo")] 45 | pub login_to: String, 46 | #[serde(rename = "MobileVersion")] 47 | pub mobile_version: String, 48 | #[serde(rename = "MFAUsed")] 49 | pub mfaused: String, 50 | } 51 | -------------------------------------------------------------------------------- /src/cloudwatch_events/sms.rs: -------------------------------------------------------------------------------- 1 | use serde_derive::Deserialize; 2 | use serde_derive::Serialize; 3 | 4 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct JobStateChange { 7 | pub state: String, 8 | #[serde(rename = "replication-run-id")] 9 | pub replication_run_id: String, 10 | #[serde(rename = "replication-job-id")] 11 | pub replication_job_id: String, 12 | #[serde(rename = "ami-id")] 13 | pub ami_id: Option, 14 | pub version: String, 15 | } 16 | -------------------------------------------------------------------------------- /src/cloudwatch_events/tag.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use serde_derive::Deserialize; 4 | use serde_derive::Serialize; 5 | 6 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 7 | #[serde(rename_all = "camelCase")] 8 | pub struct TagChangeOnResource { 9 | #[serde(rename = "changed-tag-keys")] 10 | pub changed_tag_keys: Vec, 11 | pub service: String, 12 | #[serde(rename = "resource-type")] 13 | pub resource_type: String, 14 | pub version: i64, 15 | pub tags: HashMap, 16 | } 17 | -------------------------------------------------------------------------------- /src/cloudwatch_events/trustedadvisor.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use serde_derive::Deserialize; 4 | use serde_derive::Serialize; 5 | 6 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 7 | #[serde(rename_all = "camelCase")] 8 | pub struct CheckItemRefreshNotification { 9 | #[serde(rename = "check-name")] 10 | pub check_name: String, 11 | #[serde(rename = "check-item-detail")] 12 | pub check_item_detail: HashMap, 13 | pub status: String, 14 | #[serde(rename = "resource_id")] 15 | pub resource_id: String, 16 | pub uuid: String, 17 | } 18 | -------------------------------------------------------------------------------- /src/code_commit/mod.rs: -------------------------------------------------------------------------------- 1 | use chrono::{DateTime, Utc}; 2 | 3 | /// `CodeCommitEvent` represents a CodeCommit event 4 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct CodeCommitEvent { 7 | #[serde(rename = "Records")] 8 | pub records: Vec, 9 | } 10 | 11 | pub type CodeCommitEventTime = DateTime; 12 | 13 | /// `CodeCommitRecord` represents a CodeCommit record 14 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct CodeCommitRecord { 17 | #[serde(default)] 18 | pub event_id: Option, 19 | #[serde(default)] 20 | pub event_version: Option, 21 | pub event_time: CodeCommitEventTime, 22 | #[serde(default)] 23 | pub event_trigger_name: Option, 24 | pub event_part_number: u64, 25 | #[serde(rename = "codecommit")] 26 | pub code_commit: CodeCommitCodeCommit, 27 | #[serde(default)] 28 | pub event_name: Option, 29 | /// nolint: stylecheck 30 | #[serde(default)] 31 | pub event_trigger_config_id: Option, 32 | #[serde(default)] 33 | #[serde(rename = "eventSourceARN")] 34 | pub event_source_arn: Option, 35 | #[serde(default)] 36 | #[serde(rename = "userIdentityARN")] 37 | pub user_identity_arn: Option, 38 | #[serde(default)] 39 | pub event_source: Option, 40 | #[serde(default)] 41 | pub aws_region: Option, 42 | pub event_total_parts: u64, 43 | pub custom_data: Option, 44 | } 45 | 46 | /// `CodeCommitCodeCommit` represents a CodeCommit object in a record 47 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 48 | #[serde(rename_all = "camelCase")] 49 | pub struct CodeCommitCodeCommit { 50 | pub references: Vec, 51 | } 52 | 53 | /// `CodeCommitReference` represents a Reference object in a CodeCommit object 54 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 55 | #[serde(rename_all = "camelCase")] 56 | pub struct CodeCommitReference { 57 | #[serde(default)] 58 | pub commit: Option, 59 | #[serde(default)] 60 | pub ref_: Option, 61 | #[serde(skip_serializing_if = "Option::is_none")] 62 | pub created: Option, 63 | } 64 | 65 | #[cfg(test)] 66 | mod test { 67 | use super::*; 68 | 69 | extern crate serde_json; 70 | 71 | #[test] 72 | #[cfg(feature = "code_commit")] 73 | fn example_code_commit_event() { 74 | let data = include_bytes!("../fixtures/example-code_commit-event.json"); 75 | let parsed: CodeCommitEvent = serde_json::from_slice(data).unwrap(); 76 | let output: String = serde_json::to_string(&parsed).unwrap(); 77 | let reparsed: CodeCommitEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 78 | assert_eq!(parsed, reparsed); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/codedeploy/mod.rs: -------------------------------------------------------------------------------- 1 | use chrono::{DateTime, Utc}; 2 | 3 | pub type CodeDeployDeploymentState = String; 4 | 5 | /// `CodeDeployEvent` is documented at: 6 | /// https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#acd_event_types 7 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 8 | #[serde(rename_all = "camelCase")] 9 | pub struct CodeDeployEvent { 10 | /// AccountID is the id of the AWS account from which the event originated. 11 | #[serde(default)] 12 | #[serde(rename = "account")] 13 | pub account_id: Option, 14 | /// Region is the AWS region from which the event originated. 15 | #[serde(default)] 16 | pub region: Option, 17 | /// DetailType informs the schema of the Detail field. For deployment state-change 18 | /// events, the value should be equal to CodeDeployDeploymentEventDetailType. 19 | /// For instance state-change events, the value should be equal to 20 | /// CodeDeployInstanceEventDetailType. 21 | #[serde(default)] 22 | #[serde(rename = "detail-type")] 23 | pub detail_type: Option, 24 | /// Source should be equal to CodeDeployEventSource. 25 | #[serde(default)] 26 | pub source: Option, 27 | /// Version is the version of the event's schema. 28 | #[serde(default)] 29 | pub version: Option, 30 | /// Time is the event's timestamp. 31 | pub time: DateTime, 32 | /// ID is the GUID of this event. 33 | #[serde(default)] 34 | pub id: Option, 35 | /// Resources is a list of ARNs of CodeDeploy applications and deployment 36 | /// groups that this event pertains to. 37 | pub resources: Vec, 38 | /// Detail contains information specific to a deployment event. 39 | pub detail: CodeDeployEventDetail, 40 | } 41 | 42 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 43 | #[serde(rename_all = "camelCase")] 44 | pub struct CodeDeployEventDetail { 45 | /// InstanceGroupID is the ID of the instance group. 46 | #[serde(default)] 47 | pub instance_group_id: Option, 48 | /// InstanceID is the id of the instance. This field is non-empty only if 49 | /// the DetailType of the complete event is CodeDeployInstanceEventDetailType. 50 | pub instance_id: Option, 51 | /// Region is the AWS region that the event originated from. 52 | #[serde(default)] 53 | pub region: Option, 54 | /// Application is the name of the CodeDeploy application. 55 | #[serde(default)] 56 | pub application: Option, 57 | /// DeploymentID is the id of the deployment. 58 | #[serde(default)] 59 | pub deployment_id: Option, 60 | /// State is the new state of the deployment. 61 | pub state: CodeDeployDeploymentState, 62 | /// DeploymentGroup is the name of the deployment group. 63 | #[serde(default)] 64 | pub deployment_group: Option, 65 | } 66 | 67 | #[cfg(test)] 68 | mod test { 69 | use super::*; 70 | 71 | extern crate serde_json; 72 | 73 | #[test] 74 | #[cfg(feature = "codedeploy")] 75 | fn example_codedeploy_deployment_event() { 76 | let data = include_bytes!("../fixtures/example-codedeploy-deployment-event.json"); 77 | let parsed: CodeDeployEvent = serde_json::from_slice(data).unwrap(); 78 | let output: String = serde_json::to_string(&parsed).unwrap(); 79 | let reparsed: CodeDeployEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 80 | assert_eq!(parsed, reparsed); 81 | } 82 | 83 | #[test] 84 | #[cfg(feature = "codedeploy")] 85 | fn example_codedeploy_instance_event() { 86 | let data = include_bytes!("../fixtures/example-codedeploy-instance-event.json"); 87 | let parsed: CodeDeployEvent = serde_json::from_slice(data).unwrap(); 88 | let output: String = serde_json::to_string(&parsed).unwrap(); 89 | let reparsed: CodeDeployEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 90 | assert_eq!(parsed, reparsed); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/config/mod.rs: -------------------------------------------------------------------------------- 1 | /// `ConfigEvent` contains data from an event sent from AWS Config 2 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 3 | #[serde(rename_all = "camelCase")] 4 | pub struct ConfigEvent { 5 | /// The ID of the AWS account that owns the rule 6 | #[serde(default)] 7 | pub account_id: Option, 8 | /// The ARN that AWS Config assigned to the rule 9 | /// 10 | /// nolint:stylecheck 11 | #[serde(default)] 12 | pub config_rule_arn: Option, 13 | /// nolint:stylecheck 14 | #[serde(default)] 15 | pub config_rule_id: Option, 16 | /// The name that you assigned to the rule that caused AWS Config to publish the event 17 | #[serde(default)] 18 | pub config_rule_name: Option, 19 | /// A boolean value that indicates whether the AWS resource to be evaluated has been removed from the rule's scope 20 | pub event_left_scope: bool, 21 | /// nolint:stylecheck 22 | #[serde(default)] 23 | pub execution_role_arn: Option, 24 | /// If the event is published in response to a resource configuration change, this value contains a JSON configuration item 25 | #[serde(default)] 26 | pub invoking_event: Option, 27 | /// A token that the function must pass to AWS Config with the PutEvaluations call 28 | #[serde(default)] 29 | pub result_token: Option, 30 | /// Key/value pairs that the function processes as part of its evaluation logic 31 | #[serde(default)] 32 | pub rule_parameters: Option, 33 | #[serde(default)] 34 | pub version: Option, 35 | } 36 | 37 | #[cfg(test)] 38 | mod test { 39 | use super::*; 40 | 41 | extern crate serde_json; 42 | 43 | #[test] 44 | #[cfg(feature = "config")] 45 | fn example_config_event() { 46 | let data = include_bytes!("../fixtures/example-config-event.json"); 47 | let parsed: ConfigEvent = serde_json::from_slice(data).unwrap(); 48 | let output: String = serde_json::to_string(&parsed).unwrap(); 49 | let reparsed: ConfigEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 50 | assert_eq!(parsed, reparsed); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/custom_serde/codebuild_time.rs: -------------------------------------------------------------------------------- 1 | use chrono::{DateTime, TimeZone, Utc}; 2 | use serde::de::{Deserialize, Deserializer, Error as DeError, Visitor}; 3 | use serde::ser::Serializer; 4 | use std::fmt; 5 | 6 | // Jan 2, 2006 3:04:05 PM 7 | const CODEBUILD_TIME_FORMAT: &str = "%b %e, %Y %l:%M:%S %p"; 8 | 9 | struct TimeVisitor; 10 | impl<'de> Visitor<'de> for TimeVisitor { 11 | type Value = DateTime; 12 | 13 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { 14 | write!(formatter, "valid codebuild time: {}", CODEBUILD_TIME_FORMAT) 15 | } 16 | 17 | fn visit_str(self, val: &str) -> Result { 18 | Utc.datetime_from_str(val, CODEBUILD_TIME_FORMAT) 19 | .map_err(|e| DeError::custom(format!("Parse error {} for {}", e, val))) 20 | } 21 | } 22 | 23 | pub(crate) mod str_time { 24 | use super::*; 25 | 26 | pub(crate) fn deserialize<'de, D>(d: D) -> Result, D::Error> 27 | where 28 | D: Deserializer<'de>, 29 | { 30 | d.deserialize_str(TimeVisitor) 31 | } 32 | 33 | pub fn serialize(date: &DateTime, ser: S) -> Result { 34 | let s = format!("{}", date.format(CODEBUILD_TIME_FORMAT)); 35 | ser.serialize_str(&s) 36 | } 37 | } 38 | 39 | pub(crate) mod optional_time { 40 | use super::*; 41 | 42 | pub(crate) fn deserialize<'de, D>(deserializer: D) -> Result>, D::Error> 43 | where 44 | D: Deserializer<'de>, 45 | { 46 | let s: Option = Option::deserialize(deserializer)?; 47 | if let Some(val) = s { 48 | let visitor = TimeVisitor {}; 49 | return visitor.visit_str(&val).map(Some); 50 | } 51 | 52 | Ok(None) 53 | } 54 | 55 | pub fn serialize( 56 | date: &Option>, 57 | ser: S, 58 | ) -> Result { 59 | if let Some(date) = date { 60 | return str_time::serialize(date, ser); 61 | } 62 | 63 | ser.serialize_none() 64 | } 65 | } 66 | 67 | #[cfg(test)] 68 | mod tests { 69 | use super::*; 70 | 71 | type TestTime = DateTime; 72 | 73 | #[test] 74 | fn test_deserialize_codebuild_time() { 75 | #[derive(Deserialize)] 76 | struct Test { 77 | #[serde(with = "str_time")] 78 | pub date: TestTime, 79 | } 80 | let data = json!({ 81 | "date": "Sep 1, 2017 4:12:29 PM" 82 | }); 83 | 84 | let expected = Utc 85 | .datetime_from_str("Sep 1, 2017 4:12:29 PM", CODEBUILD_TIME_FORMAT) 86 | .unwrap(); 87 | let decoded: Test = serde_json::from_value(data).unwrap(); 88 | assert_eq!(expected, decoded.date); 89 | } 90 | 91 | #[test] 92 | fn test_deserialize_codebuild_optional_time() { 93 | #[derive(Deserialize)] 94 | struct Test { 95 | #[serde(with = "optional_time")] 96 | pub date: Option, 97 | } 98 | let data = json!({ 99 | "date": "Sep 1, 2017 4:12:29 PM" 100 | }); 101 | 102 | let expected = Utc 103 | .datetime_from_str("Sep 1, 2017 4:12:29 PM", CODEBUILD_TIME_FORMAT) 104 | .unwrap(); 105 | let decoded: Test = serde_json::from_value(data).unwrap(); 106 | assert_eq!(Some(expected), decoded.date); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/custom_serde/float_unix_epoch.rs: -------------------------------------------------------------------------------- 1 | use serde::{de, ser}; 2 | use std::fmt; 3 | 4 | use chrono::offset::TimeZone; 5 | use chrono::{DateTime, LocalResult, Utc}; 6 | 7 | enum SerdeError { 8 | NonExistent { timestamp: V }, 9 | Ambiguous { timestamp: V, min: D, max: D }, 10 | } 11 | 12 | fn ne_timestamp(ts: T) -> SerdeError { 13 | SerdeError::NonExistent:: { timestamp: ts } 14 | } 15 | 16 | impl fmt::Debug for SerdeError { 17 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 18 | write!(f, "ChronoSerdeError({})", self) 19 | } 20 | } 21 | 22 | impl fmt::Display for SerdeError { 23 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 24 | match *self { 25 | SerdeError::NonExistent { ref timestamp } => { 26 | write!(f, "value is not a legal timestamp: {}", timestamp) 27 | } 28 | SerdeError::Ambiguous { 29 | ref timestamp, 30 | ref min, 31 | ref max, 32 | } => write!( 33 | f, 34 | "value is an ambiguous timestamp: {}, could be either of {}, {}", 35 | timestamp, min, max 36 | ), 37 | } 38 | } 39 | } 40 | 41 | fn serde_from(me: LocalResult, ts: &V) -> Result 42 | where 43 | E: de::Error, 44 | V: fmt::Display, 45 | T: fmt::Display, 46 | { 47 | match me { 48 | LocalResult::None => Err(E::custom(ne_timestamp(ts))), 49 | LocalResult::Ambiguous(min, max) => Err(E::custom(SerdeError::Ambiguous { 50 | timestamp: ts, 51 | min, 52 | max, 53 | })), 54 | LocalResult::Single(val) => Ok(val), 55 | } 56 | } 57 | 58 | struct SecondsFloatTimestampVisitor; 59 | 60 | /// Serialize a UTC datetime into an float number of seconds since the epoch 61 | /// ``` 62 | pub fn serialize(dt: &DateTime, serializer: S) -> Result 63 | where 64 | S: ser::Serializer, 65 | { 66 | serializer.serialize_i64(dt.timestamp_millis() / 1000) 67 | } 68 | 69 | /// Deserialize a `DateTime` from a float seconds timestamp 70 | pub fn deserialize<'de, D>(d: D) -> Result, D::Error> 71 | where 72 | D: de::Deserializer<'de>, 73 | { 74 | d.deserialize_f64(SecondsFloatTimestampVisitor) 75 | } 76 | 77 | impl<'de> de::Visitor<'de> for SecondsFloatTimestampVisitor { 78 | type Value = DateTime; 79 | 80 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { 81 | formatter.write_str("a unix timestamp as a float") 82 | } 83 | 84 | /// Deserialize a timestamp in seconds since the epoch 85 | fn visit_u64(self, value: u64) -> Result, E> 86 | where 87 | E: de::Error, 88 | { 89 | serde_from(Utc.timestamp_opt(value as i64, 0), &value) 90 | } 91 | 92 | /// Deserialize a timestamp in seconds since the epoch 93 | fn visit_i64(self, value: i64) -> Result, E> 94 | where 95 | E: de::Error, 96 | { 97 | serde_from(Utc.timestamp_opt(value, 0), &value) 98 | } 99 | 100 | /// Deserialize a timestamp in seconds since the epoch 101 | fn visit_f64(self, value: f64) -> Result, E> 102 | where 103 | E: de::Error, 104 | { 105 | let time_ms = (value.fract() * 1_000_000.).floor() as u32; 106 | let time_s = value.trunc() as i64; 107 | serde_from(Utc.timestamp_opt(time_s, time_ms), &value) 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/custom_serde/http_method.rs: -------------------------------------------------------------------------------- 1 | use http::Method; 2 | use serde::de::{Deserialize, Deserializer, Error as DeError, Unexpected, Visitor}; 3 | use serde::ser::Serializer; 4 | use std::fmt; 5 | 6 | pub fn serialize(method: &Method, ser: S) -> Result { 7 | ser.serialize_str(method.as_str()) 8 | } 9 | 10 | struct MethodVisitor; 11 | impl<'de> Visitor<'de> for MethodVisitor { 12 | type Value = Method; 13 | 14 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { 15 | write!(formatter, "valid method name") 16 | } 17 | 18 | fn visit_str(self, val: &str) -> Result { 19 | if val.is_empty() { 20 | Ok(Method::GET) 21 | } else { 22 | val.parse() 23 | .map_err(|_| DeError::invalid_value(Unexpected::Str(val), &self)) 24 | } 25 | } 26 | } 27 | 28 | pub fn deserialize<'de, D>(de: D) -> Result 29 | where 30 | D: Deserializer<'de>, 31 | { 32 | de.deserialize_str(MethodVisitor) 33 | } 34 | 35 | pub fn deserialize_optional<'de, D>(deserializer: D) -> Result, D::Error> 36 | where 37 | D: Deserializer<'de>, 38 | { 39 | let s: Option = Option::deserialize(deserializer)?; 40 | if let Some(val) = s { 41 | let visitor = MethodVisitor {}; 42 | return visitor.visit_str(&val).map(Some); 43 | } 44 | 45 | Ok(None) 46 | } 47 | 48 | pub fn serialize_optional( 49 | method: &Option, 50 | ser: S, 51 | ) -> Result { 52 | if let Some(method) = method { 53 | return serialize(method, ser); 54 | } 55 | 56 | ser.serialize_none() 57 | } 58 | 59 | #[cfg(test)] 60 | mod tests { 61 | use super::*; 62 | 63 | #[test] 64 | fn test_http_method_serializer() { 65 | #[derive(Deserialize, Serialize)] 66 | struct Test { 67 | #[serde(with = "crate::custom_serde::http_method")] 68 | pub method: http::Method, 69 | } 70 | let data = json!({ 71 | "method": "DELETE" 72 | }); 73 | let decoded: Test = serde_json::from_value(data.clone()).unwrap(); 74 | assert_eq!(http::Method::DELETE, decoded.method); 75 | 76 | let recoded = serde_json::to_value(decoded).unwrap(); 77 | assert_eq!(data, recoded); 78 | } 79 | 80 | #[test] 81 | fn test_http_optional_method_serializer() { 82 | #[derive(Deserialize, Serialize)] 83 | struct Test { 84 | #[serde(deserialize_with = "deserialize_optional")] 85 | #[serde(serialize_with = "serialize_optional")] 86 | #[serde(default)] 87 | pub method: Option, 88 | } 89 | let data = json!({ 90 | "method": "DELETE" 91 | }); 92 | let decoded: Test = serde_json::from_value(data.clone()).unwrap(); 93 | assert_eq!(Some(http::Method::DELETE), decoded.method); 94 | 95 | let recoded = serde_json::to_value(decoded).unwrap(); 96 | assert_eq!(data, recoded); 97 | 98 | let data = json!({ "method": null }); 99 | let decoded: Test = serde_json::from_value(data.clone()).unwrap(); 100 | assert_eq!(None, decoded.method); 101 | 102 | let data = json!({}); 103 | let decoded: Test = serde_json::from_value(data.clone()).unwrap(); 104 | assert_eq!(None, decoded.method); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/ecr_scan/mod.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 2 | #[serde(rename_all = "camelCase")] 3 | pub struct EcrScanEvent { 4 | #[serde(default)] 5 | pub version: Option, 6 | #[serde(default)] 7 | pub id: Option, 8 | #[serde(default)] 9 | #[serde(rename = "detail-type")] 10 | pub detail_type: Option, 11 | #[serde(default)] 12 | pub source: Option, 13 | #[serde(default)] 14 | pub time: Option, 15 | #[serde(default)] 16 | pub region: Option, 17 | pub resources: Vec, 18 | #[serde(default)] 19 | pub account: Option, 20 | pub detail: EcrScanEventDetailType, 21 | } 22 | 23 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 24 | #[serde(rename_all = "camelCase")] 25 | pub struct EcrScanEventDetailType { 26 | #[serde(default)] 27 | #[serde(rename = "scan-status")] 28 | pub scan_status: Option, 29 | #[serde(default)] 30 | #[serde(rename = "repository-name")] 31 | pub repository_name: Option, 32 | #[serde(rename = "finding-severity-counts")] 33 | pub finding_severity_counts: EcrScanEventFindingSeverityCounts, 34 | #[serde(default)] 35 | #[serde(rename = "image-digest")] 36 | pub image_digest: Option, 37 | #[serde(rename = "image-tags")] 38 | pub image_tags: Vec, 39 | } 40 | 41 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 42 | #[serde(rename_all = "camelCase")] 43 | pub struct EcrScanEventFindingSeverityCounts { 44 | #[serde(rename = "CRITICAL")] 45 | pub critical: i64, 46 | #[serde(rename = "HIGH")] 47 | pub high: i64, 48 | #[serde(rename = "MEDIUM")] 49 | pub medium: i64, 50 | #[serde(rename = "LOW")] 51 | pub low: i64, 52 | #[serde(rename = "INFORMATIONAL")] 53 | pub informational: i64, 54 | #[serde(rename = "UNDEFINED")] 55 | pub undefined: i64, 56 | } 57 | 58 | #[cfg(test)] 59 | mod test { 60 | use super::*; 61 | 62 | extern crate serde_json; 63 | 64 | #[test] 65 | #[cfg(feature = "ecr_scan")] 66 | fn example_ecr_image_scan_event() { 67 | let data = include_bytes!("../fixtures/example-ecr-image-scan-event.json"); 68 | let parsed: EcrScanEvent = serde_json::from_slice(data).unwrap(); 69 | let output: String = serde_json::to_string(&parsed).unwrap(); 70 | let reparsed: EcrScanEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 71 | assert_eq!(parsed, reparsed); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/firehose/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::custom_serde::*; 2 | use crate::encodings::{Base64Data, MillisecondTimestamp}; 3 | use std::collections::HashMap; 4 | 5 | /// `KinesisFirehoseEvent` represents the input event from Amazon Kinesis Firehose. It is used as the input parameter. 6 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 7 | #[serde(rename_all = "camelCase")] 8 | pub struct KinesisFirehoseEvent { 9 | #[serde(default)] 10 | pub invocation_id: Option, 11 | /// nolint: stylecheck 12 | #[serde(default)] 13 | pub delivery_stream_arn: Option, 14 | /// nolint: stylecheck 15 | #[serde(default)] 16 | pub source_kinesis_stream_arn: Option, 17 | #[serde(default)] 18 | pub region: Option, 19 | pub records: Vec, 20 | } 21 | 22 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 23 | #[serde(rename_all = "camelCase")] 24 | pub struct KinesisFirehoseEventRecord { 25 | #[serde(default)] 26 | pub record_id: Option, 27 | pub approximate_arrival_timestamp: MillisecondTimestamp, 28 | pub data: Base64Data, 29 | #[serde(rename = "kinesisRecordMetadata")] 30 | pub kinesis_firehose_record_metadata: Option, 31 | } 32 | 33 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 34 | #[serde(rename_all = "camelCase")] 35 | pub struct KinesisFirehoseResponse { 36 | pub records: Vec, 37 | } 38 | 39 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 40 | #[serde(rename_all = "camelCase")] 41 | pub struct KinesisFirehoseResponseRecord { 42 | #[serde(default)] 43 | pub record_id: Option, 44 | /// The status of the transformation. May be TransformedStateOk, TransformedStateDropped or TransformedStateProcessingFailed 45 | #[serde(default)] 46 | pub result: Option, 47 | pub data: Base64Data, 48 | pub metadata: KinesisFirehoseResponseRecordMetadata, 49 | } 50 | 51 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 52 | #[serde(rename_all = "camelCase")] 53 | pub struct KinesisFirehoseResponseRecordMetadata { 54 | #[serde(deserialize_with = "deserialize_lambda_map")] 55 | #[serde(default)] 56 | pub partition_keys: HashMap, 57 | } 58 | 59 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 60 | #[serde(rename_all = "camelCase")] 61 | pub struct KinesisFirehoseRecordMetadata { 62 | #[serde(default)] 63 | pub shard_id: Option, 64 | #[serde(default)] 65 | pub partition_key: Option, 66 | #[serde(default)] 67 | pub sequence_number: Option, 68 | pub subsequence_number: i64, 69 | pub approximate_arrival_timestamp: MillisecondTimestamp, 70 | } 71 | 72 | #[cfg(test)] 73 | mod test { 74 | use super::*; 75 | 76 | extern crate serde_json; 77 | 78 | #[test] 79 | #[cfg(feature = "firehose")] 80 | fn example_firehose_event() { 81 | let data = include_bytes!("../fixtures/example-firehose-event.json"); 82 | let parsed: KinesisFirehoseEvent = serde_json::from_slice(data).unwrap(); 83 | let output: String = serde_json::to_string(&parsed).unwrap(); 84 | let reparsed: KinesisFirehoseEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 85 | assert_eq!(parsed, reparsed); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/fixtures/example-activemq-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "eventSource": "aws:mq", 3 | "eventSourceArn": "arn:aws:mq:us-west-2:533019413397:broker:shask-test:b-0f5b7522-2b41-4f85-a615-735a4e6d96b5", 4 | "messages": [ 5 | { 6 | "messageID": "ID:b-0f5b7522-2b41-4f85-a615-735a4e6d96b5-2.mq.us-west-2.amazonaws.com-34859-1598944546501-4:12:1:1:3", 7 | "messageType": "jms/text-message", 8 | "timestamp": 1599863938941, 9 | "deliveryMode": 1, 10 | "correlationID": "", 11 | "replyTo": "null", 12 | "destination": { 13 | "physicalName": "testQueue" 14 | }, 15 | "redelivered": false, 16 | "type": "", 17 | "expiration": 0, 18 | "priority": 0, 19 | "data": "RW50ZXIgc29tZSB0ZXh0IGhlcmUgZm9yIHRoZSBtZXNzYWdlIGJvZHkuLi4=", 20 | "brokerInTime": 1599863938943, 21 | "brokerOutTime": 1599863938944, 22 | "properties": {"testKey": "testValue"} 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /src/fixtures/example-alb-lambda-target-request-headers-only.json: -------------------------------------------------------------------------------- 1 | { 2 | "requestContext": { 3 | "elb": { 4 | "targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/lambda-target/abcdefg" 5 | } 6 | }, 7 | "httpMethod": "GET", 8 | "path": "/", 9 | "queryStringParameters": { 10 | "key": "hello" 11 | }, 12 | "headers": { 13 | "accept": "*/*", 14 | "connection": "keep-alive", 15 | "host": "lambda-test-alb-1334523864.us-east-1.elb.amazonaws.com", 16 | "user-agent": "curl/7.54.0", 17 | "x-amzn-trace-id": "Root=1-5c34e93e-4dea0086f9763ac0667b115a", 18 | "x-forwarded-for": "25.12.198.67", 19 | "x-forwarded-port": "80", 20 | "x-forwarded-proto": "http", 21 | "x-imforwards": "20", 22 | "x-myheader": "123" 23 | }, 24 | "isBase64Encoded": false 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/fixtures/example-alb-lambda-target-request-multivalue-headers.json: -------------------------------------------------------------------------------- 1 | { 2 | "requestContext": { 3 | "elb": { 4 | "targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/lambda-target/abcdefgh" 5 | } 6 | }, 7 | "httpMethod": "GET", 8 | "path": "/", 9 | "multiValueQueryStringParameters": { 10 | "key": [ 11 | "hello" 12 | ] 13 | }, 14 | "multiValueHeaders": { 15 | "accept": [ 16 | "*/*" 17 | ], 18 | "connection": [ 19 | "keep-alive" 20 | ], 21 | "host": [ 22 | "lambda-test-alb-1234567.us-east-1.elb.amazonaws.com" 23 | ], 24 | "user-agent": [ 25 | "curl/7.54.0" 26 | ], 27 | "x-amzn-trace-id": [ 28 | "Root=1-5c34e7d4-00ca239424b68028d4c56d68" 29 | ], 30 | "x-forwarded-for": [ 31 | "72.21.198.67" 32 | ], 33 | "x-forwarded-port": [ 34 | "80" 35 | ], 36 | "x-forwarded-proto": [ 37 | "http" 38 | ], 39 | "x-imforwards": [ 40 | "20" 41 | ], 42 | "x-myheader": [ 43 | "123" 44 | ] 45 | }, 46 | "body": "Some text", 47 | "isBase64Encoded": false 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/fixtures/example-alb-lambda-target-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "isBase64Encoded": false, 3 | "statusCode": 200, 4 | "statusDescription": "200 OK", 5 | "headers": { 6 | "Set-cookie": "cookies", 7 | "Content-Type": "application/json" 8 | }, 9 | "multiValueHeaders": { 10 | "Set-cookie": ["cookie-name=cookie-value;Domain=myweb.com;Secure;HttpOnly","cookie-name=cookie-value;Expires=May 8, 2019"], 11 | "Content-Type": ["application/json"] 12 | }, 13 | "body": "Hello from Lambda" 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-console-test-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "body": "{\r\n\t\"a\": 1\r\n}", 3 | "headers":null, 4 | "httpMethod":"POST", 5 | "isBase64Encoded":false, 6 | "multiValueHeaders":null, 7 | "multiValueQueryStringParameters":null, 8 | "path":"/myPath", 9 | "pathParameters":null, 10 | "queryStringParameters":null, 11 | "requestContext":{ 12 | "accountId":"xxxxx", 13 | "apiId":"xxxxx", 14 | "domainName":"testPrefix.testDomainName", 15 | "domainPrefix":"testPrefix", 16 | "extendedRequestId":"NvWWKEZbliAFliA=", 17 | "httpMethod":"POST", 18 | "identity":{ 19 | "accessKey":"xxxxx", 20 | "accountId":"xxxxx", 21 | "apiKey":"test-invoke-api-key", 22 | "apiKeyId":"test-invoke-api-key-id", 23 | "caller":"xxxxx:xxxxx", 24 | "cognitoAuthenticationProvider":null, 25 | "cognitoAuthenticationType":null, 26 | "cognitoIdentityId":null, 27 | "cognitoIdentityPoolId":null, 28 | "principalOrgId":null, 29 | "sourceIp":"test-invoke-source-ip", 30 | "user":"xxxxx:xxxxx", 31 | "userAgent":"aws-internal/3 aws-sdk-java/1.12.154 Linux/5.4.156-94.273.amzn2int.x86_64 OpenJDK_64-Bit_Server_VM/25.322-b06 java/1.8.0_322 vendor/Oracle_Corporation cfg/retry-mode/standard", 32 | "userArn":"arn:aws:sts::xxxxx:assumed-role/xxxxx/xxxxx" 33 | }, 34 | "path":"/myPath", 35 | "protocol":"HTTP/1.1", 36 | "requestId":"e5488776-afe4-4e5e-92b1-37bd23f234d6", 37 | "requestTime":"18/Feb/2022:13:23:12 +0000", 38 | "requestTimeEpoch":1645190592806, 39 | "resourceId":"ddw8yd", 40 | "resourcePath":"/myPath", 41 | "stage":"test-invoke-stage" 42 | }, 43 | "resource":"/myPath", 44 | "stageVariables":null 45 | } -------------------------------------------------------------------------------- /src/fixtures/example-apigw-custom-auth-request-type-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "REQUEST", 3 | "methodArn": "arn:aws:execute-api:us-east-1:123456789012:s4x3opwd6i/test/GET/request", 4 | "resource": "/request", 5 | "path": "/request", 6 | "httpMethod": "GET", 7 | "headers": { 8 | "X-AMZ-Date": "20170718T062915Z", 9 | "Accept": "*/*", 10 | "HeaderAuth1": "headerValue1", 11 | "CloudFront-Viewer-Country": "US", 12 | "CloudFront-Forwarded-Proto": "https", 13 | "CloudFront-Is-Tablet-Viewer": "false", 14 | "CloudFront-Is-Mobile-Viewer": "false", 15 | "User-Agent": "...", 16 | "X-Forwarded-Proto": "https", 17 | "CloudFront-Is-SmartTV-Viewer": "false", 18 | "Host": "....execute-api.us-east-1.amazonaws.com", 19 | "Accept-Encoding": "gzip, deflate", 20 | "X-Forwarded-Port": "443", 21 | "X-Amzn-Trace-Id": "...", 22 | "Via": "...cloudfront.net (CloudFront)", 23 | "X-Amz-Cf-Id": "...", 24 | "X-Forwarded-For": "..., ...", 25 | "Postman-Token": "...", 26 | "cache-control": "no-cache", 27 | "CloudFront-Is-Desktop-Viewer": "true", 28 | "Content-Type": "application/x-www-form-urlencoded" 29 | }, 30 | "multiValueHeaders": { 31 | "X-AMZ-Date": ["20170718T062915Z"], 32 | "Accept": ["*/*"], 33 | "HeaderAuth1": ["headerValue1"], 34 | "CloudFront-Viewer-Country": ["US"], 35 | "CloudFront-Forwarded-Proto": ["https"], 36 | "CloudFront-Is-Tablet-Viewer": ["false"], 37 | "CloudFront-Is-Mobile-Viewer": ["false"], 38 | "User-Agent": ["..."], 39 | "X-Forwarded-Proto": ["https"], 40 | "CloudFront-Is-SmartTV-Viewer": ["false"], 41 | "Host": ["....execute-api.us-east-1.amazonaws.com"], 42 | "Accept-Encoding": ["gzip, deflate"], 43 | "X-Forwarded-Port": ["443"], 44 | "X-Amzn-Trace-Id": ["..."], 45 | "Via": ["...cloudfront.net (CloudFront)"], 46 | "X-Amz-Cf-Id": ["..."], 47 | "X-Forwarded-For": ["..., ..."], 48 | "Postman-Token": ["..."], 49 | "cache-control": ["no-cache"], 50 | "CloudFront-Is-Desktop-Viewer": ["true"], 51 | "Content-Type": ["application/x-www-form-urlencoded"] 52 | }, 53 | "queryStringParameters": { 54 | "QueryString1": "queryValue1" 55 | }, 56 | "multiValueQueryStringParameters": { 57 | "QueryString1": ["queryValue1"] 58 | }, 59 | "pathParameters": {}, 60 | "stageVariables": { 61 | "StageVar1": "stageValue1" 62 | }, 63 | "requestContext": { 64 | "path": "/request", 65 | "accountId": "123456789012", 66 | "resourceId": "05c7jb", 67 | "stage": "test", 68 | "requestId": "...", 69 | "identity": { 70 | "apiKey": "...", 71 | "sourceIp": "...", 72 | "clientCert": { 73 | "clientCertPem": "-----BEGIN CERTIFICATE-----\nMIIEZTCCAk0CAQEwDQ...", 74 | "issuerDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Private CA", 75 | "serialNumber": "1", 76 | "subjectDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Client", 77 | "validity": { 78 | "notAfter": "Aug 5 00:28:21 2120 GMT", 79 | "notBefore": "Aug 29 00:28:21 2020 GMT" 80 | } 81 | } 82 | }, 83 | "resourcePath": "/request", 84 | "httpMethod": "GET", 85 | "apiId": "s4x3opwd6i" 86 | } 87 | } 88 | 89 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-custom-auth-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"TOKEN", 3 | "authorizationToken":"allow", 4 | "methodArn":"arn:aws:execute-api:us-west-2:123456789012:ymy8tbxw7b/*/GET/" 5 | } 6 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-custom-auth-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "principalId": "yyyyyyyy", 3 | "policyDocument": { 4 | "Version": "2012-10-17", 5 | "Statement": [ 6 | { 7 | "Action": ["execute-api:Invoke"], 8 | "Effect": "Allow|Deny", 9 | "Resource": ["arn:aws:execute-api:{regionId}:{accountId}:{appId}/{stage}/{httpVerb}/[{resource}/[child-resources]]"] 10 | } 11 | ] 12 | }, 13 | "context": { 14 | "stringKey": "value", 15 | "numberKey": "1", 16 | "booleanKey": "true" 17 | }, 18 | "usageIdentifierKey": "{api-key}" 19 | } 20 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "/{proxy+}", 3 | "path": "/hello/world", 4 | "httpMethod": "POST", 5 | "headers": { 6 | "Accept": "*/*", 7 | "Accept-Encoding": "gzip, deflate", 8 | "cache-control": "no-cache", 9 | "CloudFront-Forwarded-Proto": "https", 10 | "CloudFront-Is-Desktop-Viewer": "true", 11 | "CloudFront-Is-Mobile-Viewer": "false", 12 | "CloudFront-Is-SmartTV-Viewer": "false", 13 | "CloudFront-Is-Tablet-Viewer": "false", 14 | "CloudFront-Viewer-Country": "US", 15 | "Content-Type": "application/json", 16 | "headerName": "headerValue", 17 | "Host": "gy415nuibc.execute-api.us-east-1.amazonaws.com", 18 | "Postman-Token": "9f583ef0-ed83-4a38-aef3-eb9ce3f7a57f", 19 | "User-Agent": "PostmanRuntime/2.4.5", 20 | "Via": "1.1 d98420743a69852491bbdea73f7680bd.cloudfront.net (CloudFront)", 21 | "X-Amz-Cf-Id": "pn-PWIJc6thYnZm5P0NMgOUglL1DYtl0gdeJky8tqsg8iS_sgsKD1A==", 22 | "X-Forwarded-For": "54.240.196.186, 54.182.214.83", 23 | "X-Forwarded-Port": "443", 24 | "X-Forwarded-Proto": "https" 25 | }, 26 | "multiValueHeaders": { 27 | "Accept": ["*/*"], 28 | "Accept-Encoding": ["gzip, deflate"], 29 | "cache-control": ["no-cache"], 30 | "CloudFront-Forwarded-Proto": ["https"], 31 | "CloudFront-Is-Desktop-Viewer": ["true"], 32 | "CloudFront-Is-Mobile-Viewer": ["false"], 33 | "CloudFront-Is-SmartTV-Viewer": ["false"], 34 | "CloudFront-Is-Tablet-Viewer": ["false"], 35 | "CloudFront-Viewer-Country": ["US"], 36 | "Content-Type": ["application/json"], 37 | "headerName": ["headerValue"], 38 | "Host": ["gy415nuibc.execute-api.us-east-1.amazonaws.com"], 39 | "Postman-Token": ["9f583ef0-ed83-4a38-aef3-eb9ce3f7a57f"], 40 | "User-Agent": ["PostmanRuntime/2.4.5"], 41 | "Via": ["1.1 d98420743a69852491bbdea73f7680bd.cloudfront.net (CloudFront)"], 42 | "X-Amz-Cf-Id": ["pn-PWIJc6thYnZm5P0NMgOUglL1DYtl0gdeJky8tqsg8iS_sgsKD1A=="], 43 | "X-Forwarded-For": ["54.240.196.186, 54.182.214.83"], 44 | "X-Forwarded-Port": ["443"], 45 | "X-Forwarded-Proto": ["https"] 46 | }, 47 | "queryStringParameters": { 48 | "name": "me" 49 | }, 50 | "multiValueQueryStringParameters": { 51 | "name": ["me"] 52 | }, 53 | "pathParameters": { 54 | "proxy": "hello/world" 55 | }, 56 | "stageVariables": { 57 | "stageVariableName": "stageVariableValue" 58 | }, 59 | "requestContext": { 60 | "accountId": "12345678912", 61 | "resourceId": "roq9wj", 62 | "path": "/hello/world", 63 | "stage": "testStage", 64 | "domainName": "gy415nuibc.execute-api.us-east-2.amazonaws.com", 65 | "domainPrefix": "y0ne18dixk", 66 | "requestId": "deef4878-7910-11e6-8f14-25afc3e9ae33", 67 | "protocol": "HTTP/1.1", 68 | "identity": { 69 | "cognitoIdentityPoolId": "theCognitoIdentityPoolId", 70 | "accountId": "theAccountId", 71 | "cognitoIdentityId": "theCognitoIdentityId", 72 | "caller": "theCaller", 73 | "apiKey": "theApiKey", 74 | "apiKeyId": "theApiKeyId", 75 | "accessKey": "ANEXAMPLEOFACCESSKEY", 76 | "sourceIp": "192.168.196.186", 77 | "cognitoAuthenticationType": "theCognitoAuthenticationType", 78 | "cognitoAuthenticationProvider": "theCognitoAuthenticationProvider", 79 | "userArn": "theUserArn", 80 | "userAgent": "PostmanRuntime/2.4.5", 81 | "user": "theUser" 82 | }, 83 | "authorizer": { 84 | "principalId": "admin", 85 | "clientId": 1, 86 | "clientName": "Exata" 87 | }, 88 | "resourcePath": "/{proxy+}", 89 | "httpMethod": "POST", 90 | "requestTime": "15/May/2020:06:01:09 +0000", 91 | "requestTimeEpoch": 1589522469693, 92 | "apiId": "gy415nuibc" 93 | }, 94 | "body": "{\r\n\t\"a\": 1\r\n}" 95 | } 96 | 97 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "statusCode": 200, 3 | "headers": { 4 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 5 | "Accept-Encoding": "gzip, deflate, lzma, sdch, br", 6 | "Accept-Language": "en-US,en;q=0.8", 7 | "CloudFront-Forwarded-Proto": "https", 8 | "CloudFront-Is-Desktop-Viewer": "true", 9 | "CloudFront-Is-Mobile-Viewer": "false", 10 | "CloudFront-Is-SmartTV-Viewer": "false", 11 | "CloudFront-Is-Tablet-Viewer": "false", 12 | "CloudFront-Viewer-Country": "US", 13 | "Host": "wt6mne2s9k.execute-api.us-west-2.amazonaws.com", 14 | "Upgrade-Insecure-Requests": "1", 15 | "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 OPR/39.0.2256.48", 16 | "Via": "1.1 fb7cca60f0ecd82ce07790c9c5eef16c.cloudfront.net (CloudFront)", 17 | "X-Amz-Cf-Id": "nBsWBOrSHMgnaROZJK1wGCZ9PcRcSpq_oSXZNQwQ10OTZL4cimZo3g==", 18 | "X-Forwarded-For": "192.168.100.1, 192.168.1.1", 19 | "X-Forwarded-Port": "443", 20 | "X-Forwarded-Proto": "https" 21 | }, 22 | "multiValueHeaders": { 23 | "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"], 24 | "Accept-Encoding": ["gzip, deflate, lzma, sdch, br"], 25 | "Accept-Language": ["en-US,en;q=0.8"], 26 | "CloudFront-Forwarded-Proto": ["https"], 27 | "CloudFront-Is-Desktop-Viewer": ["true"], 28 | "CloudFront-Is-Mobile-Viewer": ["false"], 29 | "CloudFront-Is-SmartTV-Viewer": ["false"], 30 | "CloudFront-Is-Tablet-Viewer": ["false"], 31 | "CloudFront-Viewer-Country": ["US"], 32 | "Host": ["wt6mne2s9k.execute-api.us-west-2.amazonaws.com"], 33 | "Upgrade-Insecure-Requests": ["1"], 34 | "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 OPR/39.0.2256.48"], 35 | "Via": ["1.1 fb7cca60f0ecd82ce07790c9c5eef16c.cloudfront.net (CloudFront)"], 36 | "X-Amz-Cf-Id": ["nBsWBOrSHMgnaROZJK1wGCZ9PcRcSpq_oSXZNQwQ10OTZL4cimZo3g=="], 37 | "X-Forwarded-For": ["192.168.100.1, 192.168.1.1"], 38 | "X-Forwarded-Port": ["443"], 39 | "X-Forwarded-Proto": ["https"] 40 | }, 41 | "body": "Hello World" 42 | } 43 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-restapi-openapi-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "/{proxy+}", 3 | "path": "/hello/world", 4 | "httpMethod": "POST", 5 | "headers": { 6 | "Accept": "*/*", 7 | "Accept-Encoding": "gzip, deflate", 8 | "cache-control": "no-cache", 9 | "CloudFront-Forwarded-Proto": "https", 10 | "CloudFront-Is-Desktop-Viewer": "true", 11 | "CloudFront-Is-Mobile-Viewer": "false", 12 | "CloudFront-Is-SmartTV-Viewer": "false", 13 | "CloudFront-Is-Tablet-Viewer": "false", 14 | "CloudFront-Viewer-Country": "US", 15 | "Content-Type": "application/json", 16 | "headerName": "headerValue", 17 | "Host": "gy415nuibc.execute-api.us-east-1.amazonaws.com", 18 | "Postman-Token": "9f583ef0-ed83-4a38-aef3-eb9ce3f7a57f", 19 | "User-Agent": "PostmanRuntime/2.4.5", 20 | "Via": "1.1 d98420743a69852491bbdea73f7680bd.cloudfront.net (CloudFront)", 21 | "X-Amz-Cf-Id": "pn-PWIJc6thYnZm5P0NMgOUglL1DYtl0gdeJky8tqsg8iS_sgsKD1A==", 22 | "X-Forwarded-For": "54.240.196.186, 54.182.214.83", 23 | "X-Forwarded-Port": "443", 24 | "X-Forwarded-Proto": "https" 25 | }, 26 | "multiValueHeaders": { 27 | "Accept": ["*/*"], 28 | "Accept-Encoding": ["gzip, deflate"], 29 | "cache-control": ["no-cache"], 30 | "CloudFront-Forwarded-Proto": ["https"], 31 | "CloudFront-Is-Desktop-Viewer": ["true"], 32 | "CloudFront-Is-Mobile-Viewer": ["false"], 33 | "CloudFront-Is-SmartTV-Viewer": ["false"], 34 | "CloudFront-Is-Tablet-Viewer": ["false"], 35 | "CloudFront-Viewer-Country": ["US"], 36 | "Content-Type": ["application/json"], 37 | "headerName": ["headerValue"], 38 | "Host": ["gy415nuibc.execute-api.us-east-1.amazonaws.com"], 39 | "Postman-Token": ["9f583ef0-ed83-4a38-aef3-eb9ce3f7a57f"], 40 | "User-Agent": ["PostmanRuntime/2.4.5"], 41 | "Via": ["1.1 d98420743a69852491bbdea73f7680bd.cloudfront.net (CloudFront)"], 42 | "X-Amz-Cf-Id": ["pn-PWIJc6thYnZm5P0NMgOUglL1DYtl0gdeJky8tqsg8iS_sgsKD1A=="], 43 | "X-Forwarded-For": ["54.240.196.186, 54.182.214.83"], 44 | "X-Forwarded-Port": ["443"], 45 | "X-Forwarded-Proto": ["https"] 46 | }, 47 | "queryStringParameters": { 48 | "name": "me" 49 | }, 50 | "multiValueQueryStringParameters": { 51 | "name": ["me"] 52 | }, 53 | "pathParameters": { 54 | "proxy": "hello/world" 55 | }, 56 | "stageVariables": { 57 | "stageVariableName": "stageVariableValue" 58 | }, 59 | "requestContext": { 60 | "accountId": "12345678912", 61 | "resourceId": "roq9wj", 62 | "path": "/hello/world", 63 | "operationName": "HelloWorld", 64 | "stage": "testStage", 65 | "domainName": "gy415nuibc.execute-api.us-east-2.amazonaws.com", 66 | "domainPrefix": "y0ne18dixk", 67 | "requestId": "deef4878-7910-11e6-8f14-25afc3e9ae33", 68 | "protocol": "HTTP/1.1", 69 | "identity": { 70 | "cognitoIdentityPoolId": "theCognitoIdentityPoolId", 71 | "accountId": "theAccountId", 72 | "cognitoIdentityId": "theCognitoIdentityId", 73 | "caller": "theCaller", 74 | "apiKey": "theApiKey", 75 | "apiKeyId": "theApiKeyId", 76 | "accessKey": "ANEXAMPLEOFACCESSKEY", 77 | "sourceIp": "192.168.196.186", 78 | "cognitoAuthenticationType": "theCognitoAuthenticationType", 79 | "cognitoAuthenticationProvider": "theCognitoAuthenticationProvider", 80 | "userArn": "theUserArn", 81 | "userAgent": "PostmanRuntime/2.4.5", 82 | "user": "theUser" 83 | }, 84 | "authorizer": { 85 | "principalId": "admin", 86 | "clientId": 1, 87 | "clientName": "Exata" 88 | }, 89 | "resourcePath": "/{proxy+}", 90 | "httpMethod": "POST", 91 | "requestTime": "15/May/2020:06:01:09 +0000", 92 | "requestTimeEpoch": 1589522469693, 93 | "apiId": "gy415nuibc" 94 | }, 95 | "body": "{\r\n\t\"a\": 1\r\n}" 96 | } 97 | 98 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-custom-authorizer-v1-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "type": "REQUEST", 4 | "methodArn": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/request", 5 | "identitySource": "user1,123", 6 | "authorizationToken": "user1,123", 7 | "resource": "/request", 8 | "path": "/request", 9 | "httpMethod": "GET", 10 | "headers": { 11 | "X-AMZ-Date": "20170718T062915Z", 12 | "Accept": "*/*", 13 | "HeaderAuth1": "headerValue1", 14 | "CloudFront-Viewer-Country": "US", 15 | "CloudFront-Forwarded-Proto": "https", 16 | "CloudFront-Is-Tablet-Viewer": "false", 17 | "CloudFront-Is-Mobile-Viewer": "false", 18 | "User-Agent": "..." 19 | }, 20 | "queryStringParameters": { 21 | "QueryString1": "queryValue1" 22 | }, 23 | "pathParameters": {}, 24 | "stageVariables": { 25 | "StageVar1": "stageValue1" 26 | }, 27 | "requestContext": { 28 | "path": "/request", 29 | "accountId": "123456789012", 30 | "resourceId": "05c7jb", 31 | "stage": "test", 32 | "requestId": "...", 33 | "identity": { 34 | "apiKey": "...", 35 | "sourceIp": "...", 36 | "clientCert": { 37 | "clientCertPem": "CERT_CONTENT", 38 | "subjectDN": "www.example.com", 39 | "issuerDN": "Example issuer", 40 | "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", 41 | "validity": { 42 | "notBefore": "May 28 12:30:02 2019 GMT", 43 | "notAfter": "Aug 5 09:36:04 2021 GMT" 44 | } 45 | } 46 | }, 47 | "http": { 48 | "method": "POST", 49 | "path": "/my/path", 50 | "protocol": "HTTP/1.1", 51 | "sourceIp": "IP", 52 | "userAgent": "agent" 53 | }, 54 | "resourcePath": "/request", 55 | "httpMethod": "GET", 56 | "apiId": "abcdef123", 57 | "routeKey": "$default", 58 | "time": "12/Mar/2020:19:03:58 +0000", 59 | "timeEpoch": 1583348638390 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-custom-authorizer-v2-request-without-cookies.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "type": "REQUEST", 4 | "routeArn": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/request", 5 | "identitySource": ["user1", "123"], 6 | "routeKey": "$default", 7 | "rawPath": "/my/path", 8 | "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", 9 | "headers": { 10 | "Header1": "value1", 11 | "Header2": "value2" 12 | }, 13 | "queryStringParameters": { 14 | "parameter1": "value1,value2", 15 | "parameter2": "value" 16 | }, 17 | "requestContext": { 18 | "accountId": "123456789012", 19 | "apiId": "api-id", 20 | "authentication": { 21 | "clientCert": { 22 | "clientCertPem": "CERT_CONTENT", 23 | "subjectDN": "www.example.com", 24 | "issuerDN": "Example issuer", 25 | "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", 26 | "validity": { 27 | "notBefore": "May 28 12:30:02 2019 GMT", 28 | "notAfter": "Aug 5 09:36:04 2021 GMT" 29 | } 30 | } 31 | }, 32 | "domainName": "id.execute-api.us-east-1.amazonaws.com", 33 | "domainPrefix": "id", 34 | "http": { 35 | "method": "POST", 36 | "path": "/my/path", 37 | "protocol": "HTTP/1.1", 38 | "sourceIp": "IP", 39 | "userAgent": "agent" 40 | }, 41 | "requestId": "id", 42 | "routeKey": "$default", 43 | "stage": "$default", 44 | "time": "12/Mar/2020:19:03:58 +0000", 45 | "timeEpoch": 1583348638390 46 | }, 47 | "pathParameters": { "parameter1": "value1" }, 48 | "stageVariables": { "stageVariable1": "value1", "stageVariable2": "value2" } 49 | } 50 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-custom-authorizer-v2-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "type": "REQUEST", 4 | "routeArn": "arn:aws:execute-api:us-east-1:123456789012:abcdef123/test/GET/request", 5 | "identitySource": ["user1", "123"], 6 | "routeKey": "$default", 7 | "rawPath": "/my/path", 8 | "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", 9 | "cookies": ["cookie1", "cookie2"], 10 | "headers": { 11 | "Header1": "value1", 12 | "Header2": "value2" 13 | }, 14 | "queryStringParameters": { 15 | "parameter1": "value1,value2", 16 | "parameter2": "value" 17 | }, 18 | "requestContext": { 19 | "accountId": "123456789012", 20 | "apiId": "api-id", 21 | "authentication": { 22 | "clientCert": { 23 | "clientCertPem": "CERT_CONTENT", 24 | "subjectDN": "www.example.com", 25 | "issuerDN": "Example issuer", 26 | "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1", 27 | "validity": { 28 | "notBefore": "May 28 12:30:02 2019 GMT", 29 | "notAfter": "Aug 5 09:36:04 2021 GMT" 30 | } 31 | } 32 | }, 33 | "domainName": "id.execute-api.us-east-1.amazonaws.com", 34 | "domainPrefix": "id", 35 | "http": { 36 | "method": "POST", 37 | "path": "/my/path", 38 | "protocol": "HTTP/1.1", 39 | "sourceIp": "IP", 40 | "userAgent": "agent" 41 | }, 42 | "requestId": "id", 43 | "routeKey": "$default", 44 | "stage": "$default", 45 | "time": "12/Mar/2020:19:03:58 +0000", 46 | "timeEpoch": 1583348638390 47 | }, 48 | "pathParameters": { "parameter1": "value1" }, 49 | "stageVariables": { "stageVariable1": "value1", "stageVariable2": "value2" } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-custom-authorizer-websocket-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "$LATEST", 3 | "type": "REQUEST", 4 | "methodArn": "arn:aws:execute-api:eu-west-1:123456789012:abcdef123/test/$connect", 5 | "headers": { 6 | "Header1": "value1", 7 | "Header2": "value2" 8 | }, 9 | "multiValueHeaders": { 10 | "Header1": ["value1"], 11 | "Header2": ["value2"] 12 | }, 13 | "multiValueQueryStringParameters": {}, 14 | "queryStringParameters": { 15 | "parameter1": "value1,value2", 16 | "parameter2": "value" 17 | }, 18 | "requestContext": { 19 | "apiId": "api-id", 20 | "connectedAt": 1655103417248, 21 | "connectionId": "connection-id", 22 | "domainName": "example.com", 23 | "eventType": "CONNECT", 24 | "extendedRequestId": "extended-req-id", 25 | "identity": { 26 | "sourceIp": "1.2.3.4", 27 | "userAgent": "user-agent" 28 | }, 29 | "messageDirection": "IN", 30 | "requestId": "req-id", 31 | "requestTime": "13/Jun/2022:06:56:57 +0000", 32 | "requestTimeEpoch": 1655103417249, 33 | "routeKey": "$connect", 34 | "stage": "test" 35 | }, 36 | "stageVariables": {}, 37 | "context": { 38 | "request_id": "5req-id" 39 | }, 40 | "deadline": 1655103420483, 41 | "invoked_function_arn": "arn:aws:lambda:eu-west-1:123456789012:function:a-lambda", 42 | "xray_trace_id": "xray-trace-id", 43 | "client_context": null, 44 | "identity": null, 45 | "env_config": { 46 | "function_name": "a-lambda" 47 | }, 48 | "memory": 128, 49 | "log_stream": "log-stream-id", 50 | "log_group": "log-group-id" 51 | } 52 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-request-iam.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "routeKey": "$default", 4 | "rawPath": "/my/path", 5 | "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", 6 | "cookies": [ 7 | "cookie1", 8 | "cookie2" 9 | ], 10 | "headers": { 11 | "Header1": "value1", 12 | "Header2": "value2" 13 | }, 14 | "queryStringParameters": { 15 | "parameter1": "value1,value2", 16 | "parameter2": "value" 17 | }, 18 | "pathParameters": { 19 | "proxy": "hello/world" 20 | }, 21 | "requestContext": { 22 | "routeKey": "$default", 23 | "accountId": "123456789012", 24 | "stage": "$default", 25 | "requestId": "id", 26 | "authorizer": { 27 | "iam": { 28 | "accessKey": "ARIA2ZJZYVUEREEIHAKY", 29 | "accountId": "1234567890", 30 | "callerId": "AROA7ZJZYVRE7C3DUXHH6:CognitoIdentityCredentials", 31 | "cognitoIdentity": { 32 | "amr" : ["foo"], 33 | "identityId": "us-east-1:3f291106-8703-466b-8f2b-3ecee1ca56ce", 34 | "identityPoolId": "us-east-1:4f291106-8703-466b-8f2b-3ecee1ca56ce" 35 | }, 36 | "principalOrgId": "AwsOrgId", 37 | "userArn": "arn:aws:iam::1234567890:user/Admin", 38 | "userId": "AROA2ZJZYVRE7Y3TUXHH6" 39 | } 40 | }, 41 | "apiId": "api-id", 42 | "authentication": { 43 | "clientCert": { 44 | "clientCertPem": "-----BEGIN CERTIFICATE-----\nMIIEZTCCAk0CAQEwDQ...", 45 | "issuerDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Private CA", 46 | "serialNumber": "1", 47 | "subjectDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Client", 48 | "validity": { 49 | "notAfter": "Aug 5 00:28:21 2120 GMT", 50 | "notBefore": "Aug 29 00:28:21 2020 GMT" 51 | } 52 | } 53 | }, 54 | "domainName": "id.execute-api.us-east-1.amazonaws.com", 55 | "domainPrefix": "id", 56 | "time": "12/Mar/2020:19:03:58+0000", 57 | "timeEpoch": 1583348638390, 58 | "http": { 59 | "method": "GET", 60 | "path": "/my/path", 61 | "protocol": "HTTP/1.1", 62 | "sourceIp": "IP", 63 | "userAgent": "agent" 64 | } 65 | }, 66 | "stageVariables": { 67 | "stageVariable1": "value1", 68 | "stageVariable2": "value2" 69 | }, 70 | "body": "{\r\n\t\"a\": 1\r\n}", 71 | "isBase64Encoded": false 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-request-jwt-authorizer.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "routeKey": "$default", 4 | "rawPath": "/my/path", 5 | "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", 6 | "cookies": [ 7 | "cookie1", 8 | "cookie2" 9 | ], 10 | "headers": { 11 | "Header1": "value1", 12 | "Header2": "value2" 13 | }, 14 | "queryStringParameters": { 15 | "parameter1": "value1,value2", 16 | "parameter2": "value" 17 | }, 18 | "pathParameters": { 19 | "proxy": "hello/world" 20 | }, 21 | "requestContext": { 22 | "routeKey": "$default", 23 | "accountId": "123456789012", 24 | "stage": "$default", 25 | "requestId": "id", 26 | "authorizer": { 27 | "jwt": { 28 | "claims": { 29 | "claim1": "value1", 30 | "claim2": "value2" 31 | }, 32 | "scopes": [ 33 | "scope1", 34 | "scope2" 35 | ] 36 | } 37 | }, 38 | "apiId": "api-id", 39 | "authentication": { 40 | "clientCert": { 41 | "clientCertPem": "-----BEGIN CERTIFICATE-----\nMIIEZTCCAk0CAQEwDQ...", 42 | "issuerDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Private CA", 43 | "serialNumber": "1", 44 | "subjectDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Client", 45 | "validity": { 46 | "notAfter": "Aug 5 00:28:21 2120 GMT", 47 | "notBefore": "Aug 29 00:28:21 2020 GMT" 48 | } 49 | } 50 | }, 51 | "domainName": "id.execute-api.us-east-1.amazonaws.com", 52 | "domainPrefix": "id", 53 | "time": "12/Mar/2020:19:03:58+0000", 54 | "timeEpoch": 1583348638390, 55 | "http": { 56 | "method": "GET", 57 | "path": "/my/path", 58 | "protocol": "HTTP/1.1", 59 | "sourceIp": "IP", 60 | "userAgent": "agent" 61 | } 62 | }, 63 | "stageVariables": { 64 | "stageVariable1": "value1", 65 | "stageVariable2": "value2" 66 | }, 67 | "body": "{\r\n\t\"a\": 1\r\n}", 68 | "isBase64Encoded": false 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-request-lambda-authorizer.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "routeKey": "$default", 4 | "rawPath": "/my/path", 5 | "rawQueryString": "parameter1=value1¶meter1=value2¶meter2=value", 6 | "cookies": [ 7 | "cookie1", 8 | "cookie2" 9 | ], 10 | "headers": { 11 | "Header1": "value1", 12 | "Header2": "value2" 13 | }, 14 | "queryStringParameters": { 15 | "parameter1": "value1,value2", 16 | "parameter2": "value" 17 | }, 18 | "pathParameters": { 19 | "proxy": "hello/world" 20 | }, 21 | "requestContext": { 22 | "routeKey": "$default", 23 | "accountId": "123456789012", 24 | "stage": "$default", 25 | "requestId": "id", 26 | "authorizer": { 27 | "lambda": { 28 | "key": "value" 29 | } 30 | }, 31 | "apiId": "api-id", 32 | "authentication": { 33 | "clientCert": { 34 | "clientCertPem": "-----BEGIN CERTIFICATE-----\nMIIEZTCCAk0CAQEwDQ...", 35 | "issuerDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Private CA", 36 | "serialNumber": "1", 37 | "subjectDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Client", 38 | "validity": { 39 | "notAfter": "Aug 5 00:28:21 2120 GMT", 40 | "notBefore": "Aug 29 00:28:21 2020 GMT" 41 | } 42 | } 43 | }, 44 | "domainName": "id.execute-api.us-east-1.amazonaws.com", 45 | "domainPrefix": "id", 46 | "time": "12/Mar/2020:19:03:58+0000", 47 | "timeEpoch": 1583348638390, 48 | "http": { 49 | "method": "GET", 50 | "path": "/my/path", 51 | "protocol": "HTTP/1.1", 52 | "sourceIp": "IP", 53 | "userAgent": "agent" 54 | } 55 | }, 56 | "stageVariables": { 57 | "stageVariable1": "value1", 58 | "stageVariable2": "value2" 59 | }, 60 | "body": "{\r\n\t\"a\": 1\r\n}", 61 | "isBase64Encoded": false 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-v2-request-no-authorizer.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "routeKey": "$default", 4 | "rawPath": "/", 5 | "rawQueryString": "", 6 | "headers": { 7 | "accept": "*/*", 8 | "content-length": "0", 9 | "host": "aaaaaaaaaa.execute-api.us-west-2.amazonaws.com", 10 | "user-agent": "curl/7.58.0", 11 | "x-amzn-trace-id": "Root=1-5e9f0c65-1de4d666d4dd26aced652b6c", 12 | "x-forwarded-for": "1.2.3.4", 13 | "x-forwarded-port": "443", 14 | "x-forwarded-proto": "https" 15 | }, 16 | "requestContext": { 17 | "accountId": "123456789012", 18 | "apiId": "aaaaaaaaaa", 19 | "authentication": { 20 | "clientCert": { 21 | "clientCertPem": "-----BEGIN CERTIFICATE-----\nMIIEZTCCAk0CAQEwDQ...", 22 | "issuerDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Private CA", 23 | "serialNumber": "1", 24 | "subjectDN": "C=US,ST=Washington,L=Seattle,O=Amazon Web Services,OU=Security,CN=My Client", 25 | "validity": { 26 | "notAfter": "Aug 5 00:28:21 2120 GMT", 27 | "notBefore": "Aug 29 00:28:21 2020 GMT" 28 | } 29 | } 30 | }, 31 | "domainName": "aaaaaaaaaa.execute-api.us-west-2.amazonaws.com", 32 | "domainPrefix": "aaaaaaaaaa", 33 | "http": { 34 | "method": "GET", 35 | "path": "/", 36 | "protocol": "HTTP/1.1", 37 | "sourceIp": "1.2.3.4", 38 | "userAgent": "curl/7.58.0" 39 | }, 40 | "requestId": "LV7fzho-PHcEJPw=", 41 | "routeKey": "$default", 42 | "stage": "$default", 43 | "time": "21/Apr/2020:15:08:21 +0000", 44 | "timeEpoch": 1587481701067 45 | }, 46 | "isBase64Encoded": false 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/fixtures/example-apigw-websocket-request-without-method.json: -------------------------------------------------------------------------------- 1 | { 2 | "headers": { 3 | "Host": "asdfasdf.execute-api.us-west-2.amazonaws.com", 4 | "Sec-WebSocket-Key": "asdfasdf==", 5 | "Sec-WebSocket-Version": "13", 6 | "X-Amzn-Trace-Id": "Root=1-asdf-asdfasdf", 7 | "x-api-key": "asdfasdf", 8 | "X-Forwarded-For": "10.0.0.13", 9 | "X-Forwarded-Port": "443", 10 | "X-Forwarded-Proto": "https" 11 | }, 12 | "multiValueHeaders": { 13 | "Host": [ 14 | "asdfasdf.execute-api.us-west-2.amazonaws.com" 15 | ], 16 | "Sec-WebSocket-Key": [ 17 | "asdfasdf==" 18 | ], 19 | "Sec-WebSocket-Version": [ 20 | "13" 21 | ], 22 | "X-Amzn-Trace-Id": [ 23 | "Root=1-asdf-asdfasdf" 24 | ], 25 | "x-api-key": [ 26 | "asdfasdf" 27 | ], 28 | "X-Forwarded-For": [ 29 | "10.0.0.13" 30 | ], 31 | "X-Forwarded-Port": [ 32 | "443" 33 | ], 34 | "X-Forwarded-Proto": [ 35 | "https" 36 | ] 37 | }, 38 | "requestContext": { 39 | "routeKey": "$connect", 40 | "eventType": "CONNECT", 41 | "extendedRequestId": "asdfasdf=", 42 | "requestTime": "22/Feb/2022:19:07:37 +0000", 43 | "messageDirection": "IN", 44 | "stage": "dev", 45 | "connectedAt": 1645556857902, 46 | "requestTimeEpoch": 1645556857902, 47 | "identity": { 48 | "apiKey": "asdfasdf", 49 | "apiKeyId": "asdf", 50 | "sourceIp": "10.0.0.13" 51 | }, 52 | "requestId": "asdf=", 53 | "domainName": "asdfasdf.execute-api.us-west-2.amazonaws.com", 54 | "connectionId": "asdfasdf=", 55 | "apiId": "asdfasdf" 56 | }, 57 | "isBase64Encoded": false 58 | } -------------------------------------------------------------------------------- /src/fixtures/example-apigw-websocket-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "/{proxy+}", 3 | "path": "/hello/world", 4 | "httpMethod": "POST", 5 | "headers": { 6 | "Accept": "*/*", 7 | "Accept-Encoding": "gzip, deflate", 8 | "cache-control": "no-cache", 9 | "CloudFront-Forwarded-Proto": "https", 10 | "CloudFront-Is-Desktop-Viewer": "true", 11 | "CloudFront-Is-Mobile-Viewer": "false", 12 | "CloudFront-Is-SmartTV-Viewer": "false", 13 | "CloudFront-Is-Tablet-Viewer": "false", 14 | "CloudFront-Viewer-Country": "US", 15 | "Content-Type": "application/json", 16 | "headerName": "headerValue", 17 | "Host": "gy415nuibc.execute-api.us-east-1.amazonaws.com", 18 | "Postman-Token": "9f583ef0-ed83-4a38-aef3-eb9ce3f7a57f", 19 | "User-Agent": "PostmanRuntime/2.4.5", 20 | "Via": "1.1 d98420743a69852491bbdea73f7680bd.cloudfront.net (CloudFront)", 21 | "X-Amz-Cf-Id": "pn-PWIJc6thYnZm5P0NMgOUglL1DYtl0gdeJky8tqsg8iS_sgsKD1A==", 22 | "X-Forwarded-For": "54.240.196.186, 54.182.214.83", 23 | "X-Forwarded-Port": "443", 24 | "X-Forwarded-Proto": "https" 25 | }, 26 | "multiValueHeaders": { 27 | "Host": [ 28 | "*.execute-api.eu-central-1.amazonaws.com" 29 | ], 30 | "Sec-WebSocket-Extensions": [ 31 | "permessage-deflate; client_max_window_bits" 32 | ], 33 | "Sec-WebSocket-Key": [ 34 | "*" 35 | ], 36 | "Sec-WebSocket-Version": [ 37 | "13" 38 | ], 39 | "X-Amzn-Trace-Id": [ 40 | "Root=*" 41 | ], 42 | "X-Forwarded-For": [ 43 | "*.*.*.*" 44 | ], 45 | "X-Forwarded-Port": [ 46 | "443" 47 | ], 48 | "X-Forwarded-Proto": [ 49 | "https" 50 | ] 51 | }, 52 | "queryStringParameters": { 53 | "name": "me" 54 | }, 55 | "multiValueQueryStringParameters": { 56 | "name": ["me"] 57 | }, 58 | "pathParameters": { 59 | "proxy": "hello/world" 60 | }, 61 | "stageVariables": { 62 | "stageVariableName": "stageVariableValue" 63 | }, 64 | "requestContext": { 65 | "accountId": "12345678912", 66 | "resourceId": "roq9wj", 67 | "stage": "testStage", 68 | "requestId": "deef4878-7910-11e6-8f14-25afc3e9ae33", 69 | "identity": { 70 | "cognitoIdentityPoolId": "theCognitoIdentityPoolId", 71 | "accountId": "theAccountId", 72 | "cognitoIdentityId": "theCognitoIdentityId", 73 | "caller": "theCaller", 74 | "apiKey": "theApiKey", 75 | "apiKeyId": "theApiKeyId", 76 | "accessKey": "ANEXAMPLEOFACCESSKEY", 77 | "sourceIp": "192.168.196.186", 78 | "cognitoAuthenticationType": "theCognitoAuthenticationType", 79 | "cognitoAuthenticationProvider": "theCognitoAuthenticationProvider", 80 | "userArn": "theUserArn", 81 | "userAgent": "PostmanRuntime/2.4.5", 82 | "user": "theUser" 83 | }, 84 | "resourcePath": "/{proxy+}", 85 | "authorizer": { 86 | "principalId": "admin", 87 | "clientId": 1, 88 | "clientName": "Exata" 89 | }, 90 | "httpMethod": "POST", 91 | "apiId": "gy415nuibc", 92 | "connectedAt": 1547230720092, 93 | "connectionId": "TWegAcC4EowCHnA=", 94 | "domainName": "*.execute-api.eu-central-1.amazonaws.com", 95 | "error": "*", 96 | "eventType": "CONNECT", 97 | "extendedRequestId": "TWegAcC4EowCHnA=", 98 | "integrationLatency": "123", 99 | "messageDirection": "IN", 100 | "messageId": null, 101 | "requestTime": "07/Jan/2019:09:20:57 +0000", 102 | "requestTimeEpoch": 0, 103 | "routeKey": "$connect", 104 | "status": "*" 105 | }, 106 | "body": "{\r\n\t\"a\": 1\r\n}" 107 | } 108 | 109 | -------------------------------------------------------------------------------- /src/fixtures/example-appsync-batchinvoke.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2017-02-28", 3 | "operation": "BatchInvoke", 4 | "payload": [{ 5 | "arguments": { 6 | "id": "postId1", 7 | "count": 1, 8 | "float": 1.2, 9 | "flag": true 10 | } 11 | }, 12 | { 13 | "arguments": { 14 | "id": "postId2", 15 | "count": 2, 16 | "float": 1.2 17 | } 18 | }, 19 | { 20 | "arguments": { 21 | "id": "postId3", 22 | "count": 3, 23 | "flag": false 24 | } 25 | } 26 | ] 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/fixtures/example-appsync-identity-cognito.json: -------------------------------------------------------------------------------- 1 | { 2 | "sub": "123-456", 3 | "issuer": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_abc", 4 | "username": "user1", 5 | "claims": { 6 | "sub": "123-456", 7 | "aud": "abcdefg", 8 | "event_id": "123-123-123", 9 | "token_use": "id", 10 | "auth_time": 1551226125, 11 | "iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_abc", 12 | "cognito:username": "user1", 13 | "exp": 1551228178628, 14 | "iat": 1551228178629 15 | }, 16 | "sourceIp": ["192.168.196.186", "193.168.196.186"], 17 | "defaultAuthStrategy": "ALLOW" 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/fixtures/example-appsync-identity-iam.json: -------------------------------------------------------------------------------- 1 | { 2 | "accountId": "accountid123", 3 | "cognitoIdentityPoolId": "identitypoolid123", 4 | "cognitoIdentityId": "identityid123", 5 | "cognitoIdentityAuthType": "authenticated", 6 | "cognitoIdentityAuthProvider": "providerABC", 7 | "sourceIp": ["192.168.196.186", "193.168.196.186"], 8 | "username": "user1", 9 | "userArn": "arn:aws:iam::123456789012:user/appsync" 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/fixtures/example-appsync-invoke.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2017-02-28", 3 | "operation": "Invoke", 4 | "payload": { 5 | "field": "getPost", 6 | "arguments": { 7 | "id": "postId1", 8 | "count": 1, 9 | "float": 1.2, 10 | "flag": true 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/fixtures/example-appsync-lambda-auth-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "authorizationToken": "ExampleAUTHtoken123123123", 3 | "requestContext": { 4 | "apiId": "aaaaaa123123123example123", 5 | "accountId": "111122223333", 6 | "requestId": "f4081827-1111-4444-5555-5cf4695f339f", 7 | "queryString": "mutation CreateEvent {...}\n\nquery MyQuery {...}\n", 8 | "operationName": "MyQuery", 9 | "variables": {} 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/fixtures/example-appsync-lambda-auth-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "isAuthorized": true, 3 | "resolverContext": { 4 | "banana": "very yellow", 5 | "apple": "very green" 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/fixtures/example-autoscaling-event-launch-successful.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "12345678-1234-1234-1234-123456789012", 4 | "detail-type": "EC2 Instance Launch Successful", 5 | "source": "aws.autoscaling", 6 | "account": "123456789012", 7 | "time": "1970-01-01T00:00:00Z", 8 | "region": "us-west-2", 9 | "resources": [ 10 | "auto-scaling-group-arn", 11 | "instance-arn" 12 | ], 13 | "detail": { 14 | "StatusCode": "InProgress", 15 | "Description": "Launching a new EC2 instance: i-12345678", 16 | "AutoScalingGroupName": "my-auto-scaling-group", 17 | "ActivityId": "87654321-4321-4321-4321-210987654321", 18 | "Details": { 19 | "Availability Zone": "us-west-2b", 20 | "Subnet ID": "subnet-12345678" 21 | }, 22 | "RequestId": "12345678-1234-1234-1234-123456789012", 23 | "StatusMessage": "", 24 | "EndTime": "1970-01-01T00:00:00Z", 25 | "EC2InstanceId": "i-1234567890abcdef0", 26 | "StartTime": "1970-01-01T00:00:00Z", 27 | "Cause": "description-text" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/fixtures/example-autoscaling-event-launch-unsuccessful.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "12345678-1234-1234-1234-123456789012", 4 | "detail-type": "EC2 Instance Launch Unsuccessful", 5 | "source": "aws.autoscaling", 6 | "account": "123456789012", 7 | "time": "1970-01-01T00:00:00Z", 8 | "region": "us-west-2", 9 | "resources": [ 10 | "auto-scaling-group-arn", 11 | "instance-arn" 12 | ], 13 | "detail": { 14 | "StatusCode": "Failed", 15 | "AutoScalingGroupName": "my-auto-scaling-group", 16 | "ActivityId": "87654321-4321-4321-4321-210987654321", 17 | "Details": { 18 | "Availability Zone": "us-west-2b", 19 | "Subnet ID": "subnet-12345678" 20 | }, 21 | "RequestId": "12345678-1234-1234-1234-123456789012", 22 | "StatusMessage": "message-text", 23 | "EndTime": "1970-01-01T00:00:00Z", 24 | "EC2InstanceId": "i-1234567890abcdef0", 25 | "StartTime": "1970-01-01T00:00:00Z", 26 | "Cause": "description-text" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/fixtures/example-autoscaling-event-lifecycle-action.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "12345678-1234-1234-1234-123456789012", 4 | "detail-type": "EC2 Instance-launch Lifecycle Action", 5 | "source": "aws.autoscaling", 6 | "account": "123456789012", 7 | "time": "1970-01-01T00:00:00Z", 8 | "region": "us-west-2", 9 | "resources": [ 10 | "auto-scaling-group-arn" 11 | ], 12 | "detail": { 13 | "LifecycleActionToken": "87654321-4321-4321-4321-210987654321", 14 | "AutoScalingGroupName": "my-asg", 15 | "LifecycleHookName": "my-lifecycle-hook", 16 | "EC2InstanceId": "i-1234567890abcdef0", 17 | "LifecycleTransition": "autoscaling:EC2_INSTANCE_LAUNCHING", 18 | "NotificationMetadata": "additional-info" 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/fixtures/example-autoscaling-event-terminate-action.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "12345678-1234-1234-1234-123456789012", 4 | "detail-type": "EC2 Instance-terminate Lifecycle Action", 5 | "source": "aws.autoscaling", 6 | "account": "123456789012", 7 | "time": "1970-01-01T00:00:00Z", 8 | "region": "us-west-2", 9 | "resources": [ 10 | "auto-scaling-group-arn" 11 | ], 12 | "detail": { 13 | "LifecycleActionToken":"87654321-4321-4321-4321-210987654321", 14 | "AutoScalingGroupName":"my-asg", 15 | "LifecycleHookName":"my-lifecycle-hook", 16 | "EC2InstanceId":"i-1234567890abcdef0", 17 | "LifecycleTransition":"autoscaling:EC2_INSTANCE_TERMINATING" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/fixtures/example-autoscaling-event-terminate-successful.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "12345678-1234-1234-1234-123456789012", 4 | "detail-type": "EC2 Instance Terminate Successful", 5 | "source": "aws.autoscaling", 6 | "account": "123456789012", 7 | "time": "1970-01-01T00:00:00Z", 8 | "region": "us-west-2", 9 | "resources": [ 10 | "auto-scaling-group-arn", 11 | "instance-arn" 12 | ], 13 | "detail": { 14 | "StatusCode": "InProgress", 15 | "Description": "Terminating EC2 instance: i-12345678", 16 | "AutoScalingGroupName": "my-auto-scaling-group", 17 | "ActivityId": "87654321-4321-4321-4321-210987654321", 18 | "Details": { 19 | "Availability Zone": "us-west-2b", 20 | "Subnet ID": "subnet-12345678" 21 | }, 22 | "RequestId": "12345678-1234-1234-1234-123456789012", 23 | "StatusMessage": "", 24 | "EndTime": "1970-01-01T00:00:00Z", 25 | "EC2InstanceId": "i-1234567890abcdef0", 26 | "StartTime": "1970-01-01T00:00:00Z", 27 | "Cause": "description-text" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/fixtures/example-autoscaling-event-terminate-unsuccessful.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "12345678-1234-1234-1234-123456789012", 4 | "detail-type": "EC2 Instance Terminate Unsuccessful", 5 | "source": "aws.autoscaling", 6 | "account": "123456789012", 7 | "time": "1970-01-01T00:00:00Z", 8 | "region": "us-west-2", 9 | "resources": [ 10 | "auto-scaling-group-arn", 11 | "instance-arn" 12 | ], 13 | "detail": { 14 | "StatusCode": "Failed", 15 | "AutoScalingGroupName": "my-auto-scaling-group", 16 | "ActivityId": "87654321-4321-4321-4321-210987654321", 17 | "Details": { 18 | "Availability Zone": "us-west-2b", 19 | "Subnet ID": "subnet-12345678" 20 | }, 21 | "RequestId": "12345678-1234-1234-1234-123456789012", 22 | "StatusMessage": "message-text", 23 | "EndTime": "1970-01-01T00:00:00Z", 24 | "EC2InstanceId": "i-1234567890abcdef0", 25 | "StartTime": "1970-01-01T00:00:00Z", 26 | "Cause": "description-text" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/fixtures/example-clientvpn-connectionhandler-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "connection-id": "cvpn-connection-04e7e1b2f0daf9460", 3 | "endpoint-id": "cvpn-endpoint-0f13eab7f860433cc", 4 | "common-name": "", 5 | "username": "username", 6 | "platform": "", 7 | "platform-version": "", 8 | "public-ip": "10.11.12.13", 9 | "client-openvpn-version": "", 10 | "schema-version": "v1" 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/fixtures/example-cloudwatch-alarm-sns-payload-multiple-metrics.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "EventSource": "aws:sns", 5 | "EventVersion": "1.0", 6 | "EventSubscriptionArn": "arn:aws:sns:EXAMPLE", 7 | "Sns": { 8 | "Type": "Notification", 9 | "MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", 10 | "TopicArn": "arn:aws:sns:EXAMPLE", 11 | "Subject": "TestInvoke", 12 | "Message": "{\"AlarmName\":\"EXAMPLE\",\"AlarmDescription\":\"EXAMPLE\",\"AWSAccountId\":\"EXAMPLE\",\"NewStateValue\":\"ALARM\",\"NewStateReason\":\"Threshold Crossed: 1 out of the last 1 datapoints [1234.0 (06/03/15 17:43:27)] was greater than the threshold (0.0) (minimum 1 datapoint for OK -> ALARM transition).\",\"StateChangeTime\":\"2015-06-03T17:43:27.123+0000\",\"Region\":\"EXAMPLE\",\"AlarmArn\":\"arn:aws:cloudwatch:REGION:ACCOUNT_NUMBER:alarm:EXAMPLE\",\"OldStateValue\":\"INSUFFICIENT_DATA\",\"Trigger\":{\"Period\":60,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanThreshold\",\"Threshold\":0.0,\"TreatMissingData\":\"- TreatMissingData: missing\",\"EvaluateLowSampleCountPercentile\":\"\",\"Metrics\":[{\"Expression\":\"m1*1\",\"Id\":\"e1\",\"Label\":\"Expression1\",\"ReturnData\":true},{\"Id\":\"m1\",\"MetricStat\":{\"Metric\":{\"Dimensions\":[{\"value\":\"TestInstance\",\"name\":\"InstanceId\"}],\"MetricName\":\"NetworkOut\",\"Namespace\":\"AWS/EC2\"},\"Period\":60,\"Stat\":\"Average\"},\"ReturnData\":false}]}}", 13 | "Timestamp": "2015-06-03T17:43:27.123Z", 14 | "SignatureVersion": "1", 15 | "Signature": "EXAMPLE", 16 | "SigningCertURL": "EXAMPLE", 17 | "UnsubscribeURL": "EXAMPLE", 18 | "MessageAttributes": {} 19 | } 20 | }, 21 | { 22 | "EventSource": "aws:sns", 23 | "EventVersion": "1.0", 24 | "EventSubscriptionArn": "arn:aws:sns:EXAMPLE", 25 | "Sns": { 26 | "Type": "Notification", 27 | "MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", 28 | "TopicArn": "arn:aws:sns:EXAMPLE", 29 | "Subject": "TestInvoke", 30 | "Message": "{\"AlarmName\":\"EXAMPLE\",\"AlarmDescription\":\"EXAMPLE\",\"AWSAccountId\":\"EXAMPLE\",\"NewStateValue\":\"ALARM\",\"NewStateReason\":\"Threshold Crossed: 1 out of the last 1 datapoints [1234.0 (06/03/15 17:43:27)] was greater than the threshold (0.0) (minimum 1 datapoint for OK -> ALARM transition).\",\"StateChangeTime\":\"2015-06-03T17:43:27.123+0000\",\"Region\":\"EXAMPLE\",\"AlarmArn\":\"arn:aws:cloudwatch:REGION:ACCOUNT_NUMBER:alarm:EXAMPLE\",\"OldStateValue\":\"INSUFFICIENT_DATA\",\"Trigger\":{\"Period\":60,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanThreshold\",\"Threshold\":0.0,\"TreatMissingData\":\"- TreatMissingData: missing\",\"EvaluateLowSampleCountPercentile\":\"\",\"Metrics\":[{\"Expression\":\"m1*1\",\"Id\":\"e1\",\"Label\":\"Expression1\",\"ReturnData\":true},{\"Id\":\"m1\",\"MetricStat\":{\"Metric\":{\"Dimensions\":[{\"value\":\"TestInstance\",\"name\":\"InstanceId\"}],\"MetricName\":\"NetworkOut\",\"Namespace\":\"AWS/EC2\"},\"Period\":60,\"Stat\":\"Average\"},\"ReturnData\":false}]}}", 31 | "Timestamp": "2015-06-03T17:43:27.123Z", 32 | "SignatureVersion": "1", 33 | "Signature": "EXAMPLE", 34 | "SigningCertURL": "EXAMPLE", 35 | "UnsubscribeURL": "EXAMPLE", 36 | "MessageAttributes": {} 37 | } 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /src/fixtures/example-cloudwatch-alarm-sns-payload-single-metric.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "EventSource": "aws:sns", 5 | "EventVersion": "1.0", 6 | "EventSubscriptionArn": "arn:aws:sns:EXAMPLE", 7 | "Sns": { 8 | "Type": "Notification", 9 | "MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", 10 | "TopicArn": "arn:aws:sns:EXAMPLE", 11 | "Subject": "TestInvoke", 12 | "Message": "{\"AlarmName\": \"EXAMPLE\",\"AlarmDescription\": \"EXAMPLE\",\"AWSAccountId\": \"123456789012\",\"NewStateValue\": \"ALARM\",\"NewStateReason\": \"Threshold Crossed: 1 out of the last 1 datapoints [1234.0 (06/03/15 17:43:27)] was greater than the threshold (0.0) (minimum 1 datapoint for OK -> ALARM transition).\",\"StateChangeTime\": \"2015-06-03T17:43:27.123+0000\",\"Region\": \"EXAMPLE\",\"AlarmArn\": \"arn:aws:cloudwatch:REGION:ACCOUNT_NUMBER:alarm:EXAMPLE\",\"OldStateValue\": \"INSUFFICIENT_DATA\",\"Trigger\": {\"MetricName\": \"NetworkOut\",\"Namespace\": \"AWS/EC2\",\"StatisticType\": \"Statistic\",\"Statistic\": \"AVERAGE\",\"Unit\": \"Bytes\",\"Dimensions\": [{\"value\": \"TestInstance\",\"name\": \"InstanceId\"}],\"Period\": 60,\"EvaluationPeriods\": 1,\"ComparisonOperator\": \"GreaterThanThreshold\",\"Threshold\": 0.0,\"TreatMissingData\": \"- TreatMissingData: missing\",\"EvaluateLowSampleCountPercentile\": \"\"}}", 13 | "Timestamp": "2015-06-03T17:43:27.123Z", 14 | "SignatureVersion": "1", 15 | "Signature": "EXAMPLE", 16 | "SigningCertURL": "EXAMPLE", 17 | "UnsubscribeURL": "EXAMPLE", 18 | "MessageAttributes": {} 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/fixtures/example-cloudwatch_logs-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "awslogs": { 3 | "data": "H4sIAAAAAAAAAHWPwQqCQBCGX0Xm7EFtK+smZBEUgXoLCdMhFtKV3akI8d0bLYmibvPPN3wz00CJxmQnTO41whwWQRIctmEcB6sQbFC3CjW3XW8kxpOpP+OC22d1Wml1qZkQGtoMsScxaczKN3plG8zlaHIta5KqWsozoTYw3/djzwhpLwivWFGHGpAFe7DL68JlBUk+l7KSN7tCOEJ4M3/qOI49vMHj+zCKdlFqLaU2ZHV2a4Ct/an0/ivdX8oYc1UVX860fQDQiMdxRQEAAA==" 4 | } 5 | } 6 | 7 | -------------------------------------------------------------------------------- /src/fixtures/example-code_commit-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "eventId": "5a824061-17ca-46a9-bbf9-114edeadbeef", 5 | "eventVersion": "1.0", 6 | "eventTime": "2018-01-26T15:58:33.475+0000", 7 | "eventTriggerName": "my-trigger", 8 | "eventPartNumber": 1, 9 | "codecommit": { 10 | "references": [ 11 | { 12 | "commit": "5c4ef1049f1d27deadbeeff313e0730018be182b", 13 | "ref": "refs/heads/master" 14 | } 15 | ] 16 | }, 17 | "eventName": "TriggerEventTest", 18 | "eventTriggerConfigId": "5a824061-17ca-46a9-bbf9-114edeadbeef", 19 | "eventSourceARN": "arn:aws:codecommit:us-east-1:123456789012:my-repo", 20 | "userIdentityARN": "arn:aws:iam::123456789012:root", 21 | "eventSource": "aws:codecommit", 22 | "awsRegion": "us-east-1", 23 | "eventTotalParts": 1 24 | } 25 | ] 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/fixtures/example-codedeploy-deployment-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "123456789012", 3 | "region": "us-east-1", 4 | "detail-type": "CodeDeploy Deployment State-change Notification", 5 | "source": "aws.codedeploy", 6 | "version": "0", 7 | "time": "2016-06-30T22:06:31Z", 8 | "id": "c071bfbf-83c4-49ca-a6ff-3df053957145", 9 | "resources": [ 10 | "arn:aws:codedeploy:us-east-1:123456789012:application:myApplication", 11 | "arn:aws:codedeploy:us-east-1:123456789012:deploymentgroup:myApplication/myDeploymentGroup" 12 | ], 13 | "detail": { 14 | "instanceGroupId": "9fd2fbef-2157-40d8-91e7-6845af69e2d2", 15 | "region": "us-east-1", 16 | "application": "myApplication", 17 | "deploymentId": "d-123456789", 18 | "state": "SUCCESS", 19 | "deploymentGroup": "myDeploymentGroup" 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/fixtures/example-codedeploy-instance-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "account": "123456789012", 3 | "region": "us-east-1", 4 | "detail-type": "CodeDeploy Instance State-change Notification", 5 | "source": "aws.codedeploy", 6 | "version": "0", 7 | "time": "2016-06-30T23:18:50Z", 8 | "id": "fb1d3015-c091-4bf9-95e2-d98521ab2ecb", 9 | "resources": [ 10 | "arn:aws:ec2:us-east-1:123456789012:instance/i-0000000aaaaaaaaaa", 11 | "arn:aws:codedeploy:us-east-1:123456789012:deploymentgroup:myApplication/myDeploymentGroup", 12 | "arn:aws:codedeploy:us-east-1:123456789012:application:myApplication" 13 | ], 14 | "detail": { 15 | "instanceId": "i-0000000aaaaaaaaaa", 16 | "region": "us-east-1", 17 | "state": "SUCCESS", 18 | "application": "myApplication", 19 | "deploymentId": "d-123456789", 20 | "instanceGroupId": "8cd3bfa8-9e72-4cbe-a1e5-da4efc7efd49", 21 | "deploymentGroup": "myDeploymentGroup" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/fixtures/example-codepipeline-action-execution-stage-change-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "CWE-event-id", 4 | "detail-type": "CodePipeline Action Execution State Change", 5 | "source": "aws.codepipeline", 6 | "account": "123456789012", 7 | "time": "2017-04-22T03:31:47Z", 8 | "region": "us-east-1", 9 | "resources": [ 10 | "arn:aws:codepipeline:us-east-1:123456789012:pipeline:myPipeline" 11 | ], 12 | "detail": { 13 | "pipeline": "myPipeline", 14 | "version": 1, 15 | "execution-id": "01234567-0123-0123-0123-012345678901", 16 | "stage": "Prod", 17 | "action": "myAction", 18 | "state": "STARTED", 19 | "region":"us-west-2", 20 | "type": { 21 | "owner": "AWS", 22 | "category": "Deploy", 23 | "provider": "CodeDeploy", 24 | "version": 1 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/fixtures/example-codepipeline-execution-stage-change-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "CWE-event-id", 4 | "detail-type": "CodePipeline Stage Execution State Change", 5 | "source": "aws.codepipeline", 6 | "account": "123456789012", 7 | "time": "2017-04-22T03:31:47Z", 8 | "region": "us-east-1", 9 | "resources": [ 10 | "arn:aws:codepipeline:us-east-1:123456789012:pipeline:myPipeline" 11 | ], 12 | "detail": { 13 | "pipeline": "myPipeline", 14 | "version": 1, 15 | "state": "STARTED", 16 | "execution-id": "01234567-0123-0123-0123-012345678901" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/fixtures/example-codepipeline-execution-state-change-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "CWE-event-id", 4 | "detail-type": "CodePipeline Pipeline Execution State Change", 5 | "source": "aws.codepipeline", 6 | "account": "123456789012", 7 | "time": "2017-04-22T03:31:47Z", 8 | "region": "us-east-1", 9 | "resources": [ 10 | "arn:aws:codepipeline:us-east-1:123456789012:pipeline:myPipeline" 11 | ], 12 | "detail": { 13 | "pipeline": "myPipeline", 14 | "version": 1, 15 | "state": "STARTED", 16 | "execution-id": "01234567-0123-0123-0123-012345678901" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/fixtures/example-codepipeline_job-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "CodePipeline.job": { 3 | "id": "11111111-abcd-1111-abcd-111111abcdef", 4 | "accountId": "111111111111", 5 | "data": { 6 | "actionConfiguration": { 7 | "configuration": { 8 | "FunctionName": "MyLambdaFunctionForAWSCodePipeline", 9 | "UserParameters": "some-input-such-as-a-URL" 10 | } 11 | }, 12 | "inputArtifacts": [ 13 | { 14 | "location": { 15 | "s3Location": { 16 | "bucketName": "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", 17 | "objectKey": "the name of the application, for example CodePipelineDemoApplication.zip" 18 | }, 19 | "type": "S3" 20 | }, 21 | "revision": null, 22 | "name": "ArtifactName" 23 | } 24 | ], 25 | "outputArtifacts": [], 26 | "artifactCredentials": { 27 | "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", 28 | "sessionToken": "MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVIk60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nrAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auNKyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6GuoEDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw3rrszlaEXAMPLE=", 29 | "accessKeyId": "AKIAIOSFODNN7EXAMPLE" 30 | }, 31 | "continuationToken": "A continuation token if continuing job" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-create-auth-challenge.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "region": "us-west-2", 4 | "userPoolId": "", 5 | "userName": "", 6 | "callerContext": { 7 | "awsSdkVersion": "aws-sdk-unknown-unknown", 8 | "clientId": "" 9 | }, 10 | "triggerSource": "CreateAuthChallenge_Authentication", 11 | "request": { 12 | "userAttributes": { 13 | "sub": "", 14 | "cognito:user_status": "CONFIRMED", 15 | "phone_number_verified": "true", 16 | "cognito:phone_number_alias": "+12223334455", 17 | "phone_number": "+12223334455" 18 | }, 19 | "challengeName": "CUSTOM_CHALLENGE", 20 | "session": [ 21 | { 22 | "challengeName": "PASSWORD_VERIFIER", 23 | "challengeResult": true, 24 | "challengeMetadata": "metadata" 25 | } 26 | ], 27 | "clientMetadata": { 28 | "exampleMetadataKey": "example metadata value" 29 | } 30 | }, 31 | "response": { 32 | "publicChallengeParameters": { 33 | "a": "b" 34 | }, 35 | "privateChallengeParameters": { 36 | "c": "d" 37 | }, 38 | "challengeMetadata": "challengeMetadata" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-custommessage.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "CustomMessage_SignUp/CustomMessage_ResendCode/CustomMessage_ForgotPassword/CustomMessage_VerifyUserAttribute", 4 | "region": "", 5 | "userPoolId": "", 6 | "userName": "", 7 | "callerContext": { 8 | "awsSdkVersion": "", 9 | "clientId": "" 10 | }, 11 | "request": { 12 | "userAttributes": { 13 | "phone_number_verified": true, 14 | "email_verified": false 15 | }, 16 | "codeParameter": "####", 17 | "usernameParameter": "{username}", 18 | "clientMetadata": { 19 | "exampleMetadataKey": "example metadata value" 20 | } 21 | }, 22 | "response": { 23 | "smsMessage": "", 24 | "emailMessage": "", 25 | "emailSubject": "" 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-define-auth-challenge-optional-response-fields.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "region": "us-west-2", 4 | "userPoolId": "", 5 | "userName": "", 6 | "callerContext": { 7 | "awsSdkVersion": "aws-sdk-unknown-unknown", 8 | "clientId": "" 9 | }, 10 | "triggerSource": "DefineAuthChallenge_Authentication", 11 | "request": { 12 | "userAttributes": { 13 | "sub": "", 14 | "cognito:user_status": "CONFIRMED", 15 | "phone_number_verified": "true", 16 | "cognito:phone_number_alias": "+12223334455", 17 | "phone_number": "+12223334455" 18 | }, 19 | "session": [ 20 | { 21 | "challengeName": "PASSWORD_VERIFIER", 22 | "challengeResult": true, 23 | "challengeMetadata": "metadata" 24 | } 25 | ], 26 | "clientMetadata": { 27 | "exampleMetadataKey": "example metadata value" 28 | }, 29 | "userNotFound": false 30 | }, 31 | "response": { 32 | "challengeName": "challengeName" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-define-auth-challenge.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "region": "us-west-2", 4 | "userPoolId": "", 5 | "userName": "", 6 | "callerContext": { 7 | "awsSdkVersion": "aws-sdk-unknown-unknown", 8 | "clientId": "" 9 | }, 10 | "triggerSource": "DefineAuthChallenge_Authentication", 11 | "request": { 12 | "userAttributes": { 13 | "sub": "", 14 | "cognito:user_status": "CONFIRMED", 15 | "phone_number_verified": "true", 16 | "cognito:phone_number_alias": "+12223334455", 17 | "phone_number": "+12223334455" 18 | }, 19 | "session": [ 20 | { 21 | "challengeName": "PASSWORD_VERIFIER", 22 | "challengeResult": true, 23 | "challengeMetadata": "metadata" 24 | } 25 | ], 26 | "clientMetadata": { 27 | "exampleMetadataKey": "example metadata value" 28 | }, 29 | "userNotFound": false 30 | }, 31 | "response": { 32 | "challengeName": "challengeName", 33 | "issueTokens": true, 34 | "failAuthentication": true 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-migrateuser.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "UserMigration_Authentication", 4 | "region": "", 5 | "userPoolId": "", 6 | "userName": "", 7 | "callerContext": { 8 | "awsSdkVersion": "", 9 | "clientId": "" 10 | }, 11 | "request": { 12 | "password": "", 13 | "validationData": { 14 | "exampleMetadataKey": "example metadata value" 15 | }, 16 | "clientMetadata": { 17 | "exampleMetadataKey": "example metadata value" 18 | } 19 | }, 20 | "response": { 21 | "userAttributes": { 22 | "email": "", 23 | "phone_number": "" 24 | }, 25 | "finalUserStatus": "", 26 | "messageAction": "", 27 | "desiredDeliveryMediums": [ 28 | "", 29 | "" 30 | ], 31 | "forceAliasCreation": true 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-postauthentication.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "PostAuthentication_Authentication", 4 | "region": "", 5 | "userPoolId": "", 6 | "userName": "", 7 | "callerContext": { 8 | "awsSdkVersion": "", 9 | "clientId": "" 10 | }, 11 | "request": { 12 | "newDeviceUsed": true, 13 | "userAttributes" : { 14 | "email": "", 15 | "phone_number": "" 16 | }, 17 | "clientMetadata": { 18 | "exampleMetadataKey": "example metadata value" 19 | } 20 | }, 21 | "response": {} 22 | } 23 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-postconfirmation.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "PostConfirmation_ConfirmSignUp", 4 | "region": "", 5 | "userPoolId": "", 6 | "userName": "", 7 | "callerContext": { 8 | "awsSdkVersion": "", 9 | "clientId": "" 10 | }, 11 | "request": { 12 | "userAttributes" : { 13 | "email": "", 14 | "phone_number": "" 15 | }, 16 | "clientMetadata": { 17 | "exampleMetadataKey": "example metadata value" 18 | } 19 | }, 20 | "response": {} 21 | } 22 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-preauthentication.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "PreAuthentication_Authentication", 4 | "region": "", 5 | "userPoolId": "", 6 | "userName": "", 7 | "callerContext": { 8 | "awsSdkVersion": "", 9 | "clientId": "" 10 | }, 11 | "request": { 12 | "userAttributes": { 13 | "email": "" 14 | }, 15 | "validationData": { 16 | "k1": "v1", 17 | "k2": "v2" 18 | } 19 | }, 20 | "response": {} 21 | } 22 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-presignup.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "PreSignUp_SignUp", 4 | "region": "", 5 | "userPoolId": "", 6 | "userName": "", 7 | "callerContext": { 8 | "awsSdkVersion": "", 9 | "clientId": "" 10 | }, 11 | "request": { 12 | "userAttributes": { 13 | "email": "", 14 | "phone_number": "" 15 | }, 16 | "validationData": { 17 | "k1": "v1", 18 | "k2": "v2" 19 | }, 20 | "clientMetadata": { 21 | "exampleMetadataKey": "example metadata value" 22 | } 23 | }, 24 | "response": { 25 | "autoConfirmUser": false, 26 | "autoVerifyEmail": true, 27 | "autoVerifyPhone": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-pretokengen-incoming.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "PreTokenGen", 4 | "region": "region", 5 | "userPoolId": "userPoolId", 6 | "userName": "userName", 7 | "callerContext": { 8 | "awsSdkVersion": "calling aws sdk with version", 9 | "clientId": "apps client id" 10 | }, 11 | "request": { 12 | "userAttributes": { 13 | "email": "email", 14 | "phone_number": "phone_number" 15 | }, 16 | "groupConfiguration": { 17 | "groupsToOverride": ["group-A", "group-B", "group-C"], 18 | "iamRolesToOverride": ["arn:aws:iam::XXXXXXXXXXXX:role/sns_callerA", "arn:aws:iam::XXXXXXXXX:role/sns_callerB", "arn:aws:iam::XXXXXXXXXX:role/sns_callerC"], 19 | "preferredRole": "arn:aws:iam::XXXXXXXXXXX:role/sns_caller" 20 | }, 21 | "clientMetadata": { 22 | "exampleMetadataKey": "example metadata value" 23 | } 24 | }, 25 | "response": { 26 | "claimsOverrideDetails": null 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-pretokengen.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "triggerSource": "PreTokenGen", 4 | "region": "region", 5 | "userPoolId": "userPoolId", 6 | "userName": "userName", 7 | "callerContext": { 8 | "awsSdkVersion": "calling aws sdk with version", 9 | "clientId": "apps client id" 10 | }, 11 | "request": { 12 | "userAttributes": { 13 | "email": "email", 14 | "phone_number": "phone_number" 15 | }, 16 | "groupConfiguration": { 17 | "groupsToOverride": ["group-A", "group-B", "group-C"], 18 | "iamRolesToOverride": ["arn:aws:iam::XXXXXXXXXXXX:role/sns_callerA", "arn:aws:iam::XXXXXXXXX:role/sns_callerB", "arn:aws:iam::XXXXXXXXXX:role/sns_callerC"], 19 | "preferredRole": "arn:aws:iam::XXXXXXXXXXX:role/sns_caller" 20 | }, 21 | "clientMetadata": { 22 | "exampleMetadataKey": "example metadata value" 23 | } 24 | }, 25 | "response": { 26 | "claimsOverrideDetails": { 27 | "claimsToAddOrOverride": { 28 | "attribute_key2": "attribute_value2", 29 | "attribute_key": "attribute_value" 30 | }, 31 | "claimsToSuppress": ["email"], 32 | "groupOverrideDetails": { 33 | "groupsToOverride": ["group-A", "group-B", "group-C"], 34 | "iamRolesToOverride": ["arn:aws:iam::XXXXXXXXXXXX:role/sns_callerA", "arn:aws:iam::XXXXXXXXX:role/sns_callerB", "arn:aws:iam::XXXXXXXXXX:role/sns_callerC"], 35 | "preferredRole": "arn:aws:iam::XXXXXXXXXXX:role/sns_caller" 36 | } 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-verify-auth-challenge-optional-answer-correct.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "region": "us-west-2", 4 | "userPoolId": "", 5 | "userName": "", 6 | "callerContext": { 7 | "awsSdkVersion": "aws-sdk-unknown-unknown", 8 | "clientId": "" 9 | }, 10 | "triggerSource": "VerifyAuthChallengeResponse_Authentication", 11 | "request": { 12 | "userAttributes": { 13 | "sub": "", 14 | "cognito:user_status": "CONFIRMED", 15 | "phone_number_verified": "true", 16 | "cognito:phone_number_alias": "+12223334455", 17 | "phone_number": "+12223334455" 18 | }, 19 | "privateChallengeParameters": { 20 | "secret": "11122233" 21 | }, 22 | "challengeAnswer": "123xxxx", 23 | "clientMetadata": { 24 | "exampleMetadataKey": "example metadata value" 25 | } 26 | }, 27 | "response": { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event-userpools-verify-auth-challenge.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1", 3 | "region": "us-west-2", 4 | "userPoolId": "", 5 | "userName": "", 6 | "callerContext": { 7 | "awsSdkVersion": "aws-sdk-unknown-unknown", 8 | "clientId": "" 9 | }, 10 | "triggerSource": "VerifyAuthChallengeResponse_Authentication", 11 | "request": { 12 | "userAttributes": { 13 | "sub": "", 14 | "cognito:user_status": "CONFIRMED", 15 | "phone_number_verified": "true", 16 | "cognito:phone_number_alias": "+12223334455", 17 | "phone_number": "+12223334455" 18 | }, 19 | "privateChallengeParameters": { 20 | "secret": "11122233" 21 | }, 22 | "challengeAnswer": "123xxxx", 23 | "clientMetadata": { 24 | "exampleMetadataKey": "example metadata value" 25 | } 26 | }, 27 | "response": { 28 | "answerCorrect": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/fixtures/example-cognito-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "datasetName": "datasetName", 3 | "eventType": "SyncTrigger", 4 | "region": "us-east-1", 5 | "identityId": "identityId", 6 | "datasetRecords": 7 | { 8 | "SampleKey1": 9 | { 10 | "newValue": "newValue1", 11 | "oldValue": "oldValue1", 12 | "op": "replace" 13 | } 14 | }, 15 | "identityPoolId": "identityPoolId", 16 | "version": 2 17 | } 18 | -------------------------------------------------------------------------------- /src/fixtures/example-config-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "configRuleId": "config-rule-0123456", 3 | "version": "1.0", 4 | "configRuleName": "periodic-config-rule", 5 | "configRuleArn": "arn:aws:config:us-east-1:012345678912:config-rule/config-rule-0123456", 6 | "invokingEvent": "{\"configSnapshotId\":\"00000000-0000-0000-0000-000000000000\",\"s3ObjectKey\":\"AWSLogs/000000000000/Config/us-east-1/2016/2/24/ConfigSnapshot/000000000000_Config_us-east-1_ConfigSnapshot_20160224T182319Z_00000000-0000-0000-0000-000000000000.json.gz\",\"s3Bucket\":\"config-bucket\",\"notificationCreationTime\":\"2016-02-24T18:23:20.328Z\",\"messageType\":\"ConfigurationSnapshotDeliveryCompleted\",\"recordVersion\":\"1.1\"}", 7 | "resultToken": "myResultToken", 8 | "eventLeftScope": false, 9 | "ruleParameters": "{\"myParameterKey\":\"myParameterValue\"}", 10 | "executionRoleArn": "arn:aws:iam::012345678912:role/config-role", 11 | "accountId": "012345678912" 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/fixtures/example-connect-event-without-queue.json: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "ContactFlowExecution", 3 | "Details": { 4 | "Parameters": { 5 | "key1": "value1", 6 | "key2": "value2" 7 | }, 8 | "ContactData": { 9 | "ContactId": "ASDAcxcasDFSSDFs", 10 | "InitialContactId": "Acxsada-asdasdaxA", 11 | "PreviousContactId": "Acxsada-asdasdaxA", 12 | "Channel": "Voice", 13 | "InstanceARN": "", 14 | "InitiationMethod": "INBOUND/OUTBOUND/TRANSFER/CALLBACK", 15 | "SystemEndpoint": { 16 | "Type": "TELEPHONE_NUMBER", 17 | "Address": "01234567" 18 | }, 19 | "CustomerEndpoint": { 20 | "Type": "TELEPHONE_NUMBER", 21 | "Address": "+14802021091" 22 | }, 23 | "Attributes": { 24 | "key1": "value", 25 | "key2": "value" 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/fixtures/example-connect-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "ContactFlowExecution", 3 | "Details": { 4 | "Parameters": { 5 | "key1": "value1", 6 | "key2": "value2" 7 | }, 8 | "ContactData": { 9 | "ContactId": "ASDAcxcasDFSSDFs", 10 | "InitialContactId": "Acxsada-asdasdaxA", 11 | "PreviousContactId": "Acxsada-asdasdaxA", 12 | "Channel": "Voice", 13 | "InstanceARN": "", 14 | "InitiationMethod": "INBOUND/OUTBOUND/TRANSFER/CALLBACK", 15 | "SystemEndpoint": { 16 | "Type": "TELEPHONE_NUMBER", 17 | "Address": "01234567" 18 | }, 19 | "CustomerEndpoint": { 20 | "Type": "TELEPHONE_NUMBER", 21 | "Address": "+14802021091" 22 | }, 23 | "Queue": { 24 | "Name": "PrimaryPhoneQueue", 25 | "ARN": "" 26 | }, 27 | "Attributes": { 28 | "key1": "value", 29 | "key2": "value" 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/fixtures/example-dynamodb-event-record-with-optional-fields.json: -------------------------------------------------------------------------------- 1 | { 2 | "awsRegion":"eu-west-1", 3 | "eventID":"00000000-0000-0000-0000-000000000000", 4 | "eventName":"INSERT", 5 | "userIdentity":null, 6 | "recordFormat":"application/json", 7 | "tableName":"examples", 8 | "dynamodb":{ 9 | "ApproximateCreationDateTime":1649809356015, 10 | "Keys":{ 11 | "id":{ 12 | "S":"00000000-0000-0000-0000-000000000000" 13 | } 14 | }, 15 | "NewImage":{ 16 | "id":{ 17 | "S":"00000000-0000-0000-0000-000000000000" 18 | }, 19 | "created":{ 20 | "S":"2022-02-16T15:12:00.14Z" 21 | } 22 | }, 23 | "SizeBytes":292 24 | }, 25 | "eventSource":"aws:dynamodb" 26 | } 27 | -------------------------------------------------------------------------------- /src/fixtures/example-dynamodb-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "eventID": "f07f8ca4b0b26cb9c4e5e77e69f274ee", 5 | "eventName": "INSERT", 6 | "eventVersion": "1.1", 7 | "eventSource": "aws:dynamodb", 8 | "awsRegion": "us-east-1", 9 | "userIdentity":{ 10 | "type":"Service", 11 | "principalId":"dynamodb.amazonaws.com" 12 | }, 13 | "dynamodb": { 14 | "ApproximateCreationDateTime": 1480642020, 15 | "Keys": { 16 | "val": { 17 | "S": "data" 18 | }, 19 | "key": { 20 | "S": "binary" 21 | } 22 | }, 23 | "NewImage": { 24 | "val": { 25 | "S": "data" 26 | }, 27 | "asdf1": { 28 | "B": "AAEqQQ==" 29 | }, 30 | "asdf2": { 31 | "BS": [ 32 | "AAEqQQ==", 33 | "QSoBAA==" 34 | ] 35 | }, 36 | "key": { 37 | "S": "binary" 38 | } 39 | }, 40 | "SequenceNumber": "1405400000000002063282832", 41 | "SizeBytes": 54, 42 | "StreamViewType": "NEW_AND_OLD_IMAGES" 43 | }, 44 | "eventSourceARN": "arn:aws:dynamodb:us-east-1:123456789012:table/Example-Table/stream/2016-12-01T00:00:00.000" 45 | }, 46 | { 47 | "eventID": "f07f8ca4b0b26cb9c4e5e77e42f274ee", 48 | "eventName": "INSERT", 49 | "eventVersion": "1.1", 50 | "eventSource": "aws:dynamodb", 51 | "awsRegion": "us-east-1", 52 | "dynamodb": { 53 | "ApproximateCreationDateTime": 1480642020, 54 | "Keys": { 55 | "val": { 56 | "S": "data" 57 | }, 58 | "key": { 59 | "S": "binary" 60 | } 61 | }, 62 | "NewImage": { 63 | "val": { 64 | "S": "data" 65 | }, 66 | "asdf1": { 67 | "B": "AAEqQQ==" 68 | }, 69 | "b2": { 70 | "B": "test" 71 | }, 72 | "asdf2": { 73 | "BS": [ 74 | "AAEqQQ==", 75 | "QSoBAA==", 76 | "AAEqQQ==" 77 | ] 78 | }, 79 | "key": { 80 | "S": "binary" 81 | }, 82 | "Binary": { 83 | "B": "AAEqQQ==" 84 | }, 85 | "Boolean": { 86 | "BOOL": true 87 | }, 88 | "BinarySet": { 89 | "BS": [ 90 | "AAEqQQ==", 91 | "AAEqQQ==" 92 | ] 93 | }, 94 | "List": { 95 | "L": [ 96 | { 97 | "S": "Cookies" 98 | }, 99 | { 100 | "S": "Coffee" 101 | }, 102 | { 103 | "N": "3.14159" 104 | } 105 | ] 106 | }, 107 | "Map": { 108 | "M": { 109 | "Name": { 110 | "S": "Joe" 111 | }, 112 | "Age": { 113 | "N": "35" 114 | } 115 | } 116 | }, 117 | "FloatNumber": { 118 | "N": "123.45" 119 | }, 120 | "IntegerNumber": { 121 | "N": "123" 122 | }, 123 | "NumberSet": { 124 | "NS": [ 125 | "1234", 126 | "567.8" 127 | ] 128 | }, 129 | "Null": { 130 | "NULL": true 131 | }, 132 | "String": { 133 | "S": "Hello" 134 | }, 135 | "StringSet": { 136 | "SS": [ 137 | "Giraffe", 138 | "Zebra" 139 | ] 140 | }, 141 | "EmptyStringSet": { 142 | "SS": [] 143 | } 144 | }, 145 | "SequenceNumber": "1405400000000002063282832", 146 | "SizeBytes": 54, 147 | "StreamViewType": "NEW_AND_OLD_IMAGES" 148 | }, 149 | "eventSourceARN": "arn:aws:dynamodb:us-east-1:123456789012:table/Example-Table/stream/2016-12-01T00:00:00.000" 150 | } 151 | ] 152 | } 153 | 154 | -------------------------------------------------------------------------------- /src/fixtures/example-ecr-image-scan-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0", 3 | "id": "01234567-0123-0123-0123-012345678901", 4 | "detail-type": "ECR Image Scan", 5 | "source": "aws.ecr", 6 | "account": "123456789012", 7 | "time": "2019-10-30T21:32:27Z", 8 | "region": "eu-north-1", 9 | "resources": ["arn:aws:ecr:eu-north-1:123456789012:repository/tribble-image-scan-test"], 10 | "detail": { 11 | "scan-status": "COMPLETE", 12 | "repository-name": "tribble-image-scan-test", 13 | "finding-severity-counts": { 14 | "CRITICAL": 10, 15 | "HIGH": 2, 16 | "MEDIUM": 9, 17 | "LOW": 3, 18 | "INFORMATIONAL": 0, 19 | "UNDEFINED": 0 20 | }, 21 | "image-digest": "sha256:d4a96ee9443e641fc100e763a0c10928720b50c6e3ea3342d05d7c3435fc5355", 22 | "image-tags": ["1572471135"] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/fixtures/example-firehose-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "invocationId": "invoked123", 3 | "deliveryStreamArn": "aws:lambda:events", 4 | "sourceKinesisStreamArn": "arn:aws:kinesis:us-east-1:123456789012:stream/test", 5 | "region": "us-west-2", 6 | "records": [ 7 | { 8 | "data": "SGVsbG8gV29ybGQ=", 9 | "recordId": "record1", 10 | "approximateArrivalTimestamp": 1507217624302, 11 | "kinesisRecordMetadata": { 12 | "shardId": "shardId-000000000000", 13 | "partitionKey": "4d1ad2b9-24f8-4b9d-a088-76e9947c317a", 14 | "approximateArrivalTimestamp": 1507217624302, 15 | "sequenceNumber": "49546986683135544286507457936321625675700192471156785154", 16 | "subsequenceNumber": 123456 17 | } 18 | }, 19 | { 20 | "data": "SGVsbG8gV29ybGQ=", 21 | "recordId": "record2", 22 | "approximateArrivalTimestamp": 1507217624302, 23 | "kinesisRecordMetadata": { 24 | "shardId": "shardId-000000000001", 25 | "partitionKey": "4d1ad2b9-24f8-4b9d-a088-76e9947c318a", 26 | "approximateArrivalTimestamp": 1507217624302, 27 | "sequenceNumber": "49546986683135544286507457936321625675700192471156785155", 28 | "subsequenceNumber": 123457 29 | } 30 | } 31 | ] 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/fixtures/example-iot-custom-auth-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "token" :"aToken", 3 | "signatureVerified": true, 4 | "protocols": ["tls", "http", "mqtt"], 5 | "protocolData": { 6 | "tls" : { 7 | "serverName": "serverName" 8 | }, 9 | "http": { 10 | "headers": { 11 | "X-Request-ID": "abc123" 12 | }, 13 | "queryString": "?foo=bar" 14 | }, 15 | "mqtt": { 16 | "username": "myUserName", 17 | "password": "bXlQYXNzd29yZA==", 18 | "clientId": "myClientId" 19 | } 20 | }, 21 | "connectionMetadata": { 22 | "id": "e56f08c3-c559-490f-aa9f-7e8427d0f57b" 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/fixtures/example-iot-custom-auth-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "isAuthenticated":true, 3 | "principalId": "xxxxxxxx", 4 | "disconnectAfterInSeconds": 86400, 5 | "refreshAfterInSeconds": 300, 6 | "policyDocuments": [ 7 | { 8 | "Version": "2012-10-17", 9 | "Statement": [ 10 | { 11 | "Action": ["iot:Publish"], 12 | "Effect": "Allow", 13 | "Resource": ["arn:aws:iot:us-east-1::topic/customauthtesting"] 14 | } 15 | ] 16 | } 17 | ] 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/fixtures/example-iot_1_click-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "deviceEvent": { 3 | "buttonClicked": { 4 | "clickType": "SINGLE", 5 | "reportedTime": "2018-05-04T23:26:33.747Z" 6 | } 7 | }, 8 | "deviceInfo": { 9 | "attributes": { 10 | "key3": "value3", 11 | "key1": "value1", 12 | "key4": "value4" 13 | }, 14 | "type": "button", 15 | "deviceId": "G030PMXXXXXXXXXX", 16 | "remainingLife": 5.00 17 | }, 18 | "placementInfo": { 19 | "projectName": "test", 20 | "placementName": "myPlacement", 21 | "attributes": { 22 | "location": "Seattle", 23 | "equipment": "printer" 24 | }, 25 | "devices": { 26 | "myButton": "G030PMXXXXXXXXXX" 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/fixtures/example-iot_button-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "serialNumber": "ABCDEFG12345", 3 | "clickType": "SINGLE", 4 | "batteryVoltage": "2000 mV" 5 | } 6 | -------------------------------------------------------------------------------- /src/fixtures/example-kafka-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "eventSource": "aws:kafka", 3 | "eventSourceArn": "arn:aws:kafka:us-west-2:012345678901:cluster/ExampleMSKCluster/e9f754c6-d29a-4430-a7db-958a19fd2c54-4", 4 | "bootstrapServers": "b-2.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092,b-1.demo-cluster-1.a1bcde.c1.kafka.us-east-1.amazonaws.com:9092", 5 | "records": { 6 | "AWSKafkaTopic-0": [ 7 | { 8 | "topic": "AWSKafkaTopic", 9 | "partition": 0, 10 | "offset": 0, 11 | "timestamp": 1595035749700, 12 | "timestampType": "CREATE_TIME", 13 | "key": "OGQ1NTk2YjQtMTgxMy00MjM4LWIyNGItNmRhZDhlM2QxYzBj", 14 | "value": "OGQ1NTk2YjQtMTgxMy00MjM4LWIyNGItNmRhZDhlM2QxYzBj", 15 | "headers": [ 16 | { 17 | "headerKey": [104, 101, 97, 100, 101, 114, 86, 97, 108, 117, 101] 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/fixtures/example-kinesis-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "kinesis": { 5 | "kinesisSchemaVersion": "1.0", 6 | "partitionKey": "s1", 7 | "sequenceNumber": "49568167373333333333333333333333333333333333333333333333", 8 | "data": "SGVsbG8gV29ybGQ=", 9 | "approximateArrivalTimestamp": 1480641523.477 10 | }, 11 | "eventSource": "aws:kinesis", 12 | "eventVersion": "1.0", 13 | "eventID": "shardId-000000000000:49568167373333333333333333333333333333333333333333333333", 14 | "eventName": "aws:kinesis:record", 15 | "invokeIdentityArn": "arn:aws:iam::123456789012:role/LambdaRole", 16 | "awsRegion": "us-east-1", 17 | "eventSourceARN": "arn:aws:kinesis:us-east-1:123456789012:stream/simple-stream" 18 | }, 19 | { 20 | "kinesis": { 21 | "kinesisSchemaVersion": "1.0", 22 | "partitionKey": "s1", 23 | "sequenceNumber": "49568167373333333334444444444444444444444444444444444444", 24 | "data": "SGVsbG8gV29ybGQ=", 25 | "approximateArrivalTimestamp": 1480841523.477 26 | }, 27 | "eventSource": "aws:kinesis", 28 | "eventVersion": "1.0", 29 | "eventID": "shardId-000000000000:49568167373333333334444444444444444444444444444444444444", 30 | "eventName": "aws:kinesis:record", 31 | "invokeIdentityArn": "arn:aws:iam::123456789012:role/LambdaRole", 32 | "awsRegion": "us-east-1", 33 | "eventSourceARN": "arn:aws:kinesis:us-east-1:123456789012:stream/simple-stream" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /src/fixtures/example-kinesis-firehose-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "invocationId": "invoked123", 3 | "deliveryStreamArn": "aws:lambda:events", 4 | "sourceKinesisStreamArn": "arn:aws:kinesis:us-east-1:123456789012:stream/test", 5 | "region": "us-west-2", 6 | "records": [ 7 | { 8 | "data": "SGVsbG8gV29ybGQ=", 9 | "recordId": "record1", 10 | "approximateArrivalTimestamp": 1507217624302, 11 | "kinesisRecordMetadata": { 12 | "shardId": "shardId-000000000000", 13 | "partitionKey": "4d1ad2b9-24f8-4b9d-a088-76e9947c317a", 14 | "approximateArrivalTimestamp": 1507217624302, 15 | "sequenceNumber": "49546986683135544286507457936321625675700192471156785154", 16 | "subsequenceNumber": 123456 17 | } 18 | }, 19 | { 20 | "data": "SGVsbG8gV29ybGQ=", 21 | "recordId": "record2", 22 | "approximateArrivalTimestamp": 1507217624302, 23 | "kinesisRecordMetadata": { 24 | "shardId": "shardId-000000000001", 25 | "partitionKey": "4d1ad2b9-24f8-4b9d-a088-76e9947c318a", 26 | "approximateArrivalTimestamp": 1507217624302, 27 | "sequenceNumber": "49546986683135544286507457936321625675700192471156785155", 28 | "subsequenceNumber": 123457 29 | } 30 | } 31 | ] 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/fixtures/example-kinesis-firehose-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "records": [ 3 | { 4 | "data": "SGVsbG8gV29ybGQ=", 5 | "recordId": "record1", 6 | "result": "TRANSFORMED_STATE_OK", 7 | "metadata": { 8 | "partitionKeys": {} 9 | } 10 | }, 11 | { 12 | "data": "SGVsbG8gV29ybGQ=", 13 | "recordId": "record2", 14 | "result": "TRANSFORMED_STATE_DROPPED", 15 | "metadata": { 16 | "partitionKeys": {} 17 | } 18 | }, 19 | { 20 | "data": "SGVsbG8gV29ybGQ=", 21 | "recordId": "record3", 22 | "result": "TransformedStateOk", 23 | "metadata": { 24 | "partitionKeys": { 25 | "iamKey1": "iamValue1", 26 | "iamKey2": "iamValue2" 27 | } 28 | } 29 | } 30 | ] 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/fixtures/example-lex-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "currentIntent": { 3 | "name": "intent-name", 4 | "slots": { 5 | "slot name1": "value1", 6 | "slot name2": "value2" 7 | }, 8 | "slotDetails": { 9 | "slot name1": { 10 | "resolutions": [ 11 | { "value1": "resolved value1" }, 12 | { "value2": "resolved value2" } 13 | ], 14 | "originalValue": "original text" 15 | }, 16 | "slot name2": { 17 | "resolutions": [ 18 | { "value1": "resolved value1" }, 19 | { "value2": "resolved value2" } 20 | ], 21 | "originalValue": "original text" 22 | } 23 | }, 24 | "confirmationStatus": "None, Confirmed, or Denied (intent confirmation, if configured)" 25 | }, 26 | "bot": { 27 | "name": "bot name", 28 | "alias": "bot alias", 29 | "version": "bot version" 30 | }, 31 | "userId": "User ID specified in the POST request to Amazon Lex.", 32 | "inputTranscript": "Text used to process the request", 33 | "invocationSource": "FulfillmentCodeHook or DialogCodeHook", 34 | "outputDialogMode": "Text or Voice, based on ContentType request header in runtime API request", 35 | "messageVersion": "1.0", 36 | "sessionAttributes": { 37 | "key1": "value1", 38 | "key2": "value2" 39 | }, 40 | "requestAttributes": { 41 | "key1": "value1", 42 | "key2": "value2" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/fixtures/example-lex-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessionAttributes": { 3 | "key1": "value1", 4 | "key2": "value2" 5 | }, 6 | "dialogAction": { 7 | "type": "ElicitIntent, ElicitSlot, ConfirmIntent, Delegate, or Close", 8 | "fulfillmentState": "Fulfilled or Failed", 9 | "message": { 10 | "contentType": "PlainText or SSML", 11 | "content": "message to convey to the user" 12 | }, 13 | "intentName": "intent-name", 14 | "slots": { 15 | "slot-name1": "value1", 16 | "slot-name2": "value2", 17 | "slot-name3": "value3" 18 | }, 19 | "slotToElicit": "slot-name", 20 | "responseCard": { 21 | "version": 3, 22 | "contentType": "application/vnd.amazonaws.card.generic", 23 | "genericAttachments": [ 24 | { 25 | "title": "card-title", 26 | "subTitle": "card-sub-title", 27 | "imageUrl": "URL of the image to be shown", 28 | "attachmentLinkUrl": "URL of the attachment to be associated with the card", 29 | "buttons": [ 30 | { 31 | "text": "button-text", 32 | "value": "value sent to server on button click" 33 | } 34 | ] 35 | } 36 | ] 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/fixtures/example-rabbitmq-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "eventSource": "aws:rmq", 3 | "eventSourceArn": "arn:aws:mq:us-west-2:112556298976:broker:test:b-9bcfa592-423a-4942-879d-eb284b418fc8", 4 | "rmqMessagesByQueue": { 5 | "test::/": [ 6 | { 7 | "basicProperties": { 8 | "contentType": "text/plain", 9 | "contentEncoding": null, 10 | "headers": { 11 | "header1": { 12 | "bytes": [ 13 | 118, 14 | 97, 15 | 108, 16 | 117, 17 | 101, 18 | 49 19 | ] 20 | }, 21 | "header2": { 22 | "bytes": [ 23 | 118, 24 | 97, 25 | 108, 26 | 117, 27 | 101, 28 | 50 29 | ] 30 | }, 31 | "numberInHeader": 10 32 | }, 33 | "deliveryMode": 1, 34 | "priority": 34, 35 | "correlationId": null, 36 | "replyTo": null, 37 | "expiration": "60000", 38 | "messageId": null, 39 | "timestamp": "Jan 1, 1970, 12:33:41 AM", 40 | "type": null, 41 | "userId": "AIDACKCEVSQ6C2EXAMPLE", 42 | "appId": null, 43 | "clusterId": null, 44 | "bodySize": 80 45 | }, 46 | "redelivered": false, 47 | "data": "eyJ0aW1lb3V0IjowLCJkYXRhIjoiQ1pybWYwR3c4T3Y0YnFMUXhENEUifQ==" 48 | } 49 | ] 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/fixtures/example-s3-event-with-decoded.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "eventVersion": "2.0", 5 | "eventSource": "aws:s3", 6 | "awsRegion": "us-east-1", 7 | "eventTime": "1970-01-01T00:00:00.123Z", 8 | "eventName": "ObjectCreated:Put", 9 | "userIdentity": { 10 | "principalId": "EXAMPLE" 11 | }, 12 | "requestParameters": { 13 | "sourceIPAddress": "127.0.0.1" 14 | }, 15 | "responseElements": { 16 | "x-amz-request-id": "C3D13FE58DE4C810", 17 | "x-amz-id-2": "FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD" 18 | }, 19 | "s3": { 20 | "s3SchemaVersion": "1.0", 21 | "configurationId": "testConfigRule", 22 | "bucket": { 23 | "name": "sourcebucket", 24 | "ownerIdentity": { 25 | "principalId": "EXAMPLE" 26 | }, 27 | "arn": "arn:aws:s3:::mybucket" 28 | }, 29 | "object": { 30 | "key": "Happy%20Face.jpg", 31 | "urlDecodedKey": "Happy Face.jpg", 32 | "size": 1024, 33 | "versionId": "version", 34 | "eTag": "d41d8cd98f00b204e9800998ecf8427e", 35 | "sequencer": "Happy Sequencer" 36 | } 37 | } 38 | } 39 | ] 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/fixtures/example-s3-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "eventVersion": "2.0", 5 | "eventSource": "aws:s3", 6 | "awsRegion": "us-east-1", 7 | "eventTime": "1970-01-01T00:00:00.123Z", 8 | "eventName": "ObjectCreated:Put", 9 | "userIdentity": { 10 | "principalId": "EXAMPLE" 11 | }, 12 | "requestParameters": { 13 | "sourceIPAddress": "127.0.0.1" 14 | }, 15 | "responseElements": { 16 | "x-amz-request-id": "C3D13FE58DE4C810", 17 | "x-amz-id-2": "FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD" 18 | }, 19 | "s3": { 20 | "s3SchemaVersion": "1.0", 21 | "configurationId": "testConfigRule", 22 | "bucket": { 23 | "name": "sourcebucket", 24 | "ownerIdentity": { 25 | "principalId": "EXAMPLE" 26 | }, 27 | "arn": "arn:aws:s3:::mybucket" 28 | }, 29 | "object": { 30 | "key": "Happy%20Face.jpg", 31 | "size": 1024, 32 | "versionId": "version", 33 | "eTag": "d41d8cd98f00b204e9800998ecf8427e", 34 | "sequencer": "Happy Sequencer" 35 | } 36 | } 37 | } 38 | ] 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/fixtures/example-s3-object-lambda-event-get-object-assumed-role.json: -------------------------------------------------------------------------------- 1 | { 2 | "xAmzRequestId": "requestId", 3 | "getObjectContext": { 4 | "inputS3Url": "https://my-s3-ap-111122223333.s3-accesspoint.us-east-1.amazonaws.com/example?X-Amz-Security-Token=", 5 | "outputRoute": "io-use1-001", 6 | "outputToken": "OutputToken" 7 | }, 8 | "configuration": { 9 | "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:111122223333:accesspoint/example-object-lambda-ap", 10 | "supportingAccessPointArn": "arn:aws:s3:us-east-1:111122223333:accesspoint/example-ap", 11 | "payload": "{}" 12 | }, 13 | "userRequest": { 14 | "url": "https://object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com/example", 15 | "headers": { 16 | "Host": "object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com", 17 | "Accept-Encoding": "identity", 18 | "X-Amz-Content-SHA256": "e3b0c44298fc1example" 19 | } 20 | }, 21 | "userIdentity": { 22 | "type": "AssumedRole", 23 | "principalId": "principalId", 24 | "arn": "arn:aws:sts::111122223333:assumed-role/Admin/example", 25 | "accountId": "111122223333", 26 | "accessKeyId": "accessKeyId", 27 | "sessionContext": { 28 | "attributes": { 29 | "mfaAuthenticated": "false", 30 | "creationDate": "Wed Mar 10 23:41:52 UTC 2021" 31 | }, 32 | "sessionIssuer": { 33 | "type": "Role", 34 | "principalId": "principalId", 35 | "arn": "arn:aws:iam::111122223333:role/Admin", 36 | "accountId": "111122223333", 37 | "userName": "Admin" 38 | } 39 | } 40 | }, 41 | "protocolVersion": "1.00" 42 | } -------------------------------------------------------------------------------- /src/fixtures/example-s3-object-lambda-event-get-object-iam.json: -------------------------------------------------------------------------------- 1 | { 2 | "xAmzRequestId": "requestId", 3 | "getObjectContext": { 4 | "inputS3Url": "https://my-s3-ap-111122223333.s3-accesspoint.us-east-1.amazonaws.com/example?X-Amz-Security-Token=", 5 | "outputRoute": "io-use1-001", 6 | "outputToken": "OutputToken" 7 | }, 8 | "configuration": { 9 | "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:111122223333:accesspoint/example-object-lambda-ap", 10 | "supportingAccessPointArn": "arn:aws:s3:us-east-1:111122223333:accesspoint/example-ap", 11 | "payload": "{}" 12 | }, 13 | "userRequest": { 14 | "url": "https://object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com/example", 15 | "headers": { 16 | "Host": "object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com", 17 | "Accept-Encoding": "identity", 18 | "X-Amz-Content-SHA256": "e3b0c44298fc1example" 19 | } 20 | }, 21 | "userIdentity": { 22 | "type": "IAMUser", 23 | "principalId": "principalId", 24 | "arn": "arn:aws:iam::111122223333:user/username", 25 | "accountId": "111122223333", 26 | "accessKeyId": "accessKeyId" 27 | }, 28 | "protocolVersion": "1.00" 29 | } 30 | -------------------------------------------------------------------------------- /src/fixtures/example-s3-object-lambda-event-head-object-iam.json: -------------------------------------------------------------------------------- 1 | { 2 | "xAmzRequestId": "requestId", 3 | "headObjectContext": { 4 | "inputS3Url": "https://my-s3-ap-111122223333.s3-accesspoint.us-east-1.amazonaws.com/example?X-Amz-Security-Token=" 5 | }, 6 | "configuration": { 7 | "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:111122223333:accesspoint/example-object-lambda-ap", 8 | "supportingAccessPointArn": "arn:aws:s3:us-east-1:111122223333:accesspoint/example-ap", 9 | "payload": "{}" 10 | }, 11 | "userRequest": { 12 | "url": "https://object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com/example", 13 | "headers": { 14 | "Host": "object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com", 15 | "Accept-Encoding": "identity", 16 | "X-Amz-Content-SHA256": "e3b0c44298fc1example" 17 | } 18 | }, 19 | "userIdentity": { 20 | "type": "IAMUser", 21 | "principalId": "principalId", 22 | "arn": "arn:aws:iam::111122223333:user/username", 23 | "accountId": "111122223333", 24 | "accessKeyId": "accessKeyId" 25 | }, 26 | "protocolVersion": "1.01" 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/fixtures/example-s3-object-lambda-event-list-objects-iam.json: -------------------------------------------------------------------------------- 1 | { 2 | "xAmzRequestId": "requestId", 3 | "listObjectsContext": { 4 | "inputS3Url": "https://my-s3-ap-111122223333.s3-accesspoint.us-east-1.amazonaws.com/example?X-Amz-Security-Token=" 5 | }, 6 | "configuration": { 7 | "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:111122223333:accesspoint/example-object-lambda-ap", 8 | "supportingAccessPointArn": "arn:aws:s3:us-east-1:111122223333:accesspoint/example-ap", 9 | "payload": "{}" 10 | }, 11 | "userRequest": { 12 | "url": "https://object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com/example", 13 | "headers": { 14 | "Host": "object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com", 15 | "Accept-Encoding": "identity", 16 | "X-Amz-Content-SHA256": "e3b0c44298fc1example" 17 | } 18 | }, 19 | "userIdentity": { 20 | "type": "IAMUser", 21 | "principalId": "principalId", 22 | "arn": "arn:aws:iam::111122223333:user/username", 23 | "accountId": "111122223333", 24 | "accessKeyId": "accessKeyId" 25 | }, 26 | "protocolVersion": "1.01" 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/fixtures/example-s3-object-lambda-event-list-objects-v2-iam.json: -------------------------------------------------------------------------------- 1 | { 2 | "xAmzRequestId": "requestId", 3 | "listObjectsV2Context": { 4 | "inputS3Url": "https://my-s3-ap-111122223333.s3-accesspoint.us-east-1.amazonaws.com/example?X-Amz-Security-Token=" 5 | }, 6 | "configuration": { 7 | "accessPointArn": "arn:aws:s3-object-lambda:us-east-1:111122223333:accesspoint/example-object-lambda-ap", 8 | "supportingAccessPointArn": "arn:aws:s3:us-east-1:111122223333:accesspoint/example-ap", 9 | "payload": "{}" 10 | }, 11 | "userRequest": { 12 | "url": "https://object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com/example", 13 | "headers": { 14 | "Host": "object-lambda-111122223333.s3-object-lambda.us-east-1.amazonaws.com", 15 | "Accept-Encoding": "identity", 16 | "X-Amz-Content-SHA256": "e3b0c44298fc1example" 17 | } 18 | }, 19 | "userIdentity": { 20 | "type": "IAMUser", 21 | "principalId": "principalId", 22 | "arn": "arn:aws:iam::111122223333:user/username", 23 | "accountId": "111122223333", 24 | "accessKeyId": "accessKeyId" 25 | }, 26 | "protocolVersion": "1.01" 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/fixtures/example-ses-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "eventVersion": "1.0", 5 | "ses": { 6 | "mail": { 7 | "commonHeaders": { 8 | "from": [ 9 | "Amazon Web Services " 10 | ], 11 | "to": [ 12 | "lambda@amazon.com" 13 | ], 14 | "returnPath": "aws@amazon.com", 15 | "messageId": "", 16 | "date": "Mon, 5 Dec 2016 18:40:08 -0800", 17 | "subject": "Test Subject" 18 | }, 19 | "source": "aws@amazon.com", 20 | "timestamp": "1970-01-01T00:00:00.123Z", 21 | "destination": [ 22 | "lambda@amazon.com" 23 | ], 24 | "headers": [ 25 | { 26 | "name": "Return-Path", 27 | "value": "" 28 | }, 29 | { 30 | "name": "Received", 31 | "value": "from mx.amazon.com (mx.amazon.com [127.0.0.1]) by inbound-smtp.us-east-1.amazonaws.com with SMTP id 6n4thuhcbhpfiuf25gshf70rss364fuejrvmqko1 for lambda@amazon.com; Tue, 06 Dec 2016 02:40:10 +0000 (UTC)" 32 | }, 33 | { 34 | "name": "DKIM-Signature", 35 | "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=iatn.net; s=amazon; h=mime-version:from:date:message-id:subject:to; bh=chlJxa/vZ11+0O9lf4tKDM/CcPjup2nhhdITm+hSf3c=; b=SsoNPK0wX7umtWnw8pln3YSib+E09XO99d704QdSc1TR1HxM0OTti/UaFxVD4e5b0+okBqo3rgVeWgNZ0sWZEUhBaZwSL3kTd/nHkcPexeV0XZqEgms1vmbg75F6vlz9igWflO3GbXyTRBNMM0gUXKU/686hpVW6aryEIfM/rLY=" 36 | }, 37 | { 38 | "name": "MIME-Version", 39 | "value": "1.0" 40 | }, 41 | { 42 | "name": "From", 43 | "value": "Amazon Web Services " 44 | }, 45 | { 46 | "name": "Date", 47 | "value": "Mon, 5 Dec 2016 18:40:08 -0800" 48 | }, 49 | { 50 | "name": "Message-ID", 51 | "value": "" 52 | }, 53 | { 54 | "name": "Subject", 55 | "value": "Test Subject" 56 | }, 57 | { 58 | "name": "To", 59 | "value": "lambda@amazon.com" 60 | }, 61 | { 62 | "name": "Content-Type", 63 | "value": "multipart/alternative; boundary=94eb2c0742269658b10542f452a9" 64 | } 65 | ], 66 | "headersTruncated": false, 67 | "messageId": "6n4thuhcbhpfiuf25gshf70rss364fuejrvmqko1" 68 | }, 69 | "receipt": { 70 | "recipients": [ 71 | "lambda@amazon.com" 72 | ], 73 | "timestamp": "1970-01-01T00:00:00.123Z", 74 | "spamVerdict": { 75 | "status": "PASS" 76 | }, 77 | "dkimVerdict": { 78 | "status": "PASS" 79 | }, 80 | "dmarcVerdict": { 81 | "status": "PASS" 82 | }, 83 | "dmarcPolicy": "reject", 84 | "processingTimeMillis": 574, 85 | "action": { 86 | "type": "Lambda", 87 | "invocationType": "Event", 88 | "functionArn": "arn:aws:lambda:us-east-1:000000000000:function:my-ses-lambda-function" 89 | }, 90 | "spfVerdict": { 91 | "status": "PASS" 92 | }, 93 | "virusVerdict": { 94 | "status": "PASS" 95 | } 96 | } 97 | }, 98 | "eventSource": "aws:ses" 99 | } 100 | ] 101 | } 102 | -------------------------------------------------------------------------------- /src/fixtures/example-ses-lambda-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "eventVersion": "1.0", 5 | "ses": { 6 | "mail": { 7 | "commonHeaders": { 8 | "from": [ 9 | "Amazon Web Services " 10 | ], 11 | "to": [ 12 | "lambda@amazon.com" 13 | ], 14 | "returnPath": "aws@amazon.com", 15 | "messageId": "", 16 | "date": "Mon, 5 Dec 2016 18:40:08 -0800", 17 | "subject": "Test Subject" 18 | }, 19 | "source": "aws@amazon.com", 20 | "timestamp": "1970-01-01T00:00:00.123Z", 21 | "destination": [ 22 | "lambda@amazon.com" 23 | ], 24 | "headers": [ 25 | { 26 | "name": "Return-Path", 27 | "value": "" 28 | }, 29 | { 30 | "name": "Received", 31 | "value": "from mx.amazon.com (mx.amazon.com [127.0.0.1]) by inbound-smtp.us-east-1.amazonaws.com with SMTP id 6n4thuhcbhpfiuf25gshf70rss364fuejrvmqko1 for lambda@amazon.com; Tue, 06 Dec 2016 02:40:10 +0000 (UTC)" 32 | }, 33 | { 34 | "name": "DKIM-Signature", 35 | "value": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=iatn.net; s=amazon; h=mime-version:from:date:message-id:subject:to; bh=chlJxa/vZ11+0O9lf4tKDM/CcPjup2nhhdITm+hSf3c=; b=SsoNPK0wX7umtWnw8pln3YSib+E09XO99d704QdSc1TR1HxM0OTti/UaFxVD4e5b0+okBqo3rgVeWgNZ0sWZEUhBaZwSL3kTd/nHkcPexeV0XZqEgms1vmbg75F6vlz9igWflO3GbXyTRBNMM0gUXKU/686hpVW6aryEIfM/rLY=" 36 | }, 37 | { 38 | "name": "MIME-Version", 39 | "value": "1.0" 40 | }, 41 | { 42 | "name": "From", 43 | "value": "Amazon Web Services " 44 | }, 45 | { 46 | "name": "Date", 47 | "value": "Mon, 5 Dec 2016 18:40:08 -0800" 48 | }, 49 | { 50 | "name": "Message-ID", 51 | "value": "" 52 | }, 53 | { 54 | "name": "Subject", 55 | "value": "Test Subject" 56 | }, 57 | { 58 | "name": "To", 59 | "value": "lambda@amazon.com" 60 | }, 61 | { 62 | "name": "Content-Type", 63 | "value": "multipart/alternative; boundary=94eb2c0742269658b10542f452a9" 64 | } 65 | ], 66 | "headersTruncated": false, 67 | "messageId": "6n4thuhcbhpfiuf25gshf70rss364fuejrvmqko1" 68 | }, 69 | "receipt": { 70 | "recipients": [ 71 | "lambda@amazon.com" 72 | ], 73 | "timestamp": "1970-01-01T00:00:00.123Z", 74 | "spamVerdict": { 75 | "status": "PASS" 76 | }, 77 | "dkimVerdict": { 78 | "status": "PASS" 79 | }, 80 | "dmarcVerdict": { 81 | "status": "PASS" 82 | }, 83 | "dmarcPolicy": "reject", 84 | "processingTimeMillis": 574, 85 | "action": { 86 | "type": "Lambda", 87 | "invocationType": "Event", 88 | "functionArn": "arn:aws:lambda:us-east-1:000000000000:function:my-ses-lambda-function" 89 | }, 90 | "spfVerdict": { 91 | "status": "PASS" 92 | }, 93 | "virusVerdict": { 94 | "status": "PASS" 95 | } 96 | } 97 | }, 98 | "eventSource": "aws:ses" 99 | } 100 | ] 101 | } 102 | -------------------------------------------------------------------------------- /src/fixtures/example-sns-event-obj.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "EventVersion": "1.0", 5 | "EventSubscriptionArn": "arn:aws:sns:EXAMPLE", 6 | "EventSource": "aws:sns", 7 | "Sns": { 8 | "Type" : "Notification", 9 | "MessageId" : "82833b5c-8d5d-56d0-b0e1-7511f8253eb8", 10 | "TopicArn" : "arn:aws:sns:us-east-1:246796806071:snsNetTest", 11 | "Subject" : "Greetings", 12 | "Message" : "{\"foo\":\"Hello world!\",\"bar\":123}", 13 | "Timestamp" : "2015-08-18T18:02:32.111Z", 14 | "SignatureVersion" : "1", 15 | "Signature" : "e+khMfZriwAOTkF0OVm3tmdVq9eY6s5Bj6rXZty4B2TYssx7SSSBpvsDCiDuzgeHe++MNsGLDDT+5OpGEFBqCcd/K7iXhofz+KabMEtvM2Ku3aXcFixjOCAY1BF8hH6zU6nKzOy+m7K4UIoVqIOOhqsLWoXNFWgwQseBol1pFQ/MRi9UH84/WGdU8//dH+1/zjLxCud8Lg1vY9Yi/jxMU1HVpZ2JuvzJBdNBFJWc/VYAiw8K1r/J+dxAiLr87P96MgUqyg1wWxYe00HaEXGtjIctCNcd92s3pngOOeGvPYGaTIZEbYhSf2leMYd+CXujUHRqozru5K0Zp+l99fUNTg==", 16 | "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-d6d679a1d18e95c2f9ffcf11f4f9e198.pem", 17 | "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:246796806071:snsNetTest:228cc6c9-dcd8-4c92-9f3a-77f55176b9e3" 18 | } 19 | } 20 | ] 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/fixtures/example-sns-event-pascal-case.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "EventVersion": "1.0", 5 | "EventSubscriptionArn": "arn:aws:sns:EXAMPLE", 6 | "EventSource": "aws:sns", 7 | "Sns": { 8 | "Type" : "Notification", 9 | "MessageId" : "82833b5c-8d5d-56d0-b0e1-7511f8253eb8", 10 | "TopicArn" : "arn:aws:sns:us-east-1:246796806071:snsNetTest", 11 | "Subject" : "Greetings", 12 | "Message" : "Hello\r\nworld!", 13 | "Timestamp" : "2015-08-18T18:02:32.111Z", 14 | "SignatureVersion" : "1", 15 | "Signature" : "e+khMfZriwAOTkF0OVm3tmdVq9eY6s5Bj6rXZty4B2TYssx7SSSBpvsDCiDuzgeHe++MNsGLDDT+5OpGEFBqCcd/K7iXhofz+KabMEtvM2Ku3aXcFixjOCAY1BF8hH6zU6nKzOy+m7K4UIoVqIOOhqsLWoXNFWgwQseBol1pFQ/MRi9UH84/WGdU8//dH+1/zjLxCud8Lg1vY9Yi/jxMU1HVpZ2JuvzJBdNBFJWc/VYAiw8K1r/J+dxAiLr87P96MgUqyg1wWxYe00HaEXGtjIctCNcd92s3pngOOeGvPYGaTIZEbYhSf2leMYd+CXujUHRqozru5K0Zp+l99fUNTg==", 16 | "SigningCertUrl" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-d6d679a1d18e95c2f9ffcf11f4f9e198.pem", 17 | "UnsubscribeUrl" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:246796806071:snsNetTest:228cc6c9-dcd8-4c92-9f3a-77f55176b9e3" 18 | } 19 | } 20 | ] 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/fixtures/example-sns-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "EventVersion": "1.0", 5 | "EventSubscriptionArn": "arn:aws:sns:EXAMPLE", 6 | "EventSource": "aws:sns", 7 | "Sns": { 8 | "Type" : "Notification", 9 | "MessageId" : "82833b5c-8d5d-56d0-b0e1-7511f8253eb8", 10 | "TopicArn" : "arn:aws:sns:us-east-1:246796806071:snsNetTest", 11 | "Subject" : "Greetings", 12 | "Message" : "Hello\r\nworld!", 13 | "Timestamp" : "2015-08-18T18:02:32.111Z", 14 | "SignatureVersion" : "1", 15 | "Signature" : "e+khMfZriwAOTkF0OVm3tmdVq9eY6s5Bj6rXZty4B2TYssx7SSSBpvsDCiDuzgeHe++MNsGLDDT+5OpGEFBqCcd/K7iXhofz+KabMEtvM2Ku3aXcFixjOCAY1BF8hH6zU6nKzOy+m7K4UIoVqIOOhqsLWoXNFWgwQseBol1pFQ/MRi9UH84/WGdU8//dH+1/zjLxCud8Lg1vY9Yi/jxMU1HVpZ2JuvzJBdNBFJWc/VYAiw8K1r/J+dxAiLr87P96MgUqyg1wWxYe00HaEXGtjIctCNcd92s3pngOOeGvPYGaTIZEbYhSf2leMYd+CXujUHRqozru5K0Zp+l99fUNTg==", 16 | "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-d6d679a1d18e95c2f9ffcf11f4f9e198.pem", 17 | "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:246796806071:snsNetTest:228cc6c9-dcd8-4c92-9f3a-77f55176b9e3" 18 | } 19 | } 20 | ] 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/fixtures/example-sqs-batch-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "batchItemFailures": [ 3 | { 4 | "itemIdentifier": "id2" 5 | }, 6 | { 7 | "itemIdentifier": "id4" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/fixtures/example-sqs-event-obj.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "messageId" : "MessageID_1", 5 | "receiptHandle" : "MessageReceiptHandle", 6 | "body" : "{\"a\":\"Test\",\"b\":123}", 7 | "md5OfBody" : "fce0ea8dd236ccb3ed9b37dae260836f", 8 | "md5OfMessageAttributes" : "582c92c5c5b6ac403040a4f3ab3115c9", 9 | "eventSourceARN": "arn:aws:sqs:us-west-2:123456789012:SQSQueue", 10 | "eventSource": "aws:sqs", 11 | "awsRegion": "us-west-2", 12 | "attributes" : { 13 | "ApproximateReceiveCount" : "2", 14 | "SentTimestamp" : "1520621625029", 15 | "SenderId" : "AROAIWPX5BD2BHG722MW4:sender", 16 | "ApproximateFirstReceiveTimestamp" : "1520621634884" 17 | }, 18 | "messageAttributes" : { 19 | "Attribute3" : { 20 | "binaryValue" : "MTEwMA==", 21 | "stringListValues" : ["abc", "123"], 22 | "binaryListValues" : ["MA==", "MQ==", "MA=="], 23 | "dataType" : "Binary" 24 | }, 25 | "Attribute2" : { 26 | "stringValue" : "123", 27 | "stringListValues" : [ ], 28 | "binaryListValues" : ["MQ==", "MA=="], 29 | "dataType" : "Number" 30 | }, 31 | "Attribute1" : { 32 | "stringValue" : "AttributeValue1", 33 | "stringListValues" : [ ], 34 | "binaryListValues" : [ ], 35 | "dataType" : "String" 36 | } 37 | } 38 | } 39 | ] 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/fixtures/example-sqs-event.json: -------------------------------------------------------------------------------- 1 | { 2 | "Records": [ 3 | { 4 | "messageId" : "MessageID_1", 5 | "receiptHandle" : "MessageReceiptHandle", 6 | "body" : "Message Body", 7 | "md5OfBody" : "fce0ea8dd236ccb3ed9b37dae260836f", 8 | "md5OfMessageAttributes" : "582c92c5c5b6ac403040a4f3ab3115c9", 9 | "eventSourceARN": "arn:aws:sqs:us-west-2:123456789012:SQSQueue", 10 | "eventSource": "aws:sqs", 11 | "awsRegion": "us-west-2", 12 | "attributes" : { 13 | "ApproximateReceiveCount" : "2", 14 | "SentTimestamp" : "1520621625029", 15 | "SenderId" : "AROAIWPX5BD2BHG722MW4:sender", 16 | "ApproximateFirstReceiveTimestamp" : "1520621634884" 17 | }, 18 | "messageAttributes" : { 19 | "Attribute3" : { 20 | "binaryValue" : "MTEwMA==", 21 | "stringListValues" : ["abc", "123"], 22 | "binaryListValues" : ["MA==", "MQ==", "MA=="], 23 | "dataType" : "Binary" 24 | }, 25 | "Attribute2" : { 26 | "stringValue" : "123", 27 | "stringListValues" : [ ], 28 | "binaryListValues" : ["MQ==", "MA=="], 29 | "dataType" : "Number" 30 | }, 31 | "Attribute1" : { 32 | "stringValue" : "AttributeValue1", 33 | "stringListValues" : [ ], 34 | "binaryListValues" : [ ], 35 | "dataType" : "String" 36 | } 37 | } 38 | } 39 | ] 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/generated/README.md: -------------------------------------------------------------------------------- 1 | # AWS lambda event types. 2 | 3 | These types are automatically generated from the 4 | [official Go SDK](https://github.com/aws/aws-lambda-go/tree/master/events). 5 | 6 | Generated from commit [0d45ea2853e8fa138a242336f40eadf5f66fe947](https://github.com/aws/aws-lambda-go/commit/0d45ea2853e8fa138a242336f40eadf5f66fe947). 7 | -------------------------------------------------------------------------------- /src/generated/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/iam/mod.rs: -------------------------------------------------------------------------------- 1 | /// `IamPolicyDocument` represents an IAM policy document. 2 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 3 | #[serde(rename_all = "camelCase")] 4 | pub struct IamPolicyDocument { 5 | #[serde(default)] 6 | #[serde(rename = "Version")] 7 | pub version: Option, 8 | #[serde(rename = "Statement")] 9 | pub statement: Vec, 10 | } 11 | 12 | /// `IamPolicyStatement` represents one statement from IAM policy with action, effect and resource. 13 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 14 | #[serde(rename_all = "camelCase")] 15 | pub struct IamPolicyStatement { 16 | #[serde(rename = "Action")] 17 | pub action: Vec, 18 | #[serde(default)] 19 | #[serde(rename = "Effect")] 20 | pub effect: Option, 21 | #[serde(rename = "Resource")] 22 | pub resource: Vec, 23 | } 24 | -------------------------------------------------------------------------------- /src/iot/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::custom_serde::*; 2 | use crate::encodings::Base64Data; 3 | use crate::iam::IamPolicyDocument; 4 | use http::HeaderMap; 5 | 6 | /// `IoTCoreCustomAuthorizerRequest` represents the request to an IoT Core custom authorizer. 7 | /// See https://docs.aws.amazon.com/iot/latest/developerguide/config-custom-auth.html 8 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 9 | #[serde(rename_all = "camelCase")] 10 | pub struct IoTCoreCustomAuthorizerRequest { 11 | #[serde(default)] 12 | pub token: Option, 13 | pub signature_verified: bool, 14 | pub protocols: Vec, 15 | pub protocol_data: Option, 16 | pub connection_metadata: Option, 17 | } 18 | 19 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 20 | #[serde(rename_all = "camelCase")] 21 | pub struct IoTCoreProtocolData { 22 | pub tls: Option, 23 | pub http: Option, 24 | pub mqtt: Option, 25 | } 26 | 27 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 28 | #[serde(rename_all = "camelCase")] 29 | pub struct IoTCoreTlsContext { 30 | #[serde(default)] 31 | pub server_name: Option, 32 | } 33 | 34 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 35 | #[serde(rename_all = "camelCase")] 36 | pub struct IoTCoreHttpContext { 37 | #[serde(deserialize_with = "http_serde::header_map::deserialize", default)] 38 | #[serde(serialize_with = "serialize_headers")] 39 | pub headers: HeaderMap, 40 | #[serde(default)] 41 | pub query_string: Option, 42 | } 43 | 44 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 45 | #[serde(rename_all = "camelCase")] 46 | pub struct IoTCoreMqttContext { 47 | #[serde(default)] 48 | pub client_id: Option, 49 | pub password: Base64Data, 50 | #[serde(default)] 51 | pub username: Option, 52 | } 53 | 54 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 55 | #[serde(rename_all = "camelCase")] 56 | pub struct IoTCoreConnectionMetadata { 57 | #[serde(default)] 58 | pub id: Option, 59 | } 60 | 61 | /// `IoTCoreCustomAuthorizerResponse` represents the response from an IoT Core custom authorizer. 62 | /// See https://docs.aws.amazon.com/iot/latest/developerguide/config-custom-auth.html 63 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 64 | #[serde(rename_all = "camelCase")] 65 | pub struct IoTCoreCustomAuthorizerResponse { 66 | pub is_authenticated: bool, 67 | #[serde(default)] 68 | pub principal_id: Option, 69 | pub disconnect_after_in_seconds: u32, 70 | pub refresh_after_in_seconds: u32, 71 | pub policy_documents: Vec>, 72 | } 73 | 74 | #[cfg(test)] 75 | mod test { 76 | use super::*; 77 | 78 | extern crate serde_json; 79 | 80 | #[test] 81 | #[cfg(feature = "iot")] 82 | fn example_iot_custom_auth_request() { 83 | let data = include_bytes!("../fixtures/example-iot-custom-auth-request.json"); 84 | let parsed: IoTCoreCustomAuthorizerRequest = serde_json::from_slice(data).unwrap(); 85 | let output: String = serde_json::to_string(&parsed).unwrap(); 86 | let reparsed: IoTCoreCustomAuthorizerRequest = 87 | serde_json::from_slice(output.as_bytes()).unwrap(); 88 | assert_eq!(parsed, reparsed); 89 | } 90 | 91 | #[test] 92 | #[cfg(feature = "iot")] 93 | fn example_iot_custom_auth_response() { 94 | let data = include_bytes!("../fixtures/example-iot-custom-auth-response.json"); 95 | let parsed: IoTCoreCustomAuthorizerResponse = serde_json::from_slice(data).unwrap(); 96 | let output: String = serde_json::to_string(&parsed).unwrap(); 97 | let reparsed: IoTCoreCustomAuthorizerResponse = 98 | serde_json::from_slice(output.as_bytes()).unwrap(); 99 | assert_eq!(parsed, reparsed); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/iot_1_click/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::custom_serde::*; 2 | use std::collections::HashMap; 3 | 4 | /// `IoTOneClickEvent` represents a click event published by clicking button type 5 | /// device. 6 | #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] 7 | #[serde(rename_all = "camelCase")] 8 | pub struct IoTOneClickEvent { 9 | pub device_event: IoTOneClickDeviceEvent, 10 | pub device_info: IoTOneClickDeviceInfo, 11 | pub placement_info: IoTOneClickPlacementInfo, 12 | } 13 | 14 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct IoTOneClickDeviceEvent { 17 | pub button_clicked: IoTOneClickButtonClicked, 18 | } 19 | 20 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 21 | #[serde(rename_all = "camelCase")] 22 | pub struct IoTOneClickButtonClicked { 23 | #[serde(default)] 24 | pub click_type: Option, 25 | #[serde(default)] 26 | pub reported_time: Option, 27 | } 28 | 29 | #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] 30 | #[serde(rename_all = "camelCase")] 31 | pub struct IoTOneClickDeviceInfo { 32 | #[serde(deserialize_with = "deserialize_lambda_map")] 33 | #[serde(default)] 34 | pub attributes: HashMap, 35 | #[serde(default)] 36 | pub type_: Option, 37 | #[serde(default)] 38 | pub device_id: Option, 39 | pub remaining_life: f64, 40 | } 41 | 42 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 43 | #[serde(rename_all = "camelCase")] 44 | pub struct IoTOneClickPlacementInfo { 45 | #[serde(default)] 46 | pub project_name: Option, 47 | #[serde(default)] 48 | pub placement_name: Option, 49 | #[serde(deserialize_with = "deserialize_lambda_map")] 50 | #[serde(default)] 51 | pub attributes: HashMap, 52 | #[serde(deserialize_with = "deserialize_lambda_map")] 53 | #[serde(default)] 54 | pub devices: HashMap, 55 | } 56 | 57 | #[cfg(test)] 58 | mod test { 59 | use super::*; 60 | 61 | extern crate serde_json; 62 | 63 | #[test] 64 | #[cfg(feature = "iot_1_click")] 65 | fn example_iot_1_click_event() { 66 | let data = include_bytes!("../fixtures/example-iot_1_click-event.json"); 67 | let parsed: IoTOneClickEvent = serde_json::from_slice(data).unwrap(); 68 | let output: String = serde_json::to_string(&parsed).unwrap(); 69 | let reparsed: IoTOneClickEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 70 | assert_eq!(parsed, reparsed); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/iot_button/mod.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 2 | #[serde(rename_all = "camelCase")] 3 | pub struct IoTButtonEvent { 4 | #[serde(default)] 5 | pub serial_number: Option, 6 | #[serde(default)] 7 | pub click_type: Option, 8 | #[serde(default)] 9 | pub battery_voltage: Option, 10 | } 11 | 12 | #[cfg(test)] 13 | mod test { 14 | use super::*; 15 | 16 | extern crate serde_json; 17 | 18 | #[test] 19 | #[cfg(feature = "iot_button")] 20 | fn example_iot_button_event() { 21 | let data = include_bytes!("../fixtures/example-iot_button-event.json"); 22 | let parsed: IoTButtonEvent = serde_json::from_slice(data).unwrap(); 23 | let output: String = serde_json::to_string(&parsed).unwrap(); 24 | let reparsed: IoTButtonEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 25 | assert_eq!(parsed, reparsed); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/iot_deprecated/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::iot::*; 2 | 3 | /// `IoTCustomAuthorizerRequest` contains data coming in to a custom IoT device gateway authorizer function. 4 | /// Deprecated: Use IoTCoreCustomAuthorizerRequest instead. `IoTCustomAuthorizerRequest` does not correctly model the request schema 5 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 6 | #[serde(rename_all = "camelCase")] 7 | pub struct IoTCustomAuthorizerRequest { 8 | pub http_context: Option, 9 | pub mqtt_context: Option, 10 | pub tls_context: Option, 11 | #[serde(default)] 12 | #[serde(rename = "token")] 13 | pub authorization_token: Option, 14 | #[serde(default)] 15 | pub token_signature: Option, 16 | } 17 | 18 | pub type IoTHttpContext = IoTCoreHttpContext; 19 | 20 | pub type IoTMqttContext = IoTCoreMqttContext; 21 | 22 | pub type IoTTlsContext = IoTCoreTlsContext; 23 | 24 | /// `IoTCustomAuthorizerResponse` represents the expected format of an IoT device gateway authorization response. 25 | /// Deprecated: Use IoTCoreCustomAuthorizerResponse. `IoTCustomAuthorizerResponse` does not correctly model the response schema. 26 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 27 | #[serde(rename_all = "camelCase")] 28 | pub struct IoTCustomAuthorizerResponse { 29 | pub is_authenticated: bool, 30 | #[serde(default)] 31 | pub principal_id: Option, 32 | pub disconnect_after_in_seconds: i32, 33 | pub refresh_after_in_seconds: i32, 34 | pub policy_documents: Vec, 35 | } 36 | -------------------------------------------------------------------------------- /src/kafka/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::custom_serde::*; 2 | use crate::encodings::MillisecondTimestamp; 3 | use std::collections::HashMap; 4 | 5 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 6 | #[serde(rename_all = "camelCase")] 7 | pub struct KafkaEvent { 8 | #[serde(default)] 9 | pub event_source: Option, 10 | #[serde(default)] 11 | pub event_source_arn: Option, 12 | #[serde(deserialize_with = "deserialize_lambda_map")] 13 | #[serde(default)] 14 | pub records: HashMap>, 15 | #[serde(default)] 16 | pub bootstrap_servers: Option, 17 | } 18 | 19 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 20 | #[serde(rename_all = "camelCase")] 21 | pub struct KafkaRecord { 22 | #[serde(default)] 23 | pub topic: Option, 24 | pub partition: i64, 25 | pub offset: i64, 26 | pub timestamp: MillisecondTimestamp, 27 | #[serde(default)] 28 | pub timestamp_type: Option, 29 | pub key: Option, 30 | pub value: Option, 31 | pub headers: Vec>>, 32 | } 33 | 34 | #[cfg(test)] 35 | mod test { 36 | use super::*; 37 | 38 | extern crate serde_json; 39 | 40 | #[test] 41 | #[cfg(feature = "kafka")] 42 | fn example_kafka_event() { 43 | let data = include_bytes!("../fixtures/example-kafka-event.json"); 44 | let parsed: KafkaEvent = serde_json::from_slice(data).unwrap(); 45 | let output: String = serde_json::to_string(&parsed).unwrap(); 46 | let reparsed: KafkaEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 47 | assert_eq!(parsed, reparsed); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/kinesis/analytics.rs: -------------------------------------------------------------------------------- 1 | use crate::encodings::Base64Data; 2 | 3 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 4 | #[serde(rename_all = "camelCase")] 5 | pub struct KinesisAnalyticsOutputDeliveryEvent { 6 | #[serde(default)] 7 | pub invocation_id: Option, 8 | #[serde(default)] 9 | pub application_arn: Option, 10 | pub records: Vec, 11 | } 12 | 13 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 14 | #[serde(rename_all = "camelCase")] 15 | pub struct KinesisAnalyticsOutputDeliveryEventRecord { 16 | #[serde(default)] 17 | pub record_id: Option, 18 | pub data: Base64Data, 19 | } 20 | 21 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 22 | #[serde(rename_all = "camelCase")] 23 | pub struct KinesisAnalyticsOutputDeliveryResponse { 24 | pub records: Vec, 25 | } 26 | 27 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 28 | #[serde(rename_all = "camelCase")] 29 | pub struct KinesisAnalyticsOutputDeliveryResponseRecord { 30 | #[serde(default)] 31 | pub record_id: Option, 32 | /// possible values include Ok and DeliveryFailed 33 | #[serde(default)] 34 | pub result: Option, 35 | } 36 | -------------------------------------------------------------------------------- /src/kinesis/event.rs: -------------------------------------------------------------------------------- 1 | use crate::encodings::{Base64Data, SecondTimestamp}; 2 | use crate::time_window::{TimeWindowEventResponseProperties, TimeWindowProperties}; 3 | 4 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct KinesisEvent { 7 | #[serde(rename = "Records")] 8 | pub records: Vec, 9 | } 10 | 11 | /// `KinesisTimeWindowEvent` represents an Amazon Dynamodb event when using time windows 12 | /// ref. https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows 13 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] 14 | #[serde(rename_all = "camelCase")] 15 | pub struct KinesisTimeWindowEvent { 16 | #[serde(rename = "KinesisEvent")] 17 | #[serde(flatten)] 18 | pub kinesis_event: KinesisEvent, 19 | #[serde(rename = "TimeWindowProperties")] 20 | #[serde(flatten)] 21 | pub time_window_properties: TimeWindowProperties, 22 | } 23 | 24 | /// `KinesisTimeWindowEventResponse` is the outer structure to report batch item failures for KinesisTimeWindowEvent. 25 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 26 | #[serde(rename_all = "camelCase")] 27 | pub struct KinesisTimeWindowEventResponse { 28 | #[serde(rename = "TimeWindowEventResponseProperties")] 29 | #[serde(flatten)] 30 | pub time_window_event_response_properties: TimeWindowEventResponseProperties, 31 | // pub batch_item_failures: Vec, 32 | } 33 | 34 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] 35 | #[serde(rename_all = "camelCase")] 36 | pub struct KinesisEventRecord { 37 | /// nolint: stylecheck 38 | #[serde(default)] 39 | pub aws_region: Option, 40 | #[serde(default)] 41 | #[serde(rename = "eventID")] 42 | pub event_id: Option, 43 | #[serde(default)] 44 | pub event_name: Option, 45 | #[serde(default)] 46 | pub event_source: Option, 47 | /// nolint: stylecheck 48 | #[serde(default)] 49 | #[serde(rename = "eventSourceARN")] 50 | pub event_source_arn: Option, 51 | #[serde(default)] 52 | pub event_version: Option, 53 | /// nolint: stylecheck 54 | #[serde(default)] 55 | pub invoke_identity_arn: Option, 56 | pub kinesis: KinesisRecord, 57 | } 58 | 59 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] 60 | #[serde(rename_all = "camelCase")] 61 | pub struct KinesisRecord { 62 | pub approximate_arrival_timestamp: SecondTimestamp, 63 | pub data: Base64Data, 64 | pub encryption_type: Option, 65 | #[serde(default)] 66 | pub partition_key: Option, 67 | #[serde(default)] 68 | pub sequence_number: Option, 69 | #[serde(default)] 70 | pub kinesis_schema_version: Option, 71 | } 72 | 73 | #[cfg(test)] 74 | mod test { 75 | use super::*; 76 | 77 | extern crate serde_json; 78 | 79 | #[test] 80 | #[cfg(feature = "kinesis")] 81 | fn example_kinesis_event() { 82 | let data = include_bytes!("../fixtures/example-kinesis-event.json"); 83 | let parsed: KinesisEvent = serde_json::from_slice(data).unwrap(); 84 | let output: String = serde_json::to_string(&parsed).unwrap(); 85 | let reparsed: KinesisEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 86 | assert_eq!(parsed, reparsed); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/kinesis/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod analytics; 2 | mod event; 3 | pub use self::event::*; 4 | -------------------------------------------------------------------------------- /src/rabbitmq/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::custom_serde::*; 2 | use serde::de::DeserializeOwned; 3 | use serde::ser::Serialize; 4 | use serde_json::Value; 5 | use std::collections::HashMap; 6 | 7 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 8 | #[serde(rename_all = "camelCase")] 9 | pub struct RabbitMqEvent { 10 | #[serde(default)] 11 | pub event_source: Option, 12 | #[serde(default)] 13 | pub event_source_arn: Option, 14 | #[serde(deserialize_with = "deserialize_lambda_map")] 15 | #[serde(default)] 16 | #[serde(rename = "rmqMessagesByQueue")] 17 | pub messages_by_queue: HashMap>, 18 | } 19 | 20 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 21 | #[serde(rename_all = "camelCase")] 22 | pub struct RabbitMqMessage { 23 | pub basic_properties: RabbitMqBasicProperties, 24 | #[serde(default)] 25 | pub data: Option, 26 | pub redelivered: bool, 27 | } 28 | 29 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 30 | #[serde(rename_all = "camelCase")] 31 | pub struct RabbitMqBasicProperties 32 | where 33 | T1: DeserializeOwned, 34 | T1: Serialize, 35 | { 36 | #[serde(default)] 37 | pub content_type: Option, 38 | pub content_encoding: Option, 39 | /// Application or header exchange table 40 | #[serde(deserialize_with = "deserialize_lambda_map")] 41 | #[serde(default)] 42 | #[serde(bound = "")] 43 | pub headers: HashMap, 44 | pub delivery_mode: u8, 45 | pub priority: u8, 46 | pub correlation_id: Option, 47 | pub reply_to: Option, 48 | #[serde(default)] 49 | pub expiration: Option, 50 | pub message_id: Option, 51 | #[serde(default)] 52 | pub timestamp: Option, 53 | pub type_: Option, 54 | #[serde(default)] 55 | pub user_id: Option, 56 | pub app_id: Option, 57 | pub cluster_id: Option, 58 | pub body_size: u64, 59 | } 60 | 61 | #[cfg(test)] 62 | mod test { 63 | use super::*; 64 | 65 | extern crate serde_json; 66 | 67 | #[test] 68 | #[cfg(feature = "rabbitmq")] 69 | fn example_rabbitmq_event() { 70 | let data = include_bytes!("../fixtures/example-rabbitmq-event.json"); 71 | let parsed: RabbitMqEvent = serde_json::from_slice(data).unwrap(); 72 | let output: String = serde_json::to_string(&parsed).unwrap(); 73 | let reparsed: RabbitMqEvent = serde_json::from_slice(output.as_bytes()).unwrap(); 74 | assert_eq!(parsed, reparsed); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/s3/batch_job.rs: -------------------------------------------------------------------------------- 1 | /// `S3BatchJobEvent` encapsulates the detail of a s3 batch job 2 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 3 | #[serde(rename_all = "camelCase")] 4 | pub struct S3BatchJobEvent { 5 | #[serde(default)] 6 | pub invocation_schema_version: Option, 7 | #[serde(default)] 8 | pub invocation_id: Option, 9 | pub job: S3BatchJob, 10 | pub tasks: Vec, 11 | } 12 | 13 | /// `S3BatchJob` whichs have the job id 14 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct S3BatchJob { 17 | #[serde(default)] 18 | pub id: Option, 19 | } 20 | 21 | /// `S3BatchJobTask` represents one task in the s3 batch job and have all task details 22 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 23 | #[serde(rename_all = "camelCase")] 24 | pub struct S3BatchJobTask { 25 | #[serde(default)] 26 | pub task_id: Option, 27 | #[serde(default)] 28 | pub s3_key: Option, 29 | #[serde(default)] 30 | pub s3_version_id: Option, 31 | #[serde(default)] 32 | pub s3_bucket_arn: Option, 33 | } 34 | 35 | /// `S3BatchJobResponse` is the response of a iven s3 batch job with the results 36 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 37 | #[serde(rename_all = "camelCase")] 38 | pub struct S3BatchJobResponse { 39 | #[serde(default)] 40 | pub invocation_schema_version: Option, 41 | #[serde(default)] 42 | pub treat_missing_keys_as: Option, 43 | #[serde(default)] 44 | pub invocation_id: Option, 45 | pub results: Vec, 46 | } 47 | 48 | /// `S3BatchJobResult` represents the result of a given task 49 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 50 | #[serde(rename_all = "camelCase")] 51 | pub struct S3BatchJobResult { 52 | #[serde(default)] 53 | pub task_id: Option, 54 | #[serde(default)] 55 | pub result_code: Option, 56 | #[serde(default)] 57 | pub result_string: Option, 58 | } 59 | -------------------------------------------------------------------------------- /src/s3/event.rs: -------------------------------------------------------------------------------- 1 | use crate::custom_serde::*; 2 | use chrono::{DateTime, Utc}; 3 | use std::collections::HashMap; 4 | 5 | /// `S3Event` which wrap an array of `S3Event`Record 6 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 7 | #[serde(rename_all = "camelCase")] 8 | pub struct S3Event { 9 | #[serde(rename = "Records")] 10 | pub records: Vec, 11 | } 12 | 13 | /// `S3EventRecord` which wrap record data 14 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] 15 | #[serde(rename_all = "camelCase")] 16 | pub struct S3EventRecord { 17 | #[serde(default)] 18 | pub event_version: Option, 19 | #[serde(default)] 20 | pub event_source: Option, 21 | #[serde(default)] 22 | pub aws_region: Option, 23 | pub event_time: DateTime, 24 | #[serde(default)] 25 | pub event_name: Option, 26 | #[serde(rename = "userIdentity")] 27 | pub principal_id: S3UserIdentity, 28 | pub request_parameters: S3RequestParameters, 29 | #[serde(deserialize_with = "deserialize_lambda_map")] 30 | #[serde(default)] 31 | pub response_elements: HashMap, 32 | pub s3: S3Entity, 33 | } 34 | 35 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 36 | #[serde(rename_all = "camelCase")] 37 | pub struct S3UserIdentity { 38 | #[serde(default)] 39 | pub principal_id: Option, 40 | } 41 | 42 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 43 | #[serde(rename_all = "camelCase")] 44 | pub struct S3RequestParameters { 45 | #[serde(default)] 46 | #[serde(rename = "sourceIPAddress")] 47 | pub source_ip_address: Option, 48 | } 49 | 50 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 51 | #[serde(rename_all = "camelCase")] 52 | pub struct S3Entity { 53 | #[serde(default)] 54 | #[serde(rename = "s3SchemaVersion")] 55 | pub schema_version: Option, 56 | #[serde(default)] 57 | pub configuration_id: Option, 58 | pub bucket: S3Bucket, 59 | pub object: S3Object, 60 | } 61 | 62 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 63 | #[serde(rename_all = "camelCase")] 64 | pub struct S3Bucket { 65 | #[serde(default)] 66 | pub name: Option, 67 | #[serde(default)] 68 | pub owner_identity: Option, 69 | #[serde(default)] 70 | pub arn: Option, 71 | } 72 | 73 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 74 | #[serde(rename_all = "camelCase")] 75 | pub struct S3Object { 76 | #[serde(default)] 77 | pub key: Option, 78 | pub size: Option, 79 | #[serde(default)] 80 | pub url_decoded_key: Option, 81 | #[serde(default)] 82 | pub version_id: Option, 83 | #[serde(default)] 84 | pub e_tag: Option, 85 | #[serde(default)] 86 | pub sequencer: Option, 87 | } 88 | 89 | #[cfg(test)] 90 | mod test { 91 | use super::*; 92 | 93 | extern crate serde_json; 94 | 95 | #[test] 96 | #[cfg(feature = "s3")] 97 | fn example_s3_event() { 98 | let data = include_bytes!("../fixtures/example-s3-event.json"); 99 | let parsed: S3Event = serde_json::from_slice(data).unwrap(); 100 | let output: String = serde_json::to_string(&parsed).unwrap(); 101 | let reparsed: S3Event = serde_json::from_slice(output.as_bytes()).unwrap(); 102 | assert_eq!(parsed, reparsed); 103 | } 104 | 105 | #[test] 106 | #[cfg(feature = "s3")] 107 | fn example_s3_event_with_decoded() { 108 | let data = include_bytes!("../fixtures/example-s3-event-with-decoded.json"); 109 | let parsed: S3Event = serde_json::from_slice(data).unwrap(); 110 | let output: String = serde_json::to_string(&parsed).unwrap(); 111 | let reparsed: S3Event = serde_json::from_slice(output.as_bytes()).unwrap(); 112 | assert_eq!(parsed, reparsed); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/s3/mod.rs: -------------------------------------------------------------------------------- 1 | mod event; 2 | pub use self::event::*; 3 | 4 | pub mod batch_job; 5 | pub mod object_lambda; 6 | -------------------------------------------------------------------------------- /src/streams/mod.rs: -------------------------------------------------------------------------------- 1 | /// `KinesisEventResponse` is the outer structure to report batch item failures for KinesisEvent. 2 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 3 | #[serde(rename_all = "camelCase")] 4 | pub struct KinesisEventResponse { 5 | pub batch_item_failures: Vec, 6 | } 7 | 8 | /// `KinesisBatchItemFailure` is the individual record which failed processing. 9 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 10 | #[serde(rename_all = "camelCase")] 11 | pub struct KinesisBatchItemFailure { 12 | #[serde(default)] 13 | pub item_identifier: Option, 14 | } 15 | 16 | /// `DynamoDbEventResponse` is the outer structure to report batch item failures for DynamoDBEvent. 17 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 18 | #[serde(rename_all = "camelCase")] 19 | pub struct DynamoDbEventResponse { 20 | pub batch_item_failures: Vec, 21 | } 22 | 23 | /// `DynamoDbBatchItemFailure` is the individual record which failed processing. 24 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 25 | #[serde(rename_all = "camelCase")] 26 | pub struct DynamoDbBatchItemFailure { 27 | #[serde(default)] 28 | pub item_identifier: Option, 29 | } 30 | 31 | /// `SqsEventResponse` is the outer structure to report batch item failures for SQSEvent. 32 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 33 | #[serde(rename_all = "camelCase")] 34 | pub struct SqsEventResponse { 35 | pub batch_item_failures: Vec, 36 | } 37 | 38 | /// `SqsBatchItemFailure` is the individual record which failed processing. 39 | #[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)] 40 | #[serde(rename_all = "camelCase")] 41 | pub struct SqsBatchItemFailure { 42 | #[serde(default)] 43 | pub item_identifier: Option, 44 | } 45 | -------------------------------------------------------------------------------- /src/time_window.rs: -------------------------------------------------------------------------------- 1 | use chrono::{DateTime, Utc}; 2 | use std::collections::HashMap; 3 | 4 | use crate::custom_serde::deserialize_lambda_map; 5 | 6 | /// `Window` is the object that captures the time window for the records in the event when using the tumbling windows feature 7 | /// Kinesis: https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows 8 | /// DDB: https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows 9 | #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] 10 | #[serde(rename_all = "camelCase")] 11 | pub struct Window { 12 | pub start: DateTime, 13 | pub end: DateTime, 14 | } 15 | 16 | impl Default for Window { 17 | fn default() -> Self { 18 | Window { 19 | start: Utc::now(), 20 | end: Utc::now(), 21 | } 22 | } 23 | } 24 | 25 | /// `TimeWindowProperties` is the object that captures properties that relate to the tumbling windows feature 26 | /// Kinesis: https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows 27 | /// DDB: https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows 28 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 29 | #[serde(rename_all = "camelCase")] 30 | pub struct TimeWindowProperties { 31 | /// Time window for the records in the event. 32 | pub window: Window, 33 | /// State being built up to this invoke in the time window. 34 | #[serde(deserialize_with = "deserialize_lambda_map")] 35 | #[serde(default)] 36 | pub state: HashMap, 37 | /// Shard id of the records 38 | #[serde(default)] 39 | pub shard_id: Option, 40 | /// The event source ARN of the service that generated the event (eg. DynamoDB or Kinesis) 41 | #[serde(default)] 42 | #[serde(rename = "eventSourceARN")] 43 | pub event_source_arn: Option, 44 | /// Set to true for the last invoke of the time window. 45 | /// Subsequent invoke will start a new time window along with a fresh state. 46 | pub is_final_invoke_for_window: bool, 47 | /// Set to true if window is terminated prematurely. 48 | /// Subsequent invoke will continue the same window with a fresh state. 49 | pub is_window_terminated_early: bool, 50 | } 51 | 52 | /// `TimeWindowEventResponseProperties` is the object that captures response properties that relate to the tumbling windows feature 53 | /// Kinesis: https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html#services-kinesis-windows 54 | /// DDB: https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows 55 | #[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] 56 | #[serde(rename_all = "camelCase")] 57 | pub struct TimeWindowEventResponseProperties { 58 | /// State being built up to this invoke in the time window. 59 | #[serde(deserialize_with = "deserialize_lambda_map")] 60 | #[serde(default)] 61 | pub state: HashMap, 62 | } 63 | 64 | #[cfg(test)] 65 | mod test { 66 | use super::*; 67 | 68 | extern crate serde_json; 69 | 70 | #[test] 71 | fn test_window_deserializer() { 72 | let v = serde_json::json!({ 73 | "start": "2020-12-09T07:04:00Z", 74 | "end": "2020-12-09T07:06:00Z", 75 | }); 76 | 77 | let parsed: Window = serde_json::from_value(v).unwrap(); 78 | assert_eq!("2020-12-09T07:04:00+00:00", &parsed.start.to_rfc3339()); 79 | assert_eq!("2020-12-09T07:06:00+00:00", &parsed.end.to_rfc3339()); 80 | } 81 | } 82 | --------------------------------------------------------------------------------