Class ApplicationRestController
java.lang.Object
com.netflix.genie.web.apis.rest.v3.controllers.ApplicationRestController
@RestController
@RequestMapping("/api/v3/applications")
public class ApplicationRestController
extends Object
REST end-point for supporting Applications.
- Since:
- 3.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationRestController
(DataServices dataServices, EntityModelAssemblers entityModelAssemblers) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConfigsToApplication
(String id, Set<String> configs) Add new configuration files to a given application.void
addDependenciesForApplication
(String id, Set<String> dependencies) Add new dependency files for a given application.void
addTagsForApplication
(String id, Set<String> tags) Add new tags to a given application.org.springframework.http.ResponseEntity<Void>
Create an Application.void
Delete all applications from database.void
Delete an application configuration from database.org.springframework.hateoas.EntityModel<Application>
getApplication
(String id) Get Application for given id.org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<Application>>
getApplications
(String name, String user, Set<String> statuses, Set<String> tags, String type, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler<Application> assembler) Get Applications based on user parameters.getCommandsForApplication
(String id, Set<String> statuses) Get all the commands this application is associated with.Get all the configuration files for a given application.Get all the dependency files for a given application.Get all the tags for a given application.void
patchApplication
(String id, com.github.fge.jsonpatch.JsonPatch patch) Patch an application using JSON Patch.void
Delete the all configuration files from a given application.void
Delete the all dependency files from a given application.void
Delete the all tags from a given application.void
removeTagForApplication
(String id, String tag) Remove an tag from a given application.void
updateApplication
(String id, Application updateApp) Update application.void
updateConfigsForApplication
(String id, Set<String> configs) Update the configuration files for a given application.void
updateDependenciesForApplication
(String id, Set<String> dependencies) Update the dependency files for a given application.void
updateTagsForApplication
(String id, Set<String> tags) Update the tags for a given application.
-
Constructor Details
-
ApplicationRestController
@Autowired public ApplicationRestController(DataServices dataServices, EntityModelAssemblers entityModelAssemblers) Constructor.- Parameters:
dataServices
- TheDataServices
encapsulation instance to useentityModelAssemblers
- The encapsulation of all the available V3 resource assemblers
-
-
Method Details
-
createApplication
@PostMapping(consumes="application/json") @ResponseStatus(CREATED) public org.springframework.http.ResponseEntity<Void> createApplication(@RequestBody Application app) throws IdAlreadyExistsException Create 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 String name, @RequestParam(value="user",required=false) @Nullable String user, @RequestParam(value="status",required=false) @Nullable Set<String> statuses, @RequestParam(value="tag",required=false) @Nullable Set<String> tags, @RequestParam(value="type",required=false) @Nullable 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") String id) throws NotFoundException Get 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") String id, @RequestBody Application updateApp) throws NotFoundException, PreconditionFailedException Update 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") String id, @RequestBody com.github.fge.jsonpatch.JsonPatch patch) throws NotFoundException, PreconditionFailedException, GenieServerException Patch 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") String id) throws PreconditionFailedException Delete 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") String id, @RequestBody Set<String> configs) throws NotFoundException Add 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 Set<String> getConfigsForApplication(@PathVariable("id") String id) throws NotFoundException Get 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") String id, @RequestBody Set<String> configs) throws NotFoundException Update 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") String id) throws NotFoundException Delete 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") String id, @RequestBody Set<String> dependencies) throws NotFoundException Add 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 Set<String> getDependenciesForApplication(@PathVariable("id") String id) throws NotFoundException Get 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") String id, @RequestBody Set<String> dependencies) throws NotFoundException Update 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") String id) throws NotFoundException Delete 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") String id, @RequestBody Set<String> tags) throws NotFoundException Add 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 Set<String> getTagsForApplication(@PathVariable("id") String id) throws NotFoundException Get 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") String id, @RequestBody Set<String> tags) throws NotFoundException Update 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") String id) throws NotFoundException Delete 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") String id, @PathVariable("tag") String tag) throws NotFoundException Remove 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 Set<org.springframework.hateoas.EntityModel<Command>> getCommandsForApplication(@PathVariable("id") String id, @RequestParam(value="status",required=false) @Nullable Set<String> statuses) throws NotFoundException, GeniePreconditionException Get 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
-