events

package
v0.0.0-...-283e1aa Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidEventError = errors.New("invalid go-get-git event payload")
)

Functions

This section is empty.

Types

type BuildCompletedEvent

type BuildCompletedEvent struct {
	EntryId     uuid.UUID `json:"entry_id" validate:"required"`
	RepoUrl     string    `json:"repo_url" validate:"required"`
	ContainerId string    `json:"container_id" validate:"required"`
}

type BuildFailedEvent

type BuildFailedEvent struct {
	EntryId uuid.UUID `json:"entry_id" validate:"required"`
	RepoUrl string    `json:"repo_url" validate:"required"`
}

type BuildTriggeredEvent

type BuildTriggeredEvent struct {
	EntryId uuid.UUID `json:"entry_id" validate:"required"`
	RepoUrl string    `json:"repo_url" validate:"required"`
}

type ContainerCrashedEvent

type ContainerCrashedEvent struct {
	ContainerId string `json:"container_id" validate:"required"`
}

type ContainerRestartEvent

type ContainerRestartEvent struct {
	ContainerId string `json:"container_id" validate:"required"`
}

type DefaultParser

type DefaultParser struct{}

func (DefaultParser) ParseBuildCompletedEvent

func (parser DefaultParser) ParseBuildCompletedEvent(eventPayload []byte) (BuildCompletedEvent, error)

func (DefaultParser) ParseBuildFailedEvent

func (parser DefaultParser) ParseBuildFailedEvent(eventPayload []byte) (BuildFailedEvent, error)

func (DefaultParser) ParseBuildTriggeredEvent

func (parser DefaultParser) ParseBuildTriggeredEvent(eventPayload []byte) (BuildTriggeredEvent, error)

func (DefaultParser) ParseContainerCrashedEvent

func (parser DefaultParser) ParseContainerCrashedEvent(eventPayload []byte) (ContainerCrashedEvent, error)

func (DefaultParser) ParseContainerRestartEvent

func (parser DefaultParser) ParseContainerRestartEvent(eventPayload []byte) (ContainerRestartEvent, error)

func (DefaultParser) ParseEvent

func (parser DefaultParser) ParseEvent(payload []byte) (*Event, error)

basic function used to parse an event into Event structs. Note that Event objects contaim a specific EventPayload struct, which must first be parsed. All Event JSON messages must contain an event_type which is parsed and returned

func (DefaultParser) ParseGitPushEvent

func (parser DefaultParser) ParseGitPushEvent(eventPayload []byte) (GitPushEvent, error)

func (DefaultParser) ParseNewGitRepoEvent

func (parser DefaultParser) ParseNewGitRepoEvent(eventPayload []byte) (NewGitRepoEvent, error)

type Event

type Event struct {
	ApplicationId  string      `json:"application_id" validate:"required"`
	ParentId       uuid.UUID   `json:"parent_id" validate:"required"`
	EventId        uuid.UUID   `json:"event_id" validate:"required"`
	EventTimestamp time.Time   `json:"event_timestamp" validate:"required"`
	EventType      string      `json:"event_type" validate:"required"`
	EventPayload   interface{} `json:"event_payload" validate:"required"`
}

func New

func New(EventType, ApplicationId string, ParentId uuid.UUID, payload interface{}) Event

function used to generate new event with a given payload

func ParseEvent

func ParseEvent(payload []byte) (*Event, error)

type EventParser

type EventParser interface {
	ParseEvent(payload []byte) interface{}
}

type GitPushEvent

type GitPushEvent struct {
	RepoUrl              string `json:"repo_url" validate:"required"`
	ApplicationDirectory string `json:"application_directory" validate:"required"`
}

type NewGitRepoEvent

type NewGitRepoEvent struct {
	RepoUrl              string `json:"repo_url" validate:"required"`
	ApplicationDirectory string `json:"application_directory" validate:"required"`
}

Jump to

Keyboard shortcuts

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