ruleprovider

package
v0.0.5-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EvaluateResponse_ComplianceState_name = map[int32]string{
	0: "Pending",
	1: "Compliant",
	2: "Limit",
	3: "Violation",
	4: "Error",
}
View Source
var EvaluateResponse_ComplianceState_value = map[string]int32{
	"Pending":   0,
	"Compliant": 1,
	"Limit":     2,
	"Violation": 3,
	"Error":     4,
}

Functions

func RegisterRuleProviderServer

func RegisterRuleProviderServer(s *grpc.Server, srv RuleProviderServer)

Types

type EndpointCostRequest

type EndpointCostRequest struct {
	Source               *Target     `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
	Rule                 *PolicyRule `protobuf:"bytes,2,opt,name=rule,proto3" json:"rule,omitempty"`
	PeerNodes            []string    `protobuf:"bytes,3,rep,name=peerNodes,proto3" json:"peerNodes,omitempty"`
	EligibleNodes        []string    `protobuf:"bytes,4,rep,name=eligibleNodes,proto3" json:"eligibleNodes,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*EndpointCostRequest) Descriptor

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

func (*EndpointCostRequest) GetEligibleNodes

func (m *EndpointCostRequest) GetEligibleNodes() []string

func (*EndpointCostRequest) GetPeerNodes

func (m *EndpointCostRequest) GetPeerNodes() []string

func (*EndpointCostRequest) GetRule

func (m *EndpointCostRequest) GetRule() *PolicyRule

func (*EndpointCostRequest) GetSource

func (m *EndpointCostRequest) GetSource() *Target

func (*EndpointCostRequest) ProtoMessage

func (*EndpointCostRequest) ProtoMessage()

func (*EndpointCostRequest) Reset

func (m *EndpointCostRequest) Reset()

func (*EndpointCostRequest) String

func (m *EndpointCostRequest) String() string

func (*EndpointCostRequest) XXX_DiscardUnknown

func (m *EndpointCostRequest) XXX_DiscardUnknown()

func (*EndpointCostRequest) XXX_Marshal

func (m *EndpointCostRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EndpointCostRequest) XXX_Merge

func (m *EndpointCostRequest) XXX_Merge(src proto.Message)

func (*EndpointCostRequest) XXX_Size

func (m *EndpointCostRequest) XXX_Size() int

func (*EndpointCostRequest) XXX_Unmarshal

func (m *EndpointCostRequest) XXX_Unmarshal(b []byte) error

type EndpointCostResponse

type EndpointCostResponse struct {
	NodeAndCost          []*NodeCost `protobuf:"bytes,1,rep,name=nodeAndCost,proto3" json:"nodeAndCost,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*EndpointCostResponse) Descriptor

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

func (*EndpointCostResponse) GetNodeAndCost

func (m *EndpointCostResponse) GetNodeAndCost() []*NodeCost

func (*EndpointCostResponse) ProtoMessage

func (*EndpointCostResponse) ProtoMessage()

func (*EndpointCostResponse) Reset

func (m *EndpointCostResponse) Reset()

func (*EndpointCostResponse) String

func (m *EndpointCostResponse) String() string

func (*EndpointCostResponse) XXX_DiscardUnknown

func (m *EndpointCostResponse) XXX_DiscardUnknown()

func (*EndpointCostResponse) XXX_Marshal

func (m *EndpointCostResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EndpointCostResponse) XXX_Merge

func (m *EndpointCostResponse) XXX_Merge(src proto.Message)

func (*EndpointCostResponse) XXX_Size

func (m *EndpointCostResponse) XXX_Size() int

func (*EndpointCostResponse) XXX_Unmarshal

func (m *EndpointCostResponse) XXX_Unmarshal(b []byte) error

type EvaluateRequest

type EvaluateRequest struct {
	Targets              map[string]*Target `` /* 155-byte string literal not displayed */
	Rule                 *PolicyRule        `protobuf:"bytes,2,opt,name=rule,proto3" json:"rule,omitempty"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*EvaluateRequest) Descriptor

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

func (*EvaluateRequest) GetRule

func (m *EvaluateRequest) GetRule() *PolicyRule

func (*EvaluateRequest) GetTargets

func (m *EvaluateRequest) GetTargets() map[string]*Target

func (*EvaluateRequest) ProtoMessage

func (*EvaluateRequest) ProtoMessage()

func (*EvaluateRequest) Reset

func (m *EvaluateRequest) Reset()

func (*EvaluateRequest) String

func (m *EvaluateRequest) String() string

func (*EvaluateRequest) XXX_DiscardUnknown

func (m *EvaluateRequest) XXX_DiscardUnknown()

func (*EvaluateRequest) XXX_Marshal

func (m *EvaluateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EvaluateRequest) XXX_Merge

func (m *EvaluateRequest) XXX_Merge(src proto.Message)

func (*EvaluateRequest) XXX_Size

func (m *EvaluateRequest) XXX_Size() int

func (*EvaluateRequest) XXX_Unmarshal

func (m *EvaluateRequest) XXX_Unmarshal(b []byte) error

type EvaluateResponse

type EvaluateResponse struct {
	Compliance           EvaluateResponse_ComplianceState `protobuf:"varint,1,opt,name=compliance,proto3,enum=ruleprovider.EvaluateResponse_ComplianceState" json:"compliance,omitempty"`
	Reason               string                           `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                         `json:"-"`
	XXX_unrecognized     []byte                           `json:"-"`
	XXX_sizecache        int32                            `json:"-"`
}

func (*EvaluateResponse) Descriptor

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

func (*EvaluateResponse) GetCompliance

func (*EvaluateResponse) GetReason

func (m *EvaluateResponse) GetReason() string

func (*EvaluateResponse) ProtoMessage

func (*EvaluateResponse) ProtoMessage()

func (*EvaluateResponse) Reset

func (m *EvaluateResponse) Reset()

func (*EvaluateResponse) String

func (m *EvaluateResponse) String() string

func (*EvaluateResponse) XXX_DiscardUnknown

func (m *EvaluateResponse) XXX_DiscardUnknown()

func (*EvaluateResponse) XXX_Marshal

func (m *EvaluateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EvaluateResponse) XXX_Merge

func (m *EvaluateResponse) XXX_Merge(src proto.Message)

func (*EvaluateResponse) XXX_Size

func (m *EvaluateResponse) XXX_Size() int

func (*EvaluateResponse) XXX_Unmarshal

func (m *EvaluateResponse) XXX_Unmarshal(b []byte) error

type EvaluateResponse_ComplianceState

type EvaluateResponse_ComplianceState int32
const (
	EvaluateResponse_Pending   EvaluateResponse_ComplianceState = 0
	EvaluateResponse_Compliant EvaluateResponse_ComplianceState = 1
	EvaluateResponse_Limit     EvaluateResponse_ComplianceState = 2
	EvaluateResponse_Violation EvaluateResponse_ComplianceState = 3
	EvaluateResponse_Error     EvaluateResponse_ComplianceState = 4
)

func (EvaluateResponse_ComplianceState) EnumDescriptor

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

func (EvaluateResponse_ComplianceState) String

type NodeCost

type NodeCost struct {
	Node                 string   `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
	Cost                 int64    `protobuf:"varint,2,opt,name=cost,proto3" json:"cost,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*NodeCost) Descriptor

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

func (*NodeCost) GetCost

func (m *NodeCost) GetCost() int64

func (*NodeCost) GetNode

func (m *NodeCost) GetNode() string

func (*NodeCost) ProtoMessage

func (*NodeCost) ProtoMessage()

func (*NodeCost) Reset

func (m *NodeCost) Reset()

func (*NodeCost) String

func (m *NodeCost) String() string

func (*NodeCost) XXX_DiscardUnknown

func (m *NodeCost) XXX_DiscardUnknown()

func (*NodeCost) XXX_Marshal

func (m *NodeCost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NodeCost) XXX_Merge

func (m *NodeCost) XXX_Merge(src proto.Message)

func (*NodeCost) XXX_Size

func (m *NodeCost) XXX_Size() int

func (*NodeCost) XXX_Unmarshal

func (m *NodeCost) XXX_Unmarshal(b []byte) error

type PolicyRule

type PolicyRule struct {
	// the type which this rule applies
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// the condition for the policy type against the value
	Request string `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
	// the value to which to apply the condition
	Limit                string   `protobuf:"bytes,3,opt,name=limit,proto3" json:"limit,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Defines a single policy rule

func (*PolicyRule) Descriptor

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

func (*PolicyRule) GetLimit

func (m *PolicyRule) GetLimit() string

func (*PolicyRule) GetName

func (m *PolicyRule) GetName() string

func (*PolicyRule) GetRequest

func (m *PolicyRule) GetRequest() string

func (*PolicyRule) ProtoMessage

func (*PolicyRule) ProtoMessage()

func (*PolicyRule) Reset

func (m *PolicyRule) Reset()

func (*PolicyRule) String

func (m *PolicyRule) String() string

func (*PolicyRule) XXX_DiscardUnknown

func (m *PolicyRule) XXX_DiscardUnknown()

func (*PolicyRule) XXX_Marshal

func (m *PolicyRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PolicyRule) XXX_Merge

func (m *PolicyRule) XXX_Merge(src proto.Message)

func (*PolicyRule) XXX_Size

func (m *PolicyRule) XXX_Size() int

func (*PolicyRule) XXX_Unmarshal

func (m *PolicyRule) XXX_Unmarshal(b []byte) error

type RuleProviderClient

type RuleProviderClient interface {
	Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error)
	EndpointCost(ctx context.Context, in *EndpointCostRequest, opts ...grpc.CallOption) (*EndpointCostResponse, error)
}

RuleProviderClient is the client API for RuleProvider service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRuleProviderClient

func NewRuleProviderClient(cc *grpc.ClientConn) RuleProviderClient

type RuleProviderServer

type RuleProviderServer interface {
	Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
	EndpointCost(context.Context, *EndpointCostRequest) (*EndpointCostResponse, error)
}

RuleProviderServer is the server API for RuleProvider service.

type Target

type Target struct {
	Cluster              string   `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"`
	Namespace            string   `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
	ApiVersion           string   `protobuf:"bytes,3,opt,name=apiVersion,proto3" json:"apiVersion,omitempty"`
	Kind                 string   `protobuf:"bytes,4,opt,name=kind,proto3" json:"kind,omitempty"`
	Name                 string   `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Target) Descriptor

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

func (*Target) GetApiVersion

func (m *Target) GetApiVersion() string

func (*Target) GetCluster

func (m *Target) GetCluster() string

func (*Target) GetKind

func (m *Target) GetKind() string

func (*Target) GetName

func (m *Target) GetName() string

func (*Target) GetNamespace

func (m *Target) GetNamespace() string

func (*Target) ProtoMessage

func (*Target) ProtoMessage()

func (*Target) Reset

func (m *Target) Reset()

func (*Target) String

func (m *Target) String() string

func (*Target) XXX_DiscardUnknown

func (m *Target) XXX_DiscardUnknown()

func (*Target) XXX_Marshal

func (m *Target) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Target) XXX_Merge

func (m *Target) XXX_Merge(src proto.Message)

func (*Target) XXX_Size

func (m *Target) XXX_Size() int

func (*Target) XXX_Unmarshal

func (m *Target) XXX_Unmarshal(b []byte) error

type UnimplementedRuleProviderServer

type UnimplementedRuleProviderServer struct {
}

UnimplementedRuleProviderServer can be embedded to have forward compatible implementations.

func (*UnimplementedRuleProviderServer) EndpointCost

func (*UnimplementedRuleProviderServer) Evaluate

Jump to

Keyboard shortcuts

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