-
-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more runtime examples for Rust, Go, Java
- Loading branch information
1 parent
a6ee11a
commit b64057c
Showing
43 changed files
with
921 additions
and
1,380 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
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
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
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
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
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
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
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
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
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
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,2 @@ | ||
go.sum | ||
bootstrap |
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,5 @@ | ||
module main | ||
|
||
go 1.22.6 | ||
|
||
require github.com/aws/aws-lambda-go v1.47.0 // indirect |
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,23 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/aws/aws-lambda-go/lambda" | ||
) | ||
|
||
type MyEvent struct { | ||
Name string `json:"name"` | ||
} | ||
|
||
func HandleRequest(ctx context.Context, event *MyEvent) (*string, error) { | ||
if event == nil { | ||
return nil, fmt.Errorf("received nil event") | ||
} | ||
message := fmt.Sprintf("Hello %s! serverless.tf was here!", event.Name) | ||
return &message, nil | ||
} | ||
|
||
func main() { | ||
lambda.Start(HandleRequest) | ||
} |
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,2 @@ | ||
.gradle/ | ||
build/ |
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,40 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'com.amazonaws:aws-lambda-java-core:1.2.1' | ||
implementation 'org.slf4j:slf4j-nop:2.0.6' | ||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' | ||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
// Using terraform-aws-lambda module, there is no need to make Zip archive by Gradle. Terraform AWS module will make it for you. | ||
// task buildZip(type: Zip) { | ||
// from compileJava | ||
// from processResources | ||
// into('lib') { | ||
// from configurations.runtimeClasspath | ||
// } | ||
// } | ||
|
||
task copyFiles(type: Copy) { | ||
into("$buildDir/output") | ||
|
||
from sourceSets.main.output | ||
|
||
into('lib') { | ||
from configurations.runtimeClasspath | ||
} | ||
} | ||
|
||
build.dependsOn copyFiles |
19 changes: 19 additions & 0 deletions
19
examples/fixtures/runtimes/java21/src/main/java/example/Handler.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,19 @@ | ||
package example; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.LambdaLogger; | ||
import com.amazonaws.services.lambda.runtime.RequestHandler; | ||
|
||
import java.util.Map; | ||
|
||
// Handler value: example.Handler | ||
public class Handler implements RequestHandler<Map<String,String>, String>{ | ||
|
||
@Override | ||
public String handleRequest(Map<String,String> event, Context context) | ||
{ | ||
LambdaLogger logger = context.getLogger(); | ||
logger.log("EVENT TYPE: " + event.getClass()); | ||
return "Hello from serverless.tf!!!"; | ||
} | ||
} |
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,2 @@ | ||
/target | ||
Cargo.lock |
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.