sdk

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 9 Imported by: 4

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 added in v0.3.0

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

func ConstantDefinition

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

func Map added in v0.3.0

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 added in v0.3.0

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 added in v0.3.0

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 ComputeConfig added in v0.4.0

type ComputeConfig[C any] struct {
	Config C
}

func EmptyComputeConfig added in v0.4.0

func EmptyComputeConfig() *ComputeConfig[struct{}]

func (*ComputeConfig[C]) ToMap added in v0.4.0

func (c *ComputeConfig[C]) ToMap() (map[string]any, error)

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 Compute10WithConfig added in v0.4.0

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

func Compute10WithMetadata added in v0.4.0

func Compute10WithMetadata[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, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute10WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute1WithConfig added in v0.4.0

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

func Compute1WithMetadata added in v0.4.0

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

Compute1WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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 Compute2WithConfig added in v0.4.0

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

func Compute2WithMetadata added in v0.4.0

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

Compute2WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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 Compute3WithConfig added in v0.4.0

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

func Compute3WithMetadata added in v0.4.0

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

Compute3WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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 Compute4WithConfig added in v0.4.0

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

func Compute4WithMetadata added in v0.4.0

func Compute4WithMetadata[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, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute4WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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 Compute5WithConfig added in v0.4.0

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

func Compute5WithMetadata added in v0.4.0

func Compute5WithMetadata[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, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute5WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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 Compute6WithConfig added in v0.4.0

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

func Compute6WithMetadata added in v0.4.0

func Compute6WithMetadata[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, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute6WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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 Compute7WithConfig added in v0.4.0

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

func Compute7WithMetadata added in v0.4.0

func Compute7WithMetadata[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, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute7WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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 Compute8WithConfig added in v0.4.0

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

func Compute8WithMetadata added in v0.4.0

func Compute8WithMetadata[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, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute8WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

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]

func Compute9WithConfig added in v0.4.0

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

func Compute9WithMetadata added in v0.4.0

func Compute9WithMetadata[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, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute9WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

type FetchRequest added in v0.3.0

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 added in v0.3.0

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.4.0

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 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 SecretValue added in v0.4.0

type SecretValue string

func Secret added in v0.4.0

func Secret(named string) SecretValue

func Secrets added in v0.4.0

func Secrets() SecretValue

func (SecretValue) Ref added in v0.4.0

func (s SecretValue) Ref() any

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() *WorkflowSpecFactory

func (*WorkflowSpecFactory) AddErr added in v0.4.0

func (w *WorkflowSpecFactory) AddErr(err error)

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