open-consul/proto/private/pbpeering/peering_grpc.pb.go
Matt Keeler f3c80c4eef
Protobuf Refactoring for Multi-Module Cleanliness (#16302)
Protobuf Refactoring for Multi-Module Cleanliness

This commit includes the following:

Moves all packages that were within proto/ to proto/private
Rewrites imports to account for the packages being moved
Adds in buf.work.yaml to enable buf workspaces
Names the proto-public buf module so that we can override the Go package imports within proto/buf.yaml
Bumps the buf version dependency to 1.14.0 (I was trying out the version to see if it would get around an issue - it didn't but it also doesn't break things and it seemed best to keep up with the toolchain changes)

Why:

In the future we will need to consume other protobuf dependencies such as the Google HTTP annotations for openapi generation or grpc-gateway usage.
There were some recent changes to have our own ratelimiting annotations.
The two combined were not working when I was trying to use them together (attempting to rebase another branch)
Buf workspaces should be the solution to the problem
Buf workspaces means that each module will have generated Go code that embeds proto file names relative to the proto dir and not the top level repo root.
This resulted in proto file name conflicts in the Go global protobuf type registry.
The solution to that was to add in a private/ directory into the path within the proto/ directory.
That then required rewriting all the imports.

Is this safe?

AFAICT yes
The gRPC wire protocol doesn't seem to care about the proto file names (although the Go grpc code does tack on the proto file name as Metadata in the ServiceDesc)
Other than imports, there were no changes to any generated code as a result of this.
2023-02-17 16:14:46 -05:00

362 lines
15 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc (unknown)
// source: private/pbpeering/peering.proto
package pbpeering
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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// PeeringServiceClient is the client API for PeeringService 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.
type PeeringServiceClient interface {
GenerateToken(ctx context.Context, in *GenerateTokenRequest, opts ...grpc.CallOption) (*GenerateTokenResponse, error)
Establish(ctx context.Context, in *EstablishRequest, opts ...grpc.CallOption) (*EstablishResponse, error)
PeeringRead(ctx context.Context, in *PeeringReadRequest, opts ...grpc.CallOption) (*PeeringReadResponse, error)
PeeringList(ctx context.Context, in *PeeringListRequest, opts ...grpc.CallOption) (*PeeringListResponse, error)
PeeringDelete(ctx context.Context, in *PeeringDeleteRequest, opts ...grpc.CallOption) (*PeeringDeleteResponse, error)
// TODO(peering): As of writing, this method is only used in tests to set up Peerings in the state store.
// Consider removing if we can find another way to populate state store in peering_endpoint_test.go
PeeringWrite(ctx context.Context, in *PeeringWriteRequest, opts ...grpc.CallOption) (*PeeringWriteResponse, error)
// TODO(peering): Rename this to PeeredServiceRoots? or something like that?
TrustBundleListByService(ctx context.Context, in *TrustBundleListByServiceRequest, opts ...grpc.CallOption) (*TrustBundleListByServiceResponse, error)
TrustBundleRead(ctx context.Context, in *TrustBundleReadRequest, opts ...grpc.CallOption) (*TrustBundleReadResponse, error)
}
type peeringServiceClient struct {
cc grpc.ClientConnInterface
}
func NewPeeringServiceClient(cc grpc.ClientConnInterface) PeeringServiceClient {
return &peeringServiceClient{cc}
}
func (c *peeringServiceClient) GenerateToken(ctx context.Context, in *GenerateTokenRequest, opts ...grpc.CallOption) (*GenerateTokenResponse, error) {
out := new(GenerateTokenResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/GenerateToken", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peeringServiceClient) Establish(ctx context.Context, in *EstablishRequest, opts ...grpc.CallOption) (*EstablishResponse, error) {
out := new(EstablishResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/Establish", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peeringServiceClient) PeeringRead(ctx context.Context, in *PeeringReadRequest, opts ...grpc.CallOption) (*PeeringReadResponse, error) {
out := new(PeeringReadResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/PeeringRead", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peeringServiceClient) PeeringList(ctx context.Context, in *PeeringListRequest, opts ...grpc.CallOption) (*PeeringListResponse, error) {
out := new(PeeringListResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/PeeringList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peeringServiceClient) PeeringDelete(ctx context.Context, in *PeeringDeleteRequest, opts ...grpc.CallOption) (*PeeringDeleteResponse, error) {
out := new(PeeringDeleteResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/PeeringDelete", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peeringServiceClient) PeeringWrite(ctx context.Context, in *PeeringWriteRequest, opts ...grpc.CallOption) (*PeeringWriteResponse, error) {
out := new(PeeringWriteResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/PeeringWrite", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peeringServiceClient) TrustBundleListByService(ctx context.Context, in *TrustBundleListByServiceRequest, opts ...grpc.CallOption) (*TrustBundleListByServiceResponse, error) {
out := new(TrustBundleListByServiceResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/TrustBundleListByService", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *peeringServiceClient) TrustBundleRead(ctx context.Context, in *TrustBundleReadRequest, opts ...grpc.CallOption) (*TrustBundleReadResponse, error) {
out := new(TrustBundleReadResponse)
err := c.cc.Invoke(ctx, "/hashicorp.consul.internal.peering.PeeringService/TrustBundleRead", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// PeeringServiceServer is the server API for PeeringService service.
// All implementations should embed UnimplementedPeeringServiceServer
// for forward compatibility
type PeeringServiceServer interface {
GenerateToken(context.Context, *GenerateTokenRequest) (*GenerateTokenResponse, error)
Establish(context.Context, *EstablishRequest) (*EstablishResponse, error)
PeeringRead(context.Context, *PeeringReadRequest) (*PeeringReadResponse, error)
PeeringList(context.Context, *PeeringListRequest) (*PeeringListResponse, error)
PeeringDelete(context.Context, *PeeringDeleteRequest) (*PeeringDeleteResponse, error)
// TODO(peering): As of writing, this method is only used in tests to set up Peerings in the state store.
// Consider removing if we can find another way to populate state store in peering_endpoint_test.go
PeeringWrite(context.Context, *PeeringWriteRequest) (*PeeringWriteResponse, error)
// TODO(peering): Rename this to PeeredServiceRoots? or something like that?
TrustBundleListByService(context.Context, *TrustBundleListByServiceRequest) (*TrustBundleListByServiceResponse, error)
TrustBundleRead(context.Context, *TrustBundleReadRequest) (*TrustBundleReadResponse, error)
}
// UnimplementedPeeringServiceServer should be embedded to have forward compatible implementations.
type UnimplementedPeeringServiceServer struct {
}
func (UnimplementedPeeringServiceServer) GenerateToken(context.Context, *GenerateTokenRequest) (*GenerateTokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GenerateToken not implemented")
}
func (UnimplementedPeeringServiceServer) Establish(context.Context, *EstablishRequest) (*EstablishResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Establish not implemented")
}
func (UnimplementedPeeringServiceServer) PeeringRead(context.Context, *PeeringReadRequest) (*PeeringReadResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PeeringRead not implemented")
}
func (UnimplementedPeeringServiceServer) PeeringList(context.Context, *PeeringListRequest) (*PeeringListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PeeringList not implemented")
}
func (UnimplementedPeeringServiceServer) PeeringDelete(context.Context, *PeeringDeleteRequest) (*PeeringDeleteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PeeringDelete not implemented")
}
func (UnimplementedPeeringServiceServer) PeeringWrite(context.Context, *PeeringWriteRequest) (*PeeringWriteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PeeringWrite not implemented")
}
func (UnimplementedPeeringServiceServer) TrustBundleListByService(context.Context, *TrustBundleListByServiceRequest) (*TrustBundleListByServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TrustBundleListByService not implemented")
}
func (UnimplementedPeeringServiceServer) TrustBundleRead(context.Context, *TrustBundleReadRequest) (*TrustBundleReadResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method TrustBundleRead not implemented")
}
// UnsafePeeringServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PeeringServiceServer will
// result in compilation errors.
type UnsafePeeringServiceServer interface {
mustEmbedUnimplementedPeeringServiceServer()
}
func RegisterPeeringServiceServer(s grpc.ServiceRegistrar, srv PeeringServiceServer) {
s.RegisterService(&PeeringService_ServiceDesc, srv)
}
func _PeeringService_GenerateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GenerateTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).GenerateToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/GenerateToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).GenerateToken(ctx, req.(*GenerateTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PeeringService_Establish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EstablishRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).Establish(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/Establish",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).Establish(ctx, req.(*EstablishRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PeeringService_PeeringRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PeeringReadRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).PeeringRead(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/PeeringRead",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).PeeringRead(ctx, req.(*PeeringReadRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PeeringService_PeeringList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PeeringListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).PeeringList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/PeeringList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).PeeringList(ctx, req.(*PeeringListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PeeringService_PeeringDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PeeringDeleteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).PeeringDelete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/PeeringDelete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).PeeringDelete(ctx, req.(*PeeringDeleteRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PeeringService_PeeringWrite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PeeringWriteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).PeeringWrite(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/PeeringWrite",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).PeeringWrite(ctx, req.(*PeeringWriteRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PeeringService_TrustBundleListByService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TrustBundleListByServiceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).TrustBundleListByService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/TrustBundleListByService",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).TrustBundleListByService(ctx, req.(*TrustBundleListByServiceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PeeringService_TrustBundleRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TrustBundleReadRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PeeringServiceServer).TrustBundleRead(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.consul.internal.peering.PeeringService/TrustBundleRead",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PeeringServiceServer).TrustBundleRead(ctx, req.(*TrustBundleReadRequest))
}
return interceptor(ctx, in, info, handler)
}
// PeeringService_ServiceDesc is the grpc.ServiceDesc for PeeringService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PeeringService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "hashicorp.consul.internal.peering.PeeringService",
HandlerType: (*PeeringServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GenerateToken",
Handler: _PeeringService_GenerateToken_Handler,
},
{
MethodName: "Establish",
Handler: _PeeringService_Establish_Handler,
},
{
MethodName: "PeeringRead",
Handler: _PeeringService_PeeringRead_Handler,
},
{
MethodName: "PeeringList",
Handler: _PeeringService_PeeringList_Handler,
},
{
MethodName: "PeeringDelete",
Handler: _PeeringService_PeeringDelete_Handler,
},
{
MethodName: "PeeringWrite",
Handler: _PeeringService_PeeringWrite_Handler,
},
{
MethodName: "TrustBundleListByService",
Handler: _PeeringService_TrustBundleListByService_Handler,
},
{
MethodName: "TrustBundleRead",
Handler: _PeeringService_TrustBundleRead_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "private/pbpeering/peering.proto",
}