-
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
5 changed files
with
94 additions
and
61 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
44 changes: 44 additions & 0 deletions
44
...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,44 @@ | ||
package io.quarkus.amazon.lambda.runtime; | ||
|
||
/** | ||
* Various constants and util methods used for communication with the AWS API. | ||
*/ | ||
public class AmazonLambdaApi { | ||
|
||
public static final String LAMBDA_RUNTIME_AWS_REQUEST_ID = "Lambda-Runtime-Aws-Request-Id"; | ||
|
||
public static final String QUARKUS_INTERNAL_AWS_LAMBDA_TEST_API = "quarkus-internal.aws-lambda.test-api"; | ||
|
||
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; | ||
} | ||
|
||
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
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