@RestController
@RequestMapping(value="/api/v3/applications")
public class ApplicationRestController
extends java.lang.Object
Constructor and Description |
---|
ApplicationRestController(DataServices dataServices,
EntityModelAssemblers entityModelAssemblers)
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.
|
org.springframework.hateoas.EntityModel<Application> |
getApplication(java.lang.String id)
Get Application for given id.
|
org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<Application>> |
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<org.springframework.hateoas.EntityModel<Command>> |
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(DataServices dataServices, EntityModelAssemblers entityModelAssemblers)
dataServices
- The DataServices
encapsulation instance to useentityModelAssemblers
- The encapsulation of all the available V3 resource assemblers@PostMapping(consumes="application/json") @ResponseStatus(value=CREATED) public org.springframework.http.ResponseEntity<java.lang.Void> createApplication(@RequestBody Application app) throws IdAlreadyExistsException
app
- The application to createIdAlreadyExistsException
- If the ID was already in use@DeleteMapping @ResponseStatus(value=NO_CONTENT) public void deleteAllApplications() throws PreconditionFailedException
PreconditionFailedException
- If any of the applications were still linked to a command@GetMapping(produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<Application>> getApplications(@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, @RequestParam(value="type",required=false) @Nullable 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 org.springframework.hateoas.EntityModel<Application> getApplication(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- unique id for application configurationNotFoundException
- If no application exists with the given id@PutMapping(value="/{id}", consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void updateApplication(@PathVariable(value="id") java.lang.String id, @RequestBody Application updateApp) throws NotFoundException, PreconditionFailedException
id
- unique id for configuration to updateupdateApp
- contains the application information to updateNotFoundException
- If no application with the given id existsPreconditionFailedException
- When the id in the update doesn't match@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 NotFoundException, PreconditionFailedException, GenieServerException
id
- The id of the application to patchpatch
- The JSON Patch instructionsNotFoundException
- If no application with the given id existsPreconditionFailedException
- When the id in the update doesn't matchGenieServerException
- If the patch can't be successfully applied@DeleteMapping(value="/{id}") @ResponseStatus(value=NO_CONTENT) public void deleteApplication(@PathVariable(value="id") java.lang.String id) throws PreconditionFailedException
id
- unique id of configuration to deletePreconditionFailedException
- If the application is still tied to a command@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 NotFoundException
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.NotFoundException
- If no application with the given id exists@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 NotFoundException
id
- The id of the application to get the configuration files for.
Not NULL/empty/blank.NotFoundException
- If no application with the given id exists@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 NotFoundException
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.NotFoundException
- If no application with the given ID exists@DeleteMapping(value="/{id}/configs") @ResponseStatus(value=NO_CONTENT) public void removeAllConfigsForApplication(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- The id of the application to delete the configuration files
from. Not null/empty/blank.NotFoundException
- If no application with the given ID exists@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 NotFoundException
id
- The id of the application to add the dependency file to. Not
null/empty/blank.dependencies
- The dependency files to add. Not null.NotFoundException
- If no application with the given ID exists@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 NotFoundException
id
- The id of the application to get the dependency files for. Not
NULL/empty/blank.NotFoundException
- If no application with the given ID exists@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 NotFoundException
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.NotFoundException
- If no application with the given ID exists@DeleteMapping(value="/{id}/dependencies") @ResponseStatus(value=NO_CONTENT) public void removeAllDependenciesForApplication(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- The id of the application to delete the dependency files from. Not
null/empty/blank.NotFoundException
- If no application with the given ID exists@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 NotFoundException
id
- The id of the application to add the tags to. Not
null/empty/blank.tags
- The tags to add. Not null/empty/blank.NotFoundException
- If no application with the given ID exists@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 NotFoundException
id
- The id of the application to get the tags for. Not
NULL/empty/blank.NotFoundException
- If no application with the given ID exists@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 NotFoundException
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.NotFoundException
- If no application with the given ID exists@DeleteMapping(value="/{id}/tags") @ResponseStatus(value=NO_CONTENT) public void removeAllTagsForApplication(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- The id of the application to delete the tags from.
Not null/empty/blank.NotFoundException
- If no application with the given ID exists@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 NotFoundException
id
- The id of the application to delete the tag from. Not
null/empty/blank.tag
- The tag to remove. Not null/empty/blank.NotFoundException
- If no application with the given ID exists@GetMapping(value="/{id}/commands", produces="application/hal+json") public java.util.Set<org.springframework.hateoas.EntityModel<Command>> getCommandsForApplication(@PathVariable(value="id") java.lang.String id, @RequestParam(value="status",required=false) @Nullable java.util.Set<java.lang.String> statuses) throws NotFoundException, GeniePreconditionException
id
- The id of the application to get the commands for. Not
NULL/empty/blank.statuses
- The various statuses of the commands to retrieveNotFoundException
- If no application with the given ID existsGeniePreconditionException
- When the statuses can't be parsed successfully