-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit a22c9d2
Showing
43 changed files
with
2,722 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "maven" | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 10 | ||
groups: | ||
dependencies: | ||
patterns: | ||
- "*" | ||
labels: | ||
- "dependencies" | ||
target-branch: "master" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 5 | ||
commit-message: | ||
prefix: "[workflow]" | ||
labels: | ||
- "dependencies" | ||
target-branch: "master" | ||
groups: | ||
dependencies: | ||
patterns: | ||
- "*" |
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,38 @@ | ||
name: Build | ||
|
||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
java_version: [11,17,21] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.java_version }} | ||
distribution: 'zulu' | ||
- name: Maven cache | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: maven-cache | ||
with: | ||
path: | ||
~/.m2 | ||
key: build-${{ env.cache-name }} | ||
- name: Maven version | ||
run: mvn --version | ||
- name: Build with Maven | ||
run: mvn clean test | ||
- name: Build with Maven (javax) | ||
run: ./jakarta-to-javax.sh && mvn clean test && ./javax-to-jakarta.sh |
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,28 @@ | ||
name: Dependabot auto-merge | ||
on: pull_request | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v2 | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Approve a PR | ||
run: gh pr review --approve "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
# Enable for automerge | ||
- name: Enable auto-merge for Dependabot PRs | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
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,12 @@ | ||
name: Google Format | ||
|
||
on: [push, workflow_dispatch] | ||
|
||
jobs: | ||
formatting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 # v2 minimum required | ||
- uses: axel-op/googlejavaformat-action@v3 | ||
with: | ||
args: "--skip-sorting-imports --replace" |
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,39 @@ | ||
|
||
name: avaje-sigma EA stable | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '39 1 * * 1,3,5' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: oracle-actions/setup-java@v1 | ||
with: | ||
website: jdk.java.net | ||
release: ea | ||
version: stable | ||
- name: Maven cache | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: maven-cache | ||
with: | ||
path: | ||
~/.m2 | ||
key: build-${{ env.cache-name }} | ||
- name: Maven version | ||
run: mvn --version | ||
- name: Build with Maven | ||
run: mvn package | ||
|
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,43 @@ | ||
|
||
name: avaje-sigma EA | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '39 1 * * 1,3,5' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
java_version: [GA,EA] ## valhalla (fails javadoc) | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: oracle-actions/setup-java@v1 | ||
with: | ||
website: jdk.java.net | ||
release: ${{ matrix.java_version }} | ||
- name: Maven cache | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: maven-cache | ||
with: | ||
path: | ||
~/.m2 | ||
key: build-${{ env.cache-name }} | ||
- name: Maven version | ||
run: mvn --version | ||
- name: Build with Maven | ||
run: mvn package | ||
|
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,15 @@ | ||
target/ | ||
build/ | ||
.idea/ | ||
*.iml | ||
.gradle | ||
*.prefs | ||
*.class* | ||
*.factorypath | ||
*.project | ||
*.processors | ||
*/bin/ | ||
|
||
inject-generator/avaje-inject | ||
inject-generator/avaje-inject-generator | ||
inject-generator/avaje-processors.txt |
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,24 @@ | ||
# Avaje Sigma (Final Name TBD) | ||
|
||
Provides javalin/jex style request handling for AWS lambda http requests. | ||
|
||
|
||
```java | ||
public class LambdaRequestHandler | ||
implements RequestHandler<APIGatewayV2HttpEvent, AWSHttpResponse> { | ||
|
||
AWSHttpHandler handler = | ||
Sigma.create() | ||
.routing( | ||
r -> | ||
r.get("/lambda", ctx -> ctx.text("Hello World")) | ||
.get("/route2/{param}", ctx -> ctx.text(ctx.pathParam("param")))) | ||
.createAWSHandler(); | ||
|
||
@Override | ||
public AWSHttpResponse handleRequest(APIGatewayV2HttpEvent event, Context context) { | ||
|
||
return handler.handle(event, context); | ||
} | ||
} | ||
``` |
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,61 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.avaje</groupId> | ||
<artifactId>avaje-sigma-parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
</parent> | ||
<packaging>jar</packaging> | ||
<artifactId>avaje-sigma</artifactId> | ||
<scm> | ||
<developerConnection>scm:git:git@github.com:avaje/avaje-sigma.git</developerConnection> | ||
</scm> | ||
|
||
<properties> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.amazonaws</groupId> | ||
<artifactId>aws-lambda-java-core</artifactId> | ||
<version>1.2.3</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.17.2</version> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.avaje</groupId> | ||
<artifactId>avaje-jsonb</artifactId> | ||
<version>2.1</version> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.avaje</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>1.5</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<forkCount>0</forkCount> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
14 changes: 14 additions & 0 deletions
14
avaje-sigma/src/main/java/io/avaje/sigma/AWSHttpHandler.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,14 @@ | ||
package io.avaje.sigma; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
|
||
import io.avaje.sigma.aws.events.AWSHttpResponse; | ||
import io.avaje.sigma.aws.events.AWSRequest; | ||
|
||
/** | ||
* The configured handler that takes AWS HTTP Requests, routes the request to the correct function | ||
* and performs error handling | ||
*/ | ||
public interface AWSHttpHandler { | ||
<T extends AWSRequest> AWSHttpResponse handle(T request, Context ctx); | ||
} |
17 changes: 17 additions & 0 deletions
17
avaje-sigma/src/main/java/io/avaje/sigma/ExceptionHandler.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,17 @@ | ||
package io.avaje.sigma; | ||
|
||
/** | ||
* Defines an interface for handling exceptions in a given HTTP context. | ||
* | ||
* @param <T> The specific type of exception to handle. | ||
*/ | ||
public interface ExceptionHandler<T extends Exception> { | ||
|
||
/** | ||
* Handles the given exception. | ||
* | ||
* @param exception The exception to handle. | ||
* @param ctx The HTTP context of the invocation. | ||
*/ | ||
void handle(T exception, HttpContext ctx); | ||
} |
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,17 @@ | ||
package io.avaje.sigma; | ||
|
||
/** | ||
* Functional interface for handling HTTP requests. | ||
* | ||
* @see HttpContext | ||
*/ | ||
@FunctionalInterface | ||
public interface Handler { | ||
|
||
/** | ||
* Handles the given HTTP request context. | ||
* | ||
* @param req The HTTP request context. | ||
*/ | ||
void handle(HttpContext req); | ||
} |
Oops, something went wrong.