listener

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepoPushEvent          = "repo:push"
	PullRequestMergedEvent = "pullrequest:fulfilled" // BitBucket cloud merged event
	PrMergedEvent          = "pr:merged"             // BitBucket server merged event
)
View Source
const (
	GitLabPushEvents         = "Push Hook"
	GitLabMergeRequestEvents = "Merge Request Hook"
)
View Source
const (
	GithubEventHeader    = "X-Github-Event"
	BitbucketEventHeader = "X-Event-Key"
	GitlabEventHeader    = "X-Gitlab-Event"
)

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager, hubconfig *rest.Config, tlsKeyFile, tlsCrtFile string, disableTLS bool, createService bool) error

Add does nothing for namespace subscriber, it generates cache for each of the item

Types

type BitBucketPayload

type BitBucketPayload struct {
	Repository BitBucketRepository `json:"repository"`
}

type BitBucketRepository

type BitBucketRepository struct {
	Type  string `json:"type"`
	Links struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Avatar struct {
			Href string `json:"href"`
		} `json:"avatar"`
	} `json:"links"`
	FullName string `json:"full_name"`
	Name     string `json:"name"`
	Website  string `json:"website"`
}

type GitLabPayload

type GitLabPayload struct {
	Repository GitLabRepository `json:"repository"`
}

type GitLabRepository

type GitLabRepository struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	Description string `json:"description"`
	Homepage    string `json:"homepage"`
}

type WebhookListener

type WebhookListener struct {
	LocalClient   client.Client
	RemoteClient  client.Client
	DynamicClient dynamic.Interface
	TLSKeyFile    string
	TLSCrtFile    string
	// contains filtered or unexported fields
}

WebhookListener is a generic webhook event listener

func CreateWebhookListener

func CreateWebhookListener(config,
	remoteConfig *rest.Config,
	scheme *runtime.Scheme,
	tlsKeyFile, tlsCrtFile string,
	createService bool) (*WebhookListener, error)

CreateWebhookListener creates a WebHook listener instance

func (*WebhookListener) HandleWebhook

func (listener *WebhookListener) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook handles incoming webhook events

func (*WebhookListener) ParseRequest

func (listener *WebhookListener) ParseRequest(r *http.Request) (body []byte, signature string, event interface{}, err error)

ParseRequest parses incoming WebHook event request

func (*WebhookListener) Start

func (listener *WebhookListener) Start(ctx context.Context) error

Start the GutHub WebHook event listener

Jump to

Keyboard shortcuts

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