From 6a42b21b66fe5bf89a2fbfcd15ed45509e8987b3 Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Fri, 9 Aug 2024 10:28:15 +0300 Subject: [PATCH] Merge branch 'main' into v3 --- .../v1beta1/accesscontrol.pb.gw.go | 3 +- .../v1beta1/accesscontrol_grpc.pb.go | 22 +++-- api/actions/v1/actions.pb.gw.go | 3 +- api/actions/v1/actions_grpc.pb.go | 22 +++-- api/advisors/v1/advisors.pb.gw.go | 3 +- api/advisors/v1/advisors_grpc.pb.go | 22 +++-- api/agent/v1/agent_grpc.pb.go | 80 +++++++------------ api/agentlocal/v1/agentlocal.pb.gw.go | 3 +- api/agentlocal/v1/agentlocal_grpc.pb.go | 22 +++-- api/alerting/v1/alerting.pb.gw.go | 3 +- api/alerting/v1/alerting_grpc.pb.go | 22 +++-- api/backup/v1/backup.pb.gw.go | 3 +- api/backup/v1/backup_grpc.pb.go | 22 +++-- api/backup/v1/locations.pb.gw.go | 3 +- api/backup/v1/locations_grpc.pb.go | 22 +++-- api/backup/v1/restores.pb.gw.go | 3 +- api/backup/v1/restores_grpc.pb.go | 22 +++-- api/dump/v1beta1/dump.pb.gw.go | 3 +- api/dump/v1beta1/dump_grpc.pb.go | 22 +++-- api/inventory/v1/agents.pb.gw.go | 3 +- api/inventory/v1/agents_grpc.pb.go | 22 +++-- api/inventory/v1/nodes.pb.gw.go | 3 +- api/inventory/v1/nodes_grpc.pb.go | 22 +++-- api/inventory/v1/services.pb.gw.go | 3 +- api/inventory/v1/services_grpc.pb.go | 22 +++-- api/management/v1/service.pb.gw.go | 3 +- api/management/v1/service_grpc.pb.go | 22 +++-- api/platform/v1/platform.pb.gw.go | 3 +- api/platform/v1/platform_grpc.pb.go | 22 +++-- api/qan/v1/collector_grpc.pb.go | 22 +++-- api/qan/v1/service.pb.gw.go | 3 +- api/qan/v1/service_grpc.pb.go | 22 +++-- api/server/v1/server.pb.gw.go | 3 +- api/server/v1/server_grpc.pb.go | 22 +++-- api/uievents/v1/server.pb.gw.go | 3 +- api/uievents/v1/server_grpc.pb.go | 22 +++-- api/user/v1/user.pb.gw.go | 3 +- api/user/v1/user_grpc.pb.go | 22 +++-- 38 files changed, 386 insertions(+), 166 deletions(-) diff --git a/api/accesscontrol/v1beta1/accesscontrol.pb.gw.go b/api/accesscontrol/v1beta1/accesscontrol.pb.gw.go index 0eb838b049..8f10784f9d 100644 --- a/api/accesscontrol/v1beta1/accesscontrol.pb.gw.go +++ b/api/accesscontrol/v1beta1/accesscontrol.pb.gw.go @@ -299,6 +299,7 @@ func local_request_AccessControlService_SetDefaultRole_0(ctx context.Context, ma // UnaryRPC :call AccessControlServiceServer 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 RegisterAccessControlServiceHandlerFromEndpoint 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 RegisterAccessControlServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccessControlServiceServer) error { mux.Handle("POST", pattern_AccessControlService_CreateRole_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -506,7 +507,7 @@ func RegisterAccessControlServiceHandler(ctx context.Context, mux *runtime.Serve // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccessControlServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccessControlServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AccessControlServiceClient" to call the correct interceptors. +// "AccessControlServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAccessControlServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccessControlServiceClient) error { mux.Handle("POST", pattern_AccessControlService_CreateRole_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/accesscontrol/v1beta1/accesscontrol_grpc.pb.go b/api/accesscontrol/v1beta1/accesscontrol_grpc.pb.go index def6545fe2..d35749a17e 100644 --- a/api/accesscontrol/v1beta1/accesscontrol_grpc.pb.go +++ b/api/accesscontrol/v1beta1/accesscontrol_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: accesscontrol/v1beta1/accesscontrol.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AccessControlService_CreateRole_FullMethodName = "/accesscontrol.v1beta1.AccessControlService/CreateRole" @@ -131,7 +131,7 @@ func (c *accessControlServiceClient) SetDefaultRole(ctx context.Context, in *Set // AccessControlServiceServer is the server API for AccessControlService service. // All implementations must embed UnimplementedAccessControlServiceServer -// for forward compatibility +// for forward compatibility. // // Service Role provides public methods for managing Roles. type AccessControlServiceServer interface { @@ -152,7 +152,11 @@ type AccessControlServiceServer interface { mustEmbedUnimplementedAccessControlServiceServer() } -// UnimplementedAccessControlServiceServer must be embedded to have forward compatible implementations. +// UnimplementedAccessControlServiceServer 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 UnimplementedAccessControlServiceServer struct{} func (UnimplementedAccessControlServiceServer) CreateRole(context.Context, *CreateRoleRequest) (*CreateRoleResponse, error) { @@ -183,6 +187,7 @@ func (UnimplementedAccessControlServiceServer) SetDefaultRole(context.Context, * return nil, status.Errorf(codes.Unimplemented, "method SetDefaultRole not implemented") } func (UnimplementedAccessControlServiceServer) mustEmbedUnimplementedAccessControlServiceServer() {} +func (UnimplementedAccessControlServiceServer) testEmbeddedByValue() {} // UnsafeAccessControlServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AccessControlServiceServer will @@ -192,6 +197,13 @@ type UnsafeAccessControlServiceServer interface { } func RegisterAccessControlServiceServer(s grpc.ServiceRegistrar, srv AccessControlServiceServer) { + // If the following call pancis, it indicates UnimplementedAccessControlServiceServer 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(&AccessControlService_ServiceDesc, srv) } diff --git a/api/actions/v1/actions.pb.gw.go b/api/actions/v1/actions.pb.gw.go index 303a54ea81..c84fd58bf9 100644 --- a/api/actions/v1/actions.pb.gw.go +++ b/api/actions/v1/actions.pb.gw.go @@ -159,6 +159,7 @@ func local_request_ActionsService_CancelAction_0(ctx context.Context, marshaler // UnaryRPC :call ActionsServiceServer 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 RegisterActionsServiceHandlerFromEndpoint 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 RegisterActionsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ActionsServiceServer) error { mux.Handle("GET", pattern_ActionsService_GetAction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -294,7 +295,7 @@ func RegisterActionsServiceHandler(ctx context.Context, mux *runtime.ServeMux, c // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ActionsServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ActionsServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ActionsServiceClient" to call the correct interceptors. +// "ActionsServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterActionsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ActionsServiceClient) error { mux.Handle("GET", pattern_ActionsService_GetAction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/actions/v1/actions_grpc.pb.go b/api/actions/v1/actions_grpc.pb.go index e69432a684..e540a425a3 100644 --- a/api/actions/v1/actions_grpc.pb.go +++ b/api/actions/v1/actions_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: actions/v1/actions.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ActionsService_GetAction_FullMethodName = "/actions.v1.ActionsService/GetAction" @@ -92,7 +92,7 @@ func (c *actionsServiceClient) CancelAction(ctx context.Context, in *CancelActio // ActionsServiceServer is the server API for ActionsService service. // All implementations must embed UnimplementedActionsServiceServer -// for forward compatibility +// for forward compatibility. // // Actions service provides public Management API methods for Actions. type ActionsServiceServer interface { @@ -107,7 +107,11 @@ type ActionsServiceServer interface { mustEmbedUnimplementedActionsServiceServer() } -// UnimplementedActionsServiceServer must be embedded to have forward compatible implementations. +// UnimplementedActionsServiceServer 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 UnimplementedActionsServiceServer struct{} func (UnimplementedActionsServiceServer) GetAction(context.Context, *GetActionRequest) (*GetActionResponse, error) { @@ -126,6 +130,7 @@ func (UnimplementedActionsServiceServer) CancelAction(context.Context, *CancelAc return nil, status.Errorf(codes.Unimplemented, "method CancelAction not implemented") } func (UnimplementedActionsServiceServer) mustEmbedUnimplementedActionsServiceServer() {} +func (UnimplementedActionsServiceServer) testEmbeddedByValue() {} // UnsafeActionsServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ActionsServiceServer will @@ -135,6 +140,13 @@ type UnsafeActionsServiceServer interface { } func RegisterActionsServiceServer(s grpc.ServiceRegistrar, srv ActionsServiceServer) { + // If the following call pancis, it indicates UnimplementedActionsServiceServer 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(&ActionsService_ServiceDesc, srv) } diff --git a/api/advisors/v1/advisors.pb.gw.go b/api/advisors/v1/advisors.pb.gw.go index c93947474b..bff3437706 100644 --- a/api/advisors/v1/advisors.pb.gw.go +++ b/api/advisors/v1/advisors.pb.gw.go @@ -165,6 +165,7 @@ func local_request_AdvisorService_ChangeAdvisorChecks_0(ctx context.Context, mar // UnaryRPC :call AdvisorServiceServer 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 RegisterAdvisorServiceHandlerFromEndpoint 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 RegisterAdvisorServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AdvisorServiceServer) error { mux.Handle("GET", pattern_AdvisorService_ListFailedServices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -348,7 +349,7 @@ func RegisterAdvisorServiceHandler(ctx context.Context, mux *runtime.ServeMux, c // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AdvisorServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AdvisorServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AdvisorServiceClient" to call the correct interceptors. +// "AdvisorServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAdvisorServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AdvisorServiceClient) error { mux.Handle("GET", pattern_AdvisorService_ListFailedServices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/advisors/v1/advisors_grpc.pb.go b/api/advisors/v1/advisors_grpc.pb.go index e5ec9b5e74..ad91ee616f 100644 --- a/api/advisors/v1/advisors_grpc.pb.go +++ b/api/advisors/v1/advisors_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: advisors/v1/advisors.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AdvisorService_ListFailedServices_FullMethodName = "/advisors.v1.AdvisorService/ListFailedServices" @@ -118,7 +118,7 @@ func (c *advisorServiceClient) ChangeAdvisorChecks(ctx context.Context, in *Chan // AdvisorServiceServer is the server API for AdvisorService service. // All implementations must embed UnimplementedAdvisorServiceServer -// for forward compatibility +// for forward compatibility. // // AdvisorService service provides public Management API methods for Advisor Service. type AdvisorServiceServer interface { @@ -137,7 +137,11 @@ type AdvisorServiceServer interface { mustEmbedUnimplementedAdvisorServiceServer() } -// UnimplementedAdvisorServiceServer must be embedded to have forward compatible implementations. +// UnimplementedAdvisorServiceServer 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 UnimplementedAdvisorServiceServer struct{} func (UnimplementedAdvisorServiceServer) ListFailedServices(context.Context, *ListFailedServicesRequest) (*ListFailedServicesResponse, error) { @@ -164,6 +168,7 @@ func (UnimplementedAdvisorServiceServer) ChangeAdvisorChecks(context.Context, *C return nil, status.Errorf(codes.Unimplemented, "method ChangeAdvisorChecks not implemented") } func (UnimplementedAdvisorServiceServer) mustEmbedUnimplementedAdvisorServiceServer() {} +func (UnimplementedAdvisorServiceServer) testEmbeddedByValue() {} // UnsafeAdvisorServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AdvisorServiceServer will @@ -173,6 +178,13 @@ type UnsafeAdvisorServiceServer interface { } func RegisterAdvisorServiceServer(s grpc.ServiceRegistrar, srv AdvisorServiceServer) { + // If the following call pancis, it indicates UnimplementedAdvisorServiceServer 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(&AdvisorService_ServiceDesc, srv) } diff --git a/api/agent/v1/agent_grpc.pb.go b/api/agent/v1/agent_grpc.pb.go index 78ddba4871..7b0cdc51b8 100644 --- a/api/agent/v1/agent_grpc.pb.go +++ b/api/agent/v1/agent_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: agent/v1/agent.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AgentService_Connect_FullMethodName = "/agent.v1.AgentService/Connect" @@ -30,7 +30,7 @@ const ( // Agent service provides private methods for pmm-agent <-> pmm-managed interactions. type AgentServiceClient interface { // Connect establishes two-way communication channel between pmm-agent and pmm-managed. - Connect(ctx context.Context, opts ...grpc.CallOption) (AgentService_ConnectClient, error) + Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AgentMessage, ServerMessage], error) } type agentServiceClient struct { @@ -41,56 +41,42 @@ func NewAgentServiceClient(cc grpc.ClientConnInterface) AgentServiceClient { return &agentServiceClient{cc} } -func (c *agentServiceClient) Connect(ctx context.Context, opts ...grpc.CallOption) (AgentService_ConnectClient, error) { +func (c *agentServiceClient) Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AgentMessage, ServerMessage], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &AgentService_ServiceDesc.Streams[0], AgentService_Connect_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &agentServiceConnectClient{ClientStream: stream} + x := &grpc.GenericClientStream[AgentMessage, ServerMessage]{ClientStream: stream} return x, nil } -type AgentService_ConnectClient interface { - Send(*AgentMessage) error - Recv() (*ServerMessage, error) - grpc.ClientStream -} - -type agentServiceConnectClient struct { - grpc.ClientStream -} - -func (x *agentServiceConnectClient) Send(m *AgentMessage) error { - return x.ClientStream.SendMsg(m) -} - -func (x *agentServiceConnectClient) Recv() (*ServerMessage, error) { - m := new(ServerMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AgentService_ConnectClient = grpc.BidiStreamingClient[AgentMessage, ServerMessage] // AgentServiceServer is the server API for AgentService service. // All implementations must embed UnimplementedAgentServiceServer -// for forward compatibility +// for forward compatibility. // // Agent service provides private methods for pmm-agent <-> pmm-managed interactions. type AgentServiceServer interface { // Connect establishes two-way communication channel between pmm-agent and pmm-managed. - Connect(AgentService_ConnectServer) error + Connect(grpc.BidiStreamingServer[AgentMessage, ServerMessage]) error mustEmbedUnimplementedAgentServiceServer() } -// UnimplementedAgentServiceServer must be embedded to have forward compatible implementations. +// UnimplementedAgentServiceServer 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 UnimplementedAgentServiceServer struct{} -func (UnimplementedAgentServiceServer) Connect(AgentService_ConnectServer) error { +func (UnimplementedAgentServiceServer) Connect(grpc.BidiStreamingServer[AgentMessage, ServerMessage]) error { return status.Errorf(codes.Unimplemented, "method Connect not implemented") } func (UnimplementedAgentServiceServer) mustEmbedUnimplementedAgentServiceServer() {} +func (UnimplementedAgentServiceServer) testEmbeddedByValue() {} // UnsafeAgentServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AgentServiceServer will @@ -100,34 +86,22 @@ type UnsafeAgentServiceServer interface { } func RegisterAgentServiceServer(s grpc.ServiceRegistrar, srv AgentServiceServer) { + // If the following call pancis, it indicates UnimplementedAgentServiceServer 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(&AgentService_ServiceDesc, srv) } func _AgentService_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AgentServiceServer).Connect(&agentServiceConnectServer{ServerStream: stream}) -} - -type AgentService_ConnectServer interface { - Send(*ServerMessage) error - Recv() (*AgentMessage, error) - grpc.ServerStream -} - -type agentServiceConnectServer struct { - grpc.ServerStream + return srv.(AgentServiceServer).Connect(&grpc.GenericServerStream[AgentMessage, ServerMessage]{ServerStream: stream}) } -func (x *agentServiceConnectServer) Send(m *ServerMessage) error { - return x.ServerStream.SendMsg(m) -} - -func (x *agentServiceConnectServer) Recv() (*AgentMessage, error) { - m := new(AgentMessage) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AgentService_ConnectServer = grpc.BidiStreamingServer[AgentMessage, ServerMessage] // AgentService_ServiceDesc is the grpc.ServiceDesc for AgentService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/agentlocal/v1/agentlocal.pb.gw.go b/api/agentlocal/v1/agentlocal.pb.gw.go index aa1809ee16..f8795a8ff4 100644 --- a/api/agentlocal/v1/agentlocal.pb.gw.go +++ b/api/agentlocal/v1/agentlocal.pb.gw.go @@ -117,6 +117,7 @@ func local_request_AgentLocalService_Reload_0(ctx context.Context, marshaler run // UnaryRPC :call AgentLocalServiceServer 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 RegisterAgentLocalServiceHandlerFromEndpoint 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 RegisterAgentLocalServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AgentLocalServiceServer) error { mux.Handle("POST", pattern_AgentLocalService_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -228,7 +229,7 @@ func RegisterAgentLocalServiceHandler(ctx context.Context, mux *runtime.ServeMux // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AgentLocalServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AgentLocalServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AgentLocalServiceClient" to call the correct interceptors. +// "AgentLocalServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAgentLocalServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AgentLocalServiceClient) error { mux.Handle("POST", pattern_AgentLocalService_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/agentlocal/v1/agentlocal_grpc.pb.go b/api/agentlocal/v1/agentlocal_grpc.pb.go index 8575d9db67..caaffdd9ea 100644 --- a/api/agentlocal/v1/agentlocal_grpc.pb.go +++ b/api/agentlocal/v1/agentlocal_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: agentlocal/v1/agentlocal.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AgentLocalService_Status_FullMethodName = "/agentlocal.v1.AgentLocalService/Status" @@ -66,7 +66,7 @@ func (c *agentLocalServiceClient) Reload(ctx context.Context, in *ReloadRequest, // AgentLocalServiceServer is the server API for AgentLocalService service. // All implementations must embed UnimplementedAgentLocalServiceServer -// for forward compatibility +// for forward compatibility. // // AgentLocal service provides public methods for checking pmm-agent status locally. type AgentLocalServiceServer interface { @@ -77,7 +77,11 @@ type AgentLocalServiceServer interface { mustEmbedUnimplementedAgentLocalServiceServer() } -// UnimplementedAgentLocalServiceServer must be embedded to have forward compatible implementations. +// UnimplementedAgentLocalServiceServer 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 UnimplementedAgentLocalServiceServer struct{} func (UnimplementedAgentLocalServiceServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) { @@ -88,6 +92,7 @@ func (UnimplementedAgentLocalServiceServer) Reload(context.Context, *ReloadReque return nil, status.Errorf(codes.Unimplemented, "method Reload not implemented") } func (UnimplementedAgentLocalServiceServer) mustEmbedUnimplementedAgentLocalServiceServer() {} +func (UnimplementedAgentLocalServiceServer) testEmbeddedByValue() {} // UnsafeAgentLocalServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AgentLocalServiceServer will @@ -97,6 +102,13 @@ type UnsafeAgentLocalServiceServer interface { } func RegisterAgentLocalServiceServer(s grpc.ServiceRegistrar, srv AgentLocalServiceServer) { + // If the following call pancis, it indicates UnimplementedAgentLocalServiceServer 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(&AgentLocalService_ServiceDesc, srv) } diff --git a/api/alerting/v1/alerting.pb.gw.go b/api/alerting/v1/alerting.pb.gw.go index 30d3b577df..8edb3ca048 100644 --- a/api/alerting/v1/alerting.pb.gw.go +++ b/api/alerting/v1/alerting.pb.gw.go @@ -225,6 +225,7 @@ func local_request_AlertingService_CreateRule_0(ctx context.Context, marshaler r // UnaryRPC :call AlertingServiceServer 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 RegisterAlertingServiceHandlerFromEndpoint 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 RegisterAlertingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AlertingServiceServer) error { mux.Handle("GET", pattern_AlertingService_ListTemplates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -384,7 +385,7 @@ func RegisterAlertingServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AlertingServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AlertingServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AlertingServiceClient" to call the correct interceptors. +// "AlertingServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAlertingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AlertingServiceClient) error { mux.Handle("GET", pattern_AlertingService_ListTemplates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/alerting/v1/alerting_grpc.pb.go b/api/alerting/v1/alerting_grpc.pb.go index e8b95b985f..94c17b63db 100644 --- a/api/alerting/v1/alerting_grpc.pb.go +++ b/api/alerting/v1/alerting_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: alerting/v1/alerting.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AlertingService_ListTemplates_FullMethodName = "/alerting.v1.AlertingService/ListTemplates" @@ -105,7 +105,7 @@ func (c *alertingServiceClient) CreateRule(ctx context.Context, in *CreateRuleRe // AlertingServiceServer is the server API for AlertingService service. // All implementations must embed UnimplementedAlertingServiceServer -// for forward compatibility +// for forward compatibility. // // Alerting service lets to manage alerting templates and create alerting rules from them. type AlertingServiceServer interface { @@ -122,7 +122,11 @@ type AlertingServiceServer interface { mustEmbedUnimplementedAlertingServiceServer() } -// UnimplementedAlertingServiceServer must be embedded to have forward compatible implementations. +// UnimplementedAlertingServiceServer 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 UnimplementedAlertingServiceServer struct{} func (UnimplementedAlertingServiceServer) ListTemplates(context.Context, *ListTemplatesRequest) (*ListTemplatesResponse, error) { @@ -145,6 +149,7 @@ func (UnimplementedAlertingServiceServer) CreateRule(context.Context, *CreateRul return nil, status.Errorf(codes.Unimplemented, "method CreateRule not implemented") } func (UnimplementedAlertingServiceServer) mustEmbedUnimplementedAlertingServiceServer() {} +func (UnimplementedAlertingServiceServer) testEmbeddedByValue() {} // UnsafeAlertingServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AlertingServiceServer will @@ -154,6 +159,13 @@ type UnsafeAlertingServiceServer interface { } func RegisterAlertingServiceServer(s grpc.ServiceRegistrar, srv AlertingServiceServer) { + // If the following call pancis, it indicates UnimplementedAlertingServiceServer 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(&AlertingService_ServiceDesc, srv) } diff --git a/api/backup/v1/backup.pb.gw.go b/api/backup/v1/backup.pb.gw.go index e72749708f..65d84b9c88 100644 --- a/api/backup/v1/backup.pb.gw.go +++ b/api/backup/v1/backup.pb.gw.go @@ -423,6 +423,7 @@ func local_request_BackupService_ListPitrTimeranges_0(ctx context.Context, marsh // UnaryRPC :call BackupServiceServer 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 RegisterBackupServiceHandlerFromEndpoint 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 RegisterBackupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BackupServiceServer) error { mux.Handle("POST", pattern_BackupService_StartBackup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -702,7 +703,7 @@ func RegisterBackupServiceHandler(ctx context.Context, mux *runtime.ServeMux, co // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BackupServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BackupServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "BackupServiceClient" to call the correct interceptors. +// "BackupServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterBackupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BackupServiceClient) error { mux.Handle("POST", pattern_BackupService_StartBackup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/backup/v1/backup_grpc.pb.go b/api/backup/v1/backup_grpc.pb.go index 85a46afffa..42c2f58561 100644 --- a/api/backup/v1/backup_grpc.pb.go +++ b/api/backup/v1/backup_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: backup/v1/backup.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( BackupService_StartBackup_FullMethodName = "/backup.v1.BackupService/StartBackup" @@ -170,7 +170,7 @@ func (c *backupServiceClient) ListPitrTimeranges(ctx context.Context, in *ListPi // BackupServiceServer is the server API for BackupService service. // All implementations must embed UnimplementedBackupServiceServer -// for forward compatibility +// for forward compatibility. // // Backups service handles backup operations to DB. type BackupServiceServer interface { @@ -197,7 +197,11 @@ type BackupServiceServer interface { mustEmbedUnimplementedBackupServiceServer() } -// UnimplementedBackupServiceServer must be embedded to have forward compatible implementations. +// UnimplementedBackupServiceServer 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 UnimplementedBackupServiceServer struct{} func (UnimplementedBackupServiceServer) StartBackup(context.Context, *StartBackupRequest) (*StartBackupResponse, error) { @@ -240,6 +244,7 @@ func (UnimplementedBackupServiceServer) ListPitrTimeranges(context.Context, *Lis return nil, status.Errorf(codes.Unimplemented, "method ListPitrTimeranges not implemented") } func (UnimplementedBackupServiceServer) mustEmbedUnimplementedBackupServiceServer() {} +func (UnimplementedBackupServiceServer) testEmbeddedByValue() {} // UnsafeBackupServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BackupServiceServer will @@ -249,6 +254,13 @@ type UnsafeBackupServiceServer interface { } func RegisterBackupServiceServer(s grpc.ServiceRegistrar, srv BackupServiceServer) { + // If the following call pancis, it indicates UnimplementedBackupServiceServer 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(&BackupService_ServiceDesc, srv) } diff --git a/api/backup/v1/locations.pb.gw.go b/api/backup/v1/locations.pb.gw.go index 9db00fd1d8..63fe8d8483 100644 --- a/api/backup/v1/locations.pb.gw.go +++ b/api/backup/v1/locations.pb.gw.go @@ -225,6 +225,7 @@ func local_request_LocationsService_TestLocationConfig_0(ctx context.Context, ma // UnaryRPC :call LocationsServiceServer 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 RegisterLocationsServiceHandlerFromEndpoint 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 RegisterLocationsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LocationsServiceServer) error { mux.Handle("GET", pattern_LocationsService_ListLocations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -384,7 +385,7 @@ func RegisterLocationsServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LocationsServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LocationsServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "LocationsServiceClient" to call the correct interceptors. +// "LocationsServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterLocationsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LocationsServiceClient) error { mux.Handle("GET", pattern_LocationsService_ListLocations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/backup/v1/locations_grpc.pb.go b/api/backup/v1/locations_grpc.pb.go index 6ac76578da..748f7a20ad 100644 --- a/api/backup/v1/locations_grpc.pb.go +++ b/api/backup/v1/locations_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: backup/v1/locations.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( LocationsService_ListLocations_FullMethodName = "/backup.v1.LocationsService/ListLocations" @@ -105,7 +105,7 @@ func (c *locationsServiceClient) TestLocationConfig(ctx context.Context, in *Tes // LocationsServiceServer is the server API for LocationsService service. // All implementations must embed UnimplementedLocationsServiceServer -// for forward compatibility +// for forward compatibility. // // Locations service provides access to Backup Locations. type LocationsServiceServer interface { @@ -122,7 +122,11 @@ type LocationsServiceServer interface { mustEmbedUnimplementedLocationsServiceServer() } -// UnimplementedLocationsServiceServer must be embedded to have forward compatible implementations. +// UnimplementedLocationsServiceServer 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 UnimplementedLocationsServiceServer struct{} func (UnimplementedLocationsServiceServer) ListLocations(context.Context, *ListLocationsRequest) (*ListLocationsResponse, error) { @@ -145,6 +149,7 @@ func (UnimplementedLocationsServiceServer) TestLocationConfig(context.Context, * return nil, status.Errorf(codes.Unimplemented, "method TestLocationConfig not implemented") } func (UnimplementedLocationsServiceServer) mustEmbedUnimplementedLocationsServiceServer() {} +func (UnimplementedLocationsServiceServer) testEmbeddedByValue() {} // UnsafeLocationsServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to LocationsServiceServer will @@ -154,6 +159,13 @@ type UnsafeLocationsServiceServer interface { } func RegisterLocationsServiceServer(s grpc.ServiceRegistrar, srv LocationsServiceServer) { + // If the following call pancis, it indicates UnimplementedLocationsServiceServer 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(&LocationsService_ServiceDesc, srv) } diff --git a/api/backup/v1/restores.pb.gw.go b/api/backup/v1/restores.pb.gw.go index 86fe9e5af2..a23df5f9d3 100644 --- a/api/backup/v1/restores.pb.gw.go +++ b/api/backup/v1/restores.pb.gw.go @@ -143,6 +143,7 @@ func local_request_RestoreService_RestoreBackup_0(ctx context.Context, marshaler // UnaryRPC :call RestoreServiceServer 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 RegisterRestoreServiceHandlerFromEndpoint 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 RegisterRestoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RestoreServiceServer) error { mux.Handle("GET", pattern_RestoreService_ListRestores_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -254,7 +255,7 @@ func RegisterRestoreServiceHandler(ctx context.Context, mux *runtime.ServeMux, c // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RestoreServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RestoreServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "RestoreServiceClient" to call the correct interceptors. +// "RestoreServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterRestoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RestoreServiceClient) error { mux.Handle("GET", pattern_RestoreService_ListRestores_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/backup/v1/restores_grpc.pb.go b/api/backup/v1/restores_grpc.pb.go index 0b6dd4ea96..e1371c479f 100644 --- a/api/backup/v1/restores_grpc.pb.go +++ b/api/backup/v1/restores_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: backup/v1/restores.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( RestoreService_ListRestores_FullMethodName = "/backup.v1.RestoreService/ListRestores" @@ -79,7 +79,7 @@ func (c *restoreServiceClient) RestoreBackup(ctx context.Context, in *RestoreBac // RestoreServiceServer is the server API for RestoreService service. // All implementations must embed UnimplementedRestoreServiceServer -// for forward compatibility +// for forward compatibility. // // RestoreService provides public methods for managing backup restore history. type RestoreServiceServer interface { @@ -92,7 +92,11 @@ type RestoreServiceServer interface { mustEmbedUnimplementedRestoreServiceServer() } -// UnimplementedRestoreServiceServer must be embedded to have forward compatible implementations. +// UnimplementedRestoreServiceServer 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 UnimplementedRestoreServiceServer struct{} func (UnimplementedRestoreServiceServer) ListRestores(context.Context, *ListRestoresRequest) (*ListRestoresResponse, error) { @@ -107,6 +111,7 @@ func (UnimplementedRestoreServiceServer) RestoreBackup(context.Context, *Restore return nil, status.Errorf(codes.Unimplemented, "method RestoreBackup not implemented") } func (UnimplementedRestoreServiceServer) mustEmbedUnimplementedRestoreServiceServer() {} +func (UnimplementedRestoreServiceServer) testEmbeddedByValue() {} // UnsafeRestoreServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RestoreServiceServer will @@ -116,6 +121,13 @@ type UnsafeRestoreServiceServer interface { } func RegisterRestoreServiceServer(s grpc.ServiceRegistrar, srv RestoreServiceServer) { + // If the following call pancis, it indicates UnimplementedRestoreServiceServer 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(&RestoreService_ServiceDesc, srv) } diff --git a/api/dump/v1beta1/dump.pb.gw.go b/api/dump/v1beta1/dump.pb.gw.go index 952aa0cad0..3ffa7d594e 100644 --- a/api/dump/v1beta1/dump.pb.gw.go +++ b/api/dump/v1beta1/dump.pb.gw.go @@ -191,6 +191,7 @@ func local_request_DumpService_UploadDump_0(ctx context.Context, marshaler runti // UnaryRPC :call DumpServiceServer 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 RegisterDumpServiceHandlerFromEndpoint 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 RegisterDumpServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DumpServiceServer) error { mux.Handle("POST", pattern_DumpService_StartDump_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -350,7 +351,7 @@ func RegisterDumpServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DumpServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DumpServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "DumpServiceClient" to call the correct interceptors. +// "DumpServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterDumpServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DumpServiceClient) error { mux.Handle("POST", pattern_DumpService_StartDump_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/dump/v1beta1/dump_grpc.pb.go b/api/dump/v1beta1/dump_grpc.pb.go index 3edb5c395f..5b859aafc6 100644 --- a/api/dump/v1beta1/dump_grpc.pb.go +++ b/api/dump/v1beta1/dump_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: dump/v1beta1/dump.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( DumpService_StartDump_FullMethodName = "/dump.v1beta1.DumpService/StartDump" @@ -103,7 +103,7 @@ func (c *dumpServiceClient) UploadDump(ctx context.Context, in *UploadDumpReques // DumpServiceServer is the server API for DumpService service. // All implementations must embed UnimplementedDumpServiceServer -// for forward compatibility +// for forward compatibility. type DumpServiceServer interface { // StartDump request creates pmm dump. StartDump(context.Context, *StartDumpRequest) (*StartDumpResponse, error) @@ -118,7 +118,11 @@ type DumpServiceServer interface { mustEmbedUnimplementedDumpServiceServer() } -// UnimplementedDumpServiceServer must be embedded to have forward compatible implementations. +// UnimplementedDumpServiceServer 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 UnimplementedDumpServiceServer struct{} func (UnimplementedDumpServiceServer) StartDump(context.Context, *StartDumpRequest) (*StartDumpResponse, error) { @@ -141,6 +145,7 @@ func (UnimplementedDumpServiceServer) UploadDump(context.Context, *UploadDumpReq return nil, status.Errorf(codes.Unimplemented, "method UploadDump not implemented") } func (UnimplementedDumpServiceServer) mustEmbedUnimplementedDumpServiceServer() {} +func (UnimplementedDumpServiceServer) testEmbeddedByValue() {} // UnsafeDumpServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DumpServiceServer will @@ -150,6 +155,13 @@ type UnsafeDumpServiceServer interface { } func RegisterDumpServiceServer(s grpc.ServiceRegistrar, srv DumpServiceServer) { + // If the following call pancis, it indicates UnimplementedDumpServiceServer 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(&DumpService_ServiceDesc, srv) } diff --git a/api/inventory/v1/agents.pb.gw.go b/api/inventory/v1/agents.pb.gw.go index 3aa3815845..ea823e5f0f 100644 --- a/api/inventory/v1/agents.pb.gw.go +++ b/api/inventory/v1/agents.pb.gw.go @@ -333,6 +333,7 @@ func local_request_AgentsService_RemoveAgent_0(ctx context.Context, marshaler ru // UnaryRPC :call AgentsServiceServer 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 RegisterAgentsServiceHandlerFromEndpoint 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 RegisterAgentsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AgentsServiceServer) error { mux.Handle("GET", pattern_AgentsService_ListAgents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -516,7 +517,7 @@ func RegisterAgentsServiceHandler(ctx context.Context, mux *runtime.ServeMux, co // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AgentsServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AgentsServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AgentsServiceClient" to call the correct interceptors. +// "AgentsServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAgentsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AgentsServiceClient) error { mux.Handle("GET", pattern_AgentsService_ListAgents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/inventory/v1/agents_grpc.pb.go b/api/inventory/v1/agents_grpc.pb.go index 49c5ad1067..5b26504a01 100644 --- a/api/inventory/v1/agents_grpc.pb.go +++ b/api/inventory/v1/agents_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: inventory/v1/agents.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( AgentsService_ListAgents_FullMethodName = "/inventory.v1.AgentsService/ListAgents" @@ -118,7 +118,7 @@ func (c *agentsServiceClient) RemoveAgent(ctx context.Context, in *RemoveAgentRe // AgentsServiceServer is the server API for AgentsService service. // All implementations must embed UnimplementedAgentsServiceServer -// for forward compatibility +// for forward compatibility. // // Agents service provides public methods for managing Agents. type AgentsServiceServer interface { @@ -137,7 +137,11 @@ type AgentsServiceServer interface { mustEmbedUnimplementedAgentsServiceServer() } -// UnimplementedAgentsServiceServer must be embedded to have forward compatible implementations. +// UnimplementedAgentsServiceServer 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 UnimplementedAgentsServiceServer struct{} func (UnimplementedAgentsServiceServer) ListAgents(context.Context, *ListAgentsRequest) (*ListAgentsResponse, error) { @@ -164,6 +168,7 @@ func (UnimplementedAgentsServiceServer) RemoveAgent(context.Context, *RemoveAgen return nil, status.Errorf(codes.Unimplemented, "method RemoveAgent not implemented") } func (UnimplementedAgentsServiceServer) mustEmbedUnimplementedAgentsServiceServer() {} +func (UnimplementedAgentsServiceServer) testEmbeddedByValue() {} // UnsafeAgentsServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AgentsServiceServer will @@ -173,6 +178,13 @@ type UnsafeAgentsServiceServer interface { } func RegisterAgentsServiceServer(s grpc.ServiceRegistrar, srv AgentsServiceServer) { + // If the following call pancis, it indicates UnimplementedAgentsServiceServer 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(&AgentsService_ServiceDesc, srv) } diff --git a/api/inventory/v1/nodes.pb.gw.go b/api/inventory/v1/nodes.pb.gw.go index 1a09054da1..b6ee5b6c38 100644 --- a/api/inventory/v1/nodes.pb.gw.go +++ b/api/inventory/v1/nodes.pb.gw.go @@ -209,6 +209,7 @@ func local_request_NodesService_RemoveNode_0(ctx context.Context, marshaler runt // UnaryRPC :call NodesServiceServer 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 RegisterNodesServiceHandlerFromEndpoint 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 RegisterNodesServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NodesServiceServer) error { mux.Handle("GET", pattern_NodesService_ListNodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -344,7 +345,7 @@ func RegisterNodesServiceHandler(ctx context.Context, mux *runtime.ServeMux, con // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NodesServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NodesServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "NodesServiceClient" to call the correct interceptors. +// "NodesServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterNodesServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NodesServiceClient) error { mux.Handle("GET", pattern_NodesService_ListNodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/inventory/v1/nodes_grpc.pb.go b/api/inventory/v1/nodes_grpc.pb.go index 9f3e952b28..86f5ff2104 100644 --- a/api/inventory/v1/nodes_grpc.pb.go +++ b/api/inventory/v1/nodes_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: inventory/v1/nodes.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( NodesService_ListNodes_FullMethodName = "/inventory.v1.NodesService/ListNodes" @@ -92,7 +92,7 @@ func (c *nodesServiceClient) RemoveNode(ctx context.Context, in *RemoveNodeReque // NodesServiceServer is the server API for NodesService service. // All implementations must embed UnimplementedNodesServiceServer -// for forward compatibility +// for forward compatibility. // // Nodes service provides public methods for managing Nodes. type NodesServiceServer interface { @@ -107,7 +107,11 @@ type NodesServiceServer interface { mustEmbedUnimplementedNodesServiceServer() } -// UnimplementedNodesServiceServer must be embedded to have forward compatible implementations. +// UnimplementedNodesServiceServer 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 UnimplementedNodesServiceServer struct{} func (UnimplementedNodesServiceServer) ListNodes(context.Context, *ListNodesRequest) (*ListNodesResponse, error) { @@ -126,6 +130,7 @@ func (UnimplementedNodesServiceServer) RemoveNode(context.Context, *RemoveNodeRe return nil, status.Errorf(codes.Unimplemented, "method RemoveNode not implemented") } func (UnimplementedNodesServiceServer) mustEmbedUnimplementedNodesServiceServer() {} +func (UnimplementedNodesServiceServer) testEmbeddedByValue() {} // UnsafeNodesServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to NodesServiceServer will @@ -135,6 +140,13 @@ type UnsafeNodesServiceServer interface { } func RegisterNodesServiceServer(s grpc.ServiceRegistrar, srv NodesServiceServer) { + // If the following call pancis, it indicates UnimplementedNodesServiceServer 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(&NodesService_ServiceDesc, srv) } diff --git a/api/inventory/v1/services.pb.gw.go b/api/inventory/v1/services.pb.gw.go index 99b7eba49d..77a826da39 100644 --- a/api/inventory/v1/services.pb.gw.go +++ b/api/inventory/v1/services.pb.gw.go @@ -291,6 +291,7 @@ func local_request_ServicesService_ChangeService_0(ctx context.Context, marshale // UnaryRPC :call ServicesServiceServer 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 RegisterServicesServiceHandlerFromEndpoint 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 RegisterServicesServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServicesServiceServer) error { mux.Handle("GET", pattern_ServicesService_ListServices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -474,7 +475,7 @@ func RegisterServicesServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServicesServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServicesServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ServicesServiceClient" to call the correct interceptors. +// "ServicesServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterServicesServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServicesServiceClient) error { mux.Handle("GET", pattern_ServicesService_ListServices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/inventory/v1/services_grpc.pb.go b/api/inventory/v1/services_grpc.pb.go index 049c6bbab4..55a382a871 100644 --- a/api/inventory/v1/services_grpc.pb.go +++ b/api/inventory/v1/services_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: inventory/v1/services.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ServicesService_ListServices_FullMethodName = "/inventory.v1.ServicesService/ListServices" @@ -118,7 +118,7 @@ func (c *servicesServiceClient) ChangeService(ctx context.Context, in *ChangeSer // ServicesServiceServer is the server API for ServicesService service. // All implementations must embed UnimplementedServicesServiceServer -// for forward compatibility +// for forward compatibility. // // Services service provides public methods for managing Services. type ServicesServiceServer interface { @@ -137,7 +137,11 @@ type ServicesServiceServer interface { mustEmbedUnimplementedServicesServiceServer() } -// UnimplementedServicesServiceServer must be embedded to have forward compatible implementations. +// UnimplementedServicesServiceServer 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 UnimplementedServicesServiceServer struct{} func (UnimplementedServicesServiceServer) ListServices(context.Context, *ListServicesRequest) (*ListServicesResponse, error) { @@ -164,6 +168,7 @@ func (UnimplementedServicesServiceServer) ChangeService(context.Context, *Change return nil, status.Errorf(codes.Unimplemented, "method ChangeService not implemented") } func (UnimplementedServicesServiceServer) mustEmbedUnimplementedServicesServiceServer() {} +func (UnimplementedServicesServiceServer) testEmbeddedByValue() {} // UnsafeServicesServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServicesServiceServer will @@ -173,6 +178,13 @@ type UnsafeServicesServiceServer interface { } func RegisterServicesServiceServer(s grpc.ServiceRegistrar, srv ServicesServiceServer) { + // If the following call pancis, it indicates UnimplementedServicesServiceServer 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(&ServicesService_ServiceDesc, srv) } diff --git a/api/management/v1/service.pb.gw.go b/api/management/v1/service.pb.gw.go index 70448811f9..b71f27c3f6 100644 --- a/api/management/v1/service.pb.gw.go +++ b/api/management/v1/service.pb.gw.go @@ -475,6 +475,7 @@ func local_request_ManagementService_RemoveService_0(ctx context.Context, marsha // UnaryRPC :call ManagementServiceServer 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 RegisterManagementServiceHandlerFromEndpoint 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 RegisterManagementServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ManagementServiceServer) error { mux.Handle("POST", pattern_ManagementService_AddAnnotation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -826,7 +827,7 @@ func RegisterManagementServiceHandler(ctx context.Context, mux *runtime.ServeMux // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ManagementServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ManagementServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ManagementServiceClient" to call the correct interceptors. +// "ManagementServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterManagementServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ManagementServiceClient) error { mux.Handle("POST", pattern_ManagementService_AddAnnotation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/management/v1/service_grpc.pb.go b/api/management/v1/service_grpc.pb.go index 20cd067916..476fd197e4 100644 --- a/api/management/v1/service_grpc.pb.go +++ b/api/management/v1/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: management/v1/service.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ManagementService_AddAnnotation_FullMethodName = "/management.v1.ManagementService/AddAnnotation" @@ -209,7 +209,7 @@ func (c *managementServiceClient) RemoveService(ctx context.Context, in *RemoveS // ManagementServiceServer is the server API for ManagementService service. // All implementations must embed UnimplementedManagementServiceServer -// for forward compatibility +// for forward compatibility. // // ManagementService provides public methods for managing and querying Services. type ManagementServiceServer interface { @@ -242,7 +242,11 @@ type ManagementServiceServer interface { mustEmbedUnimplementedManagementServiceServer() } -// UnimplementedManagementServiceServer must be embedded to have forward compatible implementations. +// UnimplementedManagementServiceServer 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 UnimplementedManagementServiceServer struct{} func (UnimplementedManagementServiceServer) AddAnnotation(context.Context, *AddAnnotationRequest) (*AddAnnotationResponse, error) { @@ -297,6 +301,7 @@ func (UnimplementedManagementServiceServer) RemoveService(context.Context, *Remo return nil, status.Errorf(codes.Unimplemented, "method RemoveService not implemented") } func (UnimplementedManagementServiceServer) mustEmbedUnimplementedManagementServiceServer() {} +func (UnimplementedManagementServiceServer) testEmbeddedByValue() {} // UnsafeManagementServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ManagementServiceServer will @@ -306,6 +311,13 @@ type UnsafeManagementServiceServer interface { } func RegisterManagementServiceServer(s grpc.ServiceRegistrar, srv ManagementServiceServer) { + // If the following call pancis, it indicates UnimplementedManagementServiceServer 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(&ManagementService_ServiceDesc, srv) } diff --git a/api/platform/v1/platform.pb.gw.go b/api/platform/v1/platform.pb.gw.go index 5f679e02d2..06cfee4c9e 100644 --- a/api/platform/v1/platform.pb.gw.go +++ b/api/platform/v1/platform.pb.gw.go @@ -165,6 +165,7 @@ func local_request_PlatformService_UserStatus_0(ctx context.Context, marshaler r // UnaryRPC :call PlatformServiceServer 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 RegisterPlatformServiceHandlerFromEndpoint 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 RegisterPlatformServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PlatformServiceServer) error { mux.Handle("POST", pattern_PlatformService_Connect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -372,7 +373,7 @@ func RegisterPlatformServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PlatformServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PlatformServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "PlatformServiceClient" to call the correct interceptors. +// "PlatformServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterPlatformServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PlatformServiceClient) error { mux.Handle("POST", pattern_PlatformService_Connect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/platform/v1/platform_grpc.pb.go b/api/platform/v1/platform_grpc.pb.go index c327764dd0..42cadaab2d 100644 --- a/api/platform/v1/platform_grpc.pb.go +++ b/api/platform/v1/platform_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: platform/v1/platform.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( PlatformService_Connect_FullMethodName = "/platform.v1.PlatformService/Connect" @@ -131,7 +131,7 @@ func (c *platformServiceClient) UserStatus(ctx context.Context, in *UserStatusRe // PlatformServiceServer is the server API for PlatformService service. // All implementations must embed UnimplementedPlatformServiceServer -// for forward compatibility +// for forward compatibility. // // Platform contains rpcs related to Percona Platform. type PlatformServiceServer interface { @@ -152,7 +152,11 @@ type PlatformServiceServer interface { mustEmbedUnimplementedPlatformServiceServer() } -// UnimplementedPlatformServiceServer must be embedded to have forward compatible implementations. +// UnimplementedPlatformServiceServer 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 UnimplementedPlatformServiceServer struct{} func (UnimplementedPlatformServiceServer) Connect(context.Context, *ConnectRequest) (*ConnectResponse, error) { @@ -183,6 +187,7 @@ func (UnimplementedPlatformServiceServer) UserStatus(context.Context, *UserStatu return nil, status.Errorf(codes.Unimplemented, "method UserStatus not implemented") } func (UnimplementedPlatformServiceServer) mustEmbedUnimplementedPlatformServiceServer() {} +func (UnimplementedPlatformServiceServer) testEmbeddedByValue() {} // UnsafePlatformServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PlatformServiceServer will @@ -192,6 +197,13 @@ type UnsafePlatformServiceServer interface { } func RegisterPlatformServiceServer(s grpc.ServiceRegistrar, srv PlatformServiceServer) { + // If the following call pancis, it indicates UnimplementedPlatformServiceServer 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(&PlatformService_ServiceDesc, srv) } diff --git a/api/qan/v1/collector_grpc.pb.go b/api/qan/v1/collector_grpc.pb.go index 86985e04aa..27f7ffbcdd 100644 --- a/api/qan/v1/collector_grpc.pb.go +++ b/api/qan/v1/collector_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: qan/v1/collector.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( CollectorService_Collect_FullMethodName = "/qan.v1.CollectorService/Collect" @@ -53,7 +53,7 @@ func (c *collectorServiceClient) Collect(ctx context.Context, in *CollectRequest // CollectorServiceServer is the server API for CollectorService service. // All implementations must embed UnimplementedCollectorServiceServer -// for forward compatibility +// for forward compatibility. // // Collector service accepts data from pmm-agent (via pmm-managed). type CollectorServiceServer interface { @@ -62,13 +62,18 @@ type CollectorServiceServer interface { mustEmbedUnimplementedCollectorServiceServer() } -// UnimplementedCollectorServiceServer must be embedded to have forward compatible implementations. +// UnimplementedCollectorServiceServer 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 UnimplementedCollectorServiceServer struct{} func (UnimplementedCollectorServiceServer) Collect(context.Context, *CollectRequest) (*CollectResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Collect not implemented") } func (UnimplementedCollectorServiceServer) mustEmbedUnimplementedCollectorServiceServer() {} +func (UnimplementedCollectorServiceServer) testEmbeddedByValue() {} // UnsafeCollectorServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to CollectorServiceServer will @@ -78,6 +83,13 @@ type UnsafeCollectorServiceServer interface { } func RegisterCollectorServiceServer(s grpc.ServiceRegistrar, srv CollectorServiceServer) { + // If the following call pancis, it indicates UnimplementedCollectorServiceServer 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(&CollectorService_ServiceDesc, srv) } diff --git a/api/qan/v1/service.pb.gw.go b/api/qan/v1/service.pb.gw.go index d6c3596154..7046112486 100644 --- a/api/qan/v1/service.pb.gw.go +++ b/api/qan/v1/service.pb.gw.go @@ -327,6 +327,7 @@ func local_request_QANService_GetQueryExample_0(ctx context.Context, marshaler r // UnaryRPC :call QANServiceServer 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 RegisterQANServiceHandlerFromEndpoint 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 RegisterQANServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QANServiceServer) error { mux.Handle("POST", pattern_QANService_GetReport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -630,7 +631,7 @@ func RegisterQANServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QANServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QANServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QANServiceClient" to call the correct interceptors. +// "QANServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterQANServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QANServiceClient) error { mux.Handle("POST", pattern_QANService_GetReport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/qan/v1/service_grpc.pb.go b/api/qan/v1/service_grpc.pb.go index 515e11c5df..75fc7b8118 100644 --- a/api/qan/v1/service_grpc.pb.go +++ b/api/qan/v1/service_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: qan/v1/service.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( QANService_GetReport_FullMethodName = "/qan.v1.QANService/GetReport" @@ -183,7 +183,7 @@ func (c *qANServiceClient) GetQueryExample(ctx context.Context, in *GetQueryExam // QANServiceServer is the server API for QANService service. // All implementations must embed UnimplementedQANServiceServer -// for forward compatibility +// for forward compatibility. // // QANService provides an API to interact with PMM Query Analytics. type QANServiceServer interface { @@ -212,7 +212,11 @@ type QANServiceServer interface { mustEmbedUnimplementedQANServiceServer() } -// UnimplementedQANServiceServer must be embedded to have forward compatible implementations. +// UnimplementedQANServiceServer 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 UnimplementedQANServiceServer struct{} func (UnimplementedQANServiceServer) GetReport(context.Context, *GetReportRequest) (*GetReportResponse, error) { @@ -259,6 +263,7 @@ func (UnimplementedQANServiceServer) GetQueryExample(context.Context, *GetQueryE return nil, status.Errorf(codes.Unimplemented, "method GetQueryExample not implemented") } func (UnimplementedQANServiceServer) mustEmbedUnimplementedQANServiceServer() {} +func (UnimplementedQANServiceServer) testEmbeddedByValue() {} // UnsafeQANServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to QANServiceServer will @@ -268,6 +273,13 @@ type UnsafeQANServiceServer interface { } func RegisterQANServiceServer(s grpc.ServiceRegistrar, srv QANServiceServer) { + // If the following call pancis, it indicates UnimplementedQANServiceServer 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(&QANService_ServiceDesc, srv) } diff --git a/api/server/v1/server.pb.gw.go b/api/server/v1/server.pb.gw.go index ba65789293..07e35fb1ec 100644 --- a/api/server/v1/server.pb.gw.go +++ b/api/server/v1/server.pb.gw.go @@ -221,6 +221,7 @@ func local_request_ServerService_ChangeSettings_0(ctx context.Context, marshaler // UnaryRPC :call ServerServiceServer 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 RegisterServerServiceHandlerFromEndpoint 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 RegisterServerServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServerServiceServer) error { mux.Handle("GET", pattern_ServerService_Version_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -452,7 +453,7 @@ func RegisterServerServiceHandler(ctx context.Context, mux *runtime.ServeMux, co // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServerServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServerServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ServerServiceClient" to call the correct interceptors. +// "ServerServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterServerServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServerServiceClient) error { mux.Handle("GET", pattern_ServerService_Version_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/server/v1/server_grpc.pb.go b/api/server/v1/server_grpc.pb.go index 528ca59472..708f24cadf 100644 --- a/api/server/v1/server_grpc.pb.go +++ b/api/server/v1/server_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: server/v1/server.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ServerService_Version_FullMethodName = "/server.v1.ServerService/Version" @@ -145,7 +145,7 @@ func (c *serverServiceClient) ChangeSettings(ctx context.Context, in *ChangeSett // ServerServiceServer is the server API for ServerService service. // All implementations must embed UnimplementedServerServiceServer -// for forward compatibility +// for forward compatibility. // // Server service provides generic PMM Server public APIs. type ServerServiceServer interface { @@ -169,7 +169,11 @@ type ServerServiceServer interface { mustEmbedUnimplementedServerServiceServer() } -// UnimplementedServerServiceServer must be embedded to have forward compatible implementations. +// UnimplementedServerServiceServer 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 UnimplementedServerServiceServer struct{} func (UnimplementedServerServiceServer) Version(context.Context, *VersionRequest) (*VersionResponse, error) { @@ -204,6 +208,7 @@ func (UnimplementedServerServiceServer) ChangeSettings(context.Context, *ChangeS return nil, status.Errorf(codes.Unimplemented, "method ChangeSettings not implemented") } func (UnimplementedServerServiceServer) mustEmbedUnimplementedServerServiceServer() {} +func (UnimplementedServerServiceServer) testEmbeddedByValue() {} // UnsafeServerServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServerServiceServer will @@ -213,6 +218,13 @@ type UnsafeServerServiceServer interface { } func RegisterServerServiceServer(s grpc.ServiceRegistrar, srv ServerServiceServer) { + // If the following call pancis, it indicates UnimplementedServerServiceServer 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(&ServerService_ServiceDesc, srv) } diff --git a/api/uievents/v1/server.pb.gw.go b/api/uievents/v1/server.pb.gw.go index f2478069f3..784ea0403f 100644 --- a/api/uievents/v1/server.pb.gw.go +++ b/api/uievents/v1/server.pb.gw.go @@ -61,6 +61,7 @@ func local_request_UIEventsService_Store_0(ctx context.Context, marshaler runtim // UnaryRPC :call UIEventsServiceServer 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 RegisterUIEventsServiceHandlerFromEndpoint 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 RegisterUIEventsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UIEventsServiceServer) error { mux.Handle("POST", pattern_UIEventsService_Store_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -124,7 +125,7 @@ func RegisterUIEventsServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UIEventsServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UIEventsServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "UIEventsServiceClient" to call the correct interceptors. +// "UIEventsServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterUIEventsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UIEventsServiceClient) error { mux.Handle("POST", pattern_UIEventsService_Store_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/uievents/v1/server_grpc.pb.go b/api/uievents/v1/server_grpc.pb.go index cc19473033..b763803e1f 100644 --- a/api/uievents/v1/server_grpc.pb.go +++ b/api/uievents/v1/server_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: uievents/v1/server.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( UIEventsService_Store_FullMethodName = "/uievents.v1.UIEventsService/Store" @@ -53,7 +53,7 @@ func (c *uIEventsServiceClient) Store(ctx context.Context, in *StoreRequest, opt // UIEventsServiceServer is the server API for UIEventsService service. // All implementations must embed UnimplementedUIEventsServiceServer -// for forward compatibility +// for forward compatibility. // // UIEvents collects UI related events. type UIEventsServiceServer interface { @@ -62,13 +62,18 @@ type UIEventsServiceServer interface { mustEmbedUnimplementedUIEventsServiceServer() } -// UnimplementedUIEventsServiceServer must be embedded to have forward compatible implementations. +// UnimplementedUIEventsServiceServer 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 UnimplementedUIEventsServiceServer struct{} func (UnimplementedUIEventsServiceServer) Store(context.Context, *StoreRequest) (*StoreResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Store not implemented") } func (UnimplementedUIEventsServiceServer) mustEmbedUnimplementedUIEventsServiceServer() {} +func (UnimplementedUIEventsServiceServer) testEmbeddedByValue() {} // UnsafeUIEventsServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UIEventsServiceServer will @@ -78,6 +83,13 @@ type UnsafeUIEventsServiceServer interface { } func RegisterUIEventsServiceServer(s grpc.ServiceRegistrar, srv UIEventsServiceServer) { + // If the following call pancis, it indicates UnimplementedUIEventsServiceServer 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(&UIEventsService_ServiceDesc, srv) } diff --git a/api/user/v1/user.pb.gw.go b/api/user/v1/user.pb.gw.go index 569a694ec4..890714f191 100644 --- a/api/user/v1/user.pb.gw.go +++ b/api/user/v1/user.pb.gw.go @@ -93,6 +93,7 @@ func local_request_UserService_ListUsers_0(ctx context.Context, marshaler runtim // UnaryRPC :call UserServiceServer 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 RegisterUserServiceHandlerFromEndpoint 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 RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error { mux.Handle("GET", pattern_UserService_GetUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -204,7 +205,7 @@ func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "UserServiceClient" to call the correct interceptors. +// "UserServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error { mux.Handle("GET", pattern_UserService_GetUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) diff --git a/api/user/v1/user_grpc.pb.go b/api/user/v1/user_grpc.pb.go index 79a5949497..2a74efe6ff 100644 --- a/api/user/v1/user_grpc.pb.go +++ b/api/user/v1/user_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.1 // - protoc (unknown) // source: user/v1/user.proto @@ -16,8 +16,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( UserService_GetUser_FullMethodName = "/user.v1.UserService/GetUser" @@ -76,7 +76,7 @@ func (c *userServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest, // UserServiceServer is the server API for UserService service. // All implementations must embed UnimplementedUserServiceServer -// for forward compatibility +// for forward compatibility. // // UserService contains rpcs related to user data type UserServiceServer interface { @@ -86,7 +86,11 @@ type UserServiceServer interface { mustEmbedUnimplementedUserServiceServer() } -// UnimplementedUserServiceServer must be embedded to have forward compatible implementations. +// UnimplementedUserServiceServer 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 UnimplementedUserServiceServer struct{} func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) { @@ -101,6 +105,7 @@ func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersReque return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented") } func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} +func (UnimplementedUserServiceServer) testEmbeddedByValue() {} // UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UserServiceServer will @@ -110,6 +115,13 @@ type UnsafeUserServiceServer interface { } func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { + // If the following call pancis, it indicates UnimplementedUserServiceServer 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(&UserService_ServiceDesc, srv) }