@RestController
@RequestMapping(value="/api/v3/clusters")
public class ClusterRestController
extends java.lang.Object
| Constructor and Description |
|---|
ClusterRestController(ClusterPersistenceService clusterPersistenceService,
ClusterResourceAssembler clusterResourceAssembler,
CommandResourceAssembler commandResourceAssembler)
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.
|
ClusterResource |
getCluster(java.lang.String id)
Get cluster configuration from unique id.
|
org.springframework.hateoas.PagedResources<ClusterResource> |
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<CommandResource> |
getCommandsForCluster(java.lang.String id,
java.util.Set<java.lang.String> statuses)
Get all the commandIds 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 an 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(ClusterPersistenceService clusterPersistenceService, ClusterResourceAssembler clusterResourceAssembler, CommandResourceAssembler commandResourceAssembler)
clusterPersistenceService - The cluster configuration service to use.clusterResourceAssembler - The assembler to use to convert clusters to cluster HAL resourcescommandResourceAssembler - The assembler to use to convert commands to command HAL resources@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 com.netflix.genie.common.exceptions.GenieException
cluster - contains the cluster information to createcom.netflix.genie.common.exceptions.GenieException - For any error@GetMapping(value="/{id}",
produces="application/hal+json")
@ResponseStatus(value=OK)
public ClusterResource getCluster(@PathVariable(value="id")
java.lang.String id)
throws com.netflix.genie.common.exceptions.GenieException
id - id for the clustercom.netflix.genie.common.exceptions.GenieException - For any error@GetMapping(produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.PagedResources<ClusterResource> 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 com.netflix.genie.common.exceptions.GenieException
id - unique if for cluster to updateupdateCluster - contains the cluster information to updatecom.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to patchpatch - The JSON Patch instructionscom.netflix.genie.common.exceptions.GenieException - On error@DeleteMapping(value="/{id}")
@ResponseStatus(value=NO_CONTENT)
public void deleteCluster(@PathVariable(value="id")
java.lang.String id)
throws com.netflix.genie.common.exceptions.GenieException
id - unique id for cluster to deletecom.netflix.genie.common.exceptions.GenieException - For any error@DeleteMapping
@ResponseStatus(value=NO_CONTENT)
public void deleteAllClusters()
throws com.netflix.genie.common.exceptions.GenieException
com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
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.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to get the configuration files for. Not
NULL/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
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.com.netflix.genie.common.exceptions.GenieException - For any error@DeleteMapping(value="/{id}/configs")
@ResponseStatus(value=NO_CONTENT)
public void removeAllConfigsForCluster(@PathVariable(value="id")
java.lang.String id)
throws com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to delete the configuration files from.
Not null/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to add the dependency file to. Not
null/empty/blank.dependencies - The dependency files to add. Not null.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to get the dependency files for. Not
NULL/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
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.com.netflix.genie.common.exceptions.GenieException - For any error@DeleteMapping(value="/{id}/dependencies")
@ResponseStatus(value=NO_CONTENT)
public void removeAllDependenciesForCluster(@PathVariable(value="id")
java.lang.String id)
throws com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to delete the dependency files from. Not
null/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to add the tags to. Not
null/empty/blank.tags - The tags to add. Not null/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to get the tags for. Not
NULL/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
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.com.netflix.genie.common.exceptions.GenieException - For any error@DeleteMapping(value="/{id}/tags")
@ResponseStatus(value=NO_CONTENT)
public void removeAllTagsForCluster(@PathVariable(value="id")
java.lang.String id)
throws com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to delete the tags from.
Not null/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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 com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to delete the tag from. Not
null/empty/blank.tag - The tag to remove. Not null/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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)
throws com.netflix.genie.common.exceptions.GenieException
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.com.netflix.genie.common.exceptions.GenieException - For any error@GetMapping(value="/{id}/commands",
produces="application/hal+json")
@ResponseStatus(value=OK)
public java.util.List<CommandResource> getCommandsForCluster(@PathVariable(value="id")
java.lang.String id,
@RequestParam(value="status",required=false) @Nullable
java.util.Set<java.lang.String> statuses)
throws com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to get the command files for. Not
NULL/empty/blank.statuses - The various statuses to return commandIds for.com.netflix.genie.common.exceptions.GenieException - For any error@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)
throws com.netflix.genie.common.exceptions.GenieException
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.com.netflix.genie.common.exceptions.GenieException - For any error@DeleteMapping(value="/{id}/commands")
@ResponseStatus(value=NO_CONTENT)
public void removeAllCommandsForCluster(@PathVariable(value="id")
java.lang.String id)
throws com.netflix.genie.common.exceptions.GenieException
id - The id of the cluster to delete the commandIds from. Not
null/empty/blank.com.netflix.genie.common.exceptions.GenieException - For any error@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)
throws com.netflix.genie.common.exceptions.GenieException
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.com.netflix.genie.common.exceptions.GenieException - For any error