policy

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: 11 Imported by: 0

README

策略管理

Documentation

Index

Constants

View Source
const (
	AppName = "policy"
)

Variables

View Source
var File_apps_policy_pb_policy_proto protoreflect.FileDescriptor
View Source
var File_apps_policy_pb_rpc_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Policy.ProtoReflect.Descriptor instead.

func (*Policy) GetMeta

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

func (*Policy) GetRole

func (x *Policy) GetRole() *role.Role

func (*Policy) GetSpec

func (x *Policy) GetSpec() *CreatePolicyRequest

func (*Policy) ProtoMessage

func (*Policy) ProtoMessage()

func (*Policy) ProtoReflect

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

func (*Policy) Reset

func (x *Policy) Reset()

func (*Policy) String

func (x *Policy) String() string

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) Add

func (s *PolicySet) Add(item *Policy)

func (*PolicySet) Descriptor deprecated

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

Deprecated: Use PolicySet.ProtoReflect.Descriptor instead.

func (*PolicySet) GetItems

func (x *PolicySet) GetItems() []*Policy

func (*PolicySet) GetRoles

func (s *PolicySet) GetRoles() (roles []*role.Role)

func (*PolicySet) GetTotal

func (x *PolicySet) GetTotal() int64

func (*PolicySet) Len

func (s *PolicySet) Len() uint64

func (*PolicySet) ProtoMessage

func (*PolicySet) ProtoMessage()

func (*PolicySet) ProtoReflect

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

func (*PolicySet) Reset

func (x *PolicySet) Reset()

func (*PolicySet) RoleIds

func (s *PolicySet) RoleIds() (roleIds []string)

func (*PolicySet) SetRole

func (s *PolicySet) SetRole(r *role.Role)

func (*PolicySet) String

func (x *PolicySet) String() string

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 Service

type Service interface {
	RPCServer
}

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) CreatePolicy

func (UnimplementedRPCServer) QueryPolicy

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