webhook

package
v1.10.17 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJobNotExists = errors.New("job does not exist")
View Source
var ErrMissingJobID = errors.New("missing job ID")

Functions

func NewEIAuthorizer

func NewEIAuthorizer(db *sql.DB, ei bridges.ExternalInitiator) *eiAuthorizer

func NewExternalInitiatorManager

func NewExternalInitiatorManager(db *gorm.DB, httpclient HTTPClient) *externalInitiatorManager

NewExternalInitiatorManager returns the concrete externalInitiatorManager

func ValidatedWebhookSpec

func ValidatedWebhookSpec(tomlString string, externalInitiatorManager ExternalInitiatorManager) (jb job.Job, err error)

Types

type Authorizer

type Authorizer interface {
	CanRun(ctx context.Context, config AuthorizerConfig, jobUUID uuid.UUID) (bool, error)
}

func NewAuthorizer

func NewAuthorizer(db *sql.DB, user *sessions.User, ei *bridges.ExternalInitiator) Authorizer

type AuthorizerConfig

type AuthorizerConfig interface {
	FeatureExternalInitiators() bool
}

type Delegate

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

func NewDelegate

func NewDelegate(runner pipeline.Runner, externalInitiatorManager ExternalInitiatorManager, lggr logger.Logger) *Delegate

func (*Delegate) AfterJobCreated

func (d *Delegate) AfterJobCreated(jb job.Job)

func (*Delegate) BeforeJobDeleted

func (d *Delegate) BeforeJobDeleted(jb job.Job)

func (*Delegate) JobType

func (d *Delegate) JobType() job.Type

func (*Delegate) ServicesForSpec

func (d *Delegate) ServicesForSpec(spec job.Job) ([]job.Service, error)

func (*Delegate) WebhookJobRunner

func (d *Delegate) WebhookJobRunner() JobRunner

type ExternalInitiatorManager

type ExternalInitiatorManager interface {
	Notify(webhookSpecID int32) error
	DeleteJob(webhookSpecID int32) error
	FindExternalInitiatorByName(name string) (bridges.ExternalInitiator, error)
}

ExternalInitiatorManager manages HTTP requests to remote external initiators

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type JobRunner

type JobRunner interface {
	RunJob(ctx context.Context, jobUUID uuid.UUID, requestBody string, meta pipeline.JSONSerializable) (int64, error)
}

type JobSpecNotice

type JobSpecNotice struct {
	JobID  uuid.UUID   `json:"jobId"`
	Type   string      `json:"type"`
	Params models.JSON `json:"params,omitempty"`
}

JobSpecNotice is sent to the External Initiator when JobSpecs are created.

type NullExternalInitiatorManager

type NullExternalInitiatorManager struct{}

func (NullExternalInitiatorManager) DeleteJob

func (NullExternalInitiatorManager) FindExternalInitiatorByName

func (NullExternalInitiatorManager) FindExternalInitiatorByName(name string) (bridges.ExternalInitiator, error)

func (NullExternalInitiatorManager) Notify

type TOMLWebhookSpec

type TOMLWebhookSpec struct {
	ExternalInitiators []TOMLWebhookSpecExternalInitiator `toml:"externalInitiators"`
}

type TOMLWebhookSpecExternalInitiator

type TOMLWebhookSpecExternalInitiator struct {
	Name string      `toml:"name"`
	Spec models.JSON `toml:"spec"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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