Skip to content

Commit

Permalink
[INLONG-9328][Manager] Add parameters validation for the updateAuditS…
Browse files Browse the repository at this point in the history
…ource method
  • Loading branch information
hnrainll committed Nov 23, 2023
1 parent 581444a commit 1edaf8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
* Audit source request
Expand All @@ -45,6 +46,7 @@ public class AuditSourceRequest {
private String type;

@NotBlank
@Pattern(regexp = "^(jdbc:(mysql|clickhouse)://[\\w.]+(:\\d+)?/[\\w]+(\\?.*)?|http://[\\w.]+(:\\d+)?(/[\\w]+)+(/\\d+(-\\d+)?(,\\d+(-\\d+)?)*)?)", message = "only supports MYSQL, CLICKHOUSE, ELASTICSEARCH url")
@ApiModelProperty(value = "Audit source URL, for MYSQL or CLICKHOUSE, is jdbcUrl, and for ELASTICSEARCH is the access URL with hostname:port", required = true)
private String url;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Response<Boolean> refreshCache() {

@ApiOperation(value = "Update the audit source")
@PostMapping(value = "/audit/updateSource")
public Response<Integer> updateAuditSource(@RequestBody AuditSourceRequest request) {
public Response<Integer> updateAuditSource(@Valid @RequestBody AuditSourceRequest request) {
return Response.success(auditService.updateAuditSource(request, LoginUserUtils.getLoginUser().getName()));
}

Expand Down

0 comments on commit 1edaf8b

Please sign in to comment.