events

package
v0.2.0-demo Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidator

func NewValidator() validator

NewValidator is a function that creates a validator struct with the passed in interface

Types

type EventRequestPayload

type EventRequestPayload struct {
	EventType        string          `json:"event-type"`
	EventTypeVersion string          `json:"event-type-version"`
	EventID          string          `json:"event-id,omitempty"` //uuid should be generated automatically if send empty
	EventTime        string          `json:"event-time"`
	SourceID         string          `json:"source-id"`      //put your application name here
	Data             json.RawMessage `json:"data,omitempty"` //github webhook json payload
}

EventRequestPayload represents a POST request's body which is sent to Event-Service

type HTTPClient

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

HTTPClient is an interface use to allow mocking the http.Client methods

type Sender

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

Sender is a struct used to allow mocking the SendToKyma function

func NewSender

func NewSender(c HTTPClient, v Validator, serviceURL string) Sender

NewSender is a function that creates new Sender with the passed in interfaces

func (Sender) SendToKyma

func (k Sender) SendToKyma(eventType, eventTypeVersion, eventID, sourceID string, data json.RawMessage) apperrors.AppError

SendToKyma is a function that sends the event given by the Github API to kyma's event bus

type Validator

type Validator interface {
	Validate(payload EventRequestPayload) apperrors.AppError
}

Validator is an interface used to allow mocking the validatePayload function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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