This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new b429a4c6 feat(plugins): add swagger for special plugins (#2740)
b429a4c6 is described below
commit b429a4c630d52dd981b354de7c51f2bf7b156c2d
Author: Warren Chen <[email protected]>
AuthorDate: Tue Aug 16 21:38:04 2022 +0800
feat(plugins): add swagger for special plugins (#2740)
relates to #2734 #2735
---
plugins/dbt/api/connection.go | 48 ++++++++++++++++++++++++++++++++
plugins/feishu/api/connection.go | 16 +++++++++++
plugins/gitextractor/api/connection.go | 42 ++++++++++++++++++++++++++++
plugins/refdiff/api/connection.go | 45 ++++++++++++++++++++++++++++++
plugins/starrocks/api/connection.go | 50 ++++++++++++++++++++++++++++++++++
5 files changed, 201 insertions(+)
diff --git a/plugins/dbt/api/connection.go b/plugins/dbt/api/connection.go
new file mode 100644
index 00000000..8b4f6127
--- /dev/null
+++ b/plugins/dbt/api/connection.go
@@ -0,0 +1,48 @@
+/*
+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 api
+
+import (
+ "github.com/apache/incubator-devlake/plugins/core"
+ "net/http"
+)
+
+// @Summary pipelines plan for dbt
+// @Description pipelines plan for dbt
+// @Tags plugins/dbt
+// @Accept application/json
+// @Param blueprint body DbtPipelinePlan true "json"
+// @Router /pipelines/dbt/pipeline-plan [post]
+func PostDbtPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput,
error) {
+ blueprint := &DbtPipelinePlan{}
+ return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK},
nil
+}
+
+type DbtPipelinePlan [][]struct {
+ Plugin string `json:"plugin"`
+ Options struct {
+ ProjectPath string `json:"projectPath"`
+ ProjectName string `json:"projectName"`
+ ProjectTarget string `json:"projectTarget"`
+ SelectedModels []string `json:"selectedModels"`
+ ProjectVars struct {
+ Demokey1 string `json:"demokey1"`
+ Demokey2 string `json:"demokey2"`
+ } `json:"projectVars"`
+ } `json:"options"`
+}
diff --git a/plugins/feishu/api/connection.go b/plugins/feishu/api/connection.go
index 9b26d0a9..36e9a256 100644
--- a/plugins/feishu/api/connection.go
+++ b/plugins/feishu/api/connection.go
@@ -160,3 +160,19 @@ func GetConnection(input *core.ApiResourceInput)
(*core.ApiResourceOutput, error
}
return &core.ApiResourceOutput{Body: connection}, err
}
+
+// @Summary pipelines plan for feishu
+// @Description pipelines plan for feishu
+// @Tags plugins/feishu
+// @Accept application/json
+// @Param blueprint body FeishuPipelinePlan true "json"
+// @Router /pipelines/feishu/pipeline-plan [post]
+func PostFeishuPipeline(input *core.ApiResourceInput)
(*core.ApiResourceOutput, error) {
+ blueprint := &FeishuPipelinePlan{}
+ return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK},
nil
+}
+
+type FeishuPipelinePlan [][]struct {
+ Plugin string `json:"plugin"`
+ Options struct{} `json:"options"`
+}
diff --git a/plugins/gitextractor/api/connection.go
b/plugins/gitextractor/api/connection.go
new file mode 100644
index 00000000..ca55262e
--- /dev/null
+++ b/plugins/gitextractor/api/connection.go
@@ -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 api
+
+import (
+ "github.com/apache/incubator-devlake/plugins/core"
+ "net/http"
+)
+
+// @Summary pipelines plan for gitextractor
+// @Description pipelines plan for gitextractor
+// @Tags plugins/gitextractor
+// @Accept application/json
+// @Param blueprint body GitextractorPipelinePlan true "json"
+// @Router /pipelines/gitextractor/pipeline-plan [post]
+func PostGitextractorPipeline(input *core.ApiResourceInput)
(*core.ApiResourceOutput, error) {
+ blueprint := &GitextractorPipelinePlan{}
+ return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK},
nil
+}
+
+type GitextractorPipelinePlan [][]struct {
+ Plugin string `json:"plugin"`
+ Options struct {
+ URL string `json:"url"`
+ RepoID string `json:"repoId"`
+ } `json:"options"`
+}
diff --git a/plugins/refdiff/api/connection.go
b/plugins/refdiff/api/connection.go
new file mode 100644
index 00000000..05040126
--- /dev/null
+++ b/plugins/refdiff/api/connection.go
@@ -0,0 +1,45 @@
+/*
+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 api
+
+import (
+ "github.com/apache/incubator-devlake/plugins/core"
+ "net/http"
+)
+
+// @Summary pipelines plan for refdiff
+// @Description pipelines plan for refdiff
+// @Tags plugins/refdiff
+// @Accept application/json
+// @Param blueprint body RefdiffPipelinePlan true "json"
+// @Router /pipelines/refdiff/pipeline-plan [post]
+func PostRefdiffPipeline(input *core.ApiResourceInput)
(*core.ApiResourceOutput, error) {
+ blueprint := &RefdiffPipelinePlan{}
+ return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK},
nil
+}
+
+type RefdiffPipelinePlan [][]struct {
+ Plugin string `json:"plugin"`
+ Options struct {
+ RepoID string `json:"repoId"`
+ Pairs []struct {
+ NewRef string `json:"newRef"`
+ OldRef string `json:"oldRef"`
+ } `json:"pairs"`
+ } `json:"options"`
+}
diff --git a/plugins/starrocks/api/connection.go
b/plugins/starrocks/api/connection.go
new file mode 100644
index 00000000..f6ac6b0d
--- /dev/null
+++ b/plugins/starrocks/api/connection.go
@@ -0,0 +1,50 @@
+/*
+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 api
+
+import (
+ "github.com/apache/incubator-devlake/plugins/core"
+ "net/http"
+)
+
+// @Summary pipelines plan for starrocks
+// @Description pipelines plan for starrocks
+// @Tags plugins/starrocks
+// @Accept application/json
+// @Param blueprint body StarRocksPipelinePlan true "json"
+// @Router /pipelines/starrocks/pipeline-plan [post]
+func PostStarRocksPipeline(input *core.ApiResourceInput)
(*core.ApiResourceOutput, error) {
+ blueprint := &StarRocksPipelinePlan{}
+ return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK},
nil
+}
+
+type StarRocksPipelinePlan [][]struct {
+ Plugin string `json:"plugin"`
+ Options struct {
+ Host string `json:"host"`
+ Port int `json:"port"`
+ User string `json:"user"`
+ Password string `json:"password"`
+ Database string `json:"database"`
+ BePort int `json:"be_port"`
+ Tables []string `json:"tables"`
+ BatchSize int `json:"batch_size"`
+ Extra string `json:"extra"`
+ DomainLayer string `json:"domain_layer"`
+ } `json:"options"`
+}