route/proto/route.proto

104 lines
2.1 KiB
Protocol Buffer

syntax = "proto3";
package xeserv.us.route;
option go_package = "proto";
// Nil represents nothing.
message Nil {}
// Routes lets users manage and manipulate http routes.
service Routes {
// Get fetches a single route based on the Host or ID.
rpc Get(GetRouteRequest) returns (Route) {}
// GetAll fetches all of the routes that the user owns.
rpc GetAll(Nil) returns (GetAllRoutesResponse) {}
// Put creates a new route based on user-supplied details.
rpc Put(Route) returns (Route) {}
// Delete removes a route.
rpc Delete(Route) returns (Nil) {}
}
// GetRouteRequest specifies the host or id of the route that the user wants
// to fetch.
message GetRouteRequest {
string unused = 1;
string id = 2;
}
// Route is a single HTTP route.
message Route {
string id = 1;
string creator = 2;
string host = 3;
}
// GetAllRoutesResponse encapsulates a list of routes.
message GetAllRoutesResponse {
repeated Route routes = 1;
}
// Tokens lets a user manage the database authentication tokens.
service Tokens {
rpc Get(GetTokenRequest) returns (Token) {}
rpc GetAll(Nil) returns (TokenSet) {}
rpc Put(Token) returns (Token) {}
rpc Delete(Token) returns (Nil) {}
rpc Deactivate(Token) returns (Nil) {}
}
// Token is an individual authentication token. Id and Body will usually be
// unique ID's or other cryptographic identifiers.
message Token {
string id = 1;
string body = 2; // the actual token used in authenitcation
repeated string scopes = 3; // the permissions the token has
bool active = 4;
}
// Tokenset encapsulates a list of tokens.
message TokenSet {
repeated Token tokens = 1;
}
message GetTokenRequest {
string token = 1;
string id = 2;
}
service Backends {
rpc List(BackendSelector) returns (BackendList) {}
rpc Kill(BackendID) returns (Nil) {}
}
message Backend {
string id = 1;
string proto = 2;
string user = 3;
string domain = 4;
float phi = 5;
string host = 6;
bool usable = 7;
}
message BackendList {
BackendSelector bs = 1;
repeated Backend backends = 2;
}
message BackendSelector {
string domain = 1;
string user = 2;
}
message BackendID {
string id = 1;
}