-
Notifications
You must be signed in to change notification settings - Fork 41
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
1 parent
bd8298c
commit 5efa465
Showing
397 changed files
with
3,506 additions
and
39 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 |
---|---|---|
@@ -1,47 +1,47 @@ | ||
name: Build and Push Docker Images | ||
# name: Build and Push Docker Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- githubactions-deploy | ||
# on: | ||
# push: | ||
# branches: | ||
# - githubactions-deploy | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
# steps: | ||
# - name: Checkout Repository | ||
# uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
- name: Set up Kaniko | ||
uses: GoogleContainerTools/kaniko-action@v0.1 | ||
with: | ||
image: gcr.io/kaniko-project/executor:debug | ||
args: > | ||
--context "${{ github.workspace }}" | ||
--dockerfile "${{ github.workspace }}/Dockerfile" | ||
--destination "${{ env.REGISTRY_IMAGE }}:${{ matrix.ARCH }}" | ||
# - name: Set up JDK 8 | ||
# uses: actions/setup-java@v2 | ||
# with: | ||
# java-version: '8' | ||
# distribution: 'adopt' | ||
# - name: Set up Kaniko | ||
# uses: GoogleContainerTools/kaniko-action@v0.1 | ||
# with: | ||
# image: gcr.io/kaniko-project/executor:debug | ||
# args: > | ||
# --context "${{ github.workspace }}" | ||
# --dockerfile "${{ github.workspace }}/Dockerfile" | ||
# --destination "${{ env.REGISTRY_IMAGE }}:${{ matrix.ARCH }}" | ||
|
||
|
||
# - name: Cache Maven Packages | ||
# uses: actions/cache@v2 | ||
# with: | ||
# path: ~/.m2 | ||
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
# restore-keys: ${{ runner.os }}-m2 | ||
# # - name: Cache Maven Packages | ||
# # uses: actions/cache@v2 | ||
# # with: | ||
# # path: ~/.m2 | ||
# # key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
# # restore-keys: ${{ runner.os }}-m2 | ||
|
||
# - name: Maven Build | ||
# run: mvn -B package --file pom.xml | ||
# # - name: Maven Build | ||
# # run: mvn -B package --file pom.xml | ||
|
||
# - name: Build and Push Docker Image | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# context: . | ||
# file: build/maven/Dockerfile | ||
# push: true | ||
# tags: user/repo:tag | ||
# # - name: Build and Push Docker Image | ||
# # uses: docker/build-push-action@v2 | ||
# # with: | ||
# # context: . | ||
# # file: build/maven/Dockerfile | ||
# # push: true | ||
# # tags: user/repo:tag |
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,10 @@ | ||
name: Actions Runner Controller Demo | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Explore-GitHub-Actions: | ||
# You need to use the INSTALLATION_NAME from the previous step | ||
runs-on: arc-runner-set | ||
steps: | ||
- run: echo "🎉 This job uses runner scale set runners!" |
135 changes: 135 additions & 0 deletions
135
accelerators/codegen/target/classes/JavaSpringBoot/api.mustache
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,135 @@ | ||
/** | ||
* NOTE: This class is auto generated by the swagger code generator program ({{{generatorVersion}}}). | ||
* https://github.com/swagger-api/swagger-codegen | ||
* Do not edit the class manually. | ||
*/ | ||
package {{package}}; | ||
|
||
{{#imports}}import {{import}}; | ||
{{/imports}} | ||
{{#jdk8-no-delegate}} | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
{{/jdk8-no-delegate}} | ||
import io.swagger.annotations.*; | ||
{{#jdk8-no-delegate}} | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpStatus; | ||
{{/jdk8-no-delegate}} | ||
import org.springframework.http.ResponseEntity; | ||
{{#useBeanValidation}} | ||
import org.springframework.validation.annotation.Validated; | ||
{{/useBeanValidation}} | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
{{#jdk8-no-delegate}} | ||
import javax.servlet.http.HttpServletRequest; | ||
{{/jdk8-no-delegate}} | ||
{{#useBeanValidation}} | ||
import javax.validation.Valid; | ||
import javax.validation.constraints.*; | ||
{{/useBeanValidation}} | ||
{{#jdk8-no-delegate}} | ||
import java.io.IOException; | ||
{{/jdk8-no-delegate}} | ||
import java.util.List; | ||
{{#jdk8-no-delegate}} | ||
import java.util.Optional; | ||
{{/jdk8-no-delegate}} | ||
{{^jdk8-no-delegate}} | ||
{{#useOptional}} | ||
import java.util.Optional; | ||
{{/useOptional}} | ||
{{/jdk8-no-delegate}} | ||
{{#async}} | ||
import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}}; | ||
{{/async}} | ||
{{>generatedAnnotation}} | ||
@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API") | ||
{{#operations}} | ||
public interface {{classname}} { | ||
{{#jdk8}} | ||
|
||
{{^isDelegate}} | ||
Logger log = LoggerFactory.getLogger({{classname}}.class); | ||
|
||
default Optional<ObjectMapper> getObjectMapper() { | ||
return Optional.empty(); | ||
} | ||
|
||
default Optional<HttpServletRequest> getRequest() { | ||
return Optional.empty(); | ||
} | ||
|
||
default Optional<String> getAcceptHeader() { | ||
return getRequest().map(r -> r.getHeader("Accept")); | ||
} | ||
{{/isDelegate}} | ||
{{#isDelegate}} | ||
{{classname}}Delegate getDelegate(); | ||
{{/isDelegate}} | ||
{{/jdk8}} | ||
{{#operation}} | ||
|
||
@ApiOperation(value = "{{{summary}}}", nickname = "{{{operationId}}}", notes = "{{{notes}}}"{{#returnBaseType}}, response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { | ||
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { | ||
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, | ||
{{/hasMore}}{{/scopes}} | ||
}{{/isOAuth}}){{#hasMore}}, | ||
{{/hasMore}}{{/authMethods}} | ||
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) | ||
@ApiResponses(value = { {{#responses}} | ||
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}.class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}} }) | ||
{{#implicitHeaders}} | ||
@ApiImplicitParams({ | ||
{{#headerParams}} | ||
{{>implicitHeader}} | ||
{{/headerParams}} | ||
}) | ||
{{/implicitHeaders}} | ||
@RequestMapping(value = "{{{path}}}",{{#singleContentTypes}}{{#hasProduces}} | ||
produces = "{{{vendorExtensions.x-accepts}}}", {{/hasProduces}}{{#hasConsumes}} | ||
consumes = "{{{vendorExtensions.x-contentType}}}",{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}} | ||
produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}} | ||
consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}} | ||
method = RequestMethod.{{httpMethod}}) | ||
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { | ||
{{#delegate-method}} | ||
return {{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); | ||
} | ||
|
||
// Override this method | ||
default {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{{dataType}}}{{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}},{{/hasMore}}{{/allParams}}) { | ||
{{/delegate-method}} | ||
{{^isDelegate}} | ||
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { | ||
{{#examples}} | ||
if (getAcceptHeader().get().contains("{{{contentType}}}")) { | ||
try { | ||
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(getObjectMapper().get().readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED){{#async}}){{/async}}; | ||
} catch (IOException e) { | ||
log.error("Couldn't serialize response for content type {{{contentType}}}", e); | ||
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR){{#async}}){{/async}}; | ||
} | ||
} | ||
{{/examples}} | ||
} else { | ||
log.warn("ObjectMapper or HttpServletRequest not configured in default {{classname}} interface so no example is generated"); | ||
} | ||
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED){{#async}}){{/async}}; | ||
{{/isDelegate}} | ||
{{#isDelegate}} | ||
return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); | ||
{{/isDelegate}} | ||
}{{/jdk8}} | ||
|
||
{{/operation}} | ||
} | ||
{{/operations}} |
147 changes: 147 additions & 0 deletions
147
accelerators/codegen/target/classes/JavaSpringBoot/apiController.mustache
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,147 @@ | ||
package {{package}}; | ||
|
||
{{^jdk8}} | ||
{{#imports}}import {{import}}; | ||
{{/imports}} | ||
{{/jdk8}} | ||
{{^isDelegate}} | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
{{/isDelegate}} | ||
{{^jdk8}} | ||
import io.swagger.annotations.*; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
{{/jdk8}} | ||
import org.springframework.stereotype.Controller; | ||
{{^jdk8}} | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
{{#useBeanValidation}} | ||
import javax.validation.constraints.*; | ||
import javax.validation.Valid; | ||
{{/useBeanValidation}} | ||
{{/jdk8}} | ||
{{^isDelegate}} | ||
import javax.servlet.http.HttpServletRequest; | ||
{{#jdk8}} | ||
import java.util.Optional; | ||
{{/jdk8}} | ||
{{/isDelegate}} | ||
{{^jdk8-no-delegate}} | ||
{{#useOptional}} | ||
import java.util.Optional; | ||
{{/useOptional}} | ||
{{/jdk8-no-delegate}} | ||
{{^jdk8}} | ||
{{^isDelegate}} | ||
import java.io.IOException; | ||
{{/isDelegate}} | ||
import java.util.List; | ||
{{#async}} | ||
import java.util.concurrent.Callable; | ||
{{/async}} | ||
{{/jdk8}} | ||
{{>generatedAnnotation}} | ||
@Controller | ||
{{#operations}} | ||
public class {{classname}}Controller implements {{classname}} { | ||
{{#isDelegate}} | ||
private final {{classname}}Delegate delegate; | ||
|
||
@org.springframework.beans.factory.annotation.Autowired | ||
public {{classname}}Controller({{classname}}Delegate delegate) { | ||
this.delegate = delegate; | ||
} | ||
{{#jdk8}} | ||
|
||
@Override | ||
public {{classname}}Delegate getDelegate() { | ||
return delegate; | ||
} | ||
{{/jdk8}} | ||
{{/isDelegate}} | ||
{{^isDelegate}} | ||
{{^jdk8}} | ||
private static final Logger log = LoggerFactory.getLogger({{classname}}Controller.class); | ||
|
||
{{/jdk8}} | ||
private final ObjectMapper objectMapper; | ||
|
||
private final HttpServletRequest request; | ||
|
||
@org.springframework.beans.factory.annotation.Autowired | ||
public {{classname}}Controller(ObjectMapper objectMapper, HttpServletRequest request) { | ||
this.objectMapper = objectMapper; | ||
this.request = request; | ||
} | ||
{{#jdk8}} | ||
|
||
@Override | ||
public Optional<ObjectMapper> getObjectMapper() { | ||
return Optional.ofNullable(objectMapper); | ||
} | ||
|
||
@Override | ||
public Optional<HttpServletRequest> getRequest() { | ||
return Optional.ofNullable(request); | ||
} | ||
{{/jdk8}} | ||
|
||
{{/isDelegate}} | ||
{{^jdk8}} | ||
{{#operation}} | ||
public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) { | ||
{{^isDelegate}} | ||
{{^async}} | ||
String accept = request.getHeader("Accept"); | ||
{{#examples}} | ||
if (accept != null && accept.contains("{{{contentType}}}")) { | ||
try { | ||
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED); | ||
} catch (IOException e) { | ||
log.error("Couldn't serialize response for content type {{{contentType}}}", e); | ||
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
{{/examples}} | ||
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.NOT_IMPLEMENTED); | ||
{{/async}} | ||
{{#async}} | ||
return new Callable<ResponseEntity<{{>returnTypes}}>>() { | ||
@Override | ||
public ResponseEntity<{{>returnTypes}}> call() { | ||
String accept = request.getHeader("Accept"); | ||
{{#examples}} | ||
if (accept != null && accept.contains("{{{contentType}}}")) { | ||
try { | ||
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED); | ||
} catch (IOException e) { | ||
log.error("Couldn't serialize response for content type {{{contentType}}}", e); | ||
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
{{/examples}} | ||
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.NOT_IMPLEMENTED); | ||
} | ||
}; | ||
{{/async}} | ||
{{/isDelegate}} | ||
{{#isDelegate}} | ||
return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); | ||
{{/isDelegate}} | ||
} | ||
|
||
{{/operation}} | ||
{{/jdk8}} | ||
} | ||
{{/operations}} |
Oops, something went wrong.