types

package
v0.1.0-debug.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToYAML

func ToYAML(ctx context.Context, workflow *Workflow) ([]byte, error)

Types

type Action

type Action struct {
	// Required. The service that this belongs to
	Service string

	// Required. The verb to perform.
	Verb string

	// Optional. A way to unique identify the step.
	Subresource string
}

func ParseActionID

func ParseActionID(actionID string) (Action, error)

ParseActionID parses an action ID into its constituent parts.

func (Action) IntegrationVerbString

func (o Action) IntegrationVerbString() string

func (Action) String

func (o Action) String() string

type DesiredWorkerLabel

type DesiredWorkerLabel struct {
	Value      any                    `yaml:"value,omitempty"`
	Required   bool                   `yaml:"required,omitempty"`
	Weight     int32                  `yaml:"weight,omitempty"`
	Comparator *WorkerLabelComparator `yaml:"comparator,omitempty"`
}

type RandomScheduleOpt

type RandomScheduleOpt string
const (
	Random15Min  RandomScheduleOpt = "random_15_min"
	RandomHourly RandomScheduleOpt = "random_hourly"
	RandomDaily  RandomScheduleOpt = "random_daily"
)

type RateLimit

type RateLimit struct {
	Key            string  `yaml:"key,omitempty"`
	KeyExpr        *string `yaml:"keyExpr,omitempty"`
	Units          *int    `yaml:"units,omitempty"`
	UnitsExpr      *string `yaml:"unitsExpr,omitempty"`
	LimitValueExpr *string `yaml:"limitValueExpr,omitempty"`
}

type RateLimitDuration

type RateLimitDuration string
const (
	Second RateLimitDuration = "second"
	Minute RateLimitDuration = "minute"
	Hour   RateLimitDuration = "hour"
	Day    RateLimitDuration = "day"
	Week   RateLimitDuration = "week"
	Month  RateLimitDuration = "month"
	Year   RateLimitDuration = "year"
)

type RateLimitOpts

type RateLimitOpts struct {
	Max      int
	Duration RateLimitDuration
}

type StickyStrategy

type StickyStrategy int32
const (
	StickyStrategy_SOFT StickyStrategy = 0
	StickyStrategy_HARD StickyStrategy = 1
)

func StickyStrategyPtr

func StickyStrategyPtr(v StickyStrategy) *StickyStrategy

type WorkerLabelComparator

type WorkerLabelComparator int32
const (
	WorkerLabelComparator_EQUAL                 WorkerLabelComparator = 0
	WorkerLabelComparator_NOT_EQUAL             WorkerLabelComparator = 1
	WorkerLabelComparator_GREATER_THAN          WorkerLabelComparator = 2
	WorkerLabelComparator_GREATER_THAN_OR_EQUAL WorkerLabelComparator = 3
	WorkerLabelComparator_LESS_THAN             WorkerLabelComparator = 4
	WorkerLabelComparator_LESS_THAN_OR_EQUAL    WorkerLabelComparator = 5
)

type Workflow

type Workflow struct {
	Name string `yaml:"name,omitempty"`

	ScheduleTimeout string `yaml:"scheduleTimeout,omitempty"`

	Concurrency *WorkflowConcurrency `yaml:"concurrency,omitempty"`

	Version string `yaml:"version,omitempty"`

	Description string `yaml:"description,omitempty"`

	Triggers WorkflowTriggers `yaml:"triggers"`

	Jobs map[string]WorkflowJob `yaml:"jobs"`

	OnFailureJob *WorkflowJob `yaml:"onFailureJob,omitempty"`

	StickyStrategy *StickyStrategy `yaml:"sticky,omitempty"`
}

func DefaultLoader

func DefaultLoader() []*Workflow

func ParseYAML

func ParseYAML(ctx context.Context, yamlBytes []byte) (Workflow, error)

func ReadAllValidFilesInDir

func ReadAllValidFilesInDir(filedir string) ([]*Workflow, error)

func ReadHatchetYAMLFileBytes

func ReadHatchetYAMLFileBytes(filepath string) (*Workflow, error)

ReadHatchetYAMLFileBytes reads a given YAML file from a filepath and return the parsed workflow file

type WorkflowConcurrency

type WorkflowConcurrency struct {
	ActionID *string `yaml:"action,omitempty"`

	Expression *string `yaml:"expression,omitempty"`

	MaxRuns int32 `yaml:"maxRuns,omitempty"`

	LimitStrategy WorkflowConcurrencyLimitStrategy `yaml:"limitStrategy,omitempty"`
}

type WorkflowConcurrencyLimitStrategy

type WorkflowConcurrencyLimitStrategy string
const (
	CancelInProgress WorkflowConcurrencyLimitStrategy = "CANCEL_IN_PROGRESS"
	CancelNewest     WorkflowConcurrencyLimitStrategy = "CANCEL_NEWEST"
	GroupRoundRobin  WorkflowConcurrencyLimitStrategy = "GROUP_ROUND_ROBIN"
)

type WorkflowEvent

type WorkflowEvent struct {
	Name string `yaml:"name,omitempty"`
}

type WorkflowJob

type WorkflowJob struct {
	Description string `yaml:"description,omitempty"`

	Steps []WorkflowStep `yaml:"steps"`
}

type WorkflowOnCron

type WorkflowOnCron struct {
	Schedule string `yaml:"schedule,omitempty"`
}

type WorkflowStep

type WorkflowStep struct {
	Name     string `yaml:"name,omitempty"`
	ID       string `yaml:"id,omitempty"`
	ActionID string `yaml:"action"`
	Timeout  string `yaml:"timeout,omitempty"`

	// Deprecated: this field has no effect and will be removed in a future release.
	With map[string]interface{} `yaml:"with,omitempty"`

	UserData               map[string]interface{}         `yaml:"userData,omitempty"`
	Parents                []string                       `yaml:"parents,omitempty"`
	Retries                int                            `yaml:"retries"`
	RateLimits             []RateLimit                    `yaml:"rateLimits,omitempty"`
	DesiredLabels          map[string]*DesiredWorkerLabel `yaml:"desiredLabels,omitempty"`
	RetryBackoffFactor     *float32                       `yaml:"retryBackoffFactor,omitempty"`
	RetryMaxBackoffSeconds *int32                         `yaml:"retryMaxBackoffSeconds,omitempty"`
}

type WorkflowTriggers

type WorkflowTriggers struct {
	Events    []string    `yaml:"events,omitempty"`
	Cron      []string    `yaml:"crons,omitempty"`
	Schedules []time.Time `yaml:"schedules,omitempty"`
}

Jump to

Keyboard shortcuts

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