Files
services/function/proto/function.proto
Asim Aslam ec9b7893b1 support deploying from source (#397)
* support deploying from source

* bump go version
2022-03-03 14:20:22 +00:00

191 lines
4.4 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/struct.proto";
package function;
option go_package = "./proto;function";
service Function {
rpc Call(CallRequest) returns (CallResponse) {}
rpc Deploy(DeployRequest) returns (DeployResponse) {}
rpc List(ListRequest) returns (ListResponse) {}
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
rpc Describe(DescribeRequest) returns (DescribeResponse) {}
rpc Update(UpdateRequest) returns (UpdateResponse) {}
rpc Proxy(ProxyRequest) returns (ProxyResponse) {}
rpc Regions(RegionsRequest) returns (RegionsResponse) {}
rpc Reserve(ReserveRequest) returns (ReserveResponse) {}
rpc Runtimes(RuntimesRequest) returns (RuntimesResponse) {}
}
// Call a function by name
message CallRequest {
// Name of the function
string name = 1;
// Request body that will be passed to the function
google.protobuf.Struct request = 2;
}
message CallResponse {
// Response body that the function returned
google.protobuf.Struct response = 1;
}
// Deploy a group of functions
message DeployRequest {
// function name
string name = 1;
// inline source code
string source = 2;
// github url for a repo
string repo = 3;
// branch to deploy. defaults to master
string branch = 4;
// optional subfolder path
string subfolder = 5;
// entry point, ie. handler name in the source code
// if not provided, defaults to the name parameter
string entrypoint = 6;
// runtime/lanaguage of the function e.g php74,
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16,
// dotnet3, java11, ruby26, ruby27, go111, go113, go116,
// python37, python38, python39
string runtime = 7;
// region to deploy in. defaults to europe-west1
string region = 8;
// environment variables to pass in at runtime
map<string,string> env_vars = 9;
}
message DeployResponse {
Func function = 1;
}
// List all the deployed functions
message ListRequest {
}
message Func {
// id of the function
string id = 1;
// function name
// limitation: must be unique across projects
string name = 2;
// the source code
string source = 3;
// git repo address
string repo = 4;
// branch to deploy. defaults to master
string branch = 5;
// name of handler in source code
string entrypoint = 6;
// subfolder path to entrypoint
string subfolder = 7;
// runtime/language of the function e.g php74,
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16,
// dotnet3, java11, ruby26, ruby27, go111, go113, go116,
// python37, python38, python39
string runtime = 8;
// region to deploy in. defaults to europe-west1
string region = 9;
// associated env vars
map<string,string> env_vars = 10;
// eg. ACTIVE, DEPLOY_IN_PROGRESS, OFFLINE etc
string status = 11;
// unique url of the function
string url = 12;
// time of creation
string created = 13;
// time it was updated
string updated = 14;
}
message ListResponse {
// List of functions deployed
repeated Func functions = 1;
}
// Delete a function by name
message DeleteRequest {
// The name of the function
string name = 1;
}
message DeleteResponse {
}
// Get the info for a deployed function
message DescribeRequest {
// The name of the function
string name = 1;
}
message DescribeResponse {
// The function requested
Func function = 1;
}
// Update a function. Downloads the source, builds and redeploys
message UpdateRequest {
// function name
string name = 1;
// inline source code
string source = 2;
}
message UpdateResponse {
}
// Return the backend url for proxying
message ProxyRequest {
// id of the function
string id = 1;
}
message ProxyResponse {
// backend url
string url = 1;
}
// Return a list of supported regions
message RegionsRequest {
}
message RegionsResponse {
repeated string regions = 1;
}
// Reservation represents a reserved function
message Reservation {
// name of the app
string name = 1;
// owner id
string owner = 2;
// associated token
string token = 3;
// time of reservation
string created = 4;
// time reservation expires
string expires = 5;
}
// Reserve function names and resources beyond free quota
message ReserveRequest {
// name of your app e.g helloworld
string name = 1;
}
message ReserveResponse {
// The app reservation
Reservation reservation = 1;
}
// Return a list of supported runtimes
message RuntimesRequest {
}
message RuntimesResponse {
repeated string runtimes = 1;
}