svcapi

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Overview

Package svcapi is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_svcapi_svcapi_proto protoreflect.FileDescriptor
View Source
var Svcapi_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "service.collector.svcapi.Svcapi",
	HandlerType: (*SvcapiServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _Svcapi_Create_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _Svcapi_Get_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Svcapi_Delete_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _Svcapi_Update_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "svcapi/svcapi.proto",
}

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

Functions

func RegisterSvcapiHandler

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

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

func RegisterSvcapiHandlerClient

func RegisterSvcapiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SvcapiClient) error

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

func RegisterSvcapiHandlerFromEndpoint

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

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

func RegisterSvcapiHandlerServer

func RegisterSvcapiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SvcapiServer) error

RegisterSvcapiHandlerServer registers the http handlers for service Svcapi to "mux". UnaryRPC :call SvcapiServer 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 RegisterSvcapiHandlerFromEndpoint instead.

func RegisterSvcapiServer

func RegisterSvcapiServer(s grpc.ServiceRegistrar, srv SvcapiServer)

Types

type CreateReply

type CreateReply struct {
	Code    int32       `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string      `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Svcapi  *SvcapiMeta `protobuf:"bytes,3,opt,name=svcapi,proto3" json:"svcapi,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateReply) Descriptor deprecated

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

Deprecated: Use CreateReply.ProtoReflect.Descriptor instead.

func (*CreateReply) GetCode

func (x *CreateReply) GetCode() int32

func (*CreateReply) GetMessage

func (x *CreateReply) GetMessage() string

func (*CreateReply) GetSvcapi

func (x *CreateReply) GetSvcapi() *SvcapiMeta

func (*CreateReply) ProtoMessage

func (*CreateReply) ProtoMessage()

func (*CreateReply) ProtoReflect

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

func (*CreateReply) Reset

func (x *CreateReply) Reset()

func (*CreateReply) String

func (x *CreateReply) String() string

type CreateRequest

type CreateRequest struct {
	ServiceId int32  `protobuf:"varint,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	Path      string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Method    string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
	Describe  string `protobuf:"bytes,4,opt,name=describe,proto3" json:"describe,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetDescribe

func (x *CreateRequest) GetDescribe() string

func (*CreateRequest) GetMethod

func (x *CreateRequest) GetMethod() string

func (*CreateRequest) GetPath

func (x *CreateRequest) GetPath() string

func (*CreateRequest) GetServiceId

func (x *CreateRequest) GetServiceId() int32

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type DeleteReply

type DeleteReply struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteReply) Descriptor deprecated

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

Deprecated: Use DeleteReply.ProtoReflect.Descriptor instead.

func (*DeleteReply) GetCode

func (x *DeleteReply) GetCode() int32

func (*DeleteReply) GetMessage

func (x *DeleteReply) GetMessage() string

func (*DeleteReply) ProtoMessage

func (*DeleteReply) ProtoMessage()

func (*DeleteReply) ProtoReflect

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

func (*DeleteReply) Reset

func (x *DeleteReply) Reset()

func (*DeleteReply) String

func (x *DeleteReply) String() string

type DeleteRequest

type DeleteRequest struct {
	ServiceId int32 `protobuf:"varint,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	Uuid      int32 `protobuf:"varint,2,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetServiceId

func (x *DeleteRequest) GetServiceId() int32

func (*DeleteRequest) GetUuid

func (x *DeleteRequest) GetUuid() int32

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type GetReply

type GetReply struct {
	Code    int32         `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string        `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Svcapis []*SvcapiMeta `protobuf:"bytes,3,rep,name=svcapis,proto3" json:"svcapis,omitempty"`
	Count   int32         `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
	Total   int32         `protobuf:"varint,5,opt,name=total,proto3" json:"total,omitempty"`
	Page    int32         `protobuf:"varint,6,opt,name=page,proto3" json:"page,omitempty"`
	Limit   int32         `protobuf:"varint,7,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

func (*GetReply) Descriptor deprecated

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

Deprecated: Use GetReply.ProtoReflect.Descriptor instead.

func (*GetReply) GetCode

func (x *GetReply) GetCode() int32

func (*GetReply) GetCount

func (x *GetReply) GetCount() int32

func (*GetReply) GetLimit

func (x *GetReply) GetLimit() int32

func (*GetReply) GetMessage

func (x *GetReply) GetMessage() string

func (*GetReply) GetPage

func (x *GetReply) GetPage() int32

func (*GetReply) GetSvcapis

func (x *GetReply) GetSvcapis() []*SvcapiMeta

func (*GetReply) GetTotal

func (x *GetReply) GetTotal() int32

func (*GetReply) ProtoMessage

func (*GetReply) ProtoMessage()

func (*GetReply) ProtoReflect

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

func (*GetReply) Reset

func (x *GetReply) Reset()

func (*GetReply) String

func (x *GetReply) String() string

type GetRequest

type GetRequest struct {
	Page      int32  `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
	Limit     int32  `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	ServiceId int32  `protobuf:"varint,3,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	Uuid      int32  `protobuf:"varint,4,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Path      string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"`
	Method    string `protobuf:"bytes,6,opt,name=method,proto3" json:"method,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetLimit

func (x *GetRequest) GetLimit() int32

func (*GetRequest) GetMethod

func (x *GetRequest) GetMethod() string

func (*GetRequest) GetPage

func (x *GetRequest) GetPage() int32

func (*GetRequest) GetPath

func (x *GetRequest) GetPath() string

func (*GetRequest) GetServiceId

func (x *GetRequest) GetServiceId() int32

func (*GetRequest) GetUuid

func (x *GetRequest) GetUuid() int32

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type SvcapiClient

type SvcapiClient interface {
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateReply, error)
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteReply, error)
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateReply, error)
}

SvcapiClient is the client API for Svcapi 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 NewSvcapiClient

func NewSvcapiClient(cc grpc.ClientConnInterface) SvcapiClient

type SvcapiMeta

type SvcapiMeta struct {
	Uuid       int32                  `protobuf:"varint,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Path       string                 `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Method     string                 `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
	Describe   string                 `protobuf:"bytes,4,opt,name=describe,proto3" json:"describe,omitempty"`
	CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
	UpdateTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
	ServiceId  int32                  `protobuf:"varint,7,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	TenantId   int32                  `protobuf:"varint,8,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"`
	// contains filtered or unexported fields
}

func (*SvcapiMeta) Descriptor deprecated

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

Deprecated: Use SvcapiMeta.ProtoReflect.Descriptor instead.

func (*SvcapiMeta) GetCreateTime

func (x *SvcapiMeta) GetCreateTime() *timestamppb.Timestamp

func (*SvcapiMeta) GetDescribe

func (x *SvcapiMeta) GetDescribe() string

func (*SvcapiMeta) GetMethod

func (x *SvcapiMeta) GetMethod() string

func (*SvcapiMeta) GetPath

func (x *SvcapiMeta) GetPath() string

func (*SvcapiMeta) GetServiceId

func (x *SvcapiMeta) GetServiceId() int32

func (*SvcapiMeta) GetTenantId

func (x *SvcapiMeta) GetTenantId() int32

func (*SvcapiMeta) GetUpdateTime

func (x *SvcapiMeta) GetUpdateTime() *timestamppb.Timestamp

func (*SvcapiMeta) GetUuid

func (x *SvcapiMeta) GetUuid() int32

func (*SvcapiMeta) ProtoMessage

func (*SvcapiMeta) ProtoMessage()

func (*SvcapiMeta) ProtoReflect

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

func (*SvcapiMeta) Reset

func (x *SvcapiMeta) Reset()

func (*SvcapiMeta) String

func (x *SvcapiMeta) String() string

type SvcapiServer

type SvcapiServer interface {
	Create(context.Context, *CreateRequest) (*CreateReply, error)
	Get(context.Context, *GetRequest) (*GetReply, error)
	Delete(context.Context, *DeleteRequest) (*DeleteReply, error)
	Update(context.Context, *UpdateRequest) (*UpdateReply, error)
	// contains filtered or unexported methods
}

SvcapiServer is the server API for Svcapi service. All implementations must embed UnimplementedSvcapiServer for forward compatibility

type Timestamp

type Timestamp = timestamppb.Timestamp

type UnimplementedSvcapiServer

type UnimplementedSvcapiServer struct {
}

UnimplementedSvcapiServer must be embedded to have forward compatible implementations.

func (UnimplementedSvcapiServer) Create

func (UnimplementedSvcapiServer) Delete

func (UnimplementedSvcapiServer) Get

func (UnimplementedSvcapiServer) Update

type UnsafeSvcapiServer

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

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

type UpdateReply

type UpdateReply struct {
	Code    int32       `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string      `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Svcapi  *SvcapiMeta `protobuf:"bytes,3,opt,name=svcapi,proto3" json:"svcapi,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateReply) Descriptor deprecated

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

Deprecated: Use UpdateReply.ProtoReflect.Descriptor instead.

func (*UpdateReply) GetCode

func (x *UpdateReply) GetCode() int32

func (*UpdateReply) GetMessage

func (x *UpdateReply) GetMessage() string

func (*UpdateReply) GetSvcapi

func (x *UpdateReply) GetSvcapi() *SvcapiMeta

func (*UpdateReply) ProtoMessage

func (*UpdateReply) ProtoMessage()

func (*UpdateReply) ProtoReflect

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

func (*UpdateReply) Reset

func (x *UpdateReply) Reset()

func (*UpdateReply) String

func (x *UpdateReply) String() string

type UpdateRequest

type UpdateRequest struct {
	ServiceId int32  `protobuf:"varint,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	Uuid      int32  `protobuf:"varint,2,opt,name=uuid,proto3" json:"uuid,omitempty"`
	Path      string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	Method    string `protobuf:"bytes,4,opt,name=method,proto3" json:"method,omitempty"`
	Describe  string `protobuf:"bytes,5,opt,name=describe,proto3" json:"describe,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetDescribe

func (x *UpdateRequest) GetDescribe() string

func (*UpdateRequest) GetMethod

func (x *UpdateRequest) GetMethod() string

func (*UpdateRequest) GetPath

func (x *UpdateRequest) GetPath() string

func (*UpdateRequest) GetServiceId

func (x *UpdateRequest) GetServiceId() int32

func (*UpdateRequest) GetUuid

func (x *UpdateRequest) GetUuid() int32

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

Jump to

Keyboard shortcuts

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