diff --git a/api/go/github.com/openconfig/gnmi/proto/collector/collector_grpc.pb.go b/api/go/github.com/openconfig/gnmi/proto/collector/collector_grpc.pb.go index ec8155fd8e08e2ca4effaeb4218ddc1edece2782..07acf596271131cc8568fdc5cb4f176c45b5b57f 100644 --- a/api/go/github.com/openconfig/gnmi/proto/collector/collector_grpc.pb.go +++ b/api/go/github.com/openconfig/gnmi/proto/collector/collector_grpc.pb.go @@ -16,7 +16,7 @@ // 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: github.com/openconfig/gnmi/proto/collector/collector.proto @@ -31,8 +31,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 ( Collector_Reconnect_FullMethodName = "/gnmi.Collector/Reconnect" @@ -67,7 +67,7 @@ func (c *collectorClient) Reconnect(ctx context.Context, in *ReconnectRequest, o // CollectorServer is the server API for Collector service. // All implementations must embed UnimplementedCollectorServer -// for forward compatibility +// for forward compatibility. type CollectorServer interface { // Reconnect requests that the existing connections for one or more specified // targets will be stopped and new connections established. @@ -75,14 +75,18 @@ type CollectorServer interface { mustEmbedUnimplementedCollectorServer() } -// UnimplementedCollectorServer must be embedded to have forward compatible implementations. -type UnimplementedCollectorServer struct { -} +// UnimplementedCollectorServer 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 UnimplementedCollectorServer struct{} func (UnimplementedCollectorServer) Reconnect(context.Context, *ReconnectRequest) (*Nil, error) { return nil, status.Errorf(codes.Unimplemented, "method Reconnect not implemented") } func (UnimplementedCollectorServer) mustEmbedUnimplementedCollectorServer() {} +func (UnimplementedCollectorServer) testEmbeddedByValue() {} // UnsafeCollectorServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to CollectorServer will @@ -92,6 +96,13 @@ type UnsafeCollectorServer interface { } func RegisterCollectorServer(s grpc.ServiceRegistrar, srv CollectorServer) { + // If the following call pancis, it indicates UnimplementedCollectorServer 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(&Collector_ServiceDesc, srv) } diff --git a/api/go/github.com/openconfig/gnmi/proto/gnmi/gnmi_grpc.pb.go b/api/go/github.com/openconfig/gnmi/proto/gnmi/gnmi_grpc.pb.go index 0e11fcbbd5a021bcdacbc3d2b249c159e59b97df..051e32847ef0a0fe432655f63367afc23f9e6df7 100644 --- a/api/go/github.com/openconfig/gnmi/proto/gnmi/gnmi_grpc.pb.go +++ b/api/go/github.com/openconfig/gnmi/proto/gnmi/gnmi_grpc.pb.go @@ -16,7 +16,7 @@ // 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: github.com/openconfig/gnmi/proto/gnmi/gnmi.proto @@ -40,8 +40,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 ( GNMI_Capabilities_FullMethodName = "/gnmi.gNMI/Capabilities" @@ -77,7 +77,7 @@ type GNMIClient interface { // at a particular cadence (STREAM), sent one off on a long-lived channel // (POLL), or sent as a one-off retrieval (ONCE). // Reference: gNMI Specification Section 3.5 - Subscribe(ctx context.Context, opts ...grpc.CallOption) (GNMI_SubscribeClient, error) + Subscribe(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SubscribeRequest, SubscribeResponse], error) } type gNMIClient struct { @@ -118,41 +118,22 @@ func (c *gNMIClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallO return out, nil } -func (c *gNMIClient) Subscribe(ctx context.Context, opts ...grpc.CallOption) (GNMI_SubscribeClient, error) { +func (c *gNMIClient) Subscribe(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SubscribeRequest, SubscribeResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &GNMI_ServiceDesc.Streams[0], GNMI_Subscribe_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &gNMISubscribeClient{ClientStream: stream} + x := &grpc.GenericClientStream[SubscribeRequest, SubscribeResponse]{ClientStream: stream} return x, nil } -type GNMI_SubscribeClient interface { - Send(*SubscribeRequest) error - Recv() (*SubscribeResponse, error) - grpc.ClientStream -} - -type gNMISubscribeClient struct { - grpc.ClientStream -} - -func (x *gNMISubscribeClient) Send(m *SubscribeRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *gNMISubscribeClient) Recv() (*SubscribeResponse, error) { - m := new(SubscribeResponse) - 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 GNMI_SubscribeClient = grpc.BidiStreamingClient[SubscribeRequest, SubscribeResponse] // GNMIServer is the server API for GNMI service. // All implementations must embed UnimplementedGNMIServer -// for forward compatibility +// for forward compatibility. type GNMIServer interface { // Capabilities allows the client to retrieve the set of capabilities that // is supported by the target. This allows the target to validate the @@ -177,13 +158,16 @@ type GNMIServer interface { // at a particular cadence (STREAM), sent one off on a long-lived channel // (POLL), or sent as a one-off retrieval (ONCE). // Reference: gNMI Specification Section 3.5 - Subscribe(GNMI_SubscribeServer) error + Subscribe(grpc.BidiStreamingServer[SubscribeRequest, SubscribeResponse]) error mustEmbedUnimplementedGNMIServer() } -// UnimplementedGNMIServer must be embedded to have forward compatible implementations. -type UnimplementedGNMIServer struct { -} +// UnimplementedGNMIServer 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 UnimplementedGNMIServer struct{} func (UnimplementedGNMIServer) Capabilities(context.Context, *CapabilityRequest) (*CapabilityResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Capabilities not implemented") @@ -194,10 +178,11 @@ func (UnimplementedGNMIServer) Get(context.Context, *GetRequest) (*GetResponse, func (UnimplementedGNMIServer) Set(context.Context, *SetRequest) (*SetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Set not implemented") } -func (UnimplementedGNMIServer) Subscribe(GNMI_SubscribeServer) error { +func (UnimplementedGNMIServer) Subscribe(grpc.BidiStreamingServer[SubscribeRequest, SubscribeResponse]) error { return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") } func (UnimplementedGNMIServer) mustEmbedUnimplementedGNMIServer() {} +func (UnimplementedGNMIServer) testEmbeddedByValue() {} // UnsafeGNMIServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to GNMIServer will @@ -207,6 +192,13 @@ type UnsafeGNMIServer interface { } func RegisterGNMIServer(s grpc.ServiceRegistrar, srv GNMIServer) { + // If the following call pancis, it indicates UnimplementedGNMIServer 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(&GNMI_ServiceDesc, srv) } @@ -265,30 +257,11 @@ func _GNMI_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{ } func _GNMI_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(GNMIServer).Subscribe(&gNMISubscribeServer{ServerStream: stream}) -} - -type GNMI_SubscribeServer interface { - Send(*SubscribeResponse) error - Recv() (*SubscribeRequest, error) - grpc.ServerStream -} - -type gNMISubscribeServer struct { - grpc.ServerStream + return srv.(GNMIServer).Subscribe(&grpc.GenericServerStream[SubscribeRequest, SubscribeResponse]{ServerStream: stream}) } -func (x *gNMISubscribeServer) Send(m *SubscribeResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *gNMISubscribeServer) Recv() (*SubscribeRequest, error) { - m := new(SubscribeRequest) - 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 GNMI_SubscribeServer = grpc.BidiStreamingServer[SubscribeRequest, SubscribeResponse] // GNMI_ServiceDesc is the grpc.ServiceDesc for GNMI service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/go/github.com/openconfig/gnmi/testing/fake/proto/fake_grpc.pb.go b/api/go/github.com/openconfig/gnmi/testing/fake/proto/fake_grpc.pb.go index 47fbce8ae80da31815bd5a28f6f4487e365d124f..6c43e03724fcf93692dfd4829eba427a1f110d48 100644 --- a/api/go/github.com/openconfig/gnmi/testing/fake/proto/fake_grpc.pb.go +++ b/api/go/github.com/openconfig/gnmi/testing/fake/proto/fake_grpc.pb.go @@ -4,7 +4,7 @@ // 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: github.com/openconfig/gnmi/testing/fake/proto/fake.proto @@ -19,8 +19,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 ( AgentManager_Add_FullMethodName = "/gnmi.fake.AgentManager/Add" @@ -80,7 +80,7 @@ func (c *agentManagerClient) Status(ctx context.Context, in *Config, opts ...grp // AgentManagerServer is the server API for AgentManager service. // All implementations must embed UnimplementedAgentManagerServer -// for forward compatibility +// for forward compatibility. type AgentManagerServer interface { // Add adds an agent to the server. Add(context.Context, *Config) (*Config, error) @@ -91,9 +91,12 @@ type AgentManagerServer interface { mustEmbedUnimplementedAgentManagerServer() } -// UnimplementedAgentManagerServer must be embedded to have forward compatible implementations. -type UnimplementedAgentManagerServer struct { -} +// UnimplementedAgentManagerServer 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 UnimplementedAgentManagerServer struct{} func (UnimplementedAgentManagerServer) Add(context.Context, *Config) (*Config, error) { return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") @@ -105,6 +108,7 @@ func (UnimplementedAgentManagerServer) Status(context.Context, *Config) (*Config return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } func (UnimplementedAgentManagerServer) mustEmbedUnimplementedAgentManagerServer() {} +func (UnimplementedAgentManagerServer) testEmbeddedByValue() {} // UnsafeAgentManagerServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AgentManagerServer will @@ -114,6 +118,13 @@ type UnsafeAgentManagerServer interface { } func RegisterAgentManagerServer(s grpc.ServiceRegistrar, srv AgentManagerServer) { + // If the following call pancis, it indicates UnimplementedAgentManagerServer 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(&AgentManager_ServiceDesc, srv) } diff --git a/api/go/gosdn/app/app.pb.gw.go b/api/go/gosdn/app/app.pb.gw.go index 681c8a1517aadc4f02023925da00337a9278fdb6..8ff05688f11ada4e8cbe589a431fa490e0e7a8b2 100644 --- a/api/go/gosdn/app/app.pb.gw.go +++ b/api/go/gosdn/app/app.pb.gw.go @@ -87,6 +87,7 @@ func local_request_AppService_Deregister_0(ctx context.Context, marshaler runtim // UnaryRPC :call AppServiceServer 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 RegisterAppServiceHandlerFromEndpoint 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 RegisterAppServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AppServiceServer) error { mux.Handle("POST", pattern_AppService_Register_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -177,7 +178,7 @@ func RegisterAppServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AppServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AppServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AppServiceClient" to call the correct interceptors. +// "AppServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAppServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AppServiceClient) error { mux.Handle("POST", pattern_AppService_Register_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/app/app_grpc.pb.go b/api/go/gosdn/app/app_grpc.pb.go index e3bc66ae428210dc63963e6701e64c7dee352462..4421cf0a2a9f181d1fc642fff979b3e17e9de4dc 100644 --- a/api/go/gosdn/app/app_grpc.pb.go +++ b/api/go/gosdn/app/app_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: gosdn/app/app.proto @@ -15,8 +15,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 ( AppService_Register_FullMethodName = "/gosdn.app.AppService/Register" @@ -63,7 +63,7 @@ func (c *appServiceClient) Deregister(ctx context.Context, in *AppDeregisterRequ // AppServiceServer is the server API for AppService service. // All implementations must embed UnimplementedAppServiceServer -// for forward compatibility +// for forward compatibility. type AppServiceServer interface { // Allows the registration of an application in order to use it with the controller. Register(context.Context, *AppRegisterRequest) (*AppRegisterResponse, error) @@ -72,9 +72,12 @@ type AppServiceServer interface { mustEmbedUnimplementedAppServiceServer() } -// UnimplementedAppServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAppServiceServer struct { -} +// UnimplementedAppServiceServer 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 UnimplementedAppServiceServer struct{} func (UnimplementedAppServiceServer) Register(context.Context, *AppRegisterRequest) (*AppRegisterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") @@ -83,6 +86,7 @@ func (UnimplementedAppServiceServer) Deregister(context.Context, *AppDeregisterR return nil, status.Errorf(codes.Unimplemented, "method Deregister not implemented") } func (UnimplementedAppServiceServer) mustEmbedUnimplementedAppServiceServer() {} +func (UnimplementedAppServiceServer) testEmbeddedByValue() {} // UnsafeAppServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AppServiceServer will @@ -92,6 +96,13 @@ type UnsafeAppServiceServer interface { } func RegisterAppServiceServer(s grpc.ServiceRegistrar, srv AppServiceServer) { + // If the following call pancis, it indicates UnimplementedAppServiceServer 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(&AppService_ServiceDesc, srv) } diff --git a/api/go/gosdn/configurationmanagement/configurationmanagement.pb.gw.go b/api/go/gosdn/configurationmanagement/configurationmanagement.pb.gw.go index 2a4a9453e37b4fe310103b5cb8e04e1ebedb344a..a0a3160e0a336ac38a290d5115a1d5717ff1efcd 100644 --- a/api/go/gosdn/configurationmanagement/configurationmanagement.pb.gw.go +++ b/api/go/gosdn/configurationmanagement/configurationmanagement.pb.gw.go @@ -175,6 +175,7 @@ func local_request_ConfigurationManagementService_ImportSDNConfig_0(ctx context. // UnaryRPC :call ConfigurationManagementServiceServer 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 RegisterConfigurationManagementServiceHandlerFromEndpoint 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 RegisterConfigurationManagementServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigurationManagementServiceServer) error { mux.Handle("GET", pattern_ConfigurationManagementService_ExportSDNConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -265,7 +266,7 @@ func RegisterConfigurationManagementServiceHandler(ctx context.Context, mux *run // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ConfigurationManagementServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ConfigurationManagementServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ConfigurationManagementServiceClient" to call the correct interceptors. +// "ConfigurationManagementServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterConfigurationManagementServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConfigurationManagementServiceClient) error { mux.Handle("GET", pattern_ConfigurationManagementService_ExportSDNConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/configurationmanagement/configurationmanagement_grpc.pb.go b/api/go/gosdn/configurationmanagement/configurationmanagement_grpc.pb.go index 9614b110a69ea837d0857dc4384bf879eebc46cb..381bc869796cd2e63777b1a68b914deb6d86a27b 100644 --- a/api/go/gosdn/configurationmanagement/configurationmanagement_grpc.pb.go +++ b/api/go/gosdn/configurationmanagement/configurationmanagement_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: gosdn/configurationmanagement/configurationmanagement.proto @@ -15,8 +15,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 ( ConfigurationManagementService_ExportSDNConfig_FullMethodName = "/gosdn.configurationmanagement.ConfigurationManagementService/ExportSDNConfig" @@ -65,7 +65,7 @@ func (c *configurationManagementServiceClient) ImportSDNConfig(ctx context.Conte // ConfigurationManagementServiceServer is the server API for ConfigurationManagementService service. // All implementations must embed UnimplementedConfigurationManagementServiceServer -// for forward compatibility +// for forward compatibility. // // The ConfigurationManagementService allows to access configurations type ConfigurationManagementServiceServer interface { @@ -76,9 +76,12 @@ type ConfigurationManagementServiceServer interface { mustEmbedUnimplementedConfigurationManagementServiceServer() } -// UnimplementedConfigurationManagementServiceServer must be embedded to have forward compatible implementations. -type UnimplementedConfigurationManagementServiceServer struct { -} +// UnimplementedConfigurationManagementServiceServer 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 UnimplementedConfigurationManagementServiceServer struct{} func (UnimplementedConfigurationManagementServiceServer) ExportSDNConfig(context.Context, *ExportSDNConfigRequest) (*ExportSDNConfigResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExportSDNConfig not implemented") @@ -88,6 +91,7 @@ func (UnimplementedConfigurationManagementServiceServer) ImportSDNConfig(context } func (UnimplementedConfigurationManagementServiceServer) mustEmbedUnimplementedConfigurationManagementServiceServer() { } +func (UnimplementedConfigurationManagementServiceServer) testEmbeddedByValue() {} // UnsafeConfigurationManagementServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ConfigurationManagementServiceServer will @@ -97,6 +101,13 @@ type UnsafeConfigurationManagementServiceServer interface { } func RegisterConfigurationManagementServiceServer(s grpc.ServiceRegistrar, srv ConfigurationManagementServiceServer) { + // If the following call pancis, it indicates UnimplementedConfigurationManagementServiceServer 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(&ConfigurationManagementService_ServiceDesc, srv) } diff --git a/api/go/gosdn/csbi/csbi_grpc.pb.go b/api/go/gosdn/csbi/csbi_grpc.pb.go index 71840fa3e60b8a54ba0a3d2ea25aeb3ae53b9273..5f03701a2f06cde363a48a38b08d4f6d4d63b7f8 100644 --- a/api/go/gosdn/csbi/csbi_grpc.pb.go +++ b/api/go/gosdn/csbi/csbi_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: gosdn/csbi/csbi.proto @@ -15,8 +15,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 ( CsbiService_Get_FullMethodName = "/gosdn.csbi.CsbiService/Get" @@ -35,7 +35,7 @@ const ( // grpc-gateway definitions type CsbiServiceClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) - GetFile(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (CsbiService_GetFileClient, error) + GetFile(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Payload], error) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) CreateGoStruct(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) @@ -60,13 +60,13 @@ func (c *csbiServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grp return out, nil } -func (c *csbiServiceClient) GetFile(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (CsbiService_GetFileClient, error) { +func (c *csbiServiceClient) GetFile(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Payload], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &CsbiService_ServiceDesc.Streams[0], CsbiService_GetFile_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &csbiServiceGetFileClient{ClientStream: stream} + x := &grpc.GenericClientStream[GetPayloadRequest, Payload]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -76,22 +76,8 @@ func (c *csbiServiceClient) GetFile(ctx context.Context, in *GetPayloadRequest, return x, nil } -type CsbiService_GetFileClient interface { - Recv() (*Payload, error) - grpc.ClientStream -} - -type csbiServiceGetFileClient struct { - grpc.ClientStream -} - -func (x *csbiServiceGetFileClient) Recv() (*Payload, error) { - m := new(Payload) - 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 CsbiService_GetFileClient = grpc.ServerStreamingClient[Payload] func (c *csbiServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -135,13 +121,13 @@ func (c *csbiServiceClient) Hello(ctx context.Context, in *Syn, opts ...grpc.Cal // CsbiServiceServer is the server API for CsbiService service. // All implementations must embed UnimplementedCsbiServiceServer -// for forward compatibility +// for forward compatibility. // // only used from within the controller; therefore we do not provide // grpc-gateway definitions type CsbiServiceServer interface { Get(context.Context, *GetRequest) (*GetResponse, error) - GetFile(*GetPayloadRequest, CsbiService_GetFileServer) error + GetFile(*GetPayloadRequest, grpc.ServerStreamingServer[Payload]) error Create(context.Context, *CreateRequest) (*CreateResponse, error) CreateGoStruct(context.Context, *CreateRequest) (*CreateResponse, error) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) @@ -149,14 +135,17 @@ type CsbiServiceServer interface { mustEmbedUnimplementedCsbiServiceServer() } -// UnimplementedCsbiServiceServer must be embedded to have forward compatible implementations. -type UnimplementedCsbiServiceServer struct { -} +// UnimplementedCsbiServiceServer 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 UnimplementedCsbiServiceServer struct{} func (UnimplementedCsbiServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") } -func (UnimplementedCsbiServiceServer) GetFile(*GetPayloadRequest, CsbiService_GetFileServer) error { +func (UnimplementedCsbiServiceServer) GetFile(*GetPayloadRequest, grpc.ServerStreamingServer[Payload]) error { return status.Errorf(codes.Unimplemented, "method GetFile not implemented") } func (UnimplementedCsbiServiceServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) { @@ -172,6 +161,7 @@ func (UnimplementedCsbiServiceServer) Hello(context.Context, *Syn) (*Ack, error) return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented") } func (UnimplementedCsbiServiceServer) mustEmbedUnimplementedCsbiServiceServer() {} +func (UnimplementedCsbiServiceServer) testEmbeddedByValue() {} // UnsafeCsbiServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to CsbiServiceServer will @@ -181,6 +171,13 @@ type UnsafeCsbiServiceServer interface { } func RegisterCsbiServiceServer(s grpc.ServiceRegistrar, srv CsbiServiceServer) { + // If the following call pancis, it indicates UnimplementedCsbiServiceServer 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(&CsbiService_ServiceDesc, srv) } @@ -207,21 +204,11 @@ func _CsbiService_GetFile_Handler(srv interface{}, stream grpc.ServerStream) err if err := stream.RecvMsg(m); err != nil { return err } - return srv.(CsbiServiceServer).GetFile(m, &csbiServiceGetFileServer{ServerStream: stream}) -} - -type CsbiService_GetFileServer interface { - Send(*Payload) error - grpc.ServerStream + return srv.(CsbiServiceServer).GetFile(m, &grpc.GenericServerStream[GetPayloadRequest, Payload]{ServerStream: stream}) } -type csbiServiceGetFileServer struct { - grpc.ServerStream -} - -func (x *csbiServiceGetFileServer) Send(m *Payload) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type CsbiService_GetFileServer = grpc.ServerStreamingServer[Payload] func _CsbiService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateRequest) diff --git a/api/go/gosdn/networkelement/networkelement.pb.gw.go b/api/go/gosdn/networkelement/networkelement.pb.gw.go index 7319c0304b8b621d68f4f46f6285de4092c9ec6f..fc794e3c4c033ee122a543a478139d13c5d0bd01 100644 --- a/api/go/gosdn/networkelement/networkelement.pb.gw.go +++ b/api/go/gosdn/networkelement/networkelement.pb.gw.go @@ -601,6 +601,7 @@ func local_request_NetworkElementService_SetChangeList_0(ctx context.Context, ma // UnaryRPC :call NetworkElementServiceServer 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 RegisterNetworkElementServiceHandlerFromEndpoint 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 RegisterNetworkElementServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NetworkElementServiceServer) error { mux.Handle("POST", pattern_NetworkElementService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -916,7 +917,7 @@ func RegisterNetworkElementServiceHandler(ctx context.Context, mux *runtime.Serv // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NetworkElementServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NetworkElementServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "NetworkElementServiceClient" to call the correct interceptors. +// "NetworkElementServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterNetworkElementServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NetworkElementServiceClient) error { mux.Handle("POST", pattern_NetworkElementService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/networkelement/networkelement_grpc.pb.go b/api/go/gosdn/networkelement/networkelement_grpc.pb.go index 738c643bb73352e654de3afaad8a1efe8739de6f..bab93548d16e456e5a56b70655b09884bdbb73e8 100644 --- a/api/go/gosdn/networkelement/networkelement_grpc.pb.go +++ b/api/go/gosdn/networkelement/networkelement_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: gosdn/networkelement/networkelement.proto @@ -15,8 +15,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 ( NetworkElementService_Update_FullMethodName = "/gosdn.networkelement.NetworkElementService/Update" @@ -89,7 +89,7 @@ type NetworkElementServiceClient interface { // Allows to subscribe to multiple paths of a Managed Network Element which is // managed by a specific Principal Network Domain and streams data depending on the subscribe // method. - SubscribePath(ctx context.Context, in *SubscribePathRequest, opts ...grpc.CallOption) (NetworkElementService_SubscribePathClient, error) + SubscribePath(ctx context.Context, in *SubscribePathRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribePathResponse], error) } type networkElementServiceClient struct { @@ -230,13 +230,13 @@ func (c *networkElementServiceClient) SetChangeList(ctx context.Context, in *Set return out, nil } -func (c *networkElementServiceClient) SubscribePath(ctx context.Context, in *SubscribePathRequest, opts ...grpc.CallOption) (NetworkElementService_SubscribePathClient, error) { +func (c *networkElementServiceClient) SubscribePath(ctx context.Context, in *SubscribePathRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribePathResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &NetworkElementService_ServiceDesc.Streams[0], NetworkElementService_SubscribePath_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &networkElementServiceSubscribePathClient{ClientStream: stream} + x := &grpc.GenericClientStream[SubscribePathRequest, SubscribePathResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -246,26 +246,12 @@ func (c *networkElementServiceClient) SubscribePath(ctx context.Context, in *Sub return x, nil } -type NetworkElementService_SubscribePathClient interface { - Recv() (*SubscribePathResponse, error) - grpc.ClientStream -} - -type networkElementServiceSubscribePathClient struct { - grpc.ClientStream -} - -func (x *networkElementServiceSubscribePathClient) Recv() (*SubscribePathResponse, error) { - m := new(SubscribePathResponse) - 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 NetworkElementService_SubscribePathClient = grpc.ServerStreamingClient[SubscribePathResponse] // NetworkElementServiceServer is the server API for NetworkElementService service. // All implementations must embed UnimplementedNetworkElementServiceServer -// for forward compatibility +// for forward compatibility. type NetworkElementServiceServer interface { // TODO: fix request naming to fit other requests! // Allows to update/change the meta data of stored Managed Network Element. @@ -317,13 +303,16 @@ type NetworkElementServiceServer interface { // Allows to subscribe to multiple paths of a Managed Network Element which is // managed by a specific Principal Network Domain and streams data depending on the subscribe // method. - SubscribePath(*SubscribePathRequest, NetworkElementService_SubscribePathServer) error + SubscribePath(*SubscribePathRequest, grpc.ServerStreamingServer[SubscribePathResponse]) error mustEmbedUnimplementedNetworkElementServiceServer() } -// UnimplementedNetworkElementServiceServer must be embedded to have forward compatible implementations. -type UnimplementedNetworkElementServiceServer struct { -} +// UnimplementedNetworkElementServiceServer 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 UnimplementedNetworkElementServiceServer struct{} func (UnimplementedNetworkElementServiceServer) Update(context.Context, *UpdateNetworkElementRequest) (*UpdateNetworkElementResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") @@ -364,10 +353,11 @@ func (UnimplementedNetworkElementServiceServer) GetChange(context.Context, *GetC func (UnimplementedNetworkElementServiceServer) SetChangeList(context.Context, *SetChangeListRequest) (*SetChangeListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetChangeList not implemented") } -func (UnimplementedNetworkElementServiceServer) SubscribePath(*SubscribePathRequest, NetworkElementService_SubscribePathServer) error { +func (UnimplementedNetworkElementServiceServer) SubscribePath(*SubscribePathRequest, grpc.ServerStreamingServer[SubscribePathResponse]) error { return status.Errorf(codes.Unimplemented, "method SubscribePath not implemented") } func (UnimplementedNetworkElementServiceServer) mustEmbedUnimplementedNetworkElementServiceServer() {} +func (UnimplementedNetworkElementServiceServer) testEmbeddedByValue() {} // UnsafeNetworkElementServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to NetworkElementServiceServer will @@ -377,6 +367,13 @@ type UnsafeNetworkElementServiceServer interface { } func RegisterNetworkElementServiceServer(s grpc.ServiceRegistrar, srv NetworkElementServiceServer) { + // If the following call pancis, it indicates UnimplementedNetworkElementServiceServer 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(&NetworkElementService_ServiceDesc, srv) } @@ -619,21 +616,11 @@ func _NetworkElementService_SubscribePath_Handler(srv interface{}, stream grpc.S if err := stream.RecvMsg(m); err != nil { return err } - return srv.(NetworkElementServiceServer).SubscribePath(m, &networkElementServiceSubscribePathServer{ServerStream: stream}) -} - -type NetworkElementService_SubscribePathServer interface { - Send(*SubscribePathResponse) error - grpc.ServerStream + return srv.(NetworkElementServiceServer).SubscribePath(m, &grpc.GenericServerStream[SubscribePathRequest, SubscribePathResponse]{ServerStream: stream}) } -type networkElementServiceSubscribePathServer struct { - grpc.ServerStream -} - -func (x *networkElementServiceSubscribePathServer) Send(m *SubscribePathResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type NetworkElementService_SubscribePathServer = grpc.ServerStreamingServer[SubscribePathResponse] // NetworkElementService_ServiceDesc is the grpc.ServiceDesc for NetworkElementService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/go/gosdn/plugin-internal/plugin-internal_grpc.pb.go b/api/go/gosdn/plugin-internal/plugin-internal_grpc.pb.go index 6cae73c9ebb3bbb484fb21a098b49a0968dbfe5e..eaa452aa3746a888fadffccf2db1bc902fa42ad0 100644 --- a/api/go/gosdn/plugin-internal/plugin-internal_grpc.pb.go +++ b/api/go/gosdn/plugin-internal/plugin-internal_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: gosdn/plugin-internal/plugin-internal.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 ( PluginInternalService_AvailablePlugins_FullMethodName = "/gosdn.plugin_internal.PluginInternalService/AvailablePlugins" @@ -29,7 +29,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type PluginInternalServiceClient interface { AvailablePlugins(ctx context.Context, in *GetAvailablePluginsRequest, opts ...grpc.CallOption) (*plugin_registry.GetResponse, error) - GetPluginSchema(ctx context.Context, in *GetPluginSchemaRequest, opts ...grpc.CallOption) (PluginInternalService_GetPluginSchemaClient, error) + GetPluginSchema(ctx context.Context, in *GetPluginSchemaRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PluginSchemaPayload], error) } type pluginInternalServiceClient struct { @@ -50,13 +50,13 @@ func (c *pluginInternalServiceClient) AvailablePlugins(ctx context.Context, in * return out, nil } -func (c *pluginInternalServiceClient) GetPluginSchema(ctx context.Context, in *GetPluginSchemaRequest, opts ...grpc.CallOption) (PluginInternalService_GetPluginSchemaClient, error) { +func (c *pluginInternalServiceClient) GetPluginSchema(ctx context.Context, in *GetPluginSchemaRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PluginSchemaPayload], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &PluginInternalService_ServiceDesc.Streams[0], PluginInternalService_GetPluginSchema_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &pluginInternalServiceGetPluginSchemaClient{ClientStream: stream} + x := &grpc.GenericClientStream[GetPluginSchemaRequest, PluginSchemaPayload]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -66,43 +66,33 @@ func (c *pluginInternalServiceClient) GetPluginSchema(ctx context.Context, in *G return x, nil } -type PluginInternalService_GetPluginSchemaClient interface { - Recv() (*PluginSchemaPayload, error) - grpc.ClientStream -} - -type pluginInternalServiceGetPluginSchemaClient struct { - grpc.ClientStream -} - -func (x *pluginInternalServiceGetPluginSchemaClient) Recv() (*PluginSchemaPayload, error) { - m := new(PluginSchemaPayload) - 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 PluginInternalService_GetPluginSchemaClient = grpc.ServerStreamingClient[PluginSchemaPayload] // PluginInternalServiceServer is the server API for PluginInternalService service. // All implementations must embed UnimplementedPluginInternalServiceServer -// for forward compatibility +// for forward compatibility. type PluginInternalServiceServer interface { AvailablePlugins(context.Context, *GetAvailablePluginsRequest) (*plugin_registry.GetResponse, error) - GetPluginSchema(*GetPluginSchemaRequest, PluginInternalService_GetPluginSchemaServer) error + GetPluginSchema(*GetPluginSchemaRequest, grpc.ServerStreamingServer[PluginSchemaPayload]) error mustEmbedUnimplementedPluginInternalServiceServer() } -// UnimplementedPluginInternalServiceServer must be embedded to have forward compatible implementations. -type UnimplementedPluginInternalServiceServer struct { -} +// UnimplementedPluginInternalServiceServer 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 UnimplementedPluginInternalServiceServer struct{} func (UnimplementedPluginInternalServiceServer) AvailablePlugins(context.Context, *GetAvailablePluginsRequest) (*plugin_registry.GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AvailablePlugins not implemented") } -func (UnimplementedPluginInternalServiceServer) GetPluginSchema(*GetPluginSchemaRequest, PluginInternalService_GetPluginSchemaServer) error { +func (UnimplementedPluginInternalServiceServer) GetPluginSchema(*GetPluginSchemaRequest, grpc.ServerStreamingServer[PluginSchemaPayload]) error { return status.Errorf(codes.Unimplemented, "method GetPluginSchema not implemented") } func (UnimplementedPluginInternalServiceServer) mustEmbedUnimplementedPluginInternalServiceServer() {} +func (UnimplementedPluginInternalServiceServer) testEmbeddedByValue() {} // UnsafePluginInternalServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PluginInternalServiceServer will @@ -112,6 +102,13 @@ type UnsafePluginInternalServiceServer interface { } func RegisterPluginInternalServiceServer(s grpc.ServiceRegistrar, srv PluginInternalServiceServer) { + // If the following call pancis, it indicates UnimplementedPluginInternalServiceServer 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(&PluginInternalService_ServiceDesc, srv) } @@ -138,21 +135,11 @@ func _PluginInternalService_GetPluginSchema_Handler(srv interface{}, stream grpc if err := stream.RecvMsg(m); err != nil { return err } - return srv.(PluginInternalServiceServer).GetPluginSchema(m, &pluginInternalServiceGetPluginSchemaServer{ServerStream: stream}) -} - -type PluginInternalService_GetPluginSchemaServer interface { - Send(*PluginSchemaPayload) error - grpc.ServerStream + return srv.(PluginInternalServiceServer).GetPluginSchema(m, &grpc.GenericServerStream[GetPluginSchemaRequest, PluginSchemaPayload]{ServerStream: stream}) } -type pluginInternalServiceGetPluginSchemaServer struct { - grpc.ServerStream -} - -func (x *pluginInternalServiceGetPluginSchemaServer) Send(m *PluginSchemaPayload) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type PluginInternalService_GetPluginSchemaServer = grpc.ServerStreamingServer[PluginSchemaPayload] // PluginInternalService_ServiceDesc is the grpc.ServiceDesc for PluginInternalService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/go/gosdn/plugin-registry/plugin-registry_grpc.pb.go b/api/go/gosdn/plugin-registry/plugin-registry_grpc.pb.go index c59e5ec6dcb5e11db2ff4b0f6d8340598a00e89e..4593bd8d673b97c17281c2c323ec14a3ceb82c43 100644 --- a/api/go/gosdn/plugin-registry/plugin-registry_grpc.pb.go +++ b/api/go/gosdn/plugin-registry/plugin-registry_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: gosdn/plugin-registry/plugin-registry.proto @@ -15,8 +15,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 ( PluginRegistryService_Get_FullMethodName = "/gosdn.plugin_registry.PluginRegistryService/Get" @@ -31,7 +31,7 @@ const ( type PluginRegistryServiceClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*GetResponse, error) - Download(ctx context.Context, in *GetDownloadRequest, opts ...grpc.CallOption) (PluginRegistryService_DownloadClient, error) + Download(ctx context.Context, in *GetDownloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetDownloadPayload], error) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) } @@ -63,13 +63,13 @@ func (c *pluginRegistryServiceClient) GetAll(ctx context.Context, in *GetAllRequ return out, nil } -func (c *pluginRegistryServiceClient) Download(ctx context.Context, in *GetDownloadRequest, opts ...grpc.CallOption) (PluginRegistryService_DownloadClient, error) { +func (c *pluginRegistryServiceClient) Download(ctx context.Context, in *GetDownloadRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetDownloadPayload], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &PluginRegistryService_ServiceDesc.Streams[0], PluginRegistryService_Download_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &pluginRegistryServiceDownloadClient{ClientStream: stream} + x := &grpc.GenericClientStream[GetDownloadRequest, GetDownloadPayload]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -79,22 +79,8 @@ func (c *pluginRegistryServiceClient) Download(ctx context.Context, in *GetDownl return x, nil } -type PluginRegistryService_DownloadClient interface { - Recv() (*GetDownloadPayload, error) - grpc.ClientStream -} - -type pluginRegistryServiceDownloadClient struct { - grpc.ClientStream -} - -func (x *pluginRegistryServiceDownloadClient) Recv() (*GetDownloadPayload, error) { - m := new(GetDownloadPayload) - 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 PluginRegistryService_DownloadClient = grpc.ServerStreamingClient[GetDownloadPayload] func (c *pluginRegistryServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -108,18 +94,21 @@ func (c *pluginRegistryServiceClient) Delete(ctx context.Context, in *DeleteRequ // PluginRegistryServiceServer is the server API for PluginRegistryService service. // All implementations must embed UnimplementedPluginRegistryServiceServer -// for forward compatibility +// for forward compatibility. type PluginRegistryServiceServer interface { Get(context.Context, *GetRequest) (*GetResponse, error) GetAll(context.Context, *GetAllRequest) (*GetResponse, error) - Download(*GetDownloadRequest, PluginRegistryService_DownloadServer) error + Download(*GetDownloadRequest, grpc.ServerStreamingServer[GetDownloadPayload]) error Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) mustEmbedUnimplementedPluginRegistryServiceServer() } -// UnimplementedPluginRegistryServiceServer must be embedded to have forward compatible implementations. -type UnimplementedPluginRegistryServiceServer struct { -} +// UnimplementedPluginRegistryServiceServer 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 UnimplementedPluginRegistryServiceServer struct{} func (UnimplementedPluginRegistryServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") @@ -127,13 +116,14 @@ func (UnimplementedPluginRegistryServiceServer) Get(context.Context, *GetRequest func (UnimplementedPluginRegistryServiceServer) GetAll(context.Context, *GetAllRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented") } -func (UnimplementedPluginRegistryServiceServer) Download(*GetDownloadRequest, PluginRegistryService_DownloadServer) error { +func (UnimplementedPluginRegistryServiceServer) Download(*GetDownloadRequest, grpc.ServerStreamingServer[GetDownloadPayload]) error { return status.Errorf(codes.Unimplemented, "method Download not implemented") } func (UnimplementedPluginRegistryServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } func (UnimplementedPluginRegistryServiceServer) mustEmbedUnimplementedPluginRegistryServiceServer() {} +func (UnimplementedPluginRegistryServiceServer) testEmbeddedByValue() {} // UnsafePluginRegistryServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PluginRegistryServiceServer will @@ -143,6 +133,13 @@ type UnsafePluginRegistryServiceServer interface { } func RegisterPluginRegistryServiceServer(s grpc.ServiceRegistrar, srv PluginRegistryServiceServer) { + // If the following call pancis, it indicates UnimplementedPluginRegistryServiceServer 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(&PluginRegistryService_ServiceDesc, srv) } @@ -187,21 +184,11 @@ func _PluginRegistryService_Download_Handler(srv interface{}, stream grpc.Server if err := stream.RecvMsg(m); err != nil { return err } - return srv.(PluginRegistryServiceServer).Download(m, &pluginRegistryServiceDownloadServer{ServerStream: stream}) -} - -type PluginRegistryService_DownloadServer interface { - Send(*GetDownloadPayload) error - grpc.ServerStream + return srv.(PluginRegistryServiceServer).Download(m, &grpc.GenericServerStream[GetDownloadRequest, GetDownloadPayload]{ServerStream: stream}) } -type pluginRegistryServiceDownloadServer struct { - grpc.ServerStream -} - -func (x *pluginRegistryServiceDownloadServer) Send(m *GetDownloadPayload) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type PluginRegistryService_DownloadServer = grpc.ServerStreamingServer[GetDownloadPayload] func _PluginRegistryService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteRequest) diff --git a/api/go/gosdn/plugin/plugin_grpc.pb.go b/api/go/gosdn/plugin/plugin_grpc.pb.go index b78a5d726be88969e1e61ddfe4353f55d561b305..e524b8c4bc2dad4a123d8fd5756c3424320a3427 100644 --- a/api/go/gosdn/plugin/plugin_grpc.pb.go +++ b/api/go/gosdn/plugin/plugin_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: gosdn/plugin/plugin.proto @@ -15,8 +15,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 ( Plugin_Unmarshal_FullMethodName = "/gosdn.plugin.Plugin/Unmarshal" @@ -40,7 +40,7 @@ type PluginClient interface { DeleteNode(ctx context.Context, in *DeleteNodeRequest, opts ...grpc.CallOption) (*DeleteNodeResponse, error) Model(ctx context.Context, in *ModelRequest, opts ...grpc.CallOption) (*ModelResponse, error) Diff(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (*DiffResponse, error) - SchemaTreeGzip(ctx context.Context, in *SchemaTreeGzipRequest, opts ...grpc.CallOption) (Plugin_SchemaTreeGzipClient, error) + SchemaTreeGzip(ctx context.Context, in *SchemaTreeGzipRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Payload], error) ValidateChange(ctx context.Context, in *ValidateChangeRequest, opts ...grpc.CallOption) (*ValidateChangeResponse, error) PruneConfigFalse(ctx context.Context, in *PruneConfigFalseRequest, opts ...grpc.CallOption) (*PruneConfigFalseResponse, error) } @@ -113,13 +113,13 @@ func (c *pluginClient) Diff(ctx context.Context, in *DiffRequest, opts ...grpc.C return out, nil } -func (c *pluginClient) SchemaTreeGzip(ctx context.Context, in *SchemaTreeGzipRequest, opts ...grpc.CallOption) (Plugin_SchemaTreeGzipClient, error) { +func (c *pluginClient) SchemaTreeGzip(ctx context.Context, in *SchemaTreeGzipRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Payload], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Plugin_ServiceDesc.Streams[0], Plugin_SchemaTreeGzip_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &pluginSchemaTreeGzipClient{ClientStream: stream} + x := &grpc.GenericClientStream[SchemaTreeGzipRequest, Payload]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -129,22 +129,8 @@ func (c *pluginClient) SchemaTreeGzip(ctx context.Context, in *SchemaTreeGzipReq return x, nil } -type Plugin_SchemaTreeGzipClient interface { - Recv() (*Payload, error) - grpc.ClientStream -} - -type pluginSchemaTreeGzipClient struct { - grpc.ClientStream -} - -func (x *pluginSchemaTreeGzipClient) Recv() (*Payload, error) { - m := new(Payload) - 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 Plugin_SchemaTreeGzipClient = grpc.ServerStreamingClient[Payload] func (c *pluginClient) ValidateChange(ctx context.Context, in *ValidateChangeRequest, opts ...grpc.CallOption) (*ValidateChangeResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -168,7 +154,7 @@ func (c *pluginClient) PruneConfigFalse(ctx context.Context, in *PruneConfigFals // PluginServer is the server API for Plugin service. // All implementations must embed UnimplementedPluginServer -// for forward compatibility +// for forward compatibility. type PluginServer interface { Unmarshal(context.Context, *UnmarshalRequest) (*UnmarshalResponse, error) SetNode(context.Context, *SetNodeRequest) (*SetNodeResponse, error) @@ -176,15 +162,18 @@ type PluginServer interface { DeleteNode(context.Context, *DeleteNodeRequest) (*DeleteNodeResponse, error) Model(context.Context, *ModelRequest) (*ModelResponse, error) Diff(context.Context, *DiffRequest) (*DiffResponse, error) - SchemaTreeGzip(*SchemaTreeGzipRequest, Plugin_SchemaTreeGzipServer) error + SchemaTreeGzip(*SchemaTreeGzipRequest, grpc.ServerStreamingServer[Payload]) error ValidateChange(context.Context, *ValidateChangeRequest) (*ValidateChangeResponse, error) PruneConfigFalse(context.Context, *PruneConfigFalseRequest) (*PruneConfigFalseResponse, error) mustEmbedUnimplementedPluginServer() } -// UnimplementedPluginServer must be embedded to have forward compatible implementations. -type UnimplementedPluginServer struct { -} +// UnimplementedPluginServer 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 UnimplementedPluginServer struct{} func (UnimplementedPluginServer) Unmarshal(context.Context, *UnmarshalRequest) (*UnmarshalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Unmarshal not implemented") @@ -204,7 +193,7 @@ func (UnimplementedPluginServer) Model(context.Context, *ModelRequest) (*ModelRe func (UnimplementedPluginServer) Diff(context.Context, *DiffRequest) (*DiffResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Diff not implemented") } -func (UnimplementedPluginServer) SchemaTreeGzip(*SchemaTreeGzipRequest, Plugin_SchemaTreeGzipServer) error { +func (UnimplementedPluginServer) SchemaTreeGzip(*SchemaTreeGzipRequest, grpc.ServerStreamingServer[Payload]) error { return status.Errorf(codes.Unimplemented, "method SchemaTreeGzip not implemented") } func (UnimplementedPluginServer) ValidateChange(context.Context, *ValidateChangeRequest) (*ValidateChangeResponse, error) { @@ -214,6 +203,7 @@ func (UnimplementedPluginServer) PruneConfigFalse(context.Context, *PruneConfigF return nil, status.Errorf(codes.Unimplemented, "method PruneConfigFalse not implemented") } func (UnimplementedPluginServer) mustEmbedUnimplementedPluginServer() {} +func (UnimplementedPluginServer) testEmbeddedByValue() {} // UnsafePluginServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PluginServer will @@ -223,6 +213,13 @@ type UnsafePluginServer interface { } func RegisterPluginServer(s grpc.ServiceRegistrar, srv PluginServer) { + // If the following call pancis, it indicates UnimplementedPluginServer 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(&Plugin_ServiceDesc, srv) } @@ -339,21 +336,11 @@ func _Plugin_SchemaTreeGzip_Handler(srv interface{}, stream grpc.ServerStream) e if err := stream.RecvMsg(m); err != nil { return err } - return srv.(PluginServer).SchemaTreeGzip(m, &pluginSchemaTreeGzipServer{ServerStream: stream}) -} - -type Plugin_SchemaTreeGzipServer interface { - Send(*Payload) error - grpc.ServerStream + return srv.(PluginServer).SchemaTreeGzip(m, &grpc.GenericServerStream[SchemaTreeGzipRequest, Payload]{ServerStream: stream}) } -type pluginSchemaTreeGzipServer struct { - grpc.ServerStream -} - -func (x *pluginSchemaTreeGzipServer) Send(m *Payload) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Plugin_SchemaTreeGzipServer = grpc.ServerStreamingServer[Payload] func _Plugin_ValidateChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ValidateChangeRequest) diff --git a/api/go/gosdn/pnd/pnd.pb.gw.go b/api/go/gosdn/pnd/pnd.pb.gw.go index 07a459d979ed475b8dfda90aca0fed1eafd62336..6aace9934260aae883dfaaa34035d355f7a5d95c 100644 --- a/api/go/gosdn/pnd/pnd.pb.gw.go +++ b/api/go/gosdn/pnd/pnd.pb.gw.go @@ -237,6 +237,7 @@ func local_request_PndService_DeletePnd_0(ctx context.Context, marshaler runtime // UnaryRPC :call PndServiceServer 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 RegisterPndServiceHandlerFromEndpoint 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 RegisterPndServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PndServiceServer) error { mux.Handle("GET", pattern_PndService_GetPnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -377,7 +378,7 @@ func RegisterPndServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PndServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PndServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "PndServiceClient" to call the correct interceptors. +// "PndServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterPndServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PndServiceClient) error { mux.Handle("GET", pattern_PndService_GetPnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/pnd/pnd_grpc.pb.go b/api/go/gosdn/pnd/pnd_grpc.pb.go index 9b1730125c6d596b0f92ef2c6a2f9499933fede3..7f50d9a7afb6cbaeac6e38029b2e25b0d4214eb8 100644 --- a/api/go/gosdn/pnd/pnd_grpc.pb.go +++ b/api/go/gosdn/pnd/pnd_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: gosdn/pnd/pnd.proto @@ -15,8 +15,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 ( PndService_GetPnd_FullMethodName = "/gosdn.pnd.PndService/GetPnd" @@ -89,7 +89,7 @@ func (c *pndServiceClient) DeletePnd(ctx context.Context, in *DeletePndRequest, // PndServiceServer is the server API for PndService service. // All implementations must embed UnimplementedPndServiceServer -// for forward compatibility +// for forward compatibility. type PndServiceServer interface { // Allows to request a specific Principal Network Domain. GetPnd(context.Context, *GetPndRequest) (*GetPndResponse, error) @@ -102,9 +102,12 @@ type PndServiceServer interface { mustEmbedUnimplementedPndServiceServer() } -// UnimplementedPndServiceServer must be embedded to have forward compatible implementations. -type UnimplementedPndServiceServer struct { -} +// UnimplementedPndServiceServer 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 UnimplementedPndServiceServer struct{} func (UnimplementedPndServiceServer) GetPnd(context.Context, *GetPndRequest) (*GetPndResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPnd not implemented") @@ -119,6 +122,7 @@ func (UnimplementedPndServiceServer) DeletePnd(context.Context, *DeletePndReques return nil, status.Errorf(codes.Unimplemented, "method DeletePnd not implemented") } func (UnimplementedPndServiceServer) mustEmbedUnimplementedPndServiceServer() {} +func (UnimplementedPndServiceServer) testEmbeddedByValue() {} // UnsafePndServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PndServiceServer will @@ -128,6 +132,13 @@ type UnsafePndServiceServer interface { } func RegisterPndServiceServer(s grpc.ServiceRegistrar, srv PndServiceServer) { + // If the following call pancis, it indicates UnimplementedPndServiceServer 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(&PndService_ServiceDesc, srv) } diff --git a/api/go/gosdn/rbac/rbac.pb.gw.go b/api/go/gosdn/rbac/rbac.pb.gw.go index 459dde99a657d828045237d9736ef4ed28303195..46167531eee76ea0c7ab625884059450dbab5fce 100644 --- a/api/go/gosdn/rbac/rbac.pb.gw.go +++ b/api/go/gosdn/rbac/rbac.pb.gw.go @@ -131,6 +131,7 @@ func local_request_AuthService_Logout_0(ctx context.Context, marshaler runtime.M // UnaryRPC :call AuthServiceServer 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 RegisterAuthServiceHandlerFromEndpoint 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 RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error { mux.Handle("POST", pattern_AuthService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -221,7 +222,7 @@ func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AuthServiceClient" to call the correct interceptors. +// "AuthServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error { mux.Handle("POST", pattern_AuthService_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/rbac/rbac_grpc.pb.go b/api/go/gosdn/rbac/rbac_grpc.pb.go index 81a27d4fc8a7e8265518b387a3e05580b1d3a252..bb9b67f3f1a67b215b2db08f8f251a4a29d77158 100644 --- a/api/go/gosdn/rbac/rbac_grpc.pb.go +++ b/api/go/gosdn/rbac/rbac_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: gosdn/rbac/rbac.proto @@ -15,8 +15,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 ( AuthService_Login_FullMethodName = "/gosdn.rbac.AuthService/Login" @@ -63,7 +63,7 @@ func (c *authServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts // AuthServiceServer is the server API for AuthService service. // All implementations must embed UnimplementedAuthServiceServer -// for forward compatibility +// for forward compatibility. type AuthServiceServer interface { // Allows a user to login creating a session for further actions. Login(context.Context, *LoginRequest) (*LoginResponse, error) @@ -72,9 +72,12 @@ type AuthServiceServer interface { mustEmbedUnimplementedAuthServiceServer() } -// UnimplementedAuthServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAuthServiceServer struct { -} +// UnimplementedAuthServiceServer 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 UnimplementedAuthServiceServer struct{} func (UnimplementedAuthServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") @@ -83,6 +86,7 @@ func (UnimplementedAuthServiceServer) Logout(context.Context, *LogoutRequest) (* return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") } func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} +func (UnimplementedAuthServiceServer) testEmbeddedByValue() {} // UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AuthServiceServer will @@ -92,6 +96,13 @@ type UnsafeAuthServiceServer interface { } func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { + // If the following call pancis, it indicates UnimplementedAuthServiceServer 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(&AuthService_ServiceDesc, srv) } diff --git a/api/go/gosdn/rbac/role.pb.gw.go b/api/go/gosdn/rbac/role.pb.gw.go index 3c1cd4a63950b55bdd000faf78c86270b1b8ab4e..454fe45f0561e8c731b87bf7b7184886f710cc3a 100644 --- a/api/go/gosdn/rbac/role.pb.gw.go +++ b/api/go/gosdn/rbac/role.pb.gw.go @@ -231,6 +231,7 @@ func local_request_RoleService_DeleteRoles_0(ctx context.Context, marshaler runt // UnaryRPC :call RoleServiceServer 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 RegisterRoleServiceHandlerFromEndpoint 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 RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RoleServiceServer) error { mux.Handle("POST", pattern_RoleService_CreateRoles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -421,7 +422,7 @@ func RegisterRoleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RoleServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RoleServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "RoleServiceClient" to call the correct interceptors. +// "RoleServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RoleServiceClient) error { mux.Handle("POST", pattern_RoleService_CreateRoles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/rbac/role_grpc.pb.go b/api/go/gosdn/rbac/role_grpc.pb.go index f1719c7ab30cce80e414d97ee290d463c3f68652..2c5a3008547cb7a0cd8ce2b919d532cb96b16569 100644 --- a/api/go/gosdn/rbac/role_grpc.pb.go +++ b/api/go/gosdn/rbac/role_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: gosdn/rbac/role.proto @@ -15,8 +15,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 ( RoleService_CreateRoles_FullMethodName = "/gosdn.rbac.RoleService/CreateRoles" @@ -121,7 +121,7 @@ func (c *roleServiceClient) DeleteRoles(ctx context.Context, in *DeleteRolesRequ // RoleServiceServer is the server API for RoleService service. // All implementations must embed UnimplementedRoleServiceServer -// for forward compatibility +// for forward compatibility. type RoleServiceServer interface { // Creates roles, requires login beforehand. // Requires highest permissions. @@ -144,9 +144,12 @@ type RoleServiceServer interface { mustEmbedUnimplementedRoleServiceServer() } -// UnimplementedRoleServiceServer must be embedded to have forward compatible implementations. -type UnimplementedRoleServiceServer struct { -} +// UnimplementedRoleServiceServer 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 UnimplementedRoleServiceServer struct{} func (UnimplementedRoleServiceServer) CreateRoles(context.Context, *CreateRolesRequest) (*CreateRolesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateRoles not implemented") @@ -167,6 +170,7 @@ func (UnimplementedRoleServiceServer) DeleteRoles(context.Context, *DeleteRolesR return nil, status.Errorf(codes.Unimplemented, "method DeleteRoles not implemented") } func (UnimplementedRoleServiceServer) mustEmbedUnimplementedRoleServiceServer() {} +func (UnimplementedRoleServiceServer) testEmbeddedByValue() {} // UnsafeRoleServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RoleServiceServer will @@ -176,6 +180,13 @@ type UnsafeRoleServiceServer interface { } func RegisterRoleServiceServer(s grpc.ServiceRegistrar, srv RoleServiceServer) { + // If the following call pancis, it indicates UnimplementedRoleServiceServer 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(&RoleService_ServiceDesc, srv) } diff --git a/api/go/gosdn/rbac/user.pb.gw.go b/api/go/gosdn/rbac/user.pb.gw.go index abb6b782712ec3ba1103c970da97fd2119843503..2103e85b5af84b6c36bb04fea2d03d752a5848ea 100644 --- a/api/go/gosdn/rbac/user.pb.gw.go +++ b/api/go/gosdn/rbac/user.pb.gw.go @@ -195,6 +195,7 @@ func local_request_UserService_DeleteUsers_0(ctx context.Context, marshaler runt // 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("POST", pattern_UserService_CreateUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -360,7 +361,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("POST", pattern_UserService_CreateUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/rbac/user_grpc.pb.go b/api/go/gosdn/rbac/user_grpc.pb.go index cae774d0daf0339a1b01827efce537c1dc3c4ae6..289536b5663a36422bbe0b52c877c7bb600fe886 100644 --- a/api/go/gosdn/rbac/user_grpc.pb.go +++ b/api/go/gosdn/rbac/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: gosdn/rbac/user.proto @@ -15,8 +15,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_CreateUsers_FullMethodName = "/gosdn.rbac.UserService/CreateUsers" @@ -108,7 +108,7 @@ func (c *userServiceClient) DeleteUsers(ctx context.Context, in *DeleteUsersRequ // UserServiceServer is the server API for UserService service. // All implementations must embed UnimplementedUserServiceServer -// for forward compatibility +// for forward compatibility. type UserServiceServer interface { // Create users with the provided parameters, creation of multiple users requires login beforehand. // Highest possible permissions of new users is of current permission level. @@ -129,9 +129,12 @@ type UserServiceServer interface { mustEmbedUnimplementedUserServiceServer() } -// UnimplementedUserServiceServer must be embedded to have forward compatible implementations. -type UnimplementedUserServiceServer struct { -} +// 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) CreateUsers(context.Context, *CreateUsersRequest) (*CreateUsersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateUsers not implemented") @@ -149,6 +152,7 @@ func (UnimplementedUserServiceServer) DeleteUsers(context.Context, *DeleteUsersR return nil, status.Errorf(codes.Unimplemented, "method DeleteUsers 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 @@ -158,6 +162,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) } diff --git a/api/go/gosdn/southbound/southbound_grpc.pb.go b/api/go/gosdn/southbound/southbound_grpc.pb.go index 30628cc6fddc9638215993033d2572b55cf06223..24b7bdf40e3528f2fcd725e5839111f387ccbdeb 100644 --- a/api/go/gosdn/southbound/southbound_grpc.pb.go +++ b/api/go/gosdn/southbound/southbound_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: gosdn/southbound/southbound.proto @@ -15,8 +15,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 ( SbiService_GetSchema_FullMethodName = "/gosdn.southbound.SbiService/GetSchema" @@ -26,7 +26,7 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SbiServiceClient interface { - GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (SbiService_GetSchemaClient, error) + GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Payload], error) } type sbiServiceClient struct { @@ -37,13 +37,13 @@ func NewSbiServiceClient(cc grpc.ClientConnInterface) SbiServiceClient { return &sbiServiceClient{cc} } -func (c *sbiServiceClient) GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (SbiService_GetSchemaClient, error) { +func (c *sbiServiceClient) GetSchema(ctx context.Context, in *GetSchemaRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Payload], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &SbiService_ServiceDesc.Streams[0], SbiService_GetSchema_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &sbiServiceGetSchemaClient{ClientStream: stream} + x := &grpc.GenericClientStream[GetSchemaRequest, Payload]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -53,39 +53,29 @@ func (c *sbiServiceClient) GetSchema(ctx context.Context, in *GetSchemaRequest, return x, nil } -type SbiService_GetSchemaClient interface { - Recv() (*Payload, error) - grpc.ClientStream -} - -type sbiServiceGetSchemaClient struct { - grpc.ClientStream -} - -func (x *sbiServiceGetSchemaClient) Recv() (*Payload, error) { - m := new(Payload) - 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 SbiService_GetSchemaClient = grpc.ServerStreamingClient[Payload] // SbiServiceServer is the server API for SbiService service. // All implementations must embed UnimplementedSbiServiceServer -// for forward compatibility +// for forward compatibility. type SbiServiceServer interface { - GetSchema(*GetSchemaRequest, SbiService_GetSchemaServer) error + GetSchema(*GetSchemaRequest, grpc.ServerStreamingServer[Payload]) error mustEmbedUnimplementedSbiServiceServer() } -// UnimplementedSbiServiceServer must be embedded to have forward compatible implementations. -type UnimplementedSbiServiceServer struct { -} +// UnimplementedSbiServiceServer 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 UnimplementedSbiServiceServer struct{} -func (UnimplementedSbiServiceServer) GetSchema(*GetSchemaRequest, SbiService_GetSchemaServer) error { +func (UnimplementedSbiServiceServer) GetSchema(*GetSchemaRequest, grpc.ServerStreamingServer[Payload]) error { return status.Errorf(codes.Unimplemented, "method GetSchema not implemented") } func (UnimplementedSbiServiceServer) mustEmbedUnimplementedSbiServiceServer() {} +func (UnimplementedSbiServiceServer) testEmbeddedByValue() {} // UnsafeSbiServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SbiServiceServer will @@ -95,6 +85,13 @@ type UnsafeSbiServiceServer interface { } func RegisterSbiServiceServer(s grpc.ServiceRegistrar, srv SbiServiceServer) { + // If the following call pancis, it indicates UnimplementedSbiServiceServer 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(&SbiService_ServiceDesc, srv) } @@ -103,21 +100,11 @@ func _SbiService_GetSchema_Handler(srv interface{}, stream grpc.ServerStream) er if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SbiServiceServer).GetSchema(m, &sbiServiceGetSchemaServer{ServerStream: stream}) -} - -type SbiService_GetSchemaServer interface { - Send(*Payload) error - grpc.ServerStream + return srv.(SbiServiceServer).GetSchema(m, &grpc.GenericServerStream[GetSchemaRequest, Payload]{ServerStream: stream}) } -type sbiServiceGetSchemaServer struct { - grpc.ServerStream -} - -func (x *sbiServiceGetSchemaServer) Send(m *Payload) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type SbiService_GetSchemaServer = grpc.ServerStreamingServer[Payload] // SbiService_ServiceDesc is the grpc.ServiceDesc for SbiService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/go/gosdn/subscriptionmanagement/subscriptionmanagement.pb.go b/api/go/gosdn/subscriptionmanagement/subscriptionmanagement.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..617bea4d27eea7184ec26cec37ce541c4e6b10e7 --- /dev/null +++ b/api/go/gosdn/subscriptionmanagement/subscriptionmanagement.pb.go @@ -0,0 +1,1118 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc (unknown) +// source: gosdn/subscriptionmanagement/subscriptionmanagement.proto + +package submanagement + +import ( + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/descriptorpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Subscription struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Subid string `protobuf:"bytes,1,opt,name=subid,proto3" json:"subid,omitempty"` + Pid string `protobuf:"bytes,2,opt,name=pid,proto3" json:"pid,omitempty"` + Mneid string `protobuf:"bytes,3,opt,name=mneid,proto3" json:"mneid,omitempty"` + MneName string `protobuf:"bytes,4,opt,name=mne_name,json=mneName,proto3" json:"mne_name,omitempty"` + Paths []*Path `protobuf:"bytes,5,rep,name=paths,proto3" json:"paths,omitempty"` + SubscribeOptions *SubscribeOptions `protobuf:"bytes,6,opt,name=subscribe_options,json=subscribeOptions,proto3" json:"subscribe_options,omitempty"` +} + +func (x *Subscription) Reset() { + *x = Subscription{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Subscription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Subscription) ProtoMessage() {} + +func (x *Subscription) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Subscription.ProtoReflect.Descriptor instead. +func (*Subscription) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{0} +} + +func (x *Subscription) GetSubid() string { + if x != nil { + return x.Subid + } + return "" +} + +func (x *Subscription) GetPid() string { + if x != nil { + return x.Pid + } + return "" +} + +func (x *Subscription) GetMneid() string { + if x != nil { + return x.Mneid + } + return "" +} + +func (x *Subscription) GetMneName() string { + if x != nil { + return x.MneName + } + return "" +} + +func (x *Subscription) GetPaths() []*Path { + if x != nil { + return x.Paths + } + return nil +} + +func (x *Subscription) GetSubscribeOptions() *SubscribeOptions { + if x != nil { + return x.SubscribeOptions + } + return nil +} + +type Path struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Elem []string `protobuf:"bytes,1,rep,name=elem,proto3" json:"elem,omitempty"` +} + +func (x *Path) Reset() { + *x = Path{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Path) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Path) ProtoMessage() {} + +func (x *Path) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Path.ProtoReflect.Descriptor instead. +func (*Path) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{1} +} + +func (x *Path) GetElem() []string { + if x != nil { + return x.Elem + } + return nil +} + +type SubscribeOptions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GnmiMode string `protobuf:"bytes,1,opt,name=gnmi_mode,json=gnmiMode,proto3" json:"gnmi_mode,omitempty"` + GnmiStreamMode string `protobuf:"bytes,2,opt,name=gnmi_stream_mode,json=gnmiStreamMode,proto3" json:"gnmi_stream_mode,omitempty"` + SampleInterval uint64 `protobuf:"varint,3,opt,name=sample_interval,json=sampleInterval,proto3" json:"sample_interval,omitempty"` +} + +func (x *SubscribeOptions) Reset() { + *x = SubscribeOptions{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeOptions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeOptions) ProtoMessage() {} + +func (x *SubscribeOptions) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeOptions.ProtoReflect.Descriptor instead. +func (*SubscribeOptions) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{2} +} + +func (x *SubscribeOptions) GetGnmiMode() string { + if x != nil { + return x.GnmiMode + } + return "" +} + +func (x *SubscribeOptions) GetGnmiStreamMode() string { + if x != nil { + return x.GnmiStreamMode + } + return "" +} + +func (x *SubscribeOptions) GetSampleInterval() uint64 { + if x != nil { + return x.SampleInterval + } + return 0 +} + +type GetAllRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *GetAllRequest) Reset() { + *x = GetAllRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllRequest) ProtoMessage() {} + +func (x *GetAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllRequest.ProtoReflect.Descriptor instead. +func (*GetAllRequest) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{3} +} + +func (x *GetAllRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type GetAllResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Subscriptions []*Subscription `protobuf:"bytes,2,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"` +} + +func (x *GetAllResponse) Reset() { + *x = GetAllResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllResponse) ProtoMessage() {} + +func (x *GetAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllResponse.ProtoReflect.Descriptor instead. +func (*GetAllResponse) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{4} +} + +func (x *GetAllResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetAllResponse) GetSubscriptions() []*Subscription { + if x != nil { + return x.Subscriptions + } + return nil +} + +type GetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Subid string `protobuf:"bytes,2,opt,name=subid,proto3" json:"subid,omitempty"` +} + +func (x *GetRequest) Reset() { + *x = GetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. +func (*GetRequest) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{5} +} + +func (x *GetRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetRequest) GetSubid() string { + if x != nil { + return x.Subid + } + return "" +} + +type GetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Subscriptions *Subscription `protobuf:"bytes,2,opt,name=subscriptions,proto3" json:"subscriptions,omitempty"` +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. +func (*GetResponse) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{6} +} + +func (x *GetResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetResponse) GetSubscriptions() *Subscription { + if x != nil { + return x.Subscriptions + } + return nil +} + +type DeleteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Subid string `protobuf:"bytes,2,opt,name=subid,proto3" json:"subid,omitempty"` +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *DeleteRequest) GetSubid() string { + if x != nil { + return x.Subid + } + return "" +} + +type DeleteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type AddRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Mneid string `protobuf:"bytes,2,opt,name=mneid,proto3" json:"mneid,omitempty"` + Subscription *Subscription `protobuf:"bytes,3,opt,name=subscription,proto3" json:"subscription,omitempty"` +} + +func (x *AddRequest) Reset() { + *x = AddRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddRequest) ProtoMessage() {} + +func (x *AddRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddRequest.ProtoReflect.Descriptor instead. +func (*AddRequest) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{9} +} + +func (x *AddRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *AddRequest) GetMneid() string { + if x != nil { + return x.Mneid + } + return "" +} + +func (x *AddRequest) GetSubscription() *Subscription { + if x != nil { + return x.Subscription + } + return nil +} + +type AddResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *AddResponse) Reset() { + *x = AddResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddResponse) ProtoMessage() {} + +func (x *AddResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddResponse.ProtoReflect.Descriptor instead. +func (*AddResponse) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{10} +} + +func (x *AddResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type ResetAllSubscriptionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *ResetAllSubscriptionsRequest) Reset() { + *x = ResetAllSubscriptionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResetAllSubscriptionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetAllSubscriptionsRequest) ProtoMessage() {} + +func (x *ResetAllSubscriptionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetAllSubscriptionsRequest.ProtoReflect.Descriptor instead. +func (*ResetAllSubscriptionsRequest) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{11} +} + +func (x *ResetAllSubscriptionsRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type ResetAllSubscriptionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *ResetAllSubscriptionsResponse) Reset() { + *x = ResetAllSubscriptionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResetAllSubscriptionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetAllSubscriptionsResponse) ProtoMessage() {} + +func (x *ResetAllSubscriptionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetAllSubscriptionsResponse.ProtoReflect.Descriptor instead. +func (*ResetAllSubscriptionsResponse) Descriptor() ([]byte, []int) { + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP(), []int{12} +} + +func (x *ResetAllSubscriptionsResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +var File_gosdn_subscriptionmanagement_subscriptionmanagement_proto protoreflect.FileDescriptor + +var file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDesc = []byte{ + 0x0a, 0x39, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x75, 0x62, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x75, 0x62, 0x69, 0x64, 0x12, 0x10, 0x0a, + 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x6d, 0x6e, 0x65, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x6d, 0x6e, 0x65, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x6e, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6e, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x38, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x50, + 0x61, 0x74, 0x68, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x5b, 0x0a, 0x11, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x10, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x1a, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, + 0x12, 0x0a, 0x04, 0x65, 0x6c, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x65, + 0x6c, 0x65, 0x6d, 0x22, 0x82, 0x01, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x6e, 0x6d, 0x69, + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x6e, 0x6d, + 0x69, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x67, 0x6e, 0x6d, 0x69, 0x5f, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x67, 0x6e, 0x6d, 0x69, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x12, + 0x27, 0x0a, 0x0f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0x2d, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, + 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x80, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, + 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x50, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x48, 0x0a, 0x0a, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x05, 0x73, 0x75, 0x62, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x05, 0x73, + 0x75, 0x62, 0x69, 0x64, 0x22, 0x7d, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x12, 0x50, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, + 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0x4b, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x05, 0x73, 0x75, 0x62, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x05, 0x73, 0x75, 0x62, 0x69, 0x64, + 0x22, 0x2e, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x22, 0xa0, 0x01, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, + 0x05, 0x6d, 0x6e, 0x65, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, + 0x03, 0xc8, 0x01, 0x01, 0x52, 0x05, 0x6d, 0x6e, 0x65, 0x69, 0x64, 0x12, 0x56, 0x0a, 0x0c, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x06, 0xba, + 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x2b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x22, 0x3c, 0x0a, 0x1c, 0x52, 0x65, 0x73, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x3d, + 0x0a, 0x1d, 0x52, 0x65, 0x73, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x32, 0xdd, 0x05, + 0x0a, 0x1d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x89, 0x01, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x2b, 0x2e, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, + 0x73, 0x75, 0x62, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x7a, 0x0a, 0x03, 0x47, + 0x65, 0x74, 0x12, 0x28, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x67, + 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, + 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, + 0x7b, 0x73, 0x75, 0x62, 0x69, 0x64, 0x7d, 0x12, 0x83, 0x01, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x12, 0x2b, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2c, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x7b, 0x73, 0x75, 0x62, 0x69, 0x64, 0x7d, 0x12, 0x7d, 0x0a, + 0x03, 0x41, 0x64, 0x64, 0x12, 0x28, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, + 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x64, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1b, 0x3a, 0x01, 0x2a, 0x22, 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x7b, 0x6d, 0x6e, 0x65, 0x69, 0x64, 0x7d, 0x12, 0xae, 0x01, 0x0a, + 0x15, 0x52, 0x65, 0x73, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3a, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x74, 0x42, 0x39, 0x5a, + 0x37, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, + 0x65, 0x2f, 0x64, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescOnce sync.Once + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescData = file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDesc +) + +func file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescGZIP() []byte { + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescOnce.Do(func() { + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescData = protoimpl.X.CompressGZIP(file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescData) + }) + return file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDescData +} + +var file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_goTypes = []any{ + (*Subscription)(nil), // 0: gosdn.subscriptionmanagement.Subscription + (*Path)(nil), // 1: gosdn.subscriptionmanagement.Path + (*SubscribeOptions)(nil), // 2: gosdn.subscriptionmanagement.SubscribeOptions + (*GetAllRequest)(nil), // 3: gosdn.subscriptionmanagement.GetAllRequest + (*GetAllResponse)(nil), // 4: gosdn.subscriptionmanagement.GetAllResponse + (*GetRequest)(nil), // 5: gosdn.subscriptionmanagement.GetRequest + (*GetResponse)(nil), // 6: gosdn.subscriptionmanagement.GetResponse + (*DeleteRequest)(nil), // 7: gosdn.subscriptionmanagement.DeleteRequest + (*DeleteResponse)(nil), // 8: gosdn.subscriptionmanagement.DeleteResponse + (*AddRequest)(nil), // 9: gosdn.subscriptionmanagement.AddRequest + (*AddResponse)(nil), // 10: gosdn.subscriptionmanagement.AddResponse + (*ResetAllSubscriptionsRequest)(nil), // 11: gosdn.subscriptionmanagement.ResetAllSubscriptionsRequest + (*ResetAllSubscriptionsResponse)(nil), // 12: gosdn.subscriptionmanagement.ResetAllSubscriptionsResponse +} +var file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_depIdxs = []int32{ + 1, // 0: gosdn.subscriptionmanagement.Subscription.paths:type_name -> gosdn.subscriptionmanagement.Path + 2, // 1: gosdn.subscriptionmanagement.Subscription.subscribe_options:type_name -> gosdn.subscriptionmanagement.SubscribeOptions + 0, // 2: gosdn.subscriptionmanagement.GetAllResponse.subscriptions:type_name -> gosdn.subscriptionmanagement.Subscription + 0, // 3: gosdn.subscriptionmanagement.GetResponse.subscriptions:type_name -> gosdn.subscriptionmanagement.Subscription + 0, // 4: gosdn.subscriptionmanagement.AddRequest.subscription:type_name -> gosdn.subscriptionmanagement.Subscription + 3, // 5: gosdn.subscriptionmanagement.SubscriptionManagementService.GetAll:input_type -> gosdn.subscriptionmanagement.GetAllRequest + 5, // 6: gosdn.subscriptionmanagement.SubscriptionManagementService.Get:input_type -> gosdn.subscriptionmanagement.GetRequest + 7, // 7: gosdn.subscriptionmanagement.SubscriptionManagementService.Delete:input_type -> gosdn.subscriptionmanagement.DeleteRequest + 9, // 8: gosdn.subscriptionmanagement.SubscriptionManagementService.Add:input_type -> gosdn.subscriptionmanagement.AddRequest + 11, // 9: gosdn.subscriptionmanagement.SubscriptionManagementService.ResetAllSubscriptions:input_type -> gosdn.subscriptionmanagement.ResetAllSubscriptionsRequest + 4, // 10: gosdn.subscriptionmanagement.SubscriptionManagementService.GetAll:output_type -> gosdn.subscriptionmanagement.GetAllResponse + 6, // 11: gosdn.subscriptionmanagement.SubscriptionManagementService.Get:output_type -> gosdn.subscriptionmanagement.GetResponse + 8, // 12: gosdn.subscriptionmanagement.SubscriptionManagementService.Delete:output_type -> gosdn.subscriptionmanagement.DeleteResponse + 10, // 13: gosdn.subscriptionmanagement.SubscriptionManagementService.Add:output_type -> gosdn.subscriptionmanagement.AddResponse + 12, // 14: gosdn.subscriptionmanagement.SubscriptionManagementService.ResetAllSubscriptions:output_type -> gosdn.subscriptionmanagement.ResetAllSubscriptionsResponse + 10, // [10:15] is the sub-list for method output_type + 5, // [5:10] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_init() } +func file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_init() { + if File_gosdn_subscriptionmanagement_subscriptionmanagement_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Subscription); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*Path); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*SubscribeOptions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*GetAllRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*GetAllResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*GetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*GetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*DeleteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*AddRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[10].Exporter = func(v any, i int) any { + switch v := v.(*AddResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[11].Exporter = func(v any, i int) any { + switch v := v.(*ResetAllSubscriptionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes[12].Exporter = func(v any, i int) any { + switch v := v.(*ResetAllSubscriptionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDesc, + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_goTypes, + DependencyIndexes: file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_depIdxs, + MessageInfos: file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_msgTypes, + }.Build() + File_gosdn_subscriptionmanagement_subscriptionmanagement_proto = out.File + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_rawDesc = nil + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_goTypes = nil + file_gosdn_subscriptionmanagement_subscriptionmanagement_proto_depIdxs = nil +} diff --git a/api/go/gosdn/subscriptionmanagement/subscriptionmanagement.pb.gw.go b/api/go/gosdn/subscriptionmanagement/subscriptionmanagement.pb.gw.go new file mode 100644 index 0000000000000000000000000000000000000000..b7efc5dc07746d8a27ff0b9520939e6d8183f826 --- /dev/null +++ b/api/go/gosdn/subscriptionmanagement/subscriptionmanagement.pb.gw.go @@ -0,0 +1,614 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: gosdn/subscriptionmanagement/subscriptionmanagement.proto + +/* +Package submanagement is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package submanagement + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +var ( + filter_SubscriptionManagementService_GetAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_SubscriptionManagementService_GetAll_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_GetAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SubscriptionManagementService_GetAll_0(ctx context.Context, marshaler runtime.Marshaler, server SubscriptionManagementServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAllRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_GetAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetAll(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SubscriptionManagementService_Get_0 = &utilities.DoubleArray{Encoding: map[string]int{"subid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_SubscriptionManagementService_Get_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subid") + } + + protoReq.Subid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subid", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_Get_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SubscriptionManagementService_Get_0(ctx context.Context, marshaler runtime.Marshaler, server SubscriptionManagementServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subid") + } + + protoReq.Subid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subid", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_Get_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Get(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SubscriptionManagementService_Delete_0 = &utilities.DoubleArray{Encoding: map[string]int{"subid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_SubscriptionManagementService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subid") + } + + protoReq.Subid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subid", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_Delete_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SubscriptionManagementService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server SubscriptionManagementServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["subid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subid") + } + + protoReq.Subid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subid", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_Delete_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Delete(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SubscriptionManagementService_Add_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AddRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["mneid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "mneid") + } + + protoReq.Mneid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "mneid", err) + } + + msg, err := client.Add(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SubscriptionManagementService_Add_0(ctx context.Context, marshaler runtime.Marshaler, server SubscriptionManagementServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AddRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["mneid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "mneid") + } + + protoReq.Mneid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "mneid", err) + } + + msg, err := server.Add(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SubscriptionManagementService_ResetAllSubscriptions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_SubscriptionManagementService_ResetAllSubscriptions_0(ctx context.Context, marshaler runtime.Marshaler, client SubscriptionManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ResetAllSubscriptionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_ResetAllSubscriptions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ResetAllSubscriptions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SubscriptionManagementService_ResetAllSubscriptions_0(ctx context.Context, marshaler runtime.Marshaler, server SubscriptionManagementServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ResetAllSubscriptionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SubscriptionManagementService_ResetAllSubscriptions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ResetAllSubscriptions(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterSubscriptionManagementServiceHandlerServer registers the http handlers for service SubscriptionManagementService to "mux". +// UnaryRPC :call SubscriptionManagementServiceServer 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 RegisterSubscriptionManagementServiceHandlerFromEndpoint 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 RegisterSubscriptionManagementServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SubscriptionManagementServiceServer) error { + + mux.Handle("GET", pattern_SubscriptionManagementService_GetAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/GetAll", runtime.WithHTTPPathPattern("/submanagement/subscriptions")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SubscriptionManagementService_GetAll_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_GetAll_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SubscriptionManagementService_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/Get", runtime.WithHTTPPathPattern("/submanagement/{subid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SubscriptionManagementService_Get_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SubscriptionManagementService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/Delete", runtime.WithHTTPPathPattern("/submanagement/{subid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SubscriptionManagementService_Delete_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SubscriptionManagementService_Add_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/Add", runtime.WithHTTPPathPattern("/submanagement/{mneid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SubscriptionManagementService_Add_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_Add_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SubscriptionManagementService_ResetAllSubscriptions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/ResetAllSubscriptions", runtime.WithHTTPPathPattern("/submanagement/reset")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SubscriptionManagementService_ResetAllSubscriptions_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_ResetAllSubscriptions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterSubscriptionManagementServiceHandlerFromEndpoint is same as RegisterSubscriptionManagementServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSubscriptionManagementServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSubscriptionManagementServiceHandler(ctx, mux, conn) +} + +// RegisterSubscriptionManagementServiceHandler registers the http handlers for service SubscriptionManagementService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSubscriptionManagementServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSubscriptionManagementServiceHandlerClient(ctx, mux, NewSubscriptionManagementServiceClient(conn)) +} + +// RegisterSubscriptionManagementServiceHandlerClient registers the http handlers for service SubscriptionManagementService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SubscriptionManagementServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SubscriptionManagementServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "SubscriptionManagementServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterSubscriptionManagementServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SubscriptionManagementServiceClient) error { + + mux.Handle("GET", pattern_SubscriptionManagementService_GetAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/GetAll", runtime.WithHTTPPathPattern("/submanagement/subscriptions")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SubscriptionManagementService_GetAll_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_GetAll_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SubscriptionManagementService_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/Get", runtime.WithHTTPPathPattern("/submanagement/{subid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SubscriptionManagementService_Get_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SubscriptionManagementService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/Delete", runtime.WithHTTPPathPattern("/submanagement/{subid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SubscriptionManagementService_Delete_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SubscriptionManagementService_Add_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/Add", runtime.WithHTTPPathPattern("/submanagement/{mneid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SubscriptionManagementService_Add_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_Add_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SubscriptionManagementService_ResetAllSubscriptions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/gosdn.subscriptionmanagement.SubscriptionManagementService/ResetAllSubscriptions", runtime.WithHTTPPathPattern("/submanagement/reset")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SubscriptionManagementService_ResetAllSubscriptions_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SubscriptionManagementService_ResetAllSubscriptions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_SubscriptionManagementService_GetAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"submanagement", "subscriptions"}, "")) + + pattern_SubscriptionManagementService_Get_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"submanagement", "subid"}, "")) + + pattern_SubscriptionManagementService_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"submanagement", "subid"}, "")) + + pattern_SubscriptionManagementService_Add_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"submanagement", "mneid"}, "")) + + pattern_SubscriptionManagementService_ResetAllSubscriptions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"submanagement", "reset"}, "")) +) + +var ( + forward_SubscriptionManagementService_GetAll_0 = runtime.ForwardResponseMessage + + forward_SubscriptionManagementService_Get_0 = runtime.ForwardResponseMessage + + forward_SubscriptionManagementService_Delete_0 = runtime.ForwardResponseMessage + + forward_SubscriptionManagementService_Add_0 = runtime.ForwardResponseMessage + + forward_SubscriptionManagementService_ResetAllSubscriptions_0 = runtime.ForwardResponseMessage +) diff --git a/api/go/gosdn/subscriptionmanagement/subscriptionmanagement_grpc.pb.go b/api/go/gosdn/subscriptionmanagement/subscriptionmanagement_grpc.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..6e84c6cf0ffb677ac54bb250ebe4fae7c8c136dc --- /dev/null +++ b/api/go/gosdn/subscriptionmanagement/subscriptionmanagement_grpc.pb.go @@ -0,0 +1,274 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: gosdn/subscriptionmanagement/subscriptionmanagement.proto + +package submanagement + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SubscriptionManagementService_GetAll_FullMethodName = "/gosdn.subscriptionmanagement.SubscriptionManagementService/GetAll" + SubscriptionManagementService_Get_FullMethodName = "/gosdn.subscriptionmanagement.SubscriptionManagementService/Get" + SubscriptionManagementService_Delete_FullMethodName = "/gosdn.subscriptionmanagement.SubscriptionManagementService/Delete" + SubscriptionManagementService_Add_FullMethodName = "/gosdn.subscriptionmanagement.SubscriptionManagementService/Add" + SubscriptionManagementService_ResetAllSubscriptions_FullMethodName = "/gosdn.subscriptionmanagement.SubscriptionManagementService/ResetAllSubscriptions" +) + +// SubscriptionManagementServiceClient is the client API for SubscriptionManagementService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SubscriptionManagementServiceClient interface { + GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*GetAllResponse, error) + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) + ResetAllSubscriptions(ctx context.Context, in *ResetAllSubscriptionsRequest, opts ...grpc.CallOption) (*ResetAllSubscriptionsResponse, error) +} + +type subscriptionManagementServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSubscriptionManagementServiceClient(cc grpc.ClientConnInterface) SubscriptionManagementServiceClient { + return &subscriptionManagementServiceClient{cc} +} + +func (c *subscriptionManagementServiceClient) GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*GetAllResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetAllResponse) + err := c.cc.Invoke(ctx, SubscriptionManagementService_GetAll_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscriptionManagementServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetResponse) + err := c.cc.Invoke(ctx, SubscriptionManagementService_Get_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscriptionManagementServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, SubscriptionManagementService_Delete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscriptionManagementServiceClient) Add(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*AddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddResponse) + err := c.cc.Invoke(ctx, SubscriptionManagementService_Add_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscriptionManagementServiceClient) ResetAllSubscriptions(ctx context.Context, in *ResetAllSubscriptionsRequest, opts ...grpc.CallOption) (*ResetAllSubscriptionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ResetAllSubscriptionsResponse) + err := c.cc.Invoke(ctx, SubscriptionManagementService_ResetAllSubscriptions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SubscriptionManagementServiceServer is the server API for SubscriptionManagementService service. +// All implementations must embed UnimplementedSubscriptionManagementServiceServer +// for forward compatibility. +type SubscriptionManagementServiceServer interface { + GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error) + Get(context.Context, *GetRequest) (*GetResponse, error) + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + Add(context.Context, *AddRequest) (*AddResponse, error) + ResetAllSubscriptions(context.Context, *ResetAllSubscriptionsRequest) (*ResetAllSubscriptionsResponse, error) + mustEmbedUnimplementedSubscriptionManagementServiceServer() +} + +// UnimplementedSubscriptionManagementServiceServer 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 UnimplementedSubscriptionManagementServiceServer struct{} + +func (UnimplementedSubscriptionManagementServiceServer) GetAll(context.Context, *GetAllRequest) (*GetAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented") +} +func (UnimplementedSubscriptionManagementServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedSubscriptionManagementServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedSubscriptionManagementServiceServer) Add(context.Context, *AddRequest) (*AddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") +} +func (UnimplementedSubscriptionManagementServiceServer) ResetAllSubscriptions(context.Context, *ResetAllSubscriptionsRequest) (*ResetAllSubscriptionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResetAllSubscriptions not implemented") +} +func (UnimplementedSubscriptionManagementServiceServer) mustEmbedUnimplementedSubscriptionManagementServiceServer() { +} +func (UnimplementedSubscriptionManagementServiceServer) testEmbeddedByValue() {} + +// UnsafeSubscriptionManagementServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SubscriptionManagementServiceServer will +// result in compilation errors. +type UnsafeSubscriptionManagementServiceServer interface { + mustEmbedUnimplementedSubscriptionManagementServiceServer() +} + +func RegisterSubscriptionManagementServiceServer(s grpc.ServiceRegistrar, srv SubscriptionManagementServiceServer) { + // If the following call pancis, it indicates UnimplementedSubscriptionManagementServiceServer 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(&SubscriptionManagementService_ServiceDesc, srv) +} + +func _SubscriptionManagementService_GetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscriptionManagementServiceServer).GetAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscriptionManagementService_GetAll_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscriptionManagementServiceServer).GetAll(ctx, req.(*GetAllRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscriptionManagementService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscriptionManagementServiceServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscriptionManagementService_Get_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscriptionManagementServiceServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscriptionManagementService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscriptionManagementServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscriptionManagementService_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscriptionManagementServiceServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscriptionManagementService_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscriptionManagementServiceServer).Add(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscriptionManagementService_Add_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscriptionManagementServiceServer).Add(ctx, req.(*AddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscriptionManagementService_ResetAllSubscriptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResetAllSubscriptionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscriptionManagementServiceServer).ResetAllSubscriptions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscriptionManagementService_ResetAllSubscriptions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscriptionManagementServiceServer).ResetAllSubscriptions(ctx, req.(*ResetAllSubscriptionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SubscriptionManagementService_ServiceDesc is the grpc.ServiceDesc for SubscriptionManagementService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SubscriptionManagementService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gosdn.subscriptionmanagement.SubscriptionManagementService", + HandlerType: (*SubscriptionManagementServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAll", + Handler: _SubscriptionManagementService_GetAll_Handler, + }, + { + MethodName: "Get", + Handler: _SubscriptionManagementService_Get_Handler, + }, + { + MethodName: "Delete", + Handler: _SubscriptionManagementService_Delete_Handler, + }, + { + MethodName: "Add", + Handler: _SubscriptionManagementService_Add_Handler, + }, + { + MethodName: "ResetAllSubscriptions", + Handler: _SubscriptionManagementService_ResetAllSubscriptions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "gosdn/subscriptionmanagement/subscriptionmanagement.proto", +} diff --git a/api/go/gosdn/topology/routingTable.pb.gw.go b/api/go/gosdn/topology/routingTable.pb.gw.go index d4b31f111ba656529dac9535641dd75cd0cf4540..2b736a2f523e3d725b33cfcb905e6d58a920503d 100644 --- a/api/go/gosdn/topology/routingTable.pb.gw.go +++ b/api/go/gosdn/topology/routingTable.pb.gw.go @@ -133,6 +133,7 @@ func local_request_RoutingTableService_DeleteRoute_0(ctx context.Context, marsha // UnaryRPC :call RoutingTableServiceServer 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 RegisterRoutingTableServiceHandlerFromEndpoint 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 RegisterRoutingTableServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RoutingTableServiceServer) error { mux.Handle("POST", pattern_RoutingTableService_AddRoutingTable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -248,7 +249,7 @@ func RegisterRoutingTableServiceHandler(ctx context.Context, mux *runtime.ServeM // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RoutingTableServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RoutingTableServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "RoutingTableServiceClient" to call the correct interceptors. +// "RoutingTableServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterRoutingTableServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RoutingTableServiceClient) error { mux.Handle("POST", pattern_RoutingTableService_AddRoutingTable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/topology/routingTable_grpc.pb.go b/api/go/gosdn/topology/routingTable_grpc.pb.go index 0fe3c824880edc52fdd615808ee785a8d4fe275e..c75435214987b999c099ca531b59a4b0edc452ad 100644 --- a/api/go/gosdn/topology/routingTable_grpc.pb.go +++ b/api/go/gosdn/topology/routingTable_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: gosdn/topology/routingTable.proto @@ -15,8 +15,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 ( RoutingTableService_AddRoutingTable_FullMethodName = "/gosdn.topology.RoutingTableService/AddRoutingTable" @@ -73,7 +73,7 @@ func (c *routingTableServiceClient) DeleteRoute(ctx context.Context, in *DeleteR // RoutingTableServiceServer is the server API for RoutingTableService service. // All implementations must embed UnimplementedRoutingTableServiceServer -// for forward compatibility +// for forward compatibility. type RoutingTableServiceServer interface { AddRoutingTable(context.Context, *AddRoutingTableRequest) (*AddRoutingTableResponse, error) GetRoutes(context.Context, *GetRoutesRequest) (*GetRoutesResponse, error) @@ -81,9 +81,12 @@ type RoutingTableServiceServer interface { mustEmbedUnimplementedRoutingTableServiceServer() } -// UnimplementedRoutingTableServiceServer must be embedded to have forward compatible implementations. -type UnimplementedRoutingTableServiceServer struct { -} +// UnimplementedRoutingTableServiceServer 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 UnimplementedRoutingTableServiceServer struct{} func (UnimplementedRoutingTableServiceServer) AddRoutingTable(context.Context, *AddRoutingTableRequest) (*AddRoutingTableResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddRoutingTable not implemented") @@ -95,6 +98,7 @@ func (UnimplementedRoutingTableServiceServer) DeleteRoute(context.Context, *Dele return nil, status.Errorf(codes.Unimplemented, "method DeleteRoute not implemented") } func (UnimplementedRoutingTableServiceServer) mustEmbedUnimplementedRoutingTableServiceServer() {} +func (UnimplementedRoutingTableServiceServer) testEmbeddedByValue() {} // UnsafeRoutingTableServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RoutingTableServiceServer will @@ -104,6 +108,13 @@ type UnsafeRoutingTableServiceServer interface { } func RegisterRoutingTableServiceServer(s grpc.ServiceRegistrar, srv RoutingTableServiceServer) { + // If the following call pancis, it indicates UnimplementedRoutingTableServiceServer 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(&RoutingTableService_ServiceDesc, srv) } diff --git a/api/go/gosdn/topology/topology.pb.gw.go b/api/go/gosdn/topology/topology.pb.gw.go index ae502d1de94c9c94ee224ee938c113e11222c718..93edbd2fd86ddd2bb2deb3acbfbbc3d7911569bc 100644 --- a/api/go/gosdn/topology/topology.pb.gw.go +++ b/api/go/gosdn/topology/topology.pb.gw.go @@ -159,6 +159,7 @@ func local_request_TopologyService_DeleteLink_0(ctx context.Context, marshaler r // UnaryRPC :call TopologyServiceServer 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 RegisterTopologyServiceHandlerFromEndpoint 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 RegisterTopologyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TopologyServiceServer) error { mux.Handle("POST", pattern_TopologyService_AddLink_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -299,7 +300,7 @@ func RegisterTopologyServiceHandler(ctx context.Context, mux *runtime.ServeMux, // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TopologyServiceClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TopologyServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "TopologyServiceClient" to call the correct interceptors. +// "TopologyServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterTopologyServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TopologyServiceClient) error { mux.Handle("POST", pattern_TopologyService_AddLink_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/api/go/gosdn/topology/topology_grpc.pb.go b/api/go/gosdn/topology/topology_grpc.pb.go index a54ba62a24e91c82549c23453a567410e75ada9f..a68a885b60bd8834820e9c5ebc6a6014904944b3 100644 --- a/api/go/gosdn/topology/topology_grpc.pb.go +++ b/api/go/gosdn/topology/topology_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: gosdn/topology/topology.proto @@ -15,8 +15,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 ( TopologyService_AddLink_FullMethodName = "/gosdn.topology.TopologyService/AddLink" @@ -85,7 +85,7 @@ func (c *topologyServiceClient) DeleteLink(ctx context.Context, in *DeleteLinkRe // TopologyServiceServer is the server API for TopologyService service. // All implementations must embed UnimplementedTopologyServiceServer -// for forward compatibility +// for forward compatibility. type TopologyServiceServer interface { AddLink(context.Context, *AddLinkRequest) (*AddLinkResponse, error) GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error) @@ -94,9 +94,12 @@ type TopologyServiceServer interface { mustEmbedUnimplementedTopologyServiceServer() } -// UnimplementedTopologyServiceServer must be embedded to have forward compatible implementations. -type UnimplementedTopologyServiceServer struct { -} +// UnimplementedTopologyServiceServer 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 UnimplementedTopologyServiceServer struct{} func (UnimplementedTopologyServiceServer) AddLink(context.Context, *AddLinkRequest) (*AddLinkResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AddLink not implemented") @@ -111,6 +114,7 @@ func (UnimplementedTopologyServiceServer) DeleteLink(context.Context, *DeleteLin return nil, status.Errorf(codes.Unimplemented, "method DeleteLink not implemented") } func (UnimplementedTopologyServiceServer) mustEmbedUnimplementedTopologyServiceServer() {} +func (UnimplementedTopologyServiceServer) testEmbeddedByValue() {} // UnsafeTopologyServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TopologyServiceServer will @@ -120,6 +124,13 @@ type UnsafeTopologyServiceServer interface { } func RegisterTopologyServiceServer(s grpc.ServiceRegistrar, srv TopologyServiceServer) { + // If the following call pancis, it indicates UnimplementedTopologyServiceServer 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(&TopologyService_ServiceDesc, srv) } diff --git a/api/openapiv2/gosdn_northbound.swagger.json b/api/openapiv2/gosdn_northbound.swagger.json index c380e2fd1f7bacae2c43b0243a6beb079e3ec6be..7e1d7500d998d0f22e86baa4160aee9916f332f3 100644 --- a/api/openapiv2/gosdn_northbound.swagger.json +++ b/api/openapiv2/gosdn_northbound.swagger.json @@ -59,6 +59,9 @@ { "name": "UserService" }, + { + "name": "SubscriptionManagementService" + }, { "name": "TopologyService" }, @@ -1213,6 +1216,178 @@ ] } }, + "/submanagement/reset": { + "get": { + "operationId": "SubscriptionManagementService_ResetAllSubscriptions", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/subscriptionmanagementResetAllSubscriptionsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "timestamp", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "SubscriptionManagementService" + ] + } + }, + "/submanagement/subscriptions": { + "get": { + "operationId": "SubscriptionManagementService_GetAll", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/gosdnsubscriptionmanagementGetAllResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "timestamp", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "SubscriptionManagementService" + ] + } + }, + "/submanagement/{mneid}": { + "post": { + "operationId": "SubscriptionManagementService_Add", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/subscriptionmanagementAddResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "mneid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/subscriptionmanagementSubscriptionManagementServiceAddBody" + } + } + ], + "tags": [ + "SubscriptionManagementService" + ] + } + }, + "/submanagement/{subid}": { + "get": { + "operationId": "SubscriptionManagementService_Get", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/gosdnsubscriptionmanagementGetResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "subid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "timestamp", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "SubscriptionManagementService" + ] + }, + "delete": { + "operationId": "SubscriptionManagementService_Delete", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/gosdnsubscriptionmanagementDeleteResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "subid", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "timestamp", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "SubscriptionManagementService" + ] + } + }, "/topology": { "get": { "operationId": "TopologyService_GetTopology", @@ -2849,6 +3024,27 @@ } } }, + "gosdnnetworkelementGetAllResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64", + "description": "Timestamp in nanoseconds since Epoch." + }, + "pnd": { + "$ref": "#/definitions/pndPrincipalNetworkDomain", + "description": "TODO: Check if this is really needed. Perhaps a reference to the PND's ID\nis also sufficient." + }, + "mne": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/networkelementManagedNetworkElement" + } + } + } + }, "gosdnnetworkelementGetResponse": { "type": "object", "properties": { @@ -3007,6 +3203,81 @@ "default": "TYPE_UNSPECIFIED", "title": "Changed according to style guide:\nhttps://docs.buf.build/best-practices/style-guide#enums" }, + "gosdnsubscriptionmanagementDeleteResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + } + } + }, + "gosdnsubscriptionmanagementGetAllResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "subscriptions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/gosdnsubscriptionmanagementSubscription" + } + } + } + }, + "gosdnsubscriptionmanagementGetResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "subscriptions": { + "$ref": "#/definitions/gosdnsubscriptionmanagementSubscription" + } + } + }, + "gosdnsubscriptionmanagementPath": { + "type": "object", + "properties": { + "elem": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "gosdnsubscriptionmanagementSubscription": { + "type": "object", + "properties": { + "subid": { + "type": "string" + }, + "pid": { + "type": "string" + }, + "mneid": { + "type": "string" + }, + "mneName": { + "type": "string" + }, + "paths": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/gosdnsubscriptionmanagementPath" + } + }, + "subscribeOptions": { + "$ref": "#/definitions/subscriptionmanagementSubscribeOptions" + } + } + }, "gosdntopologyConfiguration": { "type": "object", "properties": { @@ -3150,27 +3421,6 @@ } } }, - "networkelementGetAllResponse": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "int64", - "description": "Timestamp in nanoseconds since Epoch." - }, - "pnd": { - "$ref": "#/definitions/pndPrincipalNetworkDomain", - "description": "TODO: Check if this is really needed. Perhaps a reference to the PND's ID\nis also sufficient." - }, - "mne": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/networkelementManagedNetworkElement" - } - } - } - }, "networkelementGetChangeListResponse": { "type": "object", "properties": { @@ -3988,6 +4238,51 @@ } } }, + "subscriptionmanagementAddResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + } + } + }, + "subscriptionmanagementResetAllSubscriptionsResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + } + } + }, + "subscriptionmanagementSubscribeOptions": { + "type": "object", + "properties": { + "gnmiMode": { + "type": "string" + }, + "gnmiStreamMode": { + "type": "string" + }, + "sampleInterval": { + "type": "string", + "format": "uint64" + } + } + }, + "subscriptionmanagementSubscriptionManagementServiceAddBody": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "subscription": { + "$ref": "#/definitions/gosdnsubscriptionmanagementSubscription" + } + } + }, "topologyAddLinkRequest": { "type": "object", "properties": { diff --git a/api/proto/gosdn/subscriptionmanagement/subscriptionmanagement.proto b/api/proto/gosdn/subscriptionmanagement/subscriptionmanagement.proto new file mode 100644 index 0000000000000000000000000000000000000000..ec542892ea84ac8cbbbb35199d7584397b5fdc39 --- /dev/null +++ b/api/proto/gosdn/subscriptionmanagement/subscriptionmanagement.proto @@ -0,0 +1,99 @@ +syntax = "proto3"; + +package gosdn.subscriptionmanagement; + +import "buf/validate/validate.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/submanagement"; + +service SubscriptionManagementService { + rpc GetAll(GetAllRequest) returns (GetAllResponse) { + option (google.api.http) = {get: "/submanagement/subscriptions"}; + } + + rpc Get(GetRequest) returns (GetResponse) { + option (google.api.http) = {get: "/submanagement/{subid}"}; + } + + rpc Delete(DeleteRequest) returns (DeleteResponse) { + option (google.api.http) = {delete: "/submanagement/{subid}"}; + } + + rpc Add(AddRequest) returns (AddResponse) { + option (google.api.http) = { + post: "/submanagement/{mneid}" + body: "*" + }; + } + + rpc ResetAllSubscriptions(ResetAllSubscriptionsRequest) returns (ResetAllSubscriptionsResponse) { + option (google.api.http) = {get: "/submanagement/reset"}; + } +} + +message Subscription{ + string subid = 1; + string pid = 2; + string mneid = 3; + string mne_name = 4; + repeated Path paths = 5; + SubscribeOptions subscribe_options = 6; +} + +message Path{ + repeated string elem = 1; +} + +message SubscribeOptions { + string gnmi_mode = 1; + string gnmi_stream_mode = 2; + uint64 sample_interval = 3; +} + +message GetAllRequest{ + int64 timestamp = 1; +} + +message GetAllResponse{ + int64 timestamp = 1; + repeated Subscription subscriptions = 2; +} + +message GetRequest { + int64 timestamp = 1; + string subid = 2 [(buf.validate.field).required = true]; +} + +message GetResponse { + int64 timestamp = 1; + Subscription subscriptions = 2; +} + +message DeleteRequest{ + int64 timestamp = 1; + string subid = 2 [(buf.validate.field).required = true]; +} + +message DeleteResponse{ + int64 timestamp = 1; +} + +message AddRequest{ + int64 timestamp = 1; + string mneid = 2 [(buf.validate.field).required = true]; + Subscription subscription = 3 [(buf.validate.field).required = true]; +} + +message AddResponse{ + int64 timestamp = 1; +} + +message ResetAllSubscriptionsRequest { + int64 timestamp = 1; +} + +message ResetAllSubscriptionsResponse { + int64 timestamp = 1; +} diff --git a/cli/cmd/subManagement.go b/cli/cmd/subManagement.go new file mode 100644 index 0000000000000000000000000000000000000000..ffade6c3a0904d1b8d408a7840788bc9cd4705a2 --- /dev/null +++ b/cli/cmd/subManagement.go @@ -0,0 +1,48 @@ +/* +Copyright © 2021 da/net Research Group <danet@h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +package cmd + +import ( + "github.com/spf13/cobra" +) + +// subCmd represents the subscription management command. +var subCmd = &cobra.Command{ + Use: "subscription", + Aliases: []string{"sub"}, + Short: "The subscription command contains all sub-commands for subscription management.", + Long: `The subscription command contains all sub-commands for subscription management. It has no functionality in itself.`, +} + +func init() { + rootCmd.AddCommand(subCmd) +} diff --git a/cli/cmd/subManagementGetAll.go b/cli/cmd/subManagementGetAll.go new file mode 100644 index 0000000000000000000000000000000000000000..cf844c00d9a95e85fa992a16e32690c0ebd2887f --- /dev/null +++ b/cli/cmd/subManagementGetAll.go @@ -0,0 +1,67 @@ +/* +Copyright © 2021 da/net Research Group <danet@h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +package cmd + +import ( + "code.fbi.h-da.de/danet/gosdn/controller/api" + "github.com/pterm/pterm" + "github.com/sirupsen/logrus" + + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +// subGetAllCmd represents the get all subscriptions command. +var subGetAllCmd = &cobra.Command{ + Use: "getAll", + Short: "Fetches all current gNMI subscriptions.", + Long: "Fetches all current gNMI subscriptions.", + Run: func(cmd *cobra.Command, args []string) { + spinner, _ := pterm.DefaultSpinner.Start("Fetching subscriptions") + + resp, err := api.GetAll(createContextWithAuthorization(), viper.GetString("controllerAPIEndpoint")) + if err != nil { + pterm.Error.Println(err) + return + } + + for _, sub := range resp.Subscriptions { + logrus.Println(sub) + } + + spinner.Success() + }, +} + +func init() { + subCmd.AddCommand(subGetAllCmd) +} diff --git a/cli/cmd/subManagementResetAll.go b/cli/cmd/subManagementResetAll.go new file mode 100644 index 0000000000000000000000000000000000000000..d29faf964f7fc0a721e55611fca577fd39e0ca04 --- /dev/null +++ b/cli/cmd/subManagementResetAll.go @@ -0,0 +1,62 @@ +/* +Copyright © 2021 da/net Research Group <danet@h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +package cmd + +import ( + "code.fbi.h-da.de/danet/gosdn/controller/api" + "github.com/pterm/pterm" + + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +// subResetAllCmd represents the reset all subscriptions command. +var subResetAllCmd = &cobra.Command{ + Use: "reset", + Short: "Reset all current gNMI subscriptions.", + Long: "Reset all current gNMI subscriptions.", + Run: func(cmd *cobra.Command, args []string) { + spinner, _ := pterm.DefaultSpinner.Start("Reseting subscriptions") + + _, err := api.ResetAllSubscriptions(createContextWithAuthorization(), viper.GetString("controllerAPIEndpoint")) + if err != nil { + pterm.Error.Println(err) + return + } + + spinner.Success() + }, +} + +func init() { + subCmd.AddCommand(subResetAllCmd) +} diff --git a/controller/api/subManagement.go b/controller/api/subManagement.go new file mode 100644 index 0000000000000000000000000000000000000000..f439d2413420593e662b10cb191bf647965e7721 --- /dev/null +++ b/controller/api/subManagement.go @@ -0,0 +1,37 @@ +package api + +import ( + "context" + "time" + + subpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/subscriptionmanagement" + nbi "code.fbi.h-da.de/danet/gosdn/controller/northbound/client" +) + +// ResetAllSubscriptions stops all running subscriptions and restarts them the same way they ran before. +func ResetAllSubscriptions(ctx context.Context, addr string) (*subpb.ResetAllSubscriptionsResponse, error) { + subClient, err := nbi.SubManagementClient(addr, dialOptions...) + if err != nil { + return nil, err + } + + req := &subpb.ResetAllSubscriptionsRequest{ + Timestamp: time.Now().UnixNano(), + } + + return subClient.ResetAllSubscriptions(ctx, req) +} + +// GetAll returns information about all running subscriptions. +func GetAll(ctx context.Context, addr string) (*subpb.GetAllResponse, error) { + subClient, err := nbi.SubManagementClient(addr, dialOptions...) + if err != nil { + return nil, err + } + + req := &subpb.GetAllRequest{ + Timestamp: time.Now().UnixNano(), + } + + return subClient.GetAll(ctx, req) +} diff --git a/controller/controller.go b/controller/controller.go index 65d692517d2a1d5005919b63e9ead1b431b2e9e2..b46d77770e7e3a94b4684e826aebebd2e300d60f 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -29,6 +29,7 @@ import ( rpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/plugin-registry" ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" apb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/rbac" + subpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/subscriptionmanagement" tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology" "code.fbi.h-da.de/danet/gosdn/controller/app" @@ -259,6 +260,7 @@ func startGrpc() error { tpb.RegisterRoutingTableServiceServer(c.grpcServer, c.nbi.Routes) pipb.RegisterPluginInternalServiceServer(c.grpcServer, c.nbi.Plugin) cmpb.RegisterConfigurationManagementServiceServer(c.grpcServer, c.nbi.ConfigurationManagement) + subpb.RegisterSubscriptionManagementServiceServer(c.grpcServer, c.nbi.SubManagement) go func() { if err := c.grpcServer.Serve(lislisten); err != nil { @@ -357,6 +359,8 @@ func ensureAdminRoleExists() error { "/gosdn.topology.TopologyService/GetTopology", "/gosdn.topology.TopologyService/UpdateLink", "/gosdn.topology.TopologyService/DeleteLink", + "/gosdn.subscriptionmanagement.SubscriptionManagementService/ResetAllSubscriptions", + "/gosdn.subscriptionmanagement.SubscriptionManagementService/GetAll", })) if err != nil { return err diff --git a/controller/northbound/client/submanagement.go b/controller/northbound/client/submanagement.go new file mode 100644 index 0000000000000000000000000000000000000000..c8774a2e036175a807a688560209c99ac330ec64 --- /dev/null +++ b/controller/northbound/client/submanagement.go @@ -0,0 +1,17 @@ +package client + +import ( + subpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/subscriptionmanagement" + "google.golang.org/grpc" +) + +// SubManagementClient returns a client for the gRPC SubscriptionManagement service. It takes +// the address of the gRPC endpoint and optional grpc.DialOption +// as argument. +func SubManagementClient(addr string, opts ...grpc.DialOption) (subpb.SubscriptionManagementServiceClient, error) { + conn, err := grpc.NewClient(addr, opts...) + if err != nil { + return nil, err + } + return subpb.NewSubscriptionManagementServiceClient(conn), nil +} diff --git a/controller/northbound/server/nbi.go b/controller/northbound/server/nbi.go index fdd067beabb047c4b6dca9dcc084a1a84a7ced44..5657e3e5ad43a7137827dfeb5f2f1f734045394b 100644 --- a/controller/northbound/server/nbi.go +++ b/controller/northbound/server/nbi.go @@ -39,6 +39,7 @@ type NorthboundInterface struct { NetworkElement *NetworkElementServer Routes *RoutingTableServiceServer ConfigurationManagement *ConfigurationManagementServer + SubManagement *SubManagementServer } // NewNBI receives a PndStore and returns a new gRPC *NorthboundInterface. @@ -78,6 +79,7 @@ func NewNBI( NetworkElement: NewNetworkElementServer(mneService, pndService, pluginService, changeStore, protoValidator, networkElementWatchter), Routes: NewRoutingTableServiceServer(routeService, nodeService, portService, protoValidator), ConfigurationManagement: NewConfigurationManagementServer(pndService, mneService, topologyService, nodeService, portService, pluginService, protoValidator), + SubManagement: NewSubManagementServer(networkElementWatchter), } } diff --git a/controller/northbound/server/submanagement.go b/controller/northbound/server/submanagement.go new file mode 100644 index 0000000000000000000000000000000000000000..eb75420e7a482e753895e46d11ae687d7f10adee --- /dev/null +++ b/controller/northbound/server/submanagement.go @@ -0,0 +1,69 @@ +package server + +import ( + "context" + "time" + + subpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/subscriptionmanagement" + "code.fbi.h-da.de/danet/gosdn/controller/nucleus" +) + +// SubManagementServer represents a SubsriptionManagementServer. +type SubManagementServer struct { + subpb.UnimplementedSubscriptionManagementServiceServer + networkElementWatchter *nucleus.NetworkElementWatcher +} + +// NewSubManagementServer returns a new SubManagementServer. +func NewSubManagementServer(networkElementWatchter *nucleus.NetworkElementWatcher) *SubManagementServer { + return &SubManagementServer{ + networkElementWatchter: networkElementWatchter, + } +} + +// ResetAllSubscriptions stops all running subscriptions and restarts them the same way they ran before. +func (s *SubManagementServer) ResetAllSubscriptions(ctx context.Context, request *subpb.ResetAllSubscriptionsRequest) (*subpb.ResetAllSubscriptionsResponse, error) { + subscriptions := s.networkElementWatchter.GetAllSubscriptionInformations() + + s.networkElementWatchter.StopAndRemoveAllNetworkElementSubscriptions() + + s.networkElementWatchter.SubscribeToNetworkElements(subscriptions) + + return &subpb.ResetAllSubscriptionsResponse{ + Timestamp: time.Now().UnixNano(), + }, nil +} + +// GetAll returns information about all running subscriptions. +func (s *SubManagementServer) GetAll(ctx context.Context, request *subpb.GetAllRequest) (*subpb.GetAllResponse, error) { + subInfos := s.networkElementWatchter.GetAllSubscriptionInformations() + + subInfosToReturn := make([]*subpb.Subscription, 0) + + for _, info := range subInfos { + tmpPaths := make([]*subpb.Path, 0) + for _, path := range info.Opts.Paths { + tmpPaths = append(tmpPaths, &subpb.Path{ + Elem: path, + }) + } + + subInfosToReturn = append(subInfosToReturn, &subpb.Subscription{ + Subid: info.SubID, + Pid: info.PndID, + Mneid: info.MneID, + MneName: info.MneName, + Paths: tmpPaths, + SubscribeOptions: &subpb.SubscribeOptions{ + GnmiMode: info.Opts.Mode, + GnmiStreamMode: info.Opts.StreamMode, + SampleInterval: info.Opts.SampleInterval, + }, + }) + } + + return &subpb.GetAllResponse{ + Timestamp: time.Now().UnixNano(), + Subscriptions: subInfosToReturn, + }, nil +} diff --git a/controller/nucleus/networkElementWatcher.go b/controller/nucleus/networkElementWatcher.go index a39a7660e7f88b474bf6c374128dd6b6d4b26544..dd8713aa834ce8156ce423f98a7a9e40e328fb8e 100644 --- a/controller/nucleus/networkElementWatcher.go +++ b/controller/nucleus/networkElementWatcher.go @@ -2,8 +2,10 @@ package nucleus import ( "context" + "errors" "fmt" "strconv" + "sync" "code.fbi.h-da.de/danet/gosdn/controller/config" "code.fbi.h-da.de/danet/gosdn/controller/customerrs" @@ -32,15 +34,21 @@ const ( // NetworkElementWatcher is a component that subscribes to network elements via gNMI from within the controller and handles // responses by triggering the internal event process. type NetworkElementWatcher struct { - mneService networkelement.Service - networkelementSubcriptions map[uuid.UUID]*networkelementSubscriptionHelper - eventService eventInterfaces.Service + mneService networkelement.Service + networkelementSubscriptionsMutex sync.Mutex + networkelementSubcriptions map[uuid.UUID]*networkelementSubscriptionHelper + eventService eventInterfaces.Service } // networkelementSubscriptionHelper is used to store information to stop a running subscribe go routine. type networkelementSubscriptionHelper struct { + SubID string + MneID string + MneName string + PndID string stopSubscribeCtx context.Context stopFunc context.CancelFunc + Opts *gnmi.SubscribeOptions } // NewNetworkElementWatcher allows to subscribe to network element paths. @@ -54,9 +62,10 @@ func NewNetworkElementWatcher(mneService networkelement.Service, eventService ev // SubscribeToNetworkElements subscribes to every available network element in each network domain according to provided SubscribeOptions. // SubscribeOptions can be nil. Use nil for a fixed, pre-defined set of gNMI subscription options (streaming in sample mode each second). -func (n *NetworkElementWatcher) SubscribeToNetworkElements(opts *gnmi.SubscribeOptions) { - if opts == nil { - opts = &gnmi.SubscribeOptions{ +func (n *NetworkElementWatcher) SubscribeToNetworkElements(subScriptionInfos []*networkelementSubscriptionHelper) { + var tmpOpts *gnmi.SubscribeOptions + if len(subScriptionInfos) == 0 { + tmpOpts = &gnmi.SubscribeOptions{ Mode: gNMISubscribeMode, StreamMode: gNMIStreamMode, SampleInterval: subscribeSampleInterval, @@ -70,7 +79,15 @@ func (n *NetworkElementWatcher) SubscribeToNetworkElements(opts *gnmi.SubscribeO } for _, mne := range mnes { - n.subscribeToNetworkElement(mne, opts) + if len(subScriptionInfos) > 0 { + tmpOpts, err = getOptionsForMne(mne.ID().String(), subScriptionInfos) + if err != nil { + log.Infof("Couldn't find options for mne %s, reason: %v. \n Skipping subscription.", mne.Name(), err) + continue + } + } + + n.subscribeToNetworkElement(mne, tmpOpts) } } @@ -90,14 +107,19 @@ func (n *NetworkElementWatcher) SubscribeToNetworkElement(mne networkelement.Net func (n *NetworkElementWatcher) subscribeToNetworkElement(mne networkelement.NetworkElement, opts *gnmi.SubscribeOptions) { subID := uuid.New() + opts.Paths = n.mergeGnmiSubscriptions(mne.GetGnmiSubscriptionPaths(), config.GetGnmiSubscriptionPaths()) + stopContext, cancel := context.WithCancel(context.Background()) n.addToNetworkElementSubscriptions(subID, &networkelementSubscriptionHelper{ stopSubscribeCtx: stopContext, stopFunc: cancel, + SubID: subID.String(), + MneID: mne.ID().String(), + MneName: mne.Name(), + PndID: mne.PndID().String(), + Opts: opts, }) - opts.Paths = n.mergeGnmiSubscriptions(mne.GetGnmiSubscriptionPaths(), config.GetGnmiSubscriptionPaths()) - go n.callSubscribe(stopContext, mne, opts) } @@ -130,7 +152,9 @@ func (n *NetworkElementWatcher) callSubscribe(stopContext context.Context, mne n } func (n *NetworkElementWatcher) addToNetworkElementSubscriptions(subID uuid.UUID, devSub *networkelementSubscriptionHelper) { - //TODO: improve handling of subscriptions, like be able to expose to apps so specific subscriptions instead of only all can be stopped in the future + n.networkelementSubscriptionsMutex.Lock() + defer n.networkelementSubscriptionsMutex.Unlock() + n.networkelementSubcriptions[subID] = devSub } @@ -144,6 +168,9 @@ func (n *NetworkElementWatcher) StopAndRemoveAllNetworkElementSubscriptions() { // StopAndRemoveNetworkElementSubscription passes a subscription uuid to stop the running subscription go routing and removes the entry from the map // of network element subscriptions. func (n *NetworkElementWatcher) StopAndRemoveNetworkElementSubscription(subID uuid.UUID) { + n.networkelementSubscriptionsMutex.Lock() + defer n.networkelementSubscriptionsMutex.Unlock() + n.networkelementSubcriptions[subID].stopFunc() delete(n.networkelementSubcriptions, subID) } @@ -230,3 +257,41 @@ func (n *NetworkElementWatcher) mergeGnmiSubscriptions(gNMISusbcriptionPathsFrom return joinedPaths } + +// GetAllSubscriptionInformations returns the information of all running sunscriptions. +func (n *NetworkElementWatcher) GetAllSubscriptionInformations() []*networkelementSubscriptionHelper { + var information []*networkelementSubscriptionHelper + n.networkelementSubscriptionsMutex.Lock() + defer n.networkelementSubscriptionsMutex.Unlock() + + for _, info := range n.networkelementSubcriptions { + information = append(information, info) + } + + return information +} + +// GetSubscriptionInformations returns the information for one specific subscription referenced by its ID. +func (n *NetworkElementWatcher) GetSubscriptionInformations(subID uuid.UUID) (*networkelementSubscriptionHelper, error) { + n.networkelementSubscriptionsMutex.Lock() + defer n.networkelementSubscriptionsMutex.Unlock() + + information, ok := n.networkelementSubcriptions[subID] + if !ok { + return nil, errors.New(fmt.Sprintf("Couldn't retrieve information for subscription with ID: %s", subID.String())) + } + + return information, nil +} + +// getOptionsForMne checks if there is a match of the mneID with all the mne IDs provided in the slice of subscription +// information and returns the related subscribe options or an error. +func getOptionsForMne(mneID string, subInfos []*networkelementSubscriptionHelper) (*gnmi.SubscribeOptions, error) { + for _, subInfo := range subInfos { + if subInfo.MneID == mneID { + return subInfo.Opts, nil + } + } + + return nil, fmt.Errorf("error: did not find subscription infos matching to provided mne ID: %s", mneID) +}