endpoint

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BoolQuery_name = map[int32]string{
		0: "ALL",
		1: "TRUE",
		2: "FALSE",
	}
	BoolQuery_value = map[string]int32{
		"ALL":   0,
		"TRUE":  1,
		"FALSE": 2,
	}
)

Enum value maps for BoolQuery.

View Source
var File_pkg_endpoint_pb_endpoint_proto protoreflect.FileDescriptor
View Source
var File_pkg_endpoint_pb_enum_proto protoreflect.FileDescriptor
View Source
var File_pkg_endpoint_pb_request_proto protoreflect.FileDescriptor
View Source
var File_pkg_endpoint_pb_resource_proto protoreflect.FileDescriptor
View Source
var File_pkg_endpoint_pb_service_proto protoreflect.FileDescriptor

Functions

func GenHashID added in v0.2.0

func GenHashID(service, grpcPath string) string

GenHashID hash id

func HttpEntry added in v0.2.0

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterEndpointServiceServer added in v0.2.0

func RegisterEndpointServiceServer(s *grpc.Server, srv EndpointServiceServer)

Types

type BoolQuery added in v0.2.0

type BoolQuery int32
const (
	// ALL todo
	BoolQuery_ALL BoolQuery = 0
	// Pending todo
	BoolQuery_TRUE BoolQuery = 1
	// Passed todo
	BoolQuery_FALSE BoolQuery = 2
)

func ParseBoolQueryFromString added in v0.2.0

func ParseBoolQueryFromString(str string) (BoolQuery, error)

ParseBoolQueryFromString Parse BoolQuery from string

func (BoolQuery) Descriptor added in v0.2.0

func (BoolQuery) Descriptor() protoreflect.EnumDescriptor

func (BoolQuery) Enum added in v0.2.0

func (x BoolQuery) Enum() *BoolQuery

func (BoolQuery) EnumDescriptor deprecated added in v0.2.0

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

Deprecated: Use BoolQuery.Descriptor instead.

func (BoolQuery) Equal added in v0.2.0

func (t BoolQuery) Equal(target BoolQuery) bool

Equal type compare

func (BoolQuery) IsIn added in v0.2.0

func (t BoolQuery) IsIn(targets ...BoolQuery) bool

IsIn todo

func (BoolQuery) MarshalJSON added in v0.2.0

func (t BoolQuery) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (BoolQuery) Number added in v0.2.0

func (x BoolQuery) Number() protoreflect.EnumNumber

func (BoolQuery) String added in v0.2.0

func (x BoolQuery) String() string

func (BoolQuery) Type added in v0.2.0

func (*BoolQuery) UnmarshalJSON added in v0.2.0

func (t *BoolQuery) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type DeleteEndpointRequest added in v0.2.0

type DeleteEndpointRequest struct {
	ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id"`
	// contains filtered or unexported fields
}

DeleteEndpointRequest todo

func NewDeleteEndpointRequestWithServiceID added in v0.2.0

func NewDeleteEndpointRequestWithServiceID(id string) *DeleteEndpointRequest

NewDeleteEndpointRequestWithServiceID todo

func (*DeleteEndpointRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use DeleteEndpointRequest.ProtoReflect.Descriptor instead.

func (*DeleteEndpointRequest) GetServiceId added in v0.2.0

func (x *DeleteEndpointRequest) GetServiceId() string

func (*DeleteEndpointRequest) ProtoMessage added in v0.2.0

func (*DeleteEndpointRequest) ProtoMessage()

func (*DeleteEndpointRequest) ProtoReflect added in v0.2.0

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

func (*DeleteEndpointRequest) Reset added in v0.2.0

func (x *DeleteEndpointRequest) Reset()

func (*DeleteEndpointRequest) String added in v0.2.0

func (x *DeleteEndpointRequest) String() string

type DescribeEndpointRequest

type DescribeEndpointRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// contains filtered or unexported fields
}

DescribeEndpointRequest todo

func NewDescribeEndpointRequestWithID added in v0.2.0

func NewDescribeEndpointRequestWithID(id string) *DescribeEndpointRequest

NewDescribeEndpointRequestWithID todo

func (*DescribeEndpointRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use DescribeEndpointRequest.ProtoReflect.Descriptor instead.

func (*DescribeEndpointRequest) GetId added in v0.2.0

func (x *DescribeEndpointRequest) GetId() string

func (*DescribeEndpointRequest) ProtoMessage added in v0.2.0

func (*DescribeEndpointRequest) ProtoMessage()

func (*DescribeEndpointRequest) ProtoReflect added in v0.2.0

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

func (*DescribeEndpointRequest) Reset added in v0.2.0

func (x *DescribeEndpointRequest) Reset()

func (*DescribeEndpointRequest) String added in v0.2.0

func (x *DescribeEndpointRequest) String() string

func (*DescribeEndpointRequest) Validate added in v0.2.0

func (req *DescribeEndpointRequest) Validate() error

Validate 校验

type Endpoint

type Endpoint struct {

	// 端点名称
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id" validate:"required,lte=64"`
	// 创建时间
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty" bson:"create_at"`
	// 更新时间
	UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty" bson:"update_at"`
	// 该功能属于那个服务
	ServiceId string `` /* 133-byte string literal not displayed */
	// 服务那个版本的功能
	Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty" bson:"version" validate:"required,lte=64"`
	// 路由条目信息
	Entry *http.Entry `protobuf:"bytes,6,opt,name=entry,proto3" json:"entry" bson:"entry" validate:"required"`
	// contains filtered or unexported fields
}

Endpoint Service's features

func NewDefaultEndpoint

func NewDefaultEndpoint() *Endpoint

NewDefaultEndpoint todo

func NewEndpoint added in v0.2.0

func NewEndpoint(serviceID, version string, entry http.Entry) *Endpoint

NewEndpoint todo

func (*Endpoint) Descriptor deprecated added in v0.2.0

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

Deprecated: Use Endpoint.ProtoReflect.Descriptor instead.

func (*Endpoint) GetCreateAt added in v0.2.0

func (x *Endpoint) GetCreateAt() int64

func (*Endpoint) GetEntry added in v0.2.0

func (x *Endpoint) GetEntry() *http.Entry

func (*Endpoint) GetId added in v0.2.0

func (x *Endpoint) GetId() string

func (*Endpoint) GetServiceId added in v0.2.0

func (x *Endpoint) GetServiceId() string

func (*Endpoint) GetUpdateAt added in v0.2.0

func (x *Endpoint) GetUpdateAt() int64

func (*Endpoint) GetVersion added in v0.2.0

func (x *Endpoint) GetVersion() string

func (*Endpoint) LabelsToStr

func (e *Endpoint) LabelsToStr() string

LabelsToStr 扁平化标签 action:get;action:list;action-list-echo

func (*Endpoint) ParseLabels

func (e *Endpoint) ParseLabels(labels string) error

ParseLabels 解析Str格式的label

func (*Endpoint) ProtoMessage added in v0.2.0

func (*Endpoint) ProtoMessage()

func (*Endpoint) ProtoReflect added in v0.2.0

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

func (*Endpoint) Reset added in v0.2.0

func (x *Endpoint) Reset()

func (*Endpoint) String added in v0.2.0

func (x *Endpoint) String() string

type EndpointServiceClient added in v0.2.0

type EndpointServiceClient interface {
	DescribeEndpoint(ctx context.Context, in *DescribeEndpointRequest, opts ...grpc.CallOption) (*Endpoint, error)
	QueryEndpoints(ctx context.Context, in *QueryEndpointRequest, opts ...grpc.CallOption) (*Set, error)
	Registry(ctx context.Context, in *RegistryRequest, opts ...grpc.CallOption) (*RegistryResponse, error)
	DeleteEndpoint(ctx context.Context, in *DeleteEndpointRequest, opts ...grpc.CallOption) (*Endpoint, error)
	QueryResources(ctx context.Context, in *QueryResourceRequest, opts ...grpc.CallOption) (*ResourceSet, error)
}

EndpointServiceClient is the client API for EndpointService 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 NewEndpointServiceClient added in v0.2.0

func NewEndpointServiceClient(cc grpc.ClientConnInterface) EndpointServiceClient

type EndpointServiceServer added in v0.2.0

type EndpointServiceServer interface {
	DescribeEndpoint(context.Context, *DescribeEndpointRequest) (*Endpoint, error)
	QueryEndpoints(context.Context, *QueryEndpointRequest) (*Set, error)
	Registry(context.Context, *RegistryRequest) (*RegistryResponse, error)
	DeleteEndpoint(context.Context, *DeleteEndpointRequest) (*Endpoint, error)
	QueryResources(context.Context, *QueryResourceRequest) (*ResourceSet, error)
	// contains filtered or unexported methods
}

EndpointServiceServer is the server API for EndpointService service. All implementations must embed UnimplementedEndpointServiceServer for forward compatibility

type QueryEndpointRequest

type QueryEndpointRequest struct {
	Page             *page.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	ServiceId        string            `protobuf:"bytes,2,opt,name=service_id,json=serviceId,proto3" json:"service_id"`
	Path             string            `protobuf:"bytes,3,opt,name=path,proto3" json:"path"`
	Method           string            `protobuf:"bytes,4,opt,name=method,proto3" json:"method"`
	FunctionName     string            `protobuf:"bytes,5,opt,name=function_name,json=functionName,proto3" json:"function_name"`
	Resource         string            `protobuf:"bytes,6,opt,name=resource,proto3" json:"resource"`
	Labels           map[string]string `` /* 143-byte string literal not displayed */
	PermissionEnable BoolQuery         `` /* 132-byte string literal not displayed */
	// contains filtered or unexported fields
}

QueryEndpointRequest 查询应用列表

func NewQueryEndpointRequest

func NewQueryEndpointRequest(pageReq *request.PageRequest) *QueryEndpointRequest

NewQueryEndpointRequest 列表查询请求

func NewQueryEndpointRequestFromHTTP added in v0.2.0

func NewQueryEndpointRequestFromHTTP(r *http.Request) *QueryEndpointRequest

NewQueryEndpointRequestFromHTTP 列表查询请求

func (*QueryEndpointRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use QueryEndpointRequest.ProtoReflect.Descriptor instead.

func (*QueryEndpointRequest) GetFunctionName added in v0.2.0

func (x *QueryEndpointRequest) GetFunctionName() string

func (*QueryEndpointRequest) GetLabels added in v0.2.0

func (x *QueryEndpointRequest) GetLabels() map[string]string

func (*QueryEndpointRequest) GetMethod added in v0.2.0

func (x *QueryEndpointRequest) GetMethod() string

func (*QueryEndpointRequest) GetPage added in v0.2.0

func (x *QueryEndpointRequest) GetPage() *page.PageRequest

func (*QueryEndpointRequest) GetPath added in v0.2.0

func (x *QueryEndpointRequest) GetPath() string

func (*QueryEndpointRequest) GetPermissionEnable added in v0.2.0

func (x *QueryEndpointRequest) GetPermissionEnable() BoolQuery

func (*QueryEndpointRequest) GetResource added in v0.2.0

func (x *QueryEndpointRequest) GetResource() string

func (*QueryEndpointRequest) GetServiceId added in v0.2.0

func (x *QueryEndpointRequest) GetServiceId() string

func (*QueryEndpointRequest) ProtoMessage added in v0.2.0

func (*QueryEndpointRequest) ProtoMessage()

func (*QueryEndpointRequest) ProtoReflect added in v0.2.0

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

func (*QueryEndpointRequest) Reset added in v0.2.0

func (x *QueryEndpointRequest) Reset()

func (*QueryEndpointRequest) String added in v0.2.0

func (x *QueryEndpointRequest) String() string

type QueryResourceRequest added in v0.2.0

type QueryResourceRequest struct {
	Page             *page.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	ServiceIds       []string          `protobuf:"bytes,2,rep,name=service_ids,json=serviceIds,proto3" json:"service_ids"`
	PermissionEnable BoolQuery         `` /* 132-byte string literal not displayed */
	// contains filtered or unexported fields
}

QueryResourceRequest todo

func NewQueryResourceRequestFromHTTP added in v0.2.0

func NewQueryResourceRequestFromHTTP(r *http.Request) *QueryResourceRequest

NewQueryResourceRequestFromHTTP 列表查询请求

func (*QueryResourceRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use QueryResourceRequest.ProtoReflect.Descriptor instead.

func (*QueryResourceRequest) GetPage added in v0.2.0

func (x *QueryResourceRequest) GetPage() *page.PageRequest

func (*QueryResourceRequest) GetPermissionEnable added in v0.2.0

func (x *QueryResourceRequest) GetPermissionEnable() BoolQuery

func (*QueryResourceRequest) GetServiceIds added in v0.2.0

func (x *QueryResourceRequest) GetServiceIds() []string

func (*QueryResourceRequest) ProtoMessage added in v0.2.0

func (*QueryResourceRequest) ProtoMessage()

func (*QueryResourceRequest) ProtoReflect added in v0.2.0

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

func (*QueryResourceRequest) Reset added in v0.2.0

func (x *QueryResourceRequest) Reset()

func (*QueryResourceRequest) String added in v0.2.0

func (x *QueryResourceRequest) String() string

func (*QueryResourceRequest) Validate added in v0.2.0

func (req *QueryResourceRequest) Validate() error

Validate todo

type RegistryRequest

type RegistryRequest struct {
	Version string        `protobuf:"bytes,3,opt,name=version,proto3" json:"version" validate:"required,lte=32"`
	Entries []*http.Entry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"`
	// contains filtered or unexported fields
}

RegistryRequest 服务注册请求

func NewDefaultRegistryRequest

func NewDefaultRegistryRequest() *RegistryRequest

NewDefaultRegistryRequest todo

func NewRegistryRequest

func NewRegistryRequest(version string, entries []*httpb.Entry) *RegistryRequest

NewRegistryRequest 注册请求

func (*RegistryRequest) Descriptor deprecated added in v0.2.0

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

Deprecated: Use RegistryRequest.ProtoReflect.Descriptor instead.

func (*RegistryRequest) Endpoints

func (req *RegistryRequest) Endpoints(serviceID string) []*Endpoint

Endpoints 功能列表

func (*RegistryRequest) GetEntries added in v0.2.0

func (x *RegistryRequest) GetEntries() []*http.Entry

func (*RegistryRequest) GetVersion added in v0.2.0

func (x *RegistryRequest) GetVersion() string

func (*RegistryRequest) ProtoMessage added in v0.2.0

func (*RegistryRequest) ProtoMessage()

func (*RegistryRequest) ProtoReflect added in v0.2.0

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

func (*RegistryRequest) Reset added in v0.2.0

func (x *RegistryRequest) Reset()

func (*RegistryRequest) String added in v0.2.0

func (x *RegistryRequest) String() string

func (*RegistryRequest) Validate

func (req *RegistryRequest) Validate() error

Validate 校验注册请求合法性

type RegistryResponse added in v0.2.0

type RegistryResponse struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message"`
	// contains filtered or unexported fields
}

RegistryReponse todo

func NewRegistryResponse added in v0.2.0

func NewRegistryResponse(message string) *RegistryResponse

NewRegistryResponse todo

func (*RegistryResponse) Descriptor deprecated added in v0.2.0

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

Deprecated: Use RegistryResponse.ProtoReflect.Descriptor instead.

func (*RegistryResponse) GetMessage added in v0.2.0

func (x *RegistryResponse) GetMessage() string

func (*RegistryResponse) ProtoMessage added in v0.2.0

func (*RegistryResponse) ProtoMessage()

func (*RegistryResponse) ProtoReflect added in v0.2.0

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

func (*RegistryResponse) Reset added in v0.2.0

func (x *RegistryResponse) Reset()

func (*RegistryResponse) String added in v0.2.0

func (x *RegistryResponse) String() string

type Resource added in v0.2.0

type Resource struct {

	// 资源所属服务名称
	ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id"`
	// 资源名称
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"`
	// 资源支持操作的path
	Paths []string `protobuf:"bytes,3,rep,name=paths,proto3" json:"paths"`
	// 支持操作的方法
	Methods []string `protobuf:"bytes,4,rep,name=methods,proto3" json:"methods"`
	// 支持操作的函数
	Functions []string `protobuf:"bytes,5,rep,name=functions,proto3" json:"functions"`
	// 支持操作的动作
	Actions []string `protobuf:"bytes,6,rep,name=actions,proto3" json:"actions"`
	// contains filtered or unexported fields
}

Resource todo

func (*Resource) Descriptor deprecated added in v0.2.0

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

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) GetActions added in v0.2.0

func (x *Resource) GetActions() []string

func (*Resource) GetFunctions added in v0.2.0

func (x *Resource) GetFunctions() []string

func (*Resource) GetMethods added in v0.2.0

func (x *Resource) GetMethods() []string

func (*Resource) GetName added in v0.2.0

func (x *Resource) GetName() string

func (*Resource) GetPaths added in v0.2.0

func (x *Resource) GetPaths() []string

func (*Resource) GetServiceId added in v0.2.0

func (x *Resource) GetServiceId() string

func (*Resource) ProtoMessage added in v0.2.0

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect added in v0.2.0

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

func (*Resource) Reset added in v0.2.0

func (x *Resource) Reset()

func (*Resource) String added in v0.2.0

func (x *Resource) String() string

func (*Resource) UpdateAction added in v0.2.0

func (r *Resource) UpdateAction(action string)

UpdateAction todo

func (*Resource) UpdateFunction added in v0.2.0

func (r *Resource) UpdateFunction(fuction string)

UpdateFunction todo

func (*Resource) UpdateMethod added in v0.2.0

func (r *Resource) UpdateMethod(mothod string)

UpdateMethod todo

func (*Resource) UpdatePath added in v0.2.0

func (r *Resource) UpdatePath(path string)

UpdatePath todo

type ResourceSet added in v0.2.0

type ResourceSet struct {
	Total int64       `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
	Items []*Resource `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewResourceSet added in v0.2.0

func NewResourceSet() *ResourceSet

NewResourceSet todo

func (*ResourceSet) AddEndpointSet added in v0.2.0

func (s *ResourceSet) AddEndpointSet(eps *Set)

AddEndpointSet todo

func (*ResourceSet) Descriptor deprecated added in v0.2.0

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

Deprecated: Use ResourceSet.ProtoReflect.Descriptor instead.

func (*ResourceSet) GetItems added in v0.2.0

func (x *ResourceSet) GetItems() []*Resource

func (*ResourceSet) GetTotal added in v0.2.0

func (x *ResourceSet) GetTotal() int64

func (*ResourceSet) ProtoMessage added in v0.2.0

func (*ResourceSet) ProtoMessage()

func (*ResourceSet) ProtoReflect added in v0.2.0

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

func (*ResourceSet) Reset added in v0.2.0

func (x *ResourceSet) Reset()

func (*ResourceSet) String added in v0.2.0

func (x *ResourceSet) String() string

type Set

type Set struct {
	Total int64       `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
	Items []*Endpoint `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewEndpointSet

func NewEndpointSet() *Set

NewEndpointSet 实例化

func (*Set) Add

func (s *Set) Add(e *Endpoint)

Add 添加

func (*Set) Descriptor deprecated added in v0.2.0

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

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems added in v0.2.0

func (x *Set) GetItems() []*Endpoint

func (*Set) GetTotal added in v0.2.0

func (x *Set) GetTotal() int64

func (*Set) ProtoMessage added in v0.2.0

func (*Set) ProtoMessage()

func (*Set) ProtoReflect added in v0.2.0

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

func (*Set) Reset added in v0.2.0

func (x *Set) Reset()

func (*Set) String added in v0.2.0

func (x *Set) String() string

type UnimplementedEndpointServiceServer added in v0.2.0

type UnimplementedEndpointServiceServer struct {
}

UnimplementedEndpointServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedEndpointServiceServer) DeleteEndpoint added in v0.2.0

func (UnimplementedEndpointServiceServer) DescribeEndpoint added in v0.2.0

func (UnimplementedEndpointServiceServer) QueryEndpoints added in v0.2.0

func (UnimplementedEndpointServiceServer) QueryResources added in v0.2.0

func (UnimplementedEndpointServiceServer) Registry added in v0.2.0

type UnsafeEndpointServiceServer added in v0.2.0

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

UnsafeEndpointServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EndpointServiceServer 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