model

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

View Source
const (
	OAuth2DefaultTokenURI         = "/oauth2/token" // #nosec G101
	OAuth2DefaultRevokeURI        = "/oauth2/revoke"
	OAuth2DefaultIntrospectionURI = "/oauth2/introspect"
)
View Source
const (
	ErrorTypeConfiguration  = "https://serverlessworkflow.io/spec/1.0.0/errors/configuration"
	ErrorTypeValidation     = "https://serverlessworkflow.io/spec/1.0.0/errors/validation"
	ErrorTypeExpression     = "https://serverlessworkflow.io/spec/1.0.0/errors/expression"
	ErrorTypeAuthentication = "https://serverlessworkflow.io/spec/1.0.0/errors/authentication"
	ErrorTypeAuthorization  = "https://serverlessworkflow.io/spec/1.0.0/errors/authorization"
	ErrorTypeTimeout        = "https://serverlessworkflow.io/spec/1.0.0/errors/timeout"
	ErrorTypeCommunication  = "https://serverlessworkflow.io/spec/1.0.0/errors/communication"
	ErrorTypeRuntime        = "https://serverlessworkflow.io/spec/1.0.0/errors/runtime"
)

List of Standard Errors based on the Serverless Workflow specification. See: https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#standard-error-types

View Source
const DefaultSchema = "json"

Variables

View Source
var JSONPointerPattern = regexp.MustCompile(`^(/([^/~]|~[01])*)*$`)

JSONPointerPattern validates JSON Pointers as per RFC 6901.

View Source
var LiteralUriPattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9+\-.]*://[^{}\s]+$`)

LiteralUriPattern matches standard URIs without placeholders.

View Source
var LiteralUriTemplatePattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9+\-.]*://.*\{.*}.*$`)

LiteralUriTemplatePattern matches URIs with placeholders.

View Source
var NewRuntimeExpression = NewExpr

NewRuntimeExpression is an alias for NewExpr

Functions

func ErrorToJSON added in v3.1.0

func ErrorToJSON(err *Error) (string, error)

func GetValidator

func GetValidator() *validator.Validate

func IsErrAuthentication added in v3.1.0

func IsErrAuthentication(err error) bool

func IsErrAuthorization added in v3.1.0

func IsErrAuthorization(err error) bool

func IsErrCommunication added in v3.1.0

func IsErrCommunication(err error) bool

func IsErrConfiguration added in v3.1.0

func IsErrConfiguration(err error) bool

func IsErrExpression added in v3.1.0

func IsErrExpression(err error) bool

func IsErrRuntime added in v3.1.0

func IsErrRuntime(err error) bool

func IsErrTimeout added in v3.1.0

func IsErrTimeout(err error) bool

func IsErrValidation added in v3.1.0

func IsErrValidation(err error) bool

func IsStrictExpr added in v3.1.0

func IsStrictExpr(expression string) bool

IsStrictExpr returns true if the string is enclosed in `${ }`

func IsValidExpr added in v3.1.0

func IsValidExpr(expression string) bool

func NormalizeExpr added in v3.1.0

func NormalizeExpr(expr string) string

NormalizeExpr adds ${} to the given string

func ResolveRetryPolicies

func ResolveRetryPolicies(tasks []TryTaskCatch, retries map[string]*RetryPolicy) error

func SanitizeExpr added in v3.1.0

func SanitizeExpr(expression string) string

SanitizeExpr processes the expression to ensure it's ready for evaluation It removes `${}` if present and replaces single quotes with double quotes

Types

type AsyncAPIArguments

type AsyncAPIArguments struct {
	Document       *ExternalResource                  `json:"document" validate:"required"`
	Channel        string                             `json:"channel,omitempty"`
	Operation      string                             `json:"operation,omitempty"`
	Server         *AsyncAPIServer                    `json:"server,omitempty"`
	Protocol       string                             `` /* 169-byte string literal not displayed */
	Message        *AsyncAPIOutboundMessage           `json:"message,omitempty"`
	Subscription   *AsyncAPISubscription              `json:"subscription,omitempty"`
	Authentication *ReferenceableAuthenticationPolicy `json:"authentication,omitempty" validate:"omitempty"`
}

type AsyncAPIMessageConsumptionPolicy

type AsyncAPIMessageConsumptionPolicy struct {
	For    *Duration          `json:"for,omitempty"`
	Amount int                `json:"amount,omitempty" validate:"required_without_all=While Until"`
	While  *RuntimeExpression `json:"while,omitempty" validate:"required_without_all=Amount Until"`
	Until  *RuntimeExpression `json:"until,omitempty" validate:"required_without_all=Amount While"`
}

type AsyncAPIOutboundMessage

type AsyncAPIOutboundMessage struct {
	Payload map[string]interface{} `json:"payload,omitempty" validate:"omitempty"`
	Headers map[string]interface{} `json:"headers,omitempty" validate:"omitempty"`
}

type AsyncAPIServer

type AsyncAPIServer struct {
	Name      string                 `json:"name" validate:"required"`
	Variables map[string]interface{} `json:"variables,omitempty"`
}

type AsyncAPISubscription

type AsyncAPISubscription struct {
	Filter  *RuntimeExpression                `json:"filter,omitempty"`
	Consume *AsyncAPIMessageConsumptionPolicy `json:"consume" validate:"required"`
}

type AuthenticationPolicy

type AuthenticationPolicy struct {
	Basic  *BasicAuthenticationPolicy         `json:"basic,omitempty"`
	Bearer *BearerAuthenticationPolicy        `json:"bearer,omitempty"`
	Digest *DigestAuthenticationPolicy        `json:"digest,omitempty"`
	OAuth2 *OAuth2AuthenticationPolicy        `json:"oauth2,omitempty"`
	OIDC   *OpenIdConnectAuthenticationPolicy `json:"oidc,omitempty"`
}

AuthenticationPolicy Defines an authentication policy.

func NewBasicAuth

func NewBasicAuth(username, password string) *AuthenticationPolicy

func (*AuthenticationPolicy) MarshalJSON

func (ap *AuthenticationPolicy) MarshalJSON() ([]byte, error)

MarshalJSON for AuthenticationPolicy.

func (*AuthenticationPolicy) UnmarshalJSON

func (ap *AuthenticationPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON for AuthenticationPolicy to enforce "oneOf" behavior.

type BackoffDefinition

type BackoffDefinition struct {
	Definition map[string]interface{} `json:"definition,omitempty"`
}

type BasicAuthenticationPolicy

type BasicAuthenticationPolicy struct {
	Username string `json:"username,omitempty" validate:"required_without=Use"`
	Password string `json:"password,omitempty" validate:"required_without=Use"`
	Use      string `json:"use,omitempty" validate:"required_without_all=Username Password,basic_policy"`
}

BasicAuthenticationPolicy supports either inline properties (username/password) or a secret reference (use).

type BearerAuthenticationPolicy

type BearerAuthenticationPolicy struct {
	Token string `json:"token,omitempty" validate:"required_without=Use,bearer_policy"`
	Use   string `json:"use,omitempty" validate:"required_without=Token"`
}

BearerAuthenticationPolicy supports either an inline token or a secret reference (use).

type CallAsyncAPI

type CallAsyncAPI struct {
	TaskBase `json:",inline"`
	Call     string            `json:"call" validate:"required,eq=asyncapi"`
	With     AsyncAPIArguments `json:"with" validate:"required"`
}

func (*CallAsyncAPI) GetBase added in v3.1.0

func (c *CallAsyncAPI) GetBase() *TaskBase

type CallFunction

type CallFunction struct {
	TaskBase `json:",inline"`       // Inline TaskBase fields
	Call     string                 `json:"call" validate:"required"`
	With     map[string]interface{} `json:"with,omitempty"`
}

func (*CallFunction) GetBase added in v3.1.0

func (c *CallFunction) GetBase() *TaskBase

type CallGRPC

type CallGRPC struct {
	TaskBase `json:",inline"`
	Call     string        `json:"call" validate:"required,eq=grpc"`
	With     GRPCArguments `json:"with" validate:"required"`
}

func (*CallGRPC) GetBase added in v3.1.0

func (c *CallGRPC) GetBase() *TaskBase

type CallHTTP

type CallHTTP struct {
	TaskBase `json:",inline"` // Inline TaskBase fields
	Call     string           `json:"call" validate:"required,eq=http"`
	With     HTTPArguments    `json:"with" validate:"required"`
}

func (*CallHTTP) GetBase added in v3.1.0

func (c *CallHTTP) GetBase() *TaskBase

type CallOpenAPI

type CallOpenAPI struct {
	TaskBase `json:",inline"` // Inline TaskBase fields
	Call     string           `json:"call" validate:"required,eq=openapi"`
	With     OpenAPIArguments `json:"with" validate:"required"`
}

func (*CallOpenAPI) GetBase added in v3.1.0

func (c *CallOpenAPI) GetBase() *TaskBase

type Catalog

type Catalog struct {
	Endpoint *Endpoint `json:"endpoint" validate:"required"`
}

type Container

type Container struct {
	Image       string                 `json:"image" validate:"required"`
	Command     string                 `json:"command,omitempty"`
	Ports       map[string]interface{} `json:"ports,omitempty"`
	Volumes     map[string]interface{} `json:"volumes,omitempty"`
	Environment map[string]string      `json:"environment,omitempty"`
}

type Correlation

type Correlation struct {
	From   string `json:"from" validate:"required"` // Runtime expression to extract the correlation value
	Expect string `json:"expect,omitempty"`         // Expected value or runtime expression
}

Correlation defines the mapping of event attributes for correlation.

type DigestAuthenticationPolicy

type DigestAuthenticationPolicy struct {
	Username string `json:"username,omitempty" validate:"required_without=Use"`
	Password string `json:"password,omitempty" validate:"required_without=Use"`
	Use      string `json:"use,omitempty" validate:"required_without_all=Username Password,digest_policy"`
}

DigestAuthenticationPolicy supports either inline properties (username/password) or a secret reference (use).

type DoTask

type DoTask struct {
	TaskBase `json:",inline"` // Inline TaskBase fields
	Do       *TaskList        `json:"do" validate:"required,dive"`
}

DoTask represents a task configuration to execute tasks sequentially.

func (*DoTask) GetBase added in v3.1.0

func (d *DoTask) GetBase() *TaskBase

type Document

type Document struct {
	DSL       string                 `json:"dsl" yaml:"dsl" validate:"required,semver_pattern"`
	Namespace string                 `json:"namespace" yaml:"namespace" validate:"required,hostname_rfc1123"`
	Name      string                 `json:"name" yaml:"name" validate:"required,hostname_rfc1123"`
	Version   string                 `json:"version" yaml:"version" validate:"required,semver_pattern"`
	Title     string                 `json:"title,omitempty" yaml:"title,omitempty"`
	Summary   string                 `json:"summary,omitempty" yaml:"summary,omitempty"`
	Tags      map[string]string      `json:"tags,omitempty" yaml:"tags,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}

Document holds metadata for the workflow.

type Duration

type Duration struct {
	Value interface{} `json:"-"`
}

Duration represents a flexible duration that can be either inline or an ISO 8601 expression.

func NewDurationExpr

func NewDurationExpr(durationExpression string) *Duration

NewDurationExpr accessor to create a Duration object from a string

func (*Duration) AsExpression

func (d *Duration) AsExpression() string

func (*Duration) AsInline

func (d *Duration) AsInline() *DurationInline

func (*Duration) MarshalJSON

func (d *Duration) MarshalJSON() ([]byte, error)

MarshalJSON for Duration to handle both inline and expression durations.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON for Duration to handle both inline and expression durations.

type DurationExpression

type DurationExpression struct {
	Expression string `json:"-" validate:"required,iso8601_duration"`
}

DurationExpression represents the ISO 8601 expression of a duration.

func (*DurationExpression) MarshalJSON

func (d *DurationExpression) MarshalJSON() ([]byte, error)

MarshalJSON for DurationExpression.

func (*DurationExpression) String

func (d *DurationExpression) String() string

func (*DurationExpression) UnmarshalJSON

func (d *DurationExpression) UnmarshalJSON(data []byte) error

UnmarshalJSON for DurationExpression to handle ISO 8601 strings.

type DurationInline

type DurationInline struct {
	Days         int32 `json:"days,omitempty"`
	Hours        int32 `json:"hours,omitempty"`
	Minutes      int32 `json:"minutes,omitempty"`
	Seconds      int32 `json:"seconds,omitempty"`
	Milliseconds int32 `json:"milliseconds,omitempty"`
}

DurationInline represents the inline definition of a duration.

func (*DurationInline) MarshalJSON

func (d *DurationInline) MarshalJSON() ([]byte, error)

MarshalJSON for DurationInline.

type EmitEventDefinition

type EmitEventDefinition struct {
	With *EventProperties `json:"with" validate:"required"`
}

type EmitTask

type EmitTask struct {
	TaskBase `json:",inline"`      // Inline TaskBase fields
	Emit     EmitTaskConfiguration `json:"emit" validate:"required"`
}

EmitTask represents the configuration for emitting events.

func (*EmitTask) GetBase added in v3.1.0

func (e *EmitTask) GetBase() *TaskBase

func (*EmitTask) MarshalJSON

func (e *EmitTask) MarshalJSON() ([]byte, error)

type EmitTaskConfiguration

type EmitTaskConfiguration struct {
	Event EmitEventDefinition `json:"event" validate:"required"`
}

type Endpoint

type Endpoint struct {
	RuntimeExpression *RuntimeExpression     `json:"-"`
	URITemplate       URITemplate            `json:"-"`
	EndpointConfig    *EndpointConfiguration `json:"-"`
}

func NewEndpoint

func NewEndpoint(uri string) *Endpoint

func (*Endpoint) MarshalJSON

func (e *Endpoint) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshalling for Endpoint.

func (*Endpoint) String

func (e *Endpoint) String() string

func (*Endpoint) UnmarshalJSON

func (e *Endpoint) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for Endpoint.

type EndpointConfiguration

type EndpointConfiguration struct {
	RuntimeExpression *RuntimeExpression                 `json:"-"`
	URI               URITemplate                        `json:"uri" validate:"required"`
	Authentication    *ReferenceableAuthenticationPolicy `json:"authentication,omitempty"`
}

func (*EndpointConfiguration) MarshalJSON added in v3.1.0

func (e *EndpointConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshalling for Endpoint.

func (*EndpointConfiguration) UnmarshalJSON

func (e *EndpointConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for EndpointConfiguration.

type Error

type Error struct {
	// A URI reference that identifies the error type.
	// For cross-compatibility concerns, it is strongly recommended to use Standard Error Types whenever possible.
	// Runtimes MUST ensure that the property has been set when raising or escalating the error.
	Type *URITemplateOrRuntimeExpr `json:"type" validate:"required"`
	// The status code generated by the origin for this occurrence of the error.
	// For cross-compatibility concerns, it is strongly recommended to use HTTP Status Codes whenever possible.
	// Runtimes MUST ensure that the property has been set when raising or escalating the error.
	Status int `json:"status" validate:"required"`
	// A short, human-readable summary of the error.
	Title *StringOrRuntimeExpr `json:"title,omitempty"`
	// A human-readable explanation specific to this occurrence of the error.
	Detail *StringOrRuntimeExpr `json:"detail,omitempty"`
	// A JSON Pointer used to reference the component the error originates from.
	// Runtimes MUST set the property when raising or escalating the error. Otherwise ignore.
	Instance *JsonPointerOrRuntimeExpression `json:"instance,omitempty" validate:"omitempty"`
}

func AsError added in v3.1.0

func AsError(err error) *Error

AsError attempts to extract a known error type from the given error. If the error is one of the predefined structured errors, it returns the *Error. Otherwise, it returns nil.

func ErrorFromJSON added in v3.1.0

func ErrorFromJSON(jsonStr string) (*Error, error)

func NewErrAuthentication added in v3.1.0

func NewErrAuthentication(detail error, instance string) *Error

func NewErrAuthorization added in v3.1.0

func NewErrAuthorization(detail error, instance string) *Error

func NewErrCommunication added in v3.1.0

func NewErrCommunication(detail error, instance string) *Error

func NewErrConfiguration added in v3.1.0

func NewErrConfiguration(detail error, instance string) *Error

func NewErrExpression added in v3.1.0

func NewErrExpression(detail error, instance string) *Error

func NewErrRuntime added in v3.1.0

func NewErrRuntime(detail error, instance string) *Error

func NewErrTimeout added in v3.1.0

func NewErrTimeout(detail error, instance string) *Error

func NewErrValidation added in v3.1.0

func NewErrValidation(detail error, instance string) *Error

func (*Error) Error added in v3.1.0

func (e *Error) Error() string

func (*Error) WithInstanceRef added in v3.1.0

func (e *Error) WithInstanceRef(workflow *Workflow, taskName string) *Error

WithInstanceRef ensures the error has a valid JSON Pointer reference

type ErrorFilter

type ErrorFilter struct {
	Type     string `json:"type,omitempty"`
	Status   int    `json:"status,omitempty"`
	Instance string `json:"instance,omitempty"`
	Title    string `json:"title,omitempty"`
	Details  string `json:"details,omitempty"`
}

type EventConsumptionStrategy

type EventConsumptionStrategy struct {
	All   []*EventFilter         `json:"all,omitempty" validate:"omitempty,dive"`
	Any   []*EventFilter         `json:"any,omitempty" validate:"omitempty,dive"`
	One   *EventFilter           `json:"one,omitempty" validate:"omitempty"`
	Until *EventConsumptionUntil `json:"until,omitempty" validate:"omitempty"`
}

EventConsumptionStrategy defines the consumption strategy for events.

func (*EventConsumptionStrategy) MarshalJSON

func (ecs *EventConsumptionStrategy) MarshalJSON() ([]byte, error)

MarshalJSON for EventConsumptionStrategy to ensure proper serialization.

func (*EventConsumptionStrategy) UnmarshalJSON

func (ecs *EventConsumptionStrategy) UnmarshalJSON(data []byte) error

UnmarshalJSON for EventConsumptionStrategy to enforce "oneOf" behavior and handle edge cases.

type EventConsumptionUntil

type EventConsumptionUntil struct {
	Condition  *RuntimeExpression        `json:"-" validate:"omitempty"`
	Strategy   *EventConsumptionStrategy `json:"-" validate:"omitempty"`
	IsDisabled bool                      `json:"-"` // True when "until: false"
}

EventConsumptionUntil handles the complex conditions of the "until" field.

func (*EventConsumptionUntil) MarshalJSON

func (ecu *EventConsumptionUntil) MarshalJSON() ([]byte, error)

MarshalJSON for EventConsumptionUntil to handle proper serialization.

func (*EventConsumptionUntil) UnmarshalJSON

func (ecu *EventConsumptionUntil) UnmarshalJSON(data []byte) error

UnmarshalJSON for EventConsumptionUntil to handle the "oneOf" behavior.

type EventFilter

type EventFilter struct {
	With      *EventProperties       `json:"with" validate:"required"`
	Correlate map[string]Correlation `json:"correlate,omitempty" validate:"omitempty,dive"` // Keyed correlation filters
}

EventFilter defines a mechanism to filter events based on predefined criteria.

type EventProperties

type EventProperties struct {
	ID              string                    `json:"id,omitempty"`
	Source          *URITemplateOrRuntimeExpr `json:"source,omitempty" validate:"omitempty"` // URI template or runtime expression
	Type            string                    `json:"type,omitempty"`
	Time            *StringOrRuntimeExpr      `json:"time,omitempty" validate:"omitempty,string_or_runtime_expr"` // ISO 8601 date-time string or runtime expression
	Subject         string                    `json:"subject,omitempty"`
	DataContentType string                    `json:"datacontenttype,omitempty"`
	DataSchema      *URITemplateOrRuntimeExpr `json:"dataschema,omitempty" validate:"omitempty"` // URI template or runtime expression
	Additional      map[string]interface{}    `json:"-"`
}

func (*EventProperties) MarshalJSON

func (e *EventProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshaling for EventProperties.

func (*EventProperties) UnmarshalJSON

func (e *EventProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshaling for EventProperties.

type Export

type Export struct {
	Schema *Schema              `json:"schema,omitempty" validate:"omitempty"`
	As     *ObjectOrRuntimeExpr `json:"as,omitempty" validate:"omitempty"`
}

Export Set the content of the context.

type Extension

type Extension struct {
	Extend string             `json:"extend" validate:"required,oneof=call composite emit for listen raise run set switch try wait all"`
	When   *RuntimeExpression `json:"when,omitempty"`
	Before *TaskList          `json:"before,omitempty" validate:"omitempty,dive"`
	After  *TaskList          `json:"after,omitempty" validate:"omitempty,dive"`
}

Extension represents the definition of an extension.

type ExtensionItem

type ExtensionItem struct {
	Key       string     `json:"-" validate:"required"`
	Extension *Extension `json:"-" validate:"required"`
}

ExtensionItem represents a named extension and its associated definition.

func (*ExtensionItem) MarshalJSON

func (ei *ExtensionItem) MarshalJSON() ([]byte, error)

MarshalJSON for ExtensionItem to serialize as a single-key object.

func (*ExtensionItem) UnmarshalJSON

func (ei *ExtensionItem) UnmarshalJSON(data []byte) error

UnmarshalJSON for ExtensionItem to deserialize from a single-key object.

type ExtensionList

type ExtensionList []*ExtensionItem

ExtensionList represents a list of extensions.

func (*ExtensionList) Key

func (el *ExtensionList) Key(key string) *Extension

Key retrieves all extensions with the specified key.

func (*ExtensionList) MarshalJSON

func (el *ExtensionList) MarshalJSON() ([]byte, error)

MarshalJSON for ExtensionList to serialize as an array of ExtensionItem objects.

func (*ExtensionList) UnmarshalJSON

func (el *ExtensionList) UnmarshalJSON(data []byte) error

UnmarshalJSON for ExtensionList to deserialize an array of ExtensionItem objects.

type ExternalResource

type ExternalResource struct {
	Name     string    `json:"name,omitempty"`
	Endpoint *Endpoint `json:"endpoint" validate:"required"`
}

type FlowDirective

type FlowDirective struct {
	Value string `json:"-" validate:"required"` // Ensure the value is non-empty.
}

FlowDirective represents a directive that can be an enumerated or free-form string.

func (*FlowDirective) IsEnum

func (f *FlowDirective) IsEnum() bool

IsEnum checks if the FlowDirective matches one of the enumerated values.

func (*FlowDirective) IsTermination added in v3.1.0

func (f *FlowDirective) IsTermination() bool

IsTermination checks if the FlowDirective matches FlowDirectiveExit or FlowDirectiveEnd.

func (*FlowDirective) MarshalJSON

func (f *FlowDirective) MarshalJSON() ([]byte, error)

func (*FlowDirective) UnmarshalJSON

func (f *FlowDirective) UnmarshalJSON(data []byte) error

type FlowDirectiveType

type FlowDirectiveType string
const (
	FlowDirectiveContinue FlowDirectiveType = "continue"
	FlowDirectiveExit     FlowDirectiveType = "exit"
	FlowDirectiveEnd      FlowDirectiveType = "end"
)

type ForTask

type ForTask struct {
	TaskBase `json:",inline"`     // Inline TaskBase fields
	For      ForTaskConfiguration `json:"for" validate:"required"`
	While    string               `json:"while,omitempty"`
	Do       *TaskList            `json:"do" validate:"required,dive"`
}

ForTask represents a task configuration to iterate over a collection.

func (*ForTask) GetBase added in v3.1.0

func (f *ForTask) GetBase() *TaskBase

type ForTaskConfiguration

type ForTaskConfiguration struct {
	Each string `json:"each,omitempty"`         // Variable name for the current item
	In   string `json:"in" validate:"required"` // Runtime expression for the collection
	At   string `json:"at,omitempty"`           // Variable name for the current index
}

ForTaskConfiguration defines the loop configuration for iterating over a collection.

type ForkTask

type ForkTask struct {
	TaskBase `json:",inline"`      // Inline TaskBase fields
	Fork     ForkTaskConfiguration `json:"fork" validate:"required"`
}

ForkTask represents a task configuration to execute multiple tasks concurrently.

func (*ForkTask) GetBase added in v3.1.0

func (f *ForkTask) GetBase() *TaskBase

type ForkTaskConfiguration

type ForkTaskConfiguration struct {
	Branches *TaskList `json:"branches" validate:"required,dive"`
	Compete  bool      `json:"compete,omitempty"`
}

ForkTaskConfiguration defines the configuration for the branches to perform concurrently.

type GRPCArguments

type GRPCArguments struct {
	Proto          *ExternalResource                  `json:"proto" validate:"required"`
	Service        GRPCService                        `json:"service" validate:"required"`
	Method         string                             `json:"method" validate:"required"`
	Arguments      map[string]interface{}             `json:"arguments,omitempty"`
	Authentication *ReferenceableAuthenticationPolicy `json:"authentication,omitempty" validate:"omitempty"`
}

type GRPCService

type GRPCService struct {
	Name           string                             `json:"name" validate:"required"`
	Host           string                             `json:"host" validate:"required,hostname_rfc1123"`
	Port           int                                `json:"port" validate:"required,min=0,max=65535"`
	Authentication *ReferenceableAuthenticationPolicy `json:"authentication,omitempty"`
}

type HTTPArguments

type HTTPArguments struct {
	Method   string                 `json:"method" validate:"required,oneofci=GET POST PUT DELETE PATCH"`
	Endpoint *Endpoint              `json:"endpoint" validate:"required"`
	Headers  map[string]string      `json:"headers,omitempty"`
	Body     json.RawMessage        `json:"body,omitempty"`
	Query    map[string]interface{} `json:"query,omitempty"`
	Output   string                 `json:"output,omitempty" validate:"omitempty,oneof=raw content response"`
}

type Input

type Input struct {
	Schema *Schema              `json:"schema,omitempty" validate:"omitempty"`
	From   *ObjectOrRuntimeExpr `json:"from,omitempty" validate:"omitempty"`
}

Input Configures the workflow's input.

type JsonPointerOrRuntimeExpression

type JsonPointerOrRuntimeExpression struct {
	Value interface{} `json:"-" validate:"json_pointer_or_runtime_expr"` // Custom validation tag.
}

JsonPointerOrRuntimeExpression represents a type that can be a JSON Pointer or a RuntimeExpression.

func (*JsonPointerOrRuntimeExpression) GetValue added in v3.1.0

func (j *JsonPointerOrRuntimeExpression) GetValue() interface{}

func (*JsonPointerOrRuntimeExpression) IsValid added in v3.1.0

func (j *JsonPointerOrRuntimeExpression) IsValid() bool

func (*JsonPointerOrRuntimeExpression) MarshalJSON

func (j *JsonPointerOrRuntimeExpression) MarshalJSON() ([]byte, error)

MarshalJSON marshals JsonPointerOrRuntimeExpression into JSON.

func (*JsonPointerOrRuntimeExpression) String added in v3.1.0

func (*JsonPointerOrRuntimeExpression) UnmarshalJSON

func (j *JsonPointerOrRuntimeExpression) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into either a JSON Pointer or a RuntimeExpression.

type ListenTask

type ListenTask struct {
	TaskBase `json:",inline"`        // Inline TaskBase fields
	Listen   ListenTaskConfiguration `json:"listen" validate:"required"`
}

ListenTask represents a task configuration to listen to events.

func (*ListenTask) GetBase added in v3.1.0

func (lt *ListenTask) GetBase() *TaskBase

func (*ListenTask) MarshalJSON

func (lt *ListenTask) MarshalJSON() ([]byte, error)

MarshalJSON for ListenTask to ensure proper serialization.

func (*ListenTask) UnmarshalJSON

func (lt *ListenTask) UnmarshalJSON(data []byte) error

UnmarshalJSON for ListenTask to ensure proper deserialization.

type ListenTaskConfiguration

type ListenTaskConfiguration struct {
	To *EventConsumptionStrategy `json:"to" validate:"required"`
}

type LiteralUri

type LiteralUri struct {
	Value string `json:"-" validate:"required,uri_pattern"` // Validate pattern for URI.
}

func (*LiteralUri) GetValue added in v3.1.0

func (u *LiteralUri) GetValue() interface{}

func (*LiteralUri) IsURITemplate

func (u *LiteralUri) IsURITemplate() bool

func (*LiteralUri) MarshalJSON

func (u *LiteralUri) MarshalJSON() ([]byte, error)

func (*LiteralUri) String

func (u *LiteralUri) String() string

type LiteralUriTemplate

type LiteralUriTemplate struct {
	Value string `json:"-" validate:"required,uri_template_pattern"` // Validate pattern for URI template.
}

func (*LiteralUriTemplate) GetValue added in v3.1.0

func (t *LiteralUriTemplate) GetValue() interface{}

func (*LiteralUriTemplate) IsURITemplate

func (t *LiteralUriTemplate) IsURITemplate() bool

func (*LiteralUriTemplate) MarshalJSON

func (t *LiteralUriTemplate) MarshalJSON() ([]byte, error)

func (*LiteralUriTemplate) String

func (t *LiteralUriTemplate) String() string

type NamedTaskMap

type NamedTaskMap map[string]Task

func (*NamedTaskMap) UnmarshalJSON

func (ntm *NamedTaskMap) UnmarshalJSON(data []byte) error

UnmarshalJSON for NamedTaskMap to ensure proper deserialization.

type OAuth2AutenthicationDataClient

type OAuth2AutenthicationDataClient struct {
	ID             string                        `json:"id,omitempty"`
	Secret         string                        `json:"secret,omitempty"`
	Assertion      string                        `json:"assertion,omitempty"`
	Authentication OAuthClientAuthenticationType `json:"authentication,omitempty" validate:"client_auth_type"`
}

OAuth2AutenthicationDataClient The definition of an OAuth2 client.

type OAuth2AuthenticationDataGrant

type OAuth2AuthenticationDataGrant string

OAuth2AuthenticationDataGrant represents the grant type to use in OAuth2 authentication.

const (
	AuthorizationCodeGrant OAuth2AuthenticationDataGrant = "authorization_code"
	ClientCredentialsGrant OAuth2AuthenticationDataGrant = "client_credentials"
	PasswordGrant          OAuth2AuthenticationDataGrant = "password"
	RefreshTokenGrant      OAuth2AuthenticationDataGrant = "refresh_token"
	TokenExchangeGrant     OAuth2AuthenticationDataGrant = "urn:ietf:params:oauth:grant-type:token-exchange" // #nosec G101
)

Valid grant types

type OAuth2AuthenticationPolicy

type OAuth2AuthenticationPolicy struct {
	Properties *OAuth2AuthenticationProperties `json:",omitempty" validate:"required_without=Use"`
	Endpoints  *OAuth2Endpoints                `json:"endpoints,omitempty"`
	Use        string                          `json:"use,omitempty" validate:"oauth2_policy"`
}

func (*OAuth2AuthenticationPolicy) ApplyDefaults

func (o *OAuth2AuthenticationPolicy) ApplyDefaults()

func (*OAuth2AuthenticationPolicy) MarshalJSON

func (o *OAuth2AuthenticationPolicy) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON output for OAuth2AuthenticationPolicy

func (*OAuth2AuthenticationPolicy) UnmarshalJSON

func (o *OAuth2AuthenticationPolicy) UnmarshalJSON(data []byte) error

type OAuth2AuthenticationProperties

type OAuth2AuthenticationProperties struct {
	Authority URITemplate                     `json:"authority,omitempty"`
	Grant     OAuth2AuthenticationDataGrant   `` /* 158-byte string literal not displayed */
	Client    *OAuth2AutenthicationDataClient `json:"client,omitempty"`
	Request   *OAuth2TokenRequest             `json:"request,omitempty"`
	Issuers   []string                        `json:"issuers,omitempty"`
	Scopes    []string                        `json:"scopes,omitempty"`
	Audiences []string                        `json:"audiences,omitempty"`
	Username  string                          `json:"username,omitempty"`
	Password  string                          `json:"password,omitempty"`
	Subject   *OAuth2Token                    `json:"subject,omitempty"`
	Actor     *OAuth2Token                    `json:"actor,omitempty"`
}

func (*OAuth2AuthenticationProperties) UnmarshalJSON

func (o *OAuth2AuthenticationProperties) UnmarshalJSON(data []byte) error

type OAuth2Endpoints

type OAuth2Endpoints struct {
	Token         string `json:"token,omitempty"`
	Revocation    string `json:"revocation,omitempty"`
	Introspection string `json:"introspection,omitempty"`
}

type OAuth2Token

type OAuth2Token struct {
	// Token The security token to use
	Token string `json:"token,omitempty"`
	// Type The type of the security token to use.
	Type string `json:"type,omitempty"`
}

OAuth2Token Represents an OAuth2 token.

type OAuth2TokenRequest

type OAuth2TokenRequest struct {
	Encoding OAuth2TokenRequestEncodingType `json:"encoding" validate:"encoding_type"`
}

type OAuth2TokenRequestEncodingType

type OAuth2TokenRequestEncodingType string
const (
	EncodingTypeFormUrlEncoded  OAuth2TokenRequestEncodingType = "application/x-www-form-urlencoded"
	EncodingTypeApplicationJson OAuth2TokenRequestEncodingType = "application/json"
)

type OAuthClientAuthenticationType

type OAuthClientAuthenticationType string
const (
	OAuthClientAuthClientSecretBasic OAuthClientAuthenticationType = "client_secret_basic"
	OAuthClientAuthClientSecretPost  OAuthClientAuthenticationType = "client_secret_post"
	OAuthClientAuthClientSecretJWT   OAuthClientAuthenticationType = "client_secret_jwt"
	OAuthClientAuthPrivateKeyJWT     OAuthClientAuthenticationType = "private_key_jwt"
	OAuthClientAuthNone              OAuthClientAuthenticationType = "none"
)

type Object added in v3.1.0

type Object interface {
	String() string
	GetValue() interface{}
}

type ObjectOrRuntimeExpr

type ObjectOrRuntimeExpr struct {
	Value interface{} `json:"-" validate:"object_or_runtime_expr"` // Custom validation tag.
}

ObjectOrRuntimeExpr is a type that can hold either a RuntimeExpression or an object.

func NewObjectOrRuntimeExpr added in v3.1.0

func NewObjectOrRuntimeExpr(value interface{}) *ObjectOrRuntimeExpr

func (*ObjectOrRuntimeExpr) AsStringOrMap added in v3.1.0

func (o *ObjectOrRuntimeExpr) AsStringOrMap() interface{}

func (*ObjectOrRuntimeExpr) GetValue added in v3.1.0

func (o *ObjectOrRuntimeExpr) GetValue() interface{}

func (*ObjectOrRuntimeExpr) MarshalJSON

func (o *ObjectOrRuntimeExpr) MarshalJSON() ([]byte, error)

MarshalJSON marshals ObjectOrRuntimeExpr into JSON.

func (*ObjectOrRuntimeExpr) String added in v3.1.0

func (o *ObjectOrRuntimeExpr) String() string

func (*ObjectOrRuntimeExpr) UnmarshalJSON

func (o *ObjectOrRuntimeExpr) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into either a RuntimeExpression or an object.

func (*ObjectOrRuntimeExpr) Validate

func (o *ObjectOrRuntimeExpr) Validate() error

Validate validates the ObjectOrRuntimeExpr using the custom validation logic.

type ObjectOrString

type ObjectOrString struct {
	Value interface{} `validate:"object_or_string"`
}

ObjectOrString is a type that can hold either a string or an object.

func (*ObjectOrString) GetValue added in v3.1.0

func (o *ObjectOrString) GetValue() interface{}

func (*ObjectOrString) MarshalJSON

func (o *ObjectOrString) MarshalJSON() ([]byte, error)

MarshalJSON marshals ObjectOrString into JSON.

func (*ObjectOrString) String added in v3.1.0

func (o *ObjectOrString) String() string

func (*ObjectOrString) UnmarshalJSON

func (o *ObjectOrString) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into either a string or an object.

type OpenAPIArguments

type OpenAPIArguments struct {
	Document       *ExternalResource                  `json:"document" validate:"required"`
	OperationID    string                             `json:"operationId" validate:"required"`
	Parameters     map[string]interface{}             `json:"parameters,omitempty"`
	Authentication *ReferenceableAuthenticationPolicy `json:"authentication,omitempty"`
	Output         string                             `json:"output,omitempty" validate:"omitempty,oneof=raw content response"`
}

type OpenIdConnectAuthenticationPolicy

type OpenIdConnectAuthenticationPolicy struct {
	Properties *OAuth2AuthenticationProperties `json:",omitempty" validate:"omitempty,required_without=Use"`
	Use        string                          `json:"use,omitempty" validate:"omitempty,required_without=Properties"`
}

OpenIdConnectAuthenticationPolicy Use OpenIdConnect authentication.

type Output

type Output struct {
	Schema *Schema              `json:"schema,omitempty" validate:"omitempty"`
	As     *ObjectOrRuntimeExpr `json:"as,omitempty" validate:"omitempty"`
}

Output Configures the output of a workflow or task.

type RaiseTask

type RaiseTask struct {
	TaskBase `json:",inline"`       // Inline TaskBase fields
	Raise    RaiseTaskConfiguration `json:"raise" validate:"required"`
}

RaiseTask represents a task configuration to raise errors.

func (*RaiseTask) GetBase added in v3.1.0

func (r *RaiseTask) GetBase() *TaskBase

type RaiseTaskConfiguration

type RaiseTaskConfiguration struct {
	Error RaiseTaskError `json:"error" validate:"required"`
}

type RaiseTaskError

type RaiseTaskError struct {
	Definition *Error  `json:"-"`
	Ref        *string `json:"-"`
}

func (*RaiseTaskError) MarshalJSON

func (rte *RaiseTaskError) MarshalJSON() ([]byte, error)

MarshalJSON for RaiseTaskError to ensure proper serialization.

func (*RaiseTaskError) UnmarshalJSON

func (rte *RaiseTaskError) UnmarshalJSON(data []byte) error

UnmarshalJSON for RaiseTaskError to enforce "oneOf" behavior.

type ReferenceableAuthenticationPolicy

type ReferenceableAuthenticationPolicy struct {
	Use                  *string               `json:"use,omitempty"`
	AuthenticationPolicy *AuthenticationPolicy `json:",inline"`
}

ReferenceableAuthenticationPolicy represents a referenceable authentication policy.

func (*ReferenceableAuthenticationPolicy) MarshalJSON

func (rap *ReferenceableAuthenticationPolicy) MarshalJSON() ([]byte, error)

MarshalJSON for ReferenceableAuthenticationPolicy.

func (*ReferenceableAuthenticationPolicy) UnmarshalJSON

func (rap *ReferenceableAuthenticationPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON for ReferenceableAuthenticationPolicy enforces the "oneOf" behavior.

type RetryBackoff

type RetryBackoff struct {
	Constant    *BackoffDefinition `json:"constant,omitempty"`
	Exponential *BackoffDefinition `json:"exponential,omitempty"`
	Linear      *BackoffDefinition `json:"linear,omitempty"`
}

RetryBackoff defines the retry backoff strategies.

func (*RetryBackoff) MarshalJSON

func (rb *RetryBackoff) MarshalJSON() ([]byte, error)

MarshalJSON for RetryBackoff to ensure oneOf behavior.

func (*RetryBackoff) UnmarshalJSON

func (rb *RetryBackoff) UnmarshalJSON(data []byte) error

type RetryLimit

type RetryLimit struct {
	Attempt  *RetryLimitAttempt `json:"attempt,omitempty"`
	Duration *Duration          `json:"duration,omitempty"`
}

RetryLimit defines the retry limit configurations.

type RetryLimitAttempt

type RetryLimitAttempt struct {
	Count    int       `json:"count,omitempty"`
	Duration *Duration `json:"duration,omitempty"`
}

RetryLimitAttempt defines the limit for each retry attempt.

type RetryPolicy

type RetryPolicy struct {
	When       *RuntimeExpression `json:"when,omitempty"`
	ExceptWhen *RuntimeExpression `json:"exceptWhen,omitempty"`
	Delay      *Duration          `json:"delay,omitempty"`
	Backoff    *RetryBackoff      `json:"backoff,omitempty"`
	Limit      RetryLimit         `json:"limit,omitempty"`
	Jitter     *RetryPolicyJitter `json:"jitter,omitempty"`
	Ref        string             `json:"-"` // Reference to a reusable retry policy
}

RetryPolicy defines a retry policy.

func (*RetryPolicy) MarshalJSON

func (rp *RetryPolicy) MarshalJSON() ([]byte, error)

MarshalJSON for RetryPolicy to ensure proper serialization.

func (*RetryPolicy) ResolveReference

func (rp *RetryPolicy) ResolveReference(retries map[string]*RetryPolicy) error

func (*RetryPolicy) UnmarshalJSON

func (rp *RetryPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON for RetryPolicy to ensure proper deserialization.

type RetryPolicyJitter

type RetryPolicyJitter struct {
	From *Duration `json:"from" validate:"required"`
	To   *Duration `json:"to" validate:"required"`
}

RetryPolicyJitter defines the randomness or variability of retry delays.

type RunTask

type RunTask struct {
	TaskBase `json:",inline"`     // Inline TaskBase fields
	Run      RunTaskConfiguration `json:"run" validate:"required"`
}

RunTask represents a task configuration to execute external processes.

func (*RunTask) GetBase added in v3.1.0

func (r *RunTask) GetBase() *TaskBase

type RunTaskConfiguration

type RunTaskConfiguration struct {
	Await     *bool        `json:"await,omitempty"`
	Container *Container   `json:"container,omitempty"`
	Script    *Script      `json:"script,omitempty"`
	Shell     *Shell       `json:"shell,omitempty"`
	Workflow  *RunWorkflow `json:"workflow,omitempty"`
}

func (*RunTaskConfiguration) MarshalJSON

func (rtc *RunTaskConfiguration) MarshalJSON() ([]byte, error)

MarshalJSON for RunTaskConfiguration to ensure proper serialization.

func (*RunTaskConfiguration) UnmarshalJSON

func (rtc *RunTaskConfiguration) UnmarshalJSON(data []byte) error

UnmarshalJSON for RunTaskConfiguration to enforce "oneOf" behavior.

type RunWorkflow

type RunWorkflow struct {
	Namespace string                 `json:"namespace" validate:"required,hostname_rfc1123"`
	Name      string                 `json:"name" validate:"required,hostname_rfc1123"`
	Version   string                 `json:"version" validate:"required,semver_pattern"`
	Input     map[string]interface{} `json:"input,omitempty"`
}

type RuntimeExpression

type RuntimeExpression struct {
	Value string `json:"-" validate:"required"`
}

RuntimeExpression represents a runtime expression.

func NewExpr

func NewExpr(runtimeExpression string) *RuntimeExpression

NewExpr creates a new RuntimeExpression instance

func (*RuntimeExpression) GetValue added in v3.1.0

func (r *RuntimeExpression) GetValue() interface{}

func (*RuntimeExpression) IsValid

func (r *RuntimeExpression) IsValid() bool

IsValid checks if the RuntimeExpression value is valid, handling both with and without `${}`.

func (*RuntimeExpression) MarshalJSON

func (r *RuntimeExpression) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshalling for RuntimeExpression.

func (*RuntimeExpression) String

func (r *RuntimeExpression) String() string

func (*RuntimeExpression) UnmarshalJSON

func (r *RuntimeExpression) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for RuntimeExpression.

type Schedule

type Schedule struct {
	Every *Duration                 `json:"every,omitempty" validate:"omitempty"`
	Cron  string                    `json:"cron,omitempty" validate:"omitempty"`
	After *Duration                 `json:"after,omitempty" validate:"omitempty"`
	On    *EventConsumptionStrategy `json:"on,omitempty" validate:"omitempty"`
}

Schedule the workflow.

type Schema

type Schema struct {
	Format   string            `json:"format,omitempty"`
	Document interface{}       `json:"document,omitempty" validate:"omitempty"`
	Resource *ExternalResource `json:"resource,omitempty" validate:"omitempty"`
}

Schema represents the definition of a schema.

func (*Schema) ApplyDefaults

func (s *Schema) ApplyDefaults()

func (*Schema) MarshalJSON

func (s *Schema) MarshalJSON() ([]byte, error)

MarshalJSON for Schema marshals the correct field.

func (*Schema) UnmarshalJSON

func (s *Schema) UnmarshalJSON(data []byte) error

UnmarshalJSON for Schema enforces "oneOf" behavior.

type Script

type Script struct {
	Language    string                 `json:"language" validate:"required"`
	Arguments   map[string]interface{} `json:"arguments,omitempty"`
	Environment map[string]string      `json:"environment,omitempty"`
	InlineCode  *string                `json:"code,omitempty"`
	External    *ExternalResource      `json:"source,omitempty"`
}

type SetTask

type SetTask struct {
	TaskBase `json:",inline"`       // Inline TaskBase fields
	Set      map[string]interface{} `json:"set" validate:"required,min=1,dive"`
}

SetTask represents a task used to set data.

func (*SetTask) GetBase added in v3.1.0

func (st *SetTask) GetBase() *TaskBase

func (*SetTask) MarshalJSON

func (st *SetTask) MarshalJSON() ([]byte, error)

MarshalJSON for SetTask to ensure proper serialization.

func (*SetTask) UnmarshalJSON

func (st *SetTask) UnmarshalJSON(data []byte) error

UnmarshalJSON for SetTask to ensure proper deserialization.

type Shell

type Shell struct {
	Command     string                 `json:"command" validate:"required"`
	Arguments   map[string]interface{} `json:"arguments,omitempty"`
	Environment map[string]string      `json:"environment,omitempty"`
}

type StringOrRuntimeExpr

type StringOrRuntimeExpr struct {
	Value interface{} `json:"-" validate:"string_or_runtime_expr"` // Custom validation tag.
}

StringOrRuntimeExpr is a type that can hold either a RuntimeExpression or a string.

func NewStringOrRuntimeExpr added in v3.1.0

func NewStringOrRuntimeExpr(value string) *StringOrRuntimeExpr

func (*StringOrRuntimeExpr) AsObjectOrRuntimeExpr added in v3.1.0

func (s *StringOrRuntimeExpr) AsObjectOrRuntimeExpr() *ObjectOrRuntimeExpr

func (*StringOrRuntimeExpr) GetValue added in v3.1.0

func (s *StringOrRuntimeExpr) GetValue() interface{}

func (*StringOrRuntimeExpr) MarshalJSON

func (s *StringOrRuntimeExpr) MarshalJSON() ([]byte, error)

MarshalJSON marshals StringOrRuntimeExpr into JSON.

func (*StringOrRuntimeExpr) String

func (s *StringOrRuntimeExpr) String() string

func (*StringOrRuntimeExpr) UnmarshalJSON

func (s *StringOrRuntimeExpr) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into either a RuntimeExpression or a string.

type SwitchCase

type SwitchCase struct {
	When *RuntimeExpression `json:"when,omitempty"`
	Then *FlowDirective     `json:"then" validate:"required"`
}

SwitchCase defines a condition and the corresponding outcome for a switch task.

type SwitchItem

type SwitchItem map[string]SwitchCase

type SwitchTask

type SwitchTask struct {
	TaskBase `json:",inline"` // Inline TaskBase fields
	Switch   []SwitchItem     `json:"switch" validate:"required,min=1,dive,switch_item"`
}

SwitchTask represents a task configuration for conditional branching.

func (*SwitchTask) GetBase added in v3.1.0

func (st *SwitchTask) GetBase() *TaskBase

func (*SwitchTask) MarshalJSON

func (st *SwitchTask) MarshalJSON() ([]byte, error)

MarshalJSON for SwitchTask to ensure proper serialization.

func (*SwitchTask) UnmarshalJSON

func (st *SwitchTask) UnmarshalJSON(data []byte) error

UnmarshalJSON for SwitchTask to ensure proper deserialization.

type Task

type Task interface {
	GetBase() *TaskBase
}

Task represents a discrete unit of work in a workflow.

type TaskBase

type TaskBase struct {
	// A runtime expression, if any, used to determine whether or not the task should be run.
	If *RuntimeExpression `json:"if,omitempty" validate:"omitempty"`
	// Configure the task's input.
	Input *Input `json:"input,omitempty" validate:"omitempty"`
	// Configure the task's output.
	Output *Output `json:"output,omitempty" validate:"omitempty"`
	// Export task output to context.
	Export  *Export             `json:"export,omitempty" validate:"omitempty"`
	Timeout *TimeoutOrReference `json:"timeout,omitempty" validate:"omitempty"`
	// The flow directive to be performed upon completion of the task.
	Then     *FlowDirective         `json:"then,omitempty" validate:"omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

type TaskItem

type TaskItem struct {
	Key  string `json:"-" validate:"required"`
	Task Task   `json:"-" validate:"required"`
}

TaskItem represents a named task and its associated definition.

func (*TaskItem) AsCallAsyncAPITask

func (ti *TaskItem) AsCallAsyncAPITask() *CallAsyncAPI

AsCallAsyncAPITask casts the Task to a CallAsyncAPI task if possible, returning nil if the cast fails.

func (*TaskItem) AsCallFunctionTask

func (ti *TaskItem) AsCallFunctionTask() *CallFunction

AsCallFunctionTask casts the Task to a CallFunction task if possible, returning nil if the cast fails.

func (*TaskItem) AsCallGRPCTask

func (ti *TaskItem) AsCallGRPCTask() *CallGRPC

AsCallGRPCTask casts the Task to a CallGRPC task if possible, returning nil if the cast fails.

func (*TaskItem) AsCallHTTPTask

func (ti *TaskItem) AsCallHTTPTask() *CallHTTP

AsCallHTTPTask casts the Task to a CallTask if possible, returning nil if the cast fails.

func (*TaskItem) AsCallOpenAPITask

func (ti *TaskItem) AsCallOpenAPITask() *CallOpenAPI

AsCallOpenAPITask casts the Task to a CallOpenAPI task if possible, returning nil if the cast fails.

func (*TaskItem) AsDoTask

func (ti *TaskItem) AsDoTask() *DoTask

AsDoTask casts the Task to a DoTask if possible, returning nil if the cast fails.

func (*TaskItem) AsEmitTask

func (ti *TaskItem) AsEmitTask() *EmitTask

AsEmitTask casts the Task to an EmitTask if possible, returning nil if the cast fails.

func (*TaskItem) AsForTask

func (ti *TaskItem) AsForTask() *ForTask

AsForTask casts the Task to a ForTask if possible, returning nil if the cast fails.

func (*TaskItem) AsForkTask

func (ti *TaskItem) AsForkTask() *ForkTask

AsForkTask casts the Task to a ForkTask if possible, returning nil if the cast fails.

func (*TaskItem) AsListenTask

func (ti *TaskItem) AsListenTask() *ListenTask

AsListenTask casts the Task to a ListenTask if possible, returning nil if the cast fails.

func (*TaskItem) AsRaiseTask

func (ti *TaskItem) AsRaiseTask() *RaiseTask

AsRaiseTask casts the Task to a RaiseTask if possible, returning nil if the cast fails.

func (*TaskItem) AsRunTask

func (ti *TaskItem) AsRunTask() *RunTask

AsRunTask casts the Task to a RunTask if possible, returning nil if the cast fails.

func (*TaskItem) AsSetTask

func (ti *TaskItem) AsSetTask() *SetTask

AsSetTask casts the Task to a SetTask if possible, returning nil if the cast fails.

func (*TaskItem) AsSwitchTask

func (ti *TaskItem) AsSwitchTask() *SwitchTask

AsSwitchTask casts the Task to a SwitchTask if possible, returning nil if the cast fails.

func (*TaskItem) AsTryTask

func (ti *TaskItem) AsTryTask() *TryTask

AsTryTask casts the Task to a TryTask if possible, returning nil if the cast fails.

func (*TaskItem) AsWaitTask

func (ti *TaskItem) AsWaitTask() *WaitTask

AsWaitTask casts the Task to a WaitTask if possible, returning nil if the cast fails.

func (*TaskItem) GetBase added in v3.1.0

func (ti *TaskItem) GetBase() *TaskBase

func (*TaskItem) MarshalJSON

func (ti *TaskItem) MarshalJSON() ([]byte, error)

MarshalJSON for TaskItem to ensure proper serialization as a key-value pair.

type TaskList

type TaskList []*TaskItem

TaskList represents a list of named tasks to perform.

func (*TaskList) Key

func (tl *TaskList) Key(key string) *TaskItem

Key retrieves a TaskItem by its key.

func (*TaskList) KeyAndIndex added in v3.1.0

func (tl *TaskList) KeyAndIndex(key string) (int, *TaskItem)

func (*TaskList) MarshalJSON

func (tl *TaskList) MarshalJSON() ([]byte, error)

MarshalJSON for TaskList to ensure proper serialization.

func (*TaskList) Next added in v3.1.0

func (tl *TaskList) Next(currentIdx int) (int, *TaskItem)

Next gets the next item in the list based on the current index

func (*TaskList) UnmarshalJSON

func (tl *TaskList) UnmarshalJSON(data []byte) error

UnmarshalJSON for TaskList to ensure proper deserialization.

type Timeout

type Timeout struct {
	// After The duration after which to timeout
	After *Duration `json:"after" validate:"required"`
}

Timeout specifies a time limit for tasks or workflows.

func (*Timeout) MarshalJSON

func (t *Timeout) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshalling for Timeout.

func (*Timeout) UnmarshalJSON

func (t *Timeout) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for Timeout.

type TimeoutOrReference

type TimeoutOrReference struct {
	Timeout   *Timeout `json:"-" validate:"required_without=Ref"`
	Reference *string  `json:"-" validate:"required_without=Timeout"`
}

TimeoutOrReference handles either a Timeout definition or a reference (string).

func (*TimeoutOrReference) MarshalJSON

func (tr *TimeoutOrReference) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshalling for TimeoutOrReference.

func (*TimeoutOrReference) UnmarshalJSON

func (tr *TimeoutOrReference) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for TimeoutOrReference.

type TryTask

type TryTask struct {
	TaskBase `json:",inline"`
	Try      *TaskList     `json:"try" validate:"required,dive"`
	Catch    *TryTaskCatch `json:"catch" validate:"required"`
}

func (*TryTask) GetBase added in v3.1.0

func (t *TryTask) GetBase() *TaskBase

type TryTaskCatch

type TryTaskCatch struct {
	Errors struct {
		With *ErrorFilter `json:"with,omitempty"`
	} `json:"errors,omitempty"`
	As         string             `json:"as,omitempty"`
	When       *RuntimeExpression `json:"when,omitempty"`
	ExceptWhen *RuntimeExpression `json:"exceptWhen,omitempty"`
	Retry      *RetryPolicy       `json:"retry,omitempty"`
	Do         *TaskList          `json:"do,omitempty" validate:"omitempty,dive"`
}

type URITemplate

type URITemplate interface {
	IsURITemplate() bool
	String() string
	GetValue() interface{}
}

URITemplate represents a URI that can be a literal URI or a URI template.

func UnmarshalURITemplate

func UnmarshalURITemplate(data []byte) (URITemplate, error)

UnmarshalURITemplate is a shared function for unmarshalling URITemplate fields.

type URITemplateOrRuntimeExpr

type URITemplateOrRuntimeExpr struct {
	Value interface{} `json:"-" validate:"uri_template_or_runtime_expr"` // Custom validation.
}

URITemplateOrRuntimeExpr represents a type that can be a URITemplate or a RuntimeExpression.

func NewUriTemplate

func NewUriTemplate(uriTemplate string) *URITemplateOrRuntimeExpr

func (*URITemplateOrRuntimeExpr) GetValue added in v3.1.0

func (u *URITemplateOrRuntimeExpr) GetValue() interface{}

func (*URITemplateOrRuntimeExpr) MarshalJSON

func (u *URITemplateOrRuntimeExpr) MarshalJSON() ([]byte, error)

MarshalJSON marshals URITemplateOrRuntimeExpr into JSON.

func (*URITemplateOrRuntimeExpr) String

func (u *URITemplateOrRuntimeExpr) String() string

func (*URITemplateOrRuntimeExpr) UnmarshalJSON

func (u *URITemplateOrRuntimeExpr) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals data into either a URITemplate or a RuntimeExpression.

type Use

type Use struct {
	Authentications map[string]*AuthenticationPolicy `json:"authentications,omitempty" validate:"omitempty,dive"`
	Errors          map[string]*Error                `json:"errors,omitempty" validate:"omitempty,dive"`
	Extensions      ExtensionList                    `json:"extensions,omitempty" validate:"omitempty,dive"`
	Functions       NamedTaskMap                     `json:"functions,omitempty" validate:"omitempty,dive"`
	Retries         map[string]*RetryPolicy          `json:"retries,omitempty" validate:"omitempty,dive"`
	Secrets         []string                         `json:"secrets,omitempty"`
	Timeouts        map[string]*Timeout              `json:"timeouts,omitempty" validate:"omitempty,dive"`
	Catalogs        map[string]*Catalog              `json:"catalogs,omitempty" validate:"omitempty,dive"`
}

type WaitTask

type WaitTask struct {
	TaskBase `json:",inline"`
	Wait     *Duration `json:"wait" validate:"required"`
}

WaitTask represents a task configuration to delay execution for a specified duration.

func (*WaitTask) GetBase added in v3.1.0

func (wt *WaitTask) GetBase() *TaskBase

func (*WaitTask) MarshalJSON

func (wt *WaitTask) MarshalJSON() ([]byte, error)

MarshalJSON for WaitTask to ensure proper serialization.

func (*WaitTask) UnmarshalJSON

func (wt *WaitTask) UnmarshalJSON(data []byte) error

UnmarshalJSON for WaitTask to ensure proper deserialization.

type Workflow

type Workflow struct {
	Document Document            `json:"document" yaml:"document" validate:"required"`
	Input    *Input              `json:"input,omitempty" yaml:"input,omitempty"`
	Use      *Use                `json:"use,omitempty" yaml:"use"`
	Do       *TaskList           `json:"do" yaml:"do" validate:"required,dive"`
	Timeout  *TimeoutOrReference `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Output   *Output             `json:"output,omitempty" yaml:"output,omitempty"`
	Schedule *Schedule           `json:"schedule,omitempty" yaml:"schedule,omitempty"`
}

Workflow represents the root structure of a workflow.

func (*Workflow) AsMap added in v3.1.0

func (w *Workflow) AsMap() (map[string]interface{}, error)

AsMap converts the Workflow struct into a JSON Map object.

func (*Workflow) MarshalYAML

func (w *Workflow) MarshalYAML() (interface{}, error)

type WorkflowBuilder

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

WorkflowBuilder helps construct and serialize a Workflow object.

func NewWorkflowBuilder

func NewWorkflowBuilder() *WorkflowBuilder

NewWorkflowBuilder initializes a new WorkflowBuilder.

func (*WorkflowBuilder) AddTask

func (wb *WorkflowBuilder) AddTask(key string, task Task) *WorkflowBuilder

AddTask adds a TaskItem to the Workflow's Do list.

func (*WorkflowBuilder) Build

func (wb *WorkflowBuilder) Build() *Workflow

Build returns the constructed Workflow object.

func (*WorkflowBuilder) SetDocument

func (wb *WorkflowBuilder) SetDocument(dsl, namespace, name, version string) *WorkflowBuilder

SetDocument sets the Document fields in the Workflow.

func (*WorkflowBuilder) SetInput

func (wb *WorkflowBuilder) SetInput(input *Input) *WorkflowBuilder

SetInput sets the Input for the Workflow.

func (*WorkflowBuilder) SetOutput

func (wb *WorkflowBuilder) SetOutput(output *Output) *WorkflowBuilder

SetOutput sets the Output for the Workflow.

func (*WorkflowBuilder) SetSchedule

func (wb *WorkflowBuilder) SetSchedule(schedule *Schedule) *WorkflowBuilder

SetSchedule sets the Schedule for the Workflow.

func (*WorkflowBuilder) SetTimeout

func (wb *WorkflowBuilder) SetTimeout(timeout *TimeoutOrReference) *WorkflowBuilder

SetTimeout sets the Timeout for the Workflow.

func (*WorkflowBuilder) SetUse

func (wb *WorkflowBuilder) SetUse(use *Use) *WorkflowBuilder

SetUse sets the Use section for the Workflow.

func (*WorkflowBuilder) ToJSON

func (wb *WorkflowBuilder) ToJSON() ([]byte, error)

ToJSON serializes the Workflow to JSON format.

func (*WorkflowBuilder) ToYAML

func (wb *WorkflowBuilder) ToYAML() ([]byte, error)

ToYAML serializes the Workflow to YAML format.

Jump to

Keyboard shortcuts

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