endpoint

package
v0.0.0-...-f4276bb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 10 Imported by: 0

README

功能管理

业务模型

  1. 功能列表注册接口

操作 ---> 接口 ---> 路由

r.Route(r.GET("/").To(h.QuerySecret).
    Doc("查询凭证列表").
    // 作为OpenApi的值作为展示
    Metadata(restfulspec.KeyOpenAPITags, tags).
    // 通过auth来控制是否开启认证
    Metadata("auth", true))

功能:

  • feature: http接口, POST.URI cmdb.post./cmdb/api/v1/secrets
  • service: 那个服务, cmdb
  • method: post
  • path(访问路由): /cmdb/api/v1/secrets
  • ...

Documentation

Index

Constants

View Source
const AppName = "endpoints"
View Source
const (
	Rpc_RegistryEndpoints_FullMethodName = "/go11.devcloud_mini.endpoints.Rpc/RegistryEndpoints"
)

Variables

View Source
var File_mcenter_apps_endpoint_pb_model_proto protoreflect.FileDescriptor
View Source
var File_mcenter_apps_endpoint_pb_rpc_proto protoreflect.FileDescriptor
View Source
var Rpc_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "go11.devcloud_mini.endpoints.Rpc",
	HandlerType: (*RpcServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RegistryEndpoints",
			Handler:    _Rpc_RegistryEndpoints_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "mcenter/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 GetValueFromMeta

func GetValueFromMeta(meta map[string]interface{}, key string) string

func RegisterRpcServer

func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer)

Types

type Endpoint

type Endpoint struct {

	// 元数据信息
	// @gotags: json:"meta" bson:",inline"
	Meta *resource.Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta" bson:",inline"`
	// Endpint定义
	// @gotags: json:"spec" bson:",inline"
	Spec *EndpointSpec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec" bson:",inline"`
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(spec *EndpointSpec) *Endpoint

func (*Endpoint) Descriptor deprecated

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

Deprecated: Use Endpoint.ProtoReflect.Descriptor instead.

func (*Endpoint) GetMeta

func (x *Endpoint) GetMeta() *resource.Meta

func (*Endpoint) GetSpec

func (x *Endpoint) GetSpec() *EndpointSpec

func (*Endpoint) ProtoMessage

func (*Endpoint) ProtoMessage()

func (*Endpoint) ProtoReflect

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

func (*Endpoint) Reset

func (x *Endpoint) Reset()

func (*Endpoint) String

func (x *Endpoint) String() string

type EndpointSet

type EndpointSet struct {

	// 服务功能列表
	// @gotags: json:"items" bson:"items"
	Items []*Endpoint `protobuf:"bytes,1,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewEndpointSet

func NewEndpointSet(specs *EndpointSpecSet) *EndpointSet

func (*EndpointSet) Add

func (s *EndpointSet) Add(items ...*Endpoint)

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) 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

func (*EndpointSet) ToMongoDocs

func (s *EndpointSet) ToMongoDocs() (docs []interface{})

type EndpointSpec

type EndpointSpec struct {

	// 服务名称
	// @gotags: json:"service" bson:"service"
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service" bson:"service"`
	// 服务资源名称
	// @gotags: json:"resoruce" bson:"resoruce"
	Resoruce string `protobuf:"bytes,4,opt,name=resoruce,proto3" json:"resoruce" bson:"resoruce"`
	// 服务资源的操作
	// @gotags: json:"action" bson:"action"
	Action string `protobuf:"bytes,5,opt,name=action,proto3" json:"action" bson:"action"`
	// 功能的路劲: post.url
	// @gotags: json:"path" bson:"path"
	Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path" bson:"path"`
	// 功能描述
	// @gotags: json:"descrption" bson:"descrption"
	Descrption string `protobuf:"bytes,3,opt,name=descrption,proto3" json:"descrption" bson:"descrption"`
	// contains filtered or unexported fields
}

func NewEndpointSpec

func NewEndpointSpec(service, path string) *EndpointSpec

func (*EndpointSpec) Descriptor deprecated

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

Deprecated: Use EndpointSpec.ProtoReflect.Descriptor instead.

func (*EndpointSpec) GenId

func (s *EndpointSpec) GenId() string

Role需要应用Endpoint的Id, Endpint的Id不能随机生成

func (*EndpointSpec) GetAction

func (x *EndpointSpec) GetAction() string

func (*EndpointSpec) GetDescrption

func (x *EndpointSpec) GetDescrption() string

func (*EndpointSpec) GetPath

func (x *EndpointSpec) GetPath() string

func (*EndpointSpec) GetResoruce

func (x *EndpointSpec) GetResoruce() string

func (*EndpointSpec) GetService

func (x *EndpointSpec) GetService() string

func (*EndpointSpec) ProtoMessage

func (*EndpointSpec) ProtoMessage()

func (*EndpointSpec) ProtoReflect

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

func (*EndpointSpec) Reset

func (x *EndpointSpec) Reset()

func (*EndpointSpec) String

func (x *EndpointSpec) String() string

type EndpointSpecSet

type EndpointSpecSet struct {

	// 服务功能列表
	// @gotags: json:"items" bson:"items"
	Items []*EndpointSpec `protobuf:"bytes,1,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewEndpointSpecSet

func NewEndpointSpecSet() *EndpointSpecSet

func (*EndpointSpecSet) Add

func (s *EndpointSpecSet) Add(items ...*EndpointSpec)

func (*EndpointSpecSet) Descriptor deprecated

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

Deprecated: Use EndpointSpecSet.ProtoReflect.Descriptor instead.

func (*EndpointSpecSet) GetItems

func (x *EndpointSpecSet) GetItems() []*EndpointSpec

func (*EndpointSpecSet) ProtoMessage

func (*EndpointSpecSet) ProtoMessage()

func (*EndpointSpecSet) ProtoReflect

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

func (*EndpointSpecSet) Reset

func (x *EndpointSpecSet) Reset()

func (*EndpointSpecSet) Service

func (s *EndpointSpecSet) Service() (svcs []string)

func (*EndpointSpecSet) String

func (x *EndpointSpecSet) String() string

type RpcClient

type RpcClient interface {
	// 功能注册(全量注册)
	RegistryEndpoints(ctx context.Context, in *EndpointSpecSet, 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 {
	// 功能注册(全量注册)
	RegistryEndpoints(context.Context, *EndpointSpecSet) (*EndpointSet, error)
	// contains filtered or unexported methods
}

RpcServer is the server API for Rpc service. All implementations must embed UnimplementedRpcServer for forward compatibility

type Service

type Service interface {
	RpcServer
}

type UnimplementedRpcServer

type UnimplementedRpcServer struct {
}

UnimplementedRpcServer must be embedded to have forward compatible implementations.

func (UnimplementedRpcServer) RegistryEndpoints

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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