use of com.netflix.titus.grpc.protogen.JobAttributesDeleteRequest in project titus-control-plane by Netflix.
the class JobManagementResource method deleteJobAttributes.
@DELETE
@ApiOperation("Delete attributes of a job with the specified key names")
@Path("/jobs/{jobId}/attributes")
public Response deleteJobAttributes(@PathParam("jobId") String jobId, @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");
}
JobAttributesDeleteRequest request = JobAttributesDeleteRequest.newBuilder().setJobId(jobId).addAllKeys(keys).build();
return Responses.fromVoidMono(jobServiceGateway.deleteJobAttributes(request, resolveCallMetadata()));
}
use of com.netflix.titus.grpc.protogen.JobAttributesDeleteRequest in project titus-control-plane by Netflix.
the class JobManagementSpringResource method deleteJobAttributes.
@ApiOperation("Delete attributes of a job with the specified key names")
@DeleteMapping(path = "/jobs/{jobId}/attributes")
public ResponseEntity<Void> deleteJobAttributes(@PathVariable("jobId") String jobId, @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");
}
JobAttributesDeleteRequest request = JobAttributesDeleteRequest.newBuilder().setJobId(jobId).addAllKeys(keys).build();
return Responses.fromVoidMono(jobServiceGateway.deleteJobAttributes(request, authentication.getCallMetadata()), HttpStatus.OK);
}
use of com.netflix.titus.grpc.protogen.JobAttributesDeleteRequest in project titus-control-plane by Netflix.
the class JobManagementSpringResourceTest method testDeleteJobAttributes.
@Test
public void testDeleteJobAttributes() throws Exception {
JobAttributesDeleteRequest forwardedRequest = JobAttributesDeleteRequest.newBuilder().setJobId(JOB_ID_1).addKeys("keyA").build();
when(jobServiceGatewayMock.deleteJobAttributes(forwardedRequest, JUNIT_REST_CALL_METADATA)).thenReturn(Mono.empty());
SpringMockMvcUtil.doDelete(mockMvc, String.format("/api/v3/jobs/%s/attributes", JOB_ID_1), "keys", "keyA");
verify(jobServiceGatewayMock, times(1)).deleteJobAttributes(forwardedRequest, JUNIT_REST_CALL_METADATA);
}
Aggregations