Help us shape the future of Go! Take the 2026 Go Developer Survey

invoke

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LaunchSync

func LaunchSync(client *golangsdk.ServiceClient, funcUrn string, JSONBody interface{}, headers LaunchSyncHeaders) (*LaunchSyncResp, *LaunchSyncResponseHeaders, error)

LaunchSync is used to execute a function synchronously. Clients must wait for explicit responses to their requests from the function. Responses are returned only after function invocation is complete.

Types

type LaunchAsyncResp

type LaunchAsyncResp struct {
	RequestID string `json:"request_id"`
}

func LaunchAsync

func LaunchAsync(client *golangsdk.ServiceClient, funcUrn string, JSONBody interface{}) (*LaunchAsyncResp, error)

LaunchAsync is used to execute a function asynchronously.

type LaunchSyncHeaders added in v0.9.6

type LaunchSyncHeaders struct {
	// Options: tail (4 KB logs will be returned) and null (no logs will be returned).
	LogType string `json:"X-Cff-Log-Type"`

	// Dynamic memory allocation for function.
	// Options:
	// - empty or
	// - any value of 128, 256, 512, 768, 1,024, 1,280, 1,536, 1,792,
	//   2,048, 2,560, 3,072, 3,584, 4,096, 8,192, or 10,240
	// If not empty, dynamic memory allocation must be enabled for the function.
	InstanceMemory string `json:"X-Cff-Instance-Memory"`
}

LaunchSyncHeaders represents the request headers for a synchronous function invocation

func NewLaunchSyncHeaders added in v0.9.6

func NewLaunchSyncHeaders() LaunchSyncHeaders

NewLaunchSyncHeaders creates default headers for LaunchSync function invocation

type LaunchSyncResp

type LaunchSyncResp struct {
	// Request ID
	RequestID string `json:"request_id"`

	// Function execution result.
	Result string `json:"result"`

	// Function execution log.
	Log string `json:"log"`

	// Function execution status.
	Status int `json:"status"`
}

LaunchSyncResp represents the response from a synchronous function invocation

type LaunchSyncResponseHeaders added in v0.9.6

type LaunchSyncResponseHeaders struct {
	// Execution summary of the synchronous invocation.
	InvokeSummary string `json:"X-Cff-Invoke-Summary"`

	// Request ID of the synchronous invocation.
	RequestId string `json:"X-Cff-Request-Id"`

	// User log of the synchronous invocation.
	// Set X-Cff-Log-Type:tail in the request header.
	// Intercept and encode the last 2,000 bytes of the log using Base64.
	FunctionLog string `json:"X-Cff-Function-Log"`

	// Billing information of the synchronous invocation.
	BillingDuration string `json:"X-CFF-Billing-Duration"`

	// Response format:
	// - v0: text format
	// - v1: JSON format
	ResponseVersion string `json:"X-Cff-Response-Version"`

	// Error code of the synchronous invocation.
	// The value is 0 if the execution is successful.
	FuncErrCode string `json:"X-Func-Err-Code"`

	// Indicates whether the error occurs in a user function.
	IsFuncErr bool `json:"X-Is-Func-Err"`

	// AdditionalHeaders holds any additional headers not explicitly defined in the struct
	AdditionalHeaders map[string][]string `json:"-"`
}

LaunchSyncResponseHeaders represents the response headers from a synchronous function invocation

Jump to

Keyboard shortcuts

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