gateway

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gateway is the single source of truth for Edge Function branch-gateway operations: the endpoint paths, request body structures, and HTTP calls for deploy / get / body / delete are defined once here and shared by CLI commands (internal/functions/*) and MCP tools. Callers are responsible only for assembling the request (CLI reads files from disk; MCP takes code from string parameters); all transport details are handled here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, access volcengine.PgMetaAccess, slug string) error

Delete deletes an Edge Function.

func Deploy

func Deploy(ctx context.Context, access volcengine.PgMetaAccess, req DeployRequest) ([]byte, error)

Deploy creates or updates an Edge Function and returns the raw gateway response body.

func GetMetadata

func GetMetadata(ctx context.Context, access volcengine.PgMetaAccess, slug string) ([]byte, error)

GetMetadata fetches the metadata of a single Edge Function as raw JSON.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether a gateway error is a 404 (function not found).

Types

type BodyResponse

type BodyResponse struct {
	Version int    `json:"version"`
	Files   []File `json:"files"`
}

BodyResponse is the set of source files returned by the function body endpoint.

func GetBody

func GetBody(ctx context.Context, access volcengine.PgMetaAccess, slug string) (BodyResponse, error)

GetBody fetches the source files of an Edge Function.

type DeployMetadata

type DeployMetadata struct {
	EntrypointPath string `json:"entrypoint_path"`
	Name           string `json:"name"`
	Runtime        string `json:"runtime"`
	VerifyJWT      *bool  `json:"verify_jwt,omitempty"`
	ImportMapPath  string `json:"import_map_path,omitempty"`
}

DeployMetadata is the metadata for a deploy request.

type DeployRequest

type DeployRequest struct {
	ProjectRef string         `json:"projectRef,omitempty"`
	Slug       string         `json:"slug,omitempty"`
	Metadata   DeployMetadata `json:"metadata"`
	Files      []File         `json:"files"`
}

DeployRequest is the request body for a deploy call.

type File

type File struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

File is a single function source file in a gateway request/response.

Jump to

Keyboard shortcuts

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