Skip to content

Commit

Permalink
Bump to Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
docwho2 committed Jul 29, 2024
1 parent 85eb908 commit 8a6c938
Show file tree
Hide file tree
Showing 14 changed files with 454 additions and 64 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
with:
submodules: recursive

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
cache: maven

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
- name: Add AWS_ACCOUNT_ID to Environment
run: echo "AWS_ACCOUNT_ID=${{ steps.aws-creds.outputs.aws-account-id }}" >> $GITHUB_ENV

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
cache: maven

Expand Down Expand Up @@ -100,10 +100,10 @@ jobs:
- name: Add AWS_ACCOUNT_ID to Environment
run: echo "AWS_ACCOUNT_ID=${{ steps.aws-creds.outputs.aws-account-id }}" >> $GITHUB_ENV

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
cache: maven

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ jobs:
- name: Add AWS_ACCOUNT_ID to Environment
run: echo "AWS_ACCOUNT_ID=${{ steps.aws-creds.outputs.aws-account-id }}" >> $GITHUB_ENV

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
cache: maven

Expand Down Expand Up @@ -146,10 +146,10 @@ jobs:
- name: Add AWS_ACCOUNT_ID to Environment
run: echo "AWS_ACCOUNT_ID=${{ steps.aws-creds.outputs.aws-account-id }}" >> $GITHUB_ENV

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'
cache: maven

Expand Down
1 change: 1 addition & 0 deletions ChatGPT/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
</dependency>

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
Expand Down
13 changes: 6 additions & 7 deletions ChatGPT/src/main/java/cloud/cleo/squareup/ChatGPTLambda.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package cloud.cleo.squareup;

import cloud.cleo.squareup.LexV2Event.Intent;
import cloud.cleo.squareup.LexV2Event.SessionState;
import cloud.cleo.squareup.LexV2Response.Button;
import cloud.cleo.squareup.LexV2Response.ImageResponseCard;
import static cloud.cleo.squareup.enums.LexDialogAction.*;
import static cloud.cleo.squareup.enums.LexMessageContentType.*;
import cloud.cleo.squareup.functions.AbstractFunction;
Expand All @@ -12,11 +16,6 @@
import cloud.cleo.squareup.json.ZoneIdDeserializer;
import cloud.cleo.squareup.json.ZonedSerializer;
import static cloud.cleo.squareup.lang.LangUtil.LanguageIds.*;
import com.amazonaws.services.lambda.runtime.events.LexV2Event.Intent;
import com.amazonaws.services.lambda.runtime.events.LexV2Event.SessionState;
import com.amazonaws.services.lambda.runtime.events.LexV2Response;
import com.amazonaws.services.lambda.runtime.events.LexV2Response.Button;
import com.amazonaws.services.lambda.runtime.events.LexV2Response.ImageResponseCard;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
Expand Down Expand Up @@ -373,7 +372,7 @@ protected LexV2Response buildResponse(LexV2EventWrapper lexRequest, String respo
* @return
*/
private ImageResponseCard buildWelcomeCard() {
return com.amazonaws.services.lambda.runtime.events.LexV2Response.ImageResponseCard.builder()
return LexV2Response.ImageResponseCard.builder()
.withTitle("Welcome to Copper Fox Gifts")
.withImageUrl("https://www.copperfoxgifts.com/logo.png")
.withSubtitle("Ask us anything or use a quick action below")
Expand All @@ -391,7 +390,7 @@ private ImageResponseCard buildWelcomeCard() {
* @return
*/
private ImageResponseCard buildTransferCard() {
return com.amazonaws.services.lambda.runtime.events.LexV2Response.ImageResponseCard.builder()
return LexV2Response.ImageResponseCard.builder()
.withTitle("Conversation will move to Inbox")
.withImageUrl("https://www.copperfoxgifts.com/logo.png")
.withSubtitle("Please tell us how our AI ChatBot did?")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import static cloud.cleo.squareup.lang.LangUtil.LanguageIds.UNHANDLED_EXCEPTION;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.LexV2Event;
import com.amazonaws.services.lambda.runtime.events.LexV2Response;
import java.util.concurrent.CompletionException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static cloud.cleo.squareup.lang.LangUtil.LanguageIds.UNHANDLED_EXCEPTION;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.LexV2Response;
import com.amazonaws.services.lambda.runtime.events.SNSEvent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down Expand Up @@ -39,7 +38,7 @@ public class ChatGPTLambdaPinpoint extends ChatGPTLambda implements RequestHandl
@Override
public Void handleRequest(SNSEvent input, Context cntxt) {
// Only 1 record is every presented
SNSEvent.SNS snsEvent = input.getRecords().get(0).getSns();
SNSEvent.SNS snsEvent = input.getRecords().get(0).getSNS();
log.debug("Recieved SNS Event" + snsEvent);

// Convert payload to Pinpoint Event
Expand Down
Loading

0 comments on commit 8a6c938

Please sign in to comment.