refactor: consume kmsvc-proto as a Go module instead of local generation

Remove local proto/, buf.yaml, buf.gen.yaml, and generated
internal/api/v1/*.pb.go. The message-plane contract now lives in the
sibling repo kmsvc-proto (forgejo.riotpiao.homelab.com/rock/kmsvc-proto),
fetched via go get — no local buf/protoc plugin install needed.

Nothing in this repo imported internal/api/v1 yet, so this is a clean
swap with no call-site changes.
This commit is contained in:
riotpiaole
2026-06-21 19:47:43 -07:00
parent ef7b54710d
commit b3be1f929a
6 changed files with 0 additions and 2297 deletions
-11
View File
@@ -1,11 +0,0 @@
version: v2
plugins:
- local: protoc-gen-go
out: .
opt: paths=source_relative
- local: protoc-gen-go-grpc
out: .
opt: paths=source_relative
- local: protoc-gen-grpc-gateway
out: .
opt: paths=source_relative
-11
View File
@@ -1,11 +0,0 @@
version: v2
modules:
- path: proto
deps:
- buf.build/googleapis/googleapis
lint:
use:
- DEFAULT
breaking:
use:
- FILE
File diff suppressed because it is too large Load Diff
-629
View File
@@ -1,629 +0,0 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: kafkamgmt/v1/queue_service.proto
/*
Package kafkamgmtv1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package kafkamgmtv1
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_QueueService_SendMessage_0(ctx context.Context, marshaler runtime.Marshaler, client QueueServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SendMessageRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
msg, err := client.SendMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_QueueService_SendMessage_0(ctx context.Context, marshaler runtime.Marshaler, server QueueServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SendMessageRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
msg, err := server.SendMessage(ctx, &protoReq)
return msg, metadata, err
}
func request_QueueService_SendMessageBatch_0(ctx context.Context, marshaler runtime.Marshaler, client QueueServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SendMessageBatchRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
msg, err := client.SendMessageBatch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_QueueService_SendMessageBatch_0(ctx context.Context, marshaler runtime.Marshaler, server QueueServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SendMessageBatchRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
msg, err := server.SendMessageBatch(ctx, &protoReq)
return msg, metadata, err
}
var filter_QueueService_ReceiveMessage_0 = &utilities.DoubleArray{Encoding: map[string]int{"queue_name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
func request_QueueService_ReceiveMessage_0(ctx context.Context, marshaler runtime.Marshaler, client QueueServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ReceiveMessageRequest
metadata runtime.ServerMetadata
err error
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueueService_ReceiveMessage_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ReceiveMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_QueueService_ReceiveMessage_0(ctx context.Context, marshaler runtime.Marshaler, server QueueServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ReceiveMessageRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_QueueService_ReceiveMessage_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ReceiveMessage(ctx, &protoReq)
return msg, metadata, err
}
func request_QueueService_DeleteMessage_0(ctx context.Context, marshaler runtime.Marshaler, client QueueServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteMessageRequest
metadata runtime.ServerMetadata
err error
)
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
val, ok = pathParams["receipt_handle"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "receipt_handle")
}
protoReq.ReceiptHandle, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "receipt_handle", err)
}
msg, err := client.DeleteMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_QueueService_DeleteMessage_0(ctx context.Context, marshaler runtime.Marshaler, server QueueServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteMessageRequest
metadata runtime.ServerMetadata
err error
)
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
val, ok = pathParams["receipt_handle"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "receipt_handle")
}
protoReq.ReceiptHandle, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "receipt_handle", err)
}
msg, err := server.DeleteMessage(ctx, &protoReq)
return msg, metadata, err
}
func request_QueueService_DeleteMessageBatch_0(ctx context.Context, marshaler runtime.Marshaler, client QueueServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteMessageBatchRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
msg, err := client.DeleteMessageBatch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_QueueService_DeleteMessageBatch_0(ctx context.Context, marshaler runtime.Marshaler, server QueueServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteMessageBatchRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
msg, err := server.DeleteMessageBatch(ctx, &protoReq)
return msg, metadata, err
}
func request_QueueService_ChangeMessageVisibility_0(ctx context.Context, marshaler runtime.Marshaler, client QueueServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ChangeMessageVisibilityRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
val, ok = pathParams["receipt_handle"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "receipt_handle")
}
protoReq.ReceiptHandle, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "receipt_handle", err)
}
msg, err := client.ChangeMessageVisibility(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_QueueService_ChangeMessageVisibility_0(ctx context.Context, marshaler runtime.Marshaler, server QueueServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ChangeMessageVisibilityRequest
metadata runtime.ServerMetadata
err error
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
val, ok := pathParams["queue_name"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "queue_name")
}
protoReq.QueueName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "queue_name", err)
}
val, ok = pathParams["receipt_handle"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "receipt_handle")
}
protoReq.ReceiptHandle, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "receipt_handle", err)
}
msg, err := server.ChangeMessageVisibility(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueueServiceHandlerServer registers the http handlers for service QueueService to "mux".
// UnaryRPC :call QueueServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueueServiceHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterQueueServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueueServiceServer) error {
mux.Handle(http.MethodPost, pattern_QueueService_SendMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/SendMessage", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_QueueService_SendMessage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_SendMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_QueueService_SendMessageBatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/SendMessageBatch", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages:batch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_QueueService_SendMessageBatch_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_SendMessageBatch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_QueueService_ReceiveMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/ReceiveMessage", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_QueueService_ReceiveMessage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_ReceiveMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodDelete, pattern_QueueService_DeleteMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/DeleteMessage", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages/{receipt_handle}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_QueueService_DeleteMessage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_DeleteMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_QueueService_DeleteMessageBatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/DeleteMessageBatch", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages:batchDelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_QueueService_DeleteMessageBatch_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_DeleteMessageBatch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPatch, pattern_QueueService_ChangeMessageVisibility_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/ChangeMessageVisibility", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages/{receipt_handle}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_QueueService_ChangeMessageVisibility_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_ChangeMessageVisibility_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterQueueServiceHandlerFromEndpoint is same as RegisterQueueServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueueServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterQueueServiceHandler(ctx, mux, conn)
}
// RegisterQueueServiceHandler registers the http handlers for service QueueService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueueServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterQueueServiceHandlerClient(ctx, mux, NewQueueServiceClient(conn))
}
// RegisterQueueServiceHandlerClient registers the http handlers for service QueueService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueueServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueueServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "QueueServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterQueueServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueueServiceClient) error {
mux.Handle(http.MethodPost, pattern_QueueService_SendMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/SendMessage", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_QueueService_SendMessage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_SendMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_QueueService_SendMessageBatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/SendMessageBatch", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages:batch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_QueueService_SendMessageBatch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_SendMessageBatch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodGet, pattern_QueueService_ReceiveMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/ReceiveMessage", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_QueueService_ReceiveMessage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_ReceiveMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodDelete, pattern_QueueService_DeleteMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/DeleteMessage", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages/{receipt_handle}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_QueueService_DeleteMessage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_DeleteMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_QueueService_DeleteMessageBatch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/DeleteMessageBatch", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages:batchDelete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_QueueService_DeleteMessageBatch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_DeleteMessageBatch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPatch, pattern_QueueService_ChangeMessageVisibility_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/kafkamgmt.v1.QueueService/ChangeMessageVisibility", runtime.WithHTTPPathPattern("/v1/queues/{queue_name}/messages/{receipt_handle}"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_QueueService_ChangeMessageVisibility_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_QueueService_ChangeMessageVisibility_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_QueueService_SendMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "queues", "queue_name", "messages"}, ""))
pattern_QueueService_SendMessageBatch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "queues", "queue_name", "messages"}, "batch"))
pattern_QueueService_ReceiveMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "queues", "queue_name", "messages"}, ""))
pattern_QueueService_DeleteMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "queues", "queue_name", "messages", "receipt_handle"}, ""))
pattern_QueueService_DeleteMessageBatch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "queues", "queue_name", "messages"}, "batchDelete"))
pattern_QueueService_ChangeMessageVisibility_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "queues", "queue_name", "messages", "receipt_handle"}, ""))
)
var (
forward_QueueService_SendMessage_0 = runtime.ForwardResponseMessage
forward_QueueService_SendMessageBatch_0 = runtime.ForwardResponseMessage
forward_QueueService_ReceiveMessage_0 = runtime.ForwardResponseMessage
forward_QueueService_DeleteMessage_0 = runtime.ForwardResponseMessage
forward_QueueService_DeleteMessageBatch_0 = runtime.ForwardResponseMessage
forward_QueueService_ChangeMessageVisibility_0 = runtime.ForwardResponseMessage
)
-319
View File
@@ -1,319 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// source: kafkamgmt/v1/queue_service.proto
package kafkamgmtv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
QueueService_SendMessage_FullMethodName = "/kafkamgmt.v1.QueueService/SendMessage"
QueueService_SendMessageBatch_FullMethodName = "/kafkamgmt.v1.QueueService/SendMessageBatch"
QueueService_ReceiveMessage_FullMethodName = "/kafkamgmt.v1.QueueService/ReceiveMessage"
QueueService_DeleteMessage_FullMethodName = "/kafkamgmt.v1.QueueService/DeleteMessage"
QueueService_DeleteMessageBatch_FullMethodName = "/kafkamgmt.v1.QueueService/DeleteMessageBatch"
QueueService_ChangeMessageVisibility_FullMethodName = "/kafkamgmt.v1.QueueService/ChangeMessageVisibility"
)
// QueueServiceClient is the client API for QueueService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// QueueService is the message-plane API for the Kafka Management Service.
// Queue lifecycle (create/delete/configure) is managed via the Queue CRD,
// not this service — see design.md §2a/§2b.
type QueueServiceClient interface {
SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error)
SendMessageBatch(ctx context.Context, in *SendMessageBatchRequest, opts ...grpc.CallOption) (*SendMessageBatchResponse, error)
ReceiveMessage(ctx context.Context, in *ReceiveMessageRequest, opts ...grpc.CallOption) (*ReceiveMessageResponse, error)
DeleteMessage(ctx context.Context, in *DeleteMessageRequest, opts ...grpc.CallOption) (*DeleteMessageResponse, error)
DeleteMessageBatch(ctx context.Context, in *DeleteMessageBatchRequest, opts ...grpc.CallOption) (*DeleteMessageBatchResponse, error)
ChangeMessageVisibility(ctx context.Context, in *ChangeMessageVisibilityRequest, opts ...grpc.CallOption) (*ChangeMessageVisibilityResponse, error)
}
type queueServiceClient struct {
cc grpc.ClientConnInterface
}
func NewQueueServiceClient(cc grpc.ClientConnInterface) QueueServiceClient {
return &queueServiceClient{cc}
}
func (c *queueServiceClient) SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SendMessageResponse)
err := c.cc.Invoke(ctx, QueueService_SendMessage_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queueServiceClient) SendMessageBatch(ctx context.Context, in *SendMessageBatchRequest, opts ...grpc.CallOption) (*SendMessageBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SendMessageBatchResponse)
err := c.cc.Invoke(ctx, QueueService_SendMessageBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queueServiceClient) ReceiveMessage(ctx context.Context, in *ReceiveMessageRequest, opts ...grpc.CallOption) (*ReceiveMessageResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReceiveMessageResponse)
err := c.cc.Invoke(ctx, QueueService_ReceiveMessage_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queueServiceClient) DeleteMessage(ctx context.Context, in *DeleteMessageRequest, opts ...grpc.CallOption) (*DeleteMessageResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteMessageResponse)
err := c.cc.Invoke(ctx, QueueService_DeleteMessage_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queueServiceClient) DeleteMessageBatch(ctx context.Context, in *DeleteMessageBatchRequest, opts ...grpc.CallOption) (*DeleteMessageBatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteMessageBatchResponse)
err := c.cc.Invoke(ctx, QueueService_DeleteMessageBatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queueServiceClient) ChangeMessageVisibility(ctx context.Context, in *ChangeMessageVisibilityRequest, opts ...grpc.CallOption) (*ChangeMessageVisibilityResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ChangeMessageVisibilityResponse)
err := c.cc.Invoke(ctx, QueueService_ChangeMessageVisibility_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueueServiceServer is the server API for QueueService service.
// All implementations must embed UnimplementedQueueServiceServer
// for forward compatibility.
//
// QueueService is the message-plane API for the Kafka Management Service.
// Queue lifecycle (create/delete/configure) is managed via the Queue CRD,
// not this service — see design.md §2a/§2b.
type QueueServiceServer interface {
SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error)
SendMessageBatch(context.Context, *SendMessageBatchRequest) (*SendMessageBatchResponse, error)
ReceiveMessage(context.Context, *ReceiveMessageRequest) (*ReceiveMessageResponse, error)
DeleteMessage(context.Context, *DeleteMessageRequest) (*DeleteMessageResponse, error)
DeleteMessageBatch(context.Context, *DeleteMessageBatchRequest) (*DeleteMessageBatchResponse, error)
ChangeMessageVisibility(context.Context, *ChangeMessageVisibilityRequest) (*ChangeMessageVisibilityResponse, error)
mustEmbedUnimplementedQueueServiceServer()
}
// UnimplementedQueueServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueueServiceServer struct{}
func (UnimplementedQueueServiceServer) SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SendMessage not implemented")
}
func (UnimplementedQueueServiceServer) SendMessageBatch(context.Context, *SendMessageBatchRequest) (*SendMessageBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SendMessageBatch not implemented")
}
func (UnimplementedQueueServiceServer) ReceiveMessage(context.Context, *ReceiveMessageRequest) (*ReceiveMessageResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ReceiveMessage not implemented")
}
func (UnimplementedQueueServiceServer) DeleteMessage(context.Context, *DeleteMessageRequest) (*DeleteMessageResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteMessage not implemented")
}
func (UnimplementedQueueServiceServer) DeleteMessageBatch(context.Context, *DeleteMessageBatchRequest) (*DeleteMessageBatchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteMessageBatch not implemented")
}
func (UnimplementedQueueServiceServer) ChangeMessageVisibility(context.Context, *ChangeMessageVisibilityRequest) (*ChangeMessageVisibilityResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ChangeMessageVisibility not implemented")
}
func (UnimplementedQueueServiceServer) mustEmbedUnimplementedQueueServiceServer() {}
func (UnimplementedQueueServiceServer) testEmbeddedByValue() {}
// UnsafeQueueServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueueServiceServer will
// result in compilation errors.
type UnsafeQueueServiceServer interface {
mustEmbedUnimplementedQueueServiceServer()
}
func RegisterQueueServiceServer(s grpc.ServiceRegistrar, srv QueueServiceServer) {
// If the following call panics, it indicates UnimplementedQueueServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&QueueService_ServiceDesc, srv)
}
func _QueueService_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendMessageRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueueServiceServer).SendMessage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: QueueService_SendMessage_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueueServiceServer).SendMessage(ctx, req.(*SendMessageRequest))
}
return interceptor(ctx, in, info, handler)
}
func _QueueService_SendMessageBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendMessageBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueueServiceServer).SendMessageBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: QueueService_SendMessageBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueueServiceServer).SendMessageBatch(ctx, req.(*SendMessageBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _QueueService_ReceiveMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReceiveMessageRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueueServiceServer).ReceiveMessage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: QueueService_ReceiveMessage_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueueServiceServer).ReceiveMessage(ctx, req.(*ReceiveMessageRequest))
}
return interceptor(ctx, in, info, handler)
}
func _QueueService_DeleteMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteMessageRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueueServiceServer).DeleteMessage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: QueueService_DeleteMessage_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueueServiceServer).DeleteMessage(ctx, req.(*DeleteMessageRequest))
}
return interceptor(ctx, in, info, handler)
}
func _QueueService_DeleteMessageBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteMessageBatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueueServiceServer).DeleteMessageBatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: QueueService_DeleteMessageBatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueueServiceServer).DeleteMessageBatch(ctx, req.(*DeleteMessageBatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _QueueService_ChangeMessageVisibility_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangeMessageVisibilityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueueServiceServer).ChangeMessageVisibility(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: QueueService_ChangeMessageVisibility_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueueServiceServer).ChangeMessageVisibility(ctx, req.(*ChangeMessageVisibilityRequest))
}
return interceptor(ctx, in, info, handler)
}
// QueueService_ServiceDesc is the grpc.ServiceDesc for QueueService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var QueueService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "kafkamgmt.v1.QueueService",
HandlerType: (*QueueServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "SendMessage",
Handler: _QueueService_SendMessage_Handler,
},
{
MethodName: "SendMessageBatch",
Handler: _QueueService_SendMessageBatch_Handler,
},
{
MethodName: "ReceiveMessage",
Handler: _QueueService_ReceiveMessage_Handler,
},
{
MethodName: "DeleteMessage",
Handler: _QueueService_DeleteMessage_Handler,
},
{
MethodName: "DeleteMessageBatch",
Handler: _QueueService_DeleteMessageBatch_Handler,
},
{
MethodName: "ChangeMessageVisibility",
Handler: _QueueService_ChangeMessageVisibility_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "kafkamgmt/v1/queue_service.proto",
}
-147
View File
@@ -1,147 +0,0 @@
syntax = "proto3";
package kafkamgmt.v1;
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/rockliang/kafka-management-service/internal/api/v1;kafkamgmtv1";
// QueueService is the message-plane API for the Kafka Management Service.
// Queue lifecycle (create/delete/configure) is managed via the Queue CRD,
// not this service — see design.md §2a/§2b.
service QueueService {
rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) {
option (google.api.http) = {
post: "/v1/queues/{queue_name}/messages"
body: "*"
};
}
rpc SendMessageBatch(SendMessageBatchRequest) returns (SendMessageBatchResponse) {
option (google.api.http) = {
post: "/v1/queues/{queue_name}/messages:batch"
body: "*"
};
}
rpc ReceiveMessage(ReceiveMessageRequest) returns (ReceiveMessageResponse) {
option (google.api.http) = {
get: "/v1/queues/{queue_name}/messages"
};
}
rpc DeleteMessage(DeleteMessageRequest) returns (DeleteMessageResponse) {
option (google.api.http) = {
delete: "/v1/queues/{queue_name}/messages/{receipt_handle}"
};
}
rpc DeleteMessageBatch(DeleteMessageBatchRequest) returns (DeleteMessageBatchResponse) {
option (google.api.http) = {
post: "/v1/queues/{queue_name}/messages:batchDelete"
body: "*"
};
}
rpc ChangeMessageVisibility(ChangeMessageVisibilityRequest) returns (ChangeMessageVisibilityResponse) {
option (google.api.http) = {
patch: "/v1/queues/{queue_name}/messages/{receipt_handle}"
body: "*"
};
}
}
message MessageAttributes {
map<string, string> values = 1;
}
message SendMessageRequest {
string queue_name = 1;
bytes message_body = 2;
MessageAttributes message_attributes = 3;
string message_group_id = 4; // FIFO only
string message_deduplication_id = 5; // FIFO only
int32 delay_seconds = 6;
}
message SendMessageResponse {
string message_id = 1;
string sequence_number = 2; // FIFO only
}
message SendMessageBatchEntry {
string id = 1;
bytes message_body = 2;
MessageAttributes message_attributes = 3;
string message_group_id = 4;
string message_deduplication_id = 5;
int32 delay_seconds = 6;
}
message SendMessageBatchRequest {
string queue_name = 1;
repeated SendMessageBatchEntry entries = 2;
}
message BatchResultEntry {
string id = 1;
string message_id = 2;
string error = 3;
}
message SendMessageBatchResponse {
repeated BatchResultEntry successful = 1;
repeated BatchResultEntry failed = 2;
}
message ReceiveMessageRequest {
string queue_name = 1;
int32 max_number_of_messages = 2; // <= 10
int32 wait_time_seconds = 3; // 0-20, long-poll
int32 visibility_timeout_seconds = 4; // override
}
message Message {
string message_id = 1;
string receipt_handle = 2;
bytes body = 3;
MessageAttributes attributes = 4;
int32 receive_count = 5;
string message_group_id = 6;
google.protobuf.Timestamp enqueued_at = 7;
}
message ReceiveMessageResponse {
repeated Message messages = 1;
}
message DeleteMessageRequest {
string queue_name = 1;
string receipt_handle = 2;
}
message DeleteMessageResponse {}
message DeleteMessageBatchEntry {
string id = 1;
string receipt_handle = 2;
}
message DeleteMessageBatchRequest {
string queue_name = 1;
repeated DeleteMessageBatchEntry entries = 2;
}
message DeleteMessageBatchResponse {
repeated BatchResultEntry successful = 1;
repeated BatchResultEntry failed = 2;
}
message ChangeMessageVisibilityRequest {
string queue_name = 1;
string receipt_handle = 2;
int32 visibility_timeout_seconds = 3;
}
message ChangeMessageVisibilityResponse {}