-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INLONG-11618][Manager] Support COS stream source
- Loading branch information
Showing
16 changed files
with
805 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...er/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/node/cos/COSDataNodeDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.manager.pojo.node.cos; | ||
|
||
import org.apache.inlong.manager.common.enums.ErrorCodeEnum; | ||
import org.apache.inlong.manager.common.exceptions.BusinessException; | ||
import org.apache.inlong.manager.common.util.CommonBeanUtils; | ||
import org.apache.inlong.manager.common.util.JsonUtils; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* COS data node info | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ApiModel("COS data node info") | ||
public class COSDataNodeDTO { | ||
|
||
@ApiModelProperty(value = "COS bucket name") | ||
private String bucketName; | ||
|
||
@ApiModelProperty(value = "COS secret id") | ||
private String credentialsId; | ||
|
||
@ApiModelProperty(value = "COS secret key") | ||
private String credentialsKey; | ||
|
||
@ApiModelProperty(value = "COS region") | ||
private String region; | ||
|
||
/** | ||
* Get the dto instance from the request | ||
*/ | ||
public static COSDataNodeDTO getFromRequest(COSDataNodeRequest request, String extParams) { | ||
COSDataNodeDTO dto = StringUtils.isNotBlank(extParams) | ||
? COSDataNodeDTO.getFromJson(extParams) | ||
: new COSDataNodeDTO(); | ||
return CommonBeanUtils.copyProperties(request, dto, true); | ||
} | ||
|
||
/** | ||
* Get the dto instance from the JSON string. | ||
*/ | ||
public static COSDataNodeDTO getFromJson(@NotNull String extParams) { | ||
try { | ||
return JsonUtils.parseObject(extParams, COSDataNodeDTO.class); | ||
} catch (Exception e) { | ||
throw new BusinessException(ErrorCodeEnum.CLUSTER_INFO_INCORRECT, | ||
String.format("Failed to parse extParams for COS node: %s", e.getMessage())); | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...r/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/node/cos/COSDataNodeInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.manager.pojo.node.cos; | ||
|
||
import org.apache.inlong.manager.common.consts.DataNodeType; | ||
import org.apache.inlong.manager.common.util.CommonBeanUtils; | ||
import org.apache.inlong.manager.common.util.JsonTypeDefine; | ||
import org.apache.inlong.manager.pojo.node.DataNodeInfo; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
/** | ||
* COS data node info | ||
*/ | ||
@Data | ||
@SuperBuilder | ||
@AllArgsConstructor | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@JsonTypeDefine(value = DataNodeType.COS) | ||
@ApiModel("COS data node info") | ||
public class COSDataNodeInfo extends DataNodeInfo { | ||
|
||
@ApiModelProperty(value = "COS bucket name") | ||
private String bucketName; | ||
|
||
@ApiModelProperty(value = "COS secret id") | ||
private String credentialsId; | ||
|
||
@ApiModelProperty(value = "COS secret key") | ||
private String credentialsKey; | ||
|
||
@ApiModelProperty(value = "COS region") | ||
private String region; | ||
|
||
public COSDataNodeInfo() { | ||
this.setType(DataNodeType.COS); | ||
} | ||
|
||
@Override | ||
public COSDataNodeRequest genRequest() { | ||
return CommonBeanUtils.copyProperties(this, COSDataNodeRequest::new); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...anager-pojo/src/main/java/org/apache/inlong/manager/pojo/node/cos/COSDataNodeRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.manager.pojo.node.cos; | ||
|
||
import org.apache.inlong.manager.common.consts.DataNodeType; | ||
import org.apache.inlong.manager.common.util.JsonTypeDefine; | ||
import org.apache.inlong.manager.pojo.node.DataNodeRequest; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
/** | ||
* COS data node request | ||
*/ | ||
@Data | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@JsonTypeDefine(value = DataNodeType.COS) | ||
@ApiModel("COS data node request") | ||
public class COSDataNodeRequest extends DataNodeRequest { | ||
|
||
@ApiModelProperty(value = "COS bucket name") | ||
private String bucketName; | ||
|
||
@ApiModelProperty(value = "COS secret id") | ||
private String credentialsId; | ||
|
||
@ApiModelProperty(value = "COS secret key") | ||
private String credentialsKey; | ||
|
||
@ApiModelProperty(value = "COS region") | ||
private String region; | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
...r-pojo/src/main/java/org/apache/inlong/manager/pojo/source/cos/COSDataAddTaskRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.manager.pojo.source.cos; | ||
|
||
import org.apache.inlong.manager.common.consts.SourceType; | ||
import org.apache.inlong.manager.common.util.JsonTypeDefine; | ||
import org.apache.inlong.manager.pojo.source.DataAddTaskRequest; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@JsonTypeDefine(value = SourceType.COS) | ||
@ApiModel(value = "COS data add task request") | ||
public class COSDataAddTaskRequest extends DataAddTaskRequest { | ||
|
||
@ApiModelProperty("filterStreams") | ||
private List<String> filterStreams; | ||
|
||
} |
90 changes: 90 additions & 0 deletions
90
...nager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/source/cos/COSSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.inlong.manager.pojo.source.cos; | ||
|
||
import org.apache.inlong.manager.common.consts.SourceType; | ||
import org.apache.inlong.manager.common.util.CommonBeanUtils; | ||
import org.apache.inlong.manager.common.util.JsonTypeDefine; | ||
import org.apache.inlong.manager.pojo.source.SourceRequest; | ||
import org.apache.inlong.manager.pojo.source.StreamSource; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* COS source info | ||
*/ | ||
@Data | ||
@SuperBuilder | ||
@AllArgsConstructor | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@ApiModel(value = "COS source info") | ||
@JsonTypeDefine(value = SourceType.COS) | ||
public class COSSource extends StreamSource { | ||
|
||
@ApiModelProperty(value = "Path regex pattern for file, such as /a/b/*.txt", required = true) | ||
private String pattern; | ||
|
||
@ApiModelProperty("Cycle unit") | ||
private String cycleUnit; | ||
|
||
@ApiModelProperty("Whether retry") | ||
private Boolean retry; | ||
|
||
@ApiModelProperty(value = "Data start time") | ||
private String dataTimeFrom; | ||
|
||
@ApiModelProperty(value = "Data end time") | ||
private String dataTimeTo; | ||
|
||
@ApiModelProperty("TimeOffset for collection, " | ||
+ "'1m' means from one minute after, '-1m' means from one minute before, " | ||
+ "'1h' means from one hour after, '-1h' means from one minute before, " | ||
+ "'1d' means from one day after, '-1d' means from one minute before, " | ||
+ "Null or blank means from current timestamp") | ||
private String timeOffset; | ||
|
||
@ApiModelProperty("Max file count") | ||
private String maxFileCount; | ||
|
||
@ApiModelProperty(" Type of data result for column separator" | ||
+ " CSV format, set this parameter to a custom separator: , | : " | ||
+ " Json format, set this parameter to json ") | ||
private String contentStyle; | ||
|
||
@ApiModelProperty("filterStreams") | ||
private List<String> filterStreams; | ||
|
||
public COSSource() { | ||
this.setSourceType(SourceType.COS); | ||
} | ||
|
||
@Override | ||
public SourceRequest genSourceRequest() { | ||
return CommonBeanUtils.copyProperties(this, COSSourceRequest::new); | ||
} | ||
|
||
} |
Oops, something went wrong.