diff --git a/SingularityService/src/main/java/com/hubspot/singularity/resources/DeployResource.java b/SingularityService/src/main/java/com/hubspot/singularity/resources/DeployResource.java index 1fe287d696..79dc663557 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/resources/DeployResource.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/resources/DeployResource.java @@ -190,8 +190,14 @@ public SingularityRequestParent deploy(SingularityDeployRequest deployRequest, S ) public SingularityRequestParent cancelDeploy( @Parameter(hidden = true) @Auth SingularityUser user, + @Context HttpServletRequest requestContext, @Parameter(required = true, description = "The Singularity Request Id from which the deployment is removed.") @PathParam("requestId") String requestId, @Parameter(required = true, description = "The Singularity Deploy Id that should be removed.") @PathParam("deployId") String deployId) { + + return maybeProxyToLeader(requestContext, SingularityRequestParent.class, null, () -> cancelDeploy(user, requestId, deployId)); + } + + public SingularityRequestParent cancelDeploy(SingularityUser user, String requestId, String deployId) { SingularityRequestWithState requestWithState = fetchRequestWithState(requestId, user); authorizationHelper.checkForAuthorization(requestWithState.getRequest(), user, SingularityAuthorizationScope.WRITE); @@ -217,7 +223,12 @@ public SingularityRequestParent cancelDeploy( ) public SingularityRequestParent updatePendingDeploy( @Parameter(hidden = true) @Auth SingularityUser user, + @Context HttpServletRequest requestContext, @RequestBody(required = true) SingularityUpdatePendingDeployRequest updateRequest) { + return maybeProxyToLeader(requestContext, SingularityRequestParent.class, updateRequest, () -> updatePendingDeploy(user, updateRequest)); + } + + public SingularityRequestParent updatePendingDeploy(SingularityUser user, SingularityUpdatePendingDeployRequest updateRequest) { SingularityRequestWithState requestWithState = fetchRequestWithState(updateRequest.getRequestId(), user); authorizationHelper.checkForAuthorization(requestWithState.getRequest(), user, SingularityAuthorizationScope.WRITE);