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

[INLONG-7529][Manager] Change the pattern limitation of InlongGroupId and InlongStreamId #7530

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
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 @@ -49,7 +49,7 @@ public abstract class InlongGroupRequest extends BaseInlongGroup {
@ApiModelProperty(value = "Inlong group id", required = true)
@NotBlank(message = "inlongGroupId cannot be blank")
@Length(min = 4, max = 100, message = "length must be between 4 and 100")
@Pattern(regexp = "^[a-z0-9_-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
private String inlongGroupId;

@ApiModelProperty(value = "Inlong group name", required = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public abstract class SinkRequest {
@ApiModelProperty("Inlong group id")
@NotBlank(groups = {SaveValidation.class, UpdateByKeyValidation.class}, message = "inlongGroupId cannot be blank")
@Length(min = 4, max = 100, message = "length must be between 4 and 100")
@Pattern(regexp = "^[a-z0-9_-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
private String inlongGroupId;

@ApiModelProperty("Inlong stream id")
@NotBlank(groups = {SaveValidation.class, UpdateByKeyValidation.class}, message = "inlongStreamId cannot be blank")
@Length(min = 1, max = 100, message = "inlongStreamId length must be between 1 and 100")
@Pattern(regexp = "^[a-z0-9_-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
private String inlongStreamId;

@ApiModelProperty("Sink type, including: HIVE, ES, etc.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public class SourceRequest {
@ApiModelProperty("Inlong group id")
@NotBlank(groups = SaveValidation.class, message = "inlongGroupId cannot be blank")
@Length(min = 4, max = 100, message = "length must be between 4 and 100")
@Pattern(regexp = "^[a-z0-9_-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
private String inlongGroupId;

@ApiModelProperty("Inlong stream id")
@NotBlank(groups = SaveValidation.class, message = "inlongStreamId cannot be blank")
@Length(min = 1, max = 100, message = "inlongStreamId length must be between 1 and 100")
@Pattern(regexp = "^[a-z0-9_-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
private String inlongStreamId;

@ApiModelProperty("Source type, including: FILE, KAFKA, etc.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import org.apache.inlong.manager.common.validation.UpdateValidation;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
Expand All @@ -46,13 +45,13 @@ public class InlongStreamRequest extends BaseInlongStream {
@ApiModelProperty(value = "Inlong group id")
@NotBlank(message = "inlongGroupId cannot be blank")
@Length(min = 4, max = 100, message = "length must be between 4 and 100")
@Pattern(regexp = "^[a-z0-9_-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
private String inlongGroupId;

@ApiModelProperty(value = "Inlong stream id")
@NotBlank(message = "inlongStreamId cannot be blank")
@Length(min = 1, max = 100, message = "inlongStreamId length must be between 1 and 100")
@Pattern(regexp = "^[a-z0-9_-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
private String inlongStreamId;

@ApiModelProperty(value = "Inlong stream name", required = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public class DeleteTransformRequest {
@ApiModelProperty("Inlong group id")
@NotBlank(message = "inlongGroupId cannot be blank")
@Length(min = 4, max = 100, message = "length must be between 4 and 100")
@Pattern(regexp = "^[a-z0-9_-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{4,100}$", message = "only supports lowercase letters, numbers, '-', or '_'")
private String inlongGroupId;

@ApiModelProperty("Inlong stream id")
@NotBlank(message = "inlongStreamId cannot be blank")
@Length(min = 1, max = 100, message = "inlongStreamId length must be between 1 and 100")
@Pattern(regexp = "^[a-z0-9_-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
@Pattern(regexp = "^[a-z0-9_.-]{1,100}$", message = "inlongStreamId only supports lowercase letters, numbers, '-', or '_'")
private String inlongStreamId;

@ApiModelProperty("Transform name, unique in one stream")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ public PageResult<InlongGroupBriefInfo> listBrief(InlongGroupPageRequest request
public List<InlongGroupBriefInfo> listBrief(InlongGroupPageRequest request, UserInfo opInfo) {
// filter records;
List<InlongGroupEntity> filterGroupEntities = new ArrayList<>();
OrderFieldEnum.checkOrderField(request);
OrderTypeEnum.checkOrderType(request);
for (InlongGroupEntity groupEntity : groupMapper.selectByCondition(request)) {
// only the person in charges can query
if (!opInfo.getAccountType().equals(UserTypeEnum.ADMIN.getCode())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ public List<? extends StreamSink> listByCondition(SinkPageRequest request, UserI
throw new BusinessException(ErrorCodeEnum.GROUP_ID_IS_EMPTY);
}
// query result
OrderFieldEnum.checkOrderField(request);
OrderTypeEnum.checkOrderType(request);
List<StreamSinkEntity> sinkEntityList = sinkMapper.selectByCondition(request);
Map<String, Page<StreamSinkEntity>> sinkMap = Maps.newHashMap();
for (StreamSinkEntity streamSink : sinkEntityList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ public PageResult<InlongStreamBriefInfo> listBrief(InlongStreamPageRequest reque
public List<InlongStreamBriefInfo> listBrief(InlongStreamPageRequest request, UserInfo opInfo) {
request.setCurrentUser(opInfo.getName());
request.setIsAdminRole(opInfo.getRoles().contains(UserRoleCode.ADMIN));
OrderFieldEnum.checkOrderField(request);
OrderTypeEnum.checkOrderType(request);
return CommonBeanUtils.copyListProperties(streamMapper.selectByCondition(request), InlongStreamBriefInfo::new);
}

Expand Down