@RestController
@RequestMapping(value="/api/v3/clusters")
public class ClusterRestController
extends java.lang.Object
Constructor and Description |
---|
ClusterRestController(ClusterService clusterService,
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 |
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(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<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> |
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 |
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,
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 |
updateTagsForCluster(java.lang.String id,
java.util.Set<java.lang.String> tags)
Update the tags for a given cluster.
|
@Autowired public ClusterRestController(ClusterService clusterService, ClusterResourceAssembler clusterResourceAssembler, CommandResourceAssembler commandResourceAssembler)
clusterService
- 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@RequestMapping(method=POST, consumes="application/json") @ResponseStatus(value=CREATED) public org.springframework.http.ResponseEntity<java.lang.Void> createCluster(@RequestBody Cluster cluster) throws GenieException
cluster
- contains the cluster information to createGenieException
- For any error@RequestMapping(value="/{id}", method=GET, produces="application/hal+json") @ResponseStatus(value=OK) public ClusterResource getCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- id for the clusterGenieException
- For any error@RequestMapping(method=GET, produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.PagedResources<ClusterResource> getClusters(@RequestParam(value="name",required=false) java.lang.String name, @RequestParam(value="status",required=false) java.util.Set<java.lang.String> statuses, @RequestParam(value="tag",required=false) java.util.Set<java.lang.String> tags, @RequestParam(value="minUpdateTime",required=false) java.lang.Long minUpdateTime, @RequestParam(value="maxUpdateTime",required=false) java.lang.Long maxUpdateTime, @PageableDefault(size=64,sort="updated",direction=DESC) org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler<Cluster> assembler) throws 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 useGenieException
- For any error@RequestMapping(value="/{id}", method=PUT, consumes="application/json") @ResponseStatus(value=NO_CONTENT) public void updateCluster(@PathVariable(value="id") java.lang.String id, @RequestBody Cluster updateCluster) throws GenieException
id
- unique if for cluster to updateupdateCluster
- contains the cluster information to updateGenieException
- For any error@RequestMapping(value="/{id}", method=PATCH, 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 GenieException
id
- The id of the cluster to patchpatch
- The JSON Patch instructionsGenieException
- On error@RequestMapping(value="/{id}", method=DELETE) @ResponseStatus(value=NO_CONTENT) public void deleteCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- unique id for cluster to deleteGenieException
- For any error@RequestMapping(method=DELETE) @ResponseStatus(value=NO_CONTENT) public void deleteAllClusters() throws GenieException
GenieException
- For any error@RequestMapping(value="/{id}/configs", method=POST, 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 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.GenieException
- For any error@RequestMapping(value="/{id}/configs", method=GET, produces="application/json") @ResponseStatus(value=OK) public java.util.Set<java.lang.String> getConfigsForCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the cluster to get the configuration files for. Not
NULL/empty/blank.GenieException
- For any error@RequestMapping(value="/{id}/configs", method=PUT, 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 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.GenieException
- For any error@RequestMapping(value="/{id}/configs", method=DELETE) @ResponseStatus(value=NO_CONTENT) public void removeAllConfigsForCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the cluster to delete the configuration files from.
Not null/empty/blank.GenieException
- For any error@RequestMapping(value="/{id}/tags", method=POST, 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 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.GenieException
- For any error@RequestMapping(value="/{id}/tags", method=GET, produces="application/json") @ResponseStatus(value=OK) public java.util.Set<java.lang.String> getTagsForCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the cluster to get the tags for. Not
NULL/empty/blank.GenieException
- For any error@RequestMapping(value="/{id}/tags", method=PUT, 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 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.GenieException
- For any error@RequestMapping(value="/{id}/tags", method=DELETE) @ResponseStatus(value=NO_CONTENT) public void removeAllTagsForCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the cluster to delete the tags from.
Not null/empty/blank.GenieException
- For any error@RequestMapping(value="/{id}/tags/{tag}", method=DELETE) @ResponseStatus(value=NO_CONTENT) public void removeTagForCluster(@PathVariable(value="id") java.lang.String id, @PathVariable(value="tag") java.lang.String tag) throws 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.GenieException
- For any error@RequestMapping(value="/{id}/commands", method=POST, 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 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.GenieException
- For any error@RequestMapping(value="/{id}/commands", method=GET, 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) java.util.Set<java.lang.String> statuses) throws 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.GenieException
- For any error@RequestMapping(value="/{id}/commands", method=PUT, 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 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.GenieException
- For any error@RequestMapping(value="/{id}/commands", method=DELETE) @ResponseStatus(value=NO_CONTENT) public void removeAllCommandsForCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the cluster to delete the commandIds from. Not
null/empty/blank.GenieException
- For any error@RequestMapping(value="/{id}/commands/{commandId}", method=DELETE) @ResponseStatus(value=NO_CONTENT) public void removeCommandForCluster(@PathVariable(value="id") java.lang.String id, @PathVariable(value="commandId") java.lang.String commandId) throws 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.GenieException
- For any error