├── .github
├── PULL_REQUEST_TEMPLATE.md
├── dependabot.yml
└── workflows
│ ├── aws-lambda-java-core.yml
│ ├── aws-lambda-java-events-sdk-transformer.yml
│ ├── aws-lambda-java-events.yml
│ ├── aws-lambda-java-log4j2.yml
│ ├── aws-lambda-java-profiler.yml
│ ├── aws-lambda-java-serialization.yml
│ ├── aws-lambda-java-tests.yml
│ ├── repo-sync.yml
│ ├── runtime-interface-client_merge_to_main.yml
│ ├── runtime-interface-client_pr.yml
│ └── samples.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── aws-lambda-java-core
├── RELEASE.CHANGELOG.md
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── amazonaws
│ └── services
│ └── lambda
│ └── runtime
│ ├── Client.java
│ ├── ClientContext.java
│ ├── CognitoIdentity.java
│ ├── Context.java
│ ├── CustomPojoSerializer.java
│ ├── LambdaLogger.java
│ ├── LambdaRuntime.java
│ ├── LambdaRuntimeInternal.java
│ ├── RequestHandler.java
│ ├── RequestStreamHandler.java
│ └── logging
│ ├── LogFormat.java
│ └── LogLevel.java
├── aws-lambda-java-events-sdk-transformer
├── README.md
├── RELEASE.CHANGELOG.md
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── amazonaws
│ │ └── services
│ │ └── lambda
│ │ └── runtime
│ │ └── events
│ │ └── transformers
│ │ ├── v1
│ │ ├── DynamodbEventTransformer.java
│ │ └── dynamodb
│ │ │ ├── DynamodbAttributeValueTransformer.java
│ │ │ ├── DynamodbIdentityTransformer.java
│ │ │ ├── DynamodbRecordTransformer.java
│ │ │ └── DynamodbStreamRecordTransformer.java
│ │ └── v2
│ │ ├── DynamodbEventTransformer.java
│ │ └── dynamodb
│ │ ├── DynamodbAttributeValueTransformer.java
│ │ ├── DynamodbIdentityTransformer.java
│ │ ├── DynamodbRecordTransformer.java
│ │ └── DynamodbStreamRecordTransformer.java
│ └── test
│ └── java
│ └── com
│ └── amazonaws
│ └── services
│ └── lambda
│ └── runtime
│ └── events
│ └── transformers
│ ├── v1
│ ├── DynamodbEventTransformerTest.java
│ └── dynamodb
│ │ ├── DynamodbAttributeValueTransformerTest.java
│ │ ├── DynamodbIdentityTransformerTest.java
│ │ ├── DynamodbRecordTransformerTest.java
│ │ └── DynamodbStreamRecordTransformerTest.java
│ └── v2
│ ├── DynamodbEventTransformerTest.java
│ └── dynamodb
│ ├── DynamodbAttributeValueTransformerTest.java
│ ├── DynamodbIdentityTransformerTest.java
│ ├── DynamodbRecordTransformerTest.java
│ └── DynamodbStreamRecordTransformerTest.java
├── aws-lambda-java-events
├── README.md
├── RELEASE.CHANGELOG.md
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ ├── com
│ │ └── amazonaws
│ │ │ └── services
│ │ │ └── lambda
│ │ │ └── runtime
│ │ │ └── events
│ │ │ ├── APIGatewayCustomAuthorizerEvent.java
│ │ │ ├── APIGatewayProxyRequestEvent.java
│ │ │ ├── APIGatewayProxyResponseEvent.java
│ │ │ ├── APIGatewayV2CustomAuthorizerEvent.java
│ │ │ ├── APIGatewayV2HTTPEvent.java
│ │ │ ├── APIGatewayV2HTTPResponse.java
│ │ │ ├── APIGatewayV2ProxyRequestEvent.java
│ │ │ ├── APIGatewayV2ProxyResponseEvent.java
│ │ │ ├── APIGatewayV2WebSocketEvent.java
│ │ │ ├── APIGatewayV2WebSocketResponse.java
│ │ │ ├── ActiveMQEvent.java
│ │ │ ├── AppSyncLambdaAuthorizerEvent.java
│ │ │ ├── AppSyncLambdaAuthorizerResponse.java
│ │ │ ├── ApplicationLoadBalancerRequestEvent.java
│ │ │ ├── ApplicationLoadBalancerResponseEvent.java
│ │ │ ├── CloudFormationCustomResourceEvent.java
│ │ │ ├── CloudFrontEvent.java
│ │ │ ├── CloudWatchCompositeAlarmEvent.java
│ │ │ ├── CloudWatchLogsEvent.java
│ │ │ ├── CloudWatchMetricAlarmEvent.java
│ │ │ ├── CodeCommitEvent.java
│ │ │ ├── CognitoEvent.java
│ │ │ ├── CognitoUserPoolCreateAuthChallengeEvent.java
│ │ │ ├── CognitoUserPoolCustomMessageEvent.java
│ │ │ ├── CognitoUserPoolDefineAuthChallengeEvent.java
│ │ │ ├── CognitoUserPoolEvent.java
│ │ │ ├── CognitoUserPoolMigrateUserEvent.java
│ │ │ ├── CognitoUserPoolPostAuthenticationEvent.java
│ │ │ ├── CognitoUserPoolPostConfirmationEvent.java
│ │ │ ├── CognitoUserPoolPreAuthenticationEvent.java
│ │ │ ├── CognitoUserPoolPreSignUpEvent.java
│ │ │ ├── CognitoUserPoolPreTokenGenerationEvent.java
│ │ │ ├── CognitoUserPoolPreTokenGenerationEventV2.java
│ │ │ ├── CognitoUserPoolVerifyAuthChallengeResponseEvent.java
│ │ │ ├── ConfigEvent.java
│ │ │ ├── ConnectEvent.java
│ │ │ ├── DynamodbEvent.java
│ │ │ ├── DynamodbTimeWindowEvent.java
│ │ │ ├── IamPolicyResponse.java
│ │ │ ├── IamPolicyResponseV1.java
│ │ │ ├── IoTButtonEvent.java
│ │ │ ├── KafkaEvent.java
│ │ │ ├── KinesisAnalyticsFirehoseInputPreprocessingEvent.java
│ │ │ ├── KinesisAnalyticsInputPreprocessingResponse.java
│ │ │ ├── KinesisAnalyticsOutputDeliveryEvent.java
│ │ │ ├── KinesisAnalyticsOutputDeliveryResponse.java
│ │ │ ├── KinesisAnalyticsStreamsInputPreprocessingEvent.java
│ │ │ ├── KinesisEvent.java
│ │ │ ├── KinesisFirehoseEvent.java
│ │ │ ├── KinesisTimeWindowEvent.java
│ │ │ ├── LambdaDestinationEvent.java
│ │ │ ├── LexEvent.java
│ │ │ ├── MSKFirehoseEvent.java
│ │ │ ├── MSKFirehoseResponse.java
│ │ │ ├── RabbitMQEvent.java
│ │ │ ├── S3BatchEvent.java
│ │ │ ├── S3BatchEventV2.java
│ │ │ ├── S3BatchResponse.java
│ │ │ ├── S3Event.java
│ │ │ ├── S3ObjectLambdaEvent.java
│ │ │ ├── SNSEvent.java
│ │ │ ├── SQSBatchResponse.java
│ │ │ ├── SQSEvent.java
│ │ │ ├── ScheduledEvent.java
│ │ │ ├── SecretsManagerRotationEvent.java
│ │ │ ├── SimpleIAMPolicyResponse.java
│ │ │ ├── StreamsEventResponse.java
│ │ │ ├── TimeWindowEventResponse.java
│ │ │ └── models
│ │ │ ├── TimeWindow.java
│ │ │ ├── dynamodb
│ │ │ ├── AttributeValue.java
│ │ │ ├── Identity.java
│ │ │ ├── OperationType.java
│ │ │ ├── Record.java
│ │ │ ├── StreamRecord.java
│ │ │ └── StreamViewType.java
│ │ │ ├── kinesis
│ │ │ ├── EncryptionType.java
│ │ │ └── Record.java
│ │ │ └── s3
│ │ │ └── S3EventNotification.java
│ │ └── lombok.config
│ └── test
│ ├── java
│ └── com
│ │ └── amazonaws
│ │ └── services
│ │ └── lambda
│ │ └── runtime
│ │ └── events
│ │ ├── APIGatewayV2CustomAuthorizerEventTest.java
│ │ ├── HttpUtils.java
│ │ ├── IamPolicyResponseTest.java
│ │ ├── IamPolicyResponseV1Test.java
│ │ └── models
│ │ └── s3
│ │ └── S3EventNotificationTest.java
│ └── resources
│ ├── iamPolicyResponses
│ ├── allow-with-condition.json
│ ├── allow.json
│ └── deny.json
│ └── iamPolicyV1Responses
│ ├── allow-with-condition.json
│ ├── allow.json
│ └── deny.json
├── aws-lambda-java-log4j2
├── README.md
├── RELEASE.CHANGELOG.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── amazonaws
│ │ └── services
│ │ └── lambda
│ │ └── runtime
│ │ └── log4j2
│ │ ├── LambdaAppender.java
│ │ ├── LambdaJsonFormat.java
│ │ └── LambdaTextFormat.java
│ └── resources
│ └── LambdaLayout.json
├── aws-lambda-java-runtime-interface-client
├── .gitignore
├── Makefile
├── README.md
├── RELEASE.CHANGELOG.md
├── build-tools
│ └── checkstyle.xml
├── pom.xml
├── ric-dev-environment
│ ├── codeartifact-repo.mk
│ ├── publish_snapshot.sh
│ ├── settings.xml
│ └── test-platform-specific-jar-snapshot.sh
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── amazonaws
│ │ │ │ └── services
│ │ │ │ └── lambda
│ │ │ │ ├── crac
│ │ │ │ ├── CheckpointException.java
│ │ │ │ ├── Context.java
│ │ │ │ ├── ContextImpl.java
│ │ │ │ ├── Core.java
│ │ │ │ ├── DNSManager.java
│ │ │ │ ├── Resource.java
│ │ │ │ └── RestoreException.java
│ │ │ │ └── runtime
│ │ │ │ └── api
│ │ │ │ └── client
│ │ │ │ ├── AWSLambda.java
│ │ │ │ ├── ClasspathLoader.java
│ │ │ │ ├── CustomerClassLoader.java
│ │ │ │ ├── EventHandlerLoader.java
│ │ │ │ ├── HandlerInfo.java
│ │ │ │ ├── LambdaEnvironment.java
│ │ │ │ ├── LambdaRequestHandler.java
│ │ │ │ ├── PojoSerializerLoader.java
│ │ │ │ ├── ReservedRuntimeEnvironmentVariables.java
│ │ │ │ ├── TooManyServiceProvidersFoundException.java
│ │ │ │ ├── UserFault.java
│ │ │ │ ├── api
│ │ │ │ ├── LambdaClientContext.java
│ │ │ │ ├── LambdaClientContextClient.java
│ │ │ │ ├── LambdaCognitoIdentity.java
│ │ │ │ └── LambdaContext.java
│ │ │ │ ├── logging
│ │ │ │ ├── AbstractLambdaLogger.java
│ │ │ │ ├── FrameType.java
│ │ │ │ ├── FramedTelemetryLogSink.java
│ │ │ │ ├── JsonLogFormatter.java
│ │ │ │ ├── LambdaContextLogger.java
│ │ │ │ ├── LogFiltering.java
│ │ │ │ ├── LogFormatter.java
│ │ │ │ ├── LogSink.java
│ │ │ │ ├── StdOutLogSink.java
│ │ │ │ ├── StructuredLogMessage.java
│ │ │ │ └── TextLogFormatter.java
│ │ │ │ ├── runtimeapi
│ │ │ │ ├── DtoSerializers.java
│ │ │ │ ├── JniHelper.java
│ │ │ │ ├── LambdaError.java
│ │ │ │ ├── LambdaRuntimeApiClient.java
│ │ │ │ ├── LambdaRuntimeApiClientImpl.java
│ │ │ │ ├── LambdaRuntimeClientException.java
│ │ │ │ ├── NativeClient.java
│ │ │ │ ├── RapidErrorType.java
│ │ │ │ ├── converters
│ │ │ │ │ ├── LambdaErrorConverter.java
│ │ │ │ │ └── XRayErrorCauseConverter.java
│ │ │ │ └── dto
│ │ │ │ │ ├── ErrorRequest.java
│ │ │ │ │ ├── InvocationRequest.java
│ │ │ │ │ ├── StackElement.java
│ │ │ │ │ ├── XRayErrorCause.java
│ │ │ │ │ └── XRayException.java
│ │ │ │ └── util
│ │ │ │ ├── EnvReader.java
│ │ │ │ ├── LambdaOutputStream.java
│ │ │ │ └── UnsafeUtil.java
│ │ └── jni
│ │ │ ├── Dockerfile.glibc
│ │ │ ├── Dockerfile.musl
│ │ │ ├── build-jni-lib.sh
│ │ │ ├── com_amazonaws_services_lambda_crac_DNSManager.cpp
│ │ │ ├── com_amazonaws_services_lambda_crac_DNSManager.h
│ │ │ ├── com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient.cpp
│ │ │ ├── com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient.h
│ │ │ ├── deps
│ │ │ ├── aws-lambda-cpp-0.2.7
│ │ │ │ ├── .clang-format
│ │ │ │ ├── .clang-tidy
│ │ │ │ ├── .github
│ │ │ │ │ └── PULL_REQUEST_TEMPLATE.md
│ │ │ │ ├── .gitignore
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── CODE_OF_CONDUCT.md
│ │ │ │ ├── CONTRIBUTING.md
│ │ │ │ ├── LICENSE
│ │ │ │ ├── NOTICE
│ │ │ │ ├── README.md
│ │ │ │ ├── ci
│ │ │ │ │ ├── codebuild
│ │ │ │ │ │ ├── amazonlinux-2017.03.yml
│ │ │ │ │ │ ├── build-cpp-sdk.sh
│ │ │ │ │ │ ├── build.sh
│ │ │ │ │ │ ├── format-check.sh
│ │ │ │ │ │ ├── run-tests.sh
│ │ │ │ │ │ └── ubuntu-18.04.yml
│ │ │ │ │ └── docker
│ │ │ │ │ │ ├── alpine-linux-3.8
│ │ │ │ │ │ ├── amazon-linux-2017.03
│ │ │ │ │ │ └── ubuntu-linux-18.04
│ │ │ │ ├── cmake
│ │ │ │ │ └── aws-lambda-runtime-config.cmake
│ │ │ │ ├── examples
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ ├── api-gateway
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ └── main.cpp
│ │ │ │ │ ├── dynamodb
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ └── main.cpp
│ │ │ │ │ └── s3
│ │ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ └── main.cpp
│ │ │ │ ├── include
│ │ │ │ │ └── aws
│ │ │ │ │ │ ├── http
│ │ │ │ │ │ └── response.h
│ │ │ │ │ │ ├── lambda-runtime
│ │ │ │ │ │ ├── outcome.h
│ │ │ │ │ │ ├── runtime.h
│ │ │ │ │ │ └── version.h
│ │ │ │ │ │ └── logging
│ │ │ │ │ │ └── logging.h
│ │ │ │ ├── packaging
│ │ │ │ │ └── packager
│ │ │ │ ├── src
│ │ │ │ │ ├── backward.cpp
│ │ │ │ │ ├── backward.h
│ │ │ │ │ ├── logging.cpp
│ │ │ │ │ ├── runtime.cpp
│ │ │ │ │ └── version.cpp.in
│ │ │ │ └── tests
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── gtest
│ │ │ │ │ ├── .clang-tidy
│ │ │ │ │ ├── gtest-all.cc
│ │ │ │ │ └── gtest.h
│ │ │ │ │ ├── main.cpp
│ │ │ │ │ ├── resources
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── lambda_function.cpp
│ │ │ │ │ ├── runtime_tests.cpp
│ │ │ │ │ └── version_tests.cpp
│ │ │ ├── curl-7.83.1.tar.gz
│ │ │ └── curl_001_disable_wakeup.patch
│ │ │ └── macro.h
│ └── test
│ │ └── java
│ │ ├── com
│ │ └── amazonaws
│ │ │ └── services
│ │ │ └── lambda
│ │ │ ├── crac
│ │ │ ├── ContextImplTest.java
│ │ │ └── DNSCacheManagerTest.java
│ │ │ └── runtime
│ │ │ └── api
│ │ │ └── client
│ │ │ ├── ClasspathLoaderTest.java
│ │ │ ├── CustomerClassLoaderTest.java
│ │ │ ├── EventHandlerLoaderTest.java
│ │ │ ├── HandlerInfoTest.java
│ │ │ ├── LambdaRequestHandler.java
│ │ │ ├── PojoSerializerLoaderTest.java
│ │ │ ├── TooManyServiceProvidersFoundExceptionTest.java
│ │ │ ├── UserFaultTest.java
│ │ │ ├── XRayErrorCauseTest.java
│ │ │ ├── api
│ │ │ └── LambdaContextTest.java
│ │ │ ├── logging
│ │ │ ├── AbstractLambdaLoggerTest.java
│ │ │ ├── FrameTypeTest.java
│ │ │ ├── FramedTelemetryLogSinkTest.java
│ │ │ ├── JsonLogFormatterTest.java
│ │ │ ├── StdOutLogSinkTest.java
│ │ │ └── TextLogFormatterTest.java
│ │ │ ├── runtimeapi
│ │ │ ├── LambdaRuntimeApiClientImplTest.java
│ │ │ └── converters
│ │ │ │ └── LambdaErrorConverterTest.java
│ │ │ └── util
│ │ │ ├── LambdaOutputStreamTest.java
│ │ │ └── UnsafeUtilTest.java
│ │ ├── test
│ │ └── lambda
│ │ │ └── handlers
│ │ │ ├── POJOHanlderImpl.java
│ │ │ ├── RequestHandlerImpl.java
│ │ │ └── RequestStreamHandlerImpl.java
│ │ └── testpkg
│ │ └── StackTraceHelper.java
└── test
│ └── integration
│ ├── .gitignore
│ ├── codebuild-local
│ ├── Dockerfile.agent
│ ├── codebuild_build.sh
│ ├── test_all.sh
│ └── test_one.sh
│ ├── codebuild
│ ├── buildspec.os.alpine.yml
│ ├── buildspec.os.amazoncorretto.yml
│ ├── buildspec.os.amazonlinux.1.yml
│ ├── buildspec.os.amazonlinux.2.yml
│ ├── buildspec.os.centos.yml
│ ├── buildspec.os.debian.yml
│ ├── buildspec.os.ubuntu.yml
│ └── scripts
│ │ ├── clean_up.sh
│ │ ├── configure_multi_arch_env.sh
│ │ ├── fetch_test_container_logs.sh
│ │ └── run_invocation_test.sh
│ ├── docker
│ ├── Dockerfile.function.alpine
│ ├── Dockerfile.function.amazoncorretto
│ ├── Dockerfile.function.amazonlinux
│ ├── Dockerfile.function.centos
│ ├── Dockerfile.function.debian
│ └── Dockerfile.function.ubuntu
│ ├── resources
│ ├── aws-lambda-rie-arm64.tar.gz
│ └── aws-lambda-rie.tar.gz
│ └── test-handler
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── helloworld
│ └── App.java
├── aws-lambda-java-serialization
├── RELEASE.CHANGELOG.md
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── amazonaws
│ │ └── services
│ │ └── lambda
│ │ └── runtime
│ │ └── serialization
│ │ ├── PojoSerializer.java
│ │ ├── events
│ │ ├── LambdaEventSerializers.java
│ │ ├── mixins
│ │ │ ├── CloudFormationCustomResourceEventMixin.java
│ │ │ ├── CloudFrontEventMixin.java
│ │ │ ├── CloudWatchLogsEventMixin.java
│ │ │ ├── CodeCommitEventMixin.java
│ │ │ ├── ConnectEventMixin.java
│ │ │ ├── DynamodbEventMixin.java
│ │ │ ├── DynamodbTimeWindowEventMixin.java
│ │ │ ├── KinesisEventMixin.java
│ │ │ ├── KinesisTimeWindowEventMixin.java
│ │ │ ├── SNSEventMixin.java
│ │ │ ├── SQSEventMixin.java
│ │ │ ├── ScheduledEventMixin.java
│ │ │ └── SecretsManagerRotationEventMixin.java
│ │ ├── modules
│ │ │ ├── DateModule.java
│ │ │ └── DateTimeModule.java
│ │ └── serializers
│ │ │ ├── OrgJsonSerializer.java
│ │ │ └── S3EventSerializer.java
│ │ ├── factories
│ │ ├── GsonFactory.java
│ │ ├── JacksonFactory.java
│ │ └── PojoSerializerFactory.java
│ │ └── util
│ │ ├── Functions.java
│ │ ├── LambdaByteArrayOutputStream.java
│ │ ├── ReflectUtil.java
│ │ └── SerializeUtil.java
└── verify-relocation.sh
├── aws-lambda-java-tests
├── README.md
├── RELEASE.CHANGELOG.md
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── amazonaws
│ │ └── services
│ │ └── lambda
│ │ └── runtime
│ │ └── tests
│ │ ├── EventArgumentsProvider.java
│ │ ├── EventLoader.java
│ │ ├── EventLoadingException.java
│ │ ├── EventsArgumentsProvider.java
│ │ ├── HandlerParamsArgumentsProvider.java
│ │ └── annotations
│ │ ├── Event.java
│ │ ├── Events.java
│ │ ├── HandlerParams.java
│ │ ├── Response.java
│ │ └── Responses.java
│ └── test
│ ├── java
│ └── com
│ │ └── amazonaws
│ │ └── services
│ │ └── lambda
│ │ └── runtime
│ │ └── tests
│ │ ├── EventLoaderTest.java
│ │ ├── EventTest.java
│ │ ├── EventsTest.java
│ │ ├── HandlerParamsTest.java
│ │ └── S3BatchEventV2Test.java
│ └── resources
│ ├── apigw
│ ├── events
│ │ ├── apigw_event.json
│ │ └── apigw_event_nobody.json
│ └── responses
│ │ ├── apigw_response.json
│ │ └── apigw_response2.json
│ ├── apigw_auth.json
│ ├── apigw_auth_v2.json
│ ├── apigw_http_event.json
│ ├── apigw_rest_event.json
│ ├── cloudformation_event.json
│ ├── cloudfront_event.json
│ ├── cloudwatch_composite_alarm.json
│ ├── cloudwatch_event.json
│ ├── cloudwatch_metric_alarm.json
│ ├── cloudwatchlogs_event.json
│ ├── codecommit_event.json
│ ├── cognito_user_pool_pre_token_generation_event_v2.json
│ ├── config_event.json
│ ├── connect_event.json
│ ├── ddb
│ ├── dynamo_ddb_stream_record.json
│ └── dynamo_event.json
│ ├── elb_event.json
│ ├── firehose_event.json
│ ├── kafka_event.json
│ ├── kinesis_event.json
│ ├── lambda_destination_event.json
│ ├── lex_event.json
│ ├── mq_event.json
│ ├── msk_firehose_event.json
│ ├── rabbitmq_event.json
│ ├── s3_batch_event_v2.json
│ ├── s3_event.json
│ ├── secrets_rotation_event.json
│ ├── sns_event.json
│ └── sqs
│ ├── sqs_event_nobody.json
│ └── sqs_event_product.json
├── experimental
└── aws-lambda-java-profiler
│ ├── .gitignore
│ ├── .mvn
│ └── wrapper
│ │ └── maven-wrapper.properties
│ ├── README.md
│ ├── RELEASE.CHANGELOG.md
│ ├── docs
│ ├── Arch_AWS-Lambda_64.svg
│ ├── example-cold-start-flame-graph-small.png
│ └── example-cold-start-flame-graph.png
│ ├── examples
│ ├── cdk
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── cdk.json
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── myorg
│ │ │ ├── InfraApp.java
│ │ │ └── InfraStack.java
│ └── function
│ │ └── profiling-example
│ │ ├── pom.xml
│ │ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── helloworld
│ │ │ └── App.java
│ │ └── test
│ │ └── java
│ │ └── helloworld
│ │ └── AppTest.java
│ ├── extension
│ ├── build.gradle
│ ├── build_layer.sh
│ ├── extensions
│ │ └── profiler-extension
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── amazonaws
│ │ └── services
│ │ └── lambda
│ │ └── extension
│ │ ├── ExtensionClient.java
│ │ ├── ExtensionMain.java
│ │ ├── Logger.java
│ │ ├── PreMain.java
│ │ ├── S3Manager.java
│ │ └── ShutdownHook.java
│ ├── integration_tests
│ ├── cleanup.sh
│ ├── create_bucket.sh
│ ├── create_function.sh
│ ├── download_from_s3.sh
│ ├── helloworld
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── helloworld
│ │ │ │ └── Handler.java
│ │ │ └── resources
│ │ │ └── wrapper.sh
│ ├── invoke_function.sh
│ └── publish_layer.sh
│ └── update-function.sh
├── git-config
└── hooks
│ └── pre-commit
└── samples
├── custom-serialization
├── .gitignore
├── README.md
├── fastJson
│ ├── HelloWorldFunction
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── com
│ │ │ │ └── example
│ │ │ │ │ └── vehicles
│ │ │ │ │ └── serialization
│ │ │ │ │ └── FastJsonSerializer.java
│ │ │ └── helloworld
│ │ │ │ ├── App.java
│ │ │ │ └── Vehicle.java
│ │ │ └── resources
│ │ │ └── META-INF
│ │ │ └── services
│ │ │ └── com.amazonaws.services.lambda.runtime.CustomPojoSerializer
│ ├── README.md
│ ├── events
│ │ └── event.json
│ └── template.yaml
├── gson
│ ├── HelloWorldFunction
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── com
│ │ │ │ └── example
│ │ │ │ │ └── vehicles
│ │ │ │ │ └── serialization
│ │ │ │ │ └── GsonSerializer.java
│ │ │ └── helloworld
│ │ │ │ ├── App.java
│ │ │ │ └── Vehicle.java
│ │ │ └── resources
│ │ │ └── META-INF
│ │ │ └── services
│ │ │ └── com.amazonaws.services.lambda.runtime.CustomPojoSerializer
│ ├── README.md
│ ├── events
│ │ └── event.json
│ └── template.yaml
├── jackson-jr
│ ├── HelloWorldFunction
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── com
│ │ │ │ └── example
│ │ │ │ │ └── vehicles
│ │ │ │ │ └── serialization
│ │ │ │ │ └── JacksonJRSerializer.java
│ │ │ └── helloworld
│ │ │ │ ├── App.java
│ │ │ │ └── Vehicle.java
│ │ │ └── resources
│ │ │ └── META-INF
│ │ │ └── services
│ │ │ └── com.amazonaws.services.lambda.runtime.CustomPojoSerializer
│ ├── README.md
│ ├── events
│ │ └── event.json
│ └── template.yaml
├── moshi
│ ├── HelloWorldFunction
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ ├── com
│ │ │ │ └── example
│ │ │ │ │ └── vehicles
│ │ │ │ │ └── serialization
│ │ │ │ │ └── MoshiSerializer.java
│ │ │ └── helloworld
│ │ │ │ ├── App.java
│ │ │ │ └── Vehicle.java
│ │ │ └── resources
│ │ │ └── META-INF
│ │ │ └── services
│ │ │ └── com.amazonaws.services.lambda.runtime.CustomPojoSerializer
│ ├── README.md
│ ├── events
│ │ └── event.json
│ └── template.yaml
└── request-stream-handler
│ ├── HelloWorldFunction
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── helloworld
│ │ ├── App.java
│ │ └── Vehicle.java
│ ├── README.md
│ ├── events
│ └── event.json
│ └── template.yaml
├── kinesis-firehose-event-handler
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── example
│ │ └── KinesisFirehoseEventHandler.java
│ └── test
│ ├── java
│ └── example
│ │ └── KinesisFirehoseEventHandlerTest.java
│ └── resources
│ └── event.json
└── msk-firehose-event-handler
└── src
├── main
└── java
│ └── example
│ └── MSKFirehoseEventHandler.java
└── test
├── java
└── example
│ └── MSKFirehoseEventHandlerTest.java
└── resources
└── event.json
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | *Issue #, if available:*
2 |
3 | *Description of changes:*
4 |
5 | *Target (OCI, Managed Runtime, both):*
6 |
7 |
8 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
9 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 |
4 | - package-ecosystem: "github-actions"
5 | directory: "/"
6 | schedule:
7 | interval: "weekly"
--------------------------------------------------------------------------------
/.github/workflows/aws-lambda-java-core.yml:
--------------------------------------------------------------------------------
1 | # This workflow will be triggered if there will be changes to aws-lambda-java-core
2 | # package and it builds the package and the packages that depend on it.
3 |
4 | name: Java CI aws-lambda-java-core
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | paths:
10 | - 'aws-lambda-java-core/**'
11 | pull_request:
12 | branches: [ '*' ]
13 | paths:
14 | - 'aws-lambda-java-core/**'
15 | - '.github/workflows/aws-lambda-java-core.yml'
16 |
17 | jobs:
18 | build:
19 |
20 | runs-on: ubuntu-latest
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up JDK 1.8
25 | uses: actions/setup-java@v4
26 | with:
27 | java-version: 8
28 | distribution: corretto
29 |
30 | # Install base module
31 | - name: Install core with Maven
32 | run: mvn -B install --file aws-lambda-java-core/pom.xml
33 |
34 | # Package modules that depend on base module
35 | - name: Package log4j2 with Maven
36 | run: mvn -B package --file aws-lambda-java-log4j2/pom.xml
37 |
38 | # Test Runtime Interface Client
39 | - name: Run 'pr' target
40 | working-directory: ./aws-lambda-java-runtime-interface-client
41 | run: make pr
42 | env:
43 | IS_JAVA_8: true
44 |
--------------------------------------------------------------------------------
/.github/workflows/aws-lambda-java-events-sdk-transformer.yml:
--------------------------------------------------------------------------------
1 | # This workflow will be triggered if there will be changes to
2 | # aws-lambda-java-events-sdk-transformer package and it builds the package.
3 |
4 | name: Java CI aws-lambda-java-events-sdk-transformer
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | paths:
10 | - 'aws-lambda-java-events-sdk-transformer/**'
11 | pull_request:
12 | branches: [ '*' ]
13 | paths:
14 | - 'aws-lambda-java-events-sdk-transformer/**'
15 | - '.github/workflows/aws-lambda-java-events-sdk-transformer.yml'
16 |
17 | jobs:
18 | build:
19 |
20 | runs-on: ubuntu-latest
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up JDK 1.8
25 | uses: actions/setup-java@v4
26 | with:
27 | java-version: 8
28 | distribution: corretto
29 |
30 | # Install base module
31 | - name: Install events with Maven
32 | run: mvn -B install --file aws-lambda-java-events/pom.xml
33 | # Package target module
34 | - name: Package events-sdk-transformer with Maven
35 | run: mvn -B package --file aws-lambda-java-events-sdk-transformer/pom.xml
36 |
37 |
--------------------------------------------------------------------------------
/.github/workflows/aws-lambda-java-events.yml:
--------------------------------------------------------------------------------
1 | # This workflow will be triggered if there will be changes to aws-lambda-java-events
2 | # package and it builds the package and the packages that depend on it.
3 |
4 | name: Java CI aws-lambda-java-events
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | paths:
10 | - 'aws-lambda-java-events/**'
11 | pull_request:
12 | branches: [ '*' ]
13 | paths:
14 | - 'aws-lambda-java-events/**'
15 | - '.github/workflows/aws-lambda-java-events.yml'
16 |
17 | jobs:
18 | build:
19 |
20 | runs-on: ubuntu-latest
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up JDK 1.8
25 | uses: actions/setup-java@v4
26 | with:
27 | java-version: 8
28 | distribution: corretto
29 |
30 | # Install base module
31 | - name: Install events with Maven
32 | run: mvn -B install --file aws-lambda-java-events/pom.xml
33 |
34 | # Package modules that depend on base module
35 | - name: Package serialization with Maven
36 | run: mvn -B package --file aws-lambda-java-serialization/pom.xml
37 | - name: Package events-sdk-transformer with Maven
38 | run: mvn -B package --file aws-lambda-java-events-sdk-transformer/pom.xml
39 |
40 |
--------------------------------------------------------------------------------
/.github/workflows/aws-lambda-java-log4j2.yml:
--------------------------------------------------------------------------------
1 | # This workflow will be triggered if there will be changes to
2 | # aws-lambda-java-log4j2 package and it builds the package.
3 |
4 | name: Java CI aws-lambda-java-log4j2
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | paths:
10 | - 'aws-lambda-java-log4j2/**'
11 | pull_request:
12 | branches: [ '*' ]
13 | paths:
14 | - 'aws-lambda-java-log4j2/**'
15 | - '.github/workflows/aws-lambda-java-log4j2.yml'
16 |
17 | jobs:
18 | build:
19 |
20 | runs-on: ubuntu-latest
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up JDK 1.8
25 | uses: actions/setup-java@v4
26 | with:
27 | java-version: 8
28 | distribution: corretto
29 |
30 | # Install base module
31 | - name: Install core with Maven
32 | run: mvn -B install --file aws-lambda-java-core/pom.xml
33 | # Package target module
34 | - name: Package log4j2 with Maven
35 | run: mvn -B package --file aws-lambda-java-log4j2/pom.xml
36 |
37 |
--------------------------------------------------------------------------------
/.github/workflows/aws-lambda-java-serialization.yml:
--------------------------------------------------------------------------------
1 | # This workflow will be triggered if there will be changes to aws-lambda-java-serialization
2 | # package and it builds the package and the packages that depend on it.
3 |
4 | name: Java CI aws-lambda-java-serialization
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | paths:
10 | - 'aws-lambda-java-serialization/**'
11 | pull_request:
12 | branches: [ '*' ]
13 | paths:
14 | - 'aws-lambda-java-serialization/**'
15 | - '.github/workflows/aws-lambda-java-serialization.yml'
16 |
17 | jobs:
18 | build:
19 |
20 | runs-on: ubuntu-latest
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up JDK 1.8
25 | uses: actions/setup-java@v4
26 | with:
27 | java-version: 8
28 | distribution: corretto
29 |
30 | # Install base module
31 | - name: Install events with Maven
32 | run: mvn -B install --file aws-lambda-java-events/pom.xml
33 |
34 | # Package and install target module
35 | - name: Package serialization with Maven
36 | run: mvn -B package install --file aws-lambda-java-serialization/pom.xml
37 |
38 | # Run tests
39 | - name: Run tests from aws-lambda-java-tests
40 | run: mvn test --file aws-lambda-java-tests/pom.xml
41 |
--------------------------------------------------------------------------------
/.github/workflows/aws-lambda-java-tests.yml:
--------------------------------------------------------------------------------
1 | # This workflow will be triggered if there will be changes to aws-lambda-java-tests
2 | # package and it builds the package and the packages that depend on it.
3 |
4 | name: Java CI aws-lambda-java-tests
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | paths:
10 | - 'aws-lambda-java-tests/**'
11 | pull_request:
12 | branches: [ '*' ]
13 | paths:
14 | - 'aws-lambda-java-tests/**'
15 | - '.github/workflows/aws-lambda-java-tests.yml'
16 |
17 | jobs:
18 | build:
19 |
20 | runs-on: ubuntu-latest
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up JDK 1.8
25 | uses: actions/setup-java@v4
26 | with:
27 | java-version: 8
28 | distribution: corretto
29 |
30 | # Install base module
31 | - name: Install events with Maven
32 | run: mvn -B install --file aws-lambda-java-events/pom.xml
33 | - name: Install serialization with Maven
34 | run: mvn -B install --file aws-lambda-java-serialization/pom.xml
35 |
36 | # Package target module
37 | - name: Package tests with Maven
38 | run: mvn -B package --file aws-lambda-java-tests/pom.xml
39 |
40 |
--------------------------------------------------------------------------------
/.github/workflows/repo-sync.yml:
--------------------------------------------------------------------------------
1 | name: Repo Sync
2 |
3 | on:
4 | schedule:
5 | - cron: "0 8 * * 1-5" # At 08:00 on every day-of-week from Monday through Friday
6 | pull_request:
7 | branches: [ '*' ]
8 | paths:
9 | - '.github/workflows/repo-sync.yml'
10 | workflow_dispatch:
11 |
12 | jobs:
13 | repo-sync:
14 | name: Repo Sync
15 | runs-on: ubuntu-latest
16 | env:
17 | IS_CONFIGURED: ${{ secrets.SOURCE_REPO != '' }}
18 | steps:
19 | - uses: actions/checkout@v4
20 | if: ${{ env.IS_CONFIGURED == 'true' }}
21 | - uses: repo-sync/github-sync@v2
22 | name: Sync repo to branch
23 | if: ${{ env.IS_CONFIGURED == 'true' }}
24 | with:
25 | source_repo: ${{ secrets.SOURCE_REPO }}
26 | source_branch: main
27 | destination_branch: ${{ secrets.INTERMEDIATE_BRANCH }}
28 | github_token: ${{ secrets.GITHUB_TOKEN }}
29 | - uses: repo-sync/pull-request@v2
30 | name: Create pull request
31 | if: ${{ env.IS_CONFIGURED == 'true' }}
32 | with:
33 | source_branch: ${{ secrets.INTERMEDIATE_BRANCH }}
34 | destination_branch: main
35 | github_token: ${{ secrets.GITHUB_TOKEN }}
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 |
11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12 | hs_err_pid*
13 |
14 | # Maven build
15 | target/
16 | dependency-reduced-pom.xml
17 |
18 | # IDEA internal
19 | *.iml
20 | .idea
21 | .gradle
22 | .settings
23 | .classpath
24 | .project
25 |
26 | # OSX
27 | .DS_Store
28 |
29 | # snapshot process
30 | aws-lambda-java-runtime-interface-client/pom.xml.versionsBackup
31 |
32 | # profiler
33 | experimental/aws-lambda-java-profiler/integration_tests/helloworld/build
34 | experimental/aws-lambda-java-profiler/extension/build/
35 | experimental/aws-lambda-java-profiler/integration_tests/helloworld/bin
36 | !experimental/aws-lambda-java-profiler/extension/gradle/wrapper/*.jar
37 | /scratch/
38 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/RELEASE.CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### May 26, 2025
2 | `1.3.0`
3 | - Adding support for multi tenancy ([#545](https://github.com/aws/aws-lambda-java-libs/pull/545))
4 |
5 | ### August 17, 2023
6 | `1.2.3`:
7 | - Extended logger interface with level-aware logging backend functions
8 |
9 | ### November 09, 2022
10 | `1.2.2`:
11 | - Added new `CustomPojoSerializer` interface
12 | - Removed unnecessary usage of public on interface methods (aws#172)
13 |
14 | ### April 28, 2020
15 | `1.2.1`:
16 | - Added missing XML namespace declarations to `pom.xml` file ([#97](https://github.com/aws/aws-lambda-java-libs/issues/97))
17 | - Updated `nexusUrl` in `pom.xml` file ([#108](https://github.com/aws/aws-lambda-java-libs/issues/108))
18 |
19 | ### November 21, 2017
20 | `1.2.0`:
21 | - Added method to log byte array to `LambdaLogger`
22 |
23 | ### October 07, 2015
24 | `1.1.0`:
25 | - Added `LambdaRuntime` and `LambdaRuntimeInternal`
26 | - Added `getInstallationId()` to `Client`
27 | - Added `getFunctionVersion()` and `getInvokedFunctionArn()` to `Context`
28 |
29 | ### June 15, 2015
30 | `1.0.0`:
31 | - Initial support for java in AWS Lambda
32 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/Client.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime;
4 |
5 | /**
6 | * Contains information about the client application that invoked the Lambda function.
7 | *
8 | */
9 | public interface Client {
10 |
11 | /**
12 | * Gets the application's installation id
13 | */
14 | String getInstallationId();
15 |
16 | /**
17 | * Gets the application's title
18 | *
19 | */
20 | String getAppTitle();
21 |
22 | /**
23 | * Gets the application's version
24 | *
25 | */
26 | String getAppVersionName();
27 |
28 | /**
29 | * Gets the application's version code
30 | *
31 | */
32 | String getAppVersionCode();
33 |
34 | /**
35 | * Gets the application's package name
36 | */
37 | String getAppPackageName();
38 | }
39 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/ClientContext.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | *
9 | * Provides information about client configuration and execution environment.
10 | *
11 | */
12 | public interface ClientContext {
13 | /**
14 | * Gets the client information provided by the AWS Mobile SDK
15 | *
16 | */
17 | Client getClient();
18 |
19 | /**
20 | * Gets custom values set by the client application
21 | *
22 | * This map is mutable (and not thread-safe if mutated)
23 | *
24 | */
25 | Map getCustom();
26 |
27 | /**
28 | * Gets environment information provided by mobile SDK, immutable.
29 | *
30 | */
31 | Map getEnvironment();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/CognitoIdentity.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime;
4 |
5 | /**
6 | * Provides information related to Amazon Congnito identities.
7 | *
8 | */
9 | public interface CognitoIdentity {
10 | /**
11 | * Gets the Amazon Cognito identity ID
12 | *
13 | */
14 | String getIdentityId();
15 |
16 | /**
17 | * Gets the Amazon Cognito identity pool ID
18 | *
19 | */
20 | String getIdentityPoolId();
21 | }
22 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/CustomPojoSerializer.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime;
4 |
5 | import java.io.InputStream;
6 | import java.io.OutputStream;
7 |
8 | import java.lang.reflect.Type;
9 |
10 | /**
11 | * Interface required to implement a custom plain old java objects serializer
12 | */
13 | public interface CustomPojoSerializer {
14 |
15 | /**
16 | * Deserializes from input stream to plain old java object
17 | * @param input input stream
18 | * @param type plain old java object type
19 | * @return deserialized plain old java object of type T
20 | */
21 | T fromJson(InputStream input, Type type);
22 |
23 | /**
24 | * Deserializes from String to plain old java object
25 | * @param input input string
26 | * @param type plain old java object type
27 | * @return deserialized plain old java object of type T
28 | */
29 | T fromJson(String input, Type type);
30 |
31 | /**
32 | * Serializes plain old java object to output stream
33 | * @param value instance of type T to be serialized
34 | * @param output OutputStream to serialize plain old java object to
35 | * @param type plain old java object type
36 | */
37 | void toJson(T value, OutputStream output, Type type);
38 | }
39 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/LambdaLogger.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime;
4 |
5 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
6 |
7 | /**
8 | * A low level Lambda runtime logger
9 | *
10 | */
11 | public interface LambdaLogger {
12 |
13 | /**
14 | * Logs a string to AWS CloudWatch Logs
15 | *
16 | *
17 | * Logging will not be done:
18 | *
19 | * -
20 | * If the container is not configured to log to CloudWatch.
21 | *
22 | * -
23 | * If the role provided to the function does not have sufficient permissions.
24 | *
25 | *
26 | *
27 | *
28 | * @param message A string containing the event to log.
29 | */
30 | void log(String message);
31 |
32 | /**
33 | * Logs a byte array to AWS CloudWatch Logs
34 | * @param message byte array containing logs
35 | */
36 | void log(byte[] message);
37 |
38 | /**
39 | * LogLevel aware logging backend function.
40 | *
41 | * @param message in String format
42 | * @param logLevel
43 | */
44 | default void log(String message, LogLevel logLevel) {
45 | log(message);
46 | }
47 |
48 | /**
49 | * LogLevel aware logging backend function.
50 | *
51 | * @param message in byte[] format
52 | * @param logLevel
53 | */
54 | default void log(byte[] message, LogLevel logLevel) {
55 | log(message);
56 | }
57 |
58 |
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/LambdaRuntime.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 | package com.amazonaws.services.lambda.runtime;
3 |
4 | import java.io.IOException;
5 |
6 | public final class LambdaRuntime {
7 | private LambdaRuntime() {}
8 |
9 | private static volatile LambdaLogger logger = new LambdaLogger() {
10 |
11 | public void log(String message) {
12 | System.out.print(message);
13 | }
14 |
15 | public void log(byte[] message) {
16 | try {
17 | System.out.write(message);
18 | } catch (IOException e) {
19 | // NOTE: When actually running on AWS Lambda, an IOException would never happen
20 | e.printStackTrace();
21 | }
22 | }
23 | };
24 |
25 | /**
26 | * Returns the global lambda logger instance
27 | *
28 | */
29 | public static LambdaLogger getLogger() {
30 | return logger;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/LambdaRuntimeInternal.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime;
4 |
5 | /**
6 | * This class is used internally by Lambda Runtime.
7 | */
8 | public final class LambdaRuntimeInternal {
9 | private LambdaRuntimeInternal() {}
10 |
11 | private static boolean useLog4jAppender;
12 |
13 | public static void setUseLog4jAppender(boolean useLog4j) {
14 | useLog4jAppender = useLog4j;
15 | }
16 |
17 | public static boolean getUseLog4jAppender() {
18 | return useLog4jAppender;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestHandler.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime;
2 |
3 | import com.amazonaws.services.lambda.runtime.Context;
4 |
5 | /**
6 | *
7 | * Lambda request handlers implement AWS Lambda Function application logic using plain old java objects
8 | * as input and output.
9 | *
10 | * @param The input parameter type
11 | * @param The output parameter type
12 | */
13 | public interface RequestHandler {
14 | /**
15 | * Handles a Lambda Function request
16 | * @param input The Lambda Function input
17 | * @param context The Lambda execution environment context object.
18 | * @return The Lambda Function output
19 | */
20 | O handleRequest(I input, Context context);
21 | }
22 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestStreamHandler.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime;
4 |
5 | import java.io.InputStream;
6 | import java.io.OutputStream;
7 | import java.io.IOException;
8 |
9 | /**
10 | * Low-level request-handling interface, Lambda stream request handlers implement AWS Lambda Function application logic
11 | * using input and output stream
12 | */
13 | public interface RequestStreamHandler {
14 | /**
15 | * Handles a Lambda Function request
16 | * @param input The Lambda Function input stream
17 | * @param output The Lambda function output stream
18 | * @param context The Lambda execution environment context object.
19 | * @throws IOException
20 | */
21 | void handleRequest(InputStream input, OutputStream output, Context context) throws IOException;
22 | }
23 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/logging/LogFormat.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime.logging;
4 |
5 |
6 | public enum LogFormat {
7 | JSON,
8 | TEXT;
9 |
10 | public static LogFormat fromString(String logFormat) {
11 | try {
12 | return LogFormat.valueOf(logFormat.toUpperCase());
13 | } catch (Exception e) {
14 | throw new IllegalArgumentException("Invalid log format: '" + logFormat + "' expected one of [JSON, TEXT]");
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/logging/LogLevel.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime.logging;
4 |
5 |
6 | public enum LogLevel {
7 | // UNDEFINED log level is used when the legacy LambdaLogger::log(String) function is called
8 | // where the loglevel is not defined. In this case we're not filtering the message in the runtime
9 | UNDEFINED,
10 | TRACE,
11 | DEBUG,
12 | INFO,
13 | WARN,
14 | ERROR,
15 | FATAL;
16 |
17 | public static LogLevel fromString(String logLevel) {
18 | try {
19 | return LogLevel.valueOf(logLevel.toUpperCase());
20 | } catch (Exception e) {
21 | throw new IllegalArgumentException(
22 | "Invalid log level: '" + logLevel + "' expected one of [TRACE, DEBUG, INFO, WARN, ERROR, FATAL]");
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/v1/DynamodbEventTransformer.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v1;
2 |
3 | import com.amazonaws.services.dynamodbv2.model.Record;
4 | import com.amazonaws.services.lambda.runtime.events.DynamodbEvent;
5 | import com.amazonaws.services.lambda.runtime.events.transformers.v1.dynamodb.DynamodbRecordTransformer;
6 |
7 | import java.util.List;
8 | import java.util.Objects;
9 | import java.util.stream.Collectors;
10 |
11 | public class DynamodbEventTransformer {
12 |
13 | public static List toRecordsV1(final DynamodbEvent dynamodbEvent) {
14 | return dynamodbEvent
15 | .getRecords()
16 | .stream()
17 | .filter(record -> !Objects.isNull(record))
18 | .map(DynamodbRecordTransformer::toRecordV1)
19 | .collect(Collectors.toList());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/v1/dynamodb/DynamodbIdentityTransformer.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v1.dynamodb;
2 |
3 | import com.amazonaws.services.dynamodbv2.model.Identity;
4 |
5 | public class DynamodbIdentityTransformer {
6 |
7 | public static Identity toIdentityV1(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity identity) {
8 | return new Identity()
9 | .withPrincipalId(identity.getPrincipalId())
10 | .withType(identity.getType());
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/v1/dynamodb/DynamodbRecordTransformer.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v1.dynamodb;
2 |
3 | import com.amazonaws.services.dynamodbv2.model.Record;
4 | import com.amazonaws.services.lambda.runtime.events.DynamodbEvent;
5 |
6 | public class DynamodbRecordTransformer {
7 |
8 | public static Record toRecordV1(final DynamodbEvent.DynamodbStreamRecord record) {
9 | return new Record()
10 | .withAwsRegion(record.getAwsRegion())
11 | .withDynamodb(
12 | DynamodbStreamRecordTransformer.toStreamRecordV1(record.getDynamodb())
13 | )
14 | .withEventID(record.getEventID())
15 | .withEventName(record.getEventName())
16 | .withEventSource(record.getEventSource())
17 | .withEventVersion(record.getEventVersion())
18 | .withUserIdentity(
19 | record.getUserIdentity() != null
20 | ? DynamodbIdentityTransformer.toIdentityV1(record.getUserIdentity())
21 | : null
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/v2/DynamodbEventTransformer.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v2;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.DynamodbEvent;
4 | import com.amazonaws.services.lambda.runtime.events.transformers.v2.dynamodb.DynamodbRecordTransformer;
5 | import software.amazon.awssdk.services.dynamodb.model.Record;
6 |
7 | import java.util.List;
8 | import java.util.Objects;
9 | import java.util.stream.Collectors;
10 |
11 | public class DynamodbEventTransformer {
12 |
13 | public static List toRecordsV2(final DynamodbEvent dynamodbEvent) {
14 | return dynamodbEvent
15 | .getRecords()
16 | .stream()
17 | .filter(record -> !Objects.isNull(record))
18 | .map(DynamodbRecordTransformer::toRecordV2)
19 | .collect(Collectors.toList());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/v2/dynamodb/DynamodbIdentityTransformer.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v2.dynamodb;
2 |
3 | import software.amazon.awssdk.services.dynamodb.model.Identity;
4 |
5 | public class DynamodbIdentityTransformer {
6 |
7 | public static Identity toIdentityV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity identity) {
8 | return Identity.builder()
9 | .principalId(identity.getPrincipalId())
10 | .type(identity.getType())
11 | .build();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/v2/dynamodb/DynamodbRecordTransformer.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v2.dynamodb;
2 |
3 | import com.amazonaws.services.lambda.runtime.events.DynamodbEvent;
4 | import software.amazon.awssdk.services.dynamodb.model.Record;
5 |
6 | public class DynamodbRecordTransformer {
7 |
8 | public static Record toRecordV2(final DynamodbEvent.DynamodbStreamRecord record) {
9 | return Record.builder()
10 | .awsRegion(record.getAwsRegion())
11 | .dynamodb(
12 | DynamodbStreamRecordTransformer.toStreamRecordV2(record.getDynamodb())
13 | )
14 | .eventID(record.getEventID())
15 | .eventName(record.getEventName())
16 | .eventSource(record.getEventSource())
17 | .eventVersion(record.getEventVersion())
18 | .userIdentity(
19 | record.getUserIdentity() != null
20 | ? DynamodbIdentityTransformer.toIdentityV2(record.getUserIdentity())
21 | : null
22 | )
23 | .build();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/v2/dynamodb/DynamodbStreamRecordTransformer.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v2.dynamodb;
2 |
3 | import software.amazon.awssdk.services.dynamodb.model.StreamRecord;
4 |
5 | public class DynamodbStreamRecordTransformer {
6 |
7 | public static StreamRecord toStreamRecordV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord) {
8 |
9 | return StreamRecord.builder()
10 | .approximateCreationDateTime(
11 | streamRecord.getApproximateCreationDateTime().toInstant()
12 | )
13 | .keys(
14 | DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getKeys())
15 | )
16 | .newImage(
17 | streamRecord.getNewImage() != null
18 | ? DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getNewImage())
19 | : null
20 | )
21 | .oldImage(
22 | streamRecord.getOldImage() != null
23 | ? DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getOldImage())
24 | : null
25 | )
26 | .sequenceNumber(streamRecord.getSequenceNumber())
27 | .sizeBytes(streamRecord.getSizeBytes())
28 | .streamViewType(streamRecord.getStreamViewType())
29 | .build();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/test/java/com/amazonaws/services/lambda/runtime/events/transformers/v1/dynamodb/DynamodbIdentityTransformerTest.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v1.dynamodb;
2 |
3 | import com.amazonaws.services.dynamodbv2.model.Identity;
4 | import org.junit.jupiter.api.Assertions;
5 | import org.junit.jupiter.api.Test;
6 |
7 | class DynamodbIdentityTransformerTest {
8 |
9 | private static final String principalId = "1234567890";
10 | private static final String identityType = "type";
11 |
12 | //region Identity_event
13 | public static final com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity identity_event = new com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity()
14 | .withPrincipalId(principalId)
15 | .withType(identityType);
16 | //endregion
17 |
18 | //region Identity_v1
19 | public static final Identity identity_v1 = new Identity()
20 | .withPrincipalId(principalId)
21 | .withType(identityType);
22 | //endregion
23 |
24 | @Test
25 | public void testToIdentityV1() {
26 | Identity convertedIdentity = DynamodbIdentityTransformer.toIdentityV1(identity_event);
27 | Assertions.assertEquals(identity_v1, convertedIdentity);
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events-sdk-transformer/src/test/java/com/amazonaws/services/lambda/runtime/events/transformers/v2/dynamodb/DynamodbIdentityTransformerTest.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events.transformers.v2.dynamodb;
2 |
3 | import org.junit.jupiter.api.Assertions;
4 | import org.junit.jupiter.api.Test;
5 | import software.amazon.awssdk.services.dynamodb.model.Identity;
6 |
7 | class DynamodbIdentityTransformerTest {
8 |
9 | private static final String principalId = "1234567890";
10 | private static final String identityType = "type";
11 |
12 | //region Identity_event
13 | public static final com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity identity_event =
14 | new com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity()
15 | .withPrincipalId(principalId)
16 | .withType(identityType);
17 | //endregion
18 |
19 | //region Identity_v2
20 | public static final Identity identity_v2 = Identity.builder()
21 | .principalId(principalId)
22 | .type(identityType)
23 | .build();
24 | //endregion
25 |
26 | @Test
27 | public void testToIdentityV2() {
28 | Identity convertedIdentity = DynamodbIdentityTransformer.toIdentityV2(identity_event);
29 | Assertions.assertEquals(identity_v2, convertedIdentity);
30 | }
31 |
32 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2HTTPResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 | * the License. A copy of the License is located at
6 | *
7 | * http://aws.amazon.com/apache2.0
8 | *
9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 | * and limitations under the License.
12 | */
13 |
14 | package com.amazonaws.services.lambda.runtime.events;
15 |
16 | import lombok.AllArgsConstructor;
17 | import lombok.Builder;
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 |
21 | import java.util.List;
22 | import java.util.Map;
23 |
24 | @AllArgsConstructor
25 | @Builder(setterPrefix = "with")
26 | @Data
27 | @NoArgsConstructor
28 | public class APIGatewayV2HTTPResponse {
29 | private int statusCode;
30 | private Map headers;
31 | private Map> multiValueHeaders;
32 | private List cookies;
33 | private String body;
34 | private boolean isBase64Encoded;
35 | }
36 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | /**
4 | * @deprecated
5 | * This class is for use with API Gateway WebSockets, and has been renamed explicitly as {@link APIGatewayV2WebSocketEvent}
6 | * To integrate with API Gateway's HTTP API Events, use one of:
7 | * * {@link APIGatewayV2HTTPEvent} (payload version 2.0)
8 | * * {@link APIGatewayProxyRequestEvent} (payload version 1.0)
9 | */
10 | @Deprecated()
11 | public class APIGatewayV2ProxyRequestEvent extends APIGatewayV2WebSocketEvent {}
12 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | /**
4 | * @deprecated
5 | * This class is for responding to API Gateway WebSocket events, and has been renamed explicitly as {@link APIGatewayV2WebSocketResponse}
6 | * To response to API Gateway's HTTP API Events, use {@link APIGatewayV2HTTPResponse}
7 | */
8 | @Deprecated
9 | public class APIGatewayV2ProxyResponseEvent extends APIGatewayV2WebSocketResponse {}
10 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 | * the License. A copy of the License is located at
6 | *
7 | * http://aws.amazon.com/apache2.0
8 | *
9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 | * and limitations under the License.
12 | */
13 | package com.amazonaws.services.lambda.runtime.events;
14 |
15 | import java.util.Map;
16 | import java.util.List;
17 |
18 | import lombok.AllArgsConstructor;
19 | import lombok.Builder;
20 | import lombok.Data;
21 | import lombok.NoArgsConstructor;
22 |
23 | /**
24 | * Class that represents the output from an AppSync Lambda authorizer invocation.
25 | */
26 | @Data
27 | @Builder(setterPrefix = "with")
28 | @NoArgsConstructor
29 | @AllArgsConstructor
30 | public class AppSyncLambdaAuthorizerResponse {
31 |
32 | private boolean isAuthorized;
33 | private Map resolverContext;
34 | private List deniedFields;
35 | private int ttlOverride;
36 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerRequestEvent.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 |
6 | import java.io.Serializable;
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | /**
11 | * Class to represent the request event from Application Load Balancer.
12 | *
13 | * @see Using AWS Lambda with an Application Load Balancer
14 | *
15 | * @author msailes
16 | */
17 |
18 | @NoArgsConstructor
19 | @Data
20 | public class ApplicationLoadBalancerRequestEvent implements Serializable, Cloneable {
21 |
22 | @NoArgsConstructor
23 | @Data
24 | public static class Elb implements Serializable, Cloneable {
25 |
26 | private String targetGroupArn;
27 |
28 | }
29 |
30 | @NoArgsConstructor
31 | @Data
32 | public static class RequestContext implements Serializable, Cloneable {
33 |
34 | private Elb elb;
35 |
36 | }
37 |
38 | private RequestContext requestContext;
39 | private String httpMethod;
40 | private String path;
41 | private Map queryStringParameters;
42 | private Map> multiValueQueryStringParameters;
43 | private Map headers;
44 | private Map> multiValueHeaders;
45 | private String body;
46 | private boolean isBase64Encoded;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerResponseEvent.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 |
6 | import java.io.Serializable;
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | /**
11 | * Class to represent the response event to Application Load Balancer.
12 | *
13 | * @see Using AWS Lambda with an Application Load Balancer
14 | *
15 | * @author msailes
16 | */
17 |
18 | @NoArgsConstructor
19 | @Data
20 | public class ApplicationLoadBalancerResponseEvent implements Serializable, Cloneable {
21 |
22 | private int statusCode;
23 | private String statusDescription;
24 | private boolean isBase64Encoded;
25 | private Map headers;
26 | private Map> multiValueHeaders;
27 | private String body;
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/MSKFirehoseEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.events;
7 |
8 | import java.nio.ByteBuffer;
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | import lombok.AllArgsConstructor;
13 | import lombok.Builder;
14 | import lombok.Data;
15 | import lombok.NoArgsConstructor;
16 |
17 | @Data
18 | @Builder(setterPrefix = "with")
19 | @NoArgsConstructor
20 | @AllArgsConstructor
21 |
22 | public class MSKFirehoseEvent {
23 |
24 | private String invocationId;
25 |
26 | private String deliveryStreamArn;
27 |
28 | private String sourceMSKArn;
29 |
30 | private String region;
31 |
32 | private List records;
33 |
34 | @Data
35 | @Builder(setterPrefix = "with")
36 | @NoArgsConstructor
37 | @AllArgsConstructor
38 | public static class Record {
39 |
40 | private ByteBuffer kafkaRecordValue;
41 |
42 | private String recordId;
43 |
44 | private Long approximateArrivalEpoch;
45 |
46 | private Long approximateArrivalTimestamp;
47 |
48 | private Map mskRecordMetadata;
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/S3BatchEvent.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Event to represent the payload which is sent to Lambda by S3 Batch to perform a custom
12 | * action.
13 | *
14 | * https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-invoke-lambda.html
15 | */
16 |
17 | @Data
18 | @Builder(setterPrefix = "with")
19 | @NoArgsConstructor
20 | @AllArgsConstructor
21 | public class S3BatchEvent {
22 |
23 | private String invocationSchemaVersion;
24 | private String invocationId;
25 | private Job job;
26 | private List tasks;
27 |
28 | @Data
29 | @Builder(setterPrefix = "with")
30 | @NoArgsConstructor
31 | @AllArgsConstructor
32 | public static class Job {
33 |
34 | private String id;
35 | }
36 |
37 | @Data
38 | @Builder(setterPrefix = "with")
39 | @NoArgsConstructor
40 | @AllArgsConstructor
41 | public static class Task {
42 |
43 | private String taskId;
44 | private String s3Key;
45 | private String s3VersionId;
46 | private String s3BucketArn;
47 | }
48 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/S3BatchEventV2.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import java.util.List;
9 | import java.util.Map;
10 |
11 | /**
12 | * Event to represent the payload which is sent to Lambda by S3 Batch to perform a custom
13 | * action when using invocation schema version 2.0.
14 | *
15 | * https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-invoke-lambda.html
16 | */
17 |
18 | @Data
19 | @Builder(setterPrefix = "with")
20 | @NoArgsConstructor
21 | @AllArgsConstructor
22 | public class S3BatchEventV2 {
23 |
24 | private String invocationSchemaVersion;
25 | private String invocationId;
26 | private Job job;
27 | private List tasks;
28 |
29 | @Data
30 | @Builder(setterPrefix = "with")
31 | @NoArgsConstructor
32 | @AllArgsConstructor
33 | public static class Job {
34 |
35 | private String id;
36 | private Map userArguments;
37 | }
38 |
39 | @Data
40 | @Builder(setterPrefix = "with")
41 | @NoArgsConstructor
42 | @AllArgsConstructor
43 | public static class Task {
44 |
45 | private String taskId;
46 | private String s3Key;
47 | private String s3VersionId;
48 | private String s3Bucket;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SecretsManagerRotationEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 | * the License. A copy of the License is located at
6 | *
7 | * http://aws.amazon.com/apache2.0
8 | *
9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 | * and limitations under the License.
12 | */
13 |
14 | package com.amazonaws.services.lambda.runtime.events;
15 |
16 | import lombok.AllArgsConstructor;
17 | import lombok.Builder;
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 |
21 | /**
22 | * Class to represent the events which are sent during a Secrets Manager rotation process.
23 | *
24 | * @see Rotating secrets lambda function overview
25 | *
26 | * @author msailes
27 | */
28 |
29 | @Data
30 | @Builder(setterPrefix = "with")
31 | @NoArgsConstructor
32 | @AllArgsConstructor
33 | public class SecretsManagerRotationEvent {
34 |
35 | private String step;
36 | private String secretId;
37 | private String clientRequestToken;
38 | private String rotationToken;
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SimpleIAMPolicyResponse.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import java.util.Map;
9 |
10 | /**
11 | * The simplified IAM Policy response object as described in https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html
12 | *
13 | */
14 |
15 | @Data
16 | @Builder(setterPrefix = "with")
17 | @NoArgsConstructor
18 | @AllArgsConstructor
19 | public class SimpleIAMPolicyResponse {
20 |
21 | private boolean isAuthorized;
22 | private Map context;
23 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/models/TimeWindow.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 | * the License. A copy of the License is located at
6 | *
7 | * http://aws.amazon.com/apache2.0
8 | *
9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 | * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 | * and limitations under the License.
12 | */
13 |
14 | package com.amazonaws.services.lambda.runtime.events.models;
15 |
16 | import lombok.AllArgsConstructor;
17 | import lombok.Builder;
18 | import lombok.Data;
19 | import lombok.NoArgsConstructor;
20 |
21 | /**
22 | * Represents a time window.
23 | */
24 | @Data
25 | @Builder(setterPrefix = "with")
26 | @NoArgsConstructor
27 | @AllArgsConstructor
28 | public class TimeWindow {
29 |
30 | /**
31 | * Window start instant represented as ISO-8601 string.
32 | */
33 | private String start;
34 |
35 | /**
36 | * Window end instant represented as ISO-8601 string.
37 | */
38 | private String end;
39 | }
40 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/main/java/lombok.config:
--------------------------------------------------------------------------------
1 | lombok.getter.noIsPrefix = true
2 |
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/test/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2CustomAuthorizerEventTest.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.events;
2 |
3 | import org.junit.jupiter.api.Test;
4 |
5 | import java.time.Instant;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertEquals;
8 | import static org.junit.jupiter.api.Assertions.assertNotNull;
9 |
10 | public class APIGatewayV2CustomAuthorizerEventTest {
11 |
12 | private static final long TIME_EPOCH = 1601306426515L;
13 | private static final String TIME = "28/Sep/2020:15:14:43 +0000";
14 |
15 | @Test
16 | public void testEpochLongAsAnInstant() {
17 | APIGatewayV2CustomAuthorizerEvent customAuthorizerEvent = APIGatewayV2CustomAuthorizerEvent.builder()
18 | .withRequestContext(APIGatewayV2CustomAuthorizerEvent.RequestContext.builder()
19 | .withTimeEpoch(TIME_EPOCH)
20 | .build())
21 | .build();
22 |
23 | assertEquals(Instant.ofEpochMilli(1601306426515L), customAuthorizerEvent.getRequestContext().getTimeEpoch());
24 | }
25 |
26 | @Test
27 | public void testTimeStringAsDateTime() {
28 | APIGatewayV2CustomAuthorizerEvent customAuthorizerEvent = APIGatewayV2CustomAuthorizerEvent.builder()
29 | .withRequestContext(APIGatewayV2CustomAuthorizerEvent.RequestContext.builder()
30 | .withTime(TIME)
31 | .build())
32 | .build();
33 |
34 | assertNotNull(customAuthorizerEvent.getRequestContext().getTime());
35 | }
36 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/test/resources/iamPolicyResponses/allow-with-condition.json:
--------------------------------------------------------------------------------
1 | {
2 | "principalId": "me",
3 | "policyDocument": {
4 | "Version": "2012-10-17",
5 | "Statement": [{
6 | "Action": "execute-api:Invoke",
7 | "Resource": ["arn:aws:execute-api:eu-west-1:123456789012:1234abc/$deafult/*/*"],
8 | "Effect": "Allow",
9 | "Condition": {"DateGreaterThan": {"aws:TokenIssueTime": "2020-01-01T00:00:01Z"}}
10 | }]
11 | },
12 | "context":null
13 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/test/resources/iamPolicyResponses/allow.json:
--------------------------------------------------------------------------------
1 | {
2 | "principalId": "me",
3 | "policyDocument": {
4 | "Version": "2012-10-17",
5 | "Statement": [{
6 | "Action": "execute-api:Invoke",
7 | "Resource": ["arn:aws:execute-api:eu-west-1:123456789012:1234abc/$deafult/*/*"],
8 | "Effect": "Allow",
9 | "Condition": null
10 | }]
11 | },
12 | "context":null
13 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/test/resources/iamPolicyResponses/deny.json:
--------------------------------------------------------------------------------
1 | {
2 | "principalId": "me",
3 | "policyDocument": {
4 | "Version": "2012-10-17",
5 | "Statement": [{
6 | "Action": "execute-api:Invoke",
7 | "Resource": ["arn:aws:execute-api:eu-west-1:123456789012:1234abc/$deafult/*/*"],
8 | "Effect": "Deny",
9 | "Condition": null
10 | }]
11 | },
12 | "context":null
13 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/test/resources/iamPolicyV1Responses/allow-with-condition.json:
--------------------------------------------------------------------------------
1 | {
2 | "principalId": "me",
3 | "policyDocument": {
4 | "Version": "2012-10-17",
5 | "Statement": [{
6 | "Action": "execute-api:Invoke",
7 | "Resource": ["arn:aws:execute-api:eu-west-1:123456789012:1234abc/$deafult/*/*"],
8 | "Effect": "Allow",
9 | "Condition": {"DateGreaterThan": {"aws:TokenIssueTime": "2020-01-01T00:00:01Z"}}
10 | }]
11 | },
12 | "context":null,
13 | "usageIdentifierKey": "123ABC"
14 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/test/resources/iamPolicyV1Responses/allow.json:
--------------------------------------------------------------------------------
1 | {
2 | "principalId": "me",
3 | "policyDocument": {
4 | "Version": "2012-10-17",
5 | "Statement": [{
6 | "Action": "execute-api:Invoke",
7 | "Resource": ["arn:aws:execute-api:eu-west-1:123456789012:1234abc/$deafult/*/*"],
8 | "Effect": "Allow",
9 | "Condition": null
10 | }]
11 | },
12 | "context":null,
13 | "usageIdentifierKey": "123ABC"
14 | }
--------------------------------------------------------------------------------
/aws-lambda-java-events/src/test/resources/iamPolicyV1Responses/deny.json:
--------------------------------------------------------------------------------
1 | {
2 | "principalId": "me",
3 | "policyDocument": {
4 | "Version": "2012-10-17",
5 | "Statement": [{
6 | "Action": "execute-api:Invoke",
7 | "Resource": ["arn:aws:execute-api:eu-west-1:123456789012:1234abc/$deafult/*/*"],
8 | "Effect": "Deny",
9 | "Condition": null
10 | }]
11 | },
12 | "context":null,
13 | "usageIdentifierKey": "123ABC"
14 | }
--------------------------------------------------------------------------------
/aws-lambda-java-log4j2/RELEASE.CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### October 24, 2023
2 | `1.6.0`:
3 | - Log level and log format support
4 |
5 | ### January 04, 2022
6 | `1.5.1`:
7 | - Updated `log4j-core` and `log4j-api` dependencies to `2.17.1`
8 |
9 | ### December 18, 2021
10 | `1.5.0`:
11 | - Updated `log4j-core` and `log4j-api` dependencies to `2.17.0`
12 |
13 | ### December 15, 2021
14 | `1.4.0`:
15 | - Updated `log4j-core` and `log4j-api` dependencies to `2.16.0`
16 |
17 | ### December 10, 2021
18 | `1.3.0`:
19 | - Updated `log4j-core` and `log4j-api` dependencies to `2.15.0`
20 |
21 | ### May 05, 2020
22 | `1.2.0`:
23 | - Updated `log4j-core` and `log4j-api` dependencies to `2.13.2`
24 |
25 | ### April 28, 2020
26 | `1.1.1`:
27 | - Added missing XML namespace declarations to `pom.xml` file ([#97](https://github.com/aws/aws-lambda-java-libs/issues/97))
28 | - Updated `nexusUrl` in `pom.xml` file ([#108](https://github.com/aws/aws-lambda-java-libs/issues/108))
29 | - Updated `aws-lambda-java-core` to `1.2.1`
30 |
31 | ### November 21, 2017
32 | `1.1.0`:
33 | - Changed `LambdaAppender.append()` to make use of `LambdaLogger` from `com.amazonaws:aws-lambda-java-core:1.2.0`
34 |
35 | ### June 29, 2017
36 | `1.0.0`:
37 | - Initial release of AWS Lambda Log4j2 support
38 |
--------------------------------------------------------------------------------
/aws-lambda-java-log4j2/src/main/java/com/amazonaws/services/lambda/runtime/log4j2/LambdaJsonFormat.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime.log4j2;
4 |
5 | import org.apache.logging.log4j.core.Layout;
6 | import org.apache.logging.log4j.core.config.plugins.Plugin;
7 | import org.apache.logging.log4j.core.config.plugins.PluginElement;
8 | import org.apache.logging.log4j.core.config.plugins.PluginFactory;
9 |
10 | import java.io.Serializable;
11 |
12 | @Plugin(name = "LambdaJsonFormat", category = "core", printObject = true)
13 | public class LambdaJsonFormat {
14 |
15 | private Layout layout;
16 |
17 | @PluginFactory
18 | public static LambdaJsonFormat createNode(@PluginElement("Layout") Layout extends Serializable> layout) {
19 | return new LambdaJsonFormat(layout);
20 | }
21 |
22 | private LambdaJsonFormat(Layout layout) {
23 | this.layout = layout;
24 | }
25 |
26 | public Layout getLayout() {
27 | return layout;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/aws-lambda-java-log4j2/src/main/java/com/amazonaws/services/lambda/runtime/log4j2/LambdaTextFormat.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package com.amazonaws.services.lambda.runtime.log4j2;
4 |
5 | import org.apache.logging.log4j.core.Layout;
6 | import org.apache.logging.log4j.core.config.plugins.Plugin;
7 | import org.apache.logging.log4j.core.config.plugins.PluginElement;
8 | import org.apache.logging.log4j.core.config.plugins.PluginFactory;
9 |
10 | import java.io.Serializable;
11 |
12 | @Plugin(name = "LambdaTextFormat", category = "core", printObject = true)
13 | public class LambdaTextFormat {
14 |
15 | private Layout layout;
16 |
17 | @PluginFactory
18 | public static LambdaTextFormat createNode(@PluginElement("Layout") Layout extends Serializable> layout) {
19 | return new LambdaTextFormat(layout);
20 | }
21 |
22 | private LambdaTextFormat(Layout layout) {
23 | this.layout = layout;
24 | }
25 |
26 | public Layout getLayout() {
27 | return layout;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/aws-lambda-java-log4j2/src/main/resources/LambdaLayout.json:
--------------------------------------------------------------------------------
1 | {
2 | "timestamp": {
3 | "$resolver": "timestamp",
4 | "pattern": {
5 | "format": "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
6 | "timeZone": "UTC"
7 | }
8 | },
9 | "level": {
10 | "$resolver": "level",
11 | "field": "name"
12 | },
13 | "message": {
14 | "$resolver": "message"
15 | },
16 | "logger": {
17 | "$resolver": "logger",
18 | "field": "name"
19 | },
20 |
21 | "errorType": {
22 | "$resolver": "exception",
23 | "field": "className"
24 | },
25 | "errorMessage": {
26 | "$resolver": "exception",
27 | "field": "message"
28 | },
29 | "stackTrace": {
30 | "$resolver": "exception",
31 | "field": "stackTrace"
32 | },
33 |
34 | "labels": {
35 | "$resolver": "mdc",
36 | "flatten": true,
37 | "stringified": true
38 | }
39 | }
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/.gitignore:
--------------------------------------------------------------------------------
1 | compile-flags.txt
2 | ric-dev-environment/codeartifact-properties.mk
3 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/ric-dev-environment/codeartifact-repo.mk:
--------------------------------------------------------------------------------
1 |
2 | ifneq ("$(wildcard ric-dev-environment/codeartifact-properties.mk)","")
3 |
4 | include ric-dev-environment/codeartifact-properties.mk
5 | $(info Found codeartifact-properties.mk module)
6 |
7 | export MAVEN_REPO_URL:=$(shell aws codeartifact get-repository-endpoint \
8 | --domain ${CODE_ARTIFACT_DOMAIN} \
9 | --repository ${CODE_ARTIFACT_REPO_NAME} \
10 | --format maven \
11 | --output text \
12 | --region ${CODE_ARTIFACT_REPO_REGION})
13 |
14 | export MAVEN_REPO_PASSWORD:=$(shell aws codeartifact get-authorization-token \
15 | --domain ${CODE_ARTIFACT_DOMAIN} \
16 | --domain-owner ${CODE_ARTIFACT_REPO_ACCOUNT} \
17 | --query authorizationToken \
18 | --output text \
19 | --region ${CODE_ARTIFACT_REPO_REGION})
20 |
21 | export MAVEN_REPO_USERNAME:=aws
22 |
23 | $(info MAVEN_REPO_URL: $(MAVEN_REPO_URL))
24 | # $(info MAVEN_REPO_PASSWORD: $(MAVEN_REPO_PASSWORD))
25 | $(info MAVEN_REPO_USERNAME: $(MAVEN_REPO_USERNAME))
26 | $(info CODE_ARTIFACT_REPO_NAME: $(CODE_ARTIFACT_REPO_NAME))
27 | endif
28 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/ric-dev-environment/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | dev-ci
5 |
6 |
7 | ci-repo
8 | ${env.MAVEN_REPO_URL}
9 |
10 |
11 |
12 |
13 |
14 |
15 | ci-repo
16 | ${env.MAVEN_REPO_USERNAME}
17 | ${env.MAVEN_REPO_PASSWORD}
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/ric-dev-environment/test-platform-specific-jar-snapshot.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | projectVersion=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
6 |
7 |
8 | # test uber jar
9 | mvn -B -X -P ci-repo \
10 | dependency:get \
11 | -DremoteRepositories=ci-repo::::$MAVEN_REPO_URL \
12 | -Dartifact=com.amazonaws:aws-lambda-java-runtime-interface-client:${projectVersion}-SNAPSHOT \
13 | -Dtransitive=false \
14 | --settings ric-dev-environment/settings.xml
15 |
16 |
17 | PLATFORM_ARRAY=("linux-x86_64" "linux_musl-x86_64" "linux-aarch_64" "linux_musl-aarch_64")
18 |
19 | for classifier in "${PLATFORM_ARRAY[@]}"; do
20 | # Test platform specific jar
21 | mvn -B -P ci-repo \
22 | dependency:get \
23 | -DremoteRepositories=ci-repo::::$MAVEN_REPO_URL \
24 | -Dartifact=com.amazonaws:aws-lambda-java-runtime-interface-client:${projectVersion}-SNAPSHOT:jar:${classifier} \
25 | -Dtransitive=false \
26 | --settings ric-dev-environment/settings.xml
27 | done
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/crac/CheckpointException.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.crac;
7 |
8 | public class CheckpointException extends Exception {
9 | private static final long serialVersionUID = -4956873658083157585L;
10 | public CheckpointException() {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/crac/Context.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.crac;
7 |
8 | public abstract class Context implements Resource {
9 |
10 | protected Context() {
11 | }
12 |
13 | @Override
14 | public abstract void beforeCheckpoint(Context extends Resource> context)
15 | throws CheckpointException;
16 |
17 | @Override
18 | public abstract void afterRestore(Context extends Resource> context)
19 | throws RestoreException;
20 |
21 | public abstract void register(R resource);
22 | }
23 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/crac/Core.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.crac;
7 |
8 | /**
9 | * Provides the global context for registering resources.
10 | */
11 | public final class Core {
12 |
13 | private static Context globalContext = new ContextImpl();
14 |
15 | private Core() {
16 | }
17 |
18 | public static Context getGlobalContext() {
19 | return globalContext;
20 | }
21 |
22 | public static void checkpointRestore() {
23 | throw new UnsupportedOperationException();
24 | }
25 |
26 | static void resetGlobalContext() {
27 | globalContext = new ContextImpl();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/crac/DNSManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.crac;
7 |
8 | class DNSManager {
9 | static native void clearCache();
10 | }
11 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/crac/Resource.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.crac;
7 |
8 | public interface Resource {
9 | void afterRestore(Context extends Resource> context) throws Exception;
10 |
11 | void beforeCheckpoint(Context extends Resource> context) throws Exception;
12 | }
13 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/crac/RestoreException.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.crac;
7 |
8 | public class RestoreException extends Exception {
9 | private static final long serialVersionUID = -823900409868237860L;
10 |
11 | public RestoreException() {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/LambdaRequestHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client;
7 |
8 | import com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.InvocationRequest;
9 | import java.io.ByteArrayOutputStream;
10 |
11 | public interface LambdaRequestHandler {
12 | ByteArrayOutputStream call(InvocationRequest request) throws Error, Exception;
13 |
14 | static LambdaRequestHandler initErrorHandler(final Throwable e, String className) {
15 | return new UserFaultHandler(UserFault.makeInitErrorUserFault(e, className));
16 | }
17 |
18 | static LambdaRequestHandler classNotFound(final Throwable e, String className) {
19 | return new UserFaultHandler(UserFault.makeClassNotFoundUserFault(e, className));
20 | }
21 |
22 | class UserFaultHandler implements LambdaRequestHandler {
23 | public final UserFault fault;
24 |
25 | public UserFaultHandler(UserFault fault) {
26 | this.fault = fault;
27 | }
28 |
29 | public ByteArrayOutputStream call(InvocationRequest request) {
30 | throw fault;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/TooManyServiceProvidersFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client;
7 |
8 | public class TooManyServiceProvidersFoundException extends RuntimeException {
9 | public TooManyServiceProvidersFoundException() {
10 | }
11 |
12 | public TooManyServiceProvidersFoundException(String errorMessage) {
13 | super(errorMessage);
14 | }
15 |
16 | public TooManyServiceProvidersFoundException(Throwable cause) {
17 | super(cause);
18 | }
19 |
20 | public TooManyServiceProvidersFoundException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/api/LambdaClientContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.api;
7 |
8 | import com.amazonaws.services.lambda.runtime.Client;
9 | import com.amazonaws.services.lambda.runtime.ClientContext;
10 | import java.util.Map;
11 |
12 | public class LambdaClientContext implements ClientContext {
13 |
14 | private LambdaClientContextClient client;
15 | private Map custom;
16 | private Map env;
17 |
18 | public Client getClient() {
19 | return client;
20 | }
21 |
22 | public Map getCustom() {
23 | return custom;
24 | }
25 |
26 | public Map getEnvironment() {
27 | return env;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/api/LambdaClientContextClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.api;
7 |
8 | import com.amazonaws.services.lambda.runtime.Client;
9 |
10 | public class LambdaClientContextClient implements Client {
11 |
12 | private String installation_id;
13 |
14 | private String app_title;
15 |
16 | private String app_version_name;
17 |
18 | private String app_version_code;
19 |
20 | private String app_package_name;
21 |
22 | public String getInstallationId() {
23 | return installation_id;
24 | }
25 |
26 | public String getAppTitle() {
27 | return app_title;
28 | }
29 |
30 | public String getAppVersionName() {
31 | return app_version_name;
32 | }
33 |
34 | public String getAppVersionCode() {
35 | return app_version_code;
36 | }
37 |
38 | public String getAppPackageName() {
39 | return app_package_name;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/api/LambdaCognitoIdentity.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.api;
7 |
8 | import com.amazonaws.services.lambda.runtime.CognitoIdentity;
9 |
10 | public class LambdaCognitoIdentity implements CognitoIdentity {
11 |
12 | private final String cognitoIdentityId;
13 | private final String cognitoIdentityPoolId;
14 |
15 | public LambdaCognitoIdentity(String identityid, String poolid) {
16 | this.cognitoIdentityId = identityid;
17 | this.cognitoIdentityPoolId = poolid;
18 | }
19 |
20 | public String getIdentityId() {
21 | return this.cognitoIdentityId;
22 | }
23 |
24 | public String getIdentityPoolId() {
25 | return this.cognitoIdentityPoolId;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/LambdaContextLogger.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.logging;
7 |
8 | import com.amazonaws.services.lambda.runtime.logging.LogFormat;
9 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
10 | import java.io.Closeable;
11 | import java.io.IOException;
12 | import static java.nio.charset.StandardCharsets.UTF_8;
13 |
14 | public class LambdaContextLogger extends AbstractLambdaLogger implements Closeable {
15 | // If a null string is passed in, replace it with "null",
16 | // replicating the behavior of System.out.println(null);
17 | private static final byte[] NULL_BYTES_VALUE = "null".getBytes(UTF_8);
18 |
19 | private final transient LogSink sink;
20 |
21 | public LambdaContextLogger(LogSink sink, LogLevel logLevel, LogFormat logFormat) {
22 | super(logLevel, logFormat);
23 | this.sink = sink;
24 | }
25 |
26 | @Override
27 | protected void logMessage(byte[] message, LogLevel logLevel) {
28 | if (message == null) {
29 | sink.log(logLevel, this.logFormat, NULL_BYTES_VALUE);
30 | } else {
31 | sink.log(logLevel, this.logFormat, message);
32 | }
33 | }
34 |
35 | @Override
36 | public void close() throws IOException {
37 | sink.close();
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/LogFiltering.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.logging;
7 |
8 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
9 |
10 | public class LogFiltering {
11 | private final LogLevel minimumLogLevel;
12 |
13 | public LogFiltering(LogLevel minimumLogLevel) {
14 | this.minimumLogLevel = minimumLogLevel;
15 | }
16 |
17 | boolean isEnabled(LogLevel logLevel) {
18 | return (logLevel == LogLevel.UNDEFINED || logLevel.ordinal() >= minimumLogLevel.ordinal());
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/LogFormatter.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.logging;
7 |
8 | import com.amazonaws.services.lambda.runtime.api.client.api.LambdaContext;
9 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
10 |
11 | public interface LogFormatter {
12 | String format(String message, LogLevel logLevel);
13 |
14 | default void setLambdaContext(LambdaContext context) {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/LogSink.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.logging;
7 |
8 | import com.amazonaws.services.lambda.runtime.logging.LogFormat;
9 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
10 | import java.io.Closeable;
11 |
12 | public interface LogSink extends Closeable {
13 |
14 | void log(byte[] message);
15 |
16 | void log(LogLevel logLevel, LogFormat logFormat, byte[] message);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/StdOutLogSink.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.logging;
7 |
8 | import com.amazonaws.services.lambda.runtime.logging.LogFormat;
9 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
10 | import java.io.IOException;
11 |
12 | public class StdOutLogSink implements LogSink {
13 | @Override
14 | public void log(byte[] message) {
15 | log(LogLevel.UNDEFINED, LogFormat.TEXT, message);
16 | }
17 |
18 | public void log(LogLevel logLevel, LogFormat logFormat, byte[] message) {
19 | try {
20 | System.out.write(message);
21 | } catch (IOException e) {
22 | e.printStackTrace();
23 | }
24 | }
25 |
26 | @Override
27 | public void close() {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/StructuredLogMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.logging;
7 |
8 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
9 |
10 | class StructuredLogMessage {
11 | public String timestamp;
12 | public String message;
13 | public LogLevel level;
14 | public String AWSRequestId;
15 | public String tenantId;
16 | }
17 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/logging/TextLogFormatter.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.logging;
7 |
8 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
9 | import java.util.HashMap;
10 | import java.util.Map;
11 |
12 | public class TextLogFormatter implements LogFormatter {
13 | private static final Map logLevelMapper = new HashMap() {
14 | {
15 | for (LogLevel logLevel: LogLevel.values()) {
16 | put(logLevel, "[" + logLevel.toString() + "] ");
17 | }
18 | }
19 | };
20 |
21 | @Override
22 | public String format(String message, LogLevel logLevel) {
23 | if (logLevel == LogLevel.UNDEFINED) {
24 | return message;
25 | }
26 |
27 | return new StringBuilder().
28 | append(logLevelMapper.
29 | get(logLevel)).append(message).
30 | toString();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/LambdaError.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi;
6 |
7 | import com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.ErrorRequest;
8 | import com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.XRayErrorCause;
9 |
10 | public class LambdaError {
11 |
12 | public final ErrorRequest errorRequest;
13 |
14 | public final XRayErrorCause xRayErrorCause;
15 |
16 | public final RapidErrorType errorType;
17 |
18 | public LambdaError(ErrorRequest errorRequest, XRayErrorCause xRayErrorCause, RapidErrorType errorType) {
19 | this.errorRequest = errorRequest;
20 | this.xRayErrorCause = xRayErrorCause;
21 | this.errorType = errorType;
22 | }
23 |
24 | public LambdaError(ErrorRequest errorRequest, RapidErrorType errorType) {
25 | this(errorRequest, null, errorType);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/LambdaRuntimeClientException.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi;
6 |
7 | public class LambdaRuntimeClientException extends RuntimeException {
8 | public LambdaRuntimeClientException(String message, int responseCode) {
9 | super(message + " Response code: '" + responseCode + "'.");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/NativeClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi;
6 |
7 | import com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.InvocationRequest;
8 | import static com.amazonaws.services.lambda.runtime.api.client.runtimeapi.LambdaRuntimeApiClientImpl.USER_AGENT;
9 |
10 | /**
11 | * This module defines the native Runtime Interface Client which is responsible for HTTP
12 | * interactions with the Runtime API.
13 | */
14 | class NativeClient {
15 | static void init(String awsLambdaRuntimeApi) {
16 | JniHelper.load();
17 | initializeClient(USER_AGENT.getBytes(), awsLambdaRuntimeApi.getBytes());
18 | }
19 |
20 | static native void initializeClient(byte[] userAgent, byte[] awsLambdaRuntimeApi);
21 |
22 | static native InvocationRequest next();
23 |
24 | static native void postInvocationResponse(byte[] requestId, byte[] response);
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/RapidErrorType.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi;
6 |
7 | public enum RapidErrorType {
8 | BadFunctionCode,
9 | UserException,
10 | BeforeCheckpointError,
11 | AfterRestoreError;
12 |
13 | public String getRapidError() {
14 | return "Runtime." + this;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/converters/LambdaErrorConverter.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi.converters;
6 |
7 | import com.amazonaws.services.lambda.runtime.api.client.UserFault;
8 | import com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.ErrorRequest;
9 |
10 | public class LambdaErrorConverter {
11 | private LambdaErrorConverter() {
12 | }
13 |
14 | public static ErrorRequest fromUserFault(UserFault userFault) {
15 | // Not setting stacktrace for compatibility with legacy/native runtime
16 | return new ErrorRequest(userFault.msg, userFault.exception, null);
17 | }
18 |
19 | public static ErrorRequest fromThrowable(Throwable throwable) {
20 | String errorMessage = throwable.getLocalizedMessage() == null
21 | ? throwable.getClass().getName()
22 | : throwable.getLocalizedMessage();
23 | String errorType = throwable.getClass().getName();
24 |
25 | StackTraceElement[] trace = throwable.getStackTrace();
26 | String[] stackTrace = new String[trace.length];
27 | for (int i = 0; i < trace.length; i++) {
28 | stackTrace[i] = trace[i].toString();
29 | }
30 | return new ErrorRequest(errorMessage, errorType, stackTrace);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/dto/ErrorRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto;
6 |
7 | public class ErrorRequest {
8 | public String errorMessage;
9 | public String errorType;
10 | public String[] stackTrace;
11 |
12 | @SuppressWarnings("unused")
13 | public ErrorRequest() {
14 | }
15 |
16 | public ErrorRequest(String errorMessage, String errorType, String[] stackTrace) {
17 | this.errorMessage = errorMessage;
18 | this.errorType = errorType;
19 | this.stackTrace = stackTrace;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/dto/StackElement.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto;
6 |
7 | public class StackElement {
8 | public String label;
9 | public String path;
10 | public int line;
11 |
12 | @SuppressWarnings("unused")
13 | public StackElement() {
14 | }
15 |
16 | public StackElement(String label, String path, int line) {
17 | this.label = label;
18 | this.path = path;
19 | this.line = line;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/dto/XRayErrorCause.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto;
6 |
7 | import java.util.Collection;
8 |
9 | public class XRayErrorCause {
10 | public String working_directory;
11 | public Collection exceptions;
12 | public Collection paths;
13 |
14 | @SuppressWarnings("unused")
15 | public XRayErrorCause() {
16 |
17 | }
18 |
19 | public XRayErrorCause(String working_directory, Collection exceptions, Collection paths) {
20 | this.working_directory = working_directory;
21 | this.exceptions = exceptions;
22 | this.paths = paths;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/runtimeapi/dto/XRayException.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | package com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto;
6 |
7 | import java.util.List;
8 |
9 | public class XRayException {
10 | public String message;
11 | public String type;
12 | public List stack;
13 |
14 | @SuppressWarnings("unused")
15 | public XRayException() {
16 | }
17 |
18 | public XRayException(String message, String type, List stack) {
19 | this.message = message;
20 | this.type = type;
21 | this.stack = stack;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/util/EnvReader.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.util;
7 |
8 | import java.util.Map;
9 |
10 | public class EnvReader {
11 |
12 | public Map getEnv() {
13 | return System.getenv();
14 | }
15 |
16 | public String getEnv(String envVariableName) {
17 | return System.getenv(envVariableName);
18 | }
19 |
20 | public String getEnvOrDefault(String envVariableName, String defaultVal) {
21 | String val = getEnv(envVariableName);
22 | return val == null ? defaultVal : val;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/util/LambdaOutputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.util;
7 |
8 | import java.io.IOException;
9 | import java.io.OutputStream;
10 |
11 | public class LambdaOutputStream extends OutputStream {
12 | private final OutputStream inner;
13 |
14 | public LambdaOutputStream(OutputStream inner) {
15 | this.inner = inner;
16 | }
17 |
18 | @Override
19 | public void write(int b) throws IOException {
20 | write(new byte[]{(byte) b});
21 | }
22 |
23 | @Override
24 | public void write(byte[] bytes) throws IOException {
25 | write(bytes, 0, bytes.length);
26 |
27 | }
28 |
29 | @Override
30 | public void write(byte[] bytes, int offset, int length) throws IOException {
31 | inner.write(bytes, offset, length);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/util/UnsafeUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package com.amazonaws.services.lambda.runtime.api.client.util;
7 |
8 | import java.lang.reflect.Field;
9 | import sun.misc.Unsafe;
10 |
11 | /**
12 | * Utilities for easy access to sun.misc.Unsafe
13 | */
14 | public final class UnsafeUtil {
15 | public static final Unsafe TheUnsafe;
16 |
17 | static {
18 | try {
19 | final Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
20 | theUnsafe.setAccessible(true);
21 | TheUnsafe = (Unsafe) theUnsafe.get(null);
22 | } catch (Exception e) {
23 | throw new Error("failed to load Unsafe", e);
24 | }
25 | }
26 |
27 | private UnsafeUtil() {
28 | }
29 |
30 | public static void disableIllegalAccessWarning() {
31 | try {
32 | Class illegalAccessLoggerClass = Class.forName("jdk.internal.module.IllegalAccessLogger");
33 | Field loggerField = illegalAccessLoggerClass.getDeclaredField("logger");
34 | TheUnsafe.putObjectVolatile(illegalAccessLoggerClass, TheUnsafe.staticFieldOffset(loggerField), null);
35 | } catch (Throwable t) { /* ignore */ }
36 | }
37 |
38 | public static RuntimeException throwException(Throwable t) {
39 | TheUnsafe.throwException(t);
40 | throw new Error("should never get here");
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/com_amazonaws_services_lambda_crac_DNSManager.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | #include
6 | #include "macro.h"
7 | #include "com_amazonaws_services_lambda_crac_DNSManager.h"
8 |
9 | JNIEXPORT void JNICALL Java_com_amazonaws_services_lambda_crac_DNSManager_clearCache
10 | (JNIEnv *env, jclass thisClass) {
11 | jclass iNetAddressClass;
12 | jclass concurrentMap;
13 | jfieldID cacheFieldID;
14 | jobject cacheObj;
15 | jmethodID clearMethodID;
16 | CHECK_EXCEPTION(env, iNetAddressClass = env->FindClass("java/net/InetAddress"));
17 | CHECK_EXCEPTION(env, concurrentMap = env->FindClass("java/util/concurrent/ConcurrentMap"));
18 | CHECK_EXCEPTION(env, cacheFieldID = env->GetStaticFieldID(iNetAddressClass, "cache", "Ljava/util/concurrent/ConcurrentMap;"));
19 | CHECK_EXCEPTION(env, cacheObj = (jobject) env->GetStaticObjectField(iNetAddressClass, cacheFieldID));
20 | CHECK_EXCEPTION(env, clearMethodID = env->GetMethodID(concurrentMap, "clear", "()V"));
21 | CHECK_EXCEPTION(env, env->CallVoidMethod(cacheObj, clearMethodID));
22 | return;
23 |
24 | ERROR:
25 | // we need to fail silently here
26 | env->ExceptionClear();
27 | }
28 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/com_amazonaws_services_lambda_crac_DNSManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | #include
6 |
7 | #ifndef _Included_com_amazonaws_services_lambda_crac_DNSManager
8 | #define _Included_com_amazonaws_services_lambda_crac_DNSManager
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | JNIEXPORT void JNICALL Java_com_amazonaws_services_lambda_crac_DNSManager_clearCache
14 | (JNIEnv *, jclass);
15 |
16 | #ifdef __cplusplus
17 | }
18 | #endif
19 | #endif
20 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 | #include
6 |
7 | #ifndef _Included_com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient
8 | #define _Included_com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | JNIEXPORT void JNICALL Java_com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient_initializeClient
14 | (JNIEnv *, jobject, jbyteArray, jbyteArray);
15 |
16 | JNIEXPORT jobject JNICALL Java_com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient_next
17 | (JNIEnv *, jobject);
18 |
19 | JNIEXPORT void JNICALL Java_com_amazonaws_services_lambda_runtime_api_client_runtimeapi_NativeClient_postInvocationResponse
20 | (JNIEnv *, jobject, jbyteArray, jbyteArray);
21 |
22 | #ifdef __cplusplus
23 | }
24 | #endif
25 | #endif
26 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | *Issue #, if available:*
2 |
3 | *Description of changes:*
4 |
5 |
6 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
7 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | tags
3 | TODO
4 | compile_commands.json
5 | .clangd
6 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/NOTICE:
--------------------------------------------------------------------------------
1 | AWS Lambda Cpp Runtime
2 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/ci/codebuild/amazonlinux-2017.03.yml:
--------------------------------------------------------------------------------
1 | version: 0.1
2 | # This uses the docker image specified in ci/docker/amazon-linux-2017.03
3 | phases:
4 | pre_build:
5 | commands:
6 | - alias cmake=cmake3
7 | - pip install awscli
8 | - ci/codebuild/build-cpp-sdk.sh
9 | build:
10 | commands:
11 | - echo Build started on `date`
12 | - ci/codebuild/build.sh -DENABLE_TESTS=ON -DTEST_RESOURCE_PREFIX=amzn201703
13 | - ci/codebuild/run-tests.sh aws-lambda-package-lambda-test-fun amzn201703
14 | - ci/codebuild/run-tests.sh aws-lambda-package-lambda-test-fun-no-glibc amzn201703
15 | post_build:
16 | commands:
17 | - echo Build completed on `date`
18 |
19 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/ci/codebuild/build-cpp-sdk.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | # build the AWS C++ SDK
6 | cd /aws-sdk-cpp
7 | git pull
8 | mkdir build
9 | cd build
10 | cmake .. -GNinja -DBUILD_ONLY="lambda" \
11 | -DCMAKE_BUILD_TYPE=Release \
12 | -DENABLE_UNITY_BUILD=ON \
13 | -DBUILD_SHARED_LIBS=ON \
14 | -DENABLE_TESTING=OFF \
15 | -DCMAKE_INSTALL_PREFIX=/install $@
16 | ninja
17 | ninja install
18 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/ci/codebuild/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | # build the lambda-runtime
6 | cd $CODEBUILD_SRC_DIR
7 | mkdir build
8 | cd build
9 | cmake .. -GNinja -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/install $@
10 | ninja
11 | ninja install
12 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/ci/codebuild/format-check.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | CLANG_FORMAT=clang-format
6 |
7 | if NOT type $CLANG_FORMAT > /dev/null 2>&1; then
8 | echo "No appropriate clang-format found."
9 | exit 1
10 | fi
11 |
12 | FAIL=0
13 | SOURCE_FILES=$(find src include tests -type f -name "*.h" -o -name "*.cpp")
14 | for i in $SOURCE_FILES
15 | do
16 | if [ $($CLANG_FORMAT -output-replacements-xml $i | grep -c "
18 | DEPENDS ${target})
19 | endfunction()
20 |
21 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/examples/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine:latest
2 |
3 | RUN apk update && apk add cmake make git g++ bash curl-dev zlib-dev
4 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/examples/api-gateway/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 | set(CMAKE_CXX_STANDARD 11)
3 |
4 | project(api LANGUAGES CXX)
5 |
6 | find_package(aws-lambda-runtime REQUIRED)
7 | find_package(AWSSDK COMPONENTS core)
8 |
9 | add_executable(${PROJECT_NAME} "main.cpp")
10 | target_link_libraries(${PROJECT_NAME} PUBLIC AWS::aws-lambda-runtime ${AWSSDK_LINK_LIBRARIES})
11 |
12 | aws_lambda_package_target(${PROJECT_NAME})
13 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/examples/dynamodb/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 | set(CMAKE_CXX_STANDARD 11)
3 | project(ddb-demo LANGUAGES CXX)
4 |
5 | find_package(aws-lambda-runtime)
6 | find_package(AWSSDK COMPONENTS dynamodb)
7 |
8 | add_executable(${PROJECT_NAME} "main.cpp")
9 |
10 | target_link_libraries(${PROJECT_NAME} PUBLIC AWS::aws-lambda-runtime ${AWSSDK_LINK_LIBRARIES})
11 |
12 | target_compile_options(${PROJECT_NAME} PRIVATE
13 | "-fno-exceptions"
14 | "-fno-rtti"
15 | "-Wall"
16 | "-Wextra"
17 | "-Werror"
18 | "-Wconversion"
19 | "-Wno-sign-conversion")
20 |
21 | target_compile_features(${PROJECT_NAME} PRIVATE "cxx_std_11")
22 |
23 | aws_lambda_package_target(${PROJECT_NAME})
24 |
25 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/examples/s3/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 | set(CMAKE_CXX_STANDARD 11)
3 | project(encoder LANGUAGES CXX)
4 |
5 | find_package(aws-lambda-runtime)
6 | find_package(AWSSDK COMPONENTS s3)
7 |
8 | add_executable(${PROJECT_NAME} "main.cpp")
9 |
10 | target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-lambda-runtime ${AWSSDK_LINK_LIBRARIES})
11 |
12 | target_compile_options(${PROJECT_NAME} PRIVATE
13 | "-Wall"
14 | "-Wextra"
15 | "-Wconversion"
16 | "-Wshadow"
17 | "-Wno-sign-conversion")
18 |
19 | target_compile_features(${PROJECT_NAME} PRIVATE "cxx_std_11")
20 |
21 | aws_lambda_package_target(${PROJECT_NAME})
22 |
23 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/include/aws/lambda-runtime/version.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /*
3 | * Copyright 2018-present Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License").
6 | * You may not use this file except in compliance with the License.
7 | * A copy of the License is located at
8 | *
9 | * http://aws.amazon.com/apache2.0
10 | *
11 | * or in the "license" file accompanying this file. This file is distributed
12 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied. See the License for the specific language governing
14 | * permissions and limitations under the License.
15 | */
16 |
17 | namespace aws {
18 | namespace lambda_runtime {
19 |
20 | /**
21 | * Returns the major component of the library version.
22 | */
23 | unsigned get_version_major();
24 |
25 | /**
26 | * Returns the minor component of the library version.
27 | */
28 | unsigned get_version_minor();
29 |
30 | /**
31 | * Returns the patch component of the library version.
32 | */
33 | unsigned get_version_patch();
34 |
35 | /**
36 | * Returns the semantic version of the library in the form Major.Minor.Patch
37 | */
38 | char const* get_version();
39 |
40 | } // namespace lambda_runtime
41 | } // namespace aws
42 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/src/backward.cpp:
--------------------------------------------------------------------------------
1 | // Pick your poison.
2 | //
3 | // On GNU/Linux, you have few choices to get the most out of your stack trace.
4 | //
5 | // By default you get:
6 | // - object filename
7 | // - function name
8 | //
9 | // In order to add:
10 | // - source filename
11 | // - line and column numbers
12 | // - source code snippet (assuming the file is accessible)
13 |
14 | // Install one of the following library then uncomment one of the macro (or
15 | // better, add the detection of the lib and the macro definition in your build
16 | // system)
17 |
18 | // - apt-get install libdw-dev ...
19 | // - g++/clang++ -ldw ...
20 | // #define BACKWARD_HAS_DW 1
21 |
22 | // - apt-get install binutils-dev ...
23 | // - g++/clang++ -lbfd ...
24 | // #define BACKWARD_HAS_BFD 1
25 |
26 | #include "backward.h"
27 |
28 | namespace backward {
29 |
30 | backward::SignalHandling sh;
31 |
32 | } // namespace backward
33 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/src/version.cpp.in:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License").
5 | * You may not use this file except in compliance with the License.
6 | * A copy of the License is located at
7 | *
8 | * http://aws.amazon.com/apache2.0
9 | *
10 | * or in the "license" file accompanying this file. This file is distributed
11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 | * express or implied. See the License for the specific language governing
13 | * permissions and limitations under the License.
14 | */
15 |
16 | #define AWS_LAMBDA_RUNTIME_API __attribute__((visibility("default")))
17 |
18 | namespace aws {
19 | namespace lambda_runtime {
20 |
21 | /* clang-format off */
22 | AWS_LAMBDA_RUNTIME_API
23 | unsigned get_version_major()
24 | {
25 | return @PROJECT_VERSION_MAJOR@; // NOLINT
26 | }
27 |
28 | AWS_LAMBDA_RUNTIME_API
29 | unsigned get_version_minor()
30 | {
31 | return @PROJECT_VERSION_MINOR@; // NOLINT
32 | }
33 |
34 | AWS_LAMBDA_RUNTIME_API
35 | unsigned get_version_patch()
36 | {
37 | return @PROJECT_VERSION_PATCH@; // NOLINT
38 | }
39 | /* clang-format on */
40 |
41 | AWS_LAMBDA_RUNTIME_API
42 | char const* get_version()
43 | {
44 | return "@PROJECT_VERSION@";
45 | }
46 |
47 | } // namespace lambda_runtime
48 | } // namespace aws
49 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(aws-lambda-runtime-tests LANGUAGES CXX)
2 | find_package(AWSSDK COMPONENTS lambda iam)
3 |
4 | add_executable(${PROJECT_NAME}
5 | main.cpp
6 | runtime_tests.cpp
7 | version_tests.cpp
8 | gtest/gtest-all.cc)
9 |
10 | target_link_libraries(${PROJECT_NAME} PRIVATE ${AWSSDK_LINK_LIBRARIES} aws-lambda-runtime)
11 |
12 | include(GoogleTest)
13 | gtest_discover_tests(${PROJECT_NAME} EXTRA_ARGS "--aws_prefix=${TEST_RESOURCE_PREFIX}") # requires CMake 3.10 or later
14 |
15 | add_subdirectory(resources)
16 |
17 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/tests/gtest/.clang-tidy:
--------------------------------------------------------------------------------
1 | ---
2 | Checks: '-*,llvm-twine-local'
3 | ...
4 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/tests/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "gtest/gtest.h"
4 |
5 | std::function()> get_console_logger_factory()
6 | {
7 | return [] {
8 | return Aws::MakeShared(
9 | "console_logger", Aws::Utils::Logging::LogLevel::Warn);
10 | };
11 | }
12 |
13 | std::string aws_prefix;
14 |
15 | void parse_args(int argc, char** argv)
16 | {
17 | const std::string resource_prefix_option = "--aws_prefix=";
18 | for (int i = 1; i < argc; i++) {
19 | std::string arg = argv[i];
20 | if (arg.find(resource_prefix_option) == 0) {
21 | aws_prefix = arg.substr(resource_prefix_option.length()); // get whatever value after the '='
22 | break;
23 | }
24 | }
25 | }
26 |
27 | int main(int argc, char** argv)
28 | {
29 | parse_args(argc, argv);
30 | Aws::SDKOptions options;
31 | options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Warn;
32 | options.loggingOptions.logger_create_fn = get_console_logger_factory();
33 | Aws::InitAPI(options);
34 | ::testing::InitGoogleTest(&argc, argv);
35 | int exit_code = RUN_ALL_TESTS();
36 | Aws::ShutdownAPI(options);
37 | return exit_code;
38 | }
39 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/tests/resources/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(lambda-test-fun LANGUAGES CXX)
2 |
3 | # resources are the actual lambda functions deployed and exercised by the tests
4 | add_executable(${PROJECT_NAME} lambda_function.cpp)
5 | target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)
6 | target_link_libraries(${PROJECT_NAME} PRIVATE aws-lambda-runtime)
7 | # package the lambda function into lambda.zip
8 | add_custom_target(aws-lambda-package-lambda-test-fun
9 | COMMAND "${CMAKE_SOURCE_DIR}/packaging/packager" "${CMAKE_CURRENT_BINARY_DIR}/lambda-test-fun"
10 | DEPENDS ${PROJECT_NAME})
11 |
12 | add_custom_target(aws-lambda-package-lambda-test-fun-no-glibc
13 | COMMAND "${CMAKE_SOURCE_DIR}/packaging/packager" -d "${CMAKE_CURRENT_BINARY_DIR}/lambda-test-fun"
14 | DEPENDS ${PROJECT_NAME})
15 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/aws-lambda-cpp-0.2.7/tests/version_tests.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "gtest/gtest.h"
3 |
4 | using namespace aws::lambda_runtime;
5 |
6 | TEST(VersionTests, get_version_major)
7 | {
8 | auto version = get_version_major();
9 | ASSERT_EQ(0, version);
10 | }
11 |
12 | TEST(VersionTests, get_version_minor)
13 | {
14 | auto version = get_version_minor();
15 | ASSERT_GE(version, 1);
16 | }
17 |
18 | TEST(VersionTests, get_version_patch)
19 | {
20 | auto version = get_version_patch();
21 | ASSERT_GE(version, 0);
22 | }
23 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/curl-7.83.1.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/aws-lambda-java-libs/5a0f8ad9e9b8ff61ba626e71c4b5de62134e82e4/aws-lambda-java-runtime-interface-client/src/main/jni/deps/curl-7.83.1.tar.gz
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/deps/curl_001_disable_wakeup.patch:
--------------------------------------------------------------------------------
1 | diff --git a/multihandle.h b/multihandle.h
2 | index a26fb619a..18080f1c3 100644
3 | --- a/multihandle.h
4 | +++ b/multihandle.h
5 | @@ -70,10 +70,6 @@ typedef enum {
6 |
7 | #define CURLPIPE_ANY (CURLPIPE_MULTIPLEX)
8 |
9 | -#if !defined(CURL_DISABLE_SOCKETPAIR)
10 | -#define ENABLE_WAKEUP
11 | -#endif
12 | -
13 | /* value for MAXIMUM CONCURRENT STREAMS upper limit */
14 | #define INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1)
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/main/jni/macro.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 | SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | #ifndef _Included_macros
7 | #define _Included_macros
8 |
9 | #define CHECK_EXCEPTION(env, expr) \
10 | expr; \
11 | if ((env)->ExceptionOccurred()) \
12 | goto ERROR;
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/test/java/com/amazonaws/services/lambda/runtime/api/client/logging/FrameTypeTest.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.api.client.logging;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
8 | import com.amazonaws.services.lambda.runtime.logging.LogFormat;
9 |
10 | public class FrameTypeTest {
11 |
12 | @Test
13 | public void logFrames() {
14 | assertHexEquals(
15 | 0xa55a0003,
16 | FrameType.getValue(LogLevel.UNDEFINED, LogFormat.TEXT)
17 | );
18 |
19 | assertHexEquals(
20 | 0xa55a001b,
21 | FrameType.getValue(LogLevel.FATAL, LogFormat.TEXT)
22 | );
23 | }
24 |
25 |
26 | /**
27 | * Helper function to make it easier to debug failing test.
28 | *
29 | * @param expected Expected value as int
30 | * @param actual Actual value as int
31 | */
32 | private void assertHexEquals(int expected, int actual) {
33 | assertEquals(
34 | Integer.toHexString(expected),
35 | Integer.toHexString(actual)
36 | );
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/test/java/com/amazonaws/services/lambda/runtime/api/client/logging/TextLogFormatterTest.java:
--------------------------------------------------------------------------------
1 | package com.amazonaws.services.lambda.runtime.api.client.logging;
2 |
3 | import org.junit.jupiter.api.Test;
4 |
5 | import static org.junit.jupiter.api.Assertions.assertEquals;
6 |
7 | import com.amazonaws.services.lambda.runtime.logging.LogLevel;
8 |
9 | class TextLogFormatterTest {
10 | @Test
11 | void testFormattingStringWithLogLevel() {
12 | assertFormatsString("test log", LogLevel.WARN, "[WARN] test log");
13 | }
14 |
15 | @Test
16 | void testFormattingStringWithoutLogLevel() {
17 | assertFormatsString("test log", LogLevel.UNDEFINED, "test log");
18 | }
19 |
20 | void assertFormatsString(String input, LogLevel logLevel, String expected) {
21 | LogFormatter logFormatter = new TextLogFormatter();
22 | String output = logFormatter.format(input, logLevel);
23 | assertEquals(expected, output);
24 | }
25 | }
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/test/java/test/lambda/handlers/POJOHanlderImpl.java:
--------------------------------------------------------------------------------
1 | package test.lambda.handlers;
2 |
3 | import com.amazonaws.services.lambda.runtime.Context;
4 |
5 | @SuppressWarnings("unused")
6 | public class POJOHanlderImpl {
7 | @SuppressWarnings("unused")
8 | public String noParamsHandler() {
9 | return "success";
10 | }
11 |
12 | @SuppressWarnings("unused")
13 | public String oneParamHandler_event(String event) {
14 | return "success";
15 | }
16 |
17 | @SuppressWarnings("unused")
18 | public String oneParamHandler_context(Context context) {
19 | return "success";
20 | }
21 |
22 | @SuppressWarnings("unused")
23 | public String twoParamsHandler(String event, Context context) {
24 | return "success";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/test/java/test/lambda/handlers/RequestHandlerImpl.java:
--------------------------------------------------------------------------------
1 | package test.lambda.handlers;
2 |
3 | import com.amazonaws.services.lambda.runtime.Context;
4 | import com.amazonaws.services.lambda.runtime.RequestHandler;
5 |
6 |
7 | public class RequestHandlerImpl implements RequestHandler {
8 | @Override
9 | public String handleRequest(String event, Context context) {
10 | return "success";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/test/java/test/lambda/handlers/RequestStreamHandlerImpl.java:
--------------------------------------------------------------------------------
1 | package test.lambda.handlers;
2 |
3 | import com.amazonaws.services.lambda.runtime.Context;
4 | import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
5 |
6 | import java.io.IOException;
7 | import java.io.InputStream;
8 | import java.io.OutputStream;
9 |
10 | @SuppressWarnings("unused")
11 | public class RequestStreamHandlerImpl implements RequestStreamHandler {
12 | @Override
13 | public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
14 | output.write("\"success\"".getBytes());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/src/test/java/testpkg/StackTraceHelper.java:
--------------------------------------------------------------------------------
1 | /* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 |
3 | package testpkg;
4 |
5 | import com.amazonaws.services.lambda.crac.CheckpointException;
6 |
7 | /**
8 | * A helper class for throwing exception which is not in the com.amazonaws.services.lambda.runtime.api.client package
9 | * to avoid the stack traces from being filtered out.
10 | *
11 | */
12 | public class StackTraceHelper {
13 | /**
14 | * Throws a RuntimeException directly with msg as the message.
15 | */
16 | public static void throwRuntimeException(String msg){
17 | throw new RuntimeException(msg);
18 | }
19 |
20 | /**
21 | * Calls another method which throws a RuntimeException with msg as the message.
22 | */
23 | public static void callThenThrowRuntimeException(String msg){
24 | throwRuntimeException(msg);
25 | }
26 |
27 | public static void throwCheckpointExceptionWithTwoSuppressedExceptions(String msg1, String msg2) throws CheckpointException {
28 | CheckpointException e1 = new CheckpointException();
29 | e1.addSuppressed(new RuntimeException(msg1));
30 | e1.addSuppressed(new RuntimeException(msg2));
31 | throw e1;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/.gitignore:
--------------------------------------------------------------------------------
1 | generated.docker-compose.*.yml
2 | .idea
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/Dockerfile.agent:
--------------------------------------------------------------------------------
1 | FROM public.ecr.aws/amazoncorretto/amazoncorretto:8
2 |
3 | # Install docker and buildx extension
4 | RUN amazon-linux-extras enable docker && \
5 | yum clean metadata && \
6 | yum install -y docker tar gzip unzip file
7 |
8 | COPY --from=docker/buildx-bin:latest /buildx /usr/libexec/docker/cli-plugins/docker-buildx
9 |
10 | # Install maven from apache.org, as version in the yum repository doesn't support latest maven plugins
11 | ENV PATH="$PATH:/apache-maven/bin"
12 | RUN mkdir /apache-maven && \
13 | curl https://archive.apache.org/dist/maven/maven-3/3.8.7/binaries/apache-maven-3.8.7-bin.tar.gz | \
14 | tar -xz -C /apache-maven --strip-components 1
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/clean_up.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
4 | set -euo pipefail
5 |
6 | echo "Cleaning up..."
7 | docker stop "${OS_DISTRIBUTION}-app" || true
8 | docker rm --force "${OS_DISTRIBUTION}-app" || true
9 | docker stop "${OS_DISTRIBUTION}-tester" || true
10 | docker rm --force "${OS_DISTRIBUTION}-tester" || true
11 | docker network rm "${OS_DISTRIBUTION}-network" || true
12 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/configure_multi_arch_env.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
4 | set -euo pipefail
5 |
6 | echo "Setting up multi-arch build environment"
7 | ARCHITECTURE=$(arch)
8 | if [[ "$ARCHITECTURE" == "x86_64" ]]; then
9 | TARGET_EMULATOR="arm64"
10 | elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
11 | TARGET_EMULATOR="amd64"
12 | else
13 | echo "Architecture $ARCHITECTURE is not currently supported."
14 | exit 1
15 | fi
16 |
17 | echo "Installing ${TARGET_EMULATOR} emulator"
18 | docker pull public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0
19 | docker run --rm --privileged public.ecr.aws/eks-distro-build-tooling/binfmt-misc:qemu-v6.1.0 --install ${TARGET_EMULATOR}
20 | echo "Setting docker build command to default to buildx"
21 | echo "Docker buildx version: $(docker buildx version)"
22 | docker buildx install
23 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/codebuild/scripts/fetch_test_container_logs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
4 | set -euo pipefail
5 |
6 | echo "---------Container Logs: ${OS_DISTRIBUTION}-app----------"
7 | echo
8 | docker logs "${OS_DISTRIBUTION}-app" || true
9 | echo
10 | echo "---------------------------------------------------"
11 | echo "--------Container Logs: ${OS_DISTRIBUTION}-tester--------"
12 | echo
13 | docker logs "${OS_DISTRIBUTION}-tester" || true
14 | echo
15 | echo "---------------------------------------------------"
16 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.alpine:
--------------------------------------------------------------------------------
1 | ARG DISTRO_VERSION
2 |
3 | FROM public.ecr.aws/docker/library/alpine:${DISTRO_VERSION}
4 |
5 | RUN apk update && \
6 | apk add openjdk8
7 |
8 | ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar .
9 |
10 | ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"]
11 |
12 | CMD ["helloworld.App"]
13 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazoncorretto:
--------------------------------------------------------------------------------
1 | ARG RUNTIME_VERSION
2 |
3 | FROM public.ecr.aws/amazoncorretto/amazoncorretto:${RUNTIME_VERSION}
4 |
5 | ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar .
6 |
7 | ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"]
8 |
9 | CMD ["helloworld.App"]
10 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.amazonlinux:
--------------------------------------------------------------------------------
1 | ARG DISTRO_VERSION
2 |
3 | FROM public.ecr.aws/amazonlinux/amazonlinux:${DISTRO_VERSION}
4 |
5 | RUN yum install -y java-1.8.0-openjdk
6 |
7 | ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar .
8 |
9 | ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"]
10 |
11 | CMD ["helloworld.App"]
12 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.centos:
--------------------------------------------------------------------------------
1 | ARG DISTRO_VERSION
2 |
3 | FROM public.ecr.aws/docker/library/centos:centos${DISTRO_VERSION}
4 |
5 | RUN rpm --import https://yum.corretto.aws/corretto.key && \
6 | curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo && \
7 | yum install -y java-11-amazon-corretto-devel
8 |
9 | ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar .
10 |
11 | ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"]
12 |
13 | CMD ["helloworld.App"]
14 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.debian:
--------------------------------------------------------------------------------
1 | ARG DISTRO_VERSION
2 |
3 | FROM public.ecr.aws/debian/debian:${DISTRO_VERSION} as build-image
4 |
5 | RUN apt-get update && \
6 | apt-get install -y wget gpg software-properties-common && \
7 | wget -O- https://apt.corretto.aws/corretto.key | apt-key add - && \
8 | add-apt-repository 'deb https://apt.corretto.aws stable main' && \
9 | apt-get update && \
10 | apt-get install -y java-11-amazon-corretto-jdk
11 |
12 | FROM public.ecr.aws/debian/debian:${DISTRO_VERSION}
13 |
14 | COPY --from=build-image /usr/lib/jvm /usr/lib/jvm
15 |
16 | ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar .
17 |
18 | ENV PATH=/usr/lib/jvm/java-11-amazon-corretto/bin/:$PATH
19 |
20 | ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"]
21 |
22 | CMD ["helloworld.App"]
23 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/docker/Dockerfile.function.ubuntu:
--------------------------------------------------------------------------------
1 | ARG DISTRO_VERSION
2 |
3 | FROM public.ecr.aws/ubuntu/ubuntu:${DISTRO_VERSION} as build-image
4 |
5 | RUN apt-get update && \
6 | apt-get install -y apt-transport-https ca-certificates && \
7 | apt-get install -y wget gnupg software-properties-common && \
8 | wget -O- https://apt.corretto.aws/corretto.key | apt-key add - && \
9 | add-apt-repository 'deb https://apt.corretto.aws stable main' && \
10 | apt-get update && \
11 | apt-get install -y java-11-amazon-corretto-jdk
12 |
13 | FROM public.ecr.aws/ubuntu/ubuntu:${DISTRO_VERSION}
14 |
15 | COPY --from=build-image /usr/lib/jvm /usr/lib/jvm
16 |
17 | ADD aws-lambda-java-runtime-interface-client/test/integration/test-handler/target/HelloWorld-1.0.jar .
18 |
19 | ENV PATH=/usr/lib/jvm/java-11-amazon-corretto/bin/:$PATH
20 |
21 | ENTRYPOINT ["java", "-jar", "./HelloWorld-1.0.jar"]
22 |
23 | CMD ["helloworld.App"]
24 |
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/resources/aws-lambda-rie-arm64.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/aws-lambda-java-libs/5a0f8ad9e9b8ff61ba626e71c4b5de62134e82e4/aws-lambda-java-runtime-interface-client/test/integration/resources/aws-lambda-rie-arm64.tar.gz
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/resources/aws-lambda-rie.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws/aws-lambda-java-libs/5a0f8ad9e9b8ff61ba626e71c4b5de62134e82e4/aws-lambda-java-runtime-interface-client/test/integration/resources/aws-lambda-rie.tar.gz
--------------------------------------------------------------------------------
/aws-lambda-java-runtime-interface-client/test/integration/test-handler/src/main/java/helloworld/App.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | import com.amazonaws.services.lambda.runtime.Context;
4 | import com.amazonaws.services.lambda.runtime.RequestHandler;
5 |
6 | import java.util.Map;
7 |
8 | /**
9 | * Handler for requests to Lambda function.
10 | */
11 | public class App implements RequestHandler