in example/HelloWorldFunction/src/main/java/helloworld/AppParams.java [41:73]
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent input, Context context) {
log.info("\n=============== SSM Parameter Store ===============");
log.info("simplevalue={}, listvalue={}, b64value={}\n", simplevalue, listvalue, b64value);
log.info("jsonobj={}\n", jsonobj);
log.info("allvalues (multiple):");
allvalues.forEach((key, value) -> log.info("- {}={}\n", key, value));
log.info("\n=============== Secrets Manager ===============");
log.info("secretjson:");
secretjson.forEach((key, value) -> log.info("- {}={}\n", key, value));
log.info("secretjsonobj={}\n", secretjsonobj);
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("X-Custom-Header", "application/json");
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
.withHeaders(headers);
try {
final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
String output = String.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
return response
.withStatusCode(200)
.withBody(output);
} catch (IOException e) {
return response
.withBody("{}")
.withStatusCode(500);
}
}