forked from apache/inlong
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INLONG-10844][Manager] Support configuring HTTP type sink
- Loading branch information
Showing
14 changed files
with
713 additions
and
0 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
39 changes: 39 additions & 0 deletions
39
...o/src/main/java/org/apache/inlong/manager/pojo/cluster/sort/http/SortHttpClusterInfo.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,39 @@ | ||
/* | ||
* 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.cluster.sort.http; | ||
|
||
import org.apache.inlong.manager.common.enums.ClusterType; | ||
import org.apache.inlong.manager.common.util.JsonTypeDefine; | ||
import org.apache.inlong.manager.pojo.sort.BaseSortClusterInfo; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@JsonTypeDefine(value = ClusterType.SORT_HTTP) | ||
@ApiModel("Inlong cluster info for Sort http") | ||
public class SortHttpClusterInfo extends BaseSortClusterInfo { | ||
|
||
public SortHttpClusterInfo() { | ||
this.setType(ClusterType.SORT_HTTP); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...rc/main/java/org/apache/inlong/manager/pojo/cluster/sort/http/SortHttpClusterRequest.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,39 @@ | ||
/* | ||
* 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.cluster.sort.http; | ||
|
||
import org.apache.inlong.manager.common.enums.ClusterType; | ||
import org.apache.inlong.manager.common.util.JsonTypeDefine; | ||
import org.apache.inlong.manager.pojo.sort.BaseSortClusterRequest; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@JsonTypeDefine(value = ClusterType.SORT_HTTP) | ||
@ApiModel("Inlong cluster request for Sort http") | ||
public class SortHttpClusterRequest extends BaseSortClusterRequest { | ||
|
||
public SortHttpClusterRequest() { | ||
this.setType(ClusterType.SORT_HTTP); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
.../manager-pojo/src/main/java/org/apache/inlong/manager/pojo/node/http/HttpDataNodeDTO.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,75 @@ | ||
/* | ||
* 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.http; | ||
|
||
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; | ||
|
||
/** | ||
* Http service data node info | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ApiModel("Http service data node info") | ||
public class HttpDataNodeDTO { | ||
|
||
@ApiModelProperty("HTTP base url") | ||
private String baseUrl; | ||
|
||
@ApiModelProperty("Whether to enable credential") | ||
private Boolean enableCredential; | ||
|
||
@ApiModelProperty("Max connect count") | ||
private Integer maxConnect; | ||
/** | ||
* Get the dto instance from the request | ||
*/ | ||
public static HttpDataNodeDTO getFromRequest(HttpDataNodeRequest request, String extParams) { | ||
HttpDataNodeDTO dto = StringUtils.isNotBlank(extParams) | ||
? HttpDataNodeDTO.getFromJson(extParams) | ||
: new HttpDataNodeDTO(); | ||
return CommonBeanUtils.copyProperties(request, dto, true); | ||
} | ||
|
||
/** | ||
* Get the dto instance from the JSON string. | ||
*/ | ||
public static HttpDataNodeDTO getFromJson(@NotNull String extParams) { | ||
try { | ||
return JsonUtils.parseObject(extParams, HttpDataNodeDTO.class); | ||
} catch (Exception e) { | ||
throw new BusinessException(ErrorCodeEnum.GROUP_INFO_INCORRECT, | ||
String.format("Failed to parse extParams for Cloud log service node: %s", e.getMessage())); | ||
} | ||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
...manager-pojo/src/main/java/org/apache/inlong/manager/pojo/node/http/HttpDataNodeInfo.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,63 @@ | ||
/* | ||
* 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.http; | ||
|
||
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 org.apache.inlong.manager.pojo.node.DataNodeRequest; | ||
|
||
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; | ||
|
||
/** | ||
* Cloud log service data node info | ||
*/ | ||
@Data | ||
@SuperBuilder | ||
@AllArgsConstructor | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@JsonTypeDefine(value = DataNodeType.HTTP) | ||
@ApiModel("HTTP data node info") | ||
public class HttpDataNodeInfo extends DataNodeInfo { | ||
|
||
@ApiModelProperty("HTTP base url") | ||
private String baseUrl; | ||
|
||
@ApiModelProperty("Whether to enable credential") | ||
private Boolean enableCredential; | ||
|
||
@ApiModelProperty("Max connect count") | ||
private Integer maxConnect; | ||
|
||
public HttpDataNodeInfo() { | ||
setType(DataNodeType.HTTP); | ||
} | ||
|
||
@Override | ||
public DataNodeRequest genRequest() { | ||
return CommonBeanUtils.copyProperties(this, HttpDataNodeRequest::new); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...ager-pojo/src/main/java/org/apache/inlong/manager/pojo/node/http/HttpDataNodeRequest.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,53 @@ | ||
/* | ||
* 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.http; | ||
|
||
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; | ||
|
||
/** | ||
* Cloud log service data node request | ||
*/ | ||
@Data | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@JsonTypeDefine(value = DataNodeType.HTTP) | ||
@ApiModel("Http service data node request") | ||
public class HttpDataNodeRequest extends DataNodeRequest { | ||
|
||
@ApiModelProperty("HTTP base url") | ||
private String baseUrl; | ||
|
||
@ApiModelProperty("Whether to enable credential") | ||
private Boolean enableCredential; | ||
|
||
@ApiModelProperty("Max connect count") | ||
private Integer maxConnect; | ||
|
||
public HttpDataNodeRequest() { | ||
this.setType(DataNodeType.HTTP); | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
...manager/manager-pojo/src/main/java/org/apache/inlong/manager/pojo/sink/http/HttpSink.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,61 @@ | ||
/* | ||
* 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.sink.http; | ||
|
||
import org.apache.inlong.manager.common.consts.SinkType; | ||
import org.apache.inlong.manager.common.util.CommonBeanUtils; | ||
import org.apache.inlong.manager.common.util.JsonTypeDefine; | ||
import org.apache.inlong.manager.pojo.sink.SinkRequest; | ||
import org.apache.inlong.manager.pojo.sink.StreamSink; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* HTTP sink info | ||
*/ | ||
@Data | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@ApiModel(value = "HTTP sink info") | ||
@JsonTypeDefine(value = SinkType.HTTP) | ||
public class HttpSink extends StreamSink { | ||
|
||
@ApiModelProperty("HTTP path") | ||
private String path; | ||
|
||
@ApiModelProperty("HTTP method, like POST, GET") | ||
private String method; | ||
|
||
@ApiModelProperty("HTTP headers") | ||
private Map<String, String> headers; | ||
|
||
public HttpSink() { | ||
this.setSinkType(SinkType.HTTP); | ||
} | ||
|
||
@Override | ||
public SinkRequest genSinkRequest() { | ||
return CommonBeanUtils.copyProperties(this, HttpSinkRequest::new); | ||
} | ||
} |
Oops, something went wrong.