Class StreamDefinitionController
java.lang.Object
org.springframework.cloud.dataflow.server.controller.StreamDefinitionController
@RestController
@RequestMapping("/streams/definitions")
@ExposesResourceFor(StreamDefinitionResource.class)
public class StreamDefinitionController
extends Object
Controller for operations on
StreamDefinition
. This includes CRUD and optional
deployment operations.- Author:
- Eric Bottard, Mark Fisher, Patrick Peralta, Ilayaperumal Gopinathan, Gunnar Hillert, Oleg Zhurakousky, Glenn Renfro, Christian Tzolov, Andy Clement
-
Constructor Summary
ConstructorDescriptionStreamDefinitionController
(StreamService streamService, StreamDefinitionService streamDefinitionService, AppRegistryService appRegistryService, StreamDefinitionAssemblerProvider<? extends StreamDefinitionResource> streamDefinitionAssemblerProvider, AppRegistrationAssemblerProvider<? extends AppRegistrationResource> appRegistrationAssemblerProvider) Create aStreamDefinitionController
that delegates toStreamService
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Request removal of an existing stream definition.void
Request removal of all stream definitions.Return a given stream definition resource.org.springframework.hateoas.PagedModel<? extends StreamDefinitionResource>
list
(org.springframework.data.domain.Pageable pageable, String search, org.springframework.data.web.PagedResourcesAssembler<StreamDefinition> assembler) Return a page-able list ofStreamDefinitionResource
defined streams.List<? extends AppRegistrationResource>
listApplications
(String name) org.springframework.hateoas.PagedModel<? extends StreamDefinitionResource>
listRelated
(org.springframework.data.domain.Pageable pageable, String name, boolean nested, org.springframework.data.web.PagedResourcesAssembler<StreamDefinition> assembler) Return a list of related stream definition resources based on the given stream name.Create a new stream and optionally deploy it.saveWithDeployProps
(String name, String dsl, String description, boolean deploy, Map<String, String> deploymentProperties) Create a new stream and optionally deploy it.
-
Constructor Details
-
StreamDefinitionController
public StreamDefinitionController(StreamService streamService, StreamDefinitionService streamDefinitionService, AppRegistryService appRegistryService, StreamDefinitionAssemblerProvider<? extends StreamDefinitionResource> streamDefinitionAssemblerProvider, AppRegistrationAssemblerProvider<? extends AppRegistrationResource> appRegistrationAssemblerProvider) Create aStreamDefinitionController
that delegates toStreamService
.- Parameters:
streamService
- the stream service to usestreamDefinitionService
- the stream definition service to useappRegistryService
- the app registry service to usestreamDefinitionAssemblerProvider
- the stream definition assembler provider to useappRegistrationAssemblerProvider
- the app registry assembler provider to use
-
-
Method Details
-
list
@GetMapping("") @ResponseStatus(OK) public org.springframework.hateoas.PagedModel<? extends StreamDefinitionResource> list(org.springframework.data.domain.Pageable pageable, @RequestParam(required=false) String search, org.springframework.data.web.PagedResourcesAssembler<StreamDefinition> assembler) Return a page-able list ofStreamDefinitionResource
defined streams.- Parameters:
pageable
- Pagination informationassembler
- assembler forStreamDefinition
search
- optional findByTaskNameContains parameter- Returns:
- list of stream definitions
-
save
@PostMapping(value="", consumes="application/x-www-form-urlencoded") @ResponseStatus(CREATED) public StreamDefinitionResource save(@RequestParam String name, @RequestParam("definition") String dsl, @RequestParam(defaultValue="") String description, @RequestParam(defaultValue="false") boolean deploy) Create a new stream and optionally deploy it.Differs from
saveWithDeployProps(java.lang.String, java.lang.String, java.lang.String, boolean, java.util.Map<java.lang.String, java.lang.String>)
by accepting deployment properties and consumingMediaType.APPLICATION_FORM_URLENCODED
request content (required by the Dataflow Shell).- Parameters:
name
- stream namedsl
- DSL definition for streamdeploy
- iftrue
, the stream is deployed upon creation (default isfalse
)description
- description of the stream definition- Returns:
- the created stream definition
- Throws:
DuplicateStreamDefinitionException
- if a stream definition with the same name already existsInvalidStreamDefinitionException
- if there are errors parsing the stream DSL, resolving the name, or type of applications in the stream
-
saveWithDeployProps
@PostMapping(value="", consumes="application/json") @ResponseStatus(CREATED) public StreamDefinitionResource saveWithDeployProps(@RequestParam String name, @RequestParam("definition") String dsl, @RequestParam(defaultValue="") String description, @RequestParam(defaultValue="false") boolean deploy, @RequestBody(required=false) Map<String, String> deploymentProperties) Create a new stream and optionally deploy it.Differs from
save(java.lang.String, java.lang.String, java.lang.String, boolean)
by accepting deployment properties and consumingMediaType.APPLICATION_JSON
request content.- Parameters:
name
- stream namedsl
- DSL definition for streamdeploy
- iftrue
, the stream is deployed upon creation (default isfalse
)deploymentProperties
- the optional deployment properties to use when the stream is deployed upon creationdescription
- description of the stream definition- Returns:
- the created stream definition
- Throws:
DuplicateStreamDefinitionException
- if a stream definition with the same name already existsInvalidStreamDefinitionException
- if there are errors parsing the stream DSL, resolving the name, or type of applications in the stream
-
delete
Request removal of an existing stream definition.- Parameters:
name
- the name of an existing stream definition (required)
-
listRelated
@GetMapping("/{name}/related") @ResponseStatus(OK) public org.springframework.hateoas.PagedModel<? extends StreamDefinitionResource> listRelated(org.springframework.data.domain.Pageable pageable, @PathVariable String name, @RequestParam(required=false,defaultValue="false") boolean nested, org.springframework.data.web.PagedResourcesAssembler<StreamDefinition> assembler) Return a list of related stream definition resources based on the given stream name. Related streams include the main stream and the tap stream(s) on the main stream.- Parameters:
pageable
- Pagination informationname
- the name of an existing stream definition (required)nested
- if should recursively findByTaskNameContains for related stream definitionsassembler
- resource assembler for stream definition- Returns:
- a list of related stream definitions
-
display
@GetMapping("/{name}") @ResponseStatus(OK) public StreamDefinitionResource display(@PathVariable String name) Return a given stream definition resource.- Parameters:
name
- the name of an existing stream definition (required)- Returns:
- the stream definition
-
listApplications
@GetMapping("/{name}/applications") @ResponseStatus(OK) public List<? extends AppRegistrationResource> listApplications(@PathVariable String name) -
deleteAll
Request removal of all stream definitions.
-