Documentation
¶
Index ¶
- Constants
- Variables
- func GenHashID(service, path string) string
- func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
- type DescribeEndpointRequest
- func (*DescribeEndpointRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DescribeEndpointRequest) GetId() string
- func (*DescribeEndpointRequest) ProtoMessage()
- func (x *DescribeEndpointRequest) ProtoReflect() protoreflect.Message
- func (x *DescribeEndpointRequest) Reset()
- func (x *DescribeEndpointRequest) String() string
- type Endpoint
- func (*Endpoint) Descriptor() ([]byte, []int)deprecated
- func (x *Endpoint) GetCreateAt() int64
- func (x *Endpoint) GetEntry() *Entry
- func (x *Endpoint) GetId() string
- func (x *Endpoint) GetServiceId() string
- func (x *Endpoint) GetUpdateAt() int64
- func (x *Endpoint) GetVersion() string
- func (*Endpoint) ProtoMessage()
- func (x *Endpoint) ProtoReflect() protoreflect.Message
- func (x *Endpoint) Reset()
- func (x *Endpoint) String() string
- type EndpointSet
- func (s *EndpointSet) Add(e *Endpoint)
- func (*EndpointSet) Descriptor() ([]byte, []int)deprecated
- func (x *EndpointSet) GetItems() []*Endpoint
- func (x *EndpointSet) GetTotal() int64
- func (*EndpointSet) ProtoMessage()
- func (x *EndpointSet) ProtoReflect() protoreflect.Message
- func (x *EndpointSet) Reset()
- func (x *EndpointSet) String() string
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)deprecated
- func (x *Entry) GetAllow() []string
- func (x *Entry) GetAuditLog() bool
- func (x *Entry) GetAuthEnable() bool
- func (x *Entry) GetExtension() map[string]string
- func (x *Entry) GetFunctionName() string
- func (x *Entry) GetLabels() map[string]string
- func (x *Entry) GetMethod() string
- func (x *Entry) GetPath() string
- func (x *Entry) GetPermissionEnable() bool
- func (x *Entry) GetRequiredNamespace() bool
- func (x *Entry) GetResource() string
- func (*Entry) ProtoMessage()
- func (x *Entry) ProtoReflect() protoreflect.Message
- func (x *Entry) Reset()
- func (x *Entry) String() string
- type QueryEndpointRequest
- func (*QueryEndpointRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryEndpointRequest) GetFunctionName() string
- func (x *QueryEndpointRequest) GetLabels() map[string]string
- func (x *QueryEndpointRequest) GetMethod() string
- func (x *QueryEndpointRequest) GetPage() *request.PageRequest
- func (x *QueryEndpointRequest) GetPath() string
- func (x *QueryEndpointRequest) GetPermissionEnable() bool
- func (x *QueryEndpointRequest) GetResources() []string
- func (x *QueryEndpointRequest) GetServiceIds() []string
- func (*QueryEndpointRequest) ProtoMessage()
- func (x *QueryEndpointRequest) ProtoReflect() protoreflect.Message
- func (x *QueryEndpointRequest) Reset()
- func (x *QueryEndpointRequest) String() string
- type RPCClient
- type RPCServer
- type RegistryRequest
- func (*RegistryRequest) Descriptor() ([]byte, []int)deprecated
- func (req *RegistryRequest) Endpoints(serviceID string) []*Endpoint
- func (x *RegistryRequest) GetClientId() string
- func (x *RegistryRequest) GetClientSecret() string
- func (x *RegistryRequest) GetEntries() []*Entry
- func (x *RegistryRequest) GetVersion() string
- func (*RegistryRequest) ProtoMessage()
- func (x *RegistryRequest) ProtoReflect() protoreflect.Message
- func (x *RegistryRequest) Reset()
- func (x *RegistryRequest) String() string
- type RegistryResponse
- type Service
- type UnimplementedRPCServer
- func (UnimplementedRPCServer) DescribeEndpoint(context.Context, *DescribeEndpointRequest) (*Endpoint, error)
- func (UnimplementedRPCServer) QueryEndpoints(context.Context, *QueryEndpointRequest) (*EndpointSet, error)
- func (UnimplementedRPCServer) RegistryEndpoint(context.Context, *RegistryRequest) (*RegistryResponse, error)
- type UnsafeRPCServer
Constants ¶
const (
AppName = "endpoint"
)
Variables ¶
var File_apps_endpoint_pb_endpoint_proto protoreflect.FileDescriptor
var File_apps_endpoint_pb_rpc_proto protoreflect.FileDescriptor
var RPC_ServiceDesc = grpc.ServiceDesc{ ServiceName: "devcloud.mcenter.endpoint.RPC", HandlerType: (*RPCServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "RegistryEndpoint", Handler: _RPC_RegistryEndpoint_Handler, }, { MethodName: "DescribeEndpoint", Handler: _RPC_DescribeEndpoint_Handler, }, { MethodName: "QueryEndpoints", Handler: _RPC_QueryEndpoints_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/endpoint/pb/rpc.proto", }
RPC_ServiceDesc is the grpc.ServiceDesc for RPC service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRPCServer ¶
func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
Types ¶
type DescribeEndpointRequest ¶
type DescribeEndpointRequest struct {
// @gotags: json:"id"
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
// contains filtered or unexported fields
}
DescribeEndpointRequest todo
func (*DescribeEndpointRequest) Descriptor
deprecated
func (*DescribeEndpointRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescribeEndpointRequest.ProtoReflect.Descriptor instead.
func (*DescribeEndpointRequest) GetId ¶
func (x *DescribeEndpointRequest) GetId() string
func (*DescribeEndpointRequest) ProtoMessage ¶
func (*DescribeEndpointRequest) ProtoMessage()
func (*DescribeEndpointRequest) ProtoReflect ¶
func (x *DescribeEndpointRequest) ProtoReflect() protoreflect.Message
func (*DescribeEndpointRequest) Reset ¶
func (x *DescribeEndpointRequest) Reset()
func (*DescribeEndpointRequest) String ¶
func (x *DescribeEndpointRequest) String() string
type Endpoint ¶
type Endpoint struct {
// 端点名称
// @gotags: bson:"_id" json:"id" validate:"required,lte=64"
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id" validate:"required,lte=64"`
// 创建时间
// @gotags: bson:"create_at" json:"create_at,omitempty"
CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty" bson:"create_at"`
// 更新时间
// @gotags: bson:"update_at" json:"update_at,omitempty"
UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty" bson:"update_at"`
// 该功能属于那个服务
// @gotags: bson:"service_id" json:"service_id,omitempty" validate:"required,lte=64"
ServiceId string `` /* 133-byte string literal not displayed */
// 服务那个版本的功能
// @gotags: bson:"version" json:"version,omitempty" validate:"required,lte=64"
Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty" bson:"version" validate:"required,lte=64"`
// 路由条目信息
// @gotags: bson:"entry" json:"entry" validate:"required"
Entry *Entry `protobuf:"bytes,6,opt,name=entry,proto3" json:"entry" bson:"entry" validate:"required"`
// contains filtered or unexported fields
}
服务的功能: maudit [resource:OperateLog action:List] Path:Restful接口的Path(URI) Endpoint Service's features
func (*Endpoint) Descriptor
deprecated
func (*Endpoint) GetCreateAt ¶
func (*Endpoint) GetServiceId ¶
func (*Endpoint) GetUpdateAt ¶
func (*Endpoint) GetVersion ¶
func (*Endpoint) ProtoMessage ¶
func (*Endpoint) ProtoMessage()
func (*Endpoint) ProtoReflect ¶
func (x *Endpoint) ProtoReflect() protoreflect.Message
type EndpointSet ¶
type EndpointSet struct {
// @gotags: bson:"total" json:"total"
Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
// @gotags: bson:"items" json:"items"
Items []*Endpoint `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
// contains filtered or unexported fields
}
func (*EndpointSet) Descriptor
deprecated
func (*EndpointSet) Descriptor() ([]byte, []int)
Deprecated: Use EndpointSet.ProtoReflect.Descriptor instead.
func (*EndpointSet) GetItems ¶
func (x *EndpointSet) GetItems() []*Endpoint
func (*EndpointSet) GetTotal ¶
func (x *EndpointSet) GetTotal() int64
func (*EndpointSet) ProtoMessage ¶
func (*EndpointSet) ProtoMessage()
func (*EndpointSet) ProtoReflect ¶
func (x *EndpointSet) ProtoReflect() protoreflect.Message
func (*EndpointSet) Reset ¶
func (x *EndpointSet) Reset()
func (*EndpointSet) String ¶
func (x *EndpointSet) String() string
type Entry ¶
type Entry struct {
// 函数名称
// @gotags: bson:"function_name" json:"function_name"
FunctionName string `protobuf:"bytes,2,opt,name=function_name,json=functionName,proto3" json:"function_name" bson:"function_name"`
// HTTP path 用于自动生成http api
// @gotags: bson:"path" json:"path"
Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path" bson:"path"`
// HTTP method 用于自动生成http api
// @gotags: bson:"method" json:"method"
Method string `protobuf:"bytes,4,opt,name=method,proto3" json:"method" bson:"method"`
// 关键: 资源名称, GoRestuful的路由的Meta来定义该接口操作的资源
// @gotags: bson:"resource" json:"resource"
Resource string `protobuf:"bytes,5,opt,name=resource,proto3" json:"resource" bson:"resource"`
// 是否校验用户身份 (acccess_token)
// @gotags: bson:"auth_enable" json:"auth_enable"
AuthEnable bool `protobuf:"varint,6,opt,name=auth_enable,json=authEnable,proto3" json:"auth_enable" bson:"auth_enable"`
// 是否校验用户权限
// @gotags: bson:"permission_enable" json:"permission_enable"
PermissionEnable bool `protobuf:"varint,7,opt,name=permission_enable,json=permissionEnable,proto3" json:"permission_enable" bson:"permission_enable"`
// 允许的通过的身份标识符, 比如角色, 用户类型之类
// @gotags: bson:"allow" json:"allow"
Allow []string `protobuf:"bytes,12,rep,name=allow,proto3" json:"allow" bson:"allow"`
// 是否开启操作审计, 开启后这次操作将被记录
// @gotags: bson:"audit_log" json:"audit_log"
AuditLog bool `protobuf:"varint,9,opt,name=audit_log,json=auditLog,proto3" json:"audit_log" bson:"audit_log"`
// 名称空间不能为空
// @gotags: bson:"required_namespace" json:"required_namespace"
RequiredNamespace bool `` /* 130-byte string literal not displayed */
// 关键: 标签, {"action": "list"}
// @gotags: bson:"labels" json:"labels"
Labels map[string]string `` /* 157-byte string literal not displayed */
// 扩展属性
// @gotags: bson:"extension" json:"extension"
Extension map[string]string `` /* 167-byte string literal not displayed */
// contains filtered or unexported fields
}
Entry 路由条目
func (*Entry) Descriptor
deprecated
func (*Entry) GetAuditLog ¶
func (*Entry) GetAuthEnable ¶
func (*Entry) GetExtension ¶
func (*Entry) GetFunctionName ¶
func (*Entry) GetPermissionEnable ¶
func (*Entry) GetRequiredNamespace ¶
func (*Entry) GetResource ¶
func (*Entry) ProtoMessage ¶
func (*Entry) ProtoMessage()
func (*Entry) ProtoReflect ¶
func (x *Entry) ProtoReflect() protoreflect.Message
type QueryEndpointRequest ¶
type QueryEndpointRequest struct {
// @gotags: json:"page"
Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
// 几个服务总共由哪些Endpoinit
// 查询完 Endpoint, 根据Label进行匹配
// @gotags: json:"service_ids"
ServiceIds []string `protobuf:"bytes,2,rep,name=service_ids,json=serviceIds,proto3" json:"service_ids"`
// @gotags: json:"path"
Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path"`
// @gotags: json:"method"
Method string `protobuf:"bytes,4,opt,name=method,proto3" json:"method"`
// @gotags: json:"function_name"
FunctionName string `protobuf:"bytes,5,opt,name=function_name,json=functionName,proto3" json:"function_name"`
// 根据资源名称和标签能匹配到对应的Endpoint
// @gotags: json:"resources"
Resources []string `protobuf:"bytes,6,rep,name=resources,proto3" json:"resources"`
// @gotags: json:"labels"
Labels map[string]string `` /* 143-byte string literal not displayed */
// @gotags: json:"permission_enable"
PermissionEnable *bool `protobuf:"varint,8,opt,name=permission_enable,json=permissionEnable,proto3,oneof" json:"permission_enable"`
// contains filtered or unexported fields
}
QueryEndpointRequest 查询应用列表
func (*QueryEndpointRequest) Descriptor
deprecated
func (*QueryEndpointRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryEndpointRequest.ProtoReflect.Descriptor instead.
func (*QueryEndpointRequest) GetFunctionName ¶
func (x *QueryEndpointRequest) GetFunctionName() string
func (*QueryEndpointRequest) GetLabels ¶
func (x *QueryEndpointRequest) GetLabels() map[string]string
func (*QueryEndpointRequest) GetMethod ¶
func (x *QueryEndpointRequest) GetMethod() string
func (*QueryEndpointRequest) GetPage ¶
func (x *QueryEndpointRequest) GetPage() *request.PageRequest
func (*QueryEndpointRequest) GetPath ¶
func (x *QueryEndpointRequest) GetPath() string
func (*QueryEndpointRequest) GetPermissionEnable ¶
func (x *QueryEndpointRequest) GetPermissionEnable() bool
func (*QueryEndpointRequest) GetResources ¶
func (x *QueryEndpointRequest) GetResources() []string
func (*QueryEndpointRequest) GetServiceIds ¶
func (x *QueryEndpointRequest) GetServiceIds() []string
func (*QueryEndpointRequest) ProtoMessage ¶
func (*QueryEndpointRequest) ProtoMessage()
func (*QueryEndpointRequest) ProtoReflect ¶
func (x *QueryEndpointRequest) ProtoReflect() protoreflect.Message
func (*QueryEndpointRequest) Reset ¶
func (x *QueryEndpointRequest) Reset()
func (*QueryEndpointRequest) String ¶
func (x *QueryEndpointRequest) String() string
type RPCClient ¶
type RPCClient interface {
// 服务接口注册
RegistryEndpoint(ctx context.Context, in *RegistryRequest, opts ...grpc.CallOption) (*RegistryResponse, error)
DescribeEndpoint(ctx context.Context, in *DescribeEndpointRequest, opts ...grpc.CallOption) (*Endpoint, error)
QueryEndpoints(ctx context.Context, in *QueryEndpointRequest, opts ...grpc.CallOption) (*EndpointSet, error)
}
RPCClient is the client API for RPC 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 NewRPCClient ¶
func NewRPCClient(cc grpc.ClientConnInterface) RPCClient
type RPCServer ¶
type RPCServer interface {
// 服务接口注册
RegistryEndpoint(context.Context, *RegistryRequest) (*RegistryResponse, error)
DescribeEndpoint(context.Context, *DescribeEndpointRequest) (*Endpoint, error)
QueryEndpoints(context.Context, *QueryEndpointRequest) (*EndpointSet, error)
// contains filtered or unexported methods
}
RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility
type RegistryRequest ¶
type RegistryRequest struct {
// @gotags: json:"client_id" validate:"required"
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id" validate:"required"`
// @gotags: json:"client_secret" validate:"required"
ClientSecret string `protobuf:"bytes,2,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret" validate:"required"`
// @gotags: json:"version" validate:"required,lte=32"
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version" validate:"required,lte=32"`
// @gotags: json:"entries"
Entries []*Entry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"`
// contains filtered or unexported fields
}
RegistryRequest 服务注册请求, 验证服务的合法性, 需要客户端凭证
func NewRegistryRequest ¶
func NewRegistryRequest(version string, entries []*Entry) *RegistryRequest
NewRegistryRequest 注册请求
func (*RegistryRequest) Descriptor
deprecated
func (*RegistryRequest) Descriptor() ([]byte, []int)
Deprecated: Use RegistryRequest.ProtoReflect.Descriptor instead.
func (*RegistryRequest) Endpoints ¶
func (req *RegistryRequest) Endpoints(serviceID string) []*Endpoint
Endpoints 功能列表
func (*RegistryRequest) GetClientId ¶
func (x *RegistryRequest) GetClientId() string
func (*RegistryRequest) GetClientSecret ¶
func (x *RegistryRequest) GetClientSecret() string
func (*RegistryRequest) GetEntries ¶
func (x *RegistryRequest) GetEntries() []*Entry
func (*RegistryRequest) GetVersion ¶
func (x *RegistryRequest) GetVersion() string
func (*RegistryRequest) ProtoMessage ¶
func (*RegistryRequest) ProtoMessage()
func (*RegistryRequest) ProtoReflect ¶
func (x *RegistryRequest) ProtoReflect() protoreflect.Message
func (*RegistryRequest) Reset ¶
func (x *RegistryRequest) Reset()
func (*RegistryRequest) String ¶
func (x *RegistryRequest) String() string
type RegistryResponse ¶
type RegistryResponse struct {
// @gotags: json:"message"
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message"`
// contains filtered or unexported fields
}
RegistryReponse todo
func NewRegistryResponse ¶
func NewRegistryResponse(message string) *RegistryResponse
NewRegistryResponse todo
func (*RegistryResponse) Descriptor
deprecated
func (*RegistryResponse) Descriptor() ([]byte, []int)
Deprecated: Use RegistryResponse.ProtoReflect.Descriptor instead.
func (*RegistryResponse) GetMessage ¶
func (x *RegistryResponse) GetMessage() string
func (*RegistryResponse) ProtoMessage ¶
func (*RegistryResponse) ProtoMessage()
func (*RegistryResponse) ProtoReflect ¶
func (x *RegistryResponse) ProtoReflect() protoreflect.Message
func (*RegistryResponse) Reset ¶
func (x *RegistryResponse) Reset()
func (*RegistryResponse) String ¶
func (x *RegistryResponse) String() string
type UnimplementedRPCServer ¶
type UnimplementedRPCServer struct {
}
UnimplementedRPCServer must be embedded to have forward compatible implementations.
func (UnimplementedRPCServer) DescribeEndpoint ¶
func (UnimplementedRPCServer) DescribeEndpoint(context.Context, *DescribeEndpointRequest) (*Endpoint, error)
func (UnimplementedRPCServer) QueryEndpoints ¶
func (UnimplementedRPCServer) QueryEndpoints(context.Context, *QueryEndpointRequest) (*EndpointSet, error)
func (UnimplementedRPCServer) RegistryEndpoint ¶
func (UnimplementedRPCServer) RegistryEndpoint(context.Context, *RegistryRequest) (*RegistryResponse, error)
type UnsafeRPCServer ¶
type UnsafeRPCServer interface {
// contains filtered or unexported methods
}
UnsafeRPCServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RPCServer will result in compilation errors.