functions.v1.FunctionsService, with messages in
protos/functions/v1/functions.proto and protos/functions/v1/common.proto.
See Functions and versions for
the model.
RPCs
FunctionSpec
Every version is built from aFunctionSpec.
INVOCATION_PROTOCOL_RUNTIME_API is defined in the protos but returns
unimplemented. A missing image or protocol, or a contract that does not
compile, is invalid_argument. See Contracts
for writing one.
A Source carries files, each with a path relative to /app and its
content. The server packs them into a tar archive in the artifacts bucket,
records the archive as source.layer (key, sha256), and keeps each file’s
path and size on the stored spec without its content. A spec that sends
files with no content and names a layer reuses that archive, which is how a
version’s own spec is sent back to build it again. Source needs
ARTIFACTS_BUCKET on the server, or the call is failed_precondition.
Function settings
These live on the function, not the version, and apply to the next invocation of any version.name is required, trimmed, at most 128 bytes and unique within the tenant.
CreateFunction
Request fields:name, description, spec, secret_values, timeout_ms,
max_concurrency, resources, retries and network. The response carries the new
function and its first version, which returns in
FUNCTION_VERSION_STATUS_BUILDING. The build runs in the background on the
least busy live host.
secret_values maps environment variable names to values. Each is stored as a
new tenant secret and named in the version’s spec.secrets. See
Secrets.
A name already in use is already_exists. If the function is saved but the
server cannot hand its settings to the hosts, the call is unavailable and
asks you to save again.
int64 fields such as timeoutMs are strings in Connect JSON.
UpdateFunction
Sendfunction_id and the full name and description, which are always
written. timeout_ms, max_concurrency, resources, retries and
network change only when set, with the same defaults and bounds as on
create. A resources or network change takes effect on the next invocation,
and each host snapshots the function again the first time it runs it. An unknown
function_id is not_found, and a name in use is already_exists.
GetFunction
Takesid and include_versions. The Function carries its settings, its
current_version (the newest version that reached READY, which Invoke
runs by default), created_by_user_id and updated_by_user_id, and every
version when include_versions is set. Stamps such as created_at are epoch
milliseconds, with 0 meaning unset. An unknown id is not_found.
ListFunctions
Takespagination and search, which filters by name. Results are oldest
first. Pagination is described in the
overview.
DeleteFunction
Takesid. Deletes the function with its versions and invocations. An unknown
id is not_found.
CreateFunctionVersion
Takesfunction_id, spec and secret_values, and returns the new version
in BUILDING. Version numbers increase by one per function. The version
becomes the function’s current_version once it reaches READY. An unknown
function is not_found.
GetFunctionVersion
Takesfunction_id and version, the version number. For a function built
from source, each file’s content is read back from the artifacts bucket.
A missing function or version is not_found.
Builds are asynchronous. Poll
GetFunctionVersion until status leaves
BUILDING. A build is bounded at 5 minutes. A server that stops mid-build
leaves it for another server to take over.
ListFunctionVersions
Takesfunction_id and pagination. Results are newest first and omit file
content. An unknown function is not_found.
ListRuntimes
Takes no fields. Returnsruntimes and the source limits (max_files,
max_bytes).
See Runtimes and builds for what
each runtime image provides.