Documentation
¶
Overview ¶
Package function builds and packages function archives for upload.
Index ¶
- func FormatSourceNames(sources []SourceInfo) string
- func MatchesTarget(source SourceInfo, target, baseDir string) bool
- type Alias
- type DurableFunctionError
- type InvokeTokenProvider
- type Option
- type Package
- type RouteSource
- type RoutedFunctionError
- type RuntimeCatalog
- type Service
- func (s Service) CreateSchedulerByID(ctx context.Context, functionID uuid.UUID, input api.FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)
- func (s Service) DeleteAlias(_ context.Context, alias string) error
- func (s Service) DeleteByID(ctx context.Context, functionID uuid.UUID) error
- func (s Service) DeleteScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) error
- func (s Service) DeployPackage(ctx context.Context, pkg Package) (*apiclient.Function, error)
- func (s Service) DeployPackageBatch(ctx context.Context, packages []Package) (*apiclient.BatchFunctionDeployResponse, error)
- func (s Service) DeploymentLogs(ctx context.Context, functionID, deploymentID uuid.UUID, limit int, ...) (*apiclient.LogSearchResponse, error)
- func (s Service) DisableScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) (*apiclient.FunctionScheduler, error)
- func (s Service) EnableScheduler(ctx context.Context, identifier string, schedulerID uuid.UUID) (*apiclient.FunctionScheduler, error)
- func (s Service) Get(ctx context.Context, identifier string) (*apiclient.Function, error)
- func (s Service) Invoke(ctx context.Context, identifier string, payload map[string]any) (*apiclient.FunctionInvocationResponse, error)
- func (s Service) InvokeByID(ctx context.Context, functionID uuid.UUID, payload map[string]any) (*apiclient.FunctionInvocationResponse, error)
- func (s Service) ListAliases(_ context.Context) ([]Alias, error)
- func (s Service) ListPage(ctx context.Context, page, limit int) (*apiclient.PaginatedFunctions, error)
- func (s Service) ListRuntimes(ctx context.Context) ([]apiclient.FunctionRuntimeOption, error)
- func (s Service) ListSchedulers(ctx context.Context, identifier string) (*apiclient.Function, *apiclient.FunctionSchedulerListResponse, error)
- func (s Service) Names(ctx context.Context) (map[string]bool, error)
- func (s Service) Resolve(ctx context.Context, identifier string) (*apiclient.Function, error)
- func (s Service) ResolveDeployment(ctx context.Context, functionID uuid.UUID, deploymentID string) (*apiclient.FunctionDeployment, error)
- func (s Service) RoutedFrom(ctx context.Context, functionID uuid.UUID) ([]RouteSource, error)
- func (s Service) RuntimeCatalog(ctx context.Context) (RuntimeCatalog, error)
- func (s Service) RuntimeLogs(ctx context.Context, functionID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)
- func (s Service) SetAlias(_ context.Context, alias, functionIDText string) (Alias, error)
- func (s Service) StreamDeploymentLogs(ctx context.Context, functionID, deploymentID uuid.UUID, limit int) (*api.ProjectLogStream, error)
- func (s Service) StreamRuntimeLogs(ctx context.Context, functionID uuid.UUID, limit int, lastEventID string) (*api.ProjectLogStream, error)
- func (s Service) UpdateSchedulerByID(ctx context.Context, functionID, schedulerID uuid.UUID, ...) (*apiclient.FunctionScheduler, error)
- func (s Service) UpdateVisibility(ctx context.Context, identifier string, ...) (*apiclient.Function, error)
- type SharedLibrary
- type SourceInfo
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 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
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
DeleteAlias removes one function invoke alias for the current target.
func (Service) DeleteByID ¶
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 ¶
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) 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
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 ¶
ListRuntimes returns the function runtime catalog.
func (Service) ListSchedulers ¶
func (s Service) ListSchedulers(ctx context.Context, identifier string) (*apiclient.Function, *apiclient.FunctionSchedulerListResponse, error)
ListSchedulers returns schedulers configured for a function.
func (Service) Names ¶ added in v0.42.0
Names returns the names of every function in the current project.
func (Service) Resolve ¶
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
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
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.
type SharedLibrary ¶
type SharedLibrary struct {
}
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.