Add gRPC Protobuf Files for CNS Operations (#2754)
* PB Operations * Updated Protobuf Service Name * Package Rename --------- Co-authored-by: Kevin <t-kcamacho@microsoft.com>
This commit is contained in:
Родитель
0475212f9f
Коммит
96a989e078
3
Makefile
3
Makefile
|
@ -952,3 +952,6 @@ tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Bu
|
|||
|
||||
help: ## Display this help
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||
|
||||
proto-gen: ## Generates source code from protobuf files
|
||||
protoc --go_out=. --go-grpc_out=. cns/grpc/proto/server.proto
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package cns;
|
||||
|
||||
option go_package = "cns/grpc/v1alpha";
|
||||
|
||||
// The Container Network Service (CNS) exposes a set of operations that allow the Delegated Network Controller (DNC) to manage
|
||||
// and monitor nodes in an orchestrator's infrastructure.
|
||||
|
||||
// CNS defines the gRPC service exposed by CNS to interact with DNC.
|
||||
service CNS {
|
||||
// Sets the orchestrator information for a node.
|
||||
rpc SetOrchestratorInfo(SetOrchestratorInfoRequest) returns (SetOrchestratorInfoResponse);
|
||||
|
||||
// Retrieves detailed information about a specific node.
|
||||
// Primarily used for health checks.
|
||||
rpc GetNodeInfo(NodeInfoRequest) returns (NodeInfoResponse);
|
||||
}
|
||||
|
||||
// SetOrchestratorInfoRequest is the request message for setting the orchestrator information.
|
||||
message SetOrchestratorInfoRequest {
|
||||
string dncPartitionKey = 1; // The partition key for DNC.
|
||||
string nodeID = 2; // The node ID.
|
||||
string orchestratorType = 3; // The type of the orchestrator.
|
||||
}
|
||||
|
||||
// SetOrchestratorInfoResponse is the response message for setting the orchestrator information.
|
||||
message SetOrchestratorInfoResponse {}
|
||||
|
||||
// NodeInfoRequest is the request message for retrieving detailed information about a specific node.
|
||||
message NodeInfoRequest {
|
||||
string nodeID = 1; // The node ID to identify the specific node.
|
||||
}
|
||||
|
||||
// NodeInfoResponse is the response message containing detailed information about a specific node.
|
||||
message NodeInfoResponse {
|
||||
string nodeID = 1; // The node ID.
|
||||
string name = 2; // The name of the node.
|
||||
string ip = 3; // The IP address of the node.
|
||||
bool isHealthy = 4; // Indicates whether the node is healthy or not.
|
||||
string status = 5; // The current status of the node (e.g., running, stopped).
|
||||
string message = 6; // Additional information about the node's health or status.
|
||||
}
|
|
@ -0,0 +1,409 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.34.1
|
||||
// protoc v3.12.4
|
||||
// source: cns/grpc/proto/server.proto
|
||||
|
||||
package v1alpha
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// SetOrchestratorInfoRequest is the request message for setting the orchestrator information.
|
||||
type SetOrchestratorInfoRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
DncPartitionKey string `protobuf:"bytes,1,opt,name=dncPartitionKey,proto3" json:"dncPartitionKey,omitempty"` // The partition key for DNC.
|
||||
NodeID string `protobuf:"bytes,2,opt,name=nodeID,proto3" json:"nodeID,omitempty"` // The node ID.
|
||||
OrchestratorType string `protobuf:"bytes,3,opt,name=orchestratorType,proto3" json:"orchestratorType,omitempty"` // The type of the orchestrator.
|
||||
}
|
||||
|
||||
func (x *SetOrchestratorInfoRequest) Reset() {
|
||||
*x = SetOrchestratorInfoRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SetOrchestratorInfoRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetOrchestratorInfoRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SetOrchestratorInfoRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetOrchestratorInfoRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetOrchestratorInfoRequest) Descriptor() ([]byte, []int) {
|
||||
return file_cns_grpc_proto_server_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *SetOrchestratorInfoRequest) GetDncPartitionKey() string {
|
||||
if x != nil {
|
||||
return x.DncPartitionKey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SetOrchestratorInfoRequest) GetNodeID() string {
|
||||
if x != nil {
|
||||
return x.NodeID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SetOrchestratorInfoRequest) GetOrchestratorType() string {
|
||||
if x != nil {
|
||||
return x.OrchestratorType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SetOrchestratorInfoResponse is the response message for setting the orchestrator information.
|
||||
type SetOrchestratorInfoResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *SetOrchestratorInfoResponse) Reset() {
|
||||
*x = SetOrchestratorInfoResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SetOrchestratorInfoResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetOrchestratorInfoResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SetOrchestratorInfoResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetOrchestratorInfoResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SetOrchestratorInfoResponse) Descriptor() ([]byte, []int) {
|
||||
return file_cns_grpc_proto_server_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
// NodeInfoRequest is the request message for retrieving detailed information about a specific node.
|
||||
type NodeInfoRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeID string `protobuf:"bytes,1,opt,name=nodeID,proto3" json:"nodeID,omitempty"` // The node ID to identify the specific node.
|
||||
}
|
||||
|
||||
func (x *NodeInfoRequest) Reset() {
|
||||
*x = NodeInfoRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeInfoRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeInfoRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NodeInfoRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeInfoRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NodeInfoRequest) Descriptor() ([]byte, []int) {
|
||||
return file_cns_grpc_proto_server_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *NodeInfoRequest) GetNodeID() string {
|
||||
if x != nil {
|
||||
return x.NodeID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// NodeInfoResponse is the response message containing detailed information about a specific node.
|
||||
type NodeInfoResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeID string `protobuf:"bytes,1,opt,name=nodeID,proto3" json:"nodeID,omitempty"` // The node ID.
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // The name of the node.
|
||||
Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` // The IP address of the node.
|
||||
IsHealthy bool `protobuf:"varint,4,opt,name=isHealthy,proto3" json:"isHealthy,omitempty"` // Indicates whether the node is healthy or not.
|
||||
Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` // The current status of the node (e.g., running, stopped).
|
||||
Message string `protobuf:"bytes,6,opt,name=message,proto3" json:"message,omitempty"` // Additional information about the node's health or status.
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) Reset() {
|
||||
*x = NodeInfoResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeInfoResponse) ProtoMessage() {}
|
||||
|
||||
func (x *NodeInfoResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cns_grpc_proto_server_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeInfoResponse.ProtoReflect.Descriptor instead.
|
||||
func (*NodeInfoResponse) Descriptor() ([]byte, []int) {
|
||||
return file_cns_grpc_proto_server_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) GetNodeID() string {
|
||||
if x != nil {
|
||||
return x.NodeID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) GetIsHealthy() bool {
|
||||
if x != nil {
|
||||
return x.IsHealthy
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NodeInfoResponse) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_cns_grpc_proto_server_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_cns_grpc_proto_server_proto_rawDesc = []byte{
|
||||
0x0a, 0x1b, 0x63, 0x6e, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x63,
|
||||
0x6e, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x63, 0x68, 0x65, 0x73,
|
||||
0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x28, 0x0a, 0x0f, 0x64, 0x6e, 0x63, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x6e, 0x63, 0x50,
|
||||
0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64,
|
||||
0x65, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x10, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61,
|
||||
0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f,
|
||||
0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22,
|
||||
0x1d, 0x0a, 0x1b, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29,
|
||||
0x0a, 0x0f, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x6e, 0x6f, 0x64, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73,
|
||||
0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69,
|
||||
0x73, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x9b, 0x01, 0x0a, 0x03, 0x43,
|
||||
0x4e, 0x53, 0x12, 0x58, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74,
|
||||
0x72, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x2e, 0x63, 0x6e, 0x73, 0x2e,
|
||||
0x53, 0x65, 0x74, 0x4f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x63, 0x6e, 0x73,
|
||||
0x2e, 0x53, 0x65, 0x74, 0x4f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0b,
|
||||
0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x2e, 0x63, 0x6e,
|
||||
0x73, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x15, 0x2e, 0x63, 0x6e, 0x73, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x12, 0x5a, 0x10, 0x63, 0x6e, 0x73, 0x2f,
|
||||
0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_cns_grpc_proto_server_proto_rawDescOnce sync.Once
|
||||
file_cns_grpc_proto_server_proto_rawDescData = file_cns_grpc_proto_server_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_cns_grpc_proto_server_proto_rawDescGZIP() []byte {
|
||||
file_cns_grpc_proto_server_proto_rawDescOnce.Do(func() {
|
||||
file_cns_grpc_proto_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_cns_grpc_proto_server_proto_rawDescData)
|
||||
})
|
||||
return file_cns_grpc_proto_server_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_cns_grpc_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_cns_grpc_proto_server_proto_goTypes = []interface{}{
|
||||
(*SetOrchestratorInfoRequest)(nil), // 0: cns.SetOrchestratorInfoRequest
|
||||
(*SetOrchestratorInfoResponse)(nil), // 1: cns.SetOrchestratorInfoResponse
|
||||
(*NodeInfoRequest)(nil), // 2: cns.NodeInfoRequest
|
||||
(*NodeInfoResponse)(nil), // 3: cns.NodeInfoResponse
|
||||
}
|
||||
var file_cns_grpc_proto_server_proto_depIdxs = []int32{
|
||||
0, // 0: cns.CNS.SetOrchestratorInfo:input_type -> cns.SetOrchestratorInfoRequest
|
||||
2, // 1: cns.CNS.GetNodeInfo:input_type -> cns.NodeInfoRequest
|
||||
1, // 2: cns.CNS.SetOrchestratorInfo:output_type -> cns.SetOrchestratorInfoResponse
|
||||
3, // 3: cns.CNS.GetNodeInfo:output_type -> cns.NodeInfoResponse
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_cns_grpc_proto_server_proto_init() }
|
||||
func file_cns_grpc_proto_server_proto_init() {
|
||||
if File_cns_grpc_proto_server_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_cns_grpc_proto_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SetOrchestratorInfoRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cns_grpc_proto_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SetOrchestratorInfoResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cns_grpc_proto_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeInfoRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cns_grpc_proto_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeInfoResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_cns_grpc_proto_server_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_cns_grpc_proto_server_proto_goTypes,
|
||||
DependencyIndexes: file_cns_grpc_proto_server_proto_depIdxs,
|
||||
MessageInfos: file_cns_grpc_proto_server_proto_msgTypes,
|
||||
}.Build()
|
||||
File_cns_grpc_proto_server_proto = out.File
|
||||
file_cns_grpc_proto_server_proto_rawDesc = nil
|
||||
file_cns_grpc_proto_server_proto_goTypes = nil
|
||||
file_cns_grpc_proto_server_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc v3.12.4
|
||||
// source: cns/grpc/proto/server.proto
|
||||
|
||||
package v1alpha
|
||||
|
||||
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
|
||||
|
||||
const (
|
||||
CNS_SetOrchestratorInfo_FullMethodName = "/cns.CNS/SetOrchestratorInfo"
|
||||
CNS_GetNodeInfo_FullMethodName = "/cns.CNS/GetNodeInfo"
|
||||
)
|
||||
|
||||
// CNSClient is the client API for CNS 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 CNSClient interface {
|
||||
// Sets the orchestrator information for a node.
|
||||
SetOrchestratorInfo(ctx context.Context, in *SetOrchestratorInfoRequest, opts ...grpc.CallOption) (*SetOrchestratorInfoResponse, error)
|
||||
// Retrieves detailed information about a specific node.
|
||||
// Primarily used for health checks.
|
||||
GetNodeInfo(ctx context.Context, in *NodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoResponse, error)
|
||||
}
|
||||
|
||||
type cNSClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewCNSClient(cc grpc.ClientConnInterface) CNSClient {
|
||||
return &cNSClient{cc}
|
||||
}
|
||||
|
||||
func (c *cNSClient) SetOrchestratorInfo(ctx context.Context, in *SetOrchestratorInfoRequest, opts ...grpc.CallOption) (*SetOrchestratorInfoResponse, error) {
|
||||
out := new(SetOrchestratorInfoResponse)
|
||||
err := c.cc.Invoke(ctx, CNS_SetOrchestratorInfo_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *cNSClient) GetNodeInfo(ctx context.Context, in *NodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoResponse, error) {
|
||||
out := new(NodeInfoResponse)
|
||||
err := c.cc.Invoke(ctx, CNS_GetNodeInfo_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// CNSServer is the server API for CNS service.
|
||||
// All implementations must embed UnimplementedCNSServer
|
||||
// for forward compatibility
|
||||
type CNSServer interface {
|
||||
// Sets the orchestrator information for a node.
|
||||
SetOrchestratorInfo(context.Context, *SetOrchestratorInfoRequest) (*SetOrchestratorInfoResponse, error)
|
||||
// Retrieves detailed information about a specific node.
|
||||
// Primarily used for health checks.
|
||||
GetNodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoResponse, error)
|
||||
mustEmbedUnimplementedCNSServer()
|
||||
}
|
||||
|
||||
// UnimplementedCNSServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedCNSServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedCNSServer) SetOrchestratorInfo(context.Context, *SetOrchestratorInfoRequest) (*SetOrchestratorInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetOrchestratorInfo not implemented")
|
||||
}
|
||||
func (UnimplementedCNSServer) GetNodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetNodeInfo not implemented")
|
||||
}
|
||||
func (UnimplementedCNSServer) mustEmbedUnimplementedCNSServer() {}
|
||||
|
||||
// UnsafeCNSServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to CNSServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeCNSServer interface {
|
||||
mustEmbedUnimplementedCNSServer()
|
||||
}
|
||||
|
||||
func RegisterCNSServer(s grpc.ServiceRegistrar, srv CNSServer) {
|
||||
s.RegisterService(&CNS_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _CNS_SetOrchestratorInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetOrchestratorInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CNSServer).SetOrchestratorInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: CNS_SetOrchestratorInfo_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CNSServer).SetOrchestratorInfo(ctx, req.(*SetOrchestratorInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _CNS_GetNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NodeInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CNSServer).GetNodeInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: CNS_GetNodeInfo_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CNSServer).GetNodeInfo(ctx, req.(*NodeInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// CNS_ServiceDesc is the grpc.ServiceDesc for CNS service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var CNS_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cns.CNS",
|
||||
HandlerType: (*CNSServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "SetOrchestratorInfo",
|
||||
Handler: _CNS_SetOrchestratorInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetNodeInfo",
|
||||
Handler: _CNS_GetNodeInfo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cns/grpc/proto/server.proto",
|
||||
}
|
Загрузка…
Ссылка в новой задаче