http

package
v1.19.22 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 7 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// optional infraboard.mcube.http.Entry rest_api = 20210228;
	E_RestApi = &file_mcube_pb_http_entry_proto_extTypes[0]
)

Extension fields to descriptorpb.MethodOptions.

View Source
var File_mcube_pb_http_entry_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Entry added in v0.7.4

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"`
	// 资源名称
	// @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 */
	// 标签
	// @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 NewEntry added in v0.7.4

func NewEntry(path, method, resource string) *Entry

NewEntry 行健条目

func (*Entry) AddLabel added in v0.7.4

func (e *Entry) AddLabel(labels ...*Label) EntryDecorator

AddLabel 添加Label

func (*Entry) Copy added in v1.1.8

func (e *Entry) Copy() *Entry

func (*Entry) Descriptor deprecated added in v0.7.4

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

Deprecated: Use Entry.ProtoReflect.Descriptor instead.

func (*Entry) DisableAuditLog added in v1.2.9

func (e *Entry) DisableAuditLog() EntryDecorator

DisableAuth 不启用身份验证

func (*Entry) DisableAuth added in v0.7.4

func (e *Entry) DisableAuth() EntryDecorator

DisableAuth 不启用身份验证

func (*Entry) DisablePermission added in v0.7.4

func (e *Entry) DisablePermission() EntryDecorator

DisablePermission 禁用授权验证

func (*Entry) DisableRequiredNamespace added in v1.2.9

func (e *Entry) DisableRequiredNamespace() EntryDecorator

DisableAuth 不启用身份验证

func (*Entry) EnableAuditLog added in v1.2.9

func (e *Entry) EnableAuditLog() EntryDecorator

EnableAuth 启动身份验证

func (*Entry) EnableAuth added in v0.7.4

func (e *Entry) EnableAuth() EntryDecorator

EnableAuth 启动身份验证

func (*Entry) EnablePermission added in v0.7.4

func (e *Entry) EnablePermission() EntryDecorator

EnablePermission 启用授权验证

func (*Entry) EnableRequreNamespace added in v1.2.9

func (e *Entry) EnableRequreNamespace() EntryDecorator

EnableAuth 启动身份验证

func (*Entry) GetAllow added in v1.3.8

func (x *Entry) GetAllow() []string

func (*Entry) GetAuditLog added in v0.8.6

func (x *Entry) GetAuditLog() bool

func (*Entry) GetAuthEnable added in v0.7.4

func (x *Entry) GetAuthEnable() bool

func (*Entry) GetExtension added in v1.0.7

func (x *Entry) GetExtension() map[string]string

func (*Entry) GetFunctionName added in v0.7.4

func (x *Entry) GetFunctionName() string

func (*Entry) GetLabels added in v0.7.4

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

func (*Entry) GetLableValue added in v0.7.4

func (e *Entry) GetLableValue(key string) string

GetLableValue 获取Lable的值

func (*Entry) GetMethod added in v0.7.4

func (x *Entry) GetMethod() string

func (*Entry) GetPath added in v0.7.4

func (x *Entry) GetPath() string

func (*Entry) GetPermissionEnable added in v0.7.4

func (x *Entry) GetPermissionEnable() bool

func (*Entry) GetRequiredNamespace added in v1.0.7

func (x *Entry) GetRequiredNamespace() bool

func (*Entry) GetResource added in v0.7.4

func (x *Entry) GetResource() string

func (*Entry) IsAllow added in v1.3.9

func (e *Entry) IsAllow(target fmt.Stringer) bool

func (*Entry) ProtoMessage added in v0.7.4

func (*Entry) ProtoMessage()

func (*Entry) ProtoReflect added in v0.7.4

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

func (*Entry) Reset added in v0.7.4

func (x *Entry) Reset()

func (*Entry) SetAllow added in v1.4.1

func (e *Entry) SetAllow(targets ...fmt.Stringer) EntryDecorator

SetAllow 设置添加的允许的target

func (*Entry) String added in v0.7.4

func (x *Entry) String() string

func (*Entry) UniquePath added in v1.2.1

func (e *Entry) UniquePath() string

UniquePath todo

type EntryDecorator added in v0.7.4

type EntryDecorator interface {
	// SetLabel 设置子路由标签, 作用于Entry上
	AddLabel(...*Label) EntryDecorator
	EnableAuth() EntryDecorator
	DisableAuth() EntryDecorator
	EnablePermission() EntryDecorator
	DisablePermission() EntryDecorator
	SetAllow(targets ...fmt.Stringer) EntryDecorator
	EnableAuditLog() EntryDecorator
	DisableAuditLog() EntryDecorator
	EnableRequreNamespace() EntryDecorator
	DisableRequiredNamespace() EntryDecorator
}

EntryDecorator 装饰

type EntrySet added in v0.7.4

type EntrySet struct {
	Items []*Entry `json:"items"`
}

EntrySet 路由条目集

func NewEntrySet added in v0.7.4

func NewEntrySet() *EntrySet

NewEntrySet 实例

func (*EntrySet) AddEntry added in v0.7.4

func (s *EntrySet) AddEntry(es ...Entry)

AddEntry 添加Entry

func (*EntrySet) AuthEnableEntry added in v0.7.6

func (s *EntrySet) AuthEnableEntry() []*Entry

AuthEnableEntry todo

func (*EntrySet) GetEntry added in v0.7.4

func (s *EntrySet) GetEntry(path, mothod string) *Entry

GetEntry 获取条目

func (*EntrySet) Merge added in v0.7.5

func (s *EntrySet) Merge(target *EntrySet)

Merge todo

func (*EntrySet) PermissionEnableEntry added in v0.7.6

func (s *EntrySet) PermissionEnableEntry() []*Entry

PermissionEnableEntry todo

func (*EntrySet) String added in v0.7.4

func (s *EntrySet) String() string

func (*EntrySet) UniquePathEntry added in v1.1.8

func (s *EntrySet) UniquePathEntry() []*Entry

GetEntry 获取条目

type Label added in v0.7.4

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

Label 路由标签

func NewLable added in v0.7.4

func NewLable(k, v string) *Label

NewLable label实例

func (*Label) Key added in v0.7.4

func (l *Label) Key() string

Key 健

func (*Label) Value added in v0.7.4

func (l *Label) Value() string

Value 值

Jump to

Keyboard shortcuts

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