@RestController
@RequestMapping(value="/api/v3/clusters")
public class ClusterRestController
extends java.lang.Object
| Constructor and Description |
|---|
ClusterRestController(DataServices dataServices,
EntityModelAssemblers entityModelAssemblers)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCommandsForCluster(java.lang.String id,
java.util.List<java.lang.String> commandIds)
Add new commandIds to the given cluster.
|
void |
addConfigsForCluster(java.lang.String id,
java.util.Set<java.lang.String> configs)
Add new configuration files to a given cluster.
|
void |
addDependenciesForCluster(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Add new dependency files for a given cluster.
|
void |
addTagsForCluster(java.lang.String id,
java.util.Set<java.lang.String> tags)
Add new tags to a given cluster.
|
org.springframework.http.ResponseEntity<java.lang.Void> |
createCluster(@Valid com.netflix.genie.common.dto.Cluster cluster)
Create cluster configuration.
|
void |
deleteAllClusters()
Delete all clusters from database.
|
void |
deleteCluster(java.lang.String id)
Delete a cluster configuration.
|
org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Cluster> |
getCluster(java.lang.String id)
Get cluster configuration from unique id.
|
org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Cluster>> |
getClusters(java.lang.String name,
java.util.Set<java.lang.String> statuses,
java.util.Set<java.lang.String> tags,
java.lang.Long minUpdateTime,
java.lang.Long maxUpdateTime,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler<com.netflix.genie.common.dto.Cluster> assembler)
Get cluster config based on user params.
|
java.util.List<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Command>> |
getCommandsForCluster(java.lang.String id,
java.util.Set<java.lang.String> statuses)
Get all the commands configured for a given cluster.
|
java.util.Set<java.lang.String> |
getConfigsForCluster(java.lang.String id)
Get all the configuration files for a given cluster.
|
java.util.Set<java.lang.String> |
getDependenciesForCluster(java.lang.String id)
Get all the dependency files for a given cluster.
|
java.util.Set<java.lang.String> |
getTagsForCluster(java.lang.String id)
Get all the tags for a given cluster.
|
void |
patchCluster(java.lang.String id,
com.github.fge.jsonpatch.JsonPatch patch)
Patch a cluster using JSON Patch.
|
void |
removeAllCommandsForCluster(java.lang.String id)
Remove the all commandIds from a given cluster.
|
void |
removeAllConfigsForCluster(java.lang.String id)
Delete the all configuration files from a given cluster.
|
void |
removeAllDependenciesForCluster(java.lang.String id)
Delete the all dependency files from a given cluster.
|
void |
removeAllTagsForCluster(java.lang.String id)
Delete the all tags from a given cluster.
|
void |
removeCommandForCluster(java.lang.String id,
java.lang.String commandId)
Remove a command from a given cluster.
|
void |
removeTagForCluster(java.lang.String id,
java.lang.String tag)
Remove an tag from a given cluster.
|
void |
setCommandsForCluster(java.lang.String id,
java.util.List<java.lang.String> commandIds)
Set the commandIds for a given cluster.
|
void |
updateCluster(java.lang.String id,
com.netflix.genie.common.dto.Cluster updateCluster)
Update a cluster configuration.
|
void |
updateConfigsForCluster(java.lang.String id,
java.util.Set<java.lang.String> configs)
Update the configuration files for a given cluster.
|
void |
updateDependenciesForCluster(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Update the dependency files for a given cluster.
|
void |
updateTagsForCluster(java.lang.String id,
java.util.Set<java.lang.String> tags)
Update the tags for a given cluster.
|
@Autowired public ClusterRestController(DataServices dataServices, EntityModelAssemblers entityModelAssemblers)
dataServices - The DataServices encapsulation instance to use.entityModelAssemblers - The encapsulation of all available V3 resource assemblers@PostMapping(consumes="application/json")
@ResponseStatus(value=CREATED)
public org.springframework.http.ResponseEntity<java.lang.Void> createCluster(@RequestBody @Valid
@Valid com.netflix.genie.common.dto.Cluster cluster)
throws IdAlreadyExistsException
cluster - contains the cluster information to createIdAlreadyExistsException - If there is a conflict for the id@GetMapping(value="/{id}",
produces="application/hal+json")
@ResponseStatus(value=OK)
public org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Cluster> getCluster(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - id for the clusterNotFoundException - If no cluster with id exists@GetMapping(produces="application/hal+json")
@ResponseStatus(value=OK)
public org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Cluster>> getClusters(@RequestParam(value="name",required=false) @Nullable
java.lang.String name,
@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="minUpdateTime",required=false) @Nullable
java.lang.Long minUpdateTime,
@RequestParam(value="maxUpdateTime",required=false) @Nullable
java.lang.Long maxUpdateTime,
@PageableDefault(size=64,sort="updated",direction=DESC)
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler<com.netflix.genie.common.dto.Cluster> assembler)
throws com.netflix.genie.common.exceptions.GenieException
name - cluster name (can be a pattern)statuses - valid types - Types.ClusterStatustags - tags for the clusterminUpdateTime - min time when cluster configuration was updatedmaxUpdateTime - max time when cluster configuration was updatedpage - The page to getassembler - The paged resources assembler to usecom.netflix.genie.common.exceptions.GenieException - For any error@PutMapping(value="/{id}",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void updateCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
com.netflix.genie.common.dto.Cluster updateCluster)
throws NotFoundException,
PreconditionFailedException
id - unique if for cluster to updateupdateCluster - contains the cluster information to updateNotFoundException - If no cluster with id existsPreconditionFailedException - If the ids don't match@PatchMapping(value="/{id}",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void patchCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
com.github.fge.jsonpatch.JsonPatch patch)
throws NotFoundException,
PreconditionFailedException,
com.netflix.genie.common.exceptions.GenieServerException
id - The id of the cluster to patchpatch - The JSON Patch instructionsNotFoundException - If no cluster with id existsPreconditionFailedException - If the ids don't matchcom.netflix.genie.common.exceptions.GenieServerException - If the patch can't be applied@DeleteMapping(value="/{id}")
@ResponseStatus(value=NO_CONTENT)
public void deleteCluster(@PathVariable(value="id")
java.lang.String id)
throws PreconditionFailedException
id - unique id for cluster to deletePreconditionFailedException - If the cluster can't be deleted due to constraints@DeleteMapping
@ResponseStatus(value=NO_CONTENT)
public void deleteAllClusters()
throws PreconditionFailedException
PreconditionFailedException - If any cluster can't be deleted due to a constraint in the system@PostMapping(value="/{id}/configs",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addConfigsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> configs)
throws NotFoundException
id - The id of the cluster to add the configuration file to. Not null/empty/blank.configs - The configuration files to add. Not null/empty/blank.NotFoundException - If no cluster with id exists@GetMapping(value="/{id}/configs",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.Set<java.lang.String> getConfigsForCluster(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the cluster to get the configuration files for. Not NULL/empty/blank.NotFoundException - If no cluster with id exists@PutMapping(value="/{id}/configs",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void updateConfigsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> configs)
throws NotFoundException
id - The id of the cluster 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 cluster with id exists@DeleteMapping(value="/{id}/configs")
@ResponseStatus(value=NO_CONTENT)
public void removeAllConfigsForCluster(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the cluster to delete the configuration files from. Not null/empty/blank.NotFoundException - If no cluster with id exists@PostMapping(value="/{id}/dependencies",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addDependenciesForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> dependencies)
throws NotFoundException
id - The id of the cluster to add the dependency file to. Not null/empty/blank.dependencies - The dependency files to add. Not null.NotFoundException - If no cluster with id exists@GetMapping(value="/{id}/dependencies",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.Set<java.lang.String> getDependenciesForCluster(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the cluster to get the dependency files for. Not NULL/empty/blankNotFoundException - If no cluster with id exists@PutMapping(value="/{id}/dependencies",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void updateDependenciesForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> dependencies)
throws NotFoundException
id - The id of the cluster 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 cluster with id exists@DeleteMapping(value="/{id}/dependencies")
@ResponseStatus(value=NO_CONTENT)
public void removeAllDependenciesForCluster(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the cluster to delete the dependency files from. Not null/empty/blank.NotFoundException - If no cluster with id exists@PostMapping(value="/{id}/tags",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addTagsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> tags)
throws NotFoundException
id - The id of the cluster to add the tags to. Not null/empty/blank.tags - The tags to add. Not null/empty/blank.NotFoundException - If no cluster with id exists@GetMapping(value="/{id}/tags",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.Set<java.lang.String> getTagsForCluster(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the cluster to get the tags for. Not NULL/empty/blank.NotFoundException - If no cluster with id exists@PutMapping(value="/{id}/tags",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void updateTagsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> tags)
throws NotFoundException
id - The id of the cluster 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 cluster with id exists@DeleteMapping(value="/{id}/tags")
@ResponseStatus(value=NO_CONTENT)
public void removeAllTagsForCluster(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the cluster to delete the tags from. Not null/empty/blank.NotFoundException - If no cluster with id exists@DeleteMapping(value="/{id}/tags/{tag}")
@ResponseStatus(value=NO_CONTENT)
public void removeTagForCluster(@PathVariable(value="id")
java.lang.String id,
@PathVariable(value="tag")
java.lang.String tag)
throws NotFoundException
id - The id of the cluster to delete the tag from. Not null/empty/blank.tag - The tag to remove. Not null/empty/blank.NotFoundException - If no cluster with id exists@PostMapping(value="/{id}/commands",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addCommandsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.List<java.lang.String> commandIds)
id - The id of the cluster to add the commandIds to. Not null/empty/blank.commandIds - The ids of the commandIds to add. Not null.@GetMapping(value="/{id}/commands",
produces="application/hal+json")
@ResponseStatus(value=OK)
public java.util.List<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Command>> getCommandsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestParam(value="status",required=false) @Nullable
java.util.Set<java.lang.String> statuses)
throws NotFoundException
id - The id of the cluster to get the command files for. Not NULL/empty/blank.statuses - The various statuses to return commandIds for.NotFoundException - If the cluster doesn't exist@PutMapping(value="/{id}/commands",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void setCommandsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.List<java.lang.String> commandIds)
id - The id of the cluster to update the configuration files for. Not null/empty/blank.commandIds - The ids of the commands to replace existing commands with. Not null/empty/blank.@DeleteMapping(value="/{id}/commands")
@ResponseStatus(value=NO_CONTENT)
public void removeAllCommandsForCluster(@PathVariable(value="id")
java.lang.String id)
id - The id of the cluster to delete the commandIds from. Not null/empty/blank.@DeleteMapping(value="/{id}/commands/{commandId}")
@ResponseStatus(value=NO_CONTENT)
public void removeCommandForCluster(@PathVariable(value="id")
java.lang.String id,
@PathVariable(value="commandId")
java.lang.String commandId)
id - The id of the cluster to delete the command from. Not null/empty/blank.commandId - The id of the command to remove. Not null/empty/blank.