@RestController
@RequestMapping(value="/api/v3/applications")
public class ApplicationRestController
extends java.lang.Object
Constructor and Description |
---|
ApplicationRestController(ApplicationService applicationService,
ApplicationResourceAssembler applicationResourceAssembler,
CommandResourceAssembler commandResourceAssembler)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addConfigsToApplication(java.lang.String id,
java.util.Set<java.lang.String> configs)
Add new configuration files to a given application.
|
void |
addDependenciesForApplication(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Add new dependency files for a given application.
|
void |
addTagsForApplication(java.lang.String id,
java.util.Set<java.lang.String> tags)
Add new tags to a given application.
|
org.springframework.http.ResponseEntity<java.lang.Void> |
createApplication(Application app)
Create an Application.
|
void |
deleteAllApplications()
Delete all applications from database.
|
void |
deleteApplication(java.lang.String id)
Delete an application configuration from database.
|
ApplicationResource |
getApplication(java.lang.String id)
Get Application for given id.
|
org.springframework.hateoas.PagedResources<ApplicationResource> |
getApplications(java.lang.String name,
java.lang.String user,
java.util.Set<java.lang.String> statuses,
java.util.Set<java.lang.String> tags,
java.lang.String type,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler<Application> assembler)
Get Applications based on user parameters.
|
java.util.Set<CommandResource> |
getCommandsForApplication(java.lang.String id,
java.util.Set<java.lang.String> statuses)
Get all the commands this application is associated with.
|
java.util.Set<java.lang.String> |
getConfigsForApplication(java.lang.String id)
Get all the configuration files for a given application.
|
java.util.Set<java.lang.String> |
getDependenciesForApplication(java.lang.String id)
Get all the dependency files for a given application.
|
java.util.Set<java.lang.String> |
getTagsForApplication(java.lang.String id)
Get all the tags for a given application.
|
void |
patchApplication(java.lang.String id,
com.github.fge.jsonpatch.JsonPatch patch)
Patch an application using JSON Patch.
|
void |
removeAllConfigsForApplication(java.lang.String id)
Delete the all configuration files from a given application.
|
void |
removeAllDependenciesForApplication(java.lang.String id)
Delete the all dependency files from a given application.
|
void |
removeAllTagsForApplication(java.lang.String id)
Delete the all tags from a given application.
|
void |
removeTagForApplication(java.lang.String id,
java.lang.String tag)
Remove an tag from a given application.
|
void |
updateApplication(java.lang.String id,
Application updateApp)
Update application.
|
void |
updateConfigsForApplication(java.lang.String id,
java.util.Set<java.lang.String> configs)
Update the configuration files for a given application.
|
void |
updateDependenciesForApplication(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Update the dependency files for a given application.
|
void |
updateTagsForApplication(java.lang.String id,
java.util.Set<java.lang.String> tags)
Update the tags for a given application.
|
@Autowired public ApplicationRestController(ApplicationService applicationService, ApplicationResourceAssembler applicationResourceAssembler, CommandResourceAssembler commandResourceAssembler)
applicationService
- The application configuration service to use.applicationResourceAssembler
- The assembler used to create Application resources.commandResourceAssembler
- The assembler used to create Command resources.@PostMapping(consumes="application/json") @ResponseStatus(value=CREATED) public org.springframework.http.ResponseEntity<java.lang.Void> createApplication(@RequestBody Application app) throws GenieException
app
- The application to createGenieException
- For any error@DeleteMapping @ResponseStatus(value=NO_CONTENT) public void deleteAllApplications() throws GenieException
GenieException
- For any error@GetMapping(produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.PagedResources<ApplicationResource> getApplications(@RequestParam(value="name",required=false) java.lang.String name, @RequestParam(value="user",required=false) java.lang.String user, @RequestParam(value="status",required=false) java.util.Set<java.lang.String> statuses, @RequestParam(value="tag",required=false) java.util.Set<java.lang.String> tags, @RequestParam(value="type",required=false) java.lang.String type, @PageableDefault(sort="updated",direction=DESC) org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler<Application> assembler) throws GenieException
name
- name for configuration (optional)user
- The user who created the application (optional)statuses
- The statuses of the applications (optional)tags
- The set of tags you want the application for. (optional)type
- The type of applications to get (optional)page
- The page to getassembler
- The paged resources assembler to useGenieException
- For any error@GetMapping(value="/{id}", produces="application/hal+json") @ResponseStatus(value=OK) public ApplicationResource getApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- unique id for application configurationGenieException
- For any error@PutMapping(value="/{id}", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void updateApplication(@PathVariable(value="id") java.lang.String id, @RequestBody Application updateApp) throws GenieException
id
- unique id for configuration to updateupdateApp
- contains the application information to updateGenieException
- For any error@PatchMapping(value="/{id}", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void patchApplication(@PathVariable(value="id") java.lang.String id, @RequestBody com.github.fge.jsonpatch.JsonPatch patch) throws GenieException
id
- The id of the application to patchpatch
- The JSON Patch instructionsGenieException
- On error@DeleteMapping(value="/{id}") @ResponseStatus(value=NO_CONTENT) public void deleteApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- unique id of configuration to deleteGenieException
- For any error@PostMapping(value="/{id}/configs", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void addConfigsToApplication(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> configs) throws GenieException
id
- The id of the application 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> getConfigsForApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the application 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 updateConfigsForApplication(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> configs) throws GenieException
id
- The id of the application 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 removeAllConfigsForApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the application 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 addDependenciesForApplication(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> dependencies) throws GenieException
id
- The id of the application 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> getDependenciesForApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the application 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 updateDependenciesForApplication(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> dependencies) throws GenieException
id
- The id of the application 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 removeAllDependenciesForApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the application 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 addTagsForApplication(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> tags) throws GenieException
id
- The id of the application 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> getTagsForApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the application 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 updateTagsForApplication(@PathVariable(value="id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> tags) throws GenieException
id
- The id of the application 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 removeAllTagsForApplication(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the application to delete the tags from.
Not null/empty/blank.GenieException
- For any error@DeleteMapping(value="/{id}/tags/{tag}") @ResponseStatus(value=NO_CONTENT) public void removeTagForApplication(@PathVariable(value="id") java.lang.String id, @PathVariable(value="tag") java.lang.String tag) throws GenieException
id
- The id of the application to delete the tag from. Not
null/empty/blank.tag
- The tag to remove. Not null/empty/blank.GenieException
- For any error@GetMapping(value="/{id}/commands", produces="application/hal+json") public java.util.Set<CommandResource> getCommandsForApplication(@PathVariable(value="id") java.lang.String id, @RequestParam(value="status",required=false) java.util.Set<java.lang.String> statuses) throws GenieException
id
- The id of the application to get the commands for. Not
NULL/empty/blank.statuses
- The various statuses of the commands to retrieveGenieException
- For any error