Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[rest] Fix missing backward compatibility in rules/runNow #3225

Merged
merged 1 commit into from Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -317,7 +317,7 @@ public Response enableRule(@PathParam("ruleUID") @Parameter(description = "ruleU
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Rule corresponding to the given UID does not found.") })
public Response runNow(@PathParam("ruleUID") @Parameter(description = "ruleUID") String ruleUID,
@Nullable @Parameter(description = "the context for running this rule") Map<String, Object> context)
@Nullable @Parameter(description = "the context for running this rule", allowEmptyValue = true) Map<String, Object> context)
throws IOException {
Rule rule = ruleRegistry.get(ruleUID);
if (rule == null) {
Expand All @@ -330,6 +330,18 @@ public Response runNow(@PathParam("ruleUID") @Parameter(description = "ruleUID")
}
}

@POST
@RolesAllowed({ Role.USER, Role.ADMIN })
@Path("/{ruleUID}/runnow")
@Consumes(MediaType.TEXT_PLAIN)
@Operation(deprecated = true, operationId = "runRuleNow", summary = "Executes actions of the rule.", responses = {
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Rule corresponding to the given UID does not found.") })
public Response runNow(@PathParam("ruleUID") @Parameter(description = "ruleUID") String ruleUID)
throws IOException {
return runNow(ruleUID, null);
}

@GET
@Path("/{ruleUID}/triggers")
@Produces(MediaType.APPLICATION_JSON)
Expand Down