sdk

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type CapDefinition

type CapDefinition[O any] interface {
	// contains filtered or unexported methods
}

func AccessField

func AccessField[I, O any](c CapDefinition[I], fieldName string) CapDefinition[O]

AccessField is meant to be used by generated code

func AnyMap

func AnyMap[M ~map[string]any](inputs CapMap) CapDefinition[M]

func ConstantDefinition

func ConstantDefinition[O any](o O) CapDefinition[O]

func Map

func Map[T any, M ~map[string]T](input map[string]CapDefinition[T]) CapDefinition[M]

type CapListDefinition

type CapListDefinition[O any] interface {
	CapDefinition[[]O]
	Index(i int) CapDefinition[O]
}

func AnyListOf

func AnyListOf(capabilities ...capDefinition) CapListDefinition[any]

func ListOf

func ListOf[O any](capabilities ...CapDefinition[O]) CapListDefinition[O]

func ToListDefinition

func ToListDefinition[O any](c CapDefinition[[]O]) CapListDefinition[O]

type CapMap

type CapMap map[string]capDefinition

type ComponentCapDefinition

type ComponentCapDefinition[O any] map[string]any

ComponentCapDefinition is meant to be used by generated code

func (ComponentCapDefinition[O]) Ref

func (c ComponentCapDefinition[O]) Ref() any

type Compute10Inputs

type Compute10Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any, T7 any, T8 any, T9 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
	Arg7 CapDefinition[T7]
	Arg8 CapDefinition[T8]
	Arg9 CapDefinition[T9]
}

func (Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) ToSteps

func (input Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) ToSteps() StepInputs

type Compute1Inputs

type Compute1Inputs[T0 any] struct {
	Arg0 CapDefinition[T0]
}

func (Compute1Inputs[I0]) ToSteps

func (input Compute1Inputs[I0]) ToSteps() StepInputs

type Compute2Inputs

type Compute2Inputs[T0 any, T1 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
}

func (Compute2Inputs[I0, I1]) ToSteps

func (input Compute2Inputs[I0, I1]) ToSteps() StepInputs

type Compute3Inputs

type Compute3Inputs[T0 any, T1 any, T2 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
}

func (Compute3Inputs[I0, I1, I2]) ToSteps

func (input Compute3Inputs[I0, I1, I2]) ToSteps() StepInputs

type Compute4Inputs

type Compute4Inputs[T0 any, T1 any, T2 any, T3 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
}

func (Compute4Inputs[I0, I1, I2, I3]) ToSteps

func (input Compute4Inputs[I0, I1, I2, I3]) ToSteps() StepInputs

type Compute5Inputs

type Compute5Inputs[T0 any, T1 any, T2 any, T3 any, T4 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
}

func (Compute5Inputs[I0, I1, I2, I3, I4]) ToSteps

func (input Compute5Inputs[I0, I1, I2, I3, I4]) ToSteps() StepInputs

type Compute6Inputs

type Compute6Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
}

func (Compute6Inputs[I0, I1, I2, I3, I4, I5]) ToSteps

func (input Compute6Inputs[I0, I1, I2, I3, I4, I5]) ToSteps() StepInputs

type Compute7Inputs

type Compute7Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
}

func (Compute7Inputs[I0, I1, I2, I3, I4, I5, I6]) ToSteps

func (input Compute7Inputs[I0, I1, I2, I3, I4, I5, I6]) ToSteps() StepInputs

type Compute8Inputs

type Compute8Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any, T7 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
	Arg7 CapDefinition[T7]
}

func (Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7]) ToSteps

func (input Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7]) ToSteps() StepInputs

type Compute9Inputs

type Compute9Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any, T7 any, T8 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
	Arg7 CapDefinition[T7]
	Arg8 CapDefinition[T8]
}

func (Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8]) ToSteps

func (input Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8]) ToSteps() StepInputs

type ComputeOutput

type ComputeOutput[T any] struct {
	Value T
}

type ComputeOutputCap

type ComputeOutputCap[T any] interface {
	CapDefinition[ComputeOutput[T]]
	Value() CapDefinition[T]
}

func Compute1

func Compute1[I0 any, O any](w *WorkflowSpecFactory, ref string, input Compute1Inputs[I0], compute func(Runtime, I0) (O, error)) ComputeOutputCap[O]

func Compute10

func Compute10[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, I9 any, O any](w *WorkflowSpecFactory, ref string, input Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9) (O, error)) ComputeOutputCap[O]

func Compute2

func Compute2[I0 any, I1 any, O any](w *WorkflowSpecFactory, ref string, input Compute2Inputs[I0, I1], compute func(Runtime, I0, I1) (O, error)) ComputeOutputCap[O]

func Compute3

func Compute3[I0 any, I1 any, I2 any, O any](w *WorkflowSpecFactory, ref string, input Compute3Inputs[I0, I1, I2], compute func(Runtime, I0, I1, I2) (O, error)) ComputeOutputCap[O]

func Compute4

func Compute4[I0 any, I1 any, I2 any, I3 any, O any](w *WorkflowSpecFactory, ref string, input Compute4Inputs[I0, I1, I2, I3], compute func(Runtime, I0, I1, I2, I3) (O, error)) ComputeOutputCap[O]

func Compute5

func Compute5[I0 any, I1 any, I2 any, I3 any, I4 any, O any](w *WorkflowSpecFactory, ref string, input Compute5Inputs[I0, I1, I2, I3, I4], compute func(Runtime, I0, I1, I2, I3, I4) (O, error)) ComputeOutputCap[O]

func Compute6

func Compute6[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, O any](w *WorkflowSpecFactory, ref string, input Compute6Inputs[I0, I1, I2, I3, I4, I5], compute func(Runtime, I0, I1, I2, I3, I4, I5) (O, error)) ComputeOutputCap[O]

func Compute7

func Compute7[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, O any](w *WorkflowSpecFactory, ref string, input Compute7Inputs[I0, I1, I2, I3, I4, I5, I6], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6) (O, error)) ComputeOutputCap[O]

func Compute8

func Compute8[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, O any](w *WorkflowSpecFactory, ref string, input Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7) (O, error)) ComputeOutputCap[O]

func Compute9

func Compute9[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, O any](w *WorkflowSpecFactory, ref string, input Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7, I8) (O, error)) ComputeOutputCap[O]

type FetchRequest

type FetchRequest struct {
	URL       string         `json:"url"`                 // URL to query, only http and https protocols are supported.
	Method    string         `json:"method,omitempty"`    // HTTP verb, defaults to GET.
	Headers   map[string]any `json:"headers,omitempty"`   // HTTP headers, defaults to empty.
	Body      []byte         `json:"body,omitempty"`      // HTTP request body
	TimeoutMs uint32         `json:"timeoutMs,omitempty"` // Timeout in milliseconds
}

type FetchResponse

type FetchResponse struct {
	ExecutionError bool           `json:"executionError"`         // true if there were non-HTTP errors. false if HTTP request was sent regardless of status (2xx, 4xx, 5xx)
	ErrorMessage   string         `json:"errorMessage,omitempty"` // error message in case of failure
	StatusCode     uint8          `json:"statusCode"`             // HTTP status code
	Headers        map[string]any `json:"headers,omitempty"`      // HTTP headers
	Body           []byte         `json:"body,omitempty"`         // HTTP response body
}

type MessageEmitter added in v0.1.1

type MessageEmitter interface {
	// Emit sends a message to the labeler's destination.
	Emit(string) error

	// With sets the labels for the message to be emitted.  Labels are passed as key-value pairs
	// and are cumulative.
	With(kvs ...string) MessageEmitter
}

type NewWorkflowParams

type NewWorkflowParams struct {
	Owner string
	Name  string
}

type Runner

type Runner interface {
	Run(factory *WorkflowSpecFactory)
	Config() []byte
}

type Runtime

type Runtime interface {
	Logger() logger.Logger
	Fetch(req FetchRequest) (FetchResponse, error)

	// Emitter sends the given message and labels to the configured collector.
	Emitter() MessageEmitter
}

Guest interface

type Step

type Step[O any] struct {
	Definition StepDefinition
}

func (*Step[O]) AddTo

func (step *Step[O]) AddTo(w *WorkflowSpecFactory) CapDefinition[O]

AddTo is meant to be called by generated code

type StepDefinition

type StepDefinition struct {
	ID     string
	Ref    string
	Inputs StepInputs
	Config map[string]any

	CapabilityType capabilities.CapabilityType
}

StepDefinition is the parsed representation of a step in a workflow.

Within the workflow spec, they are called "Capability Properties".

type StepInputs

type StepInputs struct {
	OutputRef string
	Mapping   map[string]any
}

type WorkflowSpec

type WorkflowSpec struct {
	Name      string
	Owner     string
	Triggers  []StepDefinition
	Actions   []StepDefinition
	Consensus []StepDefinition
	Targets   []StepDefinition
}

func (*WorkflowSpec) Steps

func (w *WorkflowSpec) Steps() []StepDefinition

type WorkflowSpecFactory

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

func NewWorkflowSpecFactory

func NewWorkflowSpecFactory(
	params NewWorkflowParams,
) *WorkflowSpecFactory

func (*WorkflowSpecFactory) GetFn

func (*WorkflowSpecFactory) Spec

func (w *WorkflowSpecFactory) Spec() (WorkflowSpec, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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