proto: have route put return route object
This commit is contained in:
parent
ce15a735ed
commit
811795d174
|
@ -213,12 +213,12 @@ retry_netrc:
|
||||||
|
|
||||||
switch cmdline {
|
switch cmdline {
|
||||||
case "route create":
|
case "route create":
|
||||||
idr, err := rc.Put(ctx, &proto.Route{Host: *routesCreateDomain})
|
rt, err := rc.Put(ctx, &proto.Route{Host: *routesCreateDomain})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ln.FatalErr(ctx, err, ln.Action("create new route"))
|
ln.FatalErr(ctx, err, ln.Action("create new route"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("created route with id " + idr.Id)
|
fmt.Printf("created route for domain %s, id: %s\n", rt.Host, rt.Id)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ func (r *Route) GetAll(ctx context.Context, req *proto.Nil) (*proto.GetAllRoutes
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Route) Put(ctx context.Context, rt *proto.Route) (*proto.IDResponse, error) {
|
func (r *Route) Put(ctx context.Context, rt *proto.Route) (*proto.Route, error) {
|
||||||
clitok, err := r.getAuth(ctx, "put new route", "route:put")
|
clitok, err := r.getAuth(ctx, "put new route", "route:put")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, handleError(ctx, clitok, err, ln.F{"action": "Route.Put_getAuth"})
|
return nil, handleError(ctx, clitok, err, ln.F{"action": "Route.Put_getAuth"})
|
||||||
|
@ -77,12 +77,10 @@ func (r *Route) Put(ctx context.Context, rt *proto.Route) (*proto.IDResponse, er
|
||||||
|
|
||||||
ln.Log(ctx, drt, ln.Action("created new route"))
|
ln.Log(ctx, drt, ln.Action("created new route"))
|
||||||
|
|
||||||
return &proto.IDResponse{
|
return drt.AsProto(), nil
|
||||||
Id: drt.ID,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Route) Delete(ctx context.Context, rt *proto.Route) (*proto.IDResponse, error) {
|
func (r *Route) Delete(ctx context.Context, rt *proto.Route) (*proto.Nil, error) {
|
||||||
clitok, err := r.getAuth(ctx, "delete single route", "route:delete")
|
clitok, err := r.getAuth(ctx, "delete single route", "route:delete")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, handleError(ctx, clitok, err, ln.F{"action": "Route.Delete_getAuth"})
|
return nil, handleError(ctx, clitok, err, ln.F{"action": "Route.Delete_getAuth"})
|
||||||
|
@ -107,5 +105,5 @@ func (r *Route) Delete(ctx context.Context, rt *proto.Route) (*proto.IDResponse,
|
||||||
f["action"] = "deleted route from database"
|
f["action"] = "deleted route from database"
|
||||||
ln.Log(ctx, f, drt)
|
ln.Log(ctx, f, drt)
|
||||||
|
|
||||||
return &proto.IDResponse{Id: rt.Id}, nil
|
return &proto.Nil{}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ It has these top-level messages:
|
||||||
GetRouteRequest
|
GetRouteRequest
|
||||||
Route
|
Route
|
||||||
GetAllRoutesResponse
|
GetAllRoutesResponse
|
||||||
IDResponse
|
|
||||||
Token
|
Token
|
||||||
TokenSet
|
TokenSet
|
||||||
GetTokenRequest
|
GetTokenRequest
|
||||||
|
@ -44,6 +43,7 @@ var _ = math.Inf
|
||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
|
// Nil represents nothing.
|
||||||
type Nil struct {
|
type Nil struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +52,11 @@ func (m *Nil) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Nil) ProtoMessage() {}
|
func (*Nil) ProtoMessage() {}
|
||||||
func (*Nil) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
func (*Nil) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||||
|
|
||||||
|
// GetRouteRequest specifies the host or id of the route that the user wants
|
||||||
|
// to fetch.
|
||||||
type GetRouteRequest struct {
|
type GetRouteRequest struct {
|
||||||
Host string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"`
|
Host string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"`
|
||||||
|
Id string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *GetRouteRequest) Reset() { *m = GetRouteRequest{} }
|
func (m *GetRouteRequest) Reset() { *m = GetRouteRequest{} }
|
||||||
|
@ -68,6 +71,14 @@ func (m *GetRouteRequest) GetHost() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *GetRouteRequest) GetId() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route is a single HTTP route.
|
||||||
type Route struct {
|
type Route struct {
|
||||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||||
Creator string `protobuf:"bytes,2,opt,name=creator" json:"creator,omitempty"`
|
Creator string `protobuf:"bytes,2,opt,name=creator" json:"creator,omitempty"`
|
||||||
|
@ -100,6 +111,7 @@ func (m *Route) GetHost() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAllRoutesResponse encapsulates a list of routes.
|
||||||
type GetAllRoutesResponse struct {
|
type GetAllRoutesResponse struct {
|
||||||
Routes []*Route `protobuf:"bytes,1,rep,name=routes" json:"routes,omitempty"`
|
Routes []*Route `protobuf:"bytes,1,rep,name=routes" json:"routes,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -116,22 +128,8 @@ func (m *GetAllRoutesResponse) GetRoutes() []*Route {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type IDResponse struct {
|
// Token is an individual authentication token. Id and Body will usually be
|
||||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
// unique ID's or other cryptographic identifiers.
|
||||||
}
|
|
||||||
|
|
||||||
func (m *IDResponse) Reset() { *m = IDResponse{} }
|
|
||||||
func (m *IDResponse) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*IDResponse) ProtoMessage() {}
|
|
||||||
func (*IDResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
|
||||||
|
|
||||||
func (m *IDResponse) GetId() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Id
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type Token struct {
|
type Token struct {
|
||||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||||
Body string `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"`
|
Body string `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"`
|
||||||
|
@ -142,7 +140,7 @@ type Token struct {
|
||||||
func (m *Token) Reset() { *m = Token{} }
|
func (m *Token) Reset() { *m = Token{} }
|
||||||
func (m *Token) String() string { return proto.CompactTextString(m) }
|
func (m *Token) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Token) ProtoMessage() {}
|
func (*Token) ProtoMessage() {}
|
||||||
func (*Token) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
func (*Token) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||||
|
|
||||||
func (m *Token) GetId() string {
|
func (m *Token) GetId() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -172,6 +170,7 @@ func (m *Token) GetActive() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tokenset encapsulates a list of tokens.
|
||||||
type TokenSet struct {
|
type TokenSet struct {
|
||||||
Tokens []*Token `protobuf:"bytes,1,rep,name=tokens" json:"tokens,omitempty"`
|
Tokens []*Token `protobuf:"bytes,1,rep,name=tokens" json:"tokens,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -179,7 +178,7 @@ type TokenSet struct {
|
||||||
func (m *TokenSet) Reset() { *m = TokenSet{} }
|
func (m *TokenSet) Reset() { *m = TokenSet{} }
|
||||||
func (m *TokenSet) String() string { return proto.CompactTextString(m) }
|
func (m *TokenSet) String() string { return proto.CompactTextString(m) }
|
||||||
func (*TokenSet) ProtoMessage() {}
|
func (*TokenSet) ProtoMessage() {}
|
||||||
func (*TokenSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
func (*TokenSet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||||
|
|
||||||
func (m *TokenSet) GetTokens() []*Token {
|
func (m *TokenSet) GetTokens() []*Token {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -196,7 +195,7 @@ type GetTokenRequest struct {
|
||||||
func (m *GetTokenRequest) Reset() { *m = GetTokenRequest{} }
|
func (m *GetTokenRequest) Reset() { *m = GetTokenRequest{} }
|
||||||
func (m *GetTokenRequest) String() string { return proto.CompactTextString(m) }
|
func (m *GetTokenRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*GetTokenRequest) ProtoMessage() {}
|
func (*GetTokenRequest) ProtoMessage() {}
|
||||||
func (*GetTokenRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
func (*GetTokenRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||||
|
|
||||||
func (m *GetTokenRequest) GetToken() string {
|
func (m *GetTokenRequest) GetToken() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -225,7 +224,7 @@ type Backend struct {
|
||||||
func (m *Backend) Reset() { *m = Backend{} }
|
func (m *Backend) Reset() { *m = Backend{} }
|
||||||
func (m *Backend) String() string { return proto.CompactTextString(m) }
|
func (m *Backend) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Backend) ProtoMessage() {}
|
func (*Backend) ProtoMessage() {}
|
||||||
func (*Backend) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
func (*Backend) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||||
|
|
||||||
func (m *Backend) GetId() string {
|
func (m *Backend) GetId() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -284,7 +283,7 @@ type BackendList struct {
|
||||||
func (m *BackendList) Reset() { *m = BackendList{} }
|
func (m *BackendList) Reset() { *m = BackendList{} }
|
||||||
func (m *BackendList) String() string { return proto.CompactTextString(m) }
|
func (m *BackendList) String() string { return proto.CompactTextString(m) }
|
||||||
func (*BackendList) ProtoMessage() {}
|
func (*BackendList) ProtoMessage() {}
|
||||||
func (*BackendList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
|
func (*BackendList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||||
|
|
||||||
func (m *BackendList) GetBs() *BackendSelector {
|
func (m *BackendList) GetBs() *BackendSelector {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -308,7 +307,7 @@ type BackendSelector struct {
|
||||||
func (m *BackendSelector) Reset() { *m = BackendSelector{} }
|
func (m *BackendSelector) Reset() { *m = BackendSelector{} }
|
||||||
func (m *BackendSelector) String() string { return proto.CompactTextString(m) }
|
func (m *BackendSelector) String() string { return proto.CompactTextString(m) }
|
||||||
func (*BackendSelector) ProtoMessage() {}
|
func (*BackendSelector) ProtoMessage() {}
|
||||||
func (*BackendSelector) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
|
func (*BackendSelector) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
|
||||||
|
|
||||||
func (m *BackendSelector) GetDomain() string {
|
func (m *BackendSelector) GetDomain() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -331,7 +330,7 @@ type BackendID struct {
|
||||||
func (m *BackendID) Reset() { *m = BackendID{} }
|
func (m *BackendID) Reset() { *m = BackendID{} }
|
||||||
func (m *BackendID) String() string { return proto.CompactTextString(m) }
|
func (m *BackendID) String() string { return proto.CompactTextString(m) }
|
||||||
func (*BackendID) ProtoMessage() {}
|
func (*BackendID) ProtoMessage() {}
|
||||||
func (*BackendID) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
|
func (*BackendID) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
|
||||||
|
|
||||||
func (m *BackendID) GetId() string {
|
func (m *BackendID) GetId() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
@ -345,7 +344,6 @@ func init() {
|
||||||
proto.RegisterType((*GetRouteRequest)(nil), "route.GetRouteRequest")
|
proto.RegisterType((*GetRouteRequest)(nil), "route.GetRouteRequest")
|
||||||
proto.RegisterType((*Route)(nil), "route.Route")
|
proto.RegisterType((*Route)(nil), "route.Route")
|
||||||
proto.RegisterType((*GetAllRoutesResponse)(nil), "route.GetAllRoutesResponse")
|
proto.RegisterType((*GetAllRoutesResponse)(nil), "route.GetAllRoutesResponse")
|
||||||
proto.RegisterType((*IDResponse)(nil), "route.IDResponse")
|
|
||||||
proto.RegisterType((*Token)(nil), "route.Token")
|
proto.RegisterType((*Token)(nil), "route.Token")
|
||||||
proto.RegisterType((*TokenSet)(nil), "route.TokenSet")
|
proto.RegisterType((*TokenSet)(nil), "route.TokenSet")
|
||||||
proto.RegisterType((*GetTokenRequest)(nil), "route.GetTokenRequest")
|
proto.RegisterType((*GetTokenRequest)(nil), "route.GetTokenRequest")
|
||||||
|
@ -366,10 +364,14 @@ const _ = grpc.SupportPackageIsVersion4
|
||||||
// Client API for Routes service
|
// Client API for Routes service
|
||||||
|
|
||||||
type RoutesClient interface {
|
type RoutesClient interface {
|
||||||
|
// Get fetches a single route based on the Host or ID.
|
||||||
Get(ctx context.Context, in *GetRouteRequest, opts ...grpc.CallOption) (*Route, error)
|
Get(ctx context.Context, in *GetRouteRequest, opts ...grpc.CallOption) (*Route, error)
|
||||||
|
// GetAll fetches all of the routes that the user owns.
|
||||||
GetAll(ctx context.Context, in *Nil, opts ...grpc.CallOption) (*GetAllRoutesResponse, error)
|
GetAll(ctx context.Context, in *Nil, opts ...grpc.CallOption) (*GetAllRoutesResponse, error)
|
||||||
Put(ctx context.Context, in *Route, opts ...grpc.CallOption) (*IDResponse, error)
|
// Put creates a new route based on user-supplied details.
|
||||||
Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*IDResponse, error)
|
Put(ctx context.Context, in *Route, opts ...grpc.CallOption) (*Route, error)
|
||||||
|
// Delete removes a route.
|
||||||
|
Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*Nil, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type routesClient struct {
|
type routesClient struct {
|
||||||
|
@ -398,8 +400,8 @@ func (c *routesClient) GetAll(ctx context.Context, in *Nil, opts ...grpc.CallOpt
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *routesClient) Put(ctx context.Context, in *Route, opts ...grpc.CallOption) (*IDResponse, error) {
|
func (c *routesClient) Put(ctx context.Context, in *Route, opts ...grpc.CallOption) (*Route, error) {
|
||||||
out := new(IDResponse)
|
out := new(Route)
|
||||||
err := grpc.Invoke(ctx, "/route.Routes/Put", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/route.Routes/Put", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -407,8 +409,8 @@ func (c *routesClient) Put(ctx context.Context, in *Route, opts ...grpc.CallOpti
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *routesClient) Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*IDResponse, error) {
|
func (c *routesClient) Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*Nil, error) {
|
||||||
out := new(IDResponse)
|
out := new(Nil)
|
||||||
err := grpc.Invoke(ctx, "/route.Routes/Delete", in, out, c.cc, opts...)
|
err := grpc.Invoke(ctx, "/route.Routes/Delete", in, out, c.cc, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -419,10 +421,14 @@ func (c *routesClient) Delete(ctx context.Context, in *Route, opts ...grpc.CallO
|
||||||
// Server API for Routes service
|
// Server API for Routes service
|
||||||
|
|
||||||
type RoutesServer interface {
|
type RoutesServer interface {
|
||||||
|
// Get fetches a single route based on the Host or ID.
|
||||||
Get(context.Context, *GetRouteRequest) (*Route, error)
|
Get(context.Context, *GetRouteRequest) (*Route, error)
|
||||||
|
// GetAll fetches all of the routes that the user owns.
|
||||||
GetAll(context.Context, *Nil) (*GetAllRoutesResponse, error)
|
GetAll(context.Context, *Nil) (*GetAllRoutesResponse, error)
|
||||||
Put(context.Context, *Route) (*IDResponse, error)
|
// Put creates a new route based on user-supplied details.
|
||||||
Delete(context.Context, *Route) (*IDResponse, error)
|
Put(context.Context, *Route) (*Route, error)
|
||||||
|
// Delete removes a route.
|
||||||
|
Delete(context.Context, *Route) (*Nil, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterRoutesServer(s *grpc.Server, srv RoutesServer) {
|
func RegisterRoutesServer(s *grpc.Server, srv RoutesServer) {
|
||||||
|
@ -822,41 +828,40 @@ var _Backends_serviceDesc = grpc.ServiceDesc{
|
||||||
func init() { proto.RegisterFile("route.proto", fileDescriptor0) }
|
func init() { proto.RegisterFile("route.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 565 bytes of a gzipped FileDescriptorProto
|
// 551 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x5d, 0x8b, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x5d, 0x8b, 0xd3, 0x40,
|
||||||
0x14, 0xcd, 0x47, 0x93, 0xb6, 0xb7, 0xb2, 0x5d, 0x2f, 0x65, 0x09, 0x5d, 0x1f, 0xca, 0xb8, 0xae,
|
0x14, 0xed, 0x24, 0x4d, 0xda, 0xde, 0xca, 0x76, 0xb9, 0x94, 0x12, 0xba, 0x2f, 0x65, 0x5c, 0xd6,
|
||||||
0x41, 0x71, 0x91, 0xae, 0xe0, 0x8b, 0x3e, 0x28, 0x95, 0x52, 0x94, 0x45, 0x52, 0xdf, 0x7c, 0x4a,
|
0x20, 0xb8, 0x48, 0x57, 0xf1, 0x45, 0x1f, 0x94, 0x4a, 0x59, 0x94, 0x45, 0xa6, 0xbe, 0xf9, 0x94,
|
||||||
0xda, 0x0b, 0x0d, 0x1b, 0x3b, 0x35, 0x33, 0x15, 0xfc, 0x29, 0xfe, 0x1e, 0x7f, 0x83, 0xff, 0x47,
|
0xb4, 0x17, 0x1a, 0x36, 0x76, 0x6a, 0x66, 0x2a, 0xf8, 0x53, 0xfc, 0x25, 0xfe, 0x12, 0xff, 0x8f,
|
||||||
0x72, 0x67, 0xfa, 0x91, 0x76, 0x95, 0x7d, 0x9b, 0x7b, 0xcf, 0x99, 0x9b, 0x73, 0xee, 0x9c, 0x40,
|
0x64, 0x66, 0xfa, 0x91, 0x64, 0xdd, 0xb7, 0xb9, 0xf7, 0x9c, 0xb9, 0x39, 0xe7, 0xce, 0x09, 0xf4,
|
||||||
0xa7, 0x94, 0x6b, 0x4d, 0x57, 0xab, 0x52, 0x6a, 0x89, 0x01, 0x17, 0x22, 0x00, 0xff, 0x26, 0x2f,
|
0x0b, 0xb9, 0xd3, 0x74, 0xbd, 0x2d, 0xa4, 0x96, 0x18, 0x98, 0x82, 0x07, 0xe0, 0xdf, 0x65, 0x39,
|
||||||
0xc4, 0x13, 0xe8, 0x8e, 0x49, 0x27, 0x55, 0x2b, 0xa1, 0xef, 0x6b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 0x1f,
|
||||||
0xfe, 0xa5, 0x2c, 0xe4, 0xff, 0xe6, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x00, 0xdd,
|
0x1c, 0x58, 0xf3, 0xfe, 0x04, 0x00, 0x00,
|
||||||
0xf1, 0x18, 0x05, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,93 +4,66 @@ syntax = "proto3";
|
||||||
|
|
||||||
package route;
|
package route;
|
||||||
|
|
||||||
// import "google/api/annotations.proto";
|
// Nil represents nothing.
|
||||||
|
|
||||||
message Nil {}
|
message Nil {}
|
||||||
|
|
||||||
|
// Routes lets users manage and manipulate http routes.
|
||||||
service Routes {
|
service Routes {
|
||||||
rpc Get(GetRouteRequest) returns (Route) {
|
// Get fetches a single route based on the Host or ID.
|
||||||
// option (google.api.http) = {
|
rpc Get(GetRouteRequest) returns (Route) {}
|
||||||
// get: "/v1/routes/{host}"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc GetAll(Nil) returns (GetAllRoutesResponse) {
|
// GetAll fetches all of the routes that the user owns.
|
||||||
// option (google.api.http) = {
|
rpc GetAll(Nil) returns (GetAllRoutesResponse) {}
|
||||||
// get: "/v1/routes"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc Put(Route) returns (IDResponse) {
|
// Put creates a new route based on user-supplied details.
|
||||||
// option (google.api.http) = {
|
rpc Put(Route) returns (Route) {}
|
||||||
// post: "/v1/routes"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc Delete(Route) returns (IDResponse) {
|
// Delete removes a route.
|
||||||
// option (google.api.http) = {
|
rpc Delete(Route) returns (Nil) {}
|
||||||
// delete: "/v1/routes/{host}"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetRouteRequest specifies the host or id of the route that the user wants
|
||||||
|
// to fetch.
|
||||||
message GetRouteRequest {
|
message GetRouteRequest {
|
||||||
string host = 1;
|
string host = 1;
|
||||||
|
string id = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Route is a single HTTP route.
|
||||||
message Route {
|
message Route {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string creator = 2;
|
string creator = 2;
|
||||||
string host = 3;
|
string host = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAllRoutesResponse encapsulates a list of routes.
|
||||||
message GetAllRoutesResponse {
|
message GetAllRoutesResponse {
|
||||||
repeated Route routes = 1;
|
repeated Route routes = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message IDResponse {
|
// Tokens lets a user manage the database authentication tokens.
|
||||||
string id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
service Tokens {
|
service Tokens {
|
||||||
rpc Get(GetTokenRequest) returns (Token) {
|
rpc Get(GetTokenRequest) returns (Token) {}
|
||||||
// option (google.api.http) = {
|
|
||||||
// get: "/v1/tokens/one"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc GetAll(Nil) returns (TokenSet) {
|
rpc GetAll(Nil) returns (TokenSet) {}
|
||||||
// option (google.api.http) = {
|
|
||||||
// get: "/v1/tokens"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc Put(Token) returns (Token) {
|
rpc Put(Token) returns (Token) {}
|
||||||
// option (google.api.http) = {
|
|
||||||
// post: "/v1/tokens"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc Delete(Token) returns (Nil) {
|
rpc Delete(Token) returns (Nil) {}
|
||||||
// option (google.api.http) = {
|
|
||||||
// delete: "/v1/tokens"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc Deactivate(Token) returns (Nil) {
|
rpc Deactivate(Token) returns (Nil) {}
|
||||||
// option (google.api.http) = {
|
|
||||||
// post: "/v1/tokens/deactivate"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Token is an individual authentication token. Id and Body will usually be
|
||||||
|
// unique ID's or other cryptographic identifiers.
|
||||||
message Token {
|
message Token {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string body = 2;
|
string body = 2; // the actual token used in authenitcation
|
||||||
repeated string scopes = 3;
|
repeated string scopes = 3; // the permissions the token has
|
||||||
bool active = 4;
|
bool active = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tokenset encapsulates a list of tokens.
|
||||||
message TokenSet {
|
message TokenSet {
|
||||||
repeated Token tokens = 1;
|
repeated Token tokens = 1;
|
||||||
}
|
}
|
||||||
|
@ -101,17 +74,9 @@ message GetTokenRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
service Backends {
|
service Backends {
|
||||||
rpc List(BackendSelector) returns (BackendList) {
|
rpc List(BackendSelector) returns (BackendList) {}
|
||||||
// option (google.api.http) = {
|
|
||||||
// get: "/v1/backends"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
rpc Kill(BackendID) returns (Nil) {
|
rpc Kill(BackendID) returns (Nil) {}
|
||||||
// option (google.api.http) = {
|
|
||||||
// post: "/v1/backends/{id}/kill"
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message Backend {
|
message Backend {
|
||||||
|
|
Loading…
Reference in New Issue