use of software.amazon.awssdk.services.lambda.model.GetAccountSettingsResponse in project aws-doc-sdk-examples by awsdocs.
the class Handler method handleRequest.
@Override
public String handleRequest(SQSEvent event, Context context) {
String response = new String();
// call Lambda API
logger.info("Getting account settings");
CompletableFuture<GetAccountSettingsResponse> accountSettings = lambdaClient.getAccountSettings(GetAccountSettingsRequest.builder().build());
// log execution details
logger.info("ENVIRONMENT VARIABLES: {}", gson.toJson(System.getenv()));
logger.info("CONTEXT: {}", gson.toJson(context));
logger.info("EVENT: {}", gson.toJson(event));
// process event
for (SQSMessage msg : event.getRecords()) {
logger.info(msg.getBody());
}
// process Lambda API response
try {
GetAccountSettingsResponse settings = accountSettings.get();
response = gson.toJson(settings.accountUsage());
logger.info("Account usage: {}", response);
} catch (Exception e) {
e.getStackTrace();
}
return response;
}
use of software.amazon.awssdk.services.lambda.model.GetAccountSettingsResponse in project aws-doc-sdk-examples by awsdocs.
the class GetAccountSettings method getSettings.
// snippet-start:[lambda.java2.account.main]
public static void getSettings(LambdaClient awsLambda) {
try {
GetAccountSettingsResponse response = awsLambda.getAccountSettings();
System.out.println("Total code size for your account is " + response.accountLimit().totalCodeSize() + " bytes");
} catch (LambdaException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Aggregations