policy

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName          = "policy"
	DefaultNamespace = "default"
)

Variables

View Source
var (
	DescribeBy_name = map[int32]string{
		0: "UserName",
		1: "ID",
	}
	DescribeBy_value = map[string]int32{
		"UserName": 0,
		"ID":       1,
	}
)

Enum value maps for DescribeBy.

View Source
var File_apps_policy_pb_policy_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "keyauth.policy.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ValidatePolicy",
			Handler:    _Service_ValidatePolicy_Handler,
		},
		{
			MethodName: "QueryPolicy",
			Handler:    _Service_QueryPolicy_Handler,
		},
		{
			MethodName: "DescribePOlicy",
			Handler:    _Service_DescribePOlicy_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/policy/pb/policy.proto",
}

Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type CreatePolicyRequest

type CreatePolicyRequest struct {

	// @gotags: json:"name"  bson:"name" validate:"required"
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" bson:"name" validate:"required"`
	// @gotags: json:"description"  bson:"description"
	Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description" bson:"description"`
	// @gotags: json:"role_name"  bson:"role_name" validate:"required"
	RoleName string `protobuf:"bytes,7,opt,name=role_name,json=roleName,proto3" json:"role_name" bson:"role_name" validate:"required"`
	// @gotags: json:"namespace"  bson:"namespace"
	Namespace string `protobuf:"bytes,8,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// @gotags: json:"user_name"  bson:"user_name" validate:"required"
	UserName string `protobuf:"bytes,10,opt,name=user_name,json=userName,proto3" json:"user_name" bson:"user_name" validate:"required"`
	// contains filtered or unexported fields
}

func NewDefaultCreateRequest

func NewDefaultCreateRequest() *CreatePolicyRequest

func (*CreatePolicyRequest) Descriptor deprecated

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

Deprecated: Use CreatePolicyRequest.ProtoReflect.Descriptor instead.

func (*CreatePolicyRequest) GetDescription

func (x *CreatePolicyRequest) GetDescription() string

func (*CreatePolicyRequest) GetName

func (x *CreatePolicyRequest) GetName() string

func (*CreatePolicyRequest) GetNamespace

func (x *CreatePolicyRequest) GetNamespace() string

func (*CreatePolicyRequest) GetRoleName

func (x *CreatePolicyRequest) GetRoleName() string

func (*CreatePolicyRequest) GetUserName

func (x *CreatePolicyRequest) GetUserName() 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

func (*CreatePolicyRequest) Validate

func (c *CreatePolicyRequest) Validate() error

type DeletePolicyRequest

type DeletePolicyRequest struct {

	// @gotags: json:"id"  bson:"_id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// @gotags: json:"namespace"  bson:"namespace"
	Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// contains filtered or unexported fields
}

func NewDeletePolicyRequestById

func NewDeletePolicyRequestById(id string) *DeletePolicyRequest

func (*DeletePolicyRequest) Descriptor deprecated

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

Deprecated: Use DeletePolicyRequest.ProtoReflect.Descriptor instead.

func (*DeletePolicyRequest) GetId

func (x *DeletePolicyRequest) GetId() string

func (*DeletePolicyRequest) GetNamespace

func (x *DeletePolicyRequest) GetNamespace() string

func (*DeletePolicyRequest) ProtoMessage

func (*DeletePolicyRequest) ProtoMessage()

func (*DeletePolicyRequest) ProtoReflect

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

func (*DeletePolicyRequest) Reset

func (x *DeletePolicyRequest) Reset()

func (*DeletePolicyRequest) String

func (x *DeletePolicyRequest) String() string

type DescribeBy

type DescribeBy int32
const (
	DescribeBy_UserName DescribeBy = 0
	DescribeBy_ID       DescribeBy = 1
)

func (DescribeBy) Descriptor

func (DescribeBy) Descriptor() protoreflect.EnumDescriptor

func (DescribeBy) Enum

func (x DescribeBy) Enum() *DescribeBy

func (DescribeBy) EnumDescriptor deprecated

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

Deprecated: Use DescribeBy.Descriptor instead.

func (DescribeBy) Number

func (x DescribeBy) Number() protoreflect.EnumNumber

func (DescribeBy) String

func (x DescribeBy) String() string

func (DescribeBy) Type

type DescribePolicyRequest

type DescribePolicyRequest struct {

	// @gotags: json:"id"
	Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id"`
	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace"`
	// 关键字参数
	// @gotags: json:"name"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"`
	// @gotags: json:"describe_by"
	DescribeBy DescribeBy `protobuf:"varint,4,opt,name=describe_by,json=describeBy,proto3,enum=keyauth.policy.DescribeBy" json:"describe_by"`
	// contains filtered or unexported fields
}

func NewDescribeById

func NewDescribeById(req *DeletePolicyRequest) *DescribePolicyRequest

func NewDescribePolicyRequest

func NewDescribePolicyRequest(id string) *DescribePolicyRequest

func NewDescribeRequest

func NewDescribeRequest() *DescribePolicyRequest

func (*DescribePolicyRequest) Descriptor deprecated

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

Deprecated: Use DescribePolicyRequest.ProtoReflect.Descriptor instead.

func (*DescribePolicyRequest) GetDescribeBy

func (x *DescribePolicyRequest) GetDescribeBy() DescribeBy

func (*DescribePolicyRequest) GetId

func (x *DescribePolicyRequest) GetId() string

func (*DescribePolicyRequest) GetName

func (x *DescribePolicyRequest) GetName() string

func (*DescribePolicyRequest) GetNamespace

func (x *DescribePolicyRequest) GetNamespace() string

func (*DescribePolicyRequest) ProtoMessage

func (*DescribePolicyRequest) ProtoMessage()

func (*DescribePolicyRequest) ProtoReflect

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

func (*DescribePolicyRequest) Reset

func (x *DescribePolicyRequest) Reset()

func (*DescribePolicyRequest) String

func (x *DescribePolicyRequest) String() string

func (*DescribePolicyRequest) Validate

func (d *DescribePolicyRequest) Validate() error

type Policy

type Policy struct {

	// @gotags: json:"id"  bson:"_id"
	Id string `protobuf:"bytes,9,opt,name=id,proto3" json:"id" bson:"_id"`
	// @gotags: json:"create_at"  bson:"create_at"
	CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"`
	// @gotags: json:"create_by"  bson:"create_by"
	CreateBy string `protobuf:"bytes,3,opt,name=create_by,json=createBy,proto3" json:"create_by" bson:"create_by"`
	// @gotags: json:"update_at"  bson:"update_at"
	UpdateAt int64 `protobuf:"varint,4,opt,name=update_at,json=updateAt,proto3" json:"update_at" bson:"update_at"`
	// @gotags: json:"spec"  bson:"spec"
	Spec *CreatePolicyRequest `protobuf:"bytes,5,opt,name=spec,proto3" json:"spec" bson:"spec"`
	// contains filtered or unexported fields
}

func NewDefaultPolicy

func NewDefaultPolicy(req *CreatePolicyRequest) *Policy

func NewPolicy

func NewPolicy() *Policy

func (*Policy) Descriptor deprecated

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

Deprecated: Use Policy.ProtoReflect.Descriptor instead.

func (*Policy) GetCreateAt

func (x *Policy) GetCreateAt() int64

func (*Policy) GetCreateBy

func (x *Policy) GetCreateBy() string

func (*Policy) GetId

func (x *Policy) GetId() string

func (*Policy) GetSpec

func (x *Policy) GetSpec() *CreatePolicyRequest

func (*Policy) GetUpdateAt

func (x *Policy) GetUpdateAt() int64

func (*Policy) Patch

func (p *Policy) Patch(req *UpdatePolicyRequest) error

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

func (*Policy) Update

func (p *Policy) Update(req *UpdatePolicyRequest)

type PolicyResponse

type PolicyResponse struct {

	// @gotags: json:"description"  bson:"description"
	Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description" bson:"description"`
	// @gotags: json:"role_name"  bson:"role_name"
	RoleName string `protobuf:"bytes,2,opt,name=role_name,json=roleName,proto3" json:"role_name" bson:"role_name"`
	// contains filtered or unexported fields
}

func (*PolicyResponse) Descriptor deprecated

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

Deprecated: Use PolicyResponse.ProtoReflect.Descriptor instead.

func (*PolicyResponse) GetDescription

func (x *PolicyResponse) GetDescription() string

func (*PolicyResponse) GetRoleName

func (x *PolicyResponse) GetRoleName() string

func (*PolicyResponse) ProtoMessage

func (*PolicyResponse) ProtoMessage()

func (*PolicyResponse) ProtoReflect

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

func (*PolicyResponse) Reset

func (x *PolicyResponse) Reset()

func (*PolicyResponse) String

func (x *PolicyResponse) String() string

type PolicySet

type PolicySet struct {

	// @gotags: json:"total"  bson:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total" bson:"total"`
	// @gotags: json:"items"  bson:"items"
	Items []*Policy `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewPolicySet

func NewPolicySet() *PolicySet

func (*PolicySet) Add

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

func (*PolicySet) Descriptor deprecated

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

Deprecated: Use PolicySet.ProtoReflect.Descriptor instead.

func (*PolicySet) GetByRoleName

func (s *PolicySet) GetByRoleName(RoleName string) *Policy

func (*PolicySet) GetItems

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

func (*PolicySet) GetTotal

func (x *PolicySet) GetTotal() int64

func (*PolicySet) ProtoMessage

func (*PolicySet) ProtoMessage()

func (*PolicySet) ProtoReflect

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

func (*PolicySet) Reset

func (x *PolicySet) Reset()

func (*PolicySet) Roles

func (s *PolicySet) Roles() (roles []string)

func (*PolicySet) String

func (x *PolicySet) String() string

type QueryPolicyRequest

type QueryPolicyRequest struct {

	// 分页参数
	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace"`
	// 关键字参数
	// @gotags: json:"user_name"
	UserName string `protobuf:"bytes,2,opt,name=user_name,json=userName,proto3" json:"user_name"`
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,4,opt,name=page,proto3" json:"page"`
	// contains filtered or unexported fields
}

func NewDefaultQueryRequest

func NewDefaultQueryRequest() *QueryPolicyRequest

func NewQueryPolicy

func NewQueryPolicy() *QueryPolicyRequest

func NewQueryPolicyRequestFromHTTP

func NewQueryPolicyRequestFromHTTP(r *http.Request) *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) GetUserName

func (x *QueryPolicyRequest) GetUserName() string

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 Service

type Service interface {
	ServiceServer
	DescribePolicy(ctx context.Context, req *DescribePolicyRequest) (*Policy, error)
	DeletePolicy(ctx context.Context, req *DeletePolicyRequest) (*Policy, error)
	UpdatePolicy(ctx context.Context, req *UpdatePolicyRequest) (*Policy, error)
	CreatePolicy(ctx context.Context, req *CreatePolicyRequest) (*Policy, error)
}

type ServiceClient

type ServiceClient interface {
	ValidatePolicy(ctx context.Context, in *ValidatePolicyRequest, opts ...grpc.CallOption) (*Policy, error)
	QueryPolicy(ctx context.Context, in *QueryPolicyRequest, opts ...grpc.CallOption) (*PolicySet, error)
	DescribePOlicy(ctx context.Context, in *DescribePolicyRequest, opts ...grpc.CallOption) (*Policy, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	ValidatePolicy(context.Context, *ValidatePolicyRequest) (*Policy, error)
	QueryPolicy(context.Context, *QueryPolicyRequest) (*PolicySet, error)
	DescribePOlicy(context.Context, *DescribePolicyRequest) (*Policy, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) DescribePOlicy

func (UnimplementedServiceServer) QueryPolicy

func (UnimplementedServiceServer) ValidatePolicy

type UnsafeServiceServer

type UnsafeServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.

type UpdatePolicyRequest

type UpdatePolicyRequest struct {

	// user id
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// 更新模式
	// @gotags: json:"update_mode"
	UpdateMode request1.UpdateMode `protobuf:"varint,2,opt,name=update_mode,json=updateMode,proto3,enum=infraboard.mcube.request.UpdateMode" json:"update_mode"`
	// 更新时间
	// @gotags: json:"update_at"
	UpdateAt int64 `protobuf:"varint,4,opt,name=update_at,json=updateAt,proto3" json:"update_at"`
	// 更新的书本信息
	// @gotags: json:"spec"
	Spec *CreatePolicyRequest `protobuf:"bytes,5,opt,name=spec,proto3" json:"spec"`
	// contains filtered or unexported fields
}

func NewPatchPolicyRequest

func NewPatchPolicyRequest(id string) *UpdatePolicyRequest

func NewPutPolicyRequest

func NewPutPolicyRequest(id string) *UpdatePolicyRequest

func (*UpdatePolicyRequest) Descriptor deprecated

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

Deprecated: Use UpdatePolicyRequest.ProtoReflect.Descriptor instead.

func (*UpdatePolicyRequest) GetId

func (x *UpdatePolicyRequest) GetId() string

func (*UpdatePolicyRequest) GetSpec

func (*UpdatePolicyRequest) GetUpdateAt

func (x *UpdatePolicyRequest) GetUpdateAt() int64

func (*UpdatePolicyRequest) GetUpdateMode

func (x *UpdatePolicyRequest) GetUpdateMode() request1.UpdateMode

func (*UpdatePolicyRequest) ProtoMessage

func (*UpdatePolicyRequest) ProtoMessage()

func (*UpdatePolicyRequest) ProtoReflect

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

func (*UpdatePolicyRequest) Reset

func (x *UpdatePolicyRequest) Reset()

func (*UpdatePolicyRequest) String

func (x *UpdatePolicyRequest) String() string

type ValidatePolicyRequest

type ValidatePolicyRequest struct {

	// @gotags: json:"namespace"
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace"`
	// 关键字参数
	// @gotags: json:"user_name"
	UserName string `protobuf:"bytes,5,opt,name=user_name,json=userName,proto3" json:"user_name"`
	// @gotags: json:"resource"
	Resource string `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource"`
	// @gotags: json:"action"
	Action string `protobuf:"bytes,4,opt,name=action,proto3" json:"action"`
	// @gotags: json:"service_name"
	ServiceName string `protobuf:"bytes,6,opt,name=service_name,json=serviceName,proto3" json:"service_name"`
	// contains filtered or unexported fields
}

func NewValidateRequest

func NewValidateRequest() *ValidatePolicyRequest

func (*ValidatePolicyRequest) Descriptor deprecated

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

Deprecated: Use ValidatePolicyRequest.ProtoReflect.Descriptor instead.

func (*ValidatePolicyRequest) GetAction

func (x *ValidatePolicyRequest) GetAction() string

func (*ValidatePolicyRequest) GetNamespace

func (x *ValidatePolicyRequest) GetNamespace() string

func (*ValidatePolicyRequest) GetResource

func (x *ValidatePolicyRequest) GetResource() string

func (*ValidatePolicyRequest) GetServiceName

func (x *ValidatePolicyRequest) GetServiceName() string

func (*ValidatePolicyRequest) GetUserName

func (x *ValidatePolicyRequest) GetUserName() string

func (*ValidatePolicyRequest) ProtoMessage

func (*ValidatePolicyRequest) ProtoMessage()

func (*ValidatePolicyRequest) ProtoReflect

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

func (*ValidatePolicyRequest) Reset

func (x *ValidatePolicyRequest) Reset()

func (*ValidatePolicyRequest) String

func (x *ValidatePolicyRequest) String() string

func (*ValidatePolicyRequest) ValidatePolicy

func (v *ValidatePolicyRequest) ValidatePolicy() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL