models

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeliveryAttemptStatusOK     = "ok"
	DeliveryAttemptStatusFailed = "failed"
)
View Source
const (
	SinkTypeHttp = "http"
)
View Source
const (
	SourceTypeHttp = "http"
)

Variables

View Source
var HMACAlgorithms = []HMACAlgorithm{
	HMACAlgorithmSHA256,
}
View Source
var SinkTypes = []SinkType{
	SinkTypeHttp,
}
View Source
var SourceTypes = []SourceType{
	SourceTypeHttp,
}
View Source
var VerificationTypes = []VerificationType{
	VerificationTypeHMAC,
}

Functions

func ValidateInhooksConfig

func ValidateInhooksConfig(appConf *lib.AppConfig, c *InhooksConfig) error

ValidateInhooksConfig validates inhooks config and sets defaults

Types

type DeliveryAttempt

type DeliveryAttempt struct {
	At     time.Time             `json:"at"`
	Status DeliveryAttemptStatus `json:"status"`
	Error  string                `json:"error"`
}

type DeliveryAttemptStatus

type DeliveryAttemptStatus string

type Flow

type Flow struct {
	ID     string  `yaml:"id"`
	Source *Source `yaml:"source"`
	Sinks  []*Sink `yaml:"sinks"`
}

type HMACAlgorithm added in v0.1.6

type HMACAlgorithm string
const (
	HMACAlgorithmSHA256 HMACAlgorithm = "sha256"
)

type InhooksConfig

type InhooksConfig struct {
	Flows []*Flow `yaml:"flows"`
}

type Message

type Message struct {
	ID       string `json:"id"`
	FlowID   string `json:"flowID"`
	SourceID string `json:"sourceID"`
	// Ingested Request ID
	IngestedReqID string      `json:"ingestedReqID"`
	SinkID        string      `json:"sinkID"`
	HttpHeaders   http.Header `json:"httpHeaders"`
	RawQuery      string      `json:"rawQuery"`
	Payload       []byte      `json:"payload"`

	// Processing Info
	DeliveryAttempts []*DeliveryAttempt `json:"deliveryAttempts"`
	DeliverAfter     time.Time
}

type MessageStatus

type MessageStatus string

type QueueStatus

type QueueStatus string
const (
	QueueStatusScheduled  QueueStatus = "scheduled"
	QueueStatusReady      QueueStatus = "ready"
	QueueStatusProcessing QueueStatus = "processing"
	QueueStatusDone       QueueStatus = "done"
	QueueStatusDead       QueueStatus = "dead"
)

type QueuedInfo added in v0.1.2

type QueuedInfo struct {
	MessageID    string
	QueueStatus  QueueStatus
	DeliverAfter time.Time
}

type Sink

type Sink struct {
	// Sink ID
	ID string `yaml:"id"`
	// Sink Type
	Type SinkType `yaml:"type"`
	// Sink Url for HTTP sinks
	URL string `yaml:"url"`
	// Process after delay
	Delay *time.Duration `yaml:"delay"`
	// Retry every x time
	RetryInterval *time.Duration `yaml:"retryInterval"`
	// Retry exponential multiplier. 1 is constant backoff. Set to > 1 for exponential backoff.
	RetryExpMultiplier *float64 `yaml:"retryExpMultiplier"`
	// Max attempts
	MaxAttempts *int `yaml:"maxAttempts"`
}

type SinkType

type SinkType string

type Source

type Source struct {
	ID           string        `yaml:"id"`
	Slug         string        `yaml:"slug"`
	Type         SourceType    `yaml:"type"`
	Verification *Verification `yaml:"verification"`
}

type SourceType

type SourceType string

type Verification added in v0.1.6

type Verification struct {
	VerificationType     VerificationType `yaml:"verificationType"`
	HMACAlgorithm        *HMACAlgorithm   `yaml:"hmacAlgorithm"`
	SignatureHeader      string           `yaml:"signatureHeader"`
	SignaturePrefix      string           `yaml:"signaturePrefix"`
	CurrentSecretEnvVar  string           `yaml:"currentSecretEnvVar"`
	PreviousSecretEnvVar string           `yaml:"previousSecretEnvVar"`
}

type VerificationType added in v0.1.6

type VerificationType string
const (
	VerificationTypeHMAC VerificationType = "hmac"
)

Jump to

Keyboard shortcuts

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