micro

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "micro"
)

Variables

View Source
var (
	Type_name = map[int32]string{
		0: "NULL",
		1: "CUSTOM",
		2: "BUILD_IN",
	}
	Type_value = map[string]int32{
		"NULL":     0,
		"CUSTOM":   1,
		"BUILD_IN": 2,
	}
)

Enum value maps for Type.

View Source
var File_apps_micro_pb_enum_proto protoreflect.FileDescriptor
View Source
var File_apps_micro_pb_micro_proto protoreflect.FileDescriptor
View Source
var File_apps_micro_pb_request_proto protoreflect.FileDescriptor
View Source
var File_apps_micro_pb_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.keyauth.micro.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ValidateClientCredential",
			Handler:    _Service_ValidateClientCredential_Handler,
		},
		{
			MethodName: "CreateService",
			Handler:    _Service_CreateService_Handler,
		},
		{
			MethodName: "QueryService",
			Handler:    _Service_QueryService_Handler,
		},
		{
			MethodName: "DescribeService",
			Handler:    _Service_DescribeService_Handler,
		},
		{
			MethodName: "DeleteService",
			Handler:    _Service_DeleteService_Handler,
		},
		{
			MethodName: "RefreshServiceClientSecret",
			Handler:    _Service_RefreshServiceClientSecret_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/micro/pb/service.proto",
}

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

Functions

func HttpEntry

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type CreateMicroRequest

type CreateMicroRequest struct {

	// 服务类型
	// @gotags: bson:"type" json:"type"
	Type Type `protobuf:"varint,1,opt,name=type,proto3,enum=infraboard.keyauth.micro.Type" json:"type" bson:"type"`
	// 名称
	// @gotags: bson:"name" json:"name" validate:"required,lte=200"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" bson:"name" validate:"required,lte=200"`
	// 服务标签
	// @gotags: bson:"label" json:"label" validate:"lte=80"
	Label map[string]string `` /* 172-byte string literal not displayed */
	// 描述信息
	// @gotags: bson:"description" json:"description,omitempty"
	Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty" bson:"description"`
	// 服务所属域
	// @gotags: bson:"domain" json:"domain"
	Domain string `protobuf:"bytes,5,opt,name=domain,proto3" json:"domain" bson:"domain"`
	// 创建者ID
	// @gotags: bson:"creater" json:"creater"
	Creater string `protobuf:"bytes,6,opt,name=creater,proto3" json:"creater" bson:"creater"`
	// contains filtered or unexported fields
}

CreateMicroRequest 服务创建请求

func NewCreateMicroRequest

func NewCreateMicroRequest() *CreateMicroRequest

NewCreateMicroRequest todo

func (*CreateMicroRequest) Descriptor deprecated

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

Deprecated: Use CreateMicroRequest.ProtoReflect.Descriptor instead.

func (*CreateMicroRequest) GetCreater

func (x *CreateMicroRequest) GetCreater() string

func (*CreateMicroRequest) GetDescription

func (x *CreateMicroRequest) GetDescription() string

func (*CreateMicroRequest) GetDomain

func (x *CreateMicroRequest) GetDomain() string

func (*CreateMicroRequest) GetLabel

func (x *CreateMicroRequest) GetLabel() map[string]string

func (*CreateMicroRequest) GetName

func (x *CreateMicroRequest) GetName() string

func (*CreateMicroRequest) GetType

func (x *CreateMicroRequest) GetType() Type

func (*CreateMicroRequest) ProtoMessage

func (*CreateMicroRequest) ProtoMessage()

func (*CreateMicroRequest) ProtoReflect

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

func (*CreateMicroRequest) Reset

func (x *CreateMicroRequest) Reset()

func (*CreateMicroRequest) String

func (x *CreateMicroRequest) String() string

func (*CreateMicroRequest) Validate

func (req *CreateMicroRequest) Validate() error

Validate 校验请求是否合法

type DeleteMicroRequest

type DeleteMicroRequest struct {

	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// contains filtered or unexported fields
}

DeleteMicroRequest todo

func NewDeleteMicroRequestWithID

func NewDeleteMicroRequestWithID(id string) *DeleteMicroRequest

NewDeleteMicroRequestWithID todo

func (*DeleteMicroRequest) Descriptor deprecated

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

Deprecated: Use DeleteMicroRequest.ProtoReflect.Descriptor instead.

func (*DeleteMicroRequest) GetId

func (x *DeleteMicroRequest) GetId() string

func (*DeleteMicroRequest) ProtoMessage

func (*DeleteMicroRequest) ProtoMessage()

func (*DeleteMicroRequest) ProtoReflect

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

func (*DeleteMicroRequest) Reset

func (x *DeleteMicroRequest) Reset()

func (*DeleteMicroRequest) String

func (x *DeleteMicroRequest) String() string

func (*DeleteMicroRequest) Validate

func (req *DeleteMicroRequest) Validate() error

Validate todo

type DescribeMicroRequest

type DescribeMicroRequest struct {

	// @gotags: json:"client_id"
	ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id"`
	// @gotags: json:"name"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"`
	// @gotags: json:"id"
	Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id"`
	// contains filtered or unexported fields
}

DescribeMicroRequest 查询应用详情

func NewDescribeServiceRequest

func NewDescribeServiceRequest() *DescribeMicroRequest

NewDescribeServiceRequest new实例

func NewDescribeServiceRequestWithClientID

func NewDescribeServiceRequestWithClientID(clientID string) *DescribeMicroRequest

NewDescribeServiceRequestWithClientID new实例

func (*DescribeMicroRequest) Descriptor deprecated

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

Deprecated: Use DescribeMicroRequest.ProtoReflect.Descriptor instead.

func (*DescribeMicroRequest) GetClientId

func (x *DescribeMicroRequest) GetClientId() string

func (*DescribeMicroRequest) GetId

func (x *DescribeMicroRequest) GetId() string

func (*DescribeMicroRequest) GetName

func (x *DescribeMicroRequest) GetName() string

func (*DescribeMicroRequest) ProtoMessage

func (*DescribeMicroRequest) ProtoMessage()

func (*DescribeMicroRequest) ProtoReflect

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

func (*DescribeMicroRequest) Reset

func (x *DescribeMicroRequest) Reset()

func (*DescribeMicroRequest) String

func (x *DescribeMicroRequest) String() string

func (*DescribeMicroRequest) Validate

func (req *DescribeMicroRequest) Validate() error

Validate 校验详情查询请求

type Micro

type Micro struct {

	// 微服务ID
	// @gotags: bson:"_id" json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// 服务所属域
	// @gotags: bson:"domain" json:"domain"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" bson:"domain"`
	// 创建人
	// @gotags: bson:"creater" json:"creater"
	Creater string `protobuf:"bytes,3,opt,name=creater,proto3" json:"creater" bson:"creater"`
	// 创建的时间
	// @gotags: bson:"create_at" json:"create_at,omitempty"
	CreateAt int64 `protobuf:"varint,4,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,5,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty" bson:"update_at"`
	// 服务账号
	// @gotags: bson:"account" json:"account"
	Account string `protobuf:"bytes,6,opt,name=account,proto3" json:"account" bson:"account"`
	// 服务客户端ID
	// @gotags: bson:"client_id" json:"client_id"
	ClientId string `protobuf:"bytes,7,opt,name=client_id,json=clientId,proto3" json:"client_id" bson:"client_id"`
	// 服务客户端凭证
	// @gotags: bson:"client_secret" json:"client_secret"
	ClientSecret string `protobuf:"bytes,8,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret" bson:"client_secret"`
	// 是否启动客户端
	// @gotags: bson:"client_enabled" json:"client_enabled"
	ClientEnabled bool `protobuf:"varint,9,opt,name=client_enabled,json=clientEnabled,proto3" json:"client_enabled" bson:"client_enabled"`
	// 客户端刷新时间
	// @gotags: bson:"client_refresh_at" json:"client_refresh_at"
	ClientRefreshAt int64 `protobuf:"varint,10,opt,name=client_refresh_at,json=clientRefreshAt,proto3" json:"client_refresh_at" bson:"client_refresh_at"`
	// 是否启用该服务
	// @gotags: bson:"enabled" json:"enabled"
	Enabled bool `protobuf:"varint,11,opt,name=enabled,proto3" json:"enabled" bson:"enabled"`
	// 服务类型
	// @gotags: bson:"type" json:"type"
	Type Type `protobuf:"varint,12,opt,name=type,proto3,enum=infraboard.keyauth.micro.Type" json:"type" bson:"type"`
	// 名称
	// @gotags: bson:"name" json:"name"
	Name string `protobuf:"bytes,13,opt,name=name,proto3" json:"name" bson:"name"`
	// 服务标签
	// @gotags: bson:"label" json:"label"
	Label map[string]string `` /* 155-byte string literal not displayed */
	// 描述信息
	// @gotags: bson:"description" json:"description,omitempty"
	Description string `protobuf:"bytes,15,opt,name=description,proto3" json:"description,omitempty" bson:"description"`
	// contains filtered or unexported fields
}

Micro is service provider

func New

func New(req *CreateMicroRequest) (*Micro, error)

New 创建服务

func (*Micro) Descriptor deprecated

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

Deprecated: Use Micro.ProtoReflect.Descriptor instead.

func (*Micro) Desensitize

func (m *Micro) Desensitize()

Desensitize 数据脱敏

func (*Micro) GetAccount

func (x *Micro) GetAccount() string

func (*Micro) GetClientEnabled

func (x *Micro) GetClientEnabled() bool

func (*Micro) GetClientId

func (x *Micro) GetClientId() string

func (*Micro) GetClientRefreshAt

func (x *Micro) GetClientRefreshAt() int64

func (*Micro) GetClientSecret

func (x *Micro) GetClientSecret() string

func (*Micro) GetCreateAt

func (x *Micro) GetCreateAt() int64

func (*Micro) GetCreater

func (x *Micro) GetCreater() string

func (*Micro) GetDescription

func (x *Micro) GetDescription() string

func (*Micro) GetDomain

func (x *Micro) GetDomain() string

func (*Micro) GetEnabled

func (x *Micro) GetEnabled() bool

func (*Micro) GetId

func (x *Micro) GetId() string

func (*Micro) GetLabel

func (x *Micro) GetLabel() map[string]string

func (*Micro) GetName

func (x *Micro) GetName() string

func (*Micro) GetType

func (x *Micro) GetType() Type

func (*Micro) GetUpdateAt

func (x *Micro) GetUpdateAt() int64

func (*Micro) ProtoMessage

func (*Micro) ProtoMessage()

func (*Micro) ProtoReflect

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

func (*Micro) Reset

func (x *Micro) Reset()

func (*Micro) String

func (x *Micro) String() string

func (*Micro) ValiateClientCredential

func (m *Micro) ValiateClientCredential(clientSecret string) error

ValiateClientCredential todo

type QueryMicroRequest

type QueryMicroRequest struct {

	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 服务类型
	// @gotags: json:"type"
	Type Type `protobuf:"varint,2,opt,name=type,proto3,enum=infraboard.keyauth.micro.Type" json:"type"`
	// contains filtered or unexported fields
}

QueryMicroRequest 查询应用列表

func NewQueryMicroRequest

func NewQueryMicroRequest(pageReq *request.PageRequest) *QueryMicroRequest

NewQueryMicroRequest 列表查询请求

func (*QueryMicroRequest) Descriptor deprecated

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

Deprecated: Use QueryMicroRequest.ProtoReflect.Descriptor instead.

func (*QueryMicroRequest) GetPage

func (x *QueryMicroRequest) GetPage() *request.PageRequest

func (*QueryMicroRequest) GetType

func (x *QueryMicroRequest) GetType() Type

func (*QueryMicroRequest) ProtoMessage

func (*QueryMicroRequest) ProtoMessage()

func (*QueryMicroRequest) ProtoReflect

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

func (*QueryMicroRequest) Reset

func (x *QueryMicroRequest) Reset()

func (*QueryMicroRequest) String

func (x *QueryMicroRequest) String() string

type ServiceClient

type ServiceClient interface {
	ValidateClientCredential(ctx context.Context, in *ValidateClientCredentialRequest, opts ...grpc.CallOption) (*Micro, error)
	CreateService(ctx context.Context, in *CreateMicroRequest, opts ...grpc.CallOption) (*Micro, error)
	QueryService(ctx context.Context, in *QueryMicroRequest, opts ...grpc.CallOption) (*Set, error)
	DescribeService(ctx context.Context, in *DescribeMicroRequest, opts ...grpc.CallOption) (*Micro, error)
	DeleteService(ctx context.Context, in *DeleteMicroRequest, opts ...grpc.CallOption) (*Micro, error)
	RefreshServiceClientSecret(ctx context.Context, in *DescribeMicroRequest, opts ...grpc.CallOption) (*Micro, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	ValidateClientCredential(context.Context, *ValidateClientCredentialRequest) (*Micro, error)
	CreateService(context.Context, *CreateMicroRequest) (*Micro, error)
	QueryService(context.Context, *QueryMicroRequest) (*Set, error)
	DescribeService(context.Context, *DescribeMicroRequest) (*Micro, error)
	DeleteService(context.Context, *DeleteMicroRequest) (*Micro, error)
	RefreshServiceClientSecret(context.Context, *DescribeMicroRequest) (*Micro, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Set

type Set 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 []*Micro `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewMicroSet

func NewMicroSet() *Set

NewMicroSet 实例化

func (*Set) Add

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

Add 添加

func (*Set) Descriptor deprecated

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

Deprecated: Use Set.ProtoReflect.Descriptor instead.

func (*Set) GetItems

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

func (*Set) GetTotal

func (x *Set) GetTotal() int64

func (*Set) ProtoMessage

func (*Set) ProtoMessage()

func (*Set) ProtoReflect

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

func (*Set) Reset

func (x *Set) Reset()

func (*Set) String

func (x *Set) String() string

type Type

type Type int32
const (
	Type_NULL Type = 0
	// Custom  自定义的服务
	Type_CUSTOM Type = 1
	// BuildIn  系统内建的服务
	Type_BUILD_IN Type = 2
)

func ParseTypeFromString

func ParseTypeFromString(str string) (Type, error)

ParseTypeFromString Parse Type from string

func (Type) Descriptor

func (Type) Descriptor() protoreflect.EnumDescriptor

func (Type) Enum

func (x Type) Enum() *Type

func (Type) EnumDescriptor deprecated

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

Deprecated: Use Type.Descriptor instead.

func (Type) Equal

func (t Type) Equal(target Type) bool

Equal type compare

func (Type) IsIn

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

IsIn todo

func (Type) MarshalJSON

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

MarshalJSON todo

func (Type) Number

func (x Type) Number() protoreflect.EnumNumber

func (Type) String

func (x Type) String() string

func (Type) Type

func (Type) Type() protoreflect.EnumType

func (*Type) UnmarshalJSON

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

UnmarshalJSON todo

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) CreateService

func (UnimplementedServiceServer) DeleteService

func (UnimplementedServiceServer) DescribeService

func (UnimplementedServiceServer) QueryService

func (UnimplementedServiceServer) RefreshServiceClientSecret

func (UnimplementedServiceServer) RefreshServiceClientSecret(context.Context, *DescribeMicroRequest) (*Micro, error)

func (UnimplementedServiceServer) ValidateClientCredential

type UnsafeServiceServer

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

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

type ValidateClientCredentialRequest

type ValidateClientCredentialRequest struct {

	// 服务客户端ID
	// @gotags: json:"client_id" validate:"required,lte=100"
	ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id" validate:"required,lte=100"`
	// 服务客户端凭证
	// @gotags: json:"client_secret" validate:"required,lte=100"
	ClientSecret string `protobuf:"bytes,2,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret" validate:"required,lte=100"`
	// contains filtered or unexported fields
}

ValidateClientCredentialRequest 校验服务凭证

func NewValidateClientCredentialRequest

func NewValidateClientCredentialRequest(clientID, clientSecret string) *ValidateClientCredentialRequest

NewValidateClientCredentialRequest todo

func (*ValidateClientCredentialRequest) Descriptor deprecated

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

Deprecated: Use ValidateClientCredentialRequest.ProtoReflect.Descriptor instead.

func (*ValidateClientCredentialRequest) GetClientId

func (x *ValidateClientCredentialRequest) GetClientId() string

func (*ValidateClientCredentialRequest) GetClientSecret

func (x *ValidateClientCredentialRequest) GetClientSecret() string

func (*ValidateClientCredentialRequest) ProtoMessage

func (*ValidateClientCredentialRequest) ProtoMessage()

func (*ValidateClientCredentialRequest) ProtoReflect

func (*ValidateClientCredentialRequest) Reset

func (*ValidateClientCredentialRequest) String

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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