Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterRpcServer(s grpc.ServiceRegistrar, srv RpcServer)
- type Permission
- func (*Permission) Descriptor() ([]byte, []int)deprecated
- func (x *Permission) GetAction() []string
- func (x *Permission) GetResource() string
- func (x *Permission) GetService() string
- func (p *Permission) HasAction(action string) bool
- func (p *Permission) HasPerm(service, resource, action string) bool
- func (*Permission) ProtoMessage()
- func (x *Permission) ProtoReflect() protoreflect.Message
- func (x *Permission) Reset()
- func (x *Permission) String() string
- type QueryRoleRequest
- type Role
- func (*Role) Descriptor() ([]byte, []int)deprecated
- func (x *Role) GetMeta() *resource.Meta
- func (x *Role) GetSpec() *RoleSpec
- func (r *Role) HasPerm(service, resource, action string) bool
- func (*Role) ProtoMessage()
- func (x *Role) ProtoReflect() protoreflect.Message
- func (x *Role) Reset()
- func (x *Role) String() string
- type RoleSet
- type RoleSpec
- func (*RoleSpec) Descriptor() ([]byte, []int)deprecated
- func (x *RoleSpec) GetDescription() string
- func (x *RoleSpec) GetName() string
- func (x *RoleSpec) GetPermissions() []*Permission
- func (*RoleSpec) ProtoMessage()
- func (x *RoleSpec) ProtoReflect() protoreflect.Message
- func (x *RoleSpec) Reset()
- func (x *RoleSpec) String() string
- type RpcClient
- type RpcServer
- type Service
- type UnimplementedRpcServer
- type UnsafeRpcServer
Constants ¶
const ( Rpc_CreateRole_FullMethodName = "/go11.devcloud_mini.role.Rpc/CreateRole" Rpc_QueryRole_FullMethodName = "/go11.devcloud_mini.role.Rpc/QueryRole" )
const AppName = "roles"
Variables ¶
var File_mcenter_apps_role_pb_model_proto protoreflect.FileDescriptor
var File_mcenter_apps_role_pb_rpc_proto protoreflect.FileDescriptor
var Rpc_ServiceDesc = grpc.ServiceDesc{ ServiceName: "go11.devcloud_mini.role.Rpc", HandlerType: (*RpcServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateRole", Handler: _Rpc_CreateRole_Handler, }, { MethodName: "QueryRole", Handler: _Rpc_QueryRole_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "mcenter/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 Permission ¶
type Permission struct {
// 服务
// @gotags: json:"service" bson:"service" validate:"required"
Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service" bson:"service" validate:"required"`
// 资源
// @gotags: json:"resource" bson:"resource" validate:"required"
Resource string `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource" bson:"resource" validate:"required"`
// 操作
// @gotags: json:"action" bson:"action" validate:"required"
Action []string `protobuf:"bytes,3,rep,name=action,proto3" json:"action" bson:"action" validate:"required"`
// contains filtered or unexported fields
}
cmdb secret list
func (*Permission) Descriptor
deprecated
func (*Permission) Descriptor() ([]byte, []int)
Deprecated: Use Permission.ProtoReflect.Descriptor instead.
func (*Permission) GetAction ¶
func (x *Permission) GetAction() []string
func (*Permission) GetResource ¶
func (x *Permission) GetResource() string
func (*Permission) GetService ¶
func (x *Permission) GetService() string
func (*Permission) HasAction ¶
func (p *Permission) HasAction(action string) bool
func (*Permission) HasPerm ¶
func (p *Permission) HasPerm(service, resource, action string) bool
func (*Permission) ProtoMessage ¶
func (*Permission) ProtoMessage()
func (*Permission) ProtoReflect ¶
func (x *Permission) ProtoReflect() protoreflect.Message
func (*Permission) Reset ¶
func (x *Permission) Reset()
func (*Permission) String ¶
func (x *Permission) String() string
type QueryRoleRequest ¶
type QueryRoleRequest struct {
// 哪些Id
RoleIds []string `protobuf:"bytes,1,rep,name=role_ids,json=roleIds,proto3" json:"role_ids,omitempty"`
// contains filtered or unexported fields
}
func (*QueryRoleRequest) Descriptor
deprecated
func (*QueryRoleRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryRoleRequest.ProtoReflect.Descriptor instead.
func (*QueryRoleRequest) GetRoleIds ¶
func (x *QueryRoleRequest) GetRoleIds() []string
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 Role ¶
type Role struct {
// 元数据信息
// @gotags: json:"meta" bson:",inline"
Meta *resource.Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta" bson:",inline"`
// 角色定义
// @gotags: json:"spec" bson:",inline"
Spec *RoleSpec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec" bson:",inline"`
// contains filtered or unexported fields
}
func (*Role) Descriptor
deprecated
func (*Role) ProtoMessage ¶
func (*Role) ProtoMessage()
func (*Role) ProtoReflect ¶
func (x *Role) ProtoReflect() protoreflect.Message
type RoleSet ¶
type RoleSet struct {
Items []*Role `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
// contains filtered or unexported fields
}
func (*RoleSet) Descriptor
deprecated
func (*RoleSet) ProtoMessage ¶
func (*RoleSet) ProtoMessage()
func (*RoleSet) ProtoReflect ¶
func (x *RoleSet) ProtoReflect() protoreflect.Message
type RoleSpec ¶
type RoleSpec struct {
// 角色的权限名字
// @gotags: json:"name" bson:"name"
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" bson:"name"`
// 角色的权限描述
// @gotags: json:"description" bson:"description"
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description" bson:"description"`
// 角色的权限
// @gotags: json:"permissions" bson:"permissions"
Permissions []*Permission `protobuf:"bytes,4,rep,name=permissions,proto3" json:"permissions" bson:"permissions"`
// contains filtered or unexported fields
}
func NewRoleSpec ¶
func NewRoleSpec() *RoleSpec
func (*RoleSpec) Descriptor
deprecated
func (*RoleSpec) GetDescription ¶
func (*RoleSpec) GetPermissions ¶
func (x *RoleSpec) GetPermissions() []*Permission
func (*RoleSpec) ProtoMessage ¶
func (*RoleSpec) ProtoMessage()
func (*RoleSpec) ProtoReflect ¶
func (x *RoleSpec) ProtoReflect() protoreflect.Message
type RpcClient ¶
type RpcClient interface {
// 创建角色
CreateRole(ctx context.Context, in *RoleSpec, opts ...grpc.CallOption) (*Role, error)
// 查询角色列表
QueryRole(ctx context.Context, in *QueryRoleRequest, opts ...grpc.CallOption) (*RoleSet, 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, *RoleSpec) (*Role, error)
// 查询角色列表
QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
// contains filtered or unexported methods
}
RpcServer is the server API for Rpc service. All implementations must embed UnimplementedRpcServer for forward compatibility
type UnimplementedRpcServer ¶
type UnimplementedRpcServer struct {
}
UnimplementedRpcServer must be embedded to have forward compatible implementations.
func (UnimplementedRpcServer) CreateRole ¶
func (UnimplementedRpcServer) QueryRole ¶
func (UnimplementedRpcServer) QueryRole(context.Context, *QueryRoleRequest) (*RoleSet, error)
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.