-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
143 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package io.quarkus.amazon.lambda.runtime; | ||
|
||
/** | ||
* Various constants and util methods used for communication with the AWS API. | ||
*/ | ||
public class AmazonLambdaApi { | ||
|
||
// Response Headers | ||
public static final String LAMBDA_RUNTIME_AWS_REQUEST_ID = "Lambda-Runtime-Aws-Request-Id"; | ||
public static final String LAMBDA_RUNTIME_INVOKED_FUNCTION_ARN = "Lambda-Runtime-Invoked-Function-Arn"; | ||
public static final String LAMBDA_RUNTIME_COGNITO_IDENTITY = "Lambda-Runtime-Cognito-Identity"; | ||
public static final String LAMBDA_RUNTIME_CLIENT_CONTEXT = "Lambda-Runtime-Client-Context"; | ||
public static final String LAMBDA_RUNTIME_DEADLINE_MS = "Lambda-Runtime-Deadline-Ms"; | ||
|
||
// Test API | ||
public static final String QUARKUS_INTERNAL_AWS_LAMBDA_TEST_API = "quarkus-internal.aws-lambda.test-api"; | ||
|
||
// API paths | ||
public static final String API_PROTOCOL = "http://"; | ||
public static final String API_PATH_RUNTIME = "/2018-06-01/runtime/"; | ||
public static final String API_PATH_INVOCATION = API_PATH_RUNTIME + "invocation/"; | ||
public static final String API_PATH_INVOCATION_NEXT = API_PATH_INVOCATION + "next"; | ||
public static final String API_PATH_INIT_ERROR = API_PATH_RUNTIME + "init/error"; | ||
public static final String API_PATH_ERROR = "/error"; | ||
public static final String API_PATH_RESPONSE = "/response"; | ||
|
||
static String invocationNext() { | ||
return API_PROTOCOL + runtimeApi() + API_PATH_INVOCATION_NEXT; | ||
} | ||
|
||
static String invocationError(String requestId) { | ||
return API_PROTOCOL + runtimeApi() + API_PATH_INVOCATION + requestId + API_PATH_ERROR; | ||
} | ||
|
||
static String invocationResponse(String requestId) { | ||
return API_PROTOCOL + runtimeApi() + API_PATH_INVOCATION + requestId + API_PATH_RESPONSE; | ||
} | ||
|
||
static String initError() { | ||
return API_PROTOCOL + runtimeApi() + API_PATH_INIT_ERROR; | ||
} | ||
|
||
static String logGroupName() { | ||
return System.getenv("AWS_LAMBDA_LOG_GROUP_NAME"); | ||
} | ||
|
||
static String functionMemorySize() { | ||
return System.getenv("AWS_LAMBDA_FUNCTION_MEMORY_SIZE"); | ||
} | ||
|
||
static String logStreamName() { | ||
return System.getenv("AWS_LAMBDA_LOG_STREAM_NAME"); | ||
} | ||
|
||
static String functionName() { | ||
return System.getenv("AWS_LAMBDA_FUNCTION_NAME"); | ||
} | ||
|
||
static String functionVersion() { | ||
return System.getenv("AWS_LAMBDA_FUNCTION_VERSION"); | ||
} | ||
|
||
private static String runtimeApi() { | ||
String testApi = System.getProperty(QUARKUS_INTERNAL_AWS_LAMBDA_TEST_API); | ||
if (testApi != null) { | ||
return testApi; | ||
} | ||
return System.getenv("AWS_LAMBDA_RUNTIME_API"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...-framework/amazon-lambda/src/main/java/io/quarkus/amazon/lambda/test/LambdaException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters