types

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLabelParams

func WithLabelParams(parent context.Context, labels map[string]string) context.Context

WithLabelParams returns a copy of parent in which the labels value is set

func WithRuntimeParams

func WithRuntimeParams(parent context.Context, params RuntimeParams) context.Context

WithRuntimeParams returns a copy of parent in which the runtime params value is set

Types

type ContextKey

type ContextKey string

ContextKey is the key type for context values.

const (
	// WorkflowContextKey is the key for workflow context.
	WorkflowContextKey ContextKey = "workflowContext"
	// ProcessContextKey is the key for process context.
	ProcessContextKey ContextKey = "processContext"
	// ActionKey is the key for action.
	ActionKey ContextKey = "action"
	// LabelsKey is the key for labels.
	LabelsKey ContextKey = "labels"
	// KubeHandlersKey is the key for kube handlers.
	KubeHandlersKey ContextKey = "kubeHandlers"
	// KubeClientKey is the key for kube client.
	KubeClientKey ContextKey = "kubeClient"
)

type Deleter

type Deleter func(ctx context.Context, client client.Client, cluster, owner string, manifest *unstructured.Unstructured) error

Deleter is a client for delete resources.

type Dispatcher

type Dispatcher func(ctx context.Context, client client.Client, cluster, owner string, manifests ...*unstructured.Unstructured) error

Dispatcher is a client for apply resources.

type GenericProviderFn

type GenericProviderFn[T any, U any] func(context.Context, *Params[T]) (*U, error)

GenericProviderFn is the provider function

func (GenericProviderFn[T, U]) Call

func (fn GenericProviderFn[T, U]) Call(ctx context.Context, value cue.Value) (cue.Value, error)

Call marshal value into json and decode into underlying function input parameters, then fill back the returned output value

type KubeHandlers

type KubeHandlers struct {
	Apply  Dispatcher
	Delete Deleter
}

KubeHandlers handles resources.

type LegacyGenericProviderFn

type LegacyGenericProviderFn[T any, U any] func(context.Context, *LegacyParams[T]) (*U, error)

LegacyGenericProviderFn is the legacy provider function

func (LegacyGenericProviderFn[T, U]) Call

func (fn LegacyGenericProviderFn[T, U]) Call(ctx context.Context, value cue.Value) (cue.Value, error)

Call marshal value into json and decode into underlying function input parameters, then fill back the returned output value

type LegacyNativeProviderFn

type LegacyNativeProviderFn func(context.Context, *LegacyParams[cue.Value]) (cue.Value, error)

LegacyNativeProviderFn is the legacy native provider function

func (LegacyNativeProviderFn) Call

func (fn LegacyNativeProviderFn) Call(ctx context.Context, value cue.Value) (cue.Value, error)

Call marshal value into json and decode into underlying function input parameters, then fill back the returned output value

type LegacyParams

type LegacyParams[T any] struct {
	Params T
	RuntimeParams
}

LegacyParams is the legacy input parameters of a provider.

type NativeProviderFn

type NativeProviderFn func(context.Context, *Params[cue.Value]) (cue.Value, error)

NativeProviderFn is the legacy native provider function

func (NativeProviderFn) Call

func (fn NativeProviderFn) Call(ctx context.Context, value cue.Value) (cue.Value, error)

Call marshal value into json and decode into underlying function input parameters, then fill back the returned output value

type Params

type Params[T any] struct {
	Params T `json:"$params"`
	RuntimeParams
}

Params is the input parameters of a provider.

type Returns

type Returns[T any] struct {
	Returns T `json:"$returns"`
}

Returns is the returns of a provider.

type RuntimeParams

type RuntimeParams struct {
	WorkflowContext wfContext.Context
	ProcessContext  process.Context
	Action          types.Action
	FieldLabel      string
	Labels          map[string]string
	KubeHandlers    *KubeHandlers
	KubeClient      client.Client
}

RuntimeParams is the runtime parameters of a provider.

func RuntimeParamsFrom

func RuntimeParamsFrom(ctx context.Context) RuntimeParams

RuntimeParamsFrom returns the runtime params value stored in ctx, if any.

Jump to

Keyboard shortcuts

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