-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11243 from patriot1burke/cloud-codestarts
cloud codestarts
- Loading branch information
Showing
53 changed files
with
606 additions
and
51 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
3 changes: 3 additions & 0 deletions
3
...criptor-json/src/main/resources/codestarts/amazon-lambda-example/base/README.md
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,3 @@ | ||
# Amazon Lambda Integration | ||
|
||
Guide: https://quarkus.io/guides/amazon-lambda |
13 changes: 13 additions & 0 deletions
13
...latform-descriptor-json/src/main/resources/codestarts/amazon-lambda-example/codestart.yml
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,13 @@ | ||
--- | ||
name: amazon-lambda-example | ||
ref: amazon-lambda | ||
type: example | ||
language: | ||
base: | ||
shared-data: | ||
supports: | ||
dev-mode: false | ||
dependencies: | ||
- io.quarkus:quarkus-amazon-lambda | ||
test-dependencies: | ||
- io.quarkus:quarkus-test-amazon-lambda |
3 changes: 3 additions & 0 deletions
3
...orm-descriptor-json/src/main/resources/codestarts/amazon-lambda-example/java/payload.json
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,3 @@ | ||
{ | ||
"name": "Bill" | ||
} |
12 changes: 12 additions & 0 deletions
12
...s/codestarts/amazon-lambda-example/java/src/main/java/org/acme/lambda/GreetingLambda.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,12 @@ | ||
package org.acme.lambda; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.RequestHandler; | ||
|
||
public class GreetingLambda implements RequestHandler<Person, String> { | ||
|
||
@Override | ||
public String handleRequest(Person input, Context context) { | ||
return "Hello " + input.getName(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...resources/codestarts/amazon-lambda-example/java/src/main/java/org/acme/lambda/Person.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,15 @@ | ||
package org.acme.lambda; | ||
|
||
public class Person { | ||
|
||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Person setName(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
.../amazon-lambda-example/java/src/native-test/java/org/acme/lambda/LambdaHandlerTestIT.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,9 @@ | ||
package org.acme.lambda; | ||
|
||
import io.quarkus.test.junit.NativeImageTest; | ||
|
||
@NativeImageTest | ||
public class LambdaHandlerTestIT extends LambdaHandlerTest { | ||
|
||
// Execute the same tests but in native mode. | ||
} |
20 changes: 20 additions & 0 deletions
20
...odestarts/amazon-lambda-example/java/src/test/java/org/acme/lambda/LambdaHandlerTest.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,20 @@ | ||
package org.acme.lambda; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.amazon.lambda.test.LambdaClient; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
public class LambdaHandlerTest { | ||
|
||
@Test | ||
public void testSimpleLambdaSuccess() throws Exception { | ||
Person in = new Person(); | ||
in.setName("Stu"); | ||
String out = LambdaClient.invoke(String.class, in); | ||
Assertions.assertEquals("Hello Stu", out); | ||
} | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
...c/main/resources/codestarts/amazon-lambda-example/java/src/test/resources/application.yml
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,3 @@ | ||
quarkus.lambda.enable-polling-jvm-mode: true | ||
|
||
|
3 changes: 3 additions & 0 deletions
3
...-json/src/main/resources/codestarts/azure-functions-http-example/base/README.md
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,3 @@ | ||
# Azure Functions Integration | ||
|
||
Guide: https://quarkus.io/guides/azure-functions-http |
17 changes: 17 additions & 0 deletions
17
...esources/codestarts/azure-functions-http-example/base/azure-config/function.tpl.qute.json
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 @@ | ||
{ | ||
"scriptFile" : "../{project.artifact-id}-{project.version}-runner.jar", | ||
"entryPoint" : "io.quarkus.azure.functions.resteasy.runtime.Function.run", | ||
"bindings" : [ { | ||
"type" : "httpTrigger", | ||
"direction" : "in", | ||
"name" : "req", | ||
"route" : "{*path}", | ||
"methods" : [ "GET", "POST", "HEAD", "PUT", "OPTIONS", "DELETE" ], | ||
"dataType" : "binary", | ||
"authLevel" : "ANONYMOUS" | ||
}, { | ||
"type" : "http", | ||
"direction" : "out", | ||
"name" : "$return" | ||
} ] | ||
} |
3 changes: 3 additions & 0 deletions
3
...on/src/main/resources/codestarts/azure-functions-http-example/base/azure-config/host.json
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,3 @@ | ||
{ | ||
"version": "2.0" | ||
} |
7 changes: 7 additions & 0 deletions
7
...n/resources/codestarts/azure-functions-http-example/base/azure-config/local.settings.json
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,7 @@ | ||
{ | ||
"IsEncrypted": false, | ||
"Values": { | ||
"AzureWebJobsStorage": "", | ||
"FUNCTIONS_WORKER_RUNTIME": "java" | ||
} | ||
} |
115 changes: 115 additions & 0 deletions
115
...tor-json/src/main/resources/codestarts/azure-functions-http-example/base/pom.tpl.qute.xml
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,115 @@ | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<properties> | ||
<azure.functions.maven.plugin.version>1.3.2</azure.functions.maven.plugin.version> | ||
<resources-plugin.version>3.1.0</resources-plugin.version> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<functionAppName>$\{artifactId}-{gen-info.time}</functionAppName> | ||
<functionAppRegion>{app-region}</functionAppRegion> | ||
<functionResourceGroup>{resource-group}</functionResourceGroup> | ||
<function>{function}</function> | ||
<stagingDirectory>$\{project.build.directory}/azure-functions/$\{functionAppName}</stagingDirectory> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<!-- we only use azure plugin to deploy to Azure. | ||
The directory structure is set up through various plugins in this pom --> | ||
<plugin> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-functions-maven-plugin</artifactId> | ||
<version>$\{azure.functions.maven.plugin.version}</version> | ||
<configuration> | ||
<resourceGroup>$\{functionResourceGroup}</resourceGroup> | ||
<appName>$\{functionAppName}</appName> | ||
<region>$\{functionAppRegion}</region> | ||
<appSettings> | ||
<!-- Run Azure Function from package file by default --> | ||
<property> | ||
<name>WEBSITE_RUN_FROM_PACKAGE</name> | ||
<value>1</value> | ||
</property> | ||
<property> | ||
<name>FUNCTIONS_EXTENSION_VERSION</name> | ||
<value>~2</value> | ||
</property> | ||
<property> | ||
<name>FUNCTIONS_WORKER_RUNTIME</name> | ||
<value>java</value> | ||
</property> | ||
</appSettings> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>$\{resources-plugin.version}</version> | ||
<executions> | ||
<!-- add azure required json files | ||
to Azure staging directory --> | ||
<execution> | ||
<id>copy-base-azure-config</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<overwrite>true</overwrite> | ||
<outputDirectory>$\{stagingDirectory}</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>$\{project.basedir}/azure-config</directory> | ||
<includes> | ||
<include>host.json</include> | ||
<include>local.settings.json</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
<!-- copy unpacked function.json into Azure staging directory --> | ||
<execution> | ||
<id>copy-function-json</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<overwrite>true</overwrite> | ||
<outputDirectory>$\{stagingDirectory}/$\{function}</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>$\{project.basedir}/azure-config</directory> | ||
<filtering>true</filtering> | ||
<includes> | ||
<include>function.json</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
<!-- copy the uber-jar into Azure staging directory --> | ||
<execution> | ||
<id>copy-uberjar</id> | ||
<phase>install</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<overwrite>true</overwrite> | ||
<outputDirectory>$\{stagingDirectory}</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>$\{project.build.directory}</directory> | ||
<includes> | ||
<include>$\{project.artifactId}-$\{project.version}-runner.jar</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
1 change: 1 addition & 0 deletions
1
.../codestarts/azure-functions-http-example/base/src/main/resources/application.tpl.qute.yml
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 @@ | ||
quarkus.http.root-path: {root-context-path} |
21 changes: 21 additions & 0 deletions
21
...-descriptor-json/src/main/resources/codestarts/azure-functions-http-example/codestart.yml
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,21 @@ | ||
--- | ||
name: azure-functions-http-example | ||
ref: azure-functions-http | ||
type: example | ||
language: | ||
base: | ||
shared-data: | ||
uberjar: true | ||
supports: | ||
native: false | ||
# /api is the default root context azure functions will prepend | ||
root-context-path: "/api" | ||
data: | ||
app-region: | ||
westus | ||
resource-group: | ||
java-functions-group | ||
function: | ||
greeting | ||
dependencies: | ||
- io.quarkus:quarkus-azure-functions-http |
3 changes: 3 additions & 0 deletions
3
...r-json/src/main/resources/codestarts/funqy-amazon-lambda-example/base/README.md
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,3 @@ | ||
# Funqy Amazon Lambda Binding | ||
|
||
Guide: https://quarkus.io/guides/funqy-amazon-lambda |
13 changes: 13 additions & 0 deletions
13
...m-descriptor-json/src/main/resources/codestarts/funqy-amazon-lambda-example/codestart.yml
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,13 @@ | ||
--- | ||
name: funqy-amazon-lambda-example | ||
ref: funqy-amazon-lambda | ||
type: example | ||
language: | ||
base: | ||
shared-data: | ||
supports: | ||
dev-mode: false | ||
dependencies: | ||
- io.quarkus:quarkus-funqy-amazon-lambda | ||
test-dependencies: | ||
- io.quarkus:quarkus-test-amazon-lambda |
1 change: 1 addition & 0 deletions
1
...scriptor-json/src/main/resources/codestarts/funqy-amazon-lambda-example/java/payload.json
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 @@ | ||
{ "name" : "Bill" } |
11 changes: 11 additions & 0 deletions
11
...tarts/funqy-amazon-lambda-example/java/src/main/java/org/acme/funqy/GreetingFunction.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,11 @@ | ||
package org.acme.funqy; | ||
|
||
import io.quarkus.funqy.Funq; | ||
|
||
public class GreetingFunction { | ||
|
||
@Funq | ||
public String myFunqyGreeting(Person friend) { | ||
return "Hello " + friend.getName(); | ||
} | ||
} |
Oops, something went wrong.