@RestController
@RequestMapping(value="/api/v3/commands")
public class CommandRestController
extends java.lang.Object
Constructor and Description |
---|
CommandRestController(CommandPersistenceService commandPersistenceService,
ResourceAssemblers resourceAssemblers)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addApplicationsForCommand(java.lang.String id,
java.util.List<java.lang.String> applicationIds)
Add applications for the given command.
|
void |
addConfigsForCommand(java.lang.String id,
java.util.Set<java.lang.String> configs)
Add new configuration files to a given command.
|
void |
addDependenciesForCommand(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Add new dependency files for a given command.
|
void |
addTagsForCommand(java.lang.String id,
java.util.Set<java.lang.String> tags)
Add new tags to a given command.
|
org.springframework.http.ResponseEntity<java.lang.Void> |
createCommand(@Valid Command command)
Create a Command configuration.
|
void |
deleteAllCommands()
Delete all applications from database.
|
void |
deleteCommand(java.lang.String id)
Delete a command.
|
java.util.List<ApplicationResource> |
getApplicationsForCommand(java.lang.String id)
Get the applications configured for a given command.
|
java.util.Set<ClusterResource> |
getClustersForCommand(java.lang.String id,
java.util.Set<java.lang.String> statuses)
Get all the clusters this command is associated with.
|
CommandResource |
getCommand(java.lang.String id)
Get Command configuration for given id.
|
org.springframework.hateoas.PagedResources<CommandResource> |
getCommands(java.lang.String name,
java.lang.String user,
java.util.Set<java.lang.String> statuses,
java.util.Set<java.lang.String> tags,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler<Command> assembler)
Get Command configuration based on user parameters.
|
java.util.Set<java.lang.String> |
getConfigsForCommand(java.lang.String id)
Get all the configuration files for a given command.
|
java.util.Set<java.lang.String> |
getDependenciesForCommand(java.lang.String id)
Get all the dependency files for a given command.
|
java.util.Set<java.lang.String> |
getTagsForCommand(java.lang.String id)
Get all the tags for a given command.
|
void |
patchCommand(java.lang.String id,
com.github.fge.jsonpatch.JsonPatch patch)
Patch a command using JSON Patch.
|
void |
removeAllApplicationsForCommand(java.lang.String id)
Remove the applications from a given command.
|
void |
removeAllConfigsForCommand(java.lang.String id)
Delete the all configuration files from a given command.
|
void |
removeAllDependenciesForCommand(java.lang.String id)
Delete the all dependency files from a given command.
|
void |
removeAllTagsForCommand(java.lang.String id)
Delete the all tags from a given command.
|
void |
removeApplicationForCommand(java.lang.String id,
java.lang.String appId)
Remove the application from a given command.
|
void |
removeTagForCommand(java.lang.String id,
java.lang.String tag)
Remove an tag from a given command.
|
void |
setApplicationsForCommand(java.lang.String id,
java.util.List<java.lang.String> applicationIds)
Set the applications for the given command.
|
void |
updateCommand(java.lang.String id,
Command updateCommand)
Update command configuration.
|
void |
updateConfigsForCommand(java.lang.String id,
java.util.Set<java.lang.String> configs)
Update the configuration files for a given command.
|
void |
updateDependenciesForCommand(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Update the dependency files for a given command.
|
void |
updateTagsForCommand(java.lang.String id,
java.util.Set<java.lang.String> tags)
Update the tags for a given command.
|
@Autowired public CommandRestController(CommandPersistenceService commandPersistenceService, ResourceAssemblers resourceAssemblers)
commandPersistenceService
- The command configuration service to use.resourceAssemblers
- The encapsulation of all available V3 resource assemblers@PostMapping(consumes="application/json") @ResponseStatus(value=CREATED) public org.springframework.http.ResponseEntity<java.lang.Void> createCommand(@RequestBody @Valid @Valid Command command) throws GenieException
command
- The command configuration to createGenieException
- For any error@GetMapping(value="/{id}", produces="application/hal+json") @ResponseStatus(value=OK) public CommandResource getCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- unique id for command configurationGenieException
- For any error@GetMapping(produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.PagedResources<CommandResource> getCommands(@RequestParam(value="name",required=false) @Nullable java.lang.String name, @RequestParam(value="user",required=false) @Nullable java.lang.String user, @RequestParam(value="status",required=false) @Nullable java.util.Set<java.lang.String> statuses, @RequestParam(value="tag",required=false) @Nullable java.util.Set<java.lang.String> tags, @PageableDefault(size=64,sort="updated",direction=DESC) org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler<Command> assembler) throws GenieException
name
- Name for command (optional)user
- The user who created the configuration (optional)statuses
- The statuses of the commands to get (optional)tags
- The set of tags you want the command for.page
- The page to getassembler
- The paged resources assembler to useGenieException
- For any error@PutMapping(value="/{id}", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void updateCommand(@PathVariable(value="id") java.lang.String id, @RequestBody Command updateCommand) throws GenieException
id
- unique id for the configuration to update.updateCommand
- the information to update the command withGenieException
- For any error@PatchMapping(value="/{id}", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void patchCommand(@PathVariable(value="id") java.lang.String id, @RequestBody com.github.fge.jsonpatch.JsonPatch patch) throws GenieException
id
- The id of the command to patchpatch
- The JSON Patch instructionsGenieException
- On error@DeleteMapping @ResponseStatus(value=NO_CONTENT) public void deleteAllCommands() throws GenieException
GenieException
- For any error@DeleteMapping(value="/{id}") @ResponseStatus(value=NO_CONTENT) public void deleteCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- unique id for configuration to deleteGenieException
- For any error@PostMapping(value="/{id}/configs", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void addConfigsForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> configs) throws GenieException
id
- The id of the command to add the configuration file to. Not
null/empty/blank.configs
- The configuration files to add. Not null/empty/blank.GenieException
- For any error@GetMapping(value="/{id}/configs", produces="application/json") @ResponseStatus(value=OK) public java.util.Set<java.lang.String> getConfigsForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to get the configuration files for. Not
NULL/empty/blank.GenieException
- For any error@PutMapping(value="/{id}/configs", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void updateConfigsForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> configs) throws GenieException
id
- The id of the command to update the configuration files for.
Not null/empty/blank.configs
- The configuration files to replace existing configuration
files with. Not null/empty/blank.GenieException
- For any error@DeleteMapping(value="/{id}/configs") @ResponseStatus(value=NO_CONTENT) public void removeAllConfigsForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to delete the configuration files from.
Not null/empty/blank.GenieException
- For any error@PostMapping(value="/{id}/dependencies", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void addDependenciesForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> dependencies) throws GenieException
id
- The id of the command to add the dependency file to. Not
null/empty/blank.dependencies
- The dependency files to add. Not null.GenieException
- For any error@GetMapping(value="/{id}/dependencies", produces="application/json") @ResponseStatus(value=OK) public java.util.Set<java.lang.String> getDependenciesForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to get the dependency files for. Not
NULL/empty/blank.GenieException
- For any error@PutMapping(value="/{id}/dependencies", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void updateDependenciesForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> dependencies) throws GenieException
id
- The id of the command to update the dependency files for. Not
null/empty/blank.dependencies
- The dependency files to replace existing dependency files with. Not
null/empty/blank.GenieException
- For any error@DeleteMapping(value="/{id}/dependencies") @ResponseStatus(value=NO_CONTENT) public void removeAllDependenciesForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to delete the dependency files from. Not
null/empty/blank.GenieException
- For any error@PostMapping(value="/{id}/tags", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void addTagsForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> tags) throws GenieException
id
- The id of the command to add the tags to. Not
null/empty/blank.tags
- The tags to add. Not null/empty/blank.GenieException
- For any error@GetMapping(value="/{id}/tags", produces="application/json") @ResponseStatus(value=OK) public java.util.Set<java.lang.String> getTagsForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to get the tags for. Not
NULL/empty/blank.GenieException
- For any error@PutMapping(value="/{id}/tags", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void updateTagsForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> tags) throws GenieException
id
- The id of the command to update the tags for.
Not null/empty/blank.tags
- The tags to replace existing configuration
files with. Not null/empty/blank.GenieException
- For any error@DeleteMapping(value="/{id}/tags") @ResponseStatus(value=NO_CONTENT) public void removeAllTagsForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to delete the tags from.
Not null/empty/blank.GenieException
- For any error@DeleteMapping(value="/{id}/tags/{tag}") @ResponseStatus(value=NO_CONTENT) public void removeTagForCommand(@PathVariable(value="id") java.lang.String id, @PathVariable(value="tag") java.lang.String tag) throws GenieException
id
- The id of the command to delete the tag from. Not
null/empty/blank.tag
- The tag to remove. Not null/empty/blank.GenieException
- For any error@PostMapping(value="/{id}/applications", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void addApplicationsForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.List<java.lang.String> applicationIds) throws GenieException
id
- The id of the command to add the applications to. Not
null/empty/blank.applicationIds
- The ids of the applications to add. Not null.GenieException
- For any error@GetMapping(value="/{id}/applications", produces="application/hal+json") @ResponseStatus(value=OK) public java.util.List<ApplicationResource> getApplicationsForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to get the application files for. Not
NULL/empty/blank.GenieException
- For any error@PutMapping(value="/{id}/applications", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void setApplicationsForCommand(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.List<java.lang.String> applicationIds) throws GenieException
id
- The id of the command to add the applications to. Not
null/empty/blank.applicationIds
- The ids of the applications to set in order. Not null.GenieException
- For any error@DeleteMapping(value="/{id}/applications") @ResponseStatus(value=NO_CONTENT) public void removeAllApplicationsForCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the command to delete the applications from. Not
null/empty/blank.GenieException
- For any error@DeleteMapping(value="/{id}/applications/{appId}") @ResponseStatus(value=NO_CONTENT) public void removeApplicationForCommand(@PathVariable(value="id") java.lang.String id, @PathVariable(value="appId") java.lang.String appId) throws GenieException
id
- The id of the command to delete the application from. Not
null/empty/blank.appId
- The id of the application to remove from the command. Not null/empty/blank.GenieException
- For any error@GetMapping(value="/{id}/clusters", produces="application/hal+json") @ResponseStatus(value=OK) public java.util.Set<ClusterResource> getClustersForCommand(@PathVariable(value="id") java.lang.String id, @RequestParam(value="status",required=false) @Nullable java.util.Set<java.lang.String> statuses) throws GenieException
id
- The id of the command to get the clusters for. Not
NULL/empty/blank.statuses
- The statuses of the clusters to getGenieException
- For any error