@RestController @ConditionalOnBean(value={PunchlineResourcesService.class,PunchlineExecuteService.class}) @RequestMapping(value="/v1/{tenant}/punchline") public class PunchlineRoute extends Object
Constructor and Description |
---|
PunchlineRoute(PunchlineResourcesService service,
PunchlineExecuteService executeService) |
Modifier and Type | Method and Description |
---|---|
void |
delete(String tenant,
String id)
Delete a Punchline.
|
org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsMap> |
execute(String tenant,
String id)
Execute a saved Punchline
|
org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> |
execute(String tenant,
String runtime,
org.springframework.web.multipart.MultipartFile file)
Execute a Punchline
|
org.springframework.http.ResponseEntity<String> |
executionOutputById(String tenant,
String id)
Get execution output for a given Punchline.
|
org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> |
executions(String tenant,
javax.servlet.http.HttpServletRequest req)
Get all executions for a given tenant.
|
org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> |
executions(String tenant,
String pmlId,
javax.servlet.http.HttpServletRequest req)
Get executions for a given punchline.
|
org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> |
executionsById(String tenant,
String id)
Get all execution events for a given Punchline.
|
org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> |
getAll(String tenant)
Get list of saved Punchline files
|
org.springframework.http.ResponseEntity<byte[]> |
getOne(String tenant,
String id)
Get Punchline content
|
void |
resetScan()
Reset Analytics nodes available for Punchline
|
org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsMap> |
save(String tenant,
org.springframework.web.multipart.MultipartFile file)
Save a Punchline file
|
org.springframework.http.ResponseEntity<String> |
scan(String tenant)
Get list of all nodes available for Punchline
|
org.springframework.http.ResponseEntity<String> |
scanPyspark(String tenant)
Get list of all nodes available for Punchline
|
org.springframework.http.ResponseEntity<String> |
scanStorm(String tenant)
Get list of all nodes available for Punchline
|
org.springframework.web.context.request.async.DeferredResult<org.springframework.http.ResponseEntity<String>> |
trigger(String args,
String tenant)
POST request, expecting a JSON body where each element is an argument
to be passed for our PUNCHLINE execution
|
public PunchlineRoute(PunchlineResourcesService service, PunchlineExecuteService executeService)
@PostMapping(value="/save", consumes={"multipart/mixed","multipart/form-data"}, produces="application/json") public org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsMap> save(@PathVariable String tenant, @RequestPart org.springframework.web.multipart.MultipartFile file) throws IOException, org.thales.punch.exceptions.ConfigurationException
tenant
- tenantfile
- Punchline fileIOException
- Error on writing in ElasticSearchorg.thales.punch.exceptions.ConfigurationException
@GetMapping(produces="application/json") public org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> getAll(@PathVariable String tenant)
tenant
- tenant@GetMapping(value="/scan/analytics", produces="application/json") public org.springframework.http.ResponseEntity<String> scan(@PathVariable String tenant) throws InterruptedException
tenant
- tenantInterruptedException
- Analytics Scan error@GetMapping(value="/scan/storm", produces="application/json") public org.springframework.http.ResponseEntity<String> scanStorm(@PathVariable String tenant) throws InterruptedException
tenant
- tenantInterruptedException
- Strom Scan error@GetMapping(value="/scan/pyspark", produces="application/json") public org.springframework.http.ResponseEntity<String> scanPyspark(@PathVariable String tenant) throws InterruptedException
tenant
- tenantInterruptedException
- Pyspark Scan error@CacheEvict(value={"scan","scan-analytics"}) @Scheduled(fixedDelay=3600000L) @DeleteMapping(value="/scan/reset") public void resetScan()
@GetMapping(value="/{id}", produces="application/json") public org.springframework.http.ResponseEntity<byte[]> getOne(@PathVariable String tenant, @PathVariable String id)
tenant
- tenantid
- id@PostMapping(value="/{id}", produces="application/json") public org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsMap> execute(@PathVariable String tenant, @PathVariable String id)
tenant
- tenantid
- id@PostMapping(value="/foreground/{runtime}") public org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody> execute(@PathVariable String tenant, @PathVariable String runtime, @RequestPart org.springframework.web.multipart.MultipartFile file) throws IOException, InterruptedException
tenant
- Tenant nameruntime
- Execution environment (storm | spark | pyspark)file
- Punchline to testIOException
- Triggered if unable to create file on systemInterruptedException
@DeleteMapping(value="/{id}") public void delete(@PathVariable String tenant, @PathVariable String id)
tenant
- tenantid
- id@GetMapping(value="/executions/{id}/events") public org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> executionsById(@PathVariable String tenant, @PathVariable String id) throws IOException
tenant
- tenantid
- punchline idIOException
- Error when getting data form ES@GetMapping(value="/executions/{id}/output") public org.springframework.http.ResponseEntity<String> executionOutputById(@PathVariable String tenant, @PathVariable String id) throws IOException
tenant
- Tenant nameid
- Punchline idIOException
- Error when getting data form ES@GetMapping(value="/executions") public org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> executions(@PathVariable String tenant, javax.servlet.http.HttpServletRequest req) throws IOException
tenant
- Tenant nameIOException
- Error when getting data from ES@GetMapping(value="/executions/{pmlId}") public org.springframework.http.ResponseEntity<org.thales.punch.settings.api.ISettingsList> executions(@PathVariable String tenant, @PathVariable String pmlId, javax.servlet.http.HttpServletRequest req) throws IOException
tenant
- Tenant namepmlId
- Punchline idIOException
- Error when getting data from ES@PostMapping(value="/trigger") @ResponseBody public org.springframework.web.context.request.async.DeferredResult<org.springframework.http.ResponseEntity<String>> trigger(@RequestBody String args, @PathVariable String tenant)
curl -H "Content-Type: application/json" -d @post.json -XPOST localhost:4242/v1/mytenant/punchline/trigger -v | jq
with post.json:
{
"punchline": "/home/jonathan/Desktop/standalone/punch-standalone-linux-6.2.0-SNAPSHOT/conf/samples/punchlines/spark/basics/dataset_generator.hjson",
"runtime": "spark",
"spark-master": "spark://localhost:7077",
"deploy-mode": "cluster"
}
args
- valid JSON stringCopyright © 2023. All rights reserved.