Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Proxy deploy cancellations to leader #1970

Merged
merged 2 commits into from
Jul 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down