controlplane

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompilePolicy

func CompilePolicy(policyMessage *policylangv1.Policy, registry status.Registry) (*circuitfactory.Circuit, error)

CompilePolicy takes policyMessage and returns a compiled policy. This is a helper method for standalone consumption of policy compiler.

func Module added in v0.1.2

func Module() fx.Option

Module - Controller can be initialized by passing options from Module() to fx app.

func ValidateAndCompile added in v0.2.1

func ValidateAndCompile(ctx context.Context, name string, yamlSrc []byte) (*circuitfactory.Circuit, *policiesv1.Policy, error)

ValidateAndCompile checks the validity of a single Policy and compiles it.

Types

type FxIn added in v1.5.0

type FxIn struct {
	fx.In
	Unmarshaller config.Unmarshaller
}

FxIn is the input for the AddAgentInfoAttribute function.

type FxOut added in v0.1.3

type FxOut struct {
	fx.Out
	Validator policyvalidator.PolicySpecValidator `group:"policy-validators"`
}

FxOut is the output of the controlplane module.

type Policy

type Policy struct {
	iface.PolicyBase
	// contains filtered or unexported fields
}

Policy invokes the Circuit runtime at tick frequency.

func (*Policy) GetEvaluationInterval

func (policy *Policy) GetEvaluationInterval() time.Duration

GetEvaluationInterval returns the ID of the policy.

func (*Policy) GetStatusRegistry added in v0.4.0

func (policy *Policy) GetStatusRegistry() status.Registry

GetStatusRegistry returns the status registry of the policy.

type PolicyFactory added in v0.5.0

type PolicyFactory struct {
	// contains filtered or unexported fields
}

PolicyFactory factory for policies.

func (*PolicyFactory) GetPolicies added in v0.5.0

func (factory *PolicyFactory) GetPolicies() *policylangv1.Policies

GetPolicies returns all policies.

func (*PolicyFactory) GetPolicy added in v1.5.0

func (factory *PolicyFactory) GetPolicy(name string) *policylangv1.Policy

GetPolicy returns policy matching given name.

func (*PolicyFactory) GetPolicyWrappers added in v0.5.0

func (factory *PolicyFactory) GetPolicyWrappers() map[string]*policysyncv1.PolicyWrapper

GetPolicyWrappers returns all policy wrappers.

type PolicyService added in v0.5.0

type PolicyService struct {
	policylangv1.UnimplementedPolicyServiceServer
	// contains filtered or unexported fields
}

PolicyService is the implementation of policylangv1.PolicyService interface.

func RegisterPolicyService added in v0.5.0

func RegisterPolicyService(
	server *grpc.Server,
	policyFactory *PolicyFactory,
	etcdClient *etcdclient.Client,
	lifecycle fx.Lifecycle,
) *PolicyService

RegisterPolicyService registers a service for policy.

func (*PolicyService) DeletePolicy added in v1.5.0

func (s *PolicyService) DeletePolicy(ctx context.Context, policy *policylangv1.DeletePolicyRequest) (*emptypb.Empty, error)

DeletePolicy deletes a policy from the system.

func (*PolicyService) GetPolicies added in v0.5.0

GetPolicies returns all the policies running in the system.

func (*PolicyService) GetPolicy added in v1.5.0

GetPolicy returns the policy running in the system which matches the given name.

func (*PolicyService) PostDynamicConfig added in v1.5.0

PostDynamicConfig updates dynamic config to the system.

func (*PolicyService) UpsertPolicy added in v1.5.0

UpsertPolicy creates/updates policy to the system.

type PolicySpecValidator added in v0.3.0

type PolicySpecValidator struct{}

PolicySpecValidator Policy implementation of PolicySpecValidator interface.

func (*PolicySpecValidator) ValidateSpec added in v0.3.0

func (v *PolicySpecValidator) ValidateSpec(
	ctx context.Context,
	name string,
	yamlSrc []byte,
) (bool, string, error)

ValidateSpec checks the validity of a Policy spec

returns: * true, "", nil when Policy is valid * false, message, nil when Policy is invalid and * false, "", err on other errors.

ValidateSpec checks the syntax, validity of extractors, and validity of rego modules (by attempting to compile them).

Directories

Path Synopsis
resources
tristate
tristate is a helper package for tri-state boolean logic, which is used for logical combinator components.
tristate is a helper package for tri-state boolean logic, which is used for logical combinator components.

Jump to

Keyboard shortcuts

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