route/proto/route.proto

102 lines
1.7 KiB
Protocol Buffer

syntax = "proto3";
// option go_package = "git.xeserv.us/xena/route/routerpc/routegrpc;routegrpc";
package route;
import "google/api/annotations.proto";
message Nil {}
service Routes {
rpc Get(GetRouteRequest) returns (Route) {
option (google.api.http) = {
get: "/v1/routes/{host}"
};
}
rpc GetAll(Nil) returns (GetAllRoutesResponse) {
option (google.api.http) = {
get: "/v1/routes"
};
}
rpc Put(Route) returns (IDResponse) {
option (google.api.http) = {
post: "/v1/routes"
};
}
rpc Delete(Route) returns (IDResponse) {
option (google.api.http) = {
delete: "/v1/routes/{host}"
};
}
}
message GetRouteRequest {
string host = 1;
}
message Route {
string id = 1;
string creator = 2;
string host = 3;
}
message GetAllRoutesResponse {
repeated Route routes = 1;
}
message IDResponse {
string id = 1;
}
service Tokens {
rpc Get(GetTokenRequest) returns (Token) {
option (google.api.http) = {
get: "/v1/tokens/one"
};
}
rpc GetAll(Nil) returns (TokenSet) {
option (google.api.http) = {
get: "/v1/tokens"
};
}
rpc Put(Token) returns (IDResponse) {
option (google.api.http) = {
post: "/v1/tokens"
};
}
rpc Delete(Token) returns (Nil) {
option (google.api.http) = {
delete: "/v1/tokens"
};
}
rpc Deactivate(Token) returns (Nil) {
option (google.api.http) = {
post: "/v1/tokens/deactivate"
};
}
}
message Token {
string id = 1;
string body = 2;
repeated string scopes = 3;
bool active = 4;
}
message TokenSet {
repeated Token tokens = 1;
}
message GetTokenRequest {
string token = 1;
string id = 2;
}