Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)
- type CreatePolicyRequest
- func (*CreatePolicyRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreatePolicyRequest) GetNamespace() string
- func (x *CreatePolicyRequest) GetRoleId() string
- func (x *CreatePolicyRequest) GetUserId() string
- func (*CreatePolicyRequest) ProtoMessage()
- func (x *CreatePolicyRequest) ProtoReflect() protoreflect.Message
- func (x *CreatePolicyRequest) Reset()
- func (x *CreatePolicyRequest) String() string
- type Policy
- func (*Policy) Descriptor() ([]byte, []int)deprecated
- func (x *Policy) GetMeta() *meta.Meta
- func (x *Policy) GetRole() *role.Role
- func (x *Policy) GetSpec() *CreatePolicyRequest
- func (*Policy) ProtoMessage()
- func (x *Policy) ProtoReflect() protoreflect.Message
- func (x *Policy) Reset()
- func (x *Policy) String() string
- type PolicySet
- func (s *PolicySet) Add(item *Policy)
- func (*PolicySet) Descriptor() ([]byte, []int)deprecated
- func (x *PolicySet) GetItems() []*Policy
- func (s *PolicySet) GetRoles() (roles []*role.Role)
- func (x *PolicySet) GetTotal() int64
- func (s *PolicySet) Len() uint64
- func (*PolicySet) ProtoMessage()
- func (x *PolicySet) ProtoReflect() protoreflect.Message
- func (x *PolicySet) Reset()
- func (s *PolicySet) RoleIds() (roleIds []string)
- func (s *PolicySet) SetRole(r *role.Role)
- func (x *PolicySet) String() string
- type QueryPolicyRequest
- func (*QueryPolicyRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryPolicyRequest) GetNamespace() string
- func (x *QueryPolicyRequest) GetPage() *request.PageRequest
- func (x *QueryPolicyRequest) GetUserId() string
- func (x *QueryPolicyRequest) GetWithRole() bool
- func (*QueryPolicyRequest) ProtoMessage()
- func (x *QueryPolicyRequest) ProtoReflect() protoreflect.Message
- func (x *QueryPolicyRequest) Reset()
- func (x *QueryPolicyRequest) String() string
- type RPCClient
- type RPCServer
- type Service
- type UnimplementedRPCServer
- type UnsafeRPCServer
Constants ¶
const (
AppName = "policy"
)
Variables ¶
var File_apps_policy_pb_policy_proto protoreflect.FileDescriptor
var File_apps_policy_pb_rpc_proto protoreflect.FileDescriptor
var RPC_ServiceDesc = grpc.ServiceDesc{ ServiceName: "go9.devcloud.policy.RPC", HandlerType: (*RPCServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreatePolicy", Handler: _RPC_CreatePolicy_Handler, }, { MethodName: "QueryPolicy", Handler: _RPC_QueryPolicy_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/policy/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 CreatePolicyRequest ¶
type CreatePolicyRequest struct { // 创建信息 // @gotags: bson:"user_id" json:"user_id" UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id" bson:"user_id"` // 创建信息 // @gotags: bson:"namespace" json:"namespace" Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" bson:"namespace"` // 创建信息 // @gotags: bson:"role_id" json:"role_id" RoleId string `protobuf:"bytes,3,opt,name=role_id,json=roleId,proto3" json:"role_id" bson:"role_id"` // contains filtered or unexported fields }
func NewCreatePolicyRequest ¶
func NewCreatePolicyRequest() *CreatePolicyRequest
func (*CreatePolicyRequest) Descriptor
deprecated
func (*CreatePolicyRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreatePolicyRequest.ProtoReflect.Descriptor instead.
func (*CreatePolicyRequest) GetNamespace ¶
func (x *CreatePolicyRequest) GetNamespace() string
func (*CreatePolicyRequest) GetRoleId ¶
func (x *CreatePolicyRequest) GetRoleId() string
func (*CreatePolicyRequest) GetUserId ¶
func (x *CreatePolicyRequest) GetUserId() string
func (*CreatePolicyRequest) ProtoMessage ¶
func (*CreatePolicyRequest) ProtoMessage()
func (*CreatePolicyRequest) ProtoReflect ¶
func (x *CreatePolicyRequest) ProtoReflect() protoreflect.Message
func (*CreatePolicyRequest) Reset ¶
func (x *CreatePolicyRequest) Reset()
func (*CreatePolicyRequest) String ¶
func (x *CreatePolicyRequest) String() string
type Policy ¶
type Policy struct { // 对象元数据 // @gotags: bson:",inline" json:"meta" Meta *meta.Meta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta" bson:",inline"` // 创建信息 // @gotags: bson:",inline" json:"spec" Spec *CreatePolicyRequest `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec" bson:",inline"` // 查询关联的Role // @gotags: bson:"-" json:"role" Role *role.Role `protobuf:"bytes,3,opt,name=role,proto3" json:"role" bson:"-"` // contains filtered or unexported fields }
func New ¶
func New(req *CreatePolicyRequest) *Policy
func NewDefaultPolicy ¶
func NewDefaultPolicy() *Policy
func (*Policy) Descriptor
deprecated
func (*Policy) GetSpec ¶
func (x *Policy) GetSpec() *CreatePolicyRequest
func (*Policy) ProtoMessage ¶
func (*Policy) ProtoMessage()
func (*Policy) ProtoReflect ¶
func (x *Policy) ProtoReflect() protoreflect.Message
type PolicySet ¶
type PolicySet struct { // 用户总数量 // @gotags: json:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` // 分页的用户列表 // @gotags: json:"items" Items []*Policy `protobuf:"bytes,2,rep,name=items,proto3" json:"items"` // contains filtered or unexported fields }
func NewPolicySet ¶
func NewPolicySet() *PolicySet
func (*PolicySet) Descriptor
deprecated
func (*PolicySet) ProtoMessage ¶
func (*PolicySet) ProtoMessage()
func (*PolicySet) ProtoReflect ¶
func (x *PolicySet) ProtoReflect() protoreflect.Message
type QueryPolicyRequest ¶
type QueryPolicyRequest struct { // 分页参数 // @gotags: json:"page" Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"` // 谁 // @gotags: json:"user_id" UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id"` // 空间 // @gotags: json:"namespace" Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace"` // 默认不查询关联数据? 查询关联数据是有开销 // @gotags: json:"role" WithRole bool `protobuf:"varint,4,opt,name=with_role,json=withRole,proto3" json:"role"` // contains filtered or unexported fields }
func NewQueryPolicyRequest ¶
func NewQueryPolicyRequest() *QueryPolicyRequest
func (*QueryPolicyRequest) Descriptor
deprecated
func (*QueryPolicyRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryPolicyRequest.ProtoReflect.Descriptor instead.
func (*QueryPolicyRequest) GetNamespace ¶
func (x *QueryPolicyRequest) GetNamespace() string
func (*QueryPolicyRequest) GetPage ¶
func (x *QueryPolicyRequest) GetPage() *request.PageRequest
func (*QueryPolicyRequest) GetUserId ¶
func (x *QueryPolicyRequest) GetUserId() string
func (*QueryPolicyRequest) GetWithRole ¶
func (x *QueryPolicyRequest) GetWithRole() bool
func (*QueryPolicyRequest) ProtoMessage ¶
func (*QueryPolicyRequest) ProtoMessage()
func (*QueryPolicyRequest) ProtoReflect ¶
func (x *QueryPolicyRequest) ProtoReflect() protoreflect.Message
func (*QueryPolicyRequest) Reset ¶
func (x *QueryPolicyRequest) Reset()
func (*QueryPolicyRequest) String ¶
func (x *QueryPolicyRequest) String() string
type RPCClient ¶
type RPCClient interface { // 创建策略 CreatePolicy(ctx context.Context, in *CreatePolicyRequest, opts ...grpc.CallOption) (*Policy, error) // 查询策略 QueryPolicy(ctx context.Context, in *QueryPolicyRequest, opts ...grpc.CallOption) (*PolicySet, 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 { // 创建策略 CreatePolicy(context.Context, *CreatePolicyRequest) (*Policy, error) // 查询策略 QueryPolicy(context.Context, *QueryPolicyRequest) (*PolicySet, 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) CreatePolicy ¶
func (UnimplementedRPCServer) CreatePolicy(context.Context, *CreatePolicyRequest) (*Policy, error)
func (UnimplementedRPCServer) QueryPolicy ¶
func (UnimplementedRPCServer) QueryPolicy(context.Context, *QueryPolicyRequest) (*PolicySet, 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.