functions

package
v0.115.0-nightly Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildCmd = &cobra.Command{
	Use:   "build [directory]",
	Short: "Build a function to WASM using TinyGo",
	Long: `Compiles function.go in the given directory (or current directory) to a WASM binary.
Requires TinyGo to be installed (https://tinygo.org/getting-started/install/).`,
	Args: cobra.MaximumNArgs(1),
	RunE: runBuild,
}

BuildCmd compiles a function to WASM using TinyGo.

View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete <name>",
	Short: "Delete a deployed function",
	Long:  "Deletes a function from the Orama Network. This action cannot be undone.",
	Args:  cobra.ExactArgs(1),
	RunE:  runDelete,
}

DeleteCmd deletes a deployed function.

View Source
var DeployCmd = &cobra.Command{
	Use:   "deploy [directory]",
	Short: "Deploy a function to the Orama Network",
	Long: `Deploys the function in the given directory (or current directory).
If no .wasm file exists, it will be built automatically using TinyGo.
Reads configuration from function.yaml.`,
	Args: cobra.MaximumNArgs(1),
	RunE: runDeploy,
}

DeployCmd deploys a function to the Orama Network.

View Source
var GetCmd = &cobra.Command{
	Use:   "get <name>",
	Short: "Get details of a deployed function",
	Long:  "Retrieves and displays detailed information about a specific function.",
	Args:  cobra.ExactArgs(1),
	RunE:  runGet,
}

GetCmd shows details of a deployed function.

View Source
var InitCmd = &cobra.Command{
	Use:   "init <name>",
	Short: "Create a new serverless function project",
	Long:  "Scaffolds a new directory with function.go and function.yaml templates.",
	Args:  cobra.ExactArgs(1),
	RunE:  runInit,
}

InitCmd scaffolds a new function project.

View Source
var InvokeCmd = &cobra.Command{
	Use:   "invoke <name>",
	Short: "Invoke a deployed function",
	Long:  "Sends a request to invoke the named function with optional JSON payload.",
	Args:  cobra.ExactArgs(1),
	RunE:  runInvoke,
}

InvokeCmd invokes a deployed function.

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List deployed functions",
	Long:  "Lists all functions deployed in the current namespace.",
	Args:  cobra.NoArgs,
	RunE:  runList,
}

ListCmd lists all deployed functions.

View Source
var LogsCmd = &cobra.Command{
	Use:   "logs <name>",
	Short: "Get execution logs for a function",
	Long:  "Retrieves the most recent execution logs for a deployed function.",
	Args:  cobra.ExactArgs(1),
	RunE:  runLogs,
}

LogsCmd retrieves function execution logs.

View Source
var SecretsCmd = &cobra.Command{
	Use:   "secrets",
	Short: "Manage function secrets",
	Long: `Set, list, and delete encrypted secrets for your serverless functions.

Functions access secrets at runtime via the get_secret() host function.
Secrets are scoped to your namespace and encrypted at rest with AES-256-GCM.

Examples:
  orama function secrets set API_KEY "sk-abc123"
  orama function secrets set CERT_PEM --from-file ./cert.pem
  orama function secrets list
  orama function secrets delete API_KEY`,
}

SecretsCmd is the parent command for secrets management.

View Source
var SecretsDeleteCmd = &cobra.Command{
	Use:   "delete <name>",
	Short: "Delete a secret",
	Long:  "Permanently deletes a secret. Functions will no longer be able to access it.",
	Args:  cobra.ExactArgs(1),
	RunE:  runSecretsDelete,
}

SecretsDeleteCmd deletes a secret.

View Source
var SecretsListCmd = &cobra.Command{
	Use:   "list",
	Short: "List secret names",
	Long:  "Lists all secret names in the current namespace. Values are never shown.",
	Args:  cobra.NoArgs,
	RunE:  runSecretsList,
}

SecretsListCmd lists secret names.

View Source
var SecretsSetCmd = &cobra.Command{
	Use:   "set <name> [value]",
	Short: "Set a secret",
	Long:  `Stores an encrypted secret. Functions access it via get_secret("name"). If --from-file is used, value is read from the file instead.`,
	Args:  cobra.RangeArgs(1, 2),
	RunE:  runSecretsSet,
}

SecretsSetCmd stores an encrypted secret.

View Source
var TriggersAddCmd = &cobra.Command{
	Use:   "add <function-name>",
	Short: "Add a PubSub trigger",
	Long:  "Registers a PubSub trigger so the function is invoked when a message is published to the topic.",
	Args:  cobra.ExactArgs(1),
	RunE:  runTriggersAdd,
}

TriggersAddCmd adds a PubSub trigger to a function.

View Source
var TriggersCmd = &cobra.Command{
	Use:   "triggers",
	Short: "Manage function PubSub triggers",
	Long: `Add, list, and delete PubSub triggers for your serverless functions.

When a message is published to a topic, all functions with a trigger on
that topic are automatically invoked with the message as input.

Examples:
  orama function triggers add my-function --topic calls:invite
  orama function triggers list my-function
  orama function triggers delete my-function <trigger-id>`,
}

TriggersCmd is the parent command for trigger management.

View Source
var TriggersDeleteCmd = &cobra.Command{
	Use:   "delete <function-name> <trigger-id>",
	Short: "Delete a trigger",
	Args:  cobra.ExactArgs(2),
	RunE:  runTriggersDelete,
}

TriggersDeleteCmd deletes a trigger.

View Source
var TriggersListCmd = &cobra.Command{
	Use:   "list <function-name>",
	Short: "List triggers for a function",
	Args:  cobra.ExactArgs(1),
	RunE:  runTriggersList,
}

TriggersListCmd lists triggers for a function.

View Source
var VersionsCmd = &cobra.Command{
	Use:   "versions <name>",
	Short: "List all versions of a function",
	Long:  "Shows all deployed versions of a specific function.",
	Args:  cobra.ExactArgs(1),
	RunE:  runVersions,
}

VersionsCmd lists all versions of a function.

Functions

func ResolveFunctionDir

func ResolveFunctionDir(dir string) (string, error)

ResolveFunctionDir resolves and validates a function directory. If dir is empty, uses the current working directory.

func ValidateWASM

func ValidateWASM(data []byte) error

ValidateWASM checks that the given bytes are a valid WASM binary (magic number check).

func ValidateWASMFile

func ValidateWASMFile(path string) error

ValidateWASMFile checks that the file at the given path is a valid WASM binary.

Types

type FunctionConfig

type FunctionConfig struct {
	Name    string            `yaml:"name"`
	Public  bool              `yaml:"public"`
	Memory  int               `yaml:"memory"`
	Timeout int               `yaml:"timeout"`
	Retry   RetryConfig       `yaml:"retry"`
	Env     map[string]string `yaml:"env"`
}

FunctionConfig represents the function.yaml configuration.

func LoadConfig

func LoadConfig(dir string) (*FunctionConfig, error)

LoadConfig reads and parses a function.yaml from the given directory.

type RetryConfig

type RetryConfig struct {
	Count int `yaml:"count"`
	Delay int `yaml:"delay"`
}

RetryConfig holds retry settings.

Jump to

Keyboard shortcuts

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