Skip to content

Commit

Permalink
Use apigateway functions from ghcr.io/muhamadto/spring-native-amazonl…
Browse files Browse the repository at this point in the history
…inux2-builder:21-amazonlinux2-awscliv2

Signed-off-by: matto <muhamadto@gmail.com>
  • Loading branch information
muhamadto committed Dec 29, 2023
1 parent c96de34 commit d4dc3af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.idea/
badges/
**/target/
cdk.out/
volume/
.gitignore
CODE_OF_CONDUCT.md
HELP.md
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
target/
cdk.out/
volume/
!spring-native-aws-lambda-function/.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
Expand Down Expand Up @@ -32,3 +34,4 @@ build/
.vscode/

**/maven-wrapper.jar

20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
version: "3.9"
services:
spring-native-aws-lambda-function-infra:
image: muhamadto/spring-native-amazonlinux2-builder:21-amazonlinux2-awscliv2
image: ghcr.io/muhamadto/spring-native-amazonlinux2-builder:21-amazonlinux2-awscliv2
volumes:
- ./:/app
- ${M2_REPO}:/home/worker/.m2
Expand Down Expand Up @@ -51,22 +51,22 @@ services:
print_info_message "divider" "Package GraalVM function" &&
./mvnw -ntp clean package -U -Pnative -pl spring-native-aws-lambda-function &&
./mvnw -ntp clean package -U -X -Pnative -pl spring-native-aws-lambda-function &&
print_info_message "divider" "Creating LAMBDA function" &&
lambda_create_function lambda-FUNCTION provided.al2023 512 ./spring-native-aws-lambda-function/target/spring-native-aws-lambda-function-native-zip.zip spring-native-aws-lambda-function &&
lambda_wait_for_function lambda-FUNCTION &&
lambda_list_functions &&
print_info_message "divider" "Creating API Gateway" &&
REST_API_ID="$(apigateway_create_restApi "somerestapiname")" &&
RESOURCE_ID="$(apigateway_create_resource "$$REST_API_ID" "somePathId")"
apigateway_create_method "$$REST_API_ID" "$$RESOURCE_ID" "POST" &&
apigateway_create_lambda_integration "$$REST_API_ID" "$$RESOURCE_ID" "POST" "arn:aws:apigateway:ap-southeast-2:lambda:path/2015-03-31/functions/arn:aws:lambda:ap-southeast-2:000000000000:function:lambda-FUNCTION/invocations" &&
apigateway_create_deployment "$$REST_API_ID" "test" &&
apigateway_list_restapis &&
REST_API_ID="$(aws apigateway --endpoint-url="http://localstack:4566" create-rest-api --name 'someapigateway' --query 'id' --output text)" &&
ROOT_RESOURCE_ID=$(aws apigateway --endpoint-url="http://localstack:4566" get-resources --rest-api-id "$$REST_API_ID" --query 'items[0].id' --output text)
RESOURCE_ID=$(aws apigateway --endpoint-url="http://localstack:4566" create-resource --rest-api-id $$REST_API_ID --parent-id $$ROOT_RESOURCE_ID --path-part '{somethingPathId}' --query 'id' --output text)
aws apigateway --endpoint-url="http://localstack:4566" put-method --rest-api-id $$REST_API_ID --resource-id $$RESOURCE_ID --http-method POST --request-parameters 'method.request.path.somethingPathId=true' --authorization-type 'NONE' &&
aws apigateway --endpoint-url="http://localstack:4566" put-integration --rest-api-id $$REST_API_ID --resource-id $$RESOURCE_ID --http-method POST --type AWS_PROXY --integration-http-method POST --uri arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ap-southeast-2:000000000000:function:lambda-FUNCTION/invocations --passthrough-behavior WHEN_NO_MATCH &&
aws apigateway --endpoint-url="http://localstack:4566" create-deployment --rest-api-id $$REST_API_ID --stage-name test &&
print_info_message "plain" "http://localhost:4566/restapis/$$REST_API_ID/test/_user_request_/test" &&
print_info_message "plain" "Endpoint available at: http://localhost:4566/restapis/$$REST_API_ID/test/_user_request_/test" &&
print_info_message "block" "Successfully creating 'spring-native-aws-lambda-function'"
'
Expand Down

0 comments on commit d4dc3af

Please sign in to comment.