proto: add backend querying and management functions

This commit is contained in:
Cadey Ratio 2017-09-30 09:11:00 -07:00
parent 4394bb15a5
commit 1883feaacc
No known key found for this signature in database
GPG Key ID: D607EE27C2E7F89A
4 changed files with 614 additions and 99 deletions

View File

@ -17,6 +17,10 @@ It has these top-level messages:
Token Token
TokenSet TokenSet
GetTokenRequest GetTokenRequest
Backend
BackendList
BackendSelector
BackendID
*/ */
package route package route
@ -209,6 +213,126 @@ func (m *GetTokenRequest) GetId() string {
return "" return ""
} }
type Backend struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Proto string `protobuf:"bytes,2,opt,name=proto" json:"proto,omitempty"`
User string `protobuf:"bytes,3,opt,name=user" json:"user,omitempty"`
Domain string `protobuf:"bytes,4,opt,name=domain" json:"domain,omitempty"`
Phi float32 `protobuf:"fixed32,5,opt,name=phi" json:"phi,omitempty"`
Host string `protobuf:"bytes,6,opt,name=host" json:"host,omitempty"`
}
func (m *Backend) Reset() { *m = Backend{} }
func (m *Backend) String() string { return proto.CompactTextString(m) }
func (*Backend) ProtoMessage() {}
func (*Backend) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *Backend) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Backend) GetProto() string {
if m != nil {
return m.Proto
}
return ""
}
func (m *Backend) GetUser() string {
if m != nil {
return m.User
}
return ""
}
func (m *Backend) GetDomain() string {
if m != nil {
return m.Domain
}
return ""
}
func (m *Backend) GetPhi() float32 {
if m != nil {
return m.Phi
}
return 0
}
func (m *Backend) GetHost() string {
if m != nil {
return m.Host
}
return ""
}
type BackendList struct {
Bs *BackendSelector `protobuf:"bytes,1,opt,name=bs" json:"bs,omitempty"`
Backends []*Backend `protobuf:"bytes,2,rep,name=backends" json:"backends,omitempty"`
}
func (m *BackendList) Reset() { *m = BackendList{} }
func (m *BackendList) String() string { return proto.CompactTextString(m) }
func (*BackendList) ProtoMessage() {}
func (*BackendList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *BackendList) GetBs() *BackendSelector {
if m != nil {
return m.Bs
}
return nil
}
func (m *BackendList) GetBackends() []*Backend {
if m != nil {
return m.Backends
}
return nil
}
type BackendSelector struct {
Domain string `protobuf:"bytes,1,opt,name=domain" json:"domain,omitempty"`
User string `protobuf:"bytes,2,opt,name=user" json:"user,omitempty"`
}
func (m *BackendSelector) Reset() { *m = BackendSelector{} }
func (m *BackendSelector) String() string { return proto.CompactTextString(m) }
func (*BackendSelector) ProtoMessage() {}
func (*BackendSelector) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *BackendSelector) GetDomain() string {
if m != nil {
return m.Domain
}
return ""
}
func (m *BackendSelector) GetUser() string {
if m != nil {
return m.User
}
return ""
}
type BackendID struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
}
func (m *BackendID) Reset() { *m = BackendID{} }
func (m *BackendID) String() string { return proto.CompactTextString(m) }
func (*BackendID) ProtoMessage() {}
func (*BackendID) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *BackendID) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func init() { func init() {
proto.RegisterType((*Nil)(nil), "route.Nil") proto.RegisterType((*Nil)(nil), "route.Nil")
proto.RegisterType((*GetRouteRequest)(nil), "route.GetRouteRequest") proto.RegisterType((*GetRouteRequest)(nil), "route.GetRouteRequest")
@ -218,6 +342,10 @@ func init() {
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")
proto.RegisterType((*Backend)(nil), "route.Backend")
proto.RegisterType((*BackendList)(nil), "route.BackendList")
proto.RegisterType((*BackendSelector)(nil), "route.BackendSelector")
proto.RegisterType((*BackendID)(nil), "route.BackendID")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -587,39 +715,148 @@ var _Tokens_serviceDesc = grpc.ServiceDesc{
Metadata: "route.proto", Metadata: "route.proto",
} }
// Client API for Backends service
type BackendsClient interface {
List(ctx context.Context, in *BackendSelector, opts ...grpc.CallOption) (*BackendList, error)
Kill(ctx context.Context, in *BackendID, opts ...grpc.CallOption) (*Nil, error)
}
type backendsClient struct {
cc *grpc.ClientConn
}
func NewBackendsClient(cc *grpc.ClientConn) BackendsClient {
return &backendsClient{cc}
}
func (c *backendsClient) List(ctx context.Context, in *BackendSelector, opts ...grpc.CallOption) (*BackendList, error) {
out := new(BackendList)
err := grpc.Invoke(ctx, "/route.Backends/List", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *backendsClient) Kill(ctx context.Context, in *BackendID, opts ...grpc.CallOption) (*Nil, error) {
out := new(Nil)
err := grpc.Invoke(ctx, "/route.Backends/Kill", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Backends service
type BackendsServer interface {
List(context.Context, *BackendSelector) (*BackendList, error)
Kill(context.Context, *BackendID) (*Nil, error)
}
func RegisterBackendsServer(s *grpc.Server, srv BackendsServer) {
s.RegisterService(&_Backends_serviceDesc, srv)
}
func _Backends_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BackendSelector)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BackendsServer).List(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/route.Backends/List",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BackendsServer).List(ctx, req.(*BackendSelector))
}
return interceptor(ctx, in, info, handler)
}
func _Backends_Kill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BackendID)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BackendsServer).Kill(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/route.Backends/Kill",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BackendsServer).Kill(ctx, req.(*BackendID))
}
return interceptor(ctx, in, info, handler)
}
var _Backends_serviceDesc = grpc.ServiceDesc{
ServiceName: "route.Backends",
HandlerType: (*BackendsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "List",
Handler: _Backends_List_Handler,
},
{
MethodName: "Kill",
Handler: _Backends_Kill_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "route.proto",
}
func init() { proto.RegisterFile("route.proto", fileDescriptor0) } func init() { proto.RegisterFile("route.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 487 bytes of a gzipped FileDescriptorProto // 674 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xcd, 0x6e, 0xd3, 0x4c,
0x10, 0xc6, 0x15, 0x3b, 0x36, 0xed, 0xb4, 0x6a, 0xe9, 0x50, 0x82, 0x31, 0x45, 0x8a, 0x56, 0x20, 0x14, 0x95, 0xed, 0xd8, 0x4d, 0x6e, 0xaa, 0xb4, 0xbd, 0x5f, 0xbe, 0x60, 0xd2, 0x82, 0xa2, 0x11,
0x45, 0x3d, 0xd4, 0x10, 0x04, 0x08, 0xc4, 0x05, 0x91, 0x10, 0x71, 0xa9, 0x90, 0xcb, 0x8d, 0x93, 0xa0, 0xa8, 0x8b, 0x1a, 0x82, 0x00, 0x81, 0x60, 0x01, 0xb8, 0x94, 0x0a, 0x54, 0x21, 0x97, 0x1d,
0x9b, 0x8c, 0x8a, 0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 0x89, 0x9d, 0x7c, 0xa4, 0xce, 0x78, 0xc0, 0x33, 0x8a,
0x0f, 0x7f, 0x6b, 0xcc, 0x46, 0x19, 0x7b, 0x4c, 0x65, 0xd5, 0x0c, 0x0d, 0xc7, 0x7b, 0x55, 0x33,
0x54, 0xef, 0xca, 0x57, 0x2b, 0x3e, 0x18, 0xd8, 0xfd, 0x9a, 0x0f, 0x1a, 0x59, 0xfa, 0x7e, 0x81,
0xdb, 0x2d, 0xe3, 0xf6, 0x01, 0x42, 0xaa, 0xde, 0x73, 0xfc, 0x57, 0xec, 0x35, 0x85, 0xbd, 0x42,
0xfe, 0x2f, 0x29, 0x4d, 0x16, 0xc0, 0xd1, 0x37, 0x0b, 0x9a, 0x26, 0x7a, 0x02, 0x5f, 0x42, 0x43,
0xbd, 0x90, 0x3f, 0xbc, 0x8a, 0x3e, 0x56, 0xf7, 0xf3, 0x5e, 0xd2, 0x55, 0xf3, 0x3b, 0xb8, 0x9e,
0xcf, 0x2f, 0xde, 0x03, 0x86, 0xd0, 0x78, 0xc5, 0xd2, 0x14, 0x37, 0xab, 0x88, 0xc3, 0xb0, 0xc2,
0xed, 0xba, 0xc2, 0xfa, 0xa4, 0x57, 0xc6, 0x06, 0x17, 0x2c, 0xb9, 0x0c, 0xce, 0x58, 0x9a, 0x8e,
0x3d, 0xf5, 0x47, 0xb8, 0xfb, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x50, 0x50, 0x47, 0x10, 0x06,
0x00, 0x00,
} }

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-grpc-gateway // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: route.proto // source: route.proto
// DO NOT EDIT!
/* /*
Package route is a reverse proxy. Package route is a reverse proxy.
@ -20,10 +19,12 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/status"
) )
var _ codes.Code var _ codes.Code
var _ io.Reader var _ io.Reader
var _ status.Status
var _ = runtime.String var _ = runtime.String
var _ = utilities.NewDoubleArray var _ = utilities.NewDoubleArray
@ -40,13 +41,13 @@ func request_Routes_Get_0(ctx context.Context, marshaler runtime.Marshaler, clie
val, ok = pathParams["host"] val, ok = pathParams["host"]
if !ok { if !ok {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "host") return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "host")
} }
protoReq.Host, err = runtime.String(val) protoReq.Host, err = runtime.String(val)
if err != nil { if err != nil {
return nil, metadata, err return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "host", err)
} }
msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -72,7 +73,7 @@ func request_Routes_Put_0(ctx context.Context, marshaler runtime.Marshaler, clie
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Routes_Put_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Routes_Put_0); err != nil {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Put(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Put(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -97,17 +98,17 @@ func request_Routes_Delete_0(ctx context.Context, marshaler runtime.Marshaler, c
val, ok = pathParams["host"] val, ok = pathParams["host"]
if !ok { if !ok {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "host") return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "host")
} }
protoReq.Host, err = runtime.String(val) protoReq.Host, err = runtime.String(val)
if err != nil { if err != nil {
return nil, metadata, err return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "host", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Routes_Delete_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Routes_Delete_0); err != nil {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -124,7 +125,7 @@ func request_Tokens_Get_0(ctx context.Context, marshaler runtime.Marshaler, clie
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Get_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Get_0); err != nil {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -150,7 +151,7 @@ func request_Tokens_Put_0(ctx context.Context, marshaler runtime.Marshaler, clie
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Put_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Put_0); err != nil {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Put(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Put(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -167,7 +168,7 @@ func request_Tokens_Delete_0(ctx context.Context, marshaler runtime.Marshaler, c
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Delete_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Delete_0); err != nil {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -184,7 +185,7 @@ func request_Tokens_Deactivate_0(ctx context.Context, marshaler runtime.Marshale
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Deactivate_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Tokens_Deactivate_0); err != nil {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Deactivate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Deactivate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -192,6 +193,50 @@ func request_Tokens_Deactivate_0(ctx context.Context, marshaler runtime.Marshale
} }
var (
filter_Backends_List_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Backends_List_0(ctx context.Context, marshaler runtime.Marshaler, client BackendsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BackendSelector
var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Backends_List_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.List(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func request_Backends_Kill_0(ctx context.Context, marshaler runtime.Marshaler, client BackendsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BackendID
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["id"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
}
protoReq.Id, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
}
msg, err := client.Kill(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
// RegisterRoutesHandlerFromEndpoint is same as RegisterRoutesHandler but // RegisterRoutesHandlerFromEndpoint is same as RegisterRoutesHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterRoutesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { func RegisterRoutesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
@ -235,18 +280,19 @@ func RegisterRoutesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Routes_Get_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Routes_Get_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Routes_Get_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Routes_Get_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -263,18 +309,19 @@ func RegisterRoutesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Routes_GetAll_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Routes_GetAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Routes_GetAll_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Routes_GetAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -291,18 +338,19 @@ func RegisterRoutesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Routes_Put_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Routes_Put_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Routes_Put_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Routes_Put_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -319,18 +367,19 @@ func RegisterRoutesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Routes_Delete_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Routes_Delete_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Routes_Delete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Routes_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -400,18 +449,19 @@ func RegisterTokensHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Tokens_Get_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Tokens_Get_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Tokens_Get_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Tokens_Get_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -428,18 +478,19 @@ func RegisterTokensHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Tokens_GetAll_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Tokens_GetAll_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Tokens_GetAll_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Tokens_GetAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -456,18 +507,19 @@ func RegisterTokensHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Tokens_Put_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Tokens_Put_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Tokens_Put_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Tokens_Put_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -484,18 +536,19 @@ func RegisterTokensHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Tokens_Delete_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Tokens_Delete_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Tokens_Delete_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Tokens_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -512,18 +565,19 @@ func RegisterTokensHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp
}(ctx.Done(), cn.CloseNotify()) }(ctx.Done(), cn.CloseNotify())
} }
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, req) rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
} }
resp, md, err := request_Tokens_Deactivate_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Tokens_Deactivate_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Tokens_Deactivate_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Tokens_Deactivate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -553,3 +607,106 @@ var (
forward_Tokens_Deactivate_0 = runtime.ForwardResponseMessage forward_Tokens_Deactivate_0 = runtime.ForwardResponseMessage
) )
// RegisterBackendsHandlerFromEndpoint is same as RegisterBackendsHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBackendsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterBackendsHandler(ctx, mux, conn)
}
// RegisterBackendsHandler registers the http handlers for service Backends to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterBackendsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
client := NewBackendsClient(conn)
mux.Handle("GET", pattern_Backends_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
if cn, ok := w.(http.CloseNotifier); ok {
go func(done <-chan struct{}, closed <-chan bool) {
select {
case <-done:
case <-closed:
cancel()
}
}(ctx.Done(), cn.CloseNotify())
}
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Backends_List_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Backends_List_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Backends_Kill_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
if cn, ok := w.(http.CloseNotifier); ok {
go func(done <-chan struct{}, closed <-chan bool) {
select {
case <-done:
case <-closed:
cancel()
}
}(ctx.Done(), cn.CloseNotify())
}
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Backends_Kill_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Backends_Kill_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Backends_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "backends"}, ""))
pattern_Backends_Kill_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "backends", "id", "kill"}, ""))
)
var (
forward_Backends_List_0 = runtime.ForwardResponseMessage
forward_Backends_Kill_0 = runtime.ForwardResponseMessage
)

View File

@ -99,3 +99,40 @@ message GetTokenRequest {
string token = 1; string token = 1;
string id = 2; string id = 2;
} }
service Backends {
rpc List(BackendSelector) returns (BackendList) {
option (google.api.http) = {
get: "/v1/backends"
};
}
rpc Kill(BackendID) returns (Nil) {
option (google.api.http) = {
post: "/v1/backends/{id}/kill"
};
}
}
message Backend {
string id = 1;
string proto = 2;
string user = 3;
string domain = 4;
float phi = 5;
string host = 6;
}
message BackendList {
BackendSelector bs = 1;
repeated Backend backends = 2;
}
message BackendSelector {
string domain = 1;
string user = 2;
}
message BackendID {
string id = 1;
}

View File

@ -15,6 +15,60 @@
"application/json" "application/json"
], ],
"paths": { "paths": {
"/v1/backends": {
"get": {
"operationId": "List",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/routeBackendList"
}
}
},
"parameters": [
{
"name": "domain",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "user",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"Backends"
]
}
},
"/v1/backends/{id}/kill": {
"post": {
"operationId": "Kill",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/routeNil"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"Backends"
]
}
},
"/v1/routes": { "/v1/routes": {
"get": { "get": {
"operationId": "GetAll", "operationId": "GetAll",
@ -183,6 +237,55 @@
} }
}, },
"definitions": { "definitions": {
"routeBackend": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"proto": {
"type": "string"
},
"user": {
"type": "string"
},
"domain": {
"type": "string"
},
"phi": {
"type": "number",
"format": "float"
},
"host": {
"type": "string"
}
}
},
"routeBackendList": {
"type": "object",
"properties": {
"bs": {
"$ref": "#/definitions/routeBackendSelector"
},
"backends": {
"type": "array",
"items": {
"$ref": "#/definitions/routeBackend"
}
}
}
},
"routeBackendSelector": {
"type": "object",
"properties": {
"domain": {
"type": "string"
},
"user": {
"type": "string"
}
}
},
"routeGetAllRoutesResponse": { "routeGetAllRoutesResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -194,25 +297,6 @@
} }
} }
}, },
"routeGetRouteRequest": {
"type": "object",
"properties": {
"host": {
"type": "string"
}
}
},
"routeGetTokenRequest": {
"type": "object",
"properties": {
"token": {
"type": "string"
},
"id": {
"type": "string"
}
}
},
"routeIDResponse": { "routeIDResponse": {
"type": "object", "type": "object",
"properties": { "properties": {