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 Details

    • ApplicationRestController

      @Autowired public ApplicationRestController(DataServices dataServices, EntityModelAssemblers entityModelAssemblers)
      Constructor.
      Parameters:
      dataServices - The DataServices encapsulation instance to use
      entityModelAssemblers - 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 PreconditionFailedException
      Delete 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 get
      assembler - 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 update
      updateApp - contains the application information to update
      Throws:
      NotFoundException - If no application with the given id exists
      PreconditionFailedException - 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 patch
      patch - The JSON Patch instructions
      Throws:
      NotFoundException - If no application with the given id exists
      PreconditionFailedException - When the id in the update doesn't match
      GenieServerException - 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 exists
      GeniePreconditionException - When the statuses can't be parsed successfully