@RestController
@RequestMapping(value="/api/v3/commands")
public class CommandRestController
extends java.lang.Object
| Constructor and Description |
|---|
CommandRestController(DataServices dataServices,
EntityModelAssemblers entityModelAssemblers)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addApplicationsForCommand(java.lang.String id,
java.util.List<java.lang.String> applicationIds)
Add applications for the given command.
|
void |
addClusterCriterionForCommand(java.lang.String id,
@Valid com.netflix.genie.common.external.dtos.v4.Criterion criterion)
Add a new
Criterion as the lowest priority criterion for the given command. |
void |
addConfigsForCommand(java.lang.String id,
java.util.Set<java.lang.String> configs)
Add new configuration files to a given command.
|
void |
addDependenciesForCommand(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Add new dependency files for a given command.
|
void |
addTagsForCommand(java.lang.String id,
java.util.Set<java.lang.String> tags)
Add new tags to a given command.
|
org.springframework.http.ResponseEntity<java.lang.Void> |
createCommand(@Valid com.netflix.genie.common.dto.Command command)
Create a Command configuration.
|
void |
deleteAllCommands()
Delete all applications from database.
|
void |
deleteCommand(java.lang.String id)
Delete a command.
|
java.util.List<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Application>> |
getApplicationsForCommand(java.lang.String id)
Get the applications configured for a given command.
|
java.util.List<com.netflix.genie.common.external.dtos.v4.Criterion> |
getClusterCriteriaForCommand(java.lang.String id)
Get all the
Criterion currently associated with the command in priority order. |
java.util.Set<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Cluster>> |
getClustersForCommand(java.lang.String id,
java.util.Set<java.lang.String> statuses)
Get all the clusters this command is associated with.
|
org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Command> |
getCommand(java.lang.String id)
Get Command configuration for given id.
|
org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Command>> |
getCommands(java.lang.String name,
java.lang.String user,
java.util.Set<java.lang.String> statuses,
java.util.Set<java.lang.String> tags,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler<com.netflix.genie.common.dto.Command> assembler)
Get Command configuration based on user parameters.
|
java.util.Set<java.lang.String> |
getConfigsForCommand(java.lang.String id)
Get all the configuration files for a given command.
|
java.util.Set<java.lang.String> |
getDependenciesForCommand(java.lang.String id)
Get all the dependency files for a given command.
|
java.util.Set<java.lang.String> |
getTagsForCommand(java.lang.String id)
Get all the tags for a given command.
|
void |
insertClusterCriterionForCommand(java.lang.String id,
@Min(value=0L) int priority,
@Valid com.netflix.genie.common.external.dtos.v4.Criterion criterion)
Insert a new cluster criterion for the given command at the supplied priority.
|
void |
patchCommand(java.lang.String id,
com.github.fge.jsonpatch.JsonPatch patch)
Patch a command using JSON Patch.
|
void |
removeAllApplicationsForCommand(java.lang.String id)
Remove the applications from a given command.
|
void |
removeAllClusterCriteriaFromCommand(java.lang.String id)
Remove all the
Criterion currently associated with the command. |
void |
removeAllConfigsForCommand(java.lang.String id)
Delete the all configuration files from a given command.
|
void |
removeAllDependenciesForCommand(java.lang.String id)
Delete the all dependency files from a given command.
|
void |
removeAllTagsForCommand(java.lang.String id)
Delete the all tags from a given command.
|
void |
removeApplicationForCommand(java.lang.String id,
java.lang.String appId)
Remove the application from a given command.
|
void |
removeClusterCriterionFromCommand(java.lang.String id,
@Min(value=0L) int priority)
Remove the criterion with the given priority from the given command.
|
void |
removeTagForCommand(java.lang.String id,
java.lang.String tag)
Remove an tag from a given command.
|
java.util.List<com.netflix.genie.common.external.dtos.v4.ResolvedResources<com.netflix.genie.common.dto.Cluster>> |
resolveClustersForCommandClusterCriteria(java.lang.String id,
java.lang.Boolean addDefaultStatus)
For a given
Command retrieve the Criterion and attempt to resolve all the Cluster's the
criteria would currently match within the database. |
void |
setApplicationsForCommand(java.lang.String id,
java.util.List<java.lang.String> applicationIds)
Set the applications for the given command.
|
void |
setClusterCriteriaForCommand(java.lang.String id,
@Valid java.util.List<com.netflix.genie.common.external.dtos.v4.Criterion> clusterCriteria)
Set all new cluster criteria for the given command.
|
void |
updateCommand(java.lang.String id,
com.netflix.genie.common.dto.Command updateCommand)
Update command configuration.
|
void |
updateConfigsForCommand(java.lang.String id,
java.util.Set<java.lang.String> configs)
Update the configuration files for a given command.
|
void |
updateDependenciesForCommand(java.lang.String id,
java.util.Set<java.lang.String> dependencies)
Update the dependency files for a given command.
|
void |
updateTagsForCommand(java.lang.String id,
java.util.Set<java.lang.String> tags)
Update the tags for a given command.
|
@Autowired public CommandRestController(DataServices dataServices, EntityModelAssemblers entityModelAssemblers)
dataServices - The DataServices encapsulation instance to useentityModelAssemblers - The encapsulation of all available V3 resource assemblers@PostMapping(consumes="application/json")
@ResponseStatus(value=CREATED)
public org.springframework.http.ResponseEntity<java.lang.Void> createCommand(@RequestBody @Valid
@Valid com.netflix.genie.common.dto.Command command)
throws IdAlreadyExistsException
command - The command configuration to createIdAlreadyExistsException - When the command id was already used@GetMapping(value="/{id}",
produces="application/hal+json")
@ResponseStatus(value=OK)
public org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Command> getCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - unique id for command configurationNotFoundException - When no Command with the given id exists@GetMapping(produces="application/hal+json")
@ResponseStatus(value=OK)
public org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Command>> getCommands(@RequestParam(value="name",required=false) @Nullable
java.lang.String name,
@RequestParam(value="user",required=false) @Nullable
java.lang.String user,
@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,
@PageableDefault(size=64,sort="updated",direction=DESC)
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler<com.netflix.genie.common.dto.Command> assembler)
throws com.netflix.genie.common.exceptions.GenieException
name - Name for command (optional)user - The user who created the configuration (optional)statuses - The statuses of the commands to get (optional)tags - The set of tags you want the command for.page - 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 updateCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
com.netflix.genie.common.dto.Command updateCommand)
throws NotFoundException,
PreconditionFailedException
id - unique id for the configuration to update.updateCommand - the information to update the command withNotFoundException - When no Command with the given id existsPreconditionFailedException - When id and the updateCommand id don't match@PatchMapping(value="/{id}",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void patchCommand(@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 command to patchpatch - The JSON Patch instructionsNotFoundException - When no Command with the given id existsPreconditionFailedException - When id and the updateCommand id don't matchcom.netflix.genie.common.exceptions.GenieServerException - When the patch can't be applied@DeleteMapping
@ResponseStatus(value=NO_CONTENT)
public void deleteAllCommands()
throws PreconditionFailedException
PreconditionFailedException - When deleting one of the commands would violated a consistency issue@DeleteMapping(value="/{id}")
@ResponseStatus(value=NO_CONTENT)
public void deleteCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - unique id for configuration to deleteNotFoundException - If no Command exists with the given id@PostMapping(value="/{id}/configs",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addConfigsForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> configs)
throws NotFoundException
id - The id of the command to add the configuration file to. Not null/empty/blank.configs - The configuration files to add. Not null/empty/blank.NotFoundException - When no Command with the given id exists@GetMapping(value="/{id}/configs",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.Set<java.lang.String> getConfigsForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the command to get the configuration files for. Not NULL/empty/blank.NotFoundException - When no Command with the given id exists@PutMapping(value="/{id}/configs",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void updateConfigsForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> configs)
throws NotFoundException
id - The id of the command 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 - When no Command with the given id exists@DeleteMapping(value="/{id}/configs")
@ResponseStatus(value=NO_CONTENT)
public void removeAllConfigsForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the command to delete the configuration files from. Not null/empty/blank.NotFoundException - When no Command with the given id exists@PostMapping(value="/{id}/dependencies",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addDependenciesForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> dependencies)
throws NotFoundException
id - The id of the command to add the dependency file to. Not null/empty/blank.dependencies - The dependency files to add. Not null.NotFoundException - When no Command with the given id exists@GetMapping(value="/{id}/dependencies",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.Set<java.lang.String> getDependenciesForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the command to get the dependency files for. Not NULL/empty/blank.NotFoundException - When no Command with the given id exists@PutMapping(value="/{id}/dependencies",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void updateDependenciesForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> dependencies)
throws NotFoundException
id - The id of the command 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 - When no Command with the given id exists@DeleteMapping(value="/{id}/dependencies")
@ResponseStatus(value=NO_CONTENT)
public void removeAllDependenciesForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the command to delete the dependency files from. Not null/empty/blank.NotFoundException - When no Command with the given id exists@PostMapping(value="/{id}/tags",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addTagsForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> tags)
throws NotFoundException
id - The id of the command to add the tags to. Not null/empty/blank.tags - The tags to add. Not null/empty/blank.NotFoundException - When no Command with the given id exists@GetMapping(value="/{id}/tags",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.Set<java.lang.String> getTagsForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the command to get the tags for. Not NULL/empty/blank.NotFoundException - When no Command with the given id exists@PutMapping(value="/{id}/tags",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void updateTagsForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.Set<java.lang.String> tags)
throws NotFoundException
id - The id of the command to update the tags for. Not null/empty/blank.tags - The tags to replace existing tags with. Not null/empty/blank.NotFoundException - When no Command with the given id exists@DeleteMapping(value="/{id}/tags")
@ResponseStatus(value=NO_CONTENT)
public void removeAllTagsForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the command to delete the tags from. Not null/empty/blank.NotFoundException - When no Command with the given id exists@DeleteMapping(value="/{id}/tags/{tag}")
@ResponseStatus(value=NO_CONTENT)
public void removeTagForCommand(@PathVariable(value="id")
java.lang.String id,
@PathVariable(value="tag")
java.lang.String tag)
throws NotFoundException
id - The id of the command to delete the tag from. Not null/empty/blank.tag - The tag to remove. Not null/empty/blank.NotFoundException - When no Command with the given id exists@PostMapping(value="/{id}/applications",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void addApplicationsForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.List<java.lang.String> applicationIds)
throws NotFoundException,
PreconditionFailedException
id - The id of the command to add the applications to. Not null/empty/blank.applicationIds - The ids of the applications to add. Not null. No duplicatesNotFoundException - When no Command with the given id existsPreconditionFailedException - If there are any duplicate applications in the list or when combined with
existing applications associated with the command@GetMapping(value="/{id}/applications",
produces="application/hal+json")
@ResponseStatus(value=OK)
public java.util.List<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Application>> getApplicationsForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
id - The id of the command to get the application files for. Not NULL/empty/blank.NotFoundException - When no Command with the given id exists@PutMapping(value="/{id}/applications",
consumes="application/json")
@ResponseStatus(value=NO_CONTENT)
public void setApplicationsForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody
java.util.List<java.lang.String> applicationIds)
throws NotFoundException,
PreconditionFailedException
id - The id of the command to add the applications to. Not null/empty/blank.applicationIds - The ids of the applications to set in order. Not null.NotFoundException - When no Command with the given id existsPreconditionFailedException - If there are any duplicate applications in the list@DeleteMapping(value="/{id}/applications")
@ResponseStatus(value=NO_CONTENT)
public void removeAllApplicationsForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException,
PreconditionFailedException
id - The id of the command to delete the applications from. Not null/empty/blank.NotFoundException - When no Command with the given id existsPreconditionFailedException - If constraints block removal@DeleteMapping(value="/{id}/applications/{appId}")
@ResponseStatus(value=NO_CONTENT)
public void removeApplicationForCommand(@PathVariable(value="id")
java.lang.String id,
@PathVariable(value="appId")
java.lang.String appId)
throws NotFoundException
id - The id of the command to delete the application from. Not null/empty/blank.appId - The id of the application to remove from the command. Not null/empty/blank.NotFoundException - When no Command with the given id exists or no application exists@GetMapping(value="/{id}/clusters",
produces="application/hal+json")
@ResponseStatus(value=OK)
public java.util.Set<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Cluster>> getClustersForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestParam(value="status",required=false) @Nullable
java.util.Set<java.lang.String> statuses)
throws NotFoundException,
com.netflix.genie.common.exceptions.GeniePreconditionException
id - The id of the command to get the clusters for. Not NULL/empty/blank.statuses - The statuses of the clusters to getNotFoundException - When no Command with the given id existscom.netflix.genie.common.exceptions.GeniePreconditionException - If a supplied status is not valid@GetMapping(value="/{id}/clusterCriteria",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.List<com.netflix.genie.common.external.dtos.v4.Criterion> getClusterCriteriaForCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
Criterion currently associated with the command in priority order.id - The id of the command to get the criteria forNotFoundException - When no Command with the given id exists@DeleteMapping(value="/{id}/clusterCriteria")
@ResponseStatus(value=OK)
public void removeAllClusterCriteriaFromCommand(@PathVariable(value="id")
java.lang.String id)
throws NotFoundException
Criterion currently associated with the command.id - The id of the command to remove the criteria forNotFoundException - When no Command with the given id exists@PostMapping(value="/{id}/clusterCriteria",
consumes="application/json")
@ResponseStatus(value=OK)
public void addClusterCriterionForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody @Valid
@Valid com.netflix.genie.common.external.dtos.v4.Criterion criterion)
throws NotFoundException
Criterion as the lowest priority criterion for the given command.id - The id of the command to add the new criterion tocriterion - The Criterion to addNotFoundException - When no Command with the given id exists@PutMapping(value="/{id}/clusterCriteria",
consumes="application/json")
@ResponseStatus(value=OK)
public void setClusterCriteriaForCommand(@PathVariable(value="id")
java.lang.String id,
@RequestBody @Valid
@Valid java.util.List<com.netflix.genie.common.external.dtos.v4.Criterion> clusterCriteria)
throws NotFoundException
id - The id of the command to add the new criteria toclusterCriteria - The list of Criterion in priority order to set for the given commandNotFoundException - When no Command with the given id exists@PutMapping(value="/{id}/clusterCriteria/{priority}",
consumes="application/json")
@ResponseStatus(value=OK)
public void insertClusterCriterionForCommand(@PathVariable(value="id")
java.lang.String id,
@PathVariable(value="priority") @Min(value=0L)
@Min(value=0L) int priority,
@RequestBody @Valid
@Valid com.netflix.genie.common.external.dtos.v4.Criterion criterion)
throws NotFoundException
id - The id of the command to add the new criterion forpriority - The priority (min 0) to insert the criterion at in the listcriterion - The Criterion to addNotFoundException - When no Command with the given id exists@DeleteMapping(value="/{id}/clusterCriteria/{priority}")
@ResponseStatus(value=OK)
public void removeClusterCriterionFromCommand(@PathVariable(value="id")
java.lang.String id,
@PathVariable(value="priority") @Min(value=0L)
@Min(value=0L) int priority)
throws NotFoundException
id - The id of the command to remove the criterion frompriority - The priority (min 0, max number of existing criteria minus one) of the criterion to removeNotFoundException - When no Command with the given id exists@GetMapping(value="/{id}/resolvedClusters",
produces="application/json")
@ResponseStatus(value=OK)
public java.util.List<com.netflix.genie.common.external.dtos.v4.ResolvedResources<com.netflix.genie.common.dto.Cluster>> resolveClustersForCommandClusterCriteria(@PathVariable(value="id")
java.lang.String id,
@RequestParam(value="addDefaultStatus",defaultValue="true")
java.lang.Boolean addDefaultStatus)
throws NotFoundException
Command retrieve the Criterion and attempt to resolve all the Cluster's the
criteria would currently match within the database.id - The id of the command to get the criterion fromaddDefaultStatus - Whether the system should add the default ClusterStatus to the Criterion
if no status currently is within the Criterion. The default value is
true which will currently add the status ClusterStatus.UPResolvedResources of each criterion to the Cluster's it resolved toNotFoundException - When no Command with the given id exists