use of com.netflix.titus.grpc.protogen.TaskAttributesDeleteRequest in project titus-control-plane by Netflix.
the class JobManagementResource method deleteTaskAttributes.
@DELETE
@ApiOperation("Delete attributes of a task with the specified key names")
@Path("/tasks/{taskId}/attributes")
public Response deleteTaskAttributes(@PathParam("taskId") String taskId, @QueryParam("keys") String delimitedKeys) {
if (Strings.isNullOrEmpty(delimitedKeys)) {
throw TitusServiceException.invalidArgument("Path parameter 'keys' cannot be empty");
}
Set<String> keys = StringExt.splitByCommaIntoSet(delimitedKeys);
if (keys.isEmpty()) {
throw TitusServiceException.invalidArgument("Parsed path parameter 'keys' cannot be empty");
}
TaskAttributesDeleteRequest request = TaskAttributesDeleteRequest.newBuilder().setTaskId(taskId).addAllKeys(keys).build();
return Responses.fromCompletable(jobServiceGateway.deleteTaskAttributes(request, resolveCallMetadata()));
}
use of com.netflix.titus.grpc.protogen.TaskAttributesDeleteRequest in project titus-control-plane by Netflix.
the class JobManagementSpringResource method deleteTaskAttributes.
@ApiOperation("Delete attributes of a task with the specified key names")
@DeleteMapping(path = "/tasks/{taskId}/attributes")
public ResponseEntity<Void> deleteTaskAttributes(@PathVariable("taskId") String taskId, @RequestParam("keys") String delimitedKeys, CallMetadataAuthentication authentication) {
if (Strings.isNullOrEmpty(delimitedKeys)) {
throw TitusServiceException.invalidArgument("Path parameter 'keys' cannot be empty");
}
Set<String> keys = StringExt.splitByCommaIntoSet(delimitedKeys);
if (keys.isEmpty()) {
throw TitusServiceException.invalidArgument("Parsed path parameter 'keys' cannot be empty");
}
TaskAttributesDeleteRequest request = TaskAttributesDeleteRequest.newBuilder().setTaskId(taskId).addAllKeys(keys).build();
return Responses.fromCompletable(jobServiceGateway.deleteTaskAttributes(request, authentication.getCallMetadata()), HttpStatus.OK);
}
use of com.netflix.titus.grpc.protogen.TaskAttributesDeleteRequest in project titus-control-plane by Netflix.
the class JobManagementSpringResourceTest method testDeleteTaskAttributes.
@Test
public void testDeleteTaskAttributes() throws Exception {
TaskAttributesDeleteRequest forwardedRequest = TaskAttributesDeleteRequest.newBuilder().setTaskId(TASK_ID_1).addKeys("keyA").build();
when(jobServiceGatewayMock.deleteTaskAttributes(forwardedRequest, JUNIT_REST_CALL_METADATA)).thenReturn(Completable.complete());
SpringMockMvcUtil.doDelete(mockMvc, String.format("/api/v3/tasks/%s/attributes", TASK_ID_1), "keys", "keyA");
verify(jobServiceGatewayMock, times(1)).deleteTaskAttributes(forwardedRequest, JUNIT_REST_CALL_METADATA);
}
Aggregations