hooks

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package hooks manages webhooks on VCS repos.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(logger logr.Logger, events chan<- cloud.VCSEvent, app otf.Application) *handler

Types

type NewServiceOptions

type NewServiceOptions struct {
	CloudService cloud.Service

	otf.Database
	otf.HostnameService
}

type Service

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

func NewService

func NewService(opts NewServiceOptions) *Service

func (*Service) Hook

func (s *Service) Hook(ctx context.Context, opts otf.HookOptions) error

Hook hooks up a resource to a VCS repository, so that it may subscribe to its VCS events. A webhook is configured on the repo if one doesn't exist already. The caller provides a callback with which to establish a relationship in the DB between a resource and the hook.

func (*Service) Unhook

func (s *Service) Unhook(ctx context.Context, opts otf.UnhookOptions) error

Unhook unhooks a resource from a VCS repository. If no other resources are hooked up then the webhook is deleted from the repo. The caller provides a callback with which to remove the relationship between the hook and the resource in the DB.

NOTE: if the webhook cannot be deleted from the repo then this is not deemed fatal and the hook is still deleted from the database.

Jump to

Keyboard shortcuts

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