apiv1

package
v0.0.0-...-395d267 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package apiv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var ApiService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.v1.ApiService",
	HandlerType: (*ApiServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListSamples",
			Handler:    _ApiService_ListSamples_Handler,
		},
		{
			MethodName: "ListNodes",
			Handler:    _ApiService_ListNodes_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "v1/api.proto",
}

ApiService_ServiceDesc is the grpc.ServiceDesc for ApiService 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 File_v1_api_proto protoreflect.FileDescriptor

Functions

func RegisterApiServiceHandler

func RegisterApiServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

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

func RegisterApiServiceHandlerClient

func RegisterApiServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiServiceClient) error

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

func RegisterApiServiceHandlerFromEndpoint

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

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

func RegisterApiServiceHandlerServer

func RegisterApiServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServiceServer) error

RegisterApiServiceHandlerServer registers the http handlers for service ApiService to "mux". UnaryRPC :call ApiServiceServer 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 RegisterApiServiceHandlerFromEndpoint instead.

func RegisterApiServiceServer

func RegisterApiServiceServer(s grpc.ServiceRegistrar, srv ApiServiceServer)

Types

type ApiServiceClient

type ApiServiceClient interface {
	ListSamples(ctx context.Context, in *ListSampleRequest, opts ...grpc.CallOption) (*ListSampleResponse, error)
	ListNodes(ctx context.Context, in *ListNodesRequest, opts ...grpc.CallOption) (*ListNodesResponse, error)
}

ApiServiceClient is the client API for ApiService 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.

func NewApiServiceClient

func NewApiServiceClient(cc grpc.ClientConnInterface) ApiServiceClient

type ApiServiceServer

type ApiServiceServer interface {
	ListSamples(context.Context, *ListSampleRequest) (*ListSampleResponse, error)
	ListNodes(context.Context, *ListNodesRequest) (*ListNodesResponse, error)
	// contains filtered or unexported methods
}

ApiServiceServer is the server API for ApiService service. All implementations must embed UnimplementedApiServiceServer for forward compatibility

type ListNodesRequest

type ListNodesRequest struct {
	// contains filtered or unexported fields
}

empty node request

func (*ListNodesRequest) Descriptor deprecated

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

Deprecated: Use ListNodesRequest.ProtoReflect.Descriptor instead.

func (*ListNodesRequest) ProtoMessage

func (*ListNodesRequest) ProtoMessage()

func (*ListNodesRequest) ProtoReflect

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

func (*ListNodesRequest) Reset

func (x *ListNodesRequest) Reset()

func (*ListNodesRequest) String

func (x *ListNodesRequest) String() string

type ListNodesResponse

type ListNodesResponse struct {

	// list of node names
	Nodes []string `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
	// contains filtered or unexported fields
}

response providing a list of known nodes in the mesh

func (*ListNodesResponse) Descriptor deprecated

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

Deprecated: Use ListNodesResponse.ProtoReflect.Descriptor instead.

func (*ListNodesResponse) GetNodes

func (x *ListNodesResponse) GetNodes() []string

func (*ListNodesResponse) ProtoMessage

func (*ListNodesResponse) ProtoMessage()

func (*ListNodesResponse) ProtoReflect

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

func (*ListNodesResponse) Reset

func (x *ListNodesResponse) Reset()

func (*ListNodesResponse) String

func (x *ListNodesResponse) String() string

type ListSampleRequest

type ListSampleRequest struct {
	// contains filtered or unexported fields
}

empty sample request

func (*ListSampleRequest) Descriptor deprecated

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

Deprecated: Use ListSampleRequest.ProtoReflect.Descriptor instead.

func (*ListSampleRequest) ProtoMessage

func (*ListSampleRequest) ProtoMessage()

func (*ListSampleRequest) ProtoReflect

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

func (*ListSampleRequest) Reset

func (x *ListSampleRequest) Reset()

func (*ListSampleRequest) String

func (x *ListSampleRequest) String() string

type ListSampleResponse

type ListSampleResponse struct {

	// list of messured samples
	Samples []*Sample `protobuf:"bytes,1,rep,name=samples,proto3" json:"samples,omitempty"`
	// contains filtered or unexported fields
}

response providing a list of measurement samples

func (*ListSampleResponse) Descriptor deprecated

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

Deprecated: Use ListSampleResponse.ProtoReflect.Descriptor instead.

func (*ListSampleResponse) GetSamples

func (x *ListSampleResponse) GetSamples() []*Sample

func (*ListSampleResponse) ProtoMessage

func (*ListSampleResponse) ProtoMessage()

func (*ListSampleResponse) ProtoReflect

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

func (*ListSampleResponse) Reset

func (x *ListSampleResponse) Reset()

func (*ListSampleResponse) String

func (x *ListSampleResponse) String() string

type Sample

type Sample struct {

	// by whom the sample was messured
	From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	// to whom the sample was messured
	To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	// the sample name
	Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// the sample value
	Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
	// when the sample was messured
	Ts string `protobuf:"bytes,5,opt,name=ts,proto3" json:"ts,omitempty"`
	// contains filtered or unexported fields
}

a measurement sample

func (*Sample) Descriptor deprecated

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

Deprecated: Use Sample.ProtoReflect.Descriptor instead.

func (*Sample) GetFrom

func (x *Sample) GetFrom() string

func (*Sample) GetTo

func (x *Sample) GetTo() string

func (*Sample) GetTs

func (x *Sample) GetTs() string

func (*Sample) GetType

func (x *Sample) GetType() string

func (*Sample) GetValue

func (x *Sample) GetValue() string

func (*Sample) ProtoMessage

func (*Sample) ProtoMessage()

func (*Sample) ProtoReflect

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

func (*Sample) Reset

func (x *Sample) Reset()

func (*Sample) String

func (x *Sample) String() string

type UnimplementedApiServiceServer

type UnimplementedApiServiceServer struct {
}

UnimplementedApiServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedApiServiceServer) ListNodes

func (UnimplementedApiServiceServer) ListSamples

type UnsafeApiServiceServer

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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