Help us shape the future of Go! Take the 2026 Go Developer Survey

gitlab

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(secret, headerToken string) error

Types

type Client

type Client struct {
}

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(integrationConfig *cicdv1.IntegrationConfig, id int, client client.Client) error

func (*Client) ListWebhook

func (c *Client) ListWebhook(integrationConfig *cicdv1.IntegrationConfig, client client.Client) ([]git.WebhookEntry, error)

func (*Client) ParseWebhook

func (c *Client) ParseWebhook(integrationConfig *cicdv1.IntegrationConfig, header http.Header, jsonString []byte) (git.Webhook, error)

func (*Client) RegisterWebhook

func (c *Client) RegisterWebhook(integrationConfig *cicdv1.IntegrationConfig, Url string, client client.Client) error

func (*Client) SetCommitStatus

func (c *Client) SetCommitStatus(integrationJob *cicdv1.IntegrationJob, integrationConfig *cicdv1.IntegrationConfig, context string, state git.CommitStatusState, description, targetUrl string, client client.Client) error

type CommitStatusBody

type CommitStatusBody struct {
	State       string `json:"state"`
	TargetURL   string `json:"target_url"`
	Description string `json:"description"`
	Context     string `json:"context"`
}

type LastCommit

type LastCommit struct {
	Sha string `json:"id"`
}

type MergeRequestWebhook

type MergeRequestWebhook struct {
	Kind            string          `json:"kind"`
	Sender          Sender          `json:"user"`
	ObjectAttribute ObjectAttribute `json:"object_attributes"`
	Project         Project         `json:"project"`
}

Webhook is a gitlab-specific webhook body Should contain json tag for each field, to be unmarshalled properly

type ObjectAttribute

type ObjectAttribute struct {
	Title      string     `json:"title"`
	ID         int        `json:"id"`
	BaseRef    string     `json:"target_branch"`
	HeadRef    string     `json:"source_branch"`
	LastCommit LastCommit `json:"last_commit"`
	State      string     `json:"state"`
	Action     string     `json:"action"`
}

type Project

type Project struct {
	Name   string `json:"path_with_namespace"`
	WebUrl string `json:"web_url"`
}

type PushWebhook

type PushWebhook struct {
	Kind    string  `json:"object_kind"`
	Ref     string  `json:"ref"`
	Project Project `json:"project"`
	User    string  `json:"user_name"`
	Sha     string  `json:"after"`
}

Structure for push webhook event

type RegistrationWebhookBody

type RegistrationWebhookBody struct {
	EnableSSLVerification   bool   `json:"enable_ssl_verification"`
	ConfidentialIssueEvents bool   `json:"confidential_issues_events"`
	ConfidentialNoteEvents  bool   `json:"confidential_note_events"`
	DeploymentEvents        bool   `json:"deployment_events"`
	ID                      string `json:"id"`
	IssueEvents             bool   `json:"issues_events"`
	JobEvents               bool   `json:"job_events"`
	MergeRequestEvents      bool   `json:"merge_requests_events"`
	NoteEvents              bool   `json:"note_events"`
	PipeLineEvents          bool   `json:"pipeline_events"`
	PushEvents              bool   `json:"push_events"`
	TagPushEvents           bool   `json:"tag_push_events"`
	WikiPageEvents          bool   `json:"wiki_page_events"`
	URL                     string `json:"url"`
	Token                   string `json:"token"`
}

type Sender

type Sender struct {
	ID string `json:"username"`
}

type WebhookEntry

type WebhookEntry struct {
	Id  int    `json:"id"`
	Url string `json:"url"`
}

Jump to

Keyboard shortcuts

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