service

package
v0.0.0-...-2c311f4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 12 Imported by: 1

README

服务管理

Documentation

Index

Constants

View Source
const (
	ClientHeaderKey = "client_id"
	ClientSecretKey = "client_secret"
)
View Source
const (
	AppName = "services"
)

Variables

View Source
var (
	DESCRIBE_BY_name = map[int32]string{
		0: "SERVICE_ID",
		1: "SERVICE_CREDENTAIL_ID",
	}
	DESCRIBE_BY_value = map[string]int32{
		"SERVICE_ID":            0,
		"SERVICE_CREDENTAIL_ID": 1,
	}
)

Enum value maps for DESCRIBE_BY.

View Source
var File_apps_service_pb_rpc_proto protoreflect.FileDescriptor
View Source
var File_apps_service_pb_service_proto protoreflect.FileDescriptor
View Source
var RPC_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "go9.devcloud.service.RPC",
	HandlerType: (*RPCServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "QueryService",
			Handler:    _RPC_QueryService_Handler,
		},
		{
			MethodName: "DescribeService",
			Handler:    _RPC_DescribeService_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/service/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 CreateServiceRequest

type CreateServiceRequest struct {

	// 用户所属的Domain(公司或者组织名字)
	// @gotags: bson:"domain" json:"domain" validate:"required"
	Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain" bson:"domain" validate:"required"`
	// 服务所属空间(项目)
	// @gotags: bson:"namespace" json:"namespace" validate:"required"
	Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" bson:"namespace" validate:"required"`
	// 服务名称
	// @gotags: bson:"name" json:"name" validate:"required"
	Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name" bson:"name" validate:"required"`
	// contains filtered or unexported fields
}

func (*CreateServiceRequest) Descriptor deprecated

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

Deprecated: Use CreateServiceRequest.ProtoReflect.Descriptor instead.

func (*CreateServiceRequest) GetDomain

func (x *CreateServiceRequest) GetDomain() string

func (*CreateServiceRequest) GetName

func (x *CreateServiceRequest) GetName() string

func (*CreateServiceRequest) GetNamespace

func (x *CreateServiceRequest) GetNamespace() string

func (*CreateServiceRequest) ProtoMessage

func (*CreateServiceRequest) ProtoMessage()

func (*CreateServiceRequest) ProtoReflect

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

func (*CreateServiceRequest) Reset

func (x *CreateServiceRequest) Reset()

func (*CreateServiceRequest) String

func (x *CreateServiceRequest) String() string

type Credentail

type Credentail struct {

	// 创建时间
	// @gotags: bson:"client_id" json:"client_id"
	ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id" bson:"client_id"`
	// 创建时间
	// @gotags: bson:"password" json:"password"
	ClientSecret string `protobuf:"bytes,2,opt,name=client_secret,json=clientSecret,proto3" json:"password" bson:"password"`
	// 创建时间
	// @gotags: bson:"create_at" json:"create_at"
	CreateAt int64 `protobuf:"varint,3,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"`
	// contains filtered or unexported fields
}

func (*Credentail) Descriptor deprecated

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

Deprecated: Use Credentail.ProtoReflect.Descriptor instead.

func (*Credentail) GetClientId

func (x *Credentail) GetClientId() string

func (*Credentail) GetClientSecret

func (x *Credentail) GetClientSecret() string

func (*Credentail) GetCreateAt

func (x *Credentail) GetCreateAt() int64

func (*Credentail) ProtoMessage

func (*Credentail) ProtoMessage()

func (*Credentail) ProtoReflect

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

func (*Credentail) Reset

func (x *Credentail) Reset()

func (*Credentail) String

func (x *Credentail) String() string

type DESCRIBE_BY

type DESCRIBE_BY int32
const (
	DESCRIBE_BY_SERVICE_ID            DESCRIBE_BY = 0
	DESCRIBE_BY_SERVICE_CREDENTAIL_ID DESCRIBE_BY = 1
)

func (DESCRIBE_BY) Descriptor

func (DESCRIBE_BY) Enum

func (x DESCRIBE_BY) Enum() *DESCRIBE_BY

func (DESCRIBE_BY) EnumDescriptor deprecated

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

Deprecated: Use DESCRIBE_BY.Descriptor instead.

func (DESCRIBE_BY) Number

func (x DESCRIBE_BY) Number() protoreflect.EnumNumber

func (DESCRIBE_BY) String

func (x DESCRIBE_BY) String() string

func (DESCRIBE_BY) Type

type DescribeServiceRequest

type DescribeServiceRequest struct {

	// 查询方式
	DescribeBy DESCRIBE_BY `` /* 130-byte string literal not displayed */
	// 具体的值
	DescribeVaule string `protobuf:"bytes,2,opt,name=describe_vaule,json=describeVaule,proto3" json:"describe_vaule,omitempty"`
	// contains filtered or unexported fields
}

func (*DescribeServiceRequest) Descriptor deprecated

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

Deprecated: Use DescribeServiceRequest.ProtoReflect.Descriptor instead.

func (*DescribeServiceRequest) GetDescribeBy

func (x *DescribeServiceRequest) GetDescribeBy() DESCRIBE_BY

func (*DescribeServiceRequest) GetDescribeVaule

func (x *DescribeServiceRequest) GetDescribeVaule() string

func (*DescribeServiceRequest) ProtoMessage

func (*DescribeServiceRequest) ProtoMessage()

func (*DescribeServiceRequest) ProtoReflect

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

func (*DescribeServiceRequest) Reset

func (x *DescribeServiceRequest) Reset()

func (*DescribeServiceRequest) String

func (x *DescribeServiceRequest) String() string

type QueryServiceRequest

type QueryServiceRequest struct {

	// 分页参数
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page,omitempty"`
	// 关键字查询
	Keywords string `protobuf:"bytes,2,opt,name=keywords,proto3" json:"keywords,omitempty"`
	// contains filtered or unexported fields
}

需要做分页: page_size page_number 依赖的代码 抽离成一个 第三方库: 公共代码库, 所有的项目都依赖这部分公共代码 mcube 就是这样的公共代码库: https://github.com/infraboard/mcube

func (*QueryServiceRequest) Descriptor deprecated

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

Deprecated: Use QueryServiceRequest.ProtoReflect.Descriptor instead.

func (*QueryServiceRequest) GetKeywords

func (x *QueryServiceRequest) GetKeywords() string

func (*QueryServiceRequest) GetPage

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

func (*QueryServiceRequest) ProtoMessage

func (*QueryServiceRequest) ProtoMessage()

func (*QueryServiceRequest) ProtoReflect

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

func (*QueryServiceRequest) Reset

func (x *QueryServiceRequest) Reset()

func (*QueryServiceRequest) String

func (x *QueryServiceRequest) String() string

type RPCClient

type RPCClient interface {
	// 查询用户列表
	QueryService(ctx context.Context, in *QueryServiceRequest, opts ...grpc.CallOption) (*ServiceSet, error)
	// 查询用户详情
	DescribeService(ctx context.Context, in *DescribeServiceRequest, opts ...grpc.CallOption) (*Service, 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 {
	// 查询用户列表
	QueryService(context.Context, *QueryServiceRequest) (*ServiceSet, error)
	// 查询用户详情
	DescribeService(context.Context, *DescribeServiceRequest) (*Service, 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 struct {

	// 对象元数据
	// @gotags: bson:",inline" json:"meta"
	Meta *meta.Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta" bson:",inline"`
	// 创建服务的请求 {"spec": {"username": ""}}  -->inline-- {"username": ""}
	// @gotags: bson:",inline" json:"spec"
	Spec *CreateServiceRequest `protobuf:"bytes,15,opt,name=spec,proto3" json:"spec" bson:",inline"`
	// 服务凭证, 用于校验服务合法性
	// @gotags: bson:"credentail" json:"credentail"
	Credentail *Credentail `protobuf:"bytes,2,opt,name=credentail,proto3" json:"credentail" bson:"credentail"`
	// contains filtered or unexported fields
}

func New

func New(in *CreateServiceRequest) *Service

func NewDefaultUser

func NewDefaultUser() *Service

func (*Service) Descriptor deprecated

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

Deprecated: Use Service.ProtoReflect.Descriptor instead.

func (*Service) GetCredentail

func (x *Service) GetCredentail() *Credentail

func (*Service) GetMeta

func (x *Service) GetMeta() *meta.Meta

func (*Service) GetSpec

func (x *Service) GetSpec() *CreateServiceRequest

func (*Service) ProtoMessage

func (*Service) ProtoMessage()

func (*Service) ProtoReflect

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

func (*Service) Reset

func (x *Service) Reset()

func (*Service) String

func (x *Service) String() string

type ServiceManager

type ServiceManager interface {
	CreateService(context.Context, *CreateServiceRequest) (*Service, error)
	RPCServer
}

type ServiceSet

type ServiceSet struct {

	// 用户总数量
	// @gotags: json:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
	// 分页的用户列表
	// @gotags: json:"items"
	Items []*Service `protobuf:"bytes,2,rep,name=items,proto3" json:"items"`
	// contains filtered or unexported fields
}

用户集合

func (*ServiceSet) Descriptor deprecated

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

Deprecated: Use ServiceSet.ProtoReflect.Descriptor instead.

func (*ServiceSet) GetItems

func (x *ServiceSet) GetItems() []*Service

func (*ServiceSet) GetTotal

func (x *ServiceSet) GetTotal() int64

func (*ServiceSet) ProtoMessage

func (*ServiceSet) ProtoMessage()

func (*ServiceSet) ProtoReflect

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

func (*ServiceSet) Reset

func (x *ServiceSet) Reset()

func (*ServiceSet) String

func (x *ServiceSet) String() string

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) DescribeService

func (UnimplementedRPCServer) QueryService

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