function

package
v0.46.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package function builds and packages function archives for upload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSourceNames added in v0.26.0

func FormatSourceNames(sources []SourceInfo) string

FormatSourceNames lists scanned source names for an error that has to say what was available.

func MatchesTarget added in v0.26.0

func MatchesTarget(source SourceInfo, target, baseDir string) bool

MatchesTarget reports whether a scanned source is the one a --file value names, by function name or by path to its source.

Types

type Alias added in v0.0.4

type Alias struct {
	Name       string
	FunctionID string
}

Alias describes one configured function invoke alias.

type DurableFunctionError added in v0.42.0

type DurableFunctionError struct {
	Name string
}

DurableFunctionError reports that a name the standard function commands cannot find belongs to a durable function.

func (*DurableFunctionError) Error added in v0.42.0

func (e *DurableFunctionError) Error() string

type InvokeTokenProvider added in v0.0.4

type InvokeTokenProvider func(context.Context, *clisession.ProjectSession) (string, error)

InvokeTokenProvider returns the bearer token to use for function invoke routes.

type Option added in v0.0.4

type Option func(*Service)

Option configures function workflows.

func WithInvokeTokenProvider added in v0.0.4

func WithInvokeTokenProvider(provider InvokeTokenProvider) Option

WithInvokeTokenProvider configures the bearer token source for function invoke routes.

type Package

type Package struct {
	Name        string
	Runtime     string
	Handler     string
	ArchiveData []byte
	Size        int64

	// VariableScope and Variables carry the volcano-config.yaml declaration for
	// this function. Both nil means the manifest declared nothing, so deploy
	// sends neither field and the server keeps the function's stored scope.
	VariableScope *string
	Variables     *[]string
}

Package contains one function source archive ready for API upload.

func PackageSource

func PackageSource(info SourceInfo, baseDir string) (*Package, error)

PackageSource packages a cloud function source bundle with manifests and shared libraries.

type RouteSource added in v0.42.0

type RouteSource struct {
	Frontend   string
	PathPrefix string
}

RouteSource is a frontend path that forwards requests to a function.

type RoutedFunctionError added in v0.42.0

type RoutedFunctionError struct {
	Name   string
	Routes []RouteSource
	Err    error
}

RoutedFunctionError reports a function that cannot leave public because frontend routes forward to it.

func (*RoutedFunctionError) Error added in v0.42.0

func (e *RoutedFunctionError) Error() string

func (*RoutedFunctionError) Unwrap added in v0.42.0

func (e *RoutedFunctionError) Unwrap() error

type RuntimeCatalog

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

RuntimeCatalog indexes API-provided default runtime metadata for local source detection.

func RuntimeCatalogFromOptions

func RuntimeCatalogFromOptions(options []apiclient.FunctionRuntimeOption) RuntimeCatalog

RuntimeCatalogFromOptions converts the API runtime catalog to scanner/package metadata.

type Service

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

Service performs authenticated Volcano function workflows.

func NewService

func NewService(deps cliruntime.Deps, opts ...Option) Service

NewService returns a function service.

func (Service) CreateSchedulerByID

func (s Service) CreateSchedulerByID(ctx context.Context, functionID uuid.UUID, input api.FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)

CreateSchedulerByID creates one scheduler for the given function ID.

func (Service) DeleteAlias added in v0.0.4

func (s Service) DeleteAlias(_ context.Context, alias string) error

DeleteAlias removes one function invoke alias for the current target.

func (Service) DeleteByID

func (s Service) DeleteByID(ctx context.Context, functionID uuid.UUID) error

DeleteByID starts deleting one function by ID.

func (Service) DeleteScheduler

func (s Service) DeleteScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) error

DeleteScheduler deletes one scheduler for a function.

func (Service) DeployPackage

func (s Service) DeployPackage(ctx context.Context, pkg Package) (*apiclient.Function, error)

DeployPackage deploys one packaged function source archive.

func (Service) DeployPackageBatch

func (s Service) DeployPackageBatch(ctx context.Context, packages []Package) (*apiclient.BatchFunctionDeployResponse, error)

DeployPackageBatch deploys one batch of packaged function source archives.

func (Service) DeploymentLogs

func (s Service) DeploymentLogs(ctx context.Context, functionID, deploymentID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)

DeploymentLogs returns one build log search page for a function deployment.

func (Service) DisableScheduler

func (s Service) DisableScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) (*apiclient.FunctionScheduler, error)

DisableScheduler disables one scheduler for a function.

func (Service) EnableScheduler

func (s Service) EnableScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) (*apiclient.FunctionScheduler, error)

EnableScheduler enables one scheduler for a function.

func (Service) Get

func (s Service) Get(ctx context.Context, identifier string) (*apiclient.Function, error)

Get returns one function by normalized name/path or UUID.

func (Service) Invoke added in v0.0.4

func (s Service) Invoke(ctx context.Context, identifier string, payload map[string]any) (*apiclient.FunctionInvocationResponse, error)

Invoke invokes one function by alias, normalized name/path, or UUID.

func (Service) InvokeByID added in v0.0.4

func (s Service) InvokeByID(ctx context.Context, functionID uuid.UUID, payload map[string]any) (*apiclient.FunctionInvocationResponse, error)

InvokeByID invokes one function by ID without list-based name resolution.

func (Service) ListAliases added in v0.0.4

func (s Service) ListAliases(_ context.Context) ([]Alias, error)

ListAliases returns configured function invoke aliases for the current target.

func (Service) ListPage

func (s Service) ListPage(ctx context.Context, page, limit int) (*apiclient.PaginatedFunctions, error)

ListPage returns one function page in the current project.

func (Service) ListRuntimes

func (s Service) ListRuntimes(ctx context.Context) ([]apiclient.FunctionRuntimeOption, error)

ListRuntimes returns the function runtime catalog.

func (Service) ListSchedulers

ListSchedulers returns schedulers configured for a function.

func (Service) Names added in v0.42.0

func (s Service) Names(ctx context.Context) (map[string]bool, error)

Names returns the names of every function in the current project.

func (Service) Resolve

func (s Service) Resolve(ctx context.Context, identifier string) (*apiclient.Function, error)

Resolve returns a function by normalized name/path or UUID in the current project.

func (Service) ResolveDeployment

func (s Service) ResolveDeployment(ctx context.Context, functionID uuid.UUID, deploymentID string) (*apiclient.FunctionDeployment, error)

ResolveDeployment returns a deployment by ID, paging internally.

func (Service) RoutedFrom added in v0.42.0

func (s Service) RoutedFrom(ctx context.Context, functionID uuid.UUID) ([]RouteSource, error)

RoutedFrom lists the frontend routes that forward to a function.

func (Service) RuntimeCatalog

func (s Service) RuntimeCatalog(ctx context.Context) (RuntimeCatalog, error)

RuntimeCatalog returns deploy runtime metadata from the function runtime catalog.

func (Service) RuntimeLogs

func (s Service) RuntimeLogs(ctx context.Context, functionID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)

RuntimeLogs returns one runtime log search page for a function.

func (Service) SetAlias added in v0.0.4

func (s Service) SetAlias(_ context.Context, alias, functionIDText string) (Alias, error)

SetAlias configures one function invoke alias for the current target.

func (Service) StreamDeploymentLogs added in v0.0.4

func (s Service) StreamDeploymentLogs(ctx context.Context, functionID, deploymentID uuid.UUID, limit int) (*api.ProjectLogStream, error)

StreamDeploymentLogs opens a build log stream for a function deployment.

func (Service) StreamRuntimeLogs added in v0.0.4

func (s Service) StreamRuntimeLogs(ctx context.Context, functionID uuid.UUID, limit int, lastEventID string) (*api.ProjectLogStream, error)

StreamRuntimeLogs opens a runtime log stream for a function, resuming after lastEventID when it is set.

func (Service) UpdateSchedulerByID added in v0.0.4

func (s Service) UpdateSchedulerByID(ctx context.Context, functionID, schedulerID uuid.UUID, input api.FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)

UpdateSchedulerByID updates one scheduler by ID, preserving the scheduler UUID.

func (Service) UpdateVisibility

func (s Service) UpdateVisibility(ctx context.Context, identifier string, visibility apiclient.FunctionVisibility) (*apiclient.Function, error)

UpdateVisibility sets who can invoke one function.

type SharedLibrary

type SharedLibrary struct {
	Path  string
	Name  string
	IsDir bool
}

SharedLibrary represents a shared function library file or directory.

func FindSharedLibraries

func FindSharedLibraries(baseDir string) ([]SharedLibrary, error)

FindSharedLibraries finds underscore-prefixed files and directories below volcano/ and volcano/functions/.

type SourceInfo

type SourceInfo struct {
	Path    string
	Name    string
	Runtime apiclient.FunctionRuntimeOption
	IsDir   bool
}

SourceInfo represents one discovered deployable function source.

func ScanSources

func ScanSources(baseDir string, catalog RuntimeCatalog) ([]SourceInfo, error)

ScanSources scans volcano/functions for top-level function files and directories.

Jump to

Keyboard shortcuts

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