role

package
v0.0.0-...-79b8b17 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Rpc_CreateRole_FullMethodName = "/mcenter.role.Rpc/CreateRole"
	Rpc_DescRole_FullMethodName   = "/mcenter.role.Rpc/DescRole"
	Rpc_QueryRole_FullMethodName  = "/mcenter.role.Rpc/QueryRole"
	Rpc_DeleteRole_FullMethodName = "/mcenter.role.Rpc/DeleteRole"
)
View Source
const AppName = "role"

Variables

View Source
var (
	QueryType_name = map[int32]string{
		0: "QUERY_TYPE_UNSPECIFIED",
		1: "QUERY_TYPE_ROLE_NAME",
		2: "QUERY_TYPE_DESC",
		3: "QUERY_TYPE_ROLE_IDS",
	}
	QueryType_value = map[string]int32{
		"QUERY_TYPE_UNSPECIFIED": 0,
		"QUERY_TYPE_ROLE_NAME":   1,
		"QUERY_TYPE_DESC":        2,
		"QUERY_TYPE_ROLE_IDS":    3,
	}
)

Enum value maps for QueryType.

View Source
var File_apps_role_pb_model_proto protoreflect.FileDescriptor
View Source
var File_apps_role_pb_rpc_proto protoreflect.FileDescriptor
View Source
var Rpc_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "mcenter.role.Rpc",
	HandlerType: (*RpcServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateRole",
			Handler:    _Rpc_CreateRole_Handler,
		},
		{
			MethodName: "DescRole",
			Handler:    _Rpc_DescRole_Handler,
		},
		{
			MethodName: "QueryRole",
			Handler:    _Rpc_QueryRole_Handler,
		},
		{
			MethodName: "DeleteRole",
			Handler:    _Rpc_DeleteRole_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/role/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 DeleteRoleRequest

type DeleteRoleRequest struct {

	// @gotags: validate:"required"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" validate:"required"`
	// contains filtered or unexported fields
}

func (*DeleteRoleRequest) Descriptor deprecated

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

Deprecated: Use DeleteRoleRequest.ProtoReflect.Descriptor instead.

func (*DeleteRoleRequest) GetId

func (x *DeleteRoleRequest) GetId() int64

func (*DeleteRoleRequest) ProtoMessage

func (*DeleteRoleRequest) ProtoMessage()

func (*DeleteRoleRequest) ProtoReflect

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

func (*DeleteRoleRequest) Reset

func (x *DeleteRoleRequest) Reset()

func (*DeleteRoleRequest) String

func (x *DeleteRoleRequest) String() string

type DescRoleRequest

type DescRoleRequest struct {

	// @gotags: validate:"required"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" validate:"required"`
	// contains filtered or unexported fields
}

func (*DescRoleRequest) Descriptor deprecated

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

Deprecated: Use DescRoleRequest.ProtoReflect.Descriptor instead.

func (*DescRoleRequest) GetId

func (x *DescRoleRequest) GetId() int64

func (*DescRoleRequest) ProtoMessage

func (*DescRoleRequest) ProtoMessage()

func (*DescRoleRequest) ProtoReflect

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

func (*DescRoleRequest) Reset

func (x *DescRoleRequest) Reset()

func (*DescRoleRequest) String

func (x *DescRoleRequest) String() string

type Meta

type Meta struct {

	// @gotags: json:"created_at" gorm:"primaryKey"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"created_at" gorm:"primaryKey"`
	// @gotags: json:"created_at" gorm:"autoCreateTime"
	CreatedAt int64 `protobuf:"varint,2,opt,name=created_at,json=createdAt,proto3" json:"created_at" gorm:"autoCreateTime"`
	// @gotags: json:"updated_at" gorm:"autoUpdateTime"
	UpdatedAt int64 `protobuf:"varint,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at" gorm:"autoUpdateTime"`
	// contains filtered or unexported fields
}

func (*Meta) Descriptor deprecated

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

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetCreatedAt

func (x *Meta) GetCreatedAt() int64

func (*Meta) GetId

func (x *Meta) GetId() int64

func (*Meta) GetUpdatedAt

func (x *Meta) GetUpdatedAt() int64

func (*Meta) ProtoMessage

func (*Meta) ProtoMessage()

func (*Meta) ProtoReflect

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

func (*Meta) Reset

func (x *Meta) Reset()

func (*Meta) String

func (x *Meta) String() string

type QueryRoleRequest

type QueryRoleRequest struct {

	// @gotags: validate:"required"
	PageNum int64 `protobuf:"varint,1,opt,name=page_num,json=pageNum,proto3" json:"page_num,omitempty" validate:"required"`
	// @gotags: validate:"required"
	PageSize  int64     `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty" validate:"required"`
	QueryType QueryType `protobuf:"varint,3,opt,name=query_type,json=queryType,proto3,enum=mcenter.role.QueryType" json:"query_type,omitempty"`
	Keyword   string    `protobuf:"bytes,4,opt,name=keyword,proto3" json:"keyword,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryRoleRequest) Descriptor deprecated

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

Deprecated: Use QueryRoleRequest.ProtoReflect.Descriptor instead.

func (*QueryRoleRequest) GetKeyword

func (x *QueryRoleRequest) GetKeyword() string

func (*QueryRoleRequest) GetPageNum

func (x *QueryRoleRequest) GetPageNum() int64

func (*QueryRoleRequest) GetPageSize

func (x *QueryRoleRequest) GetPageSize() int64

func (*QueryRoleRequest) GetQueryType

func (x *QueryRoleRequest) GetQueryType() QueryType

func (*QueryRoleRequest) ProtoMessage

func (*QueryRoleRequest) ProtoMessage()

func (*QueryRoleRequest) ProtoReflect

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

func (*QueryRoleRequest) Reset

func (x *QueryRoleRequest) Reset()

func (*QueryRoleRequest) String

func (x *QueryRoleRequest) String() string

type QueryType

type QueryType int32
const (
	QueryType_QUERY_TYPE_UNSPECIFIED QueryType = 0
	QueryType_QUERY_TYPE_ROLE_NAME   QueryType = 1
	QueryType_QUERY_TYPE_DESC        QueryType = 2
	QueryType_QUERY_TYPE_ROLE_IDS    QueryType = 3
)

func (QueryType) Descriptor

func (QueryType) Descriptor() protoreflect.EnumDescriptor

func (QueryType) Enum

func (x QueryType) Enum() *QueryType

func (QueryType) EnumDescriptor deprecated

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

Deprecated: Use QueryType.Descriptor instead.

func (QueryType) Number

func (x QueryType) Number() protoreflect.EnumNumber

func (QueryType) String

func (x QueryType) String() string

func (QueryType) Type

type Role

type Role struct {

	// @gotags: gorm:"embedded"
	Meta *Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty" gorm:"embedded"`
	// @gotags: gorm:"embedded"
	Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty" gorm:"embedded"`
	// contains filtered or unexported fields
}

func (*Role) Descriptor deprecated

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

Deprecated: Use Role.ProtoReflect.Descriptor instead.

func (*Role) GetMeta

func (x *Role) GetMeta() *Meta

func (*Role) GetSpec

func (x *Role) GetSpec() *Spec

func (*Role) ProtoMessage

func (*Role) ProtoMessage()

func (*Role) ProtoReflect

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

func (*Role) Reset

func (x *Role) Reset()

func (*Role) String

func (x *Role) String() string

type RoleSet

type RoleSet struct {
	Total int64   `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	Items []*Role `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func (*RoleSet) Descriptor deprecated

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

Deprecated: Use RoleSet.ProtoReflect.Descriptor instead.

func (*RoleSet) GetItems

func (x *RoleSet) GetItems() []*Role

func (*RoleSet) GetTotal

func (x *RoleSet) GetTotal() int64

func (*RoleSet) ProtoMessage

func (*RoleSet) ProtoMessage()

func (*RoleSet) ProtoReflect

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

func (*RoleSet) Reset

func (x *RoleSet) Reset()

func (*RoleSet) String

func (x *RoleSet) String() string

func (*RoleSet) ValidatePermission

func (rs *RoleSet) ValidatePermission(v, s, a string) bool

ValidatePermission 校验给定的 service、resource、action 是否在权限允许的范围之内

type RpcClient

type RpcClient interface {
	CreateRole(ctx context.Context, in *Spec, opts ...grpc.CallOption) (*Role, error)
	DescRole(ctx context.Context, in *DescRoleRequest, opts ...grpc.CallOption) (*Role, error)
	QueryRole(ctx context.Context, in *QueryRoleRequest, opts ...grpc.CallOption) (*RoleSet, error)
	DeleteRole(ctx context.Context, in *DeleteRoleRequest, opts ...grpc.CallOption) (*Role, 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 {
	CreateRole(context.Context, *Spec) (*Role, error)
	DescRole(context.Context, *DescRoleRequest) (*Role, error)
	QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
	DeleteRole(context.Context, *DeleteRoleRequest) (*Role, 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
	CreateTable(ctx context.Context) error
}

func GetSvc

func GetSvc() Service

type Spec

type Spec struct {

	// @gotags: json:"name" validate:"required"
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" validate:"required"`
	// @gotags: json:"namespace" validate:"required"
	Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" validate:"required"`
	// @gotags: json:"service" validate:"required" gorm:"json"
	Service []string `protobuf:"bytes,3,rep,name=service,proto3" json:"service" validate:"required" gorm:"json"`
	// @gotags: json:"resource" validate:"required" gorm:"json"
	Resource []string `protobuf:"bytes,4,rep,name=resource,proto3" json:"resource" validate:"required" gorm:"json"`
	// @gotags: json:"actions" validate:"required" gorm:"json"
	Actions []string `protobuf:"bytes,5,rep,name=actions,proto3" json:"actions" validate:"required" gorm:"json"`
	// @gotags: json:"description" validate:"required"
	Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description" validate:"required"`
	// contains filtered or unexported fields
}

func (*Spec) Descriptor deprecated

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

Deprecated: Use Spec.ProtoReflect.Descriptor instead.

func (*Spec) GetActions

func (x *Spec) GetActions() []string

func (*Spec) GetDescription

func (x *Spec) GetDescription() string

func (*Spec) GetName

func (x *Spec) GetName() string

func (*Spec) GetNamespace

func (x *Spec) GetNamespace() string

func (*Spec) GetResource

func (x *Spec) GetResource() []string

func (*Spec) GetService

func (x *Spec) GetService() []string

func (*Spec) ProtoMessage

func (*Spec) ProtoMessage()

func (*Spec) ProtoReflect

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

func (*Spec) Reset

func (x *Spec) Reset()

func (*Spec) String

func (x *Spec) String() string

type UnimplementedRpcServer

type UnimplementedRpcServer struct {
}

UnimplementedRpcServer must be embedded to have forward compatible implementations.

func (UnimplementedRpcServer) CreateRole

func (UnimplementedRpcServer) DeleteRole

func (UnimplementedRpcServer) DescRole

func (UnimplementedRpcServer) QueryRole

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