From 1d16819bab6aaf2699822605e2efde6f20909c18 Mon Sep 17 00:00:00 2001 From: marcushines <80116818+marcushines@users.noreply.github.com> Date: Wed, 1 May 2024 11:16:56 -0500 Subject: [PATCH] Readd grpc.pb.go based on compiler standardization in OC repos (#190) --- bgp/BUILD.bazel | 14 +- bgp/bgp.pb.go | 84 --- bgp/bgp.proto | 2 +- bgp/bgp_grpc.pb.go | 105 ++++ bootconfig/BUILD.bazel | 9 +- bootconfig/bootconfig.pb.go | 120 ----- bootconfig/bootconfig.proto | 4 +- bootconfig/bootconfig_grpc.pb.go | 141 +++++ cert/BUILD.bazel | 13 +- cert/cert.pb.go | 401 -------------- cert/cert.proto | 1 - cert/cert_grpc.pb.go | 422 +++++++++++++++ common.bzl | 29 + common/BUILD.bazel | 13 +- containerz/BUILD.bazel | 12 +- containerz/containerz.pb.go | 486 ----------------- containerz/containerz_grpc.pb.go | 507 ++++++++++++++++++ debug/BUILD.bazel | 12 +- debug/debug.pb.go | 111 ---- debug/debug_grpc.pb.go | 132 +++++ diag/BUILD.bazel | 14 +- diag/diag.pb.go | 156 ------ diag/diag_grpc.pb.go | 177 ++++++ factory_reset/BUILD.bazel | 13 +- factory_reset/factory_reset.pb.go | 84 --- factory_reset/factory_reset_grpc.pb.go | 105 ++++ file/BUILD.bazel | 13 +- file/file.pb.go | 290 ---------- file/file_grpc.pb.go | 311 +++++++++++ healthz/BUILD.bazel | 10 +- healthz/healthz.pb.go | 256 --------- healthz/healthz_grpc.pb.go | 277 ++++++++++ layer2/BUILD.bazel | 13 +- layer2/layer2.pb.go | 256 --------- layer2/layer2_grpc.pb.go | 277 ++++++++++ mpls/BUILD.bazel | 13 +- mpls/mpls.pb.go | 184 ------- mpls/mpls.proto | 1 - mpls/mpls_grpc.pb.go | 205 +++++++ os/BUILD.bazel | 14 +- os/os.pb.go | 189 ------- os/os.proto | 16 +- os/os_grpc.pb.go | 210 ++++++++ otdr/BUILD.bazel | 14 +- otdr/otdr.pb.go | 111 ---- otdr/otdr.proto | 1 - otdr/otdr_grpc.pb.go | 132 +++++ packet_capture/BUILD.bazel | 27 +- packet_capture/packet_capture.pb.go | 7 +- packet_capture/packet_capture.proto | 14 + packet_link_qualification/BUILD.bazel | 28 +- .../packet_link_qualification.pb.go | 8 +- system/BUILD.bazel | 14 +- system/system.pb.go | 461 ---------------- system/system_grpc.pb.go | 482 +++++++++++++++++ types/BUILD.bazel | 13 +- wavelength_router/BUILD.bazel | 14 +- wavelength_router/wavelength_router.pb.go | 253 --------- .../wavelength_router_grpc.pb.go | 274 ++++++++++ 59 files changed, 4012 insertions(+), 3543 deletions(-) create mode 100755 bgp/bgp_grpc.pb.go create mode 100755 bootconfig/bootconfig_grpc.pb.go create mode 100755 cert/cert_grpc.pb.go create mode 100644 common.bzl create mode 100755 containerz/containerz_grpc.pb.go create mode 100755 debug/debug_grpc.pb.go create mode 100755 diag/diag_grpc.pb.go create mode 100755 factory_reset/factory_reset_grpc.pb.go create mode 100755 file/file_grpc.pb.go create mode 100755 healthz/healthz_grpc.pb.go create mode 100755 layer2/layer2_grpc.pb.go create mode 100755 mpls/mpls_grpc.pb.go create mode 100755 os/os_grpc.pb.go create mode 100755 otdr/otdr_grpc.pb.go create mode 100755 system/system_grpc.pb.go create mode 100755 wavelength_router/wavelength_router_grpc.pb.go diff --git a/bgp/BUILD.bazel b/bgp/BUILD.bazel index 18456c66..4d746acb 100644 --- a/bgp/BUILD.bazel +++ b/bgp/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "bgp_proto", srcs = ["bgp.proto"], @@ -48,7 +47,10 @@ cc_grpc_library( go_proto_library( name = "bgp_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/bgp", proto = ":bgp_proto", deps = ["//types"], diff --git a/bgp/bgp.pb.go b/bgp/bgp.pb.go index 48a17f21..11f6683b 100644 --- a/bgp/bgp.pb.go +++ b/bgp/bgp.pb.go @@ -7,11 +7,7 @@ package bgp import ( - context "context" _ "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -289,83 +285,3 @@ func file_bgp_bgp_proto_init() { file_bgp_bgp_proto_goTypes = nil file_bgp_bgp_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// BGPClient is the client API for BGP service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type BGPClient interface { - ClearBGPNeighbor(ctx context.Context, in *ClearBGPNeighborRequest, opts ...grpc.CallOption) (*ClearBGPNeighborResponse, error) -} - -type bGPClient struct { - cc grpc.ClientConnInterface -} - -func NewBGPClient(cc grpc.ClientConnInterface) BGPClient { - return &bGPClient{cc} -} - -func (c *bGPClient) ClearBGPNeighbor(ctx context.Context, in *ClearBGPNeighborRequest, opts ...grpc.CallOption) (*ClearBGPNeighborResponse, error) { - out := new(ClearBGPNeighborResponse) - err := c.cc.Invoke(ctx, "/gnoi.bgp.BGP/ClearBGPNeighbor", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// BGPServer is the server API for BGP service. -type BGPServer interface { - ClearBGPNeighbor(context.Context, *ClearBGPNeighborRequest) (*ClearBGPNeighborResponse, error) -} - -// UnimplementedBGPServer can be embedded to have forward compatible implementations. -type UnimplementedBGPServer struct { -} - -func (*UnimplementedBGPServer) ClearBGPNeighbor(context.Context, *ClearBGPNeighborRequest) (*ClearBGPNeighborResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearBGPNeighbor not implemented") -} - -func RegisterBGPServer(s *grpc.Server, srv BGPServer) { - s.RegisterService(&_BGP_serviceDesc, srv) -} - -func _BGP_ClearBGPNeighbor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearBGPNeighborRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BGPServer).ClearBGPNeighbor(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.bgp.BGP/ClearBGPNeighbor", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BGPServer).ClearBGPNeighbor(ctx, req.(*ClearBGPNeighborRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _BGP_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.bgp.BGP", - HandlerType: (*BGPServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ClearBGPNeighbor", - Handler: _BGP_ClearBGPNeighbor_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "bgp/bgp.proto", -} diff --git a/bgp/bgp.proto b/bgp/bgp.proto index bdef9286..1a197024 100644 --- a/bgp/bgp.proto +++ b/bgp/bgp.proto @@ -12,7 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// + syntax = "proto3"; package gnoi.bgp; diff --git a/bgp/bgp_grpc.pb.go b/bgp/bgp_grpc.pb.go new file mode 100755 index 00000000..f66278c3 --- /dev/null +++ b/bgp/bgp_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: bgp/bgp.proto + +package bgp + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// BGPClient is the client API for BGP 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 BGPClient interface { + ClearBGPNeighbor(ctx context.Context, in *ClearBGPNeighborRequest, opts ...grpc.CallOption) (*ClearBGPNeighborResponse, error) +} + +type bGPClient struct { + cc grpc.ClientConnInterface +} + +func NewBGPClient(cc grpc.ClientConnInterface) BGPClient { + return &bGPClient{cc} +} + +func (c *bGPClient) ClearBGPNeighbor(ctx context.Context, in *ClearBGPNeighborRequest, opts ...grpc.CallOption) (*ClearBGPNeighborResponse, error) { + out := new(ClearBGPNeighborResponse) + err := c.cc.Invoke(ctx, "/gnoi.bgp.BGP/ClearBGPNeighbor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BGPServer is the server API for BGP service. +// All implementations must embed UnimplementedBGPServer +// for forward compatibility +type BGPServer interface { + ClearBGPNeighbor(context.Context, *ClearBGPNeighborRequest) (*ClearBGPNeighborResponse, error) + mustEmbedUnimplementedBGPServer() +} + +// UnimplementedBGPServer must be embedded to have forward compatible implementations. +type UnimplementedBGPServer struct { +} + +func (UnimplementedBGPServer) ClearBGPNeighbor(context.Context, *ClearBGPNeighborRequest) (*ClearBGPNeighborResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearBGPNeighbor not implemented") +} +func (UnimplementedBGPServer) mustEmbedUnimplementedBGPServer() {} + +// UnsafeBGPServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to BGPServer will +// result in compilation errors. +type UnsafeBGPServer interface { + mustEmbedUnimplementedBGPServer() +} + +func RegisterBGPServer(s grpc.ServiceRegistrar, srv BGPServer) { + s.RegisterService(&BGP_ServiceDesc, srv) +} + +func _BGP_ClearBGPNeighbor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearBGPNeighborRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BGPServer).ClearBGPNeighbor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.bgp.BGP/ClearBGPNeighbor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BGPServer).ClearBGPNeighbor(ctx, req.(*ClearBGPNeighborRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// BGP_ServiceDesc is the grpc.ServiceDesc for BGP service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var BGP_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.bgp.BGP", + HandlerType: (*BGPServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ClearBGPNeighbor", + Handler: _BGP_ClearBGPNeighbor_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bgp/bgp.proto", +} diff --git a/bootconfig/BUILD.bazel b/bootconfig/BUILD.bazel index 95bc2e68..76f2105f 100644 --- a/bootconfig/BUILD.bazel +++ b/bootconfig/BUILD.bazel @@ -1,8 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") - load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -23,6 +23,8 @@ package( licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "bootconfig_proto", srcs = ["bootconfig.proto"], @@ -50,7 +52,10 @@ cc_grpc_library( go_proto_library( name = "bootconfig_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/bootconfig", proto = ":bootconfig_proto", deps = [ diff --git a/bootconfig/bootconfig.pb.go b/bootconfig/bootconfig.pb.go index 2d42849f..c19be137 100644 --- a/bootconfig/bootconfig.pb.go +++ b/bootconfig/bootconfig.pb.go @@ -7,15 +7,11 @@ package bootconfig import ( - context "context" bootz "github.com/openconfig/bootz/proto/bootz" _ "github.com/openconfig/gnoi/types" authz "github.com/openconfig/gnsi/authz" certz "github.com/openconfig/gnsi/certz" pathz "github.com/openconfig/gnsi/pathz" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -413,119 +409,3 @@ func file_bootconfig_bootconfig_proto_init() { file_bootconfig_bootconfig_proto_goTypes = nil file_bootconfig_bootconfig_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// BootConfigClient is the client API for BootConfig service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type BootConfigClient interface { - GetBootConfig(ctx context.Context, in *GetBootConfigRequest, opts ...grpc.CallOption) (*GetBootConfigResponse, error) - SetBootConfig(ctx context.Context, in *SetBootConfigRequest, opts ...grpc.CallOption) (*SetBootConfigResponse, error) -} - -type bootConfigClient struct { - cc grpc.ClientConnInterface -} - -func NewBootConfigClient(cc grpc.ClientConnInterface) BootConfigClient { - return &bootConfigClient{cc} -} - -func (c *bootConfigClient) GetBootConfig(ctx context.Context, in *GetBootConfigRequest, opts ...grpc.CallOption) (*GetBootConfigResponse, error) { - out := new(GetBootConfigResponse) - err := c.cc.Invoke(ctx, "/gnoi.bootconfig.BootConfig/GetBootConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *bootConfigClient) SetBootConfig(ctx context.Context, in *SetBootConfigRequest, opts ...grpc.CallOption) (*SetBootConfigResponse, error) { - out := new(SetBootConfigResponse) - err := c.cc.Invoke(ctx, "/gnoi.bootconfig.BootConfig/SetBootConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// BootConfigServer is the server API for BootConfig service. -type BootConfigServer interface { - GetBootConfig(context.Context, *GetBootConfigRequest) (*GetBootConfigResponse, error) - SetBootConfig(context.Context, *SetBootConfigRequest) (*SetBootConfigResponse, error) -} - -// UnimplementedBootConfigServer can be embedded to have forward compatible implementations. -type UnimplementedBootConfigServer struct { -} - -func (*UnimplementedBootConfigServer) GetBootConfig(context.Context, *GetBootConfigRequest) (*GetBootConfigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBootConfig not implemented") -} -func (*UnimplementedBootConfigServer) SetBootConfig(context.Context, *SetBootConfigRequest) (*SetBootConfigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetBootConfig not implemented") -} - -func RegisterBootConfigServer(s *grpc.Server, srv BootConfigServer) { - s.RegisterService(&_BootConfig_serviceDesc, srv) -} - -func _BootConfig_GetBootConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBootConfigRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BootConfigServer).GetBootConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.bootconfig.BootConfig/GetBootConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BootConfigServer).GetBootConfig(ctx, req.(*GetBootConfigRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _BootConfig_SetBootConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetBootConfigRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BootConfigServer).SetBootConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.bootconfig.BootConfig/SetBootConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BootConfigServer).SetBootConfig(ctx, req.(*SetBootConfigRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _BootConfig_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.bootconfig.BootConfig", - HandlerType: (*BootConfigServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetBootConfig", - Handler: _BootConfig_GetBootConfig_Handler, - }, - { - MethodName: "SetBootConfig", - Handler: _BootConfig_SetBootConfig_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "bootconfig/bootconfig.proto", -} diff --git a/bootconfig/bootconfig.proto b/bootconfig/bootconfig.proto index 94b9a809..0e8848fc 100644 --- a/bootconfig/bootconfig.proto +++ b/bootconfig/bootconfig.proto @@ -1,5 +1,5 @@ // -// Copyright 2017 Google Inc. All Rights Reserved. +// Copyright 2024 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// + syntax = "proto3"; package gnoi.bootconfig; diff --git a/bootconfig/bootconfig_grpc.pb.go b/bootconfig/bootconfig_grpc.pb.go new file mode 100755 index 00000000..6649cca8 --- /dev/null +++ b/bootconfig/bootconfig_grpc.pb.go @@ -0,0 +1,141 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: bootconfig/bootconfig.proto + +package bootconfig + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// BootConfigClient is the client API for BootConfig 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 BootConfigClient interface { + GetBootConfig(ctx context.Context, in *GetBootConfigRequest, opts ...grpc.CallOption) (*GetBootConfigResponse, error) + SetBootConfig(ctx context.Context, in *SetBootConfigRequest, opts ...grpc.CallOption) (*SetBootConfigResponse, error) +} + +type bootConfigClient struct { + cc grpc.ClientConnInterface +} + +func NewBootConfigClient(cc grpc.ClientConnInterface) BootConfigClient { + return &bootConfigClient{cc} +} + +func (c *bootConfigClient) GetBootConfig(ctx context.Context, in *GetBootConfigRequest, opts ...grpc.CallOption) (*GetBootConfigResponse, error) { + out := new(GetBootConfigResponse) + err := c.cc.Invoke(ctx, "/gnoi.bootconfig.BootConfig/GetBootConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *bootConfigClient) SetBootConfig(ctx context.Context, in *SetBootConfigRequest, opts ...grpc.CallOption) (*SetBootConfigResponse, error) { + out := new(SetBootConfigResponse) + err := c.cc.Invoke(ctx, "/gnoi.bootconfig.BootConfig/SetBootConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BootConfigServer is the server API for BootConfig service. +// All implementations must embed UnimplementedBootConfigServer +// for forward compatibility +type BootConfigServer interface { + GetBootConfig(context.Context, *GetBootConfigRequest) (*GetBootConfigResponse, error) + SetBootConfig(context.Context, *SetBootConfigRequest) (*SetBootConfigResponse, error) + mustEmbedUnimplementedBootConfigServer() +} + +// UnimplementedBootConfigServer must be embedded to have forward compatible implementations. +type UnimplementedBootConfigServer struct { +} + +func (UnimplementedBootConfigServer) GetBootConfig(context.Context, *GetBootConfigRequest) (*GetBootConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBootConfig not implemented") +} +func (UnimplementedBootConfigServer) SetBootConfig(context.Context, *SetBootConfigRequest) (*SetBootConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetBootConfig not implemented") +} +func (UnimplementedBootConfigServer) mustEmbedUnimplementedBootConfigServer() {} + +// UnsafeBootConfigServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to BootConfigServer will +// result in compilation errors. +type UnsafeBootConfigServer interface { + mustEmbedUnimplementedBootConfigServer() +} + +func RegisterBootConfigServer(s grpc.ServiceRegistrar, srv BootConfigServer) { + s.RegisterService(&BootConfig_ServiceDesc, srv) +} + +func _BootConfig_GetBootConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBootConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BootConfigServer).GetBootConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.bootconfig.BootConfig/GetBootConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BootConfigServer).GetBootConfig(ctx, req.(*GetBootConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BootConfig_SetBootConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetBootConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BootConfigServer).SetBootConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.bootconfig.BootConfig/SetBootConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BootConfigServer).SetBootConfig(ctx, req.(*SetBootConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// BootConfig_ServiceDesc is the grpc.ServiceDesc for BootConfig service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var BootConfig_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.bootconfig.BootConfig", + HandlerType: (*BootConfigServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetBootConfig", + Handler: _BootConfig_GetBootConfig_Handler, + }, + { + MethodName: "SetBootConfig", + Handler: _BootConfig_SetBootConfig_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "bootconfig/bootconfig.proto", +} diff --git a/cert/BUILD.bazel b/cert/BUILD.bazel index 30928193..5863db8d 100644 --- a/cert/BUILD.bazel +++ b/cert/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,16 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "cert_proto", srcs = ["cert.proto"], @@ -45,7 +45,10 @@ cc_grpc_library( go_proto_library( name = "cert_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/cert", proto = ":cert_proto", deps = ["//types"], diff --git a/cert/cert.pb.go b/cert/cert.pb.go index 9578e773..19ec7241 100644 --- a/cert/cert.pb.go +++ b/cert/cert.pb.go @@ -7,11 +7,7 @@ package cert import ( - context "context" _ "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -2319,400 +2315,3 @@ func file_cert_cert_proto_init() { file_cert_cert_proto_goTypes = nil file_cert_cert_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// CertificateManagementClient is the client API for CertificateManagement service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CertificateManagementClient interface { - Rotate(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_RotateClient, error) - Install(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_InstallClient, error) - GenerateCSR(ctx context.Context, in *GenerateCSRRequest, opts ...grpc.CallOption) (*GenerateCSRResponse, error) - LoadCertificate(ctx context.Context, in *LoadCertificateRequest, opts ...grpc.CallOption) (*LoadCertificateResponse, error) - LoadCertificateAuthorityBundle(ctx context.Context, in *LoadCertificateAuthorityBundleRequest, opts ...grpc.CallOption) (*LoadCertificateAuthorityBundleResponse, error) - GetCertificates(ctx context.Context, in *GetCertificatesRequest, opts ...grpc.CallOption) (*GetCertificatesResponse, error) - RevokeCertificates(ctx context.Context, in *RevokeCertificatesRequest, opts ...grpc.CallOption) (*RevokeCertificatesResponse, error) - CanGenerateCSR(ctx context.Context, in *CanGenerateCSRRequest, opts ...grpc.CallOption) (*CanGenerateCSRResponse, error) -} - -type certificateManagementClient struct { - cc grpc.ClientConnInterface -} - -func NewCertificateManagementClient(cc grpc.ClientConnInterface) CertificateManagementClient { - return &certificateManagementClient{cc} -} - -func (c *certificateManagementClient) Rotate(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_RotateClient, error) { - stream, err := c.cc.NewStream(ctx, &_CertificateManagement_serviceDesc.Streams[0], "/gnoi.certificate.CertificateManagement/Rotate", opts...) - if err != nil { - return nil, err - } - x := &certificateManagementRotateClient{stream} - return x, nil -} - -type CertificateManagement_RotateClient interface { - Send(*RotateCertificateRequest) error - Recv() (*RotateCertificateResponse, error) - grpc.ClientStream -} - -type certificateManagementRotateClient struct { - grpc.ClientStream -} - -func (x *certificateManagementRotateClient) Send(m *RotateCertificateRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *certificateManagementRotateClient) Recv() (*RotateCertificateResponse, error) { - m := new(RotateCertificateResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *certificateManagementClient) Install(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_InstallClient, error) { - stream, err := c.cc.NewStream(ctx, &_CertificateManagement_serviceDesc.Streams[1], "/gnoi.certificate.CertificateManagement/Install", opts...) - if err != nil { - return nil, err - } - x := &certificateManagementInstallClient{stream} - return x, nil -} - -type CertificateManagement_InstallClient interface { - Send(*InstallCertificateRequest) error - Recv() (*InstallCertificateResponse, error) - grpc.ClientStream -} - -type certificateManagementInstallClient struct { - grpc.ClientStream -} - -func (x *certificateManagementInstallClient) Send(m *InstallCertificateRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *certificateManagementInstallClient) Recv() (*InstallCertificateResponse, error) { - m := new(InstallCertificateResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *certificateManagementClient) GenerateCSR(ctx context.Context, in *GenerateCSRRequest, opts ...grpc.CallOption) (*GenerateCSRResponse, error) { - out := new(GenerateCSRResponse) - err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/GenerateCSR", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *certificateManagementClient) LoadCertificate(ctx context.Context, in *LoadCertificateRequest, opts ...grpc.CallOption) (*LoadCertificateResponse, error) { - out := new(LoadCertificateResponse) - err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/LoadCertificate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *certificateManagementClient) LoadCertificateAuthorityBundle(ctx context.Context, in *LoadCertificateAuthorityBundleRequest, opts ...grpc.CallOption) (*LoadCertificateAuthorityBundleResponse, error) { - out := new(LoadCertificateAuthorityBundleResponse) - err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/LoadCertificateAuthorityBundle", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *certificateManagementClient) GetCertificates(ctx context.Context, in *GetCertificatesRequest, opts ...grpc.CallOption) (*GetCertificatesResponse, error) { - out := new(GetCertificatesResponse) - err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/GetCertificates", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *certificateManagementClient) RevokeCertificates(ctx context.Context, in *RevokeCertificatesRequest, opts ...grpc.CallOption) (*RevokeCertificatesResponse, error) { - out := new(RevokeCertificatesResponse) - err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/RevokeCertificates", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *certificateManagementClient) CanGenerateCSR(ctx context.Context, in *CanGenerateCSRRequest, opts ...grpc.CallOption) (*CanGenerateCSRResponse, error) { - out := new(CanGenerateCSRResponse) - err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/CanGenerateCSR", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CertificateManagementServer is the server API for CertificateManagement service. -type CertificateManagementServer interface { - Rotate(CertificateManagement_RotateServer) error - Install(CertificateManagement_InstallServer) error - GenerateCSR(context.Context, *GenerateCSRRequest) (*GenerateCSRResponse, error) - LoadCertificate(context.Context, *LoadCertificateRequest) (*LoadCertificateResponse, error) - LoadCertificateAuthorityBundle(context.Context, *LoadCertificateAuthorityBundleRequest) (*LoadCertificateAuthorityBundleResponse, error) - GetCertificates(context.Context, *GetCertificatesRequest) (*GetCertificatesResponse, error) - RevokeCertificates(context.Context, *RevokeCertificatesRequest) (*RevokeCertificatesResponse, error) - CanGenerateCSR(context.Context, *CanGenerateCSRRequest) (*CanGenerateCSRResponse, error) -} - -// UnimplementedCertificateManagementServer can be embedded to have forward compatible implementations. -type UnimplementedCertificateManagementServer struct { -} - -func (*UnimplementedCertificateManagementServer) Rotate(CertificateManagement_RotateServer) error { - return status.Errorf(codes.Unimplemented, "method Rotate not implemented") -} -func (*UnimplementedCertificateManagementServer) Install(CertificateManagement_InstallServer) error { - return status.Errorf(codes.Unimplemented, "method Install not implemented") -} -func (*UnimplementedCertificateManagementServer) GenerateCSR(context.Context, *GenerateCSRRequest) (*GenerateCSRResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GenerateCSR not implemented") -} -func (*UnimplementedCertificateManagementServer) LoadCertificate(context.Context, *LoadCertificateRequest) (*LoadCertificateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LoadCertificate not implemented") -} -func (*UnimplementedCertificateManagementServer) LoadCertificateAuthorityBundle(context.Context, *LoadCertificateAuthorityBundleRequest) (*LoadCertificateAuthorityBundleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LoadCertificateAuthorityBundle not implemented") -} -func (*UnimplementedCertificateManagementServer) GetCertificates(context.Context, *GetCertificatesRequest) (*GetCertificatesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCertificates not implemented") -} -func (*UnimplementedCertificateManagementServer) RevokeCertificates(context.Context, *RevokeCertificatesRequest) (*RevokeCertificatesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RevokeCertificates not implemented") -} -func (*UnimplementedCertificateManagementServer) CanGenerateCSR(context.Context, *CanGenerateCSRRequest) (*CanGenerateCSRResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CanGenerateCSR not implemented") -} - -func RegisterCertificateManagementServer(s *grpc.Server, srv CertificateManagementServer) { - s.RegisterService(&_CertificateManagement_serviceDesc, srv) -} - -func _CertificateManagement_Rotate_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CertificateManagementServer).Rotate(&certificateManagementRotateServer{stream}) -} - -type CertificateManagement_RotateServer interface { - Send(*RotateCertificateResponse) error - Recv() (*RotateCertificateRequest, error) - grpc.ServerStream -} - -type certificateManagementRotateServer struct { - grpc.ServerStream -} - -func (x *certificateManagementRotateServer) Send(m *RotateCertificateResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *certificateManagementRotateServer) Recv() (*RotateCertificateRequest, error) { - m := new(RotateCertificateRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _CertificateManagement_Install_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(CertificateManagementServer).Install(&certificateManagementInstallServer{stream}) -} - -type CertificateManagement_InstallServer interface { - Send(*InstallCertificateResponse) error - Recv() (*InstallCertificateRequest, error) - grpc.ServerStream -} - -type certificateManagementInstallServer struct { - grpc.ServerStream -} - -func (x *certificateManagementInstallServer) Send(m *InstallCertificateResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *certificateManagementInstallServer) Recv() (*InstallCertificateRequest, error) { - m := new(InstallCertificateRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _CertificateManagement_GenerateCSR_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GenerateCSRRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CertificateManagementServer).GenerateCSR(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.certificate.CertificateManagement/GenerateCSR", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CertificateManagementServer).GenerateCSR(ctx, req.(*GenerateCSRRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CertificateManagement_LoadCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LoadCertificateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CertificateManagementServer).LoadCertificate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.certificate.CertificateManagement/LoadCertificate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CertificateManagementServer).LoadCertificate(ctx, req.(*LoadCertificateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CertificateManagement_LoadCertificateAuthorityBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LoadCertificateAuthorityBundleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CertificateManagementServer).LoadCertificateAuthorityBundle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.certificate.CertificateManagement/LoadCertificateAuthorityBundle", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CertificateManagementServer).LoadCertificateAuthorityBundle(ctx, req.(*LoadCertificateAuthorityBundleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CertificateManagement_GetCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCertificatesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CertificateManagementServer).GetCertificates(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.certificate.CertificateManagement/GetCertificates", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CertificateManagementServer).GetCertificates(ctx, req.(*GetCertificatesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CertificateManagement_RevokeCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RevokeCertificatesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CertificateManagementServer).RevokeCertificates(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.certificate.CertificateManagement/RevokeCertificates", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CertificateManagementServer).RevokeCertificates(ctx, req.(*RevokeCertificatesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CertificateManagement_CanGenerateCSR_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CanGenerateCSRRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CertificateManagementServer).CanGenerateCSR(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.certificate.CertificateManagement/CanGenerateCSR", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CertificateManagementServer).CanGenerateCSR(ctx, req.(*CanGenerateCSRRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _CertificateManagement_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.certificate.CertificateManagement", - HandlerType: (*CertificateManagementServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GenerateCSR", - Handler: _CertificateManagement_GenerateCSR_Handler, - }, - { - MethodName: "LoadCertificate", - Handler: _CertificateManagement_LoadCertificate_Handler, - }, - { - MethodName: "LoadCertificateAuthorityBundle", - Handler: _CertificateManagement_LoadCertificateAuthorityBundle_Handler, - }, - { - MethodName: "GetCertificates", - Handler: _CertificateManagement_GetCertificates_Handler, - }, - { - MethodName: "RevokeCertificates", - Handler: _CertificateManagement_RevokeCertificates_Handler, - }, - { - MethodName: "CanGenerateCSR", - Handler: _CertificateManagement_CanGenerateCSR_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Rotate", - Handler: _CertificateManagement_Rotate_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "Install", - Handler: _CertificateManagement_Install_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "cert/cert.proto", -} diff --git a/cert/cert.proto b/cert/cert.proto index 952a700b..85c5cbdc 100644 --- a/cert/cert.proto +++ b/cert/cert.proto @@ -12,7 +12,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// // This file defines the gNOI API to be used for certificate installation and // rotation. diff --git a/cert/cert_grpc.pb.go b/cert/cert_grpc.pb.go new file mode 100755 index 00000000..5b1f48dc --- /dev/null +++ b/cert/cert_grpc.pb.go @@ -0,0 +1,422 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: cert/cert.proto + +package cert + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// CertificateManagementClient is the client API for CertificateManagement 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 CertificateManagementClient interface { + Rotate(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_RotateClient, error) + Install(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_InstallClient, error) + GenerateCSR(ctx context.Context, in *GenerateCSRRequest, opts ...grpc.CallOption) (*GenerateCSRResponse, error) + LoadCertificate(ctx context.Context, in *LoadCertificateRequest, opts ...grpc.CallOption) (*LoadCertificateResponse, error) + LoadCertificateAuthorityBundle(ctx context.Context, in *LoadCertificateAuthorityBundleRequest, opts ...grpc.CallOption) (*LoadCertificateAuthorityBundleResponse, error) + GetCertificates(ctx context.Context, in *GetCertificatesRequest, opts ...grpc.CallOption) (*GetCertificatesResponse, error) + RevokeCertificates(ctx context.Context, in *RevokeCertificatesRequest, opts ...grpc.CallOption) (*RevokeCertificatesResponse, error) + CanGenerateCSR(ctx context.Context, in *CanGenerateCSRRequest, opts ...grpc.CallOption) (*CanGenerateCSRResponse, error) +} + +type certificateManagementClient struct { + cc grpc.ClientConnInterface +} + +func NewCertificateManagementClient(cc grpc.ClientConnInterface) CertificateManagementClient { + return &certificateManagementClient{cc} +} + +func (c *certificateManagementClient) Rotate(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_RotateClient, error) { + stream, err := c.cc.NewStream(ctx, &CertificateManagement_ServiceDesc.Streams[0], "/gnoi.certificate.CertificateManagement/Rotate", opts...) + if err != nil { + return nil, err + } + x := &certificateManagementRotateClient{stream} + return x, nil +} + +type CertificateManagement_RotateClient interface { + Send(*RotateCertificateRequest) error + Recv() (*RotateCertificateResponse, error) + grpc.ClientStream +} + +type certificateManagementRotateClient struct { + grpc.ClientStream +} + +func (x *certificateManagementRotateClient) Send(m *RotateCertificateRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *certificateManagementRotateClient) Recv() (*RotateCertificateResponse, error) { + m := new(RotateCertificateResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *certificateManagementClient) Install(ctx context.Context, opts ...grpc.CallOption) (CertificateManagement_InstallClient, error) { + stream, err := c.cc.NewStream(ctx, &CertificateManagement_ServiceDesc.Streams[1], "/gnoi.certificate.CertificateManagement/Install", opts...) + if err != nil { + return nil, err + } + x := &certificateManagementInstallClient{stream} + return x, nil +} + +type CertificateManagement_InstallClient interface { + Send(*InstallCertificateRequest) error + Recv() (*InstallCertificateResponse, error) + grpc.ClientStream +} + +type certificateManagementInstallClient struct { + grpc.ClientStream +} + +func (x *certificateManagementInstallClient) Send(m *InstallCertificateRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *certificateManagementInstallClient) Recv() (*InstallCertificateResponse, error) { + m := new(InstallCertificateResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *certificateManagementClient) GenerateCSR(ctx context.Context, in *GenerateCSRRequest, opts ...grpc.CallOption) (*GenerateCSRResponse, error) { + out := new(GenerateCSRResponse) + err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/GenerateCSR", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *certificateManagementClient) LoadCertificate(ctx context.Context, in *LoadCertificateRequest, opts ...grpc.CallOption) (*LoadCertificateResponse, error) { + out := new(LoadCertificateResponse) + err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/LoadCertificate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *certificateManagementClient) LoadCertificateAuthorityBundle(ctx context.Context, in *LoadCertificateAuthorityBundleRequest, opts ...grpc.CallOption) (*LoadCertificateAuthorityBundleResponse, error) { + out := new(LoadCertificateAuthorityBundleResponse) + err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/LoadCertificateAuthorityBundle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *certificateManagementClient) GetCertificates(ctx context.Context, in *GetCertificatesRequest, opts ...grpc.CallOption) (*GetCertificatesResponse, error) { + out := new(GetCertificatesResponse) + err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/GetCertificates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *certificateManagementClient) RevokeCertificates(ctx context.Context, in *RevokeCertificatesRequest, opts ...grpc.CallOption) (*RevokeCertificatesResponse, error) { + out := new(RevokeCertificatesResponse) + err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/RevokeCertificates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *certificateManagementClient) CanGenerateCSR(ctx context.Context, in *CanGenerateCSRRequest, opts ...grpc.CallOption) (*CanGenerateCSRResponse, error) { + out := new(CanGenerateCSRResponse) + err := c.cc.Invoke(ctx, "/gnoi.certificate.CertificateManagement/CanGenerateCSR", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CertificateManagementServer is the server API for CertificateManagement service. +// All implementations must embed UnimplementedCertificateManagementServer +// for forward compatibility +type CertificateManagementServer interface { + Rotate(CertificateManagement_RotateServer) error + Install(CertificateManagement_InstallServer) error + GenerateCSR(context.Context, *GenerateCSRRequest) (*GenerateCSRResponse, error) + LoadCertificate(context.Context, *LoadCertificateRequest) (*LoadCertificateResponse, error) + LoadCertificateAuthorityBundle(context.Context, *LoadCertificateAuthorityBundleRequest) (*LoadCertificateAuthorityBundleResponse, error) + GetCertificates(context.Context, *GetCertificatesRequest) (*GetCertificatesResponse, error) + RevokeCertificates(context.Context, *RevokeCertificatesRequest) (*RevokeCertificatesResponse, error) + CanGenerateCSR(context.Context, *CanGenerateCSRRequest) (*CanGenerateCSRResponse, error) + mustEmbedUnimplementedCertificateManagementServer() +} + +// UnimplementedCertificateManagementServer must be embedded to have forward compatible implementations. +type UnimplementedCertificateManagementServer struct { +} + +func (UnimplementedCertificateManagementServer) Rotate(CertificateManagement_RotateServer) error { + return status.Errorf(codes.Unimplemented, "method Rotate not implemented") +} +func (UnimplementedCertificateManagementServer) Install(CertificateManagement_InstallServer) error { + return status.Errorf(codes.Unimplemented, "method Install not implemented") +} +func (UnimplementedCertificateManagementServer) GenerateCSR(context.Context, *GenerateCSRRequest) (*GenerateCSRResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateCSR not implemented") +} +func (UnimplementedCertificateManagementServer) LoadCertificate(context.Context, *LoadCertificateRequest) (*LoadCertificateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LoadCertificate not implemented") +} +func (UnimplementedCertificateManagementServer) LoadCertificateAuthorityBundle(context.Context, *LoadCertificateAuthorityBundleRequest) (*LoadCertificateAuthorityBundleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LoadCertificateAuthorityBundle not implemented") +} +func (UnimplementedCertificateManagementServer) GetCertificates(context.Context, *GetCertificatesRequest) (*GetCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCertificates not implemented") +} +func (UnimplementedCertificateManagementServer) RevokeCertificates(context.Context, *RevokeCertificatesRequest) (*RevokeCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RevokeCertificates not implemented") +} +func (UnimplementedCertificateManagementServer) CanGenerateCSR(context.Context, *CanGenerateCSRRequest) (*CanGenerateCSRResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CanGenerateCSR not implemented") +} +func (UnimplementedCertificateManagementServer) mustEmbedUnimplementedCertificateManagementServer() {} + +// UnsafeCertificateManagementServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CertificateManagementServer will +// result in compilation errors. +type UnsafeCertificateManagementServer interface { + mustEmbedUnimplementedCertificateManagementServer() +} + +func RegisterCertificateManagementServer(s grpc.ServiceRegistrar, srv CertificateManagementServer) { + s.RegisterService(&CertificateManagement_ServiceDesc, srv) +} + +func _CertificateManagement_Rotate_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(CertificateManagementServer).Rotate(&certificateManagementRotateServer{stream}) +} + +type CertificateManagement_RotateServer interface { + Send(*RotateCertificateResponse) error + Recv() (*RotateCertificateRequest, error) + grpc.ServerStream +} + +type certificateManagementRotateServer struct { + grpc.ServerStream +} + +func (x *certificateManagementRotateServer) Send(m *RotateCertificateResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *certificateManagementRotateServer) Recv() (*RotateCertificateRequest, error) { + m := new(RotateCertificateRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _CertificateManagement_Install_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(CertificateManagementServer).Install(&certificateManagementInstallServer{stream}) +} + +type CertificateManagement_InstallServer interface { + Send(*InstallCertificateResponse) error + Recv() (*InstallCertificateRequest, error) + grpc.ServerStream +} + +type certificateManagementInstallServer struct { + grpc.ServerStream +} + +func (x *certificateManagementInstallServer) Send(m *InstallCertificateResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *certificateManagementInstallServer) Recv() (*InstallCertificateRequest, error) { + m := new(InstallCertificateRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _CertificateManagement_GenerateCSR_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateCSRRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateManagementServer).GenerateCSR(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.certificate.CertificateManagement/GenerateCSR", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateManagementServer).GenerateCSR(ctx, req.(*GenerateCSRRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CertificateManagement_LoadCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoadCertificateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateManagementServer).LoadCertificate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.certificate.CertificateManagement/LoadCertificate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateManagementServer).LoadCertificate(ctx, req.(*LoadCertificateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CertificateManagement_LoadCertificateAuthorityBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoadCertificateAuthorityBundleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateManagementServer).LoadCertificateAuthorityBundle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.certificate.CertificateManagement/LoadCertificateAuthorityBundle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateManagementServer).LoadCertificateAuthorityBundle(ctx, req.(*LoadCertificateAuthorityBundleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CertificateManagement_GetCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateManagementServer).GetCertificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.certificate.CertificateManagement/GetCertificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateManagementServer).GetCertificates(ctx, req.(*GetCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CertificateManagement_RevokeCertificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RevokeCertificatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateManagementServer).RevokeCertificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.certificate.CertificateManagement/RevokeCertificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateManagementServer).RevokeCertificates(ctx, req.(*RevokeCertificatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CertificateManagement_CanGenerateCSR_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CanGenerateCSRRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateManagementServer).CanGenerateCSR(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.certificate.CertificateManagement/CanGenerateCSR", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateManagementServer).CanGenerateCSR(ctx, req.(*CanGenerateCSRRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CertificateManagement_ServiceDesc is the grpc.ServiceDesc for CertificateManagement service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CertificateManagement_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.certificate.CertificateManagement", + HandlerType: (*CertificateManagementServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GenerateCSR", + Handler: _CertificateManagement_GenerateCSR_Handler, + }, + { + MethodName: "LoadCertificate", + Handler: _CertificateManagement_LoadCertificate_Handler, + }, + { + MethodName: "LoadCertificateAuthorityBundle", + Handler: _CertificateManagement_LoadCertificateAuthorityBundle_Handler, + }, + { + MethodName: "GetCertificates", + Handler: _CertificateManagement_GetCertificates_Handler, + }, + { + MethodName: "RevokeCertificates", + Handler: _CertificateManagement_RevokeCertificates_Handler, + }, + { + MethodName: "CanGenerateCSR", + Handler: _CertificateManagement_CanGenerateCSR_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Rotate", + Handler: _CertificateManagement_Rotate_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "Install", + Handler: _CertificateManagement_Install_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "cert/cert.proto", +} diff --git a/common.bzl b/common.bzl new file mode 100644 index 00000000..b40ec14a --- /dev/null +++ b/common.bzl @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") +load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "PROTO_RUNTIME_DEPS", "WELL_KNOWN_TYPES_APIV2") + +def use_new_compilers(): + go_proto_compiler( + name = "go_protoc_gen_go", + options = [ + "paths=source_relative", + ], + plugin = "@org_golang_google_protobuf//cmd/protoc-gen-go", + suffix = ".pb.go", + visibility = ["//visibility:public"], + deps = PROTO_RUNTIME_DEPS + WELL_KNOWN_TYPES_APIV2, + ) + go_proto_compiler( + name = "go_protoc_gen_go_grpc", + options = [ + "paths=source_relative", + ], + plugin = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc", + suffix = "_grpc.pb.go", + visibility = ["//visibility:public"], + deps = PROTO_RUNTIME_DEPS + [ + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], + ) + diff --git a/common/BUILD.bazel b/common/BUILD.bazel index d90d04d8..13e56a8f 100644 --- a/common/BUILD.bazel +++ b/common/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") # Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "common_proto", srcs = ["common.proto"], @@ -40,6 +39,10 @@ cc_proto_library( go_proto_library( name = "common_go_proto", + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/common", proto = ":common_proto", deps = ["//types"], diff --git a/containerz/BUILD.bazel b/containerz/BUILD.bazel index b2209f71..557125bb 100644 --- a/containerz/BUILD.bazel +++ b/containerz/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,15 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "containerz_proto", srcs = ["containerz.proto"], @@ -49,7 +50,10 @@ cc_grpc_library( go_proto_library( name = "containerz_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/containerz", proto = ":containerz_proto", deps = [ diff --git a/containerz/containerz.pb.go b/containerz/containerz.pb.go index 421d7958..968c33c7 100644 --- a/containerz/containerz.pb.go +++ b/containerz/containerz.pb.go @@ -7,13 +7,9 @@ package containerz import ( - context "context" common "github.com/openconfig/gnoi/common" _ "github.com/openconfig/gnoi/types" status "google.golang.org/genproto/googleapis/rpc/status" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status1 "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" @@ -3050,485 +3046,3 @@ func file_containerz_containerz_proto_init() { file_containerz_containerz_proto_goTypes = nil file_containerz_containerz_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ContainerzClient is the client API for Containerz service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ContainerzClient interface { - Deploy(ctx context.Context, opts ...grpc.CallOption) (Containerz_DeployClient, error) - RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*RemoveContainerResponse, error) - ListContainer(ctx context.Context, in *ListContainerRequest, opts ...grpc.CallOption) (Containerz_ListContainerClient, error) - StartContainer(ctx context.Context, in *StartContainerRequest, opts ...grpc.CallOption) (*StartContainerResponse, error) - StopContainer(ctx context.Context, in *StopContainerRequest, opts ...grpc.CallOption) (*StopContainerResponse, error) - Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (Containerz_LogClient, error) - CreateVolume(ctx context.Context, in *CreateVolumeRequest, opts ...grpc.CallOption) (*CreateVolumeResponse, error) - RemoveVolume(ctx context.Context, in *RemoveVolumeRequest, opts ...grpc.CallOption) (*RemoveVolumeResponse, error) - ListVolume(ctx context.Context, in *ListVolumeRequest, opts ...grpc.CallOption) (Containerz_ListVolumeClient, error) -} - -type containerzClient struct { - cc grpc.ClientConnInterface -} - -func NewContainerzClient(cc grpc.ClientConnInterface) ContainerzClient { - return &containerzClient{cc} -} - -func (c *containerzClient) Deploy(ctx context.Context, opts ...grpc.CallOption) (Containerz_DeployClient, error) { - stream, err := c.cc.NewStream(ctx, &_Containerz_serviceDesc.Streams[0], "/gnoi.containerz.Containerz/Deploy", opts...) - if err != nil { - return nil, err - } - x := &containerzDeployClient{stream} - return x, nil -} - -type Containerz_DeployClient interface { - Send(*DeployRequest) error - Recv() (*DeployResponse, error) - grpc.ClientStream -} - -type containerzDeployClient struct { - grpc.ClientStream -} - -func (x *containerzDeployClient) Send(m *DeployRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *containerzDeployClient) Recv() (*DeployResponse, error) { - m := new(DeployResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *containerzClient) RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*RemoveContainerResponse, error) { - out := new(RemoveContainerResponse) - err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/RemoveContainer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerzClient) ListContainer(ctx context.Context, in *ListContainerRequest, opts ...grpc.CallOption) (Containerz_ListContainerClient, error) { - stream, err := c.cc.NewStream(ctx, &_Containerz_serviceDesc.Streams[1], "/gnoi.containerz.Containerz/ListContainer", opts...) - if err != nil { - return nil, err - } - x := &containerzListContainerClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Containerz_ListContainerClient interface { - Recv() (*ListContainerResponse, error) - grpc.ClientStream -} - -type containerzListContainerClient struct { - grpc.ClientStream -} - -func (x *containerzListContainerClient) Recv() (*ListContainerResponse, error) { - m := new(ListContainerResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *containerzClient) StartContainer(ctx context.Context, in *StartContainerRequest, opts ...grpc.CallOption) (*StartContainerResponse, error) { - out := new(StartContainerResponse) - err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/StartContainer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerzClient) StopContainer(ctx context.Context, in *StopContainerRequest, opts ...grpc.CallOption) (*StopContainerResponse, error) { - out := new(StopContainerResponse) - err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/StopContainer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerzClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (Containerz_LogClient, error) { - stream, err := c.cc.NewStream(ctx, &_Containerz_serviceDesc.Streams[2], "/gnoi.containerz.Containerz/Log", opts...) - if err != nil { - return nil, err - } - x := &containerzLogClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Containerz_LogClient interface { - Recv() (*LogResponse, error) - grpc.ClientStream -} - -type containerzLogClient struct { - grpc.ClientStream -} - -func (x *containerzLogClient) Recv() (*LogResponse, error) { - m := new(LogResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *containerzClient) CreateVolume(ctx context.Context, in *CreateVolumeRequest, opts ...grpc.CallOption) (*CreateVolumeResponse, error) { - out := new(CreateVolumeResponse) - err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/CreateVolume", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerzClient) RemoveVolume(ctx context.Context, in *RemoveVolumeRequest, opts ...grpc.CallOption) (*RemoveVolumeResponse, error) { - out := new(RemoveVolumeResponse) - err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/RemoveVolume", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *containerzClient) ListVolume(ctx context.Context, in *ListVolumeRequest, opts ...grpc.CallOption) (Containerz_ListVolumeClient, error) { - stream, err := c.cc.NewStream(ctx, &_Containerz_serviceDesc.Streams[3], "/gnoi.containerz.Containerz/ListVolume", opts...) - if err != nil { - return nil, err - } - x := &containerzListVolumeClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Containerz_ListVolumeClient interface { - Recv() (*ListVolumeResponse, error) - grpc.ClientStream -} - -type containerzListVolumeClient struct { - grpc.ClientStream -} - -func (x *containerzListVolumeClient) Recv() (*ListVolumeResponse, error) { - m := new(ListVolumeResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ContainerzServer is the server API for Containerz service. -type ContainerzServer interface { - Deploy(Containerz_DeployServer) error - RemoveContainer(context.Context, *RemoveContainerRequest) (*RemoveContainerResponse, error) - ListContainer(*ListContainerRequest, Containerz_ListContainerServer) error - StartContainer(context.Context, *StartContainerRequest) (*StartContainerResponse, error) - StopContainer(context.Context, *StopContainerRequest) (*StopContainerResponse, error) - Log(*LogRequest, Containerz_LogServer) error - CreateVolume(context.Context, *CreateVolumeRequest) (*CreateVolumeResponse, error) - RemoveVolume(context.Context, *RemoveVolumeRequest) (*RemoveVolumeResponse, error) - ListVolume(*ListVolumeRequest, Containerz_ListVolumeServer) error -} - -// UnimplementedContainerzServer can be embedded to have forward compatible implementations. -type UnimplementedContainerzServer struct { -} - -func (*UnimplementedContainerzServer) Deploy(Containerz_DeployServer) error { - return status1.Errorf(codes.Unimplemented, "method Deploy not implemented") -} -func (*UnimplementedContainerzServer) RemoveContainer(context.Context, *RemoveContainerRequest) (*RemoveContainerResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method RemoveContainer not implemented") -} -func (*UnimplementedContainerzServer) ListContainer(*ListContainerRequest, Containerz_ListContainerServer) error { - return status1.Errorf(codes.Unimplemented, "method ListContainer not implemented") -} -func (*UnimplementedContainerzServer) StartContainer(context.Context, *StartContainerRequest) (*StartContainerResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method StartContainer not implemented") -} -func (*UnimplementedContainerzServer) StopContainer(context.Context, *StopContainerRequest) (*StopContainerResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method StopContainer not implemented") -} -func (*UnimplementedContainerzServer) Log(*LogRequest, Containerz_LogServer) error { - return status1.Errorf(codes.Unimplemented, "method Log not implemented") -} -func (*UnimplementedContainerzServer) CreateVolume(context.Context, *CreateVolumeRequest) (*CreateVolumeResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method CreateVolume not implemented") -} -func (*UnimplementedContainerzServer) RemoveVolume(context.Context, *RemoveVolumeRequest) (*RemoveVolumeResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method RemoveVolume not implemented") -} -func (*UnimplementedContainerzServer) ListVolume(*ListVolumeRequest, Containerz_ListVolumeServer) error { - return status1.Errorf(codes.Unimplemented, "method ListVolume not implemented") -} - -func RegisterContainerzServer(s *grpc.Server, srv ContainerzServer) { - s.RegisterService(&_Containerz_serviceDesc, srv) -} - -func _Containerz_Deploy_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ContainerzServer).Deploy(&containerzDeployServer{stream}) -} - -type Containerz_DeployServer interface { - Send(*DeployResponse) error - Recv() (*DeployRequest, error) - grpc.ServerStream -} - -type containerzDeployServer struct { - grpc.ServerStream -} - -func (x *containerzDeployServer) Send(m *DeployResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *containerzDeployServer) Recv() (*DeployRequest, error) { - m := new(DeployRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Containerz_RemoveContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveContainerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerzServer).RemoveContainer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.containerz.Containerz/RemoveContainer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerzServer).RemoveContainer(ctx, req.(*RemoveContainerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Containerz_ListContainer_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListContainerRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ContainerzServer).ListContainer(m, &containerzListContainerServer{stream}) -} - -type Containerz_ListContainerServer interface { - Send(*ListContainerResponse) error - grpc.ServerStream -} - -type containerzListContainerServer struct { - grpc.ServerStream -} - -func (x *containerzListContainerServer) Send(m *ListContainerResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Containerz_StartContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartContainerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerzServer).StartContainer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.containerz.Containerz/StartContainer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerzServer).StartContainer(ctx, req.(*StartContainerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Containerz_StopContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopContainerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerzServer).StopContainer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.containerz.Containerz/StopContainer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerzServer).StopContainer(ctx, req.(*StopContainerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Containerz_Log_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(LogRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ContainerzServer).Log(m, &containerzLogServer{stream}) -} - -type Containerz_LogServer interface { - Send(*LogResponse) error - grpc.ServerStream -} - -type containerzLogServer struct { - grpc.ServerStream -} - -func (x *containerzLogServer) Send(m *LogResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Containerz_CreateVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateVolumeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerzServer).CreateVolume(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.containerz.Containerz/CreateVolume", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerzServer).CreateVolume(ctx, req.(*CreateVolumeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Containerz_RemoveVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveVolumeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ContainerzServer).RemoveVolume(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.containerz.Containerz/RemoveVolume", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerzServer).RemoveVolume(ctx, req.(*RemoveVolumeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Containerz_ListVolume_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListVolumeRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ContainerzServer).ListVolume(m, &containerzListVolumeServer{stream}) -} - -type Containerz_ListVolumeServer interface { - Send(*ListVolumeResponse) error - grpc.ServerStream -} - -type containerzListVolumeServer struct { - grpc.ServerStream -} - -func (x *containerzListVolumeServer) Send(m *ListVolumeResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _Containerz_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.containerz.Containerz", - HandlerType: (*ContainerzServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "RemoveContainer", - Handler: _Containerz_RemoveContainer_Handler, - }, - { - MethodName: "StartContainer", - Handler: _Containerz_StartContainer_Handler, - }, - { - MethodName: "StopContainer", - Handler: _Containerz_StopContainer_Handler, - }, - { - MethodName: "CreateVolume", - Handler: _Containerz_CreateVolume_Handler, - }, - { - MethodName: "RemoveVolume", - Handler: _Containerz_RemoveVolume_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Deploy", - Handler: _Containerz_Deploy_Handler, - ServerStreams: true, - ClientStreams: true, - }, - { - StreamName: "ListContainer", - Handler: _Containerz_ListContainer_Handler, - ServerStreams: true, - }, - { - StreamName: "Log", - Handler: _Containerz_Log_Handler, - ServerStreams: true, - }, - { - StreamName: "ListVolume", - Handler: _Containerz_ListVolume_Handler, - ServerStreams: true, - }, - }, - Metadata: "containerz/containerz.proto", -} diff --git a/containerz/containerz_grpc.pb.go b/containerz/containerz_grpc.pb.go new file mode 100755 index 00000000..045b577b --- /dev/null +++ b/containerz/containerz_grpc.pb.go @@ -0,0 +1,507 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: containerz/containerz.proto + +package containerz + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ContainerzClient is the client API for Containerz 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 ContainerzClient interface { + Deploy(ctx context.Context, opts ...grpc.CallOption) (Containerz_DeployClient, error) + RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*RemoveContainerResponse, error) + ListContainer(ctx context.Context, in *ListContainerRequest, opts ...grpc.CallOption) (Containerz_ListContainerClient, error) + StartContainer(ctx context.Context, in *StartContainerRequest, opts ...grpc.CallOption) (*StartContainerResponse, error) + StopContainer(ctx context.Context, in *StopContainerRequest, opts ...grpc.CallOption) (*StopContainerResponse, error) + Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (Containerz_LogClient, error) + CreateVolume(ctx context.Context, in *CreateVolumeRequest, opts ...grpc.CallOption) (*CreateVolumeResponse, error) + RemoveVolume(ctx context.Context, in *RemoveVolumeRequest, opts ...grpc.CallOption) (*RemoveVolumeResponse, error) + ListVolume(ctx context.Context, in *ListVolumeRequest, opts ...grpc.CallOption) (Containerz_ListVolumeClient, error) +} + +type containerzClient struct { + cc grpc.ClientConnInterface +} + +func NewContainerzClient(cc grpc.ClientConnInterface) ContainerzClient { + return &containerzClient{cc} +} + +func (c *containerzClient) Deploy(ctx context.Context, opts ...grpc.CallOption) (Containerz_DeployClient, error) { + stream, err := c.cc.NewStream(ctx, &Containerz_ServiceDesc.Streams[0], "/gnoi.containerz.Containerz/Deploy", opts...) + if err != nil { + return nil, err + } + x := &containerzDeployClient{stream} + return x, nil +} + +type Containerz_DeployClient interface { + Send(*DeployRequest) error + Recv() (*DeployResponse, error) + grpc.ClientStream +} + +type containerzDeployClient struct { + grpc.ClientStream +} + +func (x *containerzDeployClient) Send(m *DeployRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *containerzDeployClient) Recv() (*DeployResponse, error) { + m := new(DeployResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *containerzClient) RemoveContainer(ctx context.Context, in *RemoveContainerRequest, opts ...grpc.CallOption) (*RemoveContainerResponse, error) { + out := new(RemoveContainerResponse) + err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/RemoveContainer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerzClient) ListContainer(ctx context.Context, in *ListContainerRequest, opts ...grpc.CallOption) (Containerz_ListContainerClient, error) { + stream, err := c.cc.NewStream(ctx, &Containerz_ServiceDesc.Streams[1], "/gnoi.containerz.Containerz/ListContainer", opts...) + if err != nil { + return nil, err + } + x := &containerzListContainerClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Containerz_ListContainerClient interface { + Recv() (*ListContainerResponse, error) + grpc.ClientStream +} + +type containerzListContainerClient struct { + grpc.ClientStream +} + +func (x *containerzListContainerClient) Recv() (*ListContainerResponse, error) { + m := new(ListContainerResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *containerzClient) StartContainer(ctx context.Context, in *StartContainerRequest, opts ...grpc.CallOption) (*StartContainerResponse, error) { + out := new(StartContainerResponse) + err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/StartContainer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerzClient) StopContainer(ctx context.Context, in *StopContainerRequest, opts ...grpc.CallOption) (*StopContainerResponse, error) { + out := new(StopContainerResponse) + err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/StopContainer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerzClient) Log(ctx context.Context, in *LogRequest, opts ...grpc.CallOption) (Containerz_LogClient, error) { + stream, err := c.cc.NewStream(ctx, &Containerz_ServiceDesc.Streams[2], "/gnoi.containerz.Containerz/Log", opts...) + if err != nil { + return nil, err + } + x := &containerzLogClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Containerz_LogClient interface { + Recv() (*LogResponse, error) + grpc.ClientStream +} + +type containerzLogClient struct { + grpc.ClientStream +} + +func (x *containerzLogClient) Recv() (*LogResponse, error) { + m := new(LogResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *containerzClient) CreateVolume(ctx context.Context, in *CreateVolumeRequest, opts ...grpc.CallOption) (*CreateVolumeResponse, error) { + out := new(CreateVolumeResponse) + err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/CreateVolume", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerzClient) RemoveVolume(ctx context.Context, in *RemoveVolumeRequest, opts ...grpc.CallOption) (*RemoveVolumeResponse, error) { + out := new(RemoveVolumeResponse) + err := c.cc.Invoke(ctx, "/gnoi.containerz.Containerz/RemoveVolume", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *containerzClient) ListVolume(ctx context.Context, in *ListVolumeRequest, opts ...grpc.CallOption) (Containerz_ListVolumeClient, error) { + stream, err := c.cc.NewStream(ctx, &Containerz_ServiceDesc.Streams[3], "/gnoi.containerz.Containerz/ListVolume", opts...) + if err != nil { + return nil, err + } + x := &containerzListVolumeClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Containerz_ListVolumeClient interface { + Recv() (*ListVolumeResponse, error) + grpc.ClientStream +} + +type containerzListVolumeClient struct { + grpc.ClientStream +} + +func (x *containerzListVolumeClient) Recv() (*ListVolumeResponse, error) { + m := new(ListVolumeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// ContainerzServer is the server API for Containerz service. +// All implementations must embed UnimplementedContainerzServer +// for forward compatibility +type ContainerzServer interface { + Deploy(Containerz_DeployServer) error + RemoveContainer(context.Context, *RemoveContainerRequest) (*RemoveContainerResponse, error) + ListContainer(*ListContainerRequest, Containerz_ListContainerServer) error + StartContainer(context.Context, *StartContainerRequest) (*StartContainerResponse, error) + StopContainer(context.Context, *StopContainerRequest) (*StopContainerResponse, error) + Log(*LogRequest, Containerz_LogServer) error + CreateVolume(context.Context, *CreateVolumeRequest) (*CreateVolumeResponse, error) + RemoveVolume(context.Context, *RemoveVolumeRequest) (*RemoveVolumeResponse, error) + ListVolume(*ListVolumeRequest, Containerz_ListVolumeServer) error + mustEmbedUnimplementedContainerzServer() +} + +// UnimplementedContainerzServer must be embedded to have forward compatible implementations. +type UnimplementedContainerzServer struct { +} + +func (UnimplementedContainerzServer) Deploy(Containerz_DeployServer) error { + return status.Errorf(codes.Unimplemented, "method Deploy not implemented") +} +func (UnimplementedContainerzServer) RemoveContainer(context.Context, *RemoveContainerRequest) (*RemoveContainerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveContainer not implemented") +} +func (UnimplementedContainerzServer) ListContainer(*ListContainerRequest, Containerz_ListContainerServer) error { + return status.Errorf(codes.Unimplemented, "method ListContainer not implemented") +} +func (UnimplementedContainerzServer) StartContainer(context.Context, *StartContainerRequest) (*StartContainerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StartContainer not implemented") +} +func (UnimplementedContainerzServer) StopContainer(context.Context, *StopContainerRequest) (*StopContainerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopContainer not implemented") +} +func (UnimplementedContainerzServer) Log(*LogRequest, Containerz_LogServer) error { + return status.Errorf(codes.Unimplemented, "method Log not implemented") +} +func (UnimplementedContainerzServer) CreateVolume(context.Context, *CreateVolumeRequest) (*CreateVolumeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateVolume not implemented") +} +func (UnimplementedContainerzServer) RemoveVolume(context.Context, *RemoveVolumeRequest) (*RemoveVolumeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveVolume not implemented") +} +func (UnimplementedContainerzServer) ListVolume(*ListVolumeRequest, Containerz_ListVolumeServer) error { + return status.Errorf(codes.Unimplemented, "method ListVolume not implemented") +} +func (UnimplementedContainerzServer) mustEmbedUnimplementedContainerzServer() {} + +// UnsafeContainerzServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ContainerzServer will +// result in compilation errors. +type UnsafeContainerzServer interface { + mustEmbedUnimplementedContainerzServer() +} + +func RegisterContainerzServer(s grpc.ServiceRegistrar, srv ContainerzServer) { + s.RegisterService(&Containerz_ServiceDesc, srv) +} + +func _Containerz_Deploy_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ContainerzServer).Deploy(&containerzDeployServer{stream}) +} + +type Containerz_DeployServer interface { + Send(*DeployResponse) error + Recv() (*DeployRequest, error) + grpc.ServerStream +} + +type containerzDeployServer struct { + grpc.ServerStream +} + +func (x *containerzDeployServer) Send(m *DeployResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *containerzDeployServer) Recv() (*DeployRequest, error) { + m := new(DeployRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Containerz_RemoveContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerzServer).RemoveContainer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.containerz.Containerz/RemoveContainer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerzServer).RemoveContainer(ctx, req.(*RemoveContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containerz_ListContainer_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListContainerRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ContainerzServer).ListContainer(m, &containerzListContainerServer{stream}) +} + +type Containerz_ListContainerServer interface { + Send(*ListContainerResponse) error + grpc.ServerStream +} + +type containerzListContainerServer struct { + grpc.ServerStream +} + +func (x *containerzListContainerServer) Send(m *ListContainerResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Containerz_StartContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerzServer).StartContainer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.containerz.Containerz/StartContainer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerzServer).StartContainer(ctx, req.(*StartContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containerz_StopContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerzServer).StopContainer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.containerz.Containerz/StopContainer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerzServer).StopContainer(ctx, req.(*StopContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containerz_Log_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(LogRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ContainerzServer).Log(m, &containerzLogServer{stream}) +} + +type Containerz_LogServer interface { + Send(*LogResponse) error + grpc.ServerStream +} + +type containerzLogServer struct { + grpc.ServerStream +} + +func (x *containerzLogServer) Send(m *LogResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Containerz_CreateVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateVolumeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerzServer).CreateVolume(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.containerz.Containerz/CreateVolume", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerzServer).CreateVolume(ctx, req.(*CreateVolumeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containerz_RemoveVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveVolumeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainerzServer).RemoveVolume(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.containerz.Containerz/RemoveVolume", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainerzServer).RemoveVolume(ctx, req.(*RemoveVolumeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containerz_ListVolume_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListVolumeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ContainerzServer).ListVolume(m, &containerzListVolumeServer{stream}) +} + +type Containerz_ListVolumeServer interface { + Send(*ListVolumeResponse) error + grpc.ServerStream +} + +type containerzListVolumeServer struct { + grpc.ServerStream +} + +func (x *containerzListVolumeServer) Send(m *ListVolumeResponse) error { + return x.ServerStream.SendMsg(m) +} + +// Containerz_ServiceDesc is the grpc.ServiceDesc for Containerz service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Containerz_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.containerz.Containerz", + HandlerType: (*ContainerzServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RemoveContainer", + Handler: _Containerz_RemoveContainer_Handler, + }, + { + MethodName: "StartContainer", + Handler: _Containerz_StartContainer_Handler, + }, + { + MethodName: "StopContainer", + Handler: _Containerz_StopContainer_Handler, + }, + { + MethodName: "CreateVolume", + Handler: _Containerz_CreateVolume_Handler, + }, + { + MethodName: "RemoveVolume", + Handler: _Containerz_RemoveVolume_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Deploy", + Handler: _Containerz_Deploy_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "ListContainer", + Handler: _Containerz_ListContainer_Handler, + ServerStreams: true, + }, + { + StreamName: "Log", + Handler: _Containerz_Log_Handler, + ServerStreams: true, + }, + { + StreamName: "ListVolume", + Handler: _Containerz_ListVolume_Handler, + ServerStreams: true, + }, + }, + Metadata: "containerz/containerz.proto", +} diff --git a/debug/BUILD.bazel b/debug/BUILD.bazel index 5b2761da..ed1d346c 100644 --- a/debug/BUILD.bazel +++ b/debug/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2023 Google LLC # @@ -15,15 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "debug_proto", srcs = ["debug.proto"], @@ -47,7 +48,10 @@ cc_grpc_library( go_proto_library( name = "debug_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/debug", proto = ":debug_proto", deps = ["//types"], diff --git a/debug/debug.pb.go b/debug/debug.pb.go index d4cc8198..d5063da0 100644 --- a/debug/debug.pb.go +++ b/debug/debug.pb.go @@ -7,11 +7,7 @@ package debug import ( - context "context" _ "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" @@ -467,110 +463,3 @@ func file_debug_debug_proto_init() { file_debug_debug_proto_goTypes = nil file_debug_debug_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// DebugClient is the client API for Debug service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type DebugClient interface { - Debug(ctx context.Context, in *DebugRequest, opts ...grpc.CallOption) (Debug_DebugClient, error) -} - -type debugClient struct { - cc grpc.ClientConnInterface -} - -func NewDebugClient(cc grpc.ClientConnInterface) DebugClient { - return &debugClient{cc} -} - -func (c *debugClient) Debug(ctx context.Context, in *DebugRequest, opts ...grpc.CallOption) (Debug_DebugClient, error) { - stream, err := c.cc.NewStream(ctx, &_Debug_serviceDesc.Streams[0], "/gnoi.debug.Debug/Debug", opts...) - if err != nil { - return nil, err - } - x := &debugDebugClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Debug_DebugClient interface { - Recv() (*DebugResponse, error) - grpc.ClientStream -} - -type debugDebugClient struct { - grpc.ClientStream -} - -func (x *debugDebugClient) Recv() (*DebugResponse, error) { - m := new(DebugResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// DebugServer is the server API for Debug service. -type DebugServer interface { - Debug(*DebugRequest, Debug_DebugServer) error -} - -// UnimplementedDebugServer can be embedded to have forward compatible implementations. -type UnimplementedDebugServer struct { -} - -func (*UnimplementedDebugServer) Debug(*DebugRequest, Debug_DebugServer) error { - return status.Errorf(codes.Unimplemented, "method Debug not implemented") -} - -func RegisterDebugServer(s *grpc.Server, srv DebugServer) { - s.RegisterService(&_Debug_serviceDesc, srv) -} - -func _Debug_Debug_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(DebugRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DebugServer).Debug(m, &debugDebugServer{stream}) -} - -type Debug_DebugServer interface { - Send(*DebugResponse) error - grpc.ServerStream -} - -type debugDebugServer struct { - grpc.ServerStream -} - -func (x *debugDebugServer) Send(m *DebugResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _Debug_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.debug.Debug", - HandlerType: (*DebugServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Debug", - Handler: _Debug_Debug_Handler, - ServerStreams: true, - }, - }, - Metadata: "debug/debug.proto", -} diff --git a/debug/debug_grpc.pb.go b/debug/debug_grpc.pb.go new file mode 100755 index 00000000..e6d6699b --- /dev/null +++ b/debug/debug_grpc.pb.go @@ -0,0 +1,132 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: debug/debug.proto + +package debug + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// DebugClient is the client API for Debug 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 DebugClient interface { + Debug(ctx context.Context, in *DebugRequest, opts ...grpc.CallOption) (Debug_DebugClient, error) +} + +type debugClient struct { + cc grpc.ClientConnInterface +} + +func NewDebugClient(cc grpc.ClientConnInterface) DebugClient { + return &debugClient{cc} +} + +func (c *debugClient) Debug(ctx context.Context, in *DebugRequest, opts ...grpc.CallOption) (Debug_DebugClient, error) { + stream, err := c.cc.NewStream(ctx, &Debug_ServiceDesc.Streams[0], "/gnoi.debug.Debug/Debug", opts...) + if err != nil { + return nil, err + } + x := &debugDebugClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Debug_DebugClient interface { + Recv() (*DebugResponse, error) + grpc.ClientStream +} + +type debugDebugClient struct { + grpc.ClientStream +} + +func (x *debugDebugClient) Recv() (*DebugResponse, error) { + m := new(DebugResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// DebugServer is the server API for Debug service. +// All implementations must embed UnimplementedDebugServer +// for forward compatibility +type DebugServer interface { + Debug(*DebugRequest, Debug_DebugServer) error + mustEmbedUnimplementedDebugServer() +} + +// UnimplementedDebugServer must be embedded to have forward compatible implementations. +type UnimplementedDebugServer struct { +} + +func (UnimplementedDebugServer) Debug(*DebugRequest, Debug_DebugServer) error { + return status.Errorf(codes.Unimplemented, "method Debug not implemented") +} +func (UnimplementedDebugServer) mustEmbedUnimplementedDebugServer() {} + +// UnsafeDebugServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DebugServer will +// result in compilation errors. +type UnsafeDebugServer interface { + mustEmbedUnimplementedDebugServer() +} + +func RegisterDebugServer(s grpc.ServiceRegistrar, srv DebugServer) { + s.RegisterService(&Debug_ServiceDesc, srv) +} + +func _Debug_Debug_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DebugRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DebugServer).Debug(m, &debugDebugServer{stream}) +} + +type Debug_DebugServer interface { + Send(*DebugResponse) error + grpc.ServerStream +} + +type debugDebugServer struct { + grpc.ServerStream +} + +func (x *debugDebugServer) Send(m *DebugResponse) error { + return x.ServerStream.SendMsg(m) +} + +// Debug_ServiceDesc is the grpc.ServiceDesc for Debug service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Debug_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.debug.Debug", + HandlerType: (*DebugServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Debug", + Handler: _Debug_Debug_Handler, + ServerStreams: true, + }, + }, + Metadata: "debug/debug.proto", +} diff --git a/diag/BUILD.bazel b/diag/BUILD.bazel index 9cea2c2e..2e2fe744 100644 --- a/diag/BUILD.bazel +++ b/diag/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "diag_proto", srcs = ["diag.proto"], @@ -48,7 +47,10 @@ cc_grpc_library( go_proto_library( name = "diag_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/diag", proto = ":diag_proto", deps = ["//types"], diff --git a/diag/diag.pb.go b/diag/diag.pb.go index 2e183f6d..90b8c838 100644 --- a/diag/diag.pb.go +++ b/diag/diag.pb.go @@ -7,11 +7,7 @@ package diag import ( - context "context" types "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1318,155 +1314,3 @@ func file_diag_diag_proto_init() { file_diag_diag_proto_goTypes = nil file_diag_diag_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// DiagClient is the client API for Diag service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type DiagClient interface { - StartBERT(ctx context.Context, in *StartBERTRequest, opts ...grpc.CallOption) (*StartBERTResponse, error) - StopBERT(ctx context.Context, in *StopBERTRequest, opts ...grpc.CallOption) (*StopBERTResponse, error) - GetBERTResult(ctx context.Context, in *GetBERTResultRequest, opts ...grpc.CallOption) (*GetBERTResultResponse, error) -} - -type diagClient struct { - cc grpc.ClientConnInterface -} - -func NewDiagClient(cc grpc.ClientConnInterface) DiagClient { - return &diagClient{cc} -} - -func (c *diagClient) StartBERT(ctx context.Context, in *StartBERTRequest, opts ...grpc.CallOption) (*StartBERTResponse, error) { - out := new(StartBERTResponse) - err := c.cc.Invoke(ctx, "/gnoi.diag.Diag/StartBERT", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *diagClient) StopBERT(ctx context.Context, in *StopBERTRequest, opts ...grpc.CallOption) (*StopBERTResponse, error) { - out := new(StopBERTResponse) - err := c.cc.Invoke(ctx, "/gnoi.diag.Diag/StopBERT", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *diagClient) GetBERTResult(ctx context.Context, in *GetBERTResultRequest, opts ...grpc.CallOption) (*GetBERTResultResponse, error) { - out := new(GetBERTResultResponse) - err := c.cc.Invoke(ctx, "/gnoi.diag.Diag/GetBERTResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// DiagServer is the server API for Diag service. -type DiagServer interface { - StartBERT(context.Context, *StartBERTRequest) (*StartBERTResponse, error) - StopBERT(context.Context, *StopBERTRequest) (*StopBERTResponse, error) - GetBERTResult(context.Context, *GetBERTResultRequest) (*GetBERTResultResponse, error) -} - -// UnimplementedDiagServer can be embedded to have forward compatible implementations. -type UnimplementedDiagServer struct { -} - -func (*UnimplementedDiagServer) StartBERT(context.Context, *StartBERTRequest) (*StartBERTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StartBERT not implemented") -} -func (*UnimplementedDiagServer) StopBERT(context.Context, *StopBERTRequest) (*StopBERTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopBERT not implemented") -} -func (*UnimplementedDiagServer) GetBERTResult(context.Context, *GetBERTResultRequest) (*GetBERTResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBERTResult not implemented") -} - -func RegisterDiagServer(s *grpc.Server, srv DiagServer) { - s.RegisterService(&_Diag_serviceDesc, srv) -} - -func _Diag_StartBERT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartBERTRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DiagServer).StartBERT(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.diag.Diag/StartBERT", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DiagServer).StartBERT(ctx, req.(*StartBERTRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Diag_StopBERT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopBERTRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DiagServer).StopBERT(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.diag.Diag/StopBERT", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DiagServer).StopBERT(ctx, req.(*StopBERTRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Diag_GetBERTResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBERTResultRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DiagServer).GetBERTResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.diag.Diag/GetBERTResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DiagServer).GetBERTResult(ctx, req.(*GetBERTResultRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Diag_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.diag.Diag", - HandlerType: (*DiagServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "StartBERT", - Handler: _Diag_StartBERT_Handler, - }, - { - MethodName: "StopBERT", - Handler: _Diag_StopBERT_Handler, - }, - { - MethodName: "GetBERTResult", - Handler: _Diag_GetBERTResult_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "diag/diag.proto", -} diff --git a/diag/diag_grpc.pb.go b/diag/diag_grpc.pb.go new file mode 100755 index 00000000..1c41d9c5 --- /dev/null +++ b/diag/diag_grpc.pb.go @@ -0,0 +1,177 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: diag/diag.proto + +package diag + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// DiagClient is the client API for Diag 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 DiagClient interface { + StartBERT(ctx context.Context, in *StartBERTRequest, opts ...grpc.CallOption) (*StartBERTResponse, error) + StopBERT(ctx context.Context, in *StopBERTRequest, opts ...grpc.CallOption) (*StopBERTResponse, error) + GetBERTResult(ctx context.Context, in *GetBERTResultRequest, opts ...grpc.CallOption) (*GetBERTResultResponse, error) +} + +type diagClient struct { + cc grpc.ClientConnInterface +} + +func NewDiagClient(cc grpc.ClientConnInterface) DiagClient { + return &diagClient{cc} +} + +func (c *diagClient) StartBERT(ctx context.Context, in *StartBERTRequest, opts ...grpc.CallOption) (*StartBERTResponse, error) { + out := new(StartBERTResponse) + err := c.cc.Invoke(ctx, "/gnoi.diag.Diag/StartBERT", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *diagClient) StopBERT(ctx context.Context, in *StopBERTRequest, opts ...grpc.CallOption) (*StopBERTResponse, error) { + out := new(StopBERTResponse) + err := c.cc.Invoke(ctx, "/gnoi.diag.Diag/StopBERT", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *diagClient) GetBERTResult(ctx context.Context, in *GetBERTResultRequest, opts ...grpc.CallOption) (*GetBERTResultResponse, error) { + out := new(GetBERTResultResponse) + err := c.cc.Invoke(ctx, "/gnoi.diag.Diag/GetBERTResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DiagServer is the server API for Diag service. +// All implementations must embed UnimplementedDiagServer +// for forward compatibility +type DiagServer interface { + StartBERT(context.Context, *StartBERTRequest) (*StartBERTResponse, error) + StopBERT(context.Context, *StopBERTRequest) (*StopBERTResponse, error) + GetBERTResult(context.Context, *GetBERTResultRequest) (*GetBERTResultResponse, error) + mustEmbedUnimplementedDiagServer() +} + +// UnimplementedDiagServer must be embedded to have forward compatible implementations. +type UnimplementedDiagServer struct { +} + +func (UnimplementedDiagServer) StartBERT(context.Context, *StartBERTRequest) (*StartBERTResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StartBERT not implemented") +} +func (UnimplementedDiagServer) StopBERT(context.Context, *StopBERTRequest) (*StopBERTResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopBERT not implemented") +} +func (UnimplementedDiagServer) GetBERTResult(context.Context, *GetBERTResultRequest) (*GetBERTResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBERTResult not implemented") +} +func (UnimplementedDiagServer) mustEmbedUnimplementedDiagServer() {} + +// UnsafeDiagServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DiagServer will +// result in compilation errors. +type UnsafeDiagServer interface { + mustEmbedUnimplementedDiagServer() +} + +func RegisterDiagServer(s grpc.ServiceRegistrar, srv DiagServer) { + s.RegisterService(&Diag_ServiceDesc, srv) +} + +func _Diag_StartBERT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartBERTRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagServer).StartBERT(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.diag.Diag/StartBERT", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagServer).StartBERT(ctx, req.(*StartBERTRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Diag_StopBERT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopBERTRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagServer).StopBERT(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.diag.Diag/StopBERT", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagServer).StopBERT(ctx, req.(*StopBERTRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Diag_GetBERTResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBERTResultRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiagServer).GetBERTResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.diag.Diag/GetBERTResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiagServer).GetBERTResult(ctx, req.(*GetBERTResultRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Diag_ServiceDesc is the grpc.ServiceDesc for Diag service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Diag_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.diag.Diag", + HandlerType: (*DiagServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "StartBERT", + Handler: _Diag_StartBERT_Handler, + }, + { + MethodName: "StopBERT", + Handler: _Diag_StopBERT_Handler, + }, + { + MethodName: "GetBERTResult", + Handler: _Diag_GetBERTResult_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "diag/diag.proto", +} diff --git a/factory_reset/BUILD.bazel b/factory_reset/BUILD.bazel index 0188f2db..c7a9e138 100644 --- a/factory_reset/BUILD.bazel +++ b/factory_reset/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,16 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "factory_reset_proto", srcs = ["factory_reset.proto"], @@ -47,7 +47,10 @@ cc_grpc_library( go_proto_library( name = "factory_reset_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/factory_reset", proto = ":factory_reset_proto", deps = ["//types"], diff --git a/factory_reset/factory_reset.pb.go b/factory_reset/factory_reset.pb.go index 21976211..5b193144 100644 --- a/factory_reset/factory_reset.pb.go +++ b/factory_reset/factory_reset.pb.go @@ -7,11 +7,7 @@ package factory_reset import ( - context "context" _ "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -437,83 +433,3 @@ func file_factory_reset_factory_reset_proto_init() { file_factory_reset_factory_reset_proto_goTypes = nil file_factory_reset_factory_reset_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// FactoryResetClient is the client API for FactoryReset service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type FactoryResetClient interface { - Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) -} - -type factoryResetClient struct { - cc grpc.ClientConnInterface -} - -func NewFactoryResetClient(cc grpc.ClientConnInterface) FactoryResetClient { - return &factoryResetClient{cc} -} - -func (c *factoryResetClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { - out := new(StartResponse) - err := c.cc.Invoke(ctx, "/gnoi.factory_reset.FactoryReset/Start", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// FactoryResetServer is the server API for FactoryReset service. -type FactoryResetServer interface { - Start(context.Context, *StartRequest) (*StartResponse, error) -} - -// UnimplementedFactoryResetServer can be embedded to have forward compatible implementations. -type UnimplementedFactoryResetServer struct { -} - -func (*UnimplementedFactoryResetServer) Start(context.Context, *StartRequest) (*StartResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") -} - -func RegisterFactoryResetServer(s *grpc.Server, srv FactoryResetServer) { - s.RegisterService(&_FactoryReset_serviceDesc, srv) -} - -func _FactoryReset_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FactoryResetServer).Start(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.factory_reset.FactoryReset/Start", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FactoryResetServer).Start(ctx, req.(*StartRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _FactoryReset_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.factory_reset.FactoryReset", - HandlerType: (*FactoryResetServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Start", - Handler: _FactoryReset_Start_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "factory_reset/factory_reset.proto", -} diff --git a/factory_reset/factory_reset_grpc.pb.go b/factory_reset/factory_reset_grpc.pb.go new file mode 100755 index 00000000..40d4c0f9 --- /dev/null +++ b/factory_reset/factory_reset_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: factory_reset/factory_reset.proto + +package factory_reset + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// FactoryResetClient is the client API for FactoryReset 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 FactoryResetClient interface { + Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) +} + +type factoryResetClient struct { + cc grpc.ClientConnInterface +} + +func NewFactoryResetClient(cc grpc.ClientConnInterface) FactoryResetClient { + return &factoryResetClient{cc} +} + +func (c *factoryResetClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { + out := new(StartResponse) + err := c.cc.Invoke(ctx, "/gnoi.factory_reset.FactoryReset/Start", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FactoryResetServer is the server API for FactoryReset service. +// All implementations must embed UnimplementedFactoryResetServer +// for forward compatibility +type FactoryResetServer interface { + Start(context.Context, *StartRequest) (*StartResponse, error) + mustEmbedUnimplementedFactoryResetServer() +} + +// UnimplementedFactoryResetServer must be embedded to have forward compatible implementations. +type UnimplementedFactoryResetServer struct { +} + +func (UnimplementedFactoryResetServer) Start(context.Context, *StartRequest) (*StartResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") +} +func (UnimplementedFactoryResetServer) mustEmbedUnimplementedFactoryResetServer() {} + +// UnsafeFactoryResetServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FactoryResetServer will +// result in compilation errors. +type UnsafeFactoryResetServer interface { + mustEmbedUnimplementedFactoryResetServer() +} + +func RegisterFactoryResetServer(s grpc.ServiceRegistrar, srv FactoryResetServer) { + s.RegisterService(&FactoryReset_ServiceDesc, srv) +} + +func _FactoryReset_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FactoryResetServer).Start(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.factory_reset.FactoryReset/Start", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FactoryResetServer).Start(ctx, req.(*StartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// FactoryReset_ServiceDesc is the grpc.ServiceDesc for FactoryReset service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var FactoryReset_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.factory_reset.FactoryReset", + HandlerType: (*FactoryResetServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Start", + Handler: _FactoryReset_Start_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "factory_reset/factory_reset.proto", +} diff --git a/file/BUILD.bazel b/file/BUILD.bazel index e200dde7..eb6ce04b 100644 --- a/file/BUILD.bazel +++ b/file/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,16 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "file_proto", srcs = ["file.proto"], @@ -48,7 +48,10 @@ cc_grpc_library( go_proto_library( name = "file_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/file", proto = ":file_proto", deps = [ diff --git a/file/file.pb.go b/file/file.pb.go index 1b283913..fe87551e 100644 --- a/file/file.pb.go +++ b/file/file.pb.go @@ -7,12 +7,8 @@ package file import ( - context "context" common "github.com/openconfig/gnoi/common" types "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1028,289 +1024,3 @@ func file_file_file_proto_init() { file_file_file_proto_goTypes = nil file_file_file_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// FileClient is the client API for File service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type FileClient interface { - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (File_GetClient, error) - TransferToRemote(ctx context.Context, in *TransferToRemoteRequest, opts ...grpc.CallOption) (*TransferToRemoteResponse, error) - Put(ctx context.Context, opts ...grpc.CallOption) (File_PutClient, error) - Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) - Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) -} - -type fileClient struct { - cc grpc.ClientConnInterface -} - -func NewFileClient(cc grpc.ClientConnInterface) FileClient { - return &fileClient{cc} -} - -func (c *fileClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (File_GetClient, error) { - stream, err := c.cc.NewStream(ctx, &_File_serviceDesc.Streams[0], "/gnoi.file.File/Get", opts...) - if err != nil { - return nil, err - } - x := &fileGetClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type File_GetClient interface { - Recv() (*GetResponse, error) - grpc.ClientStream -} - -type fileGetClient struct { - grpc.ClientStream -} - -func (x *fileGetClient) Recv() (*GetResponse, error) { - m := new(GetResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *fileClient) TransferToRemote(ctx context.Context, in *TransferToRemoteRequest, opts ...grpc.CallOption) (*TransferToRemoteResponse, error) { - out := new(TransferToRemoteResponse) - err := c.cc.Invoke(ctx, "/gnoi.file.File/TransferToRemote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *fileClient) Put(ctx context.Context, opts ...grpc.CallOption) (File_PutClient, error) { - stream, err := c.cc.NewStream(ctx, &_File_serviceDesc.Streams[1], "/gnoi.file.File/Put", opts...) - if err != nil { - return nil, err - } - x := &filePutClient{stream} - return x, nil -} - -type File_PutClient interface { - Send(*PutRequest) error - CloseAndRecv() (*PutResponse, error) - grpc.ClientStream -} - -type filePutClient struct { - grpc.ClientStream -} - -func (x *filePutClient) Send(m *PutRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *filePutClient) CloseAndRecv() (*PutResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(PutResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *fileClient) Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) { - out := new(StatResponse) - err := c.cc.Invoke(ctx, "/gnoi.file.File/Stat", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *fileClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) { - out := new(RemoveResponse) - err := c.cc.Invoke(ctx, "/gnoi.file.File/Remove", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// FileServer is the server API for File service. -type FileServer interface { - Get(*GetRequest, File_GetServer) error - TransferToRemote(context.Context, *TransferToRemoteRequest) (*TransferToRemoteResponse, error) - Put(File_PutServer) error - Stat(context.Context, *StatRequest) (*StatResponse, error) - Remove(context.Context, *RemoveRequest) (*RemoveResponse, error) -} - -// UnimplementedFileServer can be embedded to have forward compatible implementations. -type UnimplementedFileServer struct { -} - -func (*UnimplementedFileServer) Get(*GetRequest, File_GetServer) error { - return status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedFileServer) TransferToRemote(context.Context, *TransferToRemoteRequest) (*TransferToRemoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TransferToRemote not implemented") -} -func (*UnimplementedFileServer) Put(File_PutServer) error { - return status.Errorf(codes.Unimplemented, "method Put not implemented") -} -func (*UnimplementedFileServer) Stat(context.Context, *StatRequest) (*StatResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stat not implemented") -} -func (*UnimplementedFileServer) Remove(context.Context, *RemoveRequest) (*RemoveResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Remove not implemented") -} - -func RegisterFileServer(s *grpc.Server, srv FileServer) { - s.RegisterService(&_File_serviceDesc, srv) -} - -func _File_Get_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(FileServer).Get(m, &fileGetServer{stream}) -} - -type File_GetServer interface { - Send(*GetResponse) error - grpc.ServerStream -} - -type fileGetServer struct { - grpc.ServerStream -} - -func (x *fileGetServer) Send(m *GetResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _File_TransferToRemote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TransferToRemoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).TransferToRemote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.file.File/TransferToRemote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).TransferToRemote(ctx, req.(*TransferToRemoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _File_Put_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(FileServer).Put(&filePutServer{stream}) -} - -type File_PutServer interface { - SendAndClose(*PutResponse) error - Recv() (*PutRequest, error) - grpc.ServerStream -} - -type filePutServer struct { - grpc.ServerStream -} - -func (x *filePutServer) SendAndClose(m *PutResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *filePutServer) Recv() (*PutRequest, error) { - m := new(PutRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _File_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StatRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).Stat(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.file.File/Stat", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).Stat(ctx, req.(*StatRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _File_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).Remove(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.file.File/Remove", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).Remove(ctx, req.(*RemoveRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _File_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.file.File", - HandlerType: (*FileServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "TransferToRemote", - Handler: _File_TransferToRemote_Handler, - }, - { - MethodName: "Stat", - Handler: _File_Stat_Handler, - }, - { - MethodName: "Remove", - Handler: _File_Remove_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Get", - Handler: _File_Get_Handler, - ServerStreams: true, - }, - { - StreamName: "Put", - Handler: _File_Put_Handler, - ClientStreams: true, - }, - }, - Metadata: "file/file.proto", -} diff --git a/file/file_grpc.pb.go b/file/file_grpc.pb.go new file mode 100755 index 00000000..bbcb5a74 --- /dev/null +++ b/file/file_grpc.pb.go @@ -0,0 +1,311 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: file/file.proto + +package file + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// FileClient is the client API for File 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 FileClient interface { + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (File_GetClient, error) + TransferToRemote(ctx context.Context, in *TransferToRemoteRequest, opts ...grpc.CallOption) (*TransferToRemoteResponse, error) + Put(ctx context.Context, opts ...grpc.CallOption) (File_PutClient, error) + Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) + Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) +} + +type fileClient struct { + cc grpc.ClientConnInterface +} + +func NewFileClient(cc grpc.ClientConnInterface) FileClient { + return &fileClient{cc} +} + +func (c *fileClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (File_GetClient, error) { + stream, err := c.cc.NewStream(ctx, &File_ServiceDesc.Streams[0], "/gnoi.file.File/Get", opts...) + if err != nil { + return nil, err + } + x := &fileGetClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type File_GetClient interface { + Recv() (*GetResponse, error) + grpc.ClientStream +} + +type fileGetClient struct { + grpc.ClientStream +} + +func (x *fileGetClient) Recv() (*GetResponse, error) { + m := new(GetResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *fileClient) TransferToRemote(ctx context.Context, in *TransferToRemoteRequest, opts ...grpc.CallOption) (*TransferToRemoteResponse, error) { + out := new(TransferToRemoteResponse) + err := c.cc.Invoke(ctx, "/gnoi.file.File/TransferToRemote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) Put(ctx context.Context, opts ...grpc.CallOption) (File_PutClient, error) { + stream, err := c.cc.NewStream(ctx, &File_ServiceDesc.Streams[1], "/gnoi.file.File/Put", opts...) + if err != nil { + return nil, err + } + x := &filePutClient{stream} + return x, nil +} + +type File_PutClient interface { + Send(*PutRequest) error + CloseAndRecv() (*PutResponse, error) + grpc.ClientStream +} + +type filePutClient struct { + grpc.ClientStream +} + +func (x *filePutClient) Send(m *PutRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *filePutClient) CloseAndRecv() (*PutResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(PutResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *fileClient) Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) { + out := new(StatResponse) + err := c.cc.Invoke(ctx, "/gnoi.file.File/Stat", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error) { + out := new(RemoveResponse) + err := c.cc.Invoke(ctx, "/gnoi.file.File/Remove", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FileServer is the server API for File service. +// All implementations must embed UnimplementedFileServer +// for forward compatibility +type FileServer interface { + Get(*GetRequest, File_GetServer) error + TransferToRemote(context.Context, *TransferToRemoteRequest) (*TransferToRemoteResponse, error) + Put(File_PutServer) error + Stat(context.Context, *StatRequest) (*StatResponse, error) + Remove(context.Context, *RemoveRequest) (*RemoveResponse, error) + mustEmbedUnimplementedFileServer() +} + +// UnimplementedFileServer must be embedded to have forward compatible implementations. +type UnimplementedFileServer struct { +} + +func (UnimplementedFileServer) Get(*GetRequest, File_GetServer) error { + return status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedFileServer) TransferToRemote(context.Context, *TransferToRemoteRequest) (*TransferToRemoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TransferToRemote not implemented") +} +func (UnimplementedFileServer) Put(File_PutServer) error { + return status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (UnimplementedFileServer) Stat(context.Context, *StatRequest) (*StatResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stat not implemented") +} +func (UnimplementedFileServer) Remove(context.Context, *RemoveRequest) (*RemoveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Remove not implemented") +} +func (UnimplementedFileServer) mustEmbedUnimplementedFileServer() {} + +// UnsafeFileServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FileServer will +// result in compilation errors. +type UnsafeFileServer interface { + mustEmbedUnimplementedFileServer() +} + +func RegisterFileServer(s grpc.ServiceRegistrar, srv FileServer) { + s.RegisterService(&File_ServiceDesc, srv) +} + +func _File_Get_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(FileServer).Get(m, &fileGetServer{stream}) +} + +type File_GetServer interface { + Send(*GetResponse) error + grpc.ServerStream +} + +type fileGetServer struct { + grpc.ServerStream +} + +func (x *fileGetServer) Send(m *GetResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _File_TransferToRemote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TransferToRemoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).TransferToRemote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.file.File/TransferToRemote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).TransferToRemote(ctx, req.(*TransferToRemoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_Put_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(FileServer).Put(&filePutServer{stream}) +} + +type File_PutServer interface { + SendAndClose(*PutResponse) error + Recv() (*PutRequest, error) + grpc.ServerStream +} + +type filePutServer struct { + grpc.ServerStream +} + +func (x *filePutServer) SendAndClose(m *PutResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *filePutServer) Recv() (*PutRequest, error) { + m := new(PutRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _File_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).Stat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.file.File/Stat", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).Stat(ctx, req.(*StatRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).Remove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.file.File/Remove", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).Remove(ctx, req.(*RemoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// File_ServiceDesc is the grpc.ServiceDesc for File service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var File_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.file.File", + HandlerType: (*FileServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "TransferToRemote", + Handler: _File_TransferToRemote_Handler, + }, + { + MethodName: "Stat", + Handler: _File_Stat_Handler, + }, + { + MethodName: "Remove", + Handler: _File_Remove_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Get", + Handler: _File_Get_Handler, + ServerStreams: true, + }, + { + StreamName: "Put", + Handler: _File_Put_Handler, + ClientStreams: true, + }, + }, + Metadata: "file/file.proto", +} diff --git a/healthz/BUILD.bazel b/healthz/BUILD.bazel index 932a63eb..b6b2d5d4 100644 --- a/healthz/BUILD.bazel +++ b/healthz/BUILD.bazel @@ -2,6 +2,8 @@ load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -16,13 +18,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "healthz_proto", srcs = ["healthz.proto"], @@ -36,7 +39,10 @@ proto_library( go_proto_library( name = "healthz_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/healthz", proto = ":healthz_proto", deps = [ diff --git a/healthz/healthz.pb.go b/healthz/healthz.pb.go index a07a4a4e..2111bd28 100644 --- a/healthz/healthz.pb.go +++ b/healthz/healthz.pb.go @@ -7,11 +7,7 @@ package healthz import ( - context "context" types "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" @@ -1450,255 +1446,3 @@ func file_healthz_healthz_proto_init() { file_healthz_healthz_proto_goTypes = nil file_healthz_healthz_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// HealthzClient is the client API for Healthz service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type HealthzClient interface { - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) - Acknowledge(ctx context.Context, in *AcknowledgeRequest, opts ...grpc.CallOption) (*AcknowledgeResponse, error) - Artifact(ctx context.Context, in *ArtifactRequest, opts ...grpc.CallOption) (Healthz_ArtifactClient, error) - Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) -} - -type healthzClient struct { - cc grpc.ClientConnInterface -} - -func NewHealthzClient(cc grpc.ClientConnInterface) HealthzClient { - return &healthzClient{cc} -} - -func (c *healthzClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { - out := new(GetResponse) - err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/Get", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *healthzClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { - out := new(ListResponse) - err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/List", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *healthzClient) Acknowledge(ctx context.Context, in *AcknowledgeRequest, opts ...grpc.CallOption) (*AcknowledgeResponse, error) { - out := new(AcknowledgeResponse) - err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/Acknowledge", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *healthzClient) Artifact(ctx context.Context, in *ArtifactRequest, opts ...grpc.CallOption) (Healthz_ArtifactClient, error) { - stream, err := c.cc.NewStream(ctx, &_Healthz_serviceDesc.Streams[0], "/gnoi.healthz.Healthz/Artifact", opts...) - if err != nil { - return nil, err - } - x := &healthzArtifactClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Healthz_ArtifactClient interface { - Recv() (*ArtifactResponse, error) - grpc.ClientStream -} - -type healthzArtifactClient struct { - grpc.ClientStream -} - -func (x *healthzArtifactClient) Recv() (*ArtifactResponse, error) { - m := new(ArtifactResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *healthzClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) { - out := new(CheckResponse) - err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/Check", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// HealthzServer is the server API for Healthz service. -type HealthzServer interface { - Get(context.Context, *GetRequest) (*GetResponse, error) - List(context.Context, *ListRequest) (*ListResponse, error) - Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error) - Artifact(*ArtifactRequest, Healthz_ArtifactServer) error - Check(context.Context, *CheckRequest) (*CheckResponse, error) -} - -// UnimplementedHealthzServer can be embedded to have forward compatible implementations. -type UnimplementedHealthzServer struct { -} - -func (*UnimplementedHealthzServer) Get(context.Context, *GetRequest) (*GetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (*UnimplementedHealthzServer) List(context.Context, *ListRequest) (*ListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method List not implemented") -} -func (*UnimplementedHealthzServer) Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Acknowledge not implemented") -} -func (*UnimplementedHealthzServer) Artifact(*ArtifactRequest, Healthz_ArtifactServer) error { - return status.Errorf(codes.Unimplemented, "method Artifact not implemented") -} -func (*UnimplementedHealthzServer) Check(context.Context, *CheckRequest) (*CheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") -} - -func RegisterHealthzServer(s *grpc.Server, srv HealthzServer) { - s.RegisterService(&_Healthz_serviceDesc, srv) -} - -func _Healthz_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.(HealthzServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.healthz.Healthz/Get", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HealthzServer).Get(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Healthz_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HealthzServer).List(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.healthz.Healthz/List", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HealthzServer).List(ctx, req.(*ListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Healthz_Acknowledge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AcknowledgeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HealthzServer).Acknowledge(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.healthz.Healthz/Acknowledge", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HealthzServer).Acknowledge(ctx, req.(*AcknowledgeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Healthz_Artifact_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ArtifactRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(HealthzServer).Artifact(m, &healthzArtifactServer{stream}) -} - -type Healthz_ArtifactServer interface { - Send(*ArtifactResponse) error - grpc.ServerStream -} - -type healthzArtifactServer struct { - grpc.ServerStream -} - -func (x *healthzArtifactServer) Send(m *ArtifactResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Healthz_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HealthzServer).Check(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.healthz.Healthz/Check", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HealthzServer).Check(ctx, req.(*CheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Healthz_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.healthz.Healthz", - HandlerType: (*HealthzServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Get", - Handler: _Healthz_Get_Handler, - }, - { - MethodName: "List", - Handler: _Healthz_List_Handler, - }, - { - MethodName: "Acknowledge", - Handler: _Healthz_Acknowledge_Handler, - }, - { - MethodName: "Check", - Handler: _Healthz_Check_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Artifact", - Handler: _Healthz_Artifact_Handler, - ServerStreams: true, - }, - }, - Metadata: "healthz/healthz.proto", -} diff --git a/healthz/healthz_grpc.pb.go b/healthz/healthz_grpc.pb.go new file mode 100755 index 00000000..e0cd6465 --- /dev/null +++ b/healthz/healthz_grpc.pb.go @@ -0,0 +1,277 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: healthz/healthz.proto + +package healthz + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// HealthzClient is the client API for Healthz 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 HealthzClient interface { + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + Acknowledge(ctx context.Context, in *AcknowledgeRequest, opts ...grpc.CallOption) (*AcknowledgeResponse, error) + Artifact(ctx context.Context, in *ArtifactRequest, opts ...grpc.CallOption) (Healthz_ArtifactClient, error) + Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) +} + +type healthzClient struct { + cc grpc.ClientConnInterface +} + +func NewHealthzClient(cc grpc.ClientConnInterface) HealthzClient { + return &healthzClient{cc} +} + +func (c *healthzClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + out := new(GetResponse) + err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *healthzClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { + out := new(ListResponse) + err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *healthzClient) Acknowledge(ctx context.Context, in *AcknowledgeRequest, opts ...grpc.CallOption) (*AcknowledgeResponse, error) { + out := new(AcknowledgeResponse) + err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/Acknowledge", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *healthzClient) Artifact(ctx context.Context, in *ArtifactRequest, opts ...grpc.CallOption) (Healthz_ArtifactClient, error) { + stream, err := c.cc.NewStream(ctx, &Healthz_ServiceDesc.Streams[0], "/gnoi.healthz.Healthz/Artifact", opts...) + if err != nil { + return nil, err + } + x := &healthzArtifactClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Healthz_ArtifactClient interface { + Recv() (*ArtifactResponse, error) + grpc.ClientStream +} + +type healthzArtifactClient struct { + grpc.ClientStream +} + +func (x *healthzArtifactClient) Recv() (*ArtifactResponse, error) { + m := new(ArtifactResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *healthzClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) { + out := new(CheckResponse) + err := c.cc.Invoke(ctx, "/gnoi.healthz.Healthz/Check", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HealthzServer is the server API for Healthz service. +// All implementations must embed UnimplementedHealthzServer +// for forward compatibility +type HealthzServer interface { + Get(context.Context, *GetRequest) (*GetResponse, error) + List(context.Context, *ListRequest) (*ListResponse, error) + Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error) + Artifact(*ArtifactRequest, Healthz_ArtifactServer) error + Check(context.Context, *CheckRequest) (*CheckResponse, error) + mustEmbedUnimplementedHealthzServer() +} + +// UnimplementedHealthzServer must be embedded to have forward compatible implementations. +type UnimplementedHealthzServer struct { +} + +func (UnimplementedHealthzServer) Get(context.Context, *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedHealthzServer) List(context.Context, *ListRequest) (*ListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (UnimplementedHealthzServer) Acknowledge(context.Context, *AcknowledgeRequest) (*AcknowledgeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Acknowledge not implemented") +} +func (UnimplementedHealthzServer) Artifact(*ArtifactRequest, Healthz_ArtifactServer) error { + return status.Errorf(codes.Unimplemented, "method Artifact not implemented") +} +func (UnimplementedHealthzServer) Check(context.Context, *CheckRequest) (*CheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") +} +func (UnimplementedHealthzServer) mustEmbedUnimplementedHealthzServer() {} + +// UnsafeHealthzServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to HealthzServer will +// result in compilation errors. +type UnsafeHealthzServer interface { + mustEmbedUnimplementedHealthzServer() +} + +func RegisterHealthzServer(s grpc.ServiceRegistrar, srv HealthzServer) { + s.RegisterService(&Healthz_ServiceDesc, srv) +} + +func _Healthz_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.(HealthzServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.healthz.Healthz/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthzServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Healthz_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HealthzServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.healthz.Healthz/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthzServer).List(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Healthz_Acknowledge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AcknowledgeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HealthzServer).Acknowledge(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.healthz.Healthz/Acknowledge", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthzServer).Acknowledge(ctx, req.(*AcknowledgeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Healthz_Artifact_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ArtifactRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(HealthzServer).Artifact(m, &healthzArtifactServer{stream}) +} + +type Healthz_ArtifactServer interface { + Send(*ArtifactResponse) error + grpc.ServerStream +} + +type healthzArtifactServer struct { + grpc.ServerStream +} + +func (x *healthzArtifactServer) Send(m *ArtifactResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Healthz_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HealthzServer).Check(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.healthz.Healthz/Check", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthzServer).Check(ctx, req.(*CheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Healthz_ServiceDesc is the grpc.ServiceDesc for Healthz service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Healthz_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.healthz.Healthz", + HandlerType: (*HealthzServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Get", + Handler: _Healthz_Get_Handler, + }, + { + MethodName: "List", + Handler: _Healthz_List_Handler, + }, + { + MethodName: "Acknowledge", + Handler: _Healthz_Acknowledge_Handler, + }, + { + MethodName: "Check", + Handler: _Healthz_Check_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Artifact", + Handler: _Healthz_Artifact_Handler, + ServerStreams: true, + }, + }, + Metadata: "healthz/healthz.proto", +} diff --git a/layer2/BUILD.bazel b/layer2/BUILD.bazel index 0837495e..4715f6c6 100644 --- a/layer2/BUILD.bazel +++ b/layer2/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,16 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "layer2_proto", srcs = ["layer2.proto"], @@ -45,7 +45,10 @@ cc_grpc_library( go_proto_library( name = "layer2_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/layer2", proto = ":layer2_proto", deps = ["//types"], diff --git a/layer2/layer2.pb.go b/layer2/layer2.pb.go index 7414bee3..92cfe0aa 100644 --- a/layer2/layer2.pb.go +++ b/layer2/layer2.pb.go @@ -7,11 +7,7 @@ package layer2 import ( - context "context" types "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -889,255 +885,3 @@ func file_layer2_layer2_proto_init() { file_layer2_layer2_proto_goTypes = nil file_layer2_layer2_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// Layer2Client is the client API for Layer2 service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type Layer2Client interface { - ClearNeighborDiscovery(ctx context.Context, in *ClearNeighborDiscoveryRequest, opts ...grpc.CallOption) (*ClearNeighborDiscoveryResponse, error) - ClearSpanningTree(ctx context.Context, in *ClearSpanningTreeRequest, opts ...grpc.CallOption) (*ClearSpanningTreeResponse, error) - PerformBERT(ctx context.Context, in *PerformBERTRequest, opts ...grpc.CallOption) (Layer2_PerformBERTClient, error) - ClearLLDPInterface(ctx context.Context, in *ClearLLDPInterfaceRequest, opts ...grpc.CallOption) (*ClearLLDPInterfaceResponse, error) - SendWakeOnLAN(ctx context.Context, in *SendWakeOnLANRequest, opts ...grpc.CallOption) (*SendWakeOnLANResponse, error) -} - -type layer2Client struct { - cc grpc.ClientConnInterface -} - -func NewLayer2Client(cc grpc.ClientConnInterface) Layer2Client { - return &layer2Client{cc} -} - -func (c *layer2Client) ClearNeighborDiscovery(ctx context.Context, in *ClearNeighborDiscoveryRequest, opts ...grpc.CallOption) (*ClearNeighborDiscoveryResponse, error) { - out := new(ClearNeighborDiscoveryResponse) - err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/ClearNeighborDiscovery", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *layer2Client) ClearSpanningTree(ctx context.Context, in *ClearSpanningTreeRequest, opts ...grpc.CallOption) (*ClearSpanningTreeResponse, error) { - out := new(ClearSpanningTreeResponse) - err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/ClearSpanningTree", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *layer2Client) PerformBERT(ctx context.Context, in *PerformBERTRequest, opts ...grpc.CallOption) (Layer2_PerformBERTClient, error) { - stream, err := c.cc.NewStream(ctx, &_Layer2_serviceDesc.Streams[0], "/gnoi.layer2.Layer2/PerformBERT", opts...) - if err != nil { - return nil, err - } - x := &layer2PerformBERTClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Layer2_PerformBERTClient interface { - Recv() (*PerformBERTResponse, error) - grpc.ClientStream -} - -type layer2PerformBERTClient struct { - grpc.ClientStream -} - -func (x *layer2PerformBERTClient) Recv() (*PerformBERTResponse, error) { - m := new(PerformBERTResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *layer2Client) ClearLLDPInterface(ctx context.Context, in *ClearLLDPInterfaceRequest, opts ...grpc.CallOption) (*ClearLLDPInterfaceResponse, error) { - out := new(ClearLLDPInterfaceResponse) - err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/ClearLLDPInterface", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *layer2Client) SendWakeOnLAN(ctx context.Context, in *SendWakeOnLANRequest, opts ...grpc.CallOption) (*SendWakeOnLANResponse, error) { - out := new(SendWakeOnLANResponse) - err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/SendWakeOnLAN", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Layer2Server is the server API for Layer2 service. -type Layer2Server interface { - ClearNeighborDiscovery(context.Context, *ClearNeighborDiscoveryRequest) (*ClearNeighborDiscoveryResponse, error) - ClearSpanningTree(context.Context, *ClearSpanningTreeRequest) (*ClearSpanningTreeResponse, error) - PerformBERT(*PerformBERTRequest, Layer2_PerformBERTServer) error - ClearLLDPInterface(context.Context, *ClearLLDPInterfaceRequest) (*ClearLLDPInterfaceResponse, error) - SendWakeOnLAN(context.Context, *SendWakeOnLANRequest) (*SendWakeOnLANResponse, error) -} - -// UnimplementedLayer2Server can be embedded to have forward compatible implementations. -type UnimplementedLayer2Server struct { -} - -func (*UnimplementedLayer2Server) ClearNeighborDiscovery(context.Context, *ClearNeighborDiscoveryRequest) (*ClearNeighborDiscoveryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearNeighborDiscovery not implemented") -} -func (*UnimplementedLayer2Server) ClearSpanningTree(context.Context, *ClearSpanningTreeRequest) (*ClearSpanningTreeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearSpanningTree not implemented") -} -func (*UnimplementedLayer2Server) PerformBERT(*PerformBERTRequest, Layer2_PerformBERTServer) error { - return status.Errorf(codes.Unimplemented, "method PerformBERT not implemented") -} -func (*UnimplementedLayer2Server) ClearLLDPInterface(context.Context, *ClearLLDPInterfaceRequest) (*ClearLLDPInterfaceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearLLDPInterface not implemented") -} -func (*UnimplementedLayer2Server) SendWakeOnLAN(context.Context, *SendWakeOnLANRequest) (*SendWakeOnLANResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendWakeOnLAN not implemented") -} - -func RegisterLayer2Server(s *grpc.Server, srv Layer2Server) { - s.RegisterService(&_Layer2_serviceDesc, srv) -} - -func _Layer2_ClearNeighborDiscovery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearNeighborDiscoveryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(Layer2Server).ClearNeighborDiscovery(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.layer2.Layer2/ClearNeighborDiscovery", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(Layer2Server).ClearNeighborDiscovery(ctx, req.(*ClearNeighborDiscoveryRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Layer2_ClearSpanningTree_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearSpanningTreeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(Layer2Server).ClearSpanningTree(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.layer2.Layer2/ClearSpanningTree", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(Layer2Server).ClearSpanningTree(ctx, req.(*ClearSpanningTreeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Layer2_PerformBERT_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(PerformBERTRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(Layer2Server).PerformBERT(m, &layer2PerformBERTServer{stream}) -} - -type Layer2_PerformBERTServer interface { - Send(*PerformBERTResponse) error - grpc.ServerStream -} - -type layer2PerformBERTServer struct { - grpc.ServerStream -} - -func (x *layer2PerformBERTServer) Send(m *PerformBERTResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Layer2_ClearLLDPInterface_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearLLDPInterfaceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(Layer2Server).ClearLLDPInterface(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.layer2.Layer2/ClearLLDPInterface", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(Layer2Server).ClearLLDPInterface(ctx, req.(*ClearLLDPInterfaceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Layer2_SendWakeOnLAN_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SendWakeOnLANRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(Layer2Server).SendWakeOnLAN(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.layer2.Layer2/SendWakeOnLAN", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(Layer2Server).SendWakeOnLAN(ctx, req.(*SendWakeOnLANRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Layer2_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.layer2.Layer2", - HandlerType: (*Layer2Server)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ClearNeighborDiscovery", - Handler: _Layer2_ClearNeighborDiscovery_Handler, - }, - { - MethodName: "ClearSpanningTree", - Handler: _Layer2_ClearSpanningTree_Handler, - }, - { - MethodName: "ClearLLDPInterface", - Handler: _Layer2_ClearLLDPInterface_Handler, - }, - { - MethodName: "SendWakeOnLAN", - Handler: _Layer2_SendWakeOnLAN_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "PerformBERT", - Handler: _Layer2_PerformBERT_Handler, - ServerStreams: true, - }, - }, - Metadata: "layer2/layer2.proto", -} diff --git a/layer2/layer2_grpc.pb.go b/layer2/layer2_grpc.pb.go new file mode 100755 index 00000000..1690a8c5 --- /dev/null +++ b/layer2/layer2_grpc.pb.go @@ -0,0 +1,277 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: layer2/layer2.proto + +package layer2 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// Layer2Client is the client API for Layer2 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 Layer2Client interface { + ClearNeighborDiscovery(ctx context.Context, in *ClearNeighborDiscoveryRequest, opts ...grpc.CallOption) (*ClearNeighborDiscoveryResponse, error) + ClearSpanningTree(ctx context.Context, in *ClearSpanningTreeRequest, opts ...grpc.CallOption) (*ClearSpanningTreeResponse, error) + PerformBERT(ctx context.Context, in *PerformBERTRequest, opts ...grpc.CallOption) (Layer2_PerformBERTClient, error) + ClearLLDPInterface(ctx context.Context, in *ClearLLDPInterfaceRequest, opts ...grpc.CallOption) (*ClearLLDPInterfaceResponse, error) + SendWakeOnLAN(ctx context.Context, in *SendWakeOnLANRequest, opts ...grpc.CallOption) (*SendWakeOnLANResponse, error) +} + +type layer2Client struct { + cc grpc.ClientConnInterface +} + +func NewLayer2Client(cc grpc.ClientConnInterface) Layer2Client { + return &layer2Client{cc} +} + +func (c *layer2Client) ClearNeighborDiscovery(ctx context.Context, in *ClearNeighborDiscoveryRequest, opts ...grpc.CallOption) (*ClearNeighborDiscoveryResponse, error) { + out := new(ClearNeighborDiscoveryResponse) + err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/ClearNeighborDiscovery", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *layer2Client) ClearSpanningTree(ctx context.Context, in *ClearSpanningTreeRequest, opts ...grpc.CallOption) (*ClearSpanningTreeResponse, error) { + out := new(ClearSpanningTreeResponse) + err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/ClearSpanningTree", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *layer2Client) PerformBERT(ctx context.Context, in *PerformBERTRequest, opts ...grpc.CallOption) (Layer2_PerformBERTClient, error) { + stream, err := c.cc.NewStream(ctx, &Layer2_ServiceDesc.Streams[0], "/gnoi.layer2.Layer2/PerformBERT", opts...) + if err != nil { + return nil, err + } + x := &layer2PerformBERTClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Layer2_PerformBERTClient interface { + Recv() (*PerformBERTResponse, error) + grpc.ClientStream +} + +type layer2PerformBERTClient struct { + grpc.ClientStream +} + +func (x *layer2PerformBERTClient) Recv() (*PerformBERTResponse, error) { + m := new(PerformBERTResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *layer2Client) ClearLLDPInterface(ctx context.Context, in *ClearLLDPInterfaceRequest, opts ...grpc.CallOption) (*ClearLLDPInterfaceResponse, error) { + out := new(ClearLLDPInterfaceResponse) + err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/ClearLLDPInterface", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *layer2Client) SendWakeOnLAN(ctx context.Context, in *SendWakeOnLANRequest, opts ...grpc.CallOption) (*SendWakeOnLANResponse, error) { + out := new(SendWakeOnLANResponse) + err := c.cc.Invoke(ctx, "/gnoi.layer2.Layer2/SendWakeOnLAN", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Layer2Server is the server API for Layer2 service. +// All implementations must embed UnimplementedLayer2Server +// for forward compatibility +type Layer2Server interface { + ClearNeighborDiscovery(context.Context, *ClearNeighborDiscoveryRequest) (*ClearNeighborDiscoveryResponse, error) + ClearSpanningTree(context.Context, *ClearSpanningTreeRequest) (*ClearSpanningTreeResponse, error) + PerformBERT(*PerformBERTRequest, Layer2_PerformBERTServer) error + ClearLLDPInterface(context.Context, *ClearLLDPInterfaceRequest) (*ClearLLDPInterfaceResponse, error) + SendWakeOnLAN(context.Context, *SendWakeOnLANRequest) (*SendWakeOnLANResponse, error) + mustEmbedUnimplementedLayer2Server() +} + +// UnimplementedLayer2Server must be embedded to have forward compatible implementations. +type UnimplementedLayer2Server struct { +} + +func (UnimplementedLayer2Server) ClearNeighborDiscovery(context.Context, *ClearNeighborDiscoveryRequest) (*ClearNeighborDiscoveryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearNeighborDiscovery not implemented") +} +func (UnimplementedLayer2Server) ClearSpanningTree(context.Context, *ClearSpanningTreeRequest) (*ClearSpanningTreeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearSpanningTree not implemented") +} +func (UnimplementedLayer2Server) PerformBERT(*PerformBERTRequest, Layer2_PerformBERTServer) error { + return status.Errorf(codes.Unimplemented, "method PerformBERT not implemented") +} +func (UnimplementedLayer2Server) ClearLLDPInterface(context.Context, *ClearLLDPInterfaceRequest) (*ClearLLDPInterfaceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearLLDPInterface not implemented") +} +func (UnimplementedLayer2Server) SendWakeOnLAN(context.Context, *SendWakeOnLANRequest) (*SendWakeOnLANResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendWakeOnLAN not implemented") +} +func (UnimplementedLayer2Server) mustEmbedUnimplementedLayer2Server() {} + +// UnsafeLayer2Server may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to Layer2Server will +// result in compilation errors. +type UnsafeLayer2Server interface { + mustEmbedUnimplementedLayer2Server() +} + +func RegisterLayer2Server(s grpc.ServiceRegistrar, srv Layer2Server) { + s.RegisterService(&Layer2_ServiceDesc, srv) +} + +func _Layer2_ClearNeighborDiscovery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearNeighborDiscoveryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(Layer2Server).ClearNeighborDiscovery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.layer2.Layer2/ClearNeighborDiscovery", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(Layer2Server).ClearNeighborDiscovery(ctx, req.(*ClearNeighborDiscoveryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Layer2_ClearSpanningTree_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearSpanningTreeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(Layer2Server).ClearSpanningTree(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.layer2.Layer2/ClearSpanningTree", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(Layer2Server).ClearSpanningTree(ctx, req.(*ClearSpanningTreeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Layer2_PerformBERT_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(PerformBERTRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(Layer2Server).PerformBERT(m, &layer2PerformBERTServer{stream}) +} + +type Layer2_PerformBERTServer interface { + Send(*PerformBERTResponse) error + grpc.ServerStream +} + +type layer2PerformBERTServer struct { + grpc.ServerStream +} + +func (x *layer2PerformBERTServer) Send(m *PerformBERTResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Layer2_ClearLLDPInterface_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearLLDPInterfaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(Layer2Server).ClearLLDPInterface(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.layer2.Layer2/ClearLLDPInterface", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(Layer2Server).ClearLLDPInterface(ctx, req.(*ClearLLDPInterfaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Layer2_SendWakeOnLAN_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendWakeOnLANRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(Layer2Server).SendWakeOnLAN(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.layer2.Layer2/SendWakeOnLAN", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(Layer2Server).SendWakeOnLAN(ctx, req.(*SendWakeOnLANRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Layer2_ServiceDesc is the grpc.ServiceDesc for Layer2 service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Layer2_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.layer2.Layer2", + HandlerType: (*Layer2Server)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ClearNeighborDiscovery", + Handler: _Layer2_ClearNeighborDiscovery_Handler, + }, + { + MethodName: "ClearSpanningTree", + Handler: _Layer2_ClearSpanningTree_Handler, + }, + { + MethodName: "ClearLLDPInterface", + Handler: _Layer2_ClearLLDPInterface_Handler, + }, + { + MethodName: "SendWakeOnLAN", + Handler: _Layer2_SendWakeOnLAN_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "PerformBERT", + Handler: _Layer2_PerformBERT_Handler, + ServerStreams: true, + }, + }, + Metadata: "layer2/layer2.proto", +} diff --git a/mpls/BUILD.bazel b/mpls/BUILD.bazel index 9f9340ff..3406775e 100644 --- a/mpls/BUILD.bazel +++ b/mpls/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,16 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "mpls_proto", srcs = ["mpls.proto"], @@ -45,7 +45,10 @@ cc_grpc_library( go_proto_library( name = "mpls_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/mpls", proto = ":mpls_proto", deps = ["//types"], diff --git a/mpls/mpls.pb.go b/mpls/mpls.pb.go index b669403b..d87f09ce 100644 --- a/mpls/mpls.pb.go +++ b/mpls/mpls.pb.go @@ -7,11 +7,7 @@ package mpls import ( - context "context" _ "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -972,183 +968,3 @@ func file_mpls_mpls_proto_init() { file_mpls_mpls_proto_goTypes = nil file_mpls_mpls_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// MPLSClient is the client API for MPLS service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MPLSClient interface { - ClearLSP(ctx context.Context, in *ClearLSPRequest, opts ...grpc.CallOption) (*ClearLSPResponse, error) - ClearLSPCounters(ctx context.Context, in *ClearLSPCountersRequest, opts ...grpc.CallOption) (*ClearLSPCountersResponse, error) - MPLSPing(ctx context.Context, in *MPLSPingRequest, opts ...grpc.CallOption) (MPLS_MPLSPingClient, error) -} - -type mPLSClient struct { - cc grpc.ClientConnInterface -} - -func NewMPLSClient(cc grpc.ClientConnInterface) MPLSClient { - return &mPLSClient{cc} -} - -func (c *mPLSClient) ClearLSP(ctx context.Context, in *ClearLSPRequest, opts ...grpc.CallOption) (*ClearLSPResponse, error) { - out := new(ClearLSPResponse) - err := c.cc.Invoke(ctx, "/gnoi.mpls.MPLS/ClearLSP", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *mPLSClient) ClearLSPCounters(ctx context.Context, in *ClearLSPCountersRequest, opts ...grpc.CallOption) (*ClearLSPCountersResponse, error) { - out := new(ClearLSPCountersResponse) - err := c.cc.Invoke(ctx, "/gnoi.mpls.MPLS/ClearLSPCounters", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *mPLSClient) MPLSPing(ctx context.Context, in *MPLSPingRequest, opts ...grpc.CallOption) (MPLS_MPLSPingClient, error) { - stream, err := c.cc.NewStream(ctx, &_MPLS_serviceDesc.Streams[0], "/gnoi.mpls.MPLS/MPLSPing", opts...) - if err != nil { - return nil, err - } - x := &mPLSMPLSPingClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type MPLS_MPLSPingClient interface { - Recv() (*MPLSPingResponse, error) - grpc.ClientStream -} - -type mPLSMPLSPingClient struct { - grpc.ClientStream -} - -func (x *mPLSMPLSPingClient) Recv() (*MPLSPingResponse, error) { - m := new(MPLSPingResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// MPLSServer is the server API for MPLS service. -type MPLSServer interface { - ClearLSP(context.Context, *ClearLSPRequest) (*ClearLSPResponse, error) - ClearLSPCounters(context.Context, *ClearLSPCountersRequest) (*ClearLSPCountersResponse, error) - MPLSPing(*MPLSPingRequest, MPLS_MPLSPingServer) error -} - -// UnimplementedMPLSServer can be embedded to have forward compatible implementations. -type UnimplementedMPLSServer struct { -} - -func (*UnimplementedMPLSServer) ClearLSP(context.Context, *ClearLSPRequest) (*ClearLSPResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearLSP not implemented") -} -func (*UnimplementedMPLSServer) ClearLSPCounters(context.Context, *ClearLSPCountersRequest) (*ClearLSPCountersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClearLSPCounters not implemented") -} -func (*UnimplementedMPLSServer) MPLSPing(*MPLSPingRequest, MPLS_MPLSPingServer) error { - return status.Errorf(codes.Unimplemented, "method MPLSPing not implemented") -} - -func RegisterMPLSServer(s *grpc.Server, srv MPLSServer) { - s.RegisterService(&_MPLS_serviceDesc, srv) -} - -func _MPLS_ClearLSP_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearLSPRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MPLSServer).ClearLSP(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.mpls.MPLS/ClearLSP", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MPLSServer).ClearLSP(ctx, req.(*ClearLSPRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _MPLS_ClearLSPCounters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ClearLSPCountersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MPLSServer).ClearLSPCounters(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.mpls.MPLS/ClearLSPCounters", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MPLSServer).ClearLSPCounters(ctx, req.(*ClearLSPCountersRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _MPLS_MPLSPing_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(MPLSPingRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(MPLSServer).MPLSPing(m, &mPLSMPLSPingServer{stream}) -} - -type MPLS_MPLSPingServer interface { - Send(*MPLSPingResponse) error - grpc.ServerStream -} - -type mPLSMPLSPingServer struct { - grpc.ServerStream -} - -func (x *mPLSMPLSPingServer) Send(m *MPLSPingResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _MPLS_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.mpls.MPLS", - HandlerType: (*MPLSServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ClearLSP", - Handler: _MPLS_ClearLSP_Handler, - }, - { - MethodName: "ClearLSPCounters", - Handler: _MPLS_ClearLSPCounters_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "MPLSPing", - Handler: _MPLS_MPLSPing_Handler, - ServerStreams: true, - }, - }, - Metadata: "mpls/mpls.proto", -} diff --git a/mpls/mpls.proto b/mpls/mpls.proto index 0c3b308b..fe7136e5 100644 --- a/mpls/mpls.proto +++ b/mpls/mpls.proto @@ -12,7 +12,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; diff --git a/mpls/mpls_grpc.pb.go b/mpls/mpls_grpc.pb.go new file mode 100755 index 00000000..8d354e0f --- /dev/null +++ b/mpls/mpls_grpc.pb.go @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: mpls/mpls.proto + +package mpls + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// MPLSClient is the client API for MPLS 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 MPLSClient interface { + ClearLSP(ctx context.Context, in *ClearLSPRequest, opts ...grpc.CallOption) (*ClearLSPResponse, error) + ClearLSPCounters(ctx context.Context, in *ClearLSPCountersRequest, opts ...grpc.CallOption) (*ClearLSPCountersResponse, error) + MPLSPing(ctx context.Context, in *MPLSPingRequest, opts ...grpc.CallOption) (MPLS_MPLSPingClient, error) +} + +type mPLSClient struct { + cc grpc.ClientConnInterface +} + +func NewMPLSClient(cc grpc.ClientConnInterface) MPLSClient { + return &mPLSClient{cc} +} + +func (c *mPLSClient) ClearLSP(ctx context.Context, in *ClearLSPRequest, opts ...grpc.CallOption) (*ClearLSPResponse, error) { + out := new(ClearLSPResponse) + err := c.cc.Invoke(ctx, "/gnoi.mpls.MPLS/ClearLSP", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *mPLSClient) ClearLSPCounters(ctx context.Context, in *ClearLSPCountersRequest, opts ...grpc.CallOption) (*ClearLSPCountersResponse, error) { + out := new(ClearLSPCountersResponse) + err := c.cc.Invoke(ctx, "/gnoi.mpls.MPLS/ClearLSPCounters", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *mPLSClient) MPLSPing(ctx context.Context, in *MPLSPingRequest, opts ...grpc.CallOption) (MPLS_MPLSPingClient, error) { + stream, err := c.cc.NewStream(ctx, &MPLS_ServiceDesc.Streams[0], "/gnoi.mpls.MPLS/MPLSPing", opts...) + if err != nil { + return nil, err + } + x := &mPLSMPLSPingClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type MPLS_MPLSPingClient interface { + Recv() (*MPLSPingResponse, error) + grpc.ClientStream +} + +type mPLSMPLSPingClient struct { + grpc.ClientStream +} + +func (x *mPLSMPLSPingClient) Recv() (*MPLSPingResponse, error) { + m := new(MPLSPingResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// MPLSServer is the server API for MPLS service. +// All implementations must embed UnimplementedMPLSServer +// for forward compatibility +type MPLSServer interface { + ClearLSP(context.Context, *ClearLSPRequest) (*ClearLSPResponse, error) + ClearLSPCounters(context.Context, *ClearLSPCountersRequest) (*ClearLSPCountersResponse, error) + MPLSPing(*MPLSPingRequest, MPLS_MPLSPingServer) error + mustEmbedUnimplementedMPLSServer() +} + +// UnimplementedMPLSServer must be embedded to have forward compatible implementations. +type UnimplementedMPLSServer struct { +} + +func (UnimplementedMPLSServer) ClearLSP(context.Context, *ClearLSPRequest) (*ClearLSPResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearLSP not implemented") +} +func (UnimplementedMPLSServer) ClearLSPCounters(context.Context, *ClearLSPCountersRequest) (*ClearLSPCountersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearLSPCounters not implemented") +} +func (UnimplementedMPLSServer) MPLSPing(*MPLSPingRequest, MPLS_MPLSPingServer) error { + return status.Errorf(codes.Unimplemented, "method MPLSPing not implemented") +} +func (UnimplementedMPLSServer) mustEmbedUnimplementedMPLSServer() {} + +// UnsafeMPLSServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MPLSServer will +// result in compilation errors. +type UnsafeMPLSServer interface { + mustEmbedUnimplementedMPLSServer() +} + +func RegisterMPLSServer(s grpc.ServiceRegistrar, srv MPLSServer) { + s.RegisterService(&MPLS_ServiceDesc, srv) +} + +func _MPLS_ClearLSP_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearLSPRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MPLSServer).ClearLSP(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.mpls.MPLS/ClearLSP", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MPLSServer).ClearLSP(ctx, req.(*ClearLSPRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _MPLS_ClearLSPCounters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearLSPCountersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MPLSServer).ClearLSPCounters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.mpls.MPLS/ClearLSPCounters", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MPLSServer).ClearLSPCounters(ctx, req.(*ClearLSPCountersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _MPLS_MPLSPing_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(MPLSPingRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(MPLSServer).MPLSPing(m, &mPLSMPLSPingServer{stream}) +} + +type MPLS_MPLSPingServer interface { + Send(*MPLSPingResponse) error + grpc.ServerStream +} + +type mPLSMPLSPingServer struct { + grpc.ServerStream +} + +func (x *mPLSMPLSPingServer) Send(m *MPLSPingResponse) error { + return x.ServerStream.SendMsg(m) +} + +// MPLS_ServiceDesc is the grpc.ServiceDesc for MPLS service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var MPLS_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.mpls.MPLS", + HandlerType: (*MPLSServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ClearLSP", + Handler: _MPLS_ClearLSP_Handler, + }, + { + MethodName: "ClearLSPCounters", + Handler: _MPLS_ClearLSPCounters_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "MPLSPing", + Handler: _MPLS_MPLSPing_Handler, + ServerStreams: true, + }, + }, + Metadata: "mpls/mpls.proto", +} diff --git a/os/BUILD.bazel b/os/BUILD.bazel index b1963bf1..fdca6f31 100644 --- a/os/BUILD.bazel +++ b/os/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "os_proto", srcs = ["os.proto"], @@ -46,7 +45,10 @@ cc_grpc_library( go_proto_library( name = "os_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/os", proto = ":os_proto", deps = ["//types"], diff --git a/os/os.pb.go b/os/os.pb.go index 05bc3db5..66e80774 100644 --- a/os/os.pb.go +++ b/os/os.pb.go @@ -7,11 +7,7 @@ package os import ( - context "context" _ "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1795,188 +1791,3 @@ func file_os_os_proto_init() { file_os_os_proto_goTypes = nil file_os_os_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// OSClient is the client API for OS service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type OSClient interface { - Install(ctx context.Context, opts ...grpc.CallOption) (OS_InstallClient, error) - Activate(ctx context.Context, in *ActivateRequest, opts ...grpc.CallOption) (*ActivateResponse, error) - Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) -} - -type oSClient struct { - cc grpc.ClientConnInterface -} - -func NewOSClient(cc grpc.ClientConnInterface) OSClient { - return &oSClient{cc} -} - -func (c *oSClient) Install(ctx context.Context, opts ...grpc.CallOption) (OS_InstallClient, error) { - stream, err := c.cc.NewStream(ctx, &_OS_serviceDesc.Streams[0], "/gnoi.os.OS/Install", opts...) - if err != nil { - return nil, err - } - x := &oSInstallClient{stream} - return x, nil -} - -type OS_InstallClient interface { - Send(*InstallRequest) error - Recv() (*InstallResponse, error) - grpc.ClientStream -} - -type oSInstallClient struct { - grpc.ClientStream -} - -func (x *oSInstallClient) Send(m *InstallRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *oSInstallClient) Recv() (*InstallResponse, error) { - m := new(InstallResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *oSClient) Activate(ctx context.Context, in *ActivateRequest, opts ...grpc.CallOption) (*ActivateResponse, error) { - out := new(ActivateResponse) - err := c.cc.Invoke(ctx, "/gnoi.os.OS/Activate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *oSClient) Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) { - out := new(VerifyResponse) - err := c.cc.Invoke(ctx, "/gnoi.os.OS/Verify", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// OSServer is the server API for OS service. -type OSServer interface { - Install(OS_InstallServer) error - Activate(context.Context, *ActivateRequest) (*ActivateResponse, error) - Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) -} - -// UnimplementedOSServer can be embedded to have forward compatible implementations. -type UnimplementedOSServer struct { -} - -func (*UnimplementedOSServer) Install(OS_InstallServer) error { - return status.Errorf(codes.Unimplemented, "method Install not implemented") -} -func (*UnimplementedOSServer) Activate(context.Context, *ActivateRequest) (*ActivateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Activate not implemented") -} -func (*UnimplementedOSServer) Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Verify not implemented") -} - -func RegisterOSServer(s *grpc.Server, srv OSServer) { - s.RegisterService(&_OS_serviceDesc, srv) -} - -func _OS_Install_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(OSServer).Install(&oSInstallServer{stream}) -} - -type OS_InstallServer interface { - Send(*InstallResponse) error - Recv() (*InstallRequest, error) - grpc.ServerStream -} - -type oSInstallServer struct { - grpc.ServerStream -} - -func (x *oSInstallServer) Send(m *InstallResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *oSInstallServer) Recv() (*InstallRequest, error) { - m := new(InstallRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _OS_Activate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ActivateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OSServer).Activate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.os.OS/Activate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OSServer).Activate(ctx, req.(*ActivateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _OS_Verify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(VerifyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OSServer).Verify(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.os.OS/Verify", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OSServer).Verify(ctx, req.(*VerifyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _OS_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.os.OS", - HandlerType: (*OSServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Activate", - Handler: _OS_Activate_Handler, - }, - { - MethodName: "Verify", - Handler: _OS_Verify_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Install", - Handler: _OS_Install_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "os/os.proto", -} diff --git a/os/os.proto b/os/os.proto index 8ce9d8d6..00c1827c 100644 --- a/os/os.proto +++ b/os/os.proto @@ -1,4 +1,18 @@ -// This file defines a gNOI API used for OS installation. +// +// Copyright 2017 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + syntax = "proto3"; package gnoi.os; diff --git a/os/os_grpc.pb.go b/os/os_grpc.pb.go new file mode 100755 index 00000000..b5cf2809 --- /dev/null +++ b/os/os_grpc.pb.go @@ -0,0 +1,210 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: os/os.proto + +package os + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// OSClient is the client API for OS 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 OSClient interface { + Install(ctx context.Context, opts ...grpc.CallOption) (OS_InstallClient, error) + Activate(ctx context.Context, in *ActivateRequest, opts ...grpc.CallOption) (*ActivateResponse, error) + Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) +} + +type oSClient struct { + cc grpc.ClientConnInterface +} + +func NewOSClient(cc grpc.ClientConnInterface) OSClient { + return &oSClient{cc} +} + +func (c *oSClient) Install(ctx context.Context, opts ...grpc.CallOption) (OS_InstallClient, error) { + stream, err := c.cc.NewStream(ctx, &OS_ServiceDesc.Streams[0], "/gnoi.os.OS/Install", opts...) + if err != nil { + return nil, err + } + x := &oSInstallClient{stream} + return x, nil +} + +type OS_InstallClient interface { + Send(*InstallRequest) error + Recv() (*InstallResponse, error) + grpc.ClientStream +} + +type oSInstallClient struct { + grpc.ClientStream +} + +func (x *oSInstallClient) Send(m *InstallRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *oSInstallClient) Recv() (*InstallResponse, error) { + m := new(InstallResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *oSClient) Activate(ctx context.Context, in *ActivateRequest, opts ...grpc.CallOption) (*ActivateResponse, error) { + out := new(ActivateResponse) + err := c.cc.Invoke(ctx, "/gnoi.os.OS/Activate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *oSClient) Verify(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) { + out := new(VerifyResponse) + err := c.cc.Invoke(ctx, "/gnoi.os.OS/Verify", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// OSServer is the server API for OS service. +// All implementations must embed UnimplementedOSServer +// for forward compatibility +type OSServer interface { + Install(OS_InstallServer) error + Activate(context.Context, *ActivateRequest) (*ActivateResponse, error) + Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) + mustEmbedUnimplementedOSServer() +} + +// UnimplementedOSServer must be embedded to have forward compatible implementations. +type UnimplementedOSServer struct { +} + +func (UnimplementedOSServer) Install(OS_InstallServer) error { + return status.Errorf(codes.Unimplemented, "method Install not implemented") +} +func (UnimplementedOSServer) Activate(context.Context, *ActivateRequest) (*ActivateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Activate not implemented") +} +func (UnimplementedOSServer) Verify(context.Context, *VerifyRequest) (*VerifyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Verify not implemented") +} +func (UnimplementedOSServer) mustEmbedUnimplementedOSServer() {} + +// UnsafeOSServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OSServer will +// result in compilation errors. +type UnsafeOSServer interface { + mustEmbedUnimplementedOSServer() +} + +func RegisterOSServer(s grpc.ServiceRegistrar, srv OSServer) { + s.RegisterService(&OS_ServiceDesc, srv) +} + +func _OS_Install_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(OSServer).Install(&oSInstallServer{stream}) +} + +type OS_InstallServer interface { + Send(*InstallResponse) error + Recv() (*InstallRequest, error) + grpc.ServerStream +} + +type oSInstallServer struct { + grpc.ServerStream +} + +func (x *oSInstallServer) Send(m *InstallResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *oSInstallServer) Recv() (*InstallRequest, error) { + m := new(InstallRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _OS_Activate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ActivateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OSServer).Activate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.os.OS/Activate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OSServer).Activate(ctx, req.(*ActivateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OS_Verify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OSServer).Verify(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.os.OS/Verify", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OSServer).Verify(ctx, req.(*VerifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// OS_ServiceDesc is the grpc.ServiceDesc for OS service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var OS_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.os.OS", + HandlerType: (*OSServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Activate", + Handler: _OS_Activate_Handler, + }, + { + MethodName: "Verify", + Handler: _OS_Verify_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Install", + Handler: _OS_Install_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "os/os.proto", +} diff --git a/otdr/BUILD.bazel b/otdr/BUILD.bazel index 4adf672e..0d9c7d37 100644 --- a/otdr/BUILD.bazel +++ b/otdr/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "otdr_proto", srcs = ["otdr.proto"], @@ -46,7 +45,10 @@ cc_grpc_library( go_proto_library( name = "otdr_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/otdr", proto = ":otdr_proto", deps = ["//types"], diff --git a/otdr/otdr.pb.go b/otdr/otdr.pb.go index b35b9709..2b0435f6 100644 --- a/otdr/otdr.pb.go +++ b/otdr/otdr.pb.go @@ -7,11 +7,7 @@ package otdr import ( - context "context" types "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1113,110 +1109,3 @@ func file_otdr_otdr_proto_init() { file_otdr_otdr_proto_goTypes = nil file_otdr_otdr_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// OTDRClient is the client API for OTDR service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type OTDRClient interface { - Initiate(ctx context.Context, in *InitiateRequest, opts ...grpc.CallOption) (OTDR_InitiateClient, error) -} - -type oTDRClient struct { - cc grpc.ClientConnInterface -} - -func NewOTDRClient(cc grpc.ClientConnInterface) OTDRClient { - return &oTDRClient{cc} -} - -func (c *oTDRClient) Initiate(ctx context.Context, in *InitiateRequest, opts ...grpc.CallOption) (OTDR_InitiateClient, error) { - stream, err := c.cc.NewStream(ctx, &_OTDR_serviceDesc.Streams[0], "/gnoi.optical.OTDR/Initiate", opts...) - if err != nil { - return nil, err - } - x := &oTDRInitiateClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type OTDR_InitiateClient interface { - Recv() (*InitiateResponse, error) - grpc.ClientStream -} - -type oTDRInitiateClient struct { - grpc.ClientStream -} - -func (x *oTDRInitiateClient) Recv() (*InitiateResponse, error) { - m := new(InitiateResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// OTDRServer is the server API for OTDR service. -type OTDRServer interface { - Initiate(*InitiateRequest, OTDR_InitiateServer) error -} - -// UnimplementedOTDRServer can be embedded to have forward compatible implementations. -type UnimplementedOTDRServer struct { -} - -func (*UnimplementedOTDRServer) Initiate(*InitiateRequest, OTDR_InitiateServer) error { - return status.Errorf(codes.Unimplemented, "method Initiate not implemented") -} - -func RegisterOTDRServer(s *grpc.Server, srv OTDRServer) { - s.RegisterService(&_OTDR_serviceDesc, srv) -} - -func _OTDR_Initiate_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(InitiateRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(OTDRServer).Initiate(m, &oTDRInitiateServer{stream}) -} - -type OTDR_InitiateServer interface { - Send(*InitiateResponse) error - grpc.ServerStream -} - -type oTDRInitiateServer struct { - grpc.ServerStream -} - -func (x *oTDRInitiateServer) Send(m *InitiateResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _OTDR_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.optical.OTDR", - HandlerType: (*OTDRServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Initiate", - Handler: _OTDR_Initiate_Handler, - ServerStreams: true, - }, - }, - Metadata: "otdr/otdr.proto", -} diff --git a/otdr/otdr.proto b/otdr/otdr.proto index f05cc212..54ed97ec 100644 --- a/otdr/otdr.proto +++ b/otdr/otdr.proto @@ -12,7 +12,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; diff --git a/otdr/otdr_grpc.pb.go b/otdr/otdr_grpc.pb.go new file mode 100755 index 00000000..c0d5fa22 --- /dev/null +++ b/otdr/otdr_grpc.pb.go @@ -0,0 +1,132 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: otdr/otdr.proto + +package otdr + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// OTDRClient is the client API for OTDR 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 OTDRClient interface { + Initiate(ctx context.Context, in *InitiateRequest, opts ...grpc.CallOption) (OTDR_InitiateClient, error) +} + +type oTDRClient struct { + cc grpc.ClientConnInterface +} + +func NewOTDRClient(cc grpc.ClientConnInterface) OTDRClient { + return &oTDRClient{cc} +} + +func (c *oTDRClient) Initiate(ctx context.Context, in *InitiateRequest, opts ...grpc.CallOption) (OTDR_InitiateClient, error) { + stream, err := c.cc.NewStream(ctx, &OTDR_ServiceDesc.Streams[0], "/gnoi.optical.OTDR/Initiate", opts...) + if err != nil { + return nil, err + } + x := &oTDRInitiateClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type OTDR_InitiateClient interface { + Recv() (*InitiateResponse, error) + grpc.ClientStream +} + +type oTDRInitiateClient struct { + grpc.ClientStream +} + +func (x *oTDRInitiateClient) Recv() (*InitiateResponse, error) { + m := new(InitiateResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// OTDRServer is the server API for OTDR service. +// All implementations must embed UnimplementedOTDRServer +// for forward compatibility +type OTDRServer interface { + Initiate(*InitiateRequest, OTDR_InitiateServer) error + mustEmbedUnimplementedOTDRServer() +} + +// UnimplementedOTDRServer must be embedded to have forward compatible implementations. +type UnimplementedOTDRServer struct { +} + +func (UnimplementedOTDRServer) Initiate(*InitiateRequest, OTDR_InitiateServer) error { + return status.Errorf(codes.Unimplemented, "method Initiate not implemented") +} +func (UnimplementedOTDRServer) mustEmbedUnimplementedOTDRServer() {} + +// UnsafeOTDRServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to OTDRServer will +// result in compilation errors. +type UnsafeOTDRServer interface { + mustEmbedUnimplementedOTDRServer() +} + +func RegisterOTDRServer(s grpc.ServiceRegistrar, srv OTDRServer) { + s.RegisterService(&OTDR_ServiceDesc, srv) +} + +func _OTDR_Initiate_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(InitiateRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(OTDRServer).Initiate(m, &oTDRInitiateServer{stream}) +} + +type OTDR_InitiateServer interface { + Send(*InitiateResponse) error + grpc.ServerStream +} + +type oTDRInitiateServer struct { + grpc.ServerStream +} + +func (x *oTDRInitiateServer) Send(m *InitiateResponse) error { + return x.ServerStream.SendMsg(m) +} + +// OTDR_ServiceDesc is the grpc.ServiceDesc for OTDR service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var OTDR_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.optical.OTDR", + HandlerType: (*OTDRServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Initiate", + Handler: _OTDR_Initiate_Handler, + ServerStreams: true, + }, + }, + Metadata: "otdr/otdr.proto", +} diff --git a/packet_capture/BUILD.bazel b/packet_capture/BUILD.bazel index 6c8ad321..84cef576 100644 --- a/packet_capture/BUILD.bazel +++ b/packet_capture/BUILD.bazel @@ -1,6 +1,28 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +package( + default_visibility = ["//visibility:public"], + licenses = ["notice"], +) + +use_new_compilers() proto_library( name = "pcap_proto", @@ -10,7 +32,10 @@ proto_library( go_proto_library( name = "pcap_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/packet_capture", proto = ":pcap_proto", visibility = ["//visibility:public"], diff --git a/packet_capture/packet_capture.pb.go b/packet_capture/packet_capture.pb.go index d3d65ea9..0cacf497 100644 --- a/packet_capture/packet_capture.pb.go +++ b/packet_capture/packet_capture.pb.go @@ -1064,10 +1064,9 @@ var file_packet_capture_packet_capture_proto_rawDesc = []byte{ 0x69, 0x2e, 0x70, 0x63, 0x61, 0x70, 0x2e, 0x50, 0x63, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6e, 0x6f, 0x69, 0x2e, 0x70, 0x63, 0x61, 0x70, 0x2e, 0x50, 0x63, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, - 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, - 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x69, 0x2f, 0x70, 0x61, - 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x3b, 0x70, 0x63, 0x61, - 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, + 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x69, 0x2f, 0x70, 0x63, + 0x61, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/packet_capture/packet_capture.proto b/packet_capture/packet_capture.proto index 2da334df..666154d9 100644 --- a/packet_capture/packet_capture.proto +++ b/packet_capture/packet_capture.proto @@ -1,3 +1,17 @@ +// +// Copyright 2024 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. syntax = "proto3"; package gnoi.pcap; diff --git a/packet_link_qualification/BUILD.bazel b/packet_link_qualification/BUILD.bazel index 91a841f9..592cac30 100644 --- a/packet_link_qualification/BUILD.bazel +++ b/packet_link_qualification/BUILD.bazel @@ -1,6 +1,29 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") + +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +package( + default_visibility = ["//visibility:public"], + licenses = ["notice"], +) + +use_new_compilers() proto_library( name = "linkqual_proto", @@ -16,7 +39,10 @@ proto_library( go_proto_library( name = "linkqual_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/packet_link_qualification", proto = ":linkqual_proto", visibility = ["//visibility:public"], diff --git a/packet_link_qualification/packet_link_qualification.pb.go b/packet_link_qualification/packet_link_qualification.pb.go index 5ddd6de0..08b0f9a6 100644 --- a/packet_link_qualification/packet_link_qualification.pb.go +++ b/packet_link_qualification/packet_link_qualification.pb.go @@ -2259,12 +2259,10 @@ var file_packet_link_qualification_packet_link_qualification_proto_rawDesc = []b 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x67, 0x6e, 0x6f, 0x69, 0x2e, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x42, 0x47, 0xd2, 0x3e, 0x05, 0x31, 0x2e, 0x31, 0x2e, 0x30, 0x5a, 0x3d, 0x67, + 0x6e, 0x73, 0x65, 0x42, 0x2d, 0xd2, 0x3e, 0x05, 0x31, 0x2e, 0x31, 0x2e, 0x30, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x69, 0x2f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, - 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x3b, 0x6c, 0x69, 0x6e, 0x6b, 0x71, 0x75, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x69, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x71, 0x75, + 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/system/BUILD.bazel b/system/BUILD.bazel index 60173b69..647da9a9 100644 --- a/system/BUILD.bazel +++ b/system/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "system_proto", srcs = ["system.proto"], @@ -49,7 +48,10 @@ cc_grpc_library( go_proto_library( name = "system_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/system", proto = ":system_proto", deps = [ diff --git a/system/system.pb.go b/system/system.pb.go index 68123abc..c10ec8cf 100644 --- a/system/system.pb.go +++ b/system/system.pb.go @@ -7,12 +7,8 @@ package system import ( - context "context" common "github.com/openconfig/gnoi/common" types "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -2495,460 +2491,3 @@ func file_system_system_proto_init() { file_system_system_proto_goTypes = nil file_system_system_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// SystemClient is the client API for System service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type SystemClient interface { - Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (System_PingClient, error) - Traceroute(ctx context.Context, in *TracerouteRequest, opts ...grpc.CallOption) (System_TracerouteClient, error) - Time(ctx context.Context, in *TimeRequest, opts ...grpc.CallOption) (*TimeResponse, error) - SetPackage(ctx context.Context, opts ...grpc.CallOption) (System_SetPackageClient, error) - SwitchControlProcessor(ctx context.Context, in *SwitchControlProcessorRequest, opts ...grpc.CallOption) (*SwitchControlProcessorResponse, error) - Reboot(ctx context.Context, in *RebootRequest, opts ...grpc.CallOption) (*RebootResponse, error) - RebootStatus(ctx context.Context, in *RebootStatusRequest, opts ...grpc.CallOption) (*RebootStatusResponse, error) - CancelReboot(ctx context.Context, in *CancelRebootRequest, opts ...grpc.CallOption) (*CancelRebootResponse, error) - KillProcess(ctx context.Context, in *KillProcessRequest, opts ...grpc.CallOption) (*KillProcessResponse, error) -} - -type systemClient struct { - cc grpc.ClientConnInterface -} - -func NewSystemClient(cc grpc.ClientConnInterface) SystemClient { - return &systemClient{cc} -} - -func (c *systemClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (System_PingClient, error) { - stream, err := c.cc.NewStream(ctx, &_System_serviceDesc.Streams[0], "/gnoi.system.System/Ping", opts...) - if err != nil { - return nil, err - } - x := &systemPingClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type System_PingClient interface { - Recv() (*PingResponse, error) - grpc.ClientStream -} - -type systemPingClient struct { - grpc.ClientStream -} - -func (x *systemPingClient) Recv() (*PingResponse, error) { - m := new(PingResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *systemClient) Traceroute(ctx context.Context, in *TracerouteRequest, opts ...grpc.CallOption) (System_TracerouteClient, error) { - stream, err := c.cc.NewStream(ctx, &_System_serviceDesc.Streams[1], "/gnoi.system.System/Traceroute", opts...) - if err != nil { - return nil, err - } - x := &systemTracerouteClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type System_TracerouteClient interface { - Recv() (*TracerouteResponse, error) - grpc.ClientStream -} - -type systemTracerouteClient struct { - grpc.ClientStream -} - -func (x *systemTracerouteClient) Recv() (*TracerouteResponse, error) { - m := new(TracerouteResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *systemClient) Time(ctx context.Context, in *TimeRequest, opts ...grpc.CallOption) (*TimeResponse, error) { - out := new(TimeResponse) - err := c.cc.Invoke(ctx, "/gnoi.system.System/Time", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *systemClient) SetPackage(ctx context.Context, opts ...grpc.CallOption) (System_SetPackageClient, error) { - stream, err := c.cc.NewStream(ctx, &_System_serviceDesc.Streams[2], "/gnoi.system.System/SetPackage", opts...) - if err != nil { - return nil, err - } - x := &systemSetPackageClient{stream} - return x, nil -} - -type System_SetPackageClient interface { - Send(*SetPackageRequest) error - CloseAndRecv() (*SetPackageResponse, error) - grpc.ClientStream -} - -type systemSetPackageClient struct { - grpc.ClientStream -} - -func (x *systemSetPackageClient) Send(m *SetPackageRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *systemSetPackageClient) CloseAndRecv() (*SetPackageResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(SetPackageResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *systemClient) SwitchControlProcessor(ctx context.Context, in *SwitchControlProcessorRequest, opts ...grpc.CallOption) (*SwitchControlProcessorResponse, error) { - out := new(SwitchControlProcessorResponse) - err := c.cc.Invoke(ctx, "/gnoi.system.System/SwitchControlProcessor", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *systemClient) Reboot(ctx context.Context, in *RebootRequest, opts ...grpc.CallOption) (*RebootResponse, error) { - out := new(RebootResponse) - err := c.cc.Invoke(ctx, "/gnoi.system.System/Reboot", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *systemClient) RebootStatus(ctx context.Context, in *RebootStatusRequest, opts ...grpc.CallOption) (*RebootStatusResponse, error) { - out := new(RebootStatusResponse) - err := c.cc.Invoke(ctx, "/gnoi.system.System/RebootStatus", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *systemClient) CancelReboot(ctx context.Context, in *CancelRebootRequest, opts ...grpc.CallOption) (*CancelRebootResponse, error) { - out := new(CancelRebootResponse) - err := c.cc.Invoke(ctx, "/gnoi.system.System/CancelReboot", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *systemClient) KillProcess(ctx context.Context, in *KillProcessRequest, opts ...grpc.CallOption) (*KillProcessResponse, error) { - out := new(KillProcessResponse) - err := c.cc.Invoke(ctx, "/gnoi.system.System/KillProcess", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SystemServer is the server API for System service. -type SystemServer interface { - Ping(*PingRequest, System_PingServer) error - Traceroute(*TracerouteRequest, System_TracerouteServer) error - Time(context.Context, *TimeRequest) (*TimeResponse, error) - SetPackage(System_SetPackageServer) error - SwitchControlProcessor(context.Context, *SwitchControlProcessorRequest) (*SwitchControlProcessorResponse, error) - Reboot(context.Context, *RebootRequest) (*RebootResponse, error) - RebootStatus(context.Context, *RebootStatusRequest) (*RebootStatusResponse, error) - CancelReboot(context.Context, *CancelRebootRequest) (*CancelRebootResponse, error) - KillProcess(context.Context, *KillProcessRequest) (*KillProcessResponse, error) -} - -// UnimplementedSystemServer can be embedded to have forward compatible implementations. -type UnimplementedSystemServer struct { -} - -func (*UnimplementedSystemServer) Ping(*PingRequest, System_PingServer) error { - return status.Errorf(codes.Unimplemented, "method Ping not implemented") -} -func (*UnimplementedSystemServer) Traceroute(*TracerouteRequest, System_TracerouteServer) error { - return status.Errorf(codes.Unimplemented, "method Traceroute not implemented") -} -func (*UnimplementedSystemServer) Time(context.Context, *TimeRequest) (*TimeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Time not implemented") -} -func (*UnimplementedSystemServer) SetPackage(System_SetPackageServer) error { - return status.Errorf(codes.Unimplemented, "method SetPackage not implemented") -} -func (*UnimplementedSystemServer) SwitchControlProcessor(context.Context, *SwitchControlProcessorRequest) (*SwitchControlProcessorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SwitchControlProcessor not implemented") -} -func (*UnimplementedSystemServer) Reboot(context.Context, *RebootRequest) (*RebootResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Reboot not implemented") -} -func (*UnimplementedSystemServer) RebootStatus(context.Context, *RebootStatusRequest) (*RebootStatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RebootStatus not implemented") -} -func (*UnimplementedSystemServer) CancelReboot(context.Context, *CancelRebootRequest) (*CancelRebootResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CancelReboot not implemented") -} -func (*UnimplementedSystemServer) KillProcess(context.Context, *KillProcessRequest) (*KillProcessResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method KillProcess not implemented") -} - -func RegisterSystemServer(s *grpc.Server, srv SystemServer) { - s.RegisterService(&_System_serviceDesc, srv) -} - -func _System_Ping_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(PingRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(SystemServer).Ping(m, &systemPingServer{stream}) -} - -type System_PingServer interface { - Send(*PingResponse) error - grpc.ServerStream -} - -type systemPingServer struct { - grpc.ServerStream -} - -func (x *systemPingServer) Send(m *PingResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _System_Traceroute_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(TracerouteRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(SystemServer).Traceroute(m, &systemTracerouteServer{stream}) -} - -type System_TracerouteServer interface { - Send(*TracerouteResponse) error - grpc.ServerStream -} - -type systemTracerouteServer struct { - grpc.ServerStream -} - -func (x *systemTracerouteServer) Send(m *TracerouteResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _System_Time_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TimeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SystemServer).Time(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.system.System/Time", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SystemServer).Time(ctx, req.(*TimeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _System_SetPackage_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SystemServer).SetPackage(&systemSetPackageServer{stream}) -} - -type System_SetPackageServer interface { - SendAndClose(*SetPackageResponse) error - Recv() (*SetPackageRequest, error) - grpc.ServerStream -} - -type systemSetPackageServer struct { - grpc.ServerStream -} - -func (x *systemSetPackageServer) SendAndClose(m *SetPackageResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *systemSetPackageServer) Recv() (*SetPackageRequest, error) { - m := new(SetPackageRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _System_SwitchControlProcessor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SwitchControlProcessorRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SystemServer).SwitchControlProcessor(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.system.System/SwitchControlProcessor", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SystemServer).SwitchControlProcessor(ctx, req.(*SwitchControlProcessorRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _System_Reboot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RebootRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SystemServer).Reboot(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.system.System/Reboot", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SystemServer).Reboot(ctx, req.(*RebootRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _System_RebootStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RebootStatusRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SystemServer).RebootStatus(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.system.System/RebootStatus", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SystemServer).RebootStatus(ctx, req.(*RebootStatusRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _System_CancelReboot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CancelRebootRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SystemServer).CancelReboot(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.system.System/CancelReboot", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SystemServer).CancelReboot(ctx, req.(*CancelRebootRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _System_KillProcess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(KillProcessRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SystemServer).KillProcess(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.system.System/KillProcess", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SystemServer).KillProcess(ctx, req.(*KillProcessRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _System_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.system.System", - HandlerType: (*SystemServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Time", - Handler: _System_Time_Handler, - }, - { - MethodName: "SwitchControlProcessor", - Handler: _System_SwitchControlProcessor_Handler, - }, - { - MethodName: "Reboot", - Handler: _System_Reboot_Handler, - }, - { - MethodName: "RebootStatus", - Handler: _System_RebootStatus_Handler, - }, - { - MethodName: "CancelReboot", - Handler: _System_CancelReboot_Handler, - }, - { - MethodName: "KillProcess", - Handler: _System_KillProcess_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Ping", - Handler: _System_Ping_Handler, - ServerStreams: true, - }, - { - StreamName: "Traceroute", - Handler: _System_Traceroute_Handler, - ServerStreams: true, - }, - { - StreamName: "SetPackage", - Handler: _System_SetPackage_Handler, - ClientStreams: true, - }, - }, - Metadata: "system/system.proto", -} diff --git a/system/system_grpc.pb.go b/system/system_grpc.pb.go new file mode 100755 index 00000000..628e3347 --- /dev/null +++ b/system/system_grpc.pb.go @@ -0,0 +1,482 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: system/system.proto + +package system + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// SystemClient is the client API for System 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 SystemClient interface { + Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (System_PingClient, error) + Traceroute(ctx context.Context, in *TracerouteRequest, opts ...grpc.CallOption) (System_TracerouteClient, error) + Time(ctx context.Context, in *TimeRequest, opts ...grpc.CallOption) (*TimeResponse, error) + SetPackage(ctx context.Context, opts ...grpc.CallOption) (System_SetPackageClient, error) + SwitchControlProcessor(ctx context.Context, in *SwitchControlProcessorRequest, opts ...grpc.CallOption) (*SwitchControlProcessorResponse, error) + Reboot(ctx context.Context, in *RebootRequest, opts ...grpc.CallOption) (*RebootResponse, error) + RebootStatus(ctx context.Context, in *RebootStatusRequest, opts ...grpc.CallOption) (*RebootStatusResponse, error) + CancelReboot(ctx context.Context, in *CancelRebootRequest, opts ...grpc.CallOption) (*CancelRebootResponse, error) + KillProcess(ctx context.Context, in *KillProcessRequest, opts ...grpc.CallOption) (*KillProcessResponse, error) +} + +type systemClient struct { + cc grpc.ClientConnInterface +} + +func NewSystemClient(cc grpc.ClientConnInterface) SystemClient { + return &systemClient{cc} +} + +func (c *systemClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (System_PingClient, error) { + stream, err := c.cc.NewStream(ctx, &System_ServiceDesc.Streams[0], "/gnoi.system.System/Ping", opts...) + if err != nil { + return nil, err + } + x := &systemPingClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type System_PingClient interface { + Recv() (*PingResponse, error) + grpc.ClientStream +} + +type systemPingClient struct { + grpc.ClientStream +} + +func (x *systemPingClient) Recv() (*PingResponse, error) { + m := new(PingResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *systemClient) Traceroute(ctx context.Context, in *TracerouteRequest, opts ...grpc.CallOption) (System_TracerouteClient, error) { + stream, err := c.cc.NewStream(ctx, &System_ServiceDesc.Streams[1], "/gnoi.system.System/Traceroute", opts...) + if err != nil { + return nil, err + } + x := &systemTracerouteClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type System_TracerouteClient interface { + Recv() (*TracerouteResponse, error) + grpc.ClientStream +} + +type systemTracerouteClient struct { + grpc.ClientStream +} + +func (x *systemTracerouteClient) Recv() (*TracerouteResponse, error) { + m := new(TracerouteResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *systemClient) Time(ctx context.Context, in *TimeRequest, opts ...grpc.CallOption) (*TimeResponse, error) { + out := new(TimeResponse) + err := c.cc.Invoke(ctx, "/gnoi.system.System/Time", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemClient) SetPackage(ctx context.Context, opts ...grpc.CallOption) (System_SetPackageClient, error) { + stream, err := c.cc.NewStream(ctx, &System_ServiceDesc.Streams[2], "/gnoi.system.System/SetPackage", opts...) + if err != nil { + return nil, err + } + x := &systemSetPackageClient{stream} + return x, nil +} + +type System_SetPackageClient interface { + Send(*SetPackageRequest) error + CloseAndRecv() (*SetPackageResponse, error) + grpc.ClientStream +} + +type systemSetPackageClient struct { + grpc.ClientStream +} + +func (x *systemSetPackageClient) Send(m *SetPackageRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *systemSetPackageClient) CloseAndRecv() (*SetPackageResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(SetPackageResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *systemClient) SwitchControlProcessor(ctx context.Context, in *SwitchControlProcessorRequest, opts ...grpc.CallOption) (*SwitchControlProcessorResponse, error) { + out := new(SwitchControlProcessorResponse) + err := c.cc.Invoke(ctx, "/gnoi.system.System/SwitchControlProcessor", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemClient) Reboot(ctx context.Context, in *RebootRequest, opts ...grpc.CallOption) (*RebootResponse, error) { + out := new(RebootResponse) + err := c.cc.Invoke(ctx, "/gnoi.system.System/Reboot", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemClient) RebootStatus(ctx context.Context, in *RebootStatusRequest, opts ...grpc.CallOption) (*RebootStatusResponse, error) { + out := new(RebootStatusResponse) + err := c.cc.Invoke(ctx, "/gnoi.system.System/RebootStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemClient) CancelReboot(ctx context.Context, in *CancelRebootRequest, opts ...grpc.CallOption) (*CancelRebootResponse, error) { + out := new(CancelRebootResponse) + err := c.cc.Invoke(ctx, "/gnoi.system.System/CancelReboot", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *systemClient) KillProcess(ctx context.Context, in *KillProcessRequest, opts ...grpc.CallOption) (*KillProcessResponse, error) { + out := new(KillProcessResponse) + err := c.cc.Invoke(ctx, "/gnoi.system.System/KillProcess", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SystemServer is the server API for System service. +// All implementations must embed UnimplementedSystemServer +// for forward compatibility +type SystemServer interface { + Ping(*PingRequest, System_PingServer) error + Traceroute(*TracerouteRequest, System_TracerouteServer) error + Time(context.Context, *TimeRequest) (*TimeResponse, error) + SetPackage(System_SetPackageServer) error + SwitchControlProcessor(context.Context, *SwitchControlProcessorRequest) (*SwitchControlProcessorResponse, error) + Reboot(context.Context, *RebootRequest) (*RebootResponse, error) + RebootStatus(context.Context, *RebootStatusRequest) (*RebootStatusResponse, error) + CancelReboot(context.Context, *CancelRebootRequest) (*CancelRebootResponse, error) + KillProcess(context.Context, *KillProcessRequest) (*KillProcessResponse, error) + mustEmbedUnimplementedSystemServer() +} + +// UnimplementedSystemServer must be embedded to have forward compatible implementations. +type UnimplementedSystemServer struct { +} + +func (UnimplementedSystemServer) Ping(*PingRequest, System_PingServer) error { + return status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (UnimplementedSystemServer) Traceroute(*TracerouteRequest, System_TracerouteServer) error { + return status.Errorf(codes.Unimplemented, "method Traceroute not implemented") +} +func (UnimplementedSystemServer) Time(context.Context, *TimeRequest) (*TimeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Time not implemented") +} +func (UnimplementedSystemServer) SetPackage(System_SetPackageServer) error { + return status.Errorf(codes.Unimplemented, "method SetPackage not implemented") +} +func (UnimplementedSystemServer) SwitchControlProcessor(context.Context, *SwitchControlProcessorRequest) (*SwitchControlProcessorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwitchControlProcessor not implemented") +} +func (UnimplementedSystemServer) Reboot(context.Context, *RebootRequest) (*RebootResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Reboot not implemented") +} +func (UnimplementedSystemServer) RebootStatus(context.Context, *RebootStatusRequest) (*RebootStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RebootStatus not implemented") +} +func (UnimplementedSystemServer) CancelReboot(context.Context, *CancelRebootRequest) (*CancelRebootResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelReboot not implemented") +} +func (UnimplementedSystemServer) KillProcess(context.Context, *KillProcessRequest) (*KillProcessResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method KillProcess not implemented") +} +func (UnimplementedSystemServer) mustEmbedUnimplementedSystemServer() {} + +// UnsafeSystemServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SystemServer will +// result in compilation errors. +type UnsafeSystemServer interface { + mustEmbedUnimplementedSystemServer() +} + +func RegisterSystemServer(s grpc.ServiceRegistrar, srv SystemServer) { + s.RegisterService(&System_ServiceDesc, srv) +} + +func _System_Ping_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(PingRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(SystemServer).Ping(m, &systemPingServer{stream}) +} + +type System_PingServer interface { + Send(*PingResponse) error + grpc.ServerStream +} + +type systemPingServer struct { + grpc.ServerStream +} + +func (x *systemPingServer) Send(m *PingResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _System_Traceroute_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(TracerouteRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(SystemServer).Traceroute(m, &systemTracerouteServer{stream}) +} + +type System_TracerouteServer interface { + Send(*TracerouteResponse) error + grpc.ServerStream +} + +type systemTracerouteServer struct { + grpc.ServerStream +} + +func (x *systemTracerouteServer) Send(m *TracerouteResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _System_Time_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TimeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServer).Time(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.system.System/Time", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServer).Time(ctx, req.(*TimeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _System_SetPackage_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SystemServer).SetPackage(&systemSetPackageServer{stream}) +} + +type System_SetPackageServer interface { + SendAndClose(*SetPackageResponse) error + Recv() (*SetPackageRequest, error) + grpc.ServerStream +} + +type systemSetPackageServer struct { + grpc.ServerStream +} + +func (x *systemSetPackageServer) SendAndClose(m *SetPackageResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *systemSetPackageServer) Recv() (*SetPackageRequest, error) { + m := new(SetPackageRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _System_SwitchControlProcessor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SwitchControlProcessorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServer).SwitchControlProcessor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.system.System/SwitchControlProcessor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServer).SwitchControlProcessor(ctx, req.(*SwitchControlProcessorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _System_Reboot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RebootRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServer).Reboot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.system.System/Reboot", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServer).Reboot(ctx, req.(*RebootRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _System_RebootStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RebootStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServer).RebootStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.system.System/RebootStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServer).RebootStatus(ctx, req.(*RebootStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _System_CancelReboot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CancelRebootRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServer).CancelReboot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.system.System/CancelReboot", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServer).CancelReboot(ctx, req.(*CancelRebootRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _System_KillProcess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KillProcessRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SystemServer).KillProcess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.system.System/KillProcess", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SystemServer).KillProcess(ctx, req.(*KillProcessRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// System_ServiceDesc is the grpc.ServiceDesc for System service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var System_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.system.System", + HandlerType: (*SystemServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Time", + Handler: _System_Time_Handler, + }, + { + MethodName: "SwitchControlProcessor", + Handler: _System_SwitchControlProcessor_Handler, + }, + { + MethodName: "Reboot", + Handler: _System_Reboot_Handler, + }, + { + MethodName: "RebootStatus", + Handler: _System_RebootStatus_Handler, + }, + { + MethodName: "CancelReboot", + Handler: _System_CancelReboot_Handler, + }, + { + MethodName: "KillProcess", + Handler: _System_KillProcess_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Ping", + Handler: _System_Ping_Handler, + ServerStreams: true, + }, + { + StreamName: "Traceroute", + Handler: _System_Traceroute_Handler, + ServerStreams: true, + }, + { + StreamName: "SetPackage", + Handler: _System_SetPackage_Handler, + ClientStreams: true, + }, + }, + Metadata: "system/system.proto", +} diff --git a/types/BUILD.bazel b/types/BUILD.bazel index 591bf298..46370cce 100644 --- a/types/BUILD.bazel +++ b/types/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "types_proto", srcs = ["types.proto"], @@ -40,6 +39,10 @@ cc_proto_library( go_proto_library( name = "types_go_proto", + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/types", proto = ":types_proto", ) diff --git a/wavelength_router/BUILD.bazel b/wavelength_router/BUILD.bazel index 3b124142..da6b62a6 100644 --- a/wavelength_router/BUILD.bazel +++ b/wavelength_router/BUILD.bazel @@ -1,6 +1,8 @@ load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_go//go:def.bzl", "go_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") +load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("//:common.bzl", "use_new_compilers") #Copyright 2021 Google LLC # @@ -15,17 +17,14 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Supporting infrastructure for implementing and testing PINS. -# - -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") package( default_visibility = ["//visibility:public"], licenses = ["notice"], ) +use_new_compilers() + proto_library( name = "wavelength_router_proto", srcs = ["wavelength_router.proto"], @@ -46,7 +45,10 @@ cc_grpc_library( go_proto_library( name = "wavelength_router_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], + compilers = [ + "go_protoc_gen_go", + "go_protoc_gen_go_grpc", + ], importpath = "github.com/openconfig/gnoi/wavelength_router", proto = ":wavelength_router_proto", deps = ["//types"], diff --git a/wavelength_router/wavelength_router.pb.go b/wavelength_router/wavelength_router.pb.go index 0e73d7a1..6121d84f 100644 --- a/wavelength_router/wavelength_router.pb.go +++ b/wavelength_router/wavelength_router.pb.go @@ -7,11 +7,7 @@ package wavelength_router import ( - context "context" types "github.com/openconfig/gnoi/types" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -1225,252 +1221,3 @@ func file_wavelength_router_wavelength_router_proto_init() { file_wavelength_router_wavelength_router_proto_goTypes = nil file_wavelength_router_wavelength_router_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// WavelengthRouterClient is the client API for WavelengthRouter service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type WavelengthRouterClient interface { - // Deprecated: Do not use. - AdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustPSDClient, error) - // Deprecated: Do not use. - CancelAdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (*CancelAdjustPSDResponse, error) - AdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustSpectrumClient, error) - CancelAdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (*CancelAdjustSpectrumResponse, error) -} - -type wavelengthRouterClient struct { - cc grpc.ClientConnInterface -} - -func NewWavelengthRouterClient(cc grpc.ClientConnInterface) WavelengthRouterClient { - return &wavelengthRouterClient{cc} -} - -// Deprecated: Do not use. -func (c *wavelengthRouterClient) AdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustPSDClient, error) { - stream, err := c.cc.NewStream(ctx, &_WavelengthRouter_serviceDesc.Streams[0], "/gnoi.optical.WavelengthRouter/AdjustPSD", opts...) - if err != nil { - return nil, err - } - x := &wavelengthRouterAdjustPSDClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type WavelengthRouter_AdjustPSDClient interface { - Recv() (*AdjustPSDResponse, error) - grpc.ClientStream -} - -type wavelengthRouterAdjustPSDClient struct { - grpc.ClientStream -} - -func (x *wavelengthRouterAdjustPSDClient) Recv() (*AdjustPSDResponse, error) { - m := new(AdjustPSDResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// Deprecated: Do not use. -func (c *wavelengthRouterClient) CancelAdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (*CancelAdjustPSDResponse, error) { - out := new(CancelAdjustPSDResponse) - err := c.cc.Invoke(ctx, "/gnoi.optical.WavelengthRouter/CancelAdjustPSD", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *wavelengthRouterClient) AdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustSpectrumClient, error) { - stream, err := c.cc.NewStream(ctx, &_WavelengthRouter_serviceDesc.Streams[1], "/gnoi.optical.WavelengthRouter/AdjustSpectrum", opts...) - if err != nil { - return nil, err - } - x := &wavelengthRouterAdjustSpectrumClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type WavelengthRouter_AdjustSpectrumClient interface { - Recv() (*AdjustSpectrumResponse, error) - grpc.ClientStream -} - -type wavelengthRouterAdjustSpectrumClient struct { - grpc.ClientStream -} - -func (x *wavelengthRouterAdjustSpectrumClient) Recv() (*AdjustSpectrumResponse, error) { - m := new(AdjustSpectrumResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *wavelengthRouterClient) CancelAdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (*CancelAdjustSpectrumResponse, error) { - out := new(CancelAdjustSpectrumResponse) - err := c.cc.Invoke(ctx, "/gnoi.optical.WavelengthRouter/CancelAdjustSpectrum", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// WavelengthRouterServer is the server API for WavelengthRouter service. -type WavelengthRouterServer interface { - // Deprecated: Do not use. - AdjustPSD(*AdjustPSDRequest, WavelengthRouter_AdjustPSDServer) error - // Deprecated: Do not use. - CancelAdjustPSD(context.Context, *AdjustPSDRequest) (*CancelAdjustPSDResponse, error) - AdjustSpectrum(*AdjustSpectrumRequest, WavelengthRouter_AdjustSpectrumServer) error - CancelAdjustSpectrum(context.Context, *AdjustSpectrumRequest) (*CancelAdjustSpectrumResponse, error) -} - -// UnimplementedWavelengthRouterServer can be embedded to have forward compatible implementations. -type UnimplementedWavelengthRouterServer struct { -} - -func (*UnimplementedWavelengthRouterServer) AdjustPSD(*AdjustPSDRequest, WavelengthRouter_AdjustPSDServer) error { - return status.Errorf(codes.Unimplemented, "method AdjustPSD not implemented") -} -func (*UnimplementedWavelengthRouterServer) CancelAdjustPSD(context.Context, *AdjustPSDRequest) (*CancelAdjustPSDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CancelAdjustPSD not implemented") -} -func (*UnimplementedWavelengthRouterServer) AdjustSpectrum(*AdjustSpectrumRequest, WavelengthRouter_AdjustSpectrumServer) error { - return status.Errorf(codes.Unimplemented, "method AdjustSpectrum not implemented") -} -func (*UnimplementedWavelengthRouterServer) CancelAdjustSpectrum(context.Context, *AdjustSpectrumRequest) (*CancelAdjustSpectrumResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CancelAdjustSpectrum not implemented") -} - -func RegisterWavelengthRouterServer(s *grpc.Server, srv WavelengthRouterServer) { - s.RegisterService(&_WavelengthRouter_serviceDesc, srv) -} - -func _WavelengthRouter_AdjustPSD_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(AdjustPSDRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(WavelengthRouterServer).AdjustPSD(m, &wavelengthRouterAdjustPSDServer{stream}) -} - -type WavelengthRouter_AdjustPSDServer interface { - Send(*AdjustPSDResponse) error - grpc.ServerStream -} - -type wavelengthRouterAdjustPSDServer struct { - grpc.ServerStream -} - -func (x *wavelengthRouterAdjustPSDServer) Send(m *AdjustPSDResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _WavelengthRouter_CancelAdjustPSD_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AdjustPSDRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WavelengthRouterServer).CancelAdjustPSD(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.optical.WavelengthRouter/CancelAdjustPSD", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WavelengthRouterServer).CancelAdjustPSD(ctx, req.(*AdjustPSDRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WavelengthRouter_AdjustSpectrum_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(AdjustSpectrumRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(WavelengthRouterServer).AdjustSpectrum(m, &wavelengthRouterAdjustSpectrumServer{stream}) -} - -type WavelengthRouter_AdjustSpectrumServer interface { - Send(*AdjustSpectrumResponse) error - grpc.ServerStream -} - -type wavelengthRouterAdjustSpectrumServer struct { - grpc.ServerStream -} - -func (x *wavelengthRouterAdjustSpectrumServer) Send(m *AdjustSpectrumResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _WavelengthRouter_CancelAdjustSpectrum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AdjustSpectrumRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WavelengthRouterServer).CancelAdjustSpectrum(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gnoi.optical.WavelengthRouter/CancelAdjustSpectrum", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WavelengthRouterServer).CancelAdjustSpectrum(ctx, req.(*AdjustSpectrumRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _WavelengthRouter_serviceDesc = grpc.ServiceDesc{ - ServiceName: "gnoi.optical.WavelengthRouter", - HandlerType: (*WavelengthRouterServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CancelAdjustPSD", - Handler: _WavelengthRouter_CancelAdjustPSD_Handler, - }, - { - MethodName: "CancelAdjustSpectrum", - Handler: _WavelengthRouter_CancelAdjustSpectrum_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "AdjustPSD", - Handler: _WavelengthRouter_AdjustPSD_Handler, - ServerStreams: true, - }, - { - StreamName: "AdjustSpectrum", - Handler: _WavelengthRouter_AdjustSpectrum_Handler, - ServerStreams: true, - }, - }, - Metadata: "wavelength_router/wavelength_router.proto", -} diff --git a/wavelength_router/wavelength_router_grpc.pb.go b/wavelength_router/wavelength_router_grpc.pb.go new file mode 100755 index 00000000..88dbc6bf --- /dev/null +++ b/wavelength_router/wavelength_router_grpc.pb.go @@ -0,0 +1,274 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.10 +// source: wavelength_router/wavelength_router.proto + +package wavelength_router + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// WavelengthRouterClient is the client API for WavelengthRouter 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 WavelengthRouterClient interface { + // Deprecated: Do not use. + AdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustPSDClient, error) + // Deprecated: Do not use. + CancelAdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (*CancelAdjustPSDResponse, error) + AdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustSpectrumClient, error) + CancelAdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (*CancelAdjustSpectrumResponse, error) +} + +type wavelengthRouterClient struct { + cc grpc.ClientConnInterface +} + +func NewWavelengthRouterClient(cc grpc.ClientConnInterface) WavelengthRouterClient { + return &wavelengthRouterClient{cc} +} + +// Deprecated: Do not use. +func (c *wavelengthRouterClient) AdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustPSDClient, error) { + stream, err := c.cc.NewStream(ctx, &WavelengthRouter_ServiceDesc.Streams[0], "/gnoi.optical.WavelengthRouter/AdjustPSD", opts...) + if err != nil { + return nil, err + } + x := &wavelengthRouterAdjustPSDClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type WavelengthRouter_AdjustPSDClient interface { + Recv() (*AdjustPSDResponse, error) + grpc.ClientStream +} + +type wavelengthRouterAdjustPSDClient struct { + grpc.ClientStream +} + +func (x *wavelengthRouterAdjustPSDClient) Recv() (*AdjustPSDResponse, error) { + m := new(AdjustPSDResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Deprecated: Do not use. +func (c *wavelengthRouterClient) CancelAdjustPSD(ctx context.Context, in *AdjustPSDRequest, opts ...grpc.CallOption) (*CancelAdjustPSDResponse, error) { + out := new(CancelAdjustPSDResponse) + err := c.cc.Invoke(ctx, "/gnoi.optical.WavelengthRouter/CancelAdjustPSD", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wavelengthRouterClient) AdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (WavelengthRouter_AdjustSpectrumClient, error) { + stream, err := c.cc.NewStream(ctx, &WavelengthRouter_ServiceDesc.Streams[1], "/gnoi.optical.WavelengthRouter/AdjustSpectrum", opts...) + if err != nil { + return nil, err + } + x := &wavelengthRouterAdjustSpectrumClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type WavelengthRouter_AdjustSpectrumClient interface { + Recv() (*AdjustSpectrumResponse, error) + grpc.ClientStream +} + +type wavelengthRouterAdjustSpectrumClient struct { + grpc.ClientStream +} + +func (x *wavelengthRouterAdjustSpectrumClient) Recv() (*AdjustSpectrumResponse, error) { + m := new(AdjustSpectrumResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *wavelengthRouterClient) CancelAdjustSpectrum(ctx context.Context, in *AdjustSpectrumRequest, opts ...grpc.CallOption) (*CancelAdjustSpectrumResponse, error) { + out := new(CancelAdjustSpectrumResponse) + err := c.cc.Invoke(ctx, "/gnoi.optical.WavelengthRouter/CancelAdjustSpectrum", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WavelengthRouterServer is the server API for WavelengthRouter service. +// All implementations must embed UnimplementedWavelengthRouterServer +// for forward compatibility +type WavelengthRouterServer interface { + // Deprecated: Do not use. + AdjustPSD(*AdjustPSDRequest, WavelengthRouter_AdjustPSDServer) error + // Deprecated: Do not use. + CancelAdjustPSD(context.Context, *AdjustPSDRequest) (*CancelAdjustPSDResponse, error) + AdjustSpectrum(*AdjustSpectrumRequest, WavelengthRouter_AdjustSpectrumServer) error + CancelAdjustSpectrum(context.Context, *AdjustSpectrumRequest) (*CancelAdjustSpectrumResponse, error) + mustEmbedUnimplementedWavelengthRouterServer() +} + +// UnimplementedWavelengthRouterServer must be embedded to have forward compatible implementations. +type UnimplementedWavelengthRouterServer struct { +} + +func (UnimplementedWavelengthRouterServer) AdjustPSD(*AdjustPSDRequest, WavelengthRouter_AdjustPSDServer) error { + return status.Errorf(codes.Unimplemented, "method AdjustPSD not implemented") +} +func (UnimplementedWavelengthRouterServer) CancelAdjustPSD(context.Context, *AdjustPSDRequest) (*CancelAdjustPSDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelAdjustPSD not implemented") +} +func (UnimplementedWavelengthRouterServer) AdjustSpectrum(*AdjustSpectrumRequest, WavelengthRouter_AdjustSpectrumServer) error { + return status.Errorf(codes.Unimplemented, "method AdjustSpectrum not implemented") +} +func (UnimplementedWavelengthRouterServer) CancelAdjustSpectrum(context.Context, *AdjustSpectrumRequest) (*CancelAdjustSpectrumResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CancelAdjustSpectrum not implemented") +} +func (UnimplementedWavelengthRouterServer) mustEmbedUnimplementedWavelengthRouterServer() {} + +// UnsafeWavelengthRouterServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WavelengthRouterServer will +// result in compilation errors. +type UnsafeWavelengthRouterServer interface { + mustEmbedUnimplementedWavelengthRouterServer() +} + +func RegisterWavelengthRouterServer(s grpc.ServiceRegistrar, srv WavelengthRouterServer) { + s.RegisterService(&WavelengthRouter_ServiceDesc, srv) +} + +func _WavelengthRouter_AdjustPSD_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(AdjustPSDRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WavelengthRouterServer).AdjustPSD(m, &wavelengthRouterAdjustPSDServer{stream}) +} + +type WavelengthRouter_AdjustPSDServer interface { + Send(*AdjustPSDResponse) error + grpc.ServerStream +} + +type wavelengthRouterAdjustPSDServer struct { + grpc.ServerStream +} + +func (x *wavelengthRouterAdjustPSDServer) Send(m *AdjustPSDResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _WavelengthRouter_CancelAdjustPSD_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AdjustPSDRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WavelengthRouterServer).CancelAdjustPSD(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.optical.WavelengthRouter/CancelAdjustPSD", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WavelengthRouterServer).CancelAdjustPSD(ctx, req.(*AdjustPSDRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WavelengthRouter_AdjustSpectrum_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(AdjustSpectrumRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WavelengthRouterServer).AdjustSpectrum(m, &wavelengthRouterAdjustSpectrumServer{stream}) +} + +type WavelengthRouter_AdjustSpectrumServer interface { + Send(*AdjustSpectrumResponse) error + grpc.ServerStream +} + +type wavelengthRouterAdjustSpectrumServer struct { + grpc.ServerStream +} + +func (x *wavelengthRouterAdjustSpectrumServer) Send(m *AdjustSpectrumResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _WavelengthRouter_CancelAdjustSpectrum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AdjustSpectrumRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WavelengthRouterServer).CancelAdjustSpectrum(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.optical.WavelengthRouter/CancelAdjustSpectrum", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WavelengthRouterServer).CancelAdjustSpectrum(ctx, req.(*AdjustSpectrumRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WavelengthRouter_ServiceDesc is the grpc.ServiceDesc for WavelengthRouter service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WavelengthRouter_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.optical.WavelengthRouter", + HandlerType: (*WavelengthRouterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CancelAdjustPSD", + Handler: _WavelengthRouter_CancelAdjustPSD_Handler, + }, + { + MethodName: "CancelAdjustSpectrum", + Handler: _WavelengthRouter_CancelAdjustSpectrum_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "AdjustPSD", + Handler: _WavelengthRouter_AdjustPSD_Handler, + ServerStreams: true, + }, + { + StreamName: "AdjustSpectrum", + Handler: _WavelengthRouter_AdjustSpectrum_Handler, + ServerStreams: true, + }, + }, + Metadata: "wavelength_router/wavelength_router.proto", +}