webhookparser

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const BitbucketServerEventHeader = "X-Event-Key"
View Source
const EventHeaderKey = "X-Event-Key"
View Source
const Sha256Signature = "X-Hub-Signature"

Variables

This section is empty.

Functions

This section is empty.

Types

type BitbucketCloudWebhook

type BitbucketCloudWebhook struct {
	// contains filtered or unexported fields
}

func NewBitbucketCloudWebhookWebhook

func NewBitbucketCloudWebhookWebhook(request *http.Request) *BitbucketCloudWebhook

type BitbucketServerWebhook

type BitbucketServerWebhook struct {
	// contains filtered or unexported fields
}

func NewBitbucketServerWebhookWebhook

func NewBitbucketServerWebhookWebhook(request *http.Request) *BitbucketServerWebhook

type GitHubWebhook

type GitHubWebhook struct {
	// contains filtered or unexported fields
}

func NewGitHubWebhook

func NewGitHubWebhook(request *http.Request) *GitHubWebhook

type GitLabWebhook

type GitLabWebhook struct {
	// contains filtered or unexported fields
}

func NewGitLabWebhook

func NewGitLabWebhook(request *http.Request) *GitLabWebhook

type WebhookInfo

type WebhookInfo struct {
	// The target repository for pull requests and push
	Repository string `json:"repository,omitempty"`
	// The target branch for pull requests and push
	Branch string `json:"branch,omitempty"`
	// The source repository for pull requests
	SourceRepository string `json:"source_repository,omitempty"`
	// The source branch for pull requests
	SourceBranch string `json:"source_branch,omitempty"`
	// Seconds from epoch
	Timestamp int64 `json:"timestamp,omitempty"`
	// The event type
	Event vcsutils.WebhookEvent `json:"event,omitempty"`
}

This struct is used for parsing an incoming webhook request from the VCS provider.

func ParseIncomingWebhook

func ParseIncomingWebhook(provider vcsutils.VcsProvider, token []byte, request *http.Request) (*WebhookInfo, error)

Parse incoming webhook payload request into a structurized WebhookInfo object. provider - The VCS provider token - Token to authenticate incoming webhooks. If empty, signature will not be verified. request - The HTTP request of the incoming webhook

type WebhookParser

type WebhookParser interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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