proto

package
v0.0.13-r4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Status_name = map[int32]string{
		0: "UNKNOWN",
		1: "SERVING",
		2: "OFFLINE",
		3: "RUNNING",
		4: "STOPPED",
		5: "INTENAL",
		6: "HASERRS",
		7: "NOEXIST",
	}
	Status_value = map[string]int32{
		"UNKNOWN": 0,
		"SERVING": 1,
		"OFFLINE": 2,
		"RUNNING": 3,
		"STOPPED": 4,
		"INTENAL": 5,
		"HASERRS": 6,
		"NOEXIST": 7,
	}
)

Enum value maps for Status.

View Source
var File_pkg_health_proto_health_proto protoreflect.FileDescriptor
View Source
var HealthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "nocloud.health.HealthService",
	HandlerType: (*HealthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Probe",
			Handler:    _HealthService_Probe_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/health/proto/health.proto",
}

HealthService_ServiceDesc is the grpc.ServiceDesc for HealthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var InternalProbeService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "nocloud.health.InternalProbeService",
	HandlerType: (*InternalProbeServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Service",
			Handler:    _InternalProbeService_Service_Handler,
		},
		{
			MethodName: "Routine",
			Handler:    _InternalProbeService_Routine_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/health/proto/health.proto",
}

InternalProbeService_ServiceDesc is the grpc.ServiceDesc for InternalProbeService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHealthServiceHandler

func RegisterHealthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn grpc.ClientConnInterface) error

RegisterHealthServiceHandler registers the http handlers for service HealthService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterHealthServiceHandlerClient

func RegisterHealthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HealthServiceClient) error

RegisterHealthServiceHandlerClient registers the http handlers for service HealthService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HealthServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HealthServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HealthServiceClient" to call the correct interceptors.

func RegisterHealthServiceHandlerFromEndpoint

func RegisterHealthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterHealthServiceHandlerFromEndpoint is same as RegisterHealthServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterHealthServiceHandlerServer

func RegisterHealthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HealthServiceServer) error

RegisterHealthServiceHandlerServer registers the http handlers for service HealthService to "mux". UnaryRPC :call HealthServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterHealthServiceHandlerFromEndpoint instead.

func RegisterHealthServiceServer

func RegisterHealthServiceServer(s grpc.ServiceRegistrar, srv HealthServiceServer)

func RegisterInternalProbeServiceServer

func RegisterInternalProbeServiceServer(s grpc.ServiceRegistrar, srv InternalProbeServiceServer)

Types

type HealthServiceClient

type HealthServiceClient interface {
	Probe(ctx context.Context, in *ProbeRequest, opts ...grpc.CallOption) (*ProbeResponse, error)
}

HealthServiceClient is the client API for HealthService 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 HealthServiceServer

type HealthServiceServer interface {
	Probe(context.Context, *ProbeRequest) (*ProbeResponse, error)
	// contains filtered or unexported methods
}

HealthServiceServer is the server API for HealthService service. All implementations must embed UnimplementedHealthServiceServer for forward compatibility

type InternalProbeServiceClient

type InternalProbeServiceClient interface {
	Service(ctx context.Context, in *ProbeRequest, opts ...grpc.CallOption) (*ServingStatus, error)
	Routine(ctx context.Context, in *ProbeRequest, opts ...grpc.CallOption) (*RoutineStatus, error)
}

InternalProbeServiceClient is the client API for InternalProbeService 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 InternalProbeServiceServer

type InternalProbeServiceServer interface {
	Service(context.Context, *ProbeRequest) (*ServingStatus, error)
	Routine(context.Context, *ProbeRequest) (*RoutineStatus, error)
	// contains filtered or unexported methods
}

InternalProbeServiceServer is the server API for InternalProbeService service. All implementations must embed UnimplementedInternalProbeServiceServer for forward compatibility

type ProbeRequest

type ProbeRequest struct {
	ProbeType string `protobuf:"bytes,1,opt,name=probe_type,json=probeType,proto3" json:"probe_type,omitempty"`
	Payload   string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*ProbeRequest) Descriptor deprecated

func (*ProbeRequest) Descriptor() ([]byte, []int)

Deprecated: Use ProbeRequest.ProtoReflect.Descriptor instead.

func (*ProbeRequest) GetPayload

func (x *ProbeRequest) GetPayload() string

func (*ProbeRequest) GetProbeType

func (x *ProbeRequest) GetProbeType() string

func (*ProbeRequest) ProtoMessage

func (*ProbeRequest) ProtoMessage()

func (*ProbeRequest) ProtoReflect

func (x *ProbeRequest) ProtoReflect() protoreflect.Message

func (*ProbeRequest) Reset

func (x *ProbeRequest) Reset()

func (*ProbeRequest) String

func (x *ProbeRequest) String() string

type ProbeResponse

type ProbeResponse struct {
	Response string           `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
	Status   Status           `protobuf:"varint,2,opt,name=status,proto3,enum=nocloud.health.Status" json:"status,omitempty"`
	Serving  []*ServingStatus `protobuf:"bytes,3,rep,name=serving,proto3" json:"serving,omitempty"`
	Routines []*RoutineStatus `protobuf:"bytes,4,rep,name=routines,proto3" json:"routines,omitempty"`
	// contains filtered or unexported fields
}

func (*ProbeResponse) Descriptor deprecated

func (*ProbeResponse) Descriptor() ([]byte, []int)

Deprecated: Use ProbeResponse.ProtoReflect.Descriptor instead.

func (*ProbeResponse) GetResponse

func (x *ProbeResponse) GetResponse() string

func (*ProbeResponse) GetRoutines

func (x *ProbeResponse) GetRoutines() []*RoutineStatus

func (*ProbeResponse) GetServing

func (x *ProbeResponse) GetServing() []*ServingStatus

func (*ProbeResponse) GetStatus

func (x *ProbeResponse) GetStatus() Status

func (*ProbeResponse) ProtoMessage

func (*ProbeResponse) ProtoMessage()

func (*ProbeResponse) ProtoReflect

func (x *ProbeResponse) ProtoReflect() protoreflect.Message

func (*ProbeResponse) Reset

func (x *ProbeResponse) Reset()

func (*ProbeResponse) String

func (x *ProbeResponse) String() string

type RoutineStatus

type RoutineStatus struct {
	Routine       string         `protobuf:"bytes,1,opt,name=routine,proto3" json:"routine,omitempty"`
	Status        *ServingStatus `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	LastExecution string         `protobuf:"bytes,3,opt,name=last_execution,json=lastExecution,proto3" json:"last_execution,omitempty"`
	// contains filtered or unexported fields
}

func (*RoutineStatus) Descriptor deprecated

func (*RoutineStatus) Descriptor() ([]byte, []int)

Deprecated: Use RoutineStatus.ProtoReflect.Descriptor instead.

func (*RoutineStatus) GetLastExecution

func (x *RoutineStatus) GetLastExecution() string

func (*RoutineStatus) GetRoutine

func (x *RoutineStatus) GetRoutine() string

func (*RoutineStatus) GetStatus

func (x *RoutineStatus) GetStatus() *ServingStatus

func (*RoutineStatus) ProtoMessage

func (*RoutineStatus) ProtoMessage()

func (*RoutineStatus) ProtoReflect

func (x *RoutineStatus) ProtoReflect() protoreflect.Message

func (*RoutineStatus) Reset

func (x *RoutineStatus) Reset()

func (*RoutineStatus) String

func (x *RoutineStatus) String() string

type ServingStatus

type ServingStatus struct {
	Service string  `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	Status  Status  `protobuf:"varint,2,opt,name=status,proto3,enum=nocloud.health.Status" json:"status,omitempty"`
	Error   *string `protobuf:"bytes,3,opt,name=error,proto3,oneof" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*ServingStatus) Descriptor deprecated

func (*ServingStatus) Descriptor() ([]byte, []int)

Deprecated: Use ServingStatus.ProtoReflect.Descriptor instead.

func (*ServingStatus) GetError

func (x *ServingStatus) GetError() string

func (*ServingStatus) GetService

func (x *ServingStatus) GetService() string

func (*ServingStatus) GetStatus

func (x *ServingStatus) GetStatus() Status

func (*ServingStatus) ProtoMessage

func (*ServingStatus) ProtoMessage()

func (*ServingStatus) ProtoReflect

func (x *ServingStatus) ProtoReflect() protoreflect.Message

func (*ServingStatus) Reset

func (x *ServingStatus) Reset()

func (*ServingStatus) String

func (x *ServingStatus) String() string

type Status

type Status int32
const (
	Status_UNKNOWN Status = 0
	Status_SERVING Status = 1 // Service is up and running
	Status_OFFLINE Status = 2 // Service is offline(down)
	Status_RUNNING Status = 3 // Routine is running
	Status_STOPPED Status = 4 // Routine is stopped
	Status_INTENAL Status = 5 // Internal error while making status
	Status_HASERRS Status = 6 // Check has errors
	Status_NOEXIST Status = 7 // Service has no Routines
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type UnimplementedHealthServiceServer

type UnimplementedHealthServiceServer struct {
}

UnimplementedHealthServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedHealthServiceServer) Probe

type UnimplementedInternalProbeServiceServer

type UnimplementedInternalProbeServiceServer struct {
}

UnimplementedInternalProbeServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedInternalProbeServiceServer) Routine

func (UnimplementedInternalProbeServiceServer) Service

type UnsafeHealthServiceServer

type UnsafeHealthServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeHealthServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HealthServiceServer will result in compilation errors.

type UnsafeInternalProbeServiceServer

type UnsafeInternalProbeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeInternalProbeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to InternalProbeServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL