webhook

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: MIT Imports: 16 Imported by: 0

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 NewExternalInitiatorManager

func NewExternalInitiatorManager(db *gorm.DB) *externalInitiatorManager

NewExternalInitiatorManager returns the concrete externalInitiatorManager

func ValidatedWebhookSpec

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

Types

type Delegate

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

func NewDelegate

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

func (*Delegate) JobType

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

func (*Delegate) OnJobCreated

func (d *Delegate) OnJobCreated(spec job.Job)

func (*Delegate) OnJobDeleted

func (d *Delegate) OnJobDeleted(spec job.Job)

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(models.JobSpec) error
	NotifyV2(jobID uuid.UUID, initrName string, initrSpec *models.JSON) error
	DeleteJob(jobID models.JobID) error
	DeleteJobV2(job job.Job) error
	FindExternalInitiatorByName(name string) (models.ExternalInitiator, error)
}

ExternalInitiatorManager manages HTTP requests to remote external initiators

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  models.JobID `json:"jobId"`
	Type   string       `json:"type"`
	Params models.JSON  `json:"params,omitempty"`
}

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

func NewJobSpecNotice

func NewJobSpecNotice(initiator models.Initiator, js models.JobSpec) (*JobSpecNotice, error)

NewJobSpecNotice returns a new JobSpec.

type JobSpecNoticeV2

type JobSpecNoticeV2 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) DeleteJobV2

func (NullExternalInitiatorManager) DeleteJobV2(jb job.Job) error

func (NullExternalInitiatorManager) FindExternalInitiatorByName

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

func (NullExternalInitiatorManager) Notify

func (NullExternalInitiatorManager) NotifyV2

func (NullExternalInitiatorManager) NotifyV2(jobUUID uuid.UUID, initrName string, initrSpec *models.JSON) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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