api

package
v0.0.0-...-1fa52ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: Apache-2.0, BSD-2-Clause, ISC, + 1 more Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseIssue

CloseIssue @Summary set issue's status to DONE @Description set issue's status to DONE @Tags plugins/webhook @Success 200 {string} noResponse "" @Failure 400 {string} errcode.Error "Bad Request" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/:connectionId/issue/:issueKey/close [POST]

func DeleteConnection

func DeleteConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error)

DeleteConnection @Summary delete a webhook connection @Description Delete a webhook connection @Tags plugins/webhook @Success 200 {object} models.WebhookConnection @Failure 400 {string} errcode.Error "Bad Request" @Failure 409 {object} services.BlueprintProjectPairs "References exist to this connection" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/connections/{connectionId} [DELETE]

func GetConnection

func GetConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error)

GetConnection @Summary get webhook connection detail @Description Get webhook connection detail @Tags plugins/webhook @Success 200 {object} WebhookConnectionResponse @Failure 400 {string} errcode.Error "Bad Request" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/connections/{connectionId} [GET]

func Init

func Init(br context.BasicRes, p plugin.PluginMeta)

func ListConnections

func ListConnections(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error)

ListConnections @Summary get all webhook connections @Description Get all webhook connections @Tags plugins/webhook @Success 200 {object} []WebhookConnectionResponse @Failure 400 {string} errcode.Error "Bad Request" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/connections [GET]

func MakeDataSourcePipelinePlanV200

func MakeDataSourcePipelinePlanV200(connectionId uint64) (coreModels.PipelinePlan, []plugin.Scope, errors.Error)

func PatchConnection

func PatchConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error)

PatchConnection @Summary patch webhook connection @Description Patch webhook connection @Tags plugins/webhook @Param body body models.WebhookConnection true "json body" @Success 200 {object} models.WebhookConnection @Failure 400 {string} errcode.Error "Bad Request" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/connections/{connectionId} [PATCH]

func PostConnections

func PostConnections(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error)

PostConnections @Summary create webhook connection @Description Create webhook connection, example: {"name":"Webhook data connection name"} @Tags plugins/webhook @Param body body WebhookConnectionResponse true "json body" @Success 200 {object} WebhookConnectionResponse @Failure 400 {string} errcode.Error "Bad Request" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/connections [POST]

func PostDeploymentCicdTask

func PostDeploymentCicdTask(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error)

PostDeploymentCicdTask @Summary create deployment by webhook @Description Create deployment pipeline by webhook.<br/> @Description example1: {"repo_url":"devlake","commit_sha":"015e3d3b480e417aede5a1293bd61de9b0fd051d","start_time":"2020-01-01T12:00:00+00:00","end_time":"2020-01-01T12:59:59+00:00","environment":"PRODUCTION"}<br/> @Description So we suggest request before task after deployment pipeline finish. @Description Both cicd_pipeline and cicd_task will be created @Tags plugins/webhook @Param body body WebhookDeployTaskRequest true "json body" @Success 200 @Failure 400 {string} errcode.Error "Bad Request" @Failure 403 {string} errcode.Error "Forbidden" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/connections/:connectionId/deployments [POST]

func PostIssue

PostIssue @Summary receive a record as defined and save it @Description receive a record as follow and save it, example: {"url":"","issue_key":"DLK-1234","title":"a feature from DLK","description":"","epic_key":"","type":"BUG","status":"TODO","original_status":"created","story_point":0,"resolution_date":null,"created_date":"2020-01-01T12:00:00+00:00","updated_date":null,"lead_time_minutes":0,"parent_issue_key":"DLK-1200","priority":"","original_estimate_minutes":0,"time_spent_minutes":0,"time_remaining_minutes":0,"creator_id":"user1131","creator_name":"Nick name 1","assignee_id":"user1132","assignee_name":"Nick name 2","severity":"","component":""} @Tags plugins/webhook @Param body body WebhookIssueRequest true "json body" @Success 200 {string} noResponse "" @Failure 400 {string} errcode.Error "Bad Request" @Failure 500 {string} errcode.Error "Internal Error" @Router /plugins/webhook/:connectionId/issues [POST]

Types

type DeploymentCommit

type DeploymentCommit struct {
	RepoUrl   string `mapstructure:"repo_url" validate:"required"`
	Name      string `mapstructure:"name"`
	RefName   string `mapstructure:"ref_name"`
	CommitSha string `mapstructure:"commit_sha" validate:"required"`
	CommitMsg string `mapstructure:"commit_msg"`
}

type WebhookConnectionResponse

type WebhookConnectionResponse struct {
	models.WebhookConnection
	PostIssuesEndpoint             string             `json:"postIssuesEndpoint"`
	CloseIssuesEndpoint            string             `json:"closeIssuesEndpoint"`
	PostPipelineTaskEndpoint       string             `json:"postPipelineTaskEndpoint"`
	PostPipelineDeployTaskEndpoint string             `json:"postPipelineDeployTaskEndpoint"`
	ClosePipelineEndpoint          string             `json:"closePipelineEndpoint"`
	ApiKey                         *coreModels.ApiKey `json:"apiKey,omitempty"`
}

type WebhookDeployTaskRequest

type WebhookDeployTaskRequest struct {
	PipelineId string `mapstructure:"pipeline_id"`
	// RepoUrl should be unique string, fill url or other unique data
	RepoId string `mapstructure:"repo_id"`
	Result string `mapstructure:"result"`
	// start_time and end_time is more readable for users,
	// StartedDate and FinishedDate is same as columns in db.
	// So they all keep.
	CreatedDate *time.Time `mapstructure:"create_time"`
	// QueuedDate   *time.Time `mapstructure:"queue_time"`
	StartedDate  *time.Time `mapstructure:"start_time" validate:"required"`
	FinishedDate *time.Time `mapstructure:"end_time"`
	RepoUrl      string     `mapstructure:"repo_url"`
	Environment  string     `validate:"omitempty,oneof=PRODUCTION STAGING TESTING DEVELOPMENT"`
	Name         string     `mapstructure:"name"`
	RefName      string     `mapstructure:"ref_name"`
	CommitSha    string     `mapstructure:"commit_sha"`
	CommitMsg    string     `mapstructure:"commit_msg"`
	// DeploymentCommits is used for multiple commits in one deployment
	DeploymentCommits []DeploymentCommit `mapstructure:"deploymentCommits" validate:"omitempty,dive"`
}

type WebhookIssueRequest

type WebhookIssueRequest struct {
	Url                     string     `mapstructure:"url"`
	IssueKey                string     `mapstructure:"issue_key" validate:"required"`
	Title                   string     `mapstructure:"title" validate:"required"`
	Description             string     `mapstructure:"description"`
	EpicKey                 string     `mapstructure:"epic_key"`
	Type                    string     `mapstructure:"type"`
	Status                  string     `mapstructure:"status" validate:"oneof=TODO DONE IN_PROGRESS"`
	OriginalStatus          string     `mapstructure:"original_status" validate:"required"`
	StoryPoint              float64    `mapstructure:"story_point"`
	ResolutionDate          *time.Time `mapstructure:"resolution_date"`
	CreatedDate             *time.Time `mapstructure:"created_date" validate:"required"`
	UpdatedDate             *time.Time `mapstructure:"updated_date"`
	LeadTimeMinutes         uint       `mapstructure:"lead_time_minutes"`
	ParentIssueKey          string     `mapstructure:"parent_issue_key"`
	Priority                string     `mapstructure:"priority"`
	OriginalEstimateMinutes int64      `mapstructure:"original_estimate_minutes"`
	TimeSpentMinutes        int64      `mapstructure:"time_spent_minutes"`
	TimeRemainingMinutes    int64      `mapstructure:"time_remaining_minutes"`
	CreatorId               string     `mapstructure:"creator_id"`
	CreatorName             string     `mapstructure:"creator_name"`
	AssigneeId              string     `mapstructure:"assignee_id"`
	AssigneeName            string     `mapstructure:"assignee_name"`
	Severity                string     `mapstructure:"severity"`
	Component               string     `mapstructure:"component"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL