micro

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

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_pkg_micro_pb_enum_proto protoreflect.FileDescriptor
View Source
var File_pkg_micro_pb_micro_proto protoreflect.FileDescriptor
View Source
var File_pkg_micro_pb_request_proto protoreflect.FileDescriptor
View Source
var File_pkg_micro_pb_service_proto protoreflect.FileDescriptor
View Source
var MicroService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "keyauth.micro.MicroService",
	HandlerType: (*MicroServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ValidateClientCredential",
			Handler:    _MicroService_ValidateClientCredential_Handler,
		},
		{
			MethodName: "CreateService",
			Handler:    _MicroService_CreateService_Handler,
		},
		{
			MethodName: "QueryService",
			Handler:    _MicroService_QueryService_Handler,
		},
		{
			MethodName: "DescribeService",
			Handler:    _MicroService_DescribeService_Handler,
		},
		{
			MethodName: "DeleteService",
			Handler:    _MicroService_DeleteService_Handler,
		},
		{
			MethodName: "RefreshServiceClientSecret",
			Handler:    _MicroService_RefreshServiceClientSecret_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/micro/pb/service.proto",
}

MicroService_ServiceDesc is the grpc.ServiceDesc for MicroService 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 added in v0.2.0

func HttpEntry() *http.EntrySet

HttpEntry todo

func RegisterMicroServiceServer added in v0.2.0

func RegisterMicroServiceServer(s grpc.ServiceRegistrar, srv MicroServiceServer)

Types

type CreateMicroRequest

type CreateMicroRequest struct {

	// 服务类型
	Type Type `protobuf:"varint,1,opt,name=type,proto3,enum=keyauth.micro.Type" json:"type" bson:"type"`
	// 名称
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" bson:"name" validate:"required,lte=200"`
	// 服务标签
	Label map[string]string `` /* 172-byte string literal not displayed */
	// 描述信息
	Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty" bson:"description"`
	// contains filtered or unexported fields
}

CreateMicroRequest 服务创建请求

func NewCreateMicroRequest

func NewCreateMicroRequest() *CreateMicroRequest

NewCreateMicroRequest todo

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

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

Deprecated: Use CreateMicroRequest.ProtoReflect.Descriptor instead.

func (*CreateMicroRequest) GetDescription added in v0.2.0

func (x *CreateMicroRequest) GetDescription() string

func (*CreateMicroRequest) GetLabel added in v0.2.0

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

func (*CreateMicroRequest) GetName added in v0.2.0

func (x *CreateMicroRequest) GetName() string

func (*CreateMicroRequest) GetType added in v0.2.0

func (x *CreateMicroRequest) GetType() Type

func (*CreateMicroRequest) ProtoMessage added in v0.2.0

func (*CreateMicroRequest) ProtoMessage()

func (*CreateMicroRequest) ProtoReflect added in v0.2.0

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

func (*CreateMicroRequest) Reset added in v0.2.0

func (x *CreateMicroRequest) Reset()

func (*CreateMicroRequest) String added in v0.2.0

func (x *CreateMicroRequest) String() string

func (*CreateMicroRequest) Validate

func (req *CreateMicroRequest) Validate() error

Validate 校验请求是否合法

type DeleteMicroRequest added in v0.2.0

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

DeleteMicroRequest todo

func NewDeleteMicroRequestWithID added in v0.2.0

func NewDeleteMicroRequestWithID(id string) *DeleteMicroRequest

NewDeleteMicroRequestWithID todo

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

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

Deprecated: Use DeleteMicroRequest.ProtoReflect.Descriptor instead.

func (*DeleteMicroRequest) GetId added in v0.2.0

func (x *DeleteMicroRequest) GetId() string

func (*DeleteMicroRequest) ProtoMessage added in v0.2.0

func (*DeleteMicroRequest) ProtoMessage()

func (*DeleteMicroRequest) ProtoReflect added in v0.2.0

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

func (*DeleteMicroRequest) Reset added in v0.2.0

func (x *DeleteMicroRequest) Reset()

func (*DeleteMicroRequest) String added in v0.2.0

func (x *DeleteMicroRequest) String() string

func (*DeleteMicroRequest) Validate added in v0.2.0

func (req *DeleteMicroRequest) Validate() error

Validate todo

type DescribeMicroRequest

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

DescribeMicroRequest 查询应用详情

func NewDescribeServiceRequest added in v0.2.0

func NewDescribeServiceRequest() *DescribeMicroRequest

NewDescribeServiceRequest new实例

func NewDescribeServiceRequestWithClientID added in v0.2.0

func NewDescribeServiceRequestWithClientID(clientID string) *DescribeMicroRequest

NewDescribeServiceRequestWithClientID new实例

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

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

Deprecated: Use DescribeMicroRequest.ProtoReflect.Descriptor instead.

func (*DescribeMicroRequest) GetClientId added in v0.2.0

func (x *DescribeMicroRequest) GetClientId() string

func (*DescribeMicroRequest) GetId added in v0.2.0

func (x *DescribeMicroRequest) GetId() string

func (*DescribeMicroRequest) GetName added in v0.2.0

func (x *DescribeMicroRequest) GetName() string

func (*DescribeMicroRequest) ProtoMessage added in v0.2.0

func (*DescribeMicroRequest) ProtoMessage()

func (*DescribeMicroRequest) ProtoReflect added in v0.2.0

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

func (*DescribeMicroRequest) Reset added in v0.2.0

func (x *DescribeMicroRequest) Reset()

func (*DescribeMicroRequest) String added in v0.2.0

func (x *DescribeMicroRequest) String() string

func (*DescribeMicroRequest) Validate

func (req *DescribeMicroRequest) Validate() error

Validate 校验详情查询请求

type Micro

type Micro struct {

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

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

Deprecated: Use Micro.ProtoReflect.Descriptor instead.

func (*Micro) Desensitize added in v0.2.0

func (m *Micro) Desensitize()

Desensitize 数据脱敏

func (*Micro) GetAccount added in v0.2.0

func (x *Micro) GetAccount() string

func (*Micro) GetClientEnabled added in v0.2.0

func (x *Micro) GetClientEnabled() bool

func (*Micro) GetClientId added in v0.2.0

func (x *Micro) GetClientId() string

func (*Micro) GetClientRefreshAt added in v0.2.0

func (x *Micro) GetClientRefreshAt() int64

func (*Micro) GetClientSecret added in v0.2.0

func (x *Micro) GetClientSecret() string

func (*Micro) GetCreateAt added in v0.2.0

func (x *Micro) GetCreateAt() int64

func (*Micro) GetCreater added in v0.2.0

func (x *Micro) GetCreater() string

func (*Micro) GetDescription added in v0.2.0

func (x *Micro) GetDescription() string

func (*Micro) GetDomain added in v0.2.0

func (x *Micro) GetDomain() string

func (*Micro) GetEnabled added in v0.2.0

func (x *Micro) GetEnabled() bool

func (*Micro) GetId added in v0.2.0

func (x *Micro) GetId() string

func (*Micro) GetLabel added in v0.2.0

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

func (*Micro) GetName added in v0.2.0

func (x *Micro) GetName() string

func (*Micro) GetType added in v0.2.0

func (x *Micro) GetType() Type

func (*Micro) GetUpdateAt added in v0.2.0

func (x *Micro) GetUpdateAt() int64

func (*Micro) ProtoMessage added in v0.2.0

func (*Micro) ProtoMessage()

func (*Micro) ProtoReflect added in v0.2.0

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

func (*Micro) Reset added in v0.2.0

func (x *Micro) Reset()

func (*Micro) String added in v0.2.0

func (x *Micro) String() string

func (*Micro) ValiateClientCredential added in v0.2.0

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

ValiateClientCredential todo

type MicroServiceClient added in v0.2.0

type MicroServiceClient 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)
}

MicroServiceClient is the client API for MicroService 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 NewMicroServiceClient added in v0.2.0

func NewMicroServiceClient(cc grpc.ClientConnInterface) MicroServiceClient

type MicroServiceServer added in v0.2.0

type MicroServiceServer 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
}

MicroServiceServer is the server API for MicroService service. All implementations must embed UnimplementedMicroServiceServer for forward compatibility

type QueryMicroRequest

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

QueryMicroRequest 查询应用列表

func NewQueryMicroRequest

func NewQueryMicroRequest(pageReq *request.PageRequest) *QueryMicroRequest

NewQueryMicroRequest 列表查询请求

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

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

Deprecated: Use QueryMicroRequest.ProtoReflect.Descriptor instead.

func (*QueryMicroRequest) GetPage added in v0.2.0

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

func (*QueryMicroRequest) GetType added in v0.3.2

func (x *QueryMicroRequest) GetType() Type

func (*QueryMicroRequest) ProtoMessage added in v0.2.0

func (*QueryMicroRequest) ProtoMessage()

func (*QueryMicroRequest) ProtoReflect added in v0.2.0

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

func (*QueryMicroRequest) Reset added in v0.2.0

func (x *QueryMicroRequest) Reset()

func (*QueryMicroRequest) String added in v0.2.0

func (x *QueryMicroRequest) String() string

type Set

type Set struct {
	Total int64    `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
	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 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() []*Micro

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 Type

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

func ParseTypeFromString added in v0.2.0

func ParseTypeFromString(str string) (Type, error)

ParseTypeFromString Parse Type from string

func (Type) Descriptor added in v0.2.0

func (Type) Descriptor() protoreflect.EnumDescriptor

func (Type) Enum added in v0.2.0

func (x Type) Enum() *Type

func (Type) EnumDescriptor deprecated added in v0.2.0

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

Deprecated: Use Type.Descriptor instead.

func (Type) Equal added in v0.2.0

func (t Type) Equal(target Type) bool

Equal type compare

func (Type) IsIn added in v0.2.0

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

IsIn todo

func (Type) MarshalJSON added in v0.2.0

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

MarshalJSON todo

func (Type) Number added in v0.2.0

func (x Type) Number() protoreflect.EnumNumber

func (Type) String added in v0.2.0

func (x Type) String() string

func (Type) Type added in v0.2.0

func (Type) Type() protoreflect.EnumType

func (*Type) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON todo

type UnimplementedMicroServiceServer added in v0.2.0

type UnimplementedMicroServiceServer struct {
}

UnimplementedMicroServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedMicroServiceServer) CreateService added in v0.2.0

func (UnimplementedMicroServiceServer) DeleteService added in v0.2.0

func (UnimplementedMicroServiceServer) DescribeService added in v0.2.0

func (UnimplementedMicroServiceServer) QueryService added in v0.2.0

func (UnimplementedMicroServiceServer) RefreshServiceClientSecret added in v0.2.0

func (UnimplementedMicroServiceServer) ValidateClientCredential added in v0.2.0

type UnsafeMicroServiceServer added in v0.2.0

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

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

type ValidateClientCredentialRequest added in v0.2.0

type ValidateClientCredentialRequest struct {

	// 服务客户端ID
	ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id" 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 added in v0.2.0

func NewValidateClientCredentialRequest(clientID, clientSecret string) *ValidateClientCredentialRequest

NewValidateClientCredentialRequest todo

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

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

Deprecated: Use ValidateClientCredentialRequest.ProtoReflect.Descriptor instead.

func (*ValidateClientCredentialRequest) GetClientId added in v0.2.0

func (x *ValidateClientCredentialRequest) GetClientId() string

func (*ValidateClientCredentialRequest) GetClientSecret added in v0.2.0

func (x *ValidateClientCredentialRequest) GetClientSecret() string

func (*ValidateClientCredentialRequest) ProtoMessage added in v0.2.0

func (*ValidateClientCredentialRequest) ProtoMessage()

func (*ValidateClientCredentialRequest) ProtoReflect added in v0.2.0

func (*ValidateClientCredentialRequest) Reset added in v0.2.0

func (*ValidateClientCredentialRequest) String added in v0.2.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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