Skip to content
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
219 changes: 219 additions & 0 deletions api/blueprints/blueprint_plugin_setting.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
package blueprints

import (
"github.com/apache/incubator-devlake/plugins/core"
"net/http"
)

type CodeTransformationRules struct {
PrType string `mapstructure:"prType" json:"prType"`
PrComponent string `mapstructure:"prComponent" json:"prComponent"`
PrBodyClosePattern string `mapstructure:"prBodyClosePattern" json:"prBodyClosePattern"`
IssueSeverity string `mapstructure:"issueSeverity" json:"issueSeverity"`
IssuePriority string `mapstructure:"issuePriority" json:"issuePriority"`
IssueComponent string `mapstructure:"issueComponent" json:"issueComponent"`
IssueTypeBug string `mapstructure:"issueTypeBug" json:"issueTypeBug"`
IssueTypeIncident string `mapstructure:"issueTypeIncident" json:"issueTypeIncident"`
IssueTypeRequirement string `mapstructure:"issueTypeRequirement" json:"issueTypeRequirement"`
}

type TicketTransformationRules struct {
EpicKeyField string `json:"epicKeyField"`
StoryPointField string `json:"storyPointField"`
RemotelinkCommitShaPattern string `json:"remotelinkCommitShaPattern"`
TypeMappings map[string]struct {
StandardType string `json:"standardType"`
} `json:"typeMappings"`
}

// @Summary blueprints setting for tapd
// @Description blueprint setting for tapd
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint body TapdBlueprintSetting true "json"
// @Router /blueprints/tapd/blueprint-setting [post]
func PostTapdBlueprintSetting(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &TapdBlueprintSetting{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type TapdBlueprintSetting []struct {
Version string `json:"version"`
Connections []struct {
Plugin string `json:"plugin"`
ConnectionID int `json:"connectionId"`
Scope []struct {
Options struct {
WorkspaceId uint64 `mapstruct:"workspaceId"`
CompanyId uint64 `mapstruct:"companyId"`
Tasks []string `mapstruct:"tasks,omitempty"`
Since string
} `json:"options"`
Entities []string `json:"entities"`
} `json:"scope"`
} `json:"connections"`
}

// @Summary blueprints plan for refdiff
// @Description blueprints plan for refdiff
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint body RefdiffBlueprintPlan true "json"
// @Router /blueprints/refdiff/blueprint-plan [post]
func PostRefdiffBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &RefdiffBlueprintPlan{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type RefdiffBlueprintPlan [][]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"`
}

// @Summary blueprints setting for jira
// @Description blueprint setting for jira
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint-setting body JiraBlueprintSetting true "json"
// @Router /blueprints/jira/blueprint-setting [post]
func PostJiraBlueprintSetting(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &JiraBlueprintSetting{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type JiraBlueprintSetting []struct {
Version string `json:"version"`
Connections []struct {
Plugin string `json:"plugin"`
ConnectionID int `json:"connectionId"`
Scope []struct {
Transformation TicketTransformationRules `json:"transformation"`
Options struct {
BoardId uint64 `json:"boardId"`
Since string `json:"since"`
} `json:"options"`
Entities []string `json:"entities"`
} `json:"scope"`
} `json:"connections"`
}

// @Summary blueprints setting for gitlab
// @Description blueprint setting for gitlab
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint body GitlabBlueprintSetting true "json"
// @Router /blueprints/gitlab/blueprint-setting [post]
func PostGitlabBluePrint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &GitlabBlueprintSetting{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type GitlabBlueprintSetting []struct {
Version string `json:"version"`
Connections []struct {
Plugin string `json:"plugin"`
ConnectionID int `json:"connectionId"`
Scope []struct {
Transformation CodeTransformationRules `json:"transformation"`
Options struct {
ProjectId int `json:"projectId"`
Since string
} `json:"options"`
Entities []string `json:"entities"`
} `json:"scope"`
} `json:"connections"`
}

// @Summary blueprints plan for gitextractor
// @Description blueprints plan for gitextractor
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint body GitextractorBlueprintPlan true "json"
// @Router /blueprints/gitextractor/blueprint-plan [post]
func PostGitextractorBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &GitextractorBlueprintPlan{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type GitextractorBlueprintPlan [][]struct {
Plugin string `json:"plugin"`
Options struct {
URL string `json:"url"`
RepoID string `json:"repoId"`
} `json:"options"`
}

// @Summary blueprints plan for feishu
// @Description blueprints plan for feishu
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint body FeishuBlueprintPlan true "json"
// @Router /blueprints/feishu/blueprint-plan [post]
func PostFeishuBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &FeishuBlueprintPlan{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type FeishuBlueprintPlan [][]struct {
Plugin string `json:"plugin"`
Options struct{} `json:"options"`
}

// @Summary blueprints plan for dbt
// @Description blueprints plan for dbt
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint body DbtBlueprintPlan true "json"
// @Router /blueprints/dbt/blueprint-plan [post]
func PostDbtBlueprint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &DbtBlueprintPlan{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type DbtBlueprintPlan [][]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"`
}

// @Summary blueprints setting for github
// @Description blueprint setting for github
// @Tags framework/blueprints
// @Accept application/json
// @Param blueprint body GithubBlueprintSetting true "json"
// @Router /blueprints/github/blueprint-setting [post]
func PostGithubBluePrint(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
blueprint := &GithubBlueprintSetting{}
return &core.ApiResourceOutput{Body: blueprint, Status: http.StatusOK}, nil
}

type GithubBlueprintSetting []struct {
Version string `json:"version"`
Connections []struct {
Plugin string `json:"plugin"`
ConnectionID int `json:"connectionId"`
Scope []struct {
Transformation CodeTransformationRules `json:"transformation"`
Options struct {
Owner string `json:"owner"`
Repo string `json:"repo"`
Since string
} `json:"options"`
Entities []string `json:"entities"`
} `json:"scope"`
} `json:"connections"`
}
176 changes: 176 additions & 0 deletions api/pipelines/pipeline_plugin_plan.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
package pipelines

import (
"github.com/apache/incubator-devlake/plugins/core"
"net/http"
)

type CodeTransformationRules struct {
PrType string `mapstructure:"prType" json:"prType"`
PrComponent string `mapstructure:"prComponent" json:"prComponent"`
PrBodyClosePattern string `mapstructure:"prBodyClosePattern" json:"prBodyClosePattern"`
IssueSeverity string `mapstructure:"issueSeverity" json:"issueSeverity"`
IssuePriority string `mapstructure:"issuePriority" json:"issuePriority"`
IssueComponent string `mapstructure:"issueComponent" json:"issueComponent"`
IssueTypeBug string `mapstructure:"issueTypeBug" json:"issueTypeBug"`
IssueTypeIncident string `mapstructure:"issueTypeIncident" json:"issueTypeIncident"`
IssueTypeRequirement string `mapstructure:"issueTypeRequirement" json:"issueTypeRequirement"`
}

type TicketTransformationRules struct {
EpicKeyField string `json:"epicKeyField"`
StoryPointField string `json:"storyPointField"`
RemotelinkCommitShaPattern string `json:"remotelinkCommitShaPattern"`
TypeMappings map[string]struct {
StandardType string `json:"standardType"`
} `json:"typeMappings"`
}

// @Summary pipelines plan for jira
// @Description pipelines plan for jira
// @Tags framework/pipelines
// @Accept application/json
// @Param pipeline-plan body JiraPipelinePlan true "json"
// @Router /pipelines/jira/pipeline-plan [post]
func PostJiraPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
pipeline := &JiraPipelinePlan{}
return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil
}

type JiraPipelinePlan [][]struct {
Plugin string `json:"plugin"`
Subtasks []string `json:"subtasks"`
Options struct {
BoardID int `json:"boardId"`
ConnectionID int `json:"connectionId"`
TransformationRules TicketTransformationRules `json:"transformationRules"`
} `json:"options"`
}

// @Summary pipelines plan for gitextractor
// @Description pipelines plan for gitextractor
// @Tags framework/pipelines
// @Accept application/json
// @Param pipeline body GitextractorPipelinePlan true "json"
// @Router /pipelines/gitextractor/pipeline-plan [post]
func PostGitextractorPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
pipeline := &GitextractorPipelinePlan{}
return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil
}

type GitextractorPipelinePlan [][]struct {
Plugin string `json:"plugin"`
Options struct {
URL string `json:"url"`
RepoID string `json:"repoId"`
} `json:"options"`
}

// @Summary pipelines plan for gitee
// @Description pipelines plan for gitee
// @Tags framework/pipelines
// @Accept application/json
// @Param pipeline body GiteePipelinePlan true "json"
// @Router /pipelines/gitee/pipeline-plan [post]
func PostGiteePipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
pipeline := &GiteePipelinePlan{}
return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil
}

type GiteePipelinePlan [][]struct {
Plugin string `json:"plugin"`
Subtasks []string `json:"subtasks"`
Options struct {
ConnectionID int `json:"connectionId"`
Owner string `json:"owner"`
Repo string `json:"repo"`
Since string
Transformation CodeTransformationRules `json:"transformation"`
} `json:"options"`
}

// @Summary pipelines plan for feishu
// @Description pipelines plan for feishu
// @Tags framework/pipelines
// @Accept application/json
// @Param pipeline body FeishuPipelinePlan true "json"
// @Router /pipelines/feishu/pipeline-plan [post]
func PostFeishuPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
pipeline := &FeishuPipelinePlan{}
return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil
}

type FeishuPipelinePlan [][]struct {
Plugin string `json:"plugin"`
Options struct{} `json:"options"`
}

// @Summary pipelines plan for dbt
// @Description pipelines plan for dbt
// @Tags framework/pipelines
// @Accept application/json
// @Param pipeline body DbtPipelinePlan true "json"
// @Router /pipelines/dbt/pipeline-plan [post]
func PostDbtPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
pipeline := &DbtPipelinePlan{}
return &core.ApiResourceOutput{Body: pipeline, 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"`
}

// @Summary pipelines plan for github
// @Description pipelines plan for github
// @Tags framework/pipelines
// @Accept application/json
// @Param pipeline body GithubPipelinePlan true "json"
// @Router /pipelines/github/pipeline-plan [post]
func PostGithubPipeline(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
pipeline := &GithubPipelinePlan{}
return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil
}

type GithubPipelinePlan [][]struct {
Plugin string `json:"plugin"`
Subtasks []string `json:"subtasks"`
Options struct {
ConnectionID int `json:"connectionId"`
Owner string `json:"owner"`
Repo string `json:"repo"`
Since string
Transformation CodeTransformationRules `json:"transformation"`
} `json:"options"`
}

// @Summary pipelines plan for tapd
// @Description pipelines plan for tapd
// @Tags framework/pipelines
// @Accept application/json
// @Param pipeline body TapdPipelinePlan true "json"
// @Router /pipelines/tapd/pipeline-plan [post]
func PostTapdPipelinePlan(input *core.ApiResourceInput) (*core.ApiResourceOutput, error) {
pipeline := &TapdPipelinePlan{}
return &core.ApiResourceOutput{Body: pipeline, Status: http.StatusOK}, nil
}

type TapdPipelinePlan [][]struct {
Plugin string `json:"plugin"`
Subtasks []string `json:"subtasks"`
Options struct {
WorkspaceId uint64 `mapstruct:"workspaceId"`
CompanyId uint64 `mapstruct:"companyId"`
Tasks []string `mapstruct:"tasks,omitempty"`
Since string
} `json:"options"`
}
Loading