Class TaskDefinitionController
java.lang.Object
org.springframework.cloud.dataflow.server.controller.TaskDefinitionController
@RestController
@RequestMapping("/tasks/definitions")
@ExposesResourceFor(TaskDefinitionResource.class)
public class TaskDefinitionController
extends Object
Controller for operations on
TaskDefinition
. This includes CRUD operations.- Author:
- Michael Minella, Marius Bogoevici, Glenn Renfro, Mark Fisher, Gunnar Hillert, Daniel Serleg, Ilayaperumal Gopinathan, Chris Bono
-
Constructor Summary
ConstructorDescriptionTaskDefinitionController
(DataflowTaskExplorer taskExplorer, TaskDefinitionRepository repository, TaskSaveService taskSaveService, TaskDeleteService taskDeleteService, TaskDefinitionAssemblerProvider<? extends TaskDefinitionResource> taskDefinitionAssemblerProvider) Creates aTaskDefinitionController
that delegates CRUD operations to the providedTaskDefinitionRepository
task status checks to the providedTaskLauncher
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Delete all task from the repository.void
destroyTask
(String name, Boolean cleanup) Delete the task from the repository so that it can no longer be executed.Return a given task definition resource.org.springframework.hateoas.PagedModel<? extends TaskDefinitionResource>
list
(org.springframework.data.domain.Pageable pageable, String taskName, String description, boolean manifest, String dslText, org.springframework.data.web.PagedResourcesAssembler<TaskExecutionAwareTaskDefinition> assembler) Return a page-able list ofTaskDefinitionResource
defined tasks.Register a task definition for future execution.
-
Constructor Details
-
TaskDefinitionController
public TaskDefinitionController(DataflowTaskExplorer taskExplorer, TaskDefinitionRepository repository, TaskSaveService taskSaveService, TaskDeleteService taskDeleteService, TaskDefinitionAssemblerProvider<? extends TaskDefinitionResource> taskDefinitionAssemblerProvider) Creates aTaskDefinitionController
that delegates- CRUD operations to the provided
TaskDefinitionRepository
- task status checks to the provided
TaskLauncher
- Parameters:
taskExplorer
- used to look up TaskExecutions.repository
- the repository this controller will use for task CRUD operations.taskSaveService
- handles Task saving related operations.taskDeleteService
- handles Task deletion related operations.taskDefinitionAssemblerProvider
- the task definition assembler provider to use.
- CRUD operations to the provided
-
-
Method Details
-
save
@PostMapping("") public TaskDefinitionResource save(@RequestParam String name, @RequestParam("definition") String dsl, @RequestParam(defaultValue="") String description) Register a task definition for future execution.- Parameters:
name
- name the name of the taskdsl
- DSL definition for the taskdescription
- description of the task definition- Returns:
- the task definition
-
destroyTask
@DeleteMapping("/{name}") @ResponseStatus(OK) public void destroyTask(@PathVariable String name, @RequestParam(required=false) Boolean cleanup) Delete the task from the repository so that it can no longer be executed.- Parameters:
name
- name of the task to be deletedcleanup
- optional cleanup indicator.
-
destroyAll
Delete all task from the repository. -
list
@GetMapping("") @ResponseStatus(OK) public org.springframework.hateoas.PagedModel<? extends TaskDefinitionResource> list(org.springframework.data.domain.Pageable pageable, @RequestParam(required=false) String taskName, @RequestParam(required=false) String description, @RequestParam(required=false) boolean manifest, @RequestParam(required=false) String dslText, org.springframework.data.web.PagedResourcesAssembler<TaskExecutionAwareTaskDefinition> assembler) Return a page-able list ofTaskDefinitionResource
defined tasks.- Parameters:
pageable
- page-able collection ofTaskDefinitionResource
taskName
- optional findByTaskNameContains parameterdslText
- optional findByDslText parameterdescription
- optional findByDescription parametermanifest
- optional manifest flag to indicate whether the latest task execution requires task manifest updateassembler
- assembler for theTaskDefinition
- Returns:
- a list of task definitions
-
display
@GetMapping("/{name}") @ResponseStatus(OK) public TaskDefinitionResource display(@PathVariable String name, @RequestParam(required=false) boolean manifest) Return a given task definition resource.- Parameters:
name
- the name of an existing task definition (required)manifest
- indicator to include manifest in response.- Returns:
- the task definition
-