Class ApplicationRestController
- java.lang.Object
-
- com.netflix.genie.web.apis.rest.v3.controllers.ApplicationRestController
-
@RestController @RequestMapping("/api/v3/applications") public class ApplicationRestController extends java.lang.ObjectREST end-point for supporting Applications.- Since:
- 3.0.0
-
-
Constructor Summary
Constructors Constructor Description ApplicationRestController(DataServices dataServices, EntityModelAssemblers entityModelAssemblers)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConfigsToApplication(java.lang.String id, java.util.Set<java.lang.String> configs)Add new configuration files to a given application.voidaddDependenciesForApplication(java.lang.String id, java.util.Set<java.lang.String> dependencies)Add new dependency files for a given application.voidaddTagsForApplication(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.voiddeleteAllApplications()Delete all applications from database.voiddeleteApplication(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.voidpatchApplication(java.lang.String id, com.github.fge.jsonpatch.JsonPatch patch)Patch an application using JSON Patch.voidremoveAllConfigsForApplication(java.lang.String id)Delete the all configuration files from a given application.voidremoveAllDependenciesForApplication(java.lang.String id)Delete the all dependency files from a given application.voidremoveAllTagsForApplication(java.lang.String id)Delete the all tags from a given application.voidremoveTagForApplication(java.lang.String id, java.lang.String tag)Remove an tag from a given application.voidupdateApplication(java.lang.String id, Application updateApp)Update application.voidupdateConfigsForApplication(java.lang.String id, java.util.Set<java.lang.String> configs)Update the configuration files for a given application.voidupdateDependenciesForApplication(java.lang.String id, java.util.Set<java.lang.String> dependencies)Update the dependency files for a given application.voidupdateTagsForApplication(java.lang.String id, java.util.Set<java.lang.String> tags)Update the tags for a given application.
-
-
-
Constructor Detail
-
ApplicationRestController
@Autowired public ApplicationRestController(DataServices dataServices, EntityModelAssemblers entityModelAssemblers)
Constructor.- Parameters:
dataServices- TheDataServicesencapsulation instance to useentityModelAssemblers- The encapsulation of all the available V3 resource assemblers
-
-
Method Detail
-
createApplication
@PostMapping(consumes="application/json") @ResponseStatus(CREATED) public org.springframework.http.ResponseEntity<java.lang.Void> createApplication(@RequestBody Application app) throws IdAlreadyExistsExceptionCreate an Application.- Parameters:
app- The application to create- Returns:
- The created application configuration
- Throws:
IdAlreadyExistsException- If the ID was already in use
-
deleteAllApplications
@DeleteMapping @ResponseStatus(NO_CONTENT) public void deleteAllApplications() throws PreconditionFailedExceptionDelete all applications from database.- Throws:
PreconditionFailedException- If any of the applications were still linked to a command
-
getApplications
@GetMapping(produces="application/hal+json") @ResponseStatus(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
Get Applications based on user parameters.- Parameters:
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 use- Returns:
- All applications matching the criteria
- Throws:
GenieException- For any error
-
getApplication
@GetMapping(value="/{id}", produces="application/hal+json") @ResponseStatus(OK) public org.springframework.hateoas.EntityModel<Application> getApplication(@PathVariable("id") java.lang.String id) throws NotFoundExceptionGet Application for given id.- Parameters:
id- unique id for application configuration- Returns:
- The application configuration
- Throws:
NotFoundException- If no application exists with the given id
-
updateApplication
@PutMapping(value="/{id}", consumes="application/json") @ResponseStatus(NO_CONTENT) public void updateApplication(@PathVariable("id") java.lang.String id, @RequestBody Application updateApp) throws NotFoundException, PreconditionFailedExceptionUpdate application.- Parameters:
id- unique id for configuration to updateupdateApp- contains the application information to update- Throws:
NotFoundException- If no application with the given id existsPreconditionFailedException- When the id in the update doesn't match
-
patchApplication
@PatchMapping(value="/{id}", consumes="application/json") @ResponseStatus(NO_CONTENT) public void patchApplication(@PathVariable("id") java.lang.String id, @RequestBody com.github.fge.jsonpatch.JsonPatch patch) throws NotFoundException, PreconditionFailedException, GenieServerExceptionPatch an application using JSON Patch.- Parameters:
id- The id of the application to patchpatch- The JSON Patch instructions- Throws:
NotFoundException- 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
-
deleteApplication
@DeleteMapping("/{id}") @ResponseStatus(NO_CONTENT) public void deleteApplication(@PathVariable("id") java.lang.String id) throws PreconditionFailedExceptionDelete an application configuration from database.- Parameters:
id- unique id of configuration to delete- Throws:
PreconditionFailedException- If the application is still tied to a command
-
addConfigsToApplication
@PostMapping(value="/{id}/configs", consumes="application/json") @ResponseStatus(NO_CONTENT) public void addConfigsToApplication(@PathVariable("id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> configs) throws NotFoundExceptionAdd new configuration files to a given application.- Parameters:
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.- Throws:
NotFoundException- If no application with the given id exists
-
getConfigsForApplication
@GetMapping(value="/{id}/configs", produces="application/json") @ResponseStatus(OK) public java.util.Set<java.lang.String> getConfigsForApplication(@PathVariable("id") java.lang.String id) throws NotFoundExceptionGet all the configuration files for a given application.- Parameters:
id- The id of the application to get the configuration files for. Not NULL/empty/blank.- Returns:
- The active set of configuration files.
- Throws:
NotFoundException- If no application with the given id exists
-
updateConfigsForApplication
@PutMapping(value="/{id}/configs", consumes="application/json") @ResponseStatus(NO_CONTENT) public void updateConfigsForApplication(@PathVariable("id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> configs) throws NotFoundExceptionUpdate the configuration files for a given application.- Parameters:
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.- Throws:
NotFoundException- If no application with the given ID exists
-
removeAllConfigsForApplication
@DeleteMapping("/{id}/configs") @ResponseStatus(NO_CONTENT) public void removeAllConfigsForApplication(@PathVariable("id") java.lang.String id) throws NotFoundExceptionDelete the all configuration files from a given application.- Parameters:
id- The id of the application to delete the configuration files from. Not null/empty/blank.- Throws:
NotFoundException- If no application with the given ID exists
-
addDependenciesForApplication
@PostMapping(value="/{id}/dependencies", consumes="application/json") @ResponseStatus(NO_CONTENT) public void addDependenciesForApplication(@PathVariable("id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> dependencies) throws NotFoundExceptionAdd new dependency files for a given application.- Parameters:
id- The id of the application to add the dependency file to. Not null/empty/blank.dependencies- The dependency files to add. Not null.- Throws:
NotFoundException- If no application with the given ID exists
-
getDependenciesForApplication
@GetMapping(value="/{id}/dependencies", produces="application/json") @ResponseStatus(OK) public java.util.Set<java.lang.String> getDependenciesForApplication(@PathVariable("id") java.lang.String id) throws NotFoundExceptionGet all the dependency files for a given application.- Parameters:
id- The id of the application to get the dependency files for. Not NULL/empty/blank.- Returns:
- The set of dependency files.
- Throws:
NotFoundException- If no application with the given ID exists
-
updateDependenciesForApplication
@PutMapping(value="/{id}/dependencies", consumes="application/json") @ResponseStatus(NO_CONTENT) public void updateDependenciesForApplication(@PathVariable("id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> dependencies) throws NotFoundExceptionUpdate the dependency files for a given application.- Parameters:
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.- Throws:
NotFoundException- If no application with the given ID exists
-
removeAllDependenciesForApplication
@DeleteMapping("/{id}/dependencies") @ResponseStatus(NO_CONTENT) public void removeAllDependenciesForApplication(@PathVariable("id") java.lang.String id) throws NotFoundExceptionDelete the all dependency files from a given application.- Parameters:
id- The id of the application to delete the dependency files from. Not null/empty/blank.- Throws:
NotFoundException- If no application with the given ID exists
-
addTagsForApplication
@PostMapping(value="/{id}/tags", consumes="application/json") @ResponseStatus(NO_CONTENT) public void addTagsForApplication(@PathVariable("id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> tags) throws NotFoundExceptionAdd new tags to a given application.- Parameters:
id- The id of the application to add the tags to. Not null/empty/blank.tags- The tags to add. Not null/empty/blank.- Throws:
NotFoundException- If no application with the given ID exists
-
getTagsForApplication
@GetMapping(value="/{id}/tags", produces="application/json") @ResponseStatus(OK) public java.util.Set<java.lang.String> getTagsForApplication(@PathVariable("id") java.lang.String id) throws NotFoundExceptionGet all the tags for a given application.- Parameters:
id- The id of the application to get the tags for. Not NULL/empty/blank.- Returns:
- The active set of tags.
- Throws:
NotFoundException- If no application with the given ID exists
-
updateTagsForApplication
@PutMapping(value="/{id}/tags", consumes="application/json") @ResponseStatus(NO_CONTENT) public void updateTagsForApplication(@PathVariable("id") java.lang.String id, @RequestBody java.util.Set<java.lang.String> tags) throws NotFoundExceptionUpdate the tags for a given application.- Parameters:
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.- Throws:
NotFoundException- If no application with the given ID exists
-
removeAllTagsForApplication
@DeleteMapping("/{id}/tags") @ResponseStatus(NO_CONTENT) public void removeAllTagsForApplication(@PathVariable("id") java.lang.String id) throws NotFoundExceptionDelete the all tags from a given application.- Parameters:
id- The id of the application to delete the tags from. Not null/empty/blank.- Throws:
NotFoundException- If no application with the given ID exists
-
removeTagForApplication
@DeleteMapping("/{id}/tags/{tag}") @ResponseStatus(NO_CONTENT) public void removeTagForApplication(@PathVariable("id") java.lang.String id, @PathVariable("tag") java.lang.String tag) throws NotFoundExceptionRemove an tag from a given application.- Parameters:
id- The id of the application to delete the tag from. Not null/empty/blank.tag- The tag to remove. Not null/empty/blank.- Throws:
NotFoundException- If no application with the given ID exists
-
getCommandsForApplication
@GetMapping(value="/{id}/commands", produces="application/hal+json") public java.util.Set<org.springframework.hateoas.EntityModel<Command>> getCommandsForApplication(@PathVariable("id") java.lang.String id, @RequestParam(value="status",required=false) @Nullable java.util.Set<java.lang.String> statuses) throws NotFoundException, GeniePreconditionExceptionGet all the commands this application is associated with.- Parameters:
id- The id of the application to get the commands for. Not NULL/empty/blank.statuses- The various statuses of the commands to retrieve- Returns:
- The set of commands.
- Throws:
NotFoundException- If no application with the given ID existsGeniePreconditionException- When the statuses can't be parsed successfully
-
-