Documentation ¶
Index ¶
- func ComponentDTO(circuit CompiledCircuit) ([]*languagev1.ComponentView, []*languagev1.Link)
- func DOT(components []*languagev1.ComponentView, links []*languagev1.Link) string
- func Mermaid(components []*languagev1.ComponentView, links []*languagev1.Link) string
- func Module() fx.Option
- func NewComponentAndOptions(componentProto *policylangv1.Component, componentIndex int, ...) (runtime.CompiledComponent, []runtime.CompiledComponent, fx.Option, error)
- func RegisterPolicyService(server *grpc.Server, policyFactory *PolicyFactory)
- type CompiledCircuit
- type CompiledComponent
- type FxOut
- type Policy
- type PolicyFactory
- type PolicyService
- type PolicySpecValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComponentDTO ¶ added in v0.1.3
func ComponentDTO(circuit CompiledCircuit) ([]*languagev1.ComponentView, []*languagev1.Link)
ComponentDTO takes a CompiledCircuit and returns its graph representation.
func DOT ¶ added in v0.1.3
func DOT(components []*languagev1.ComponentView, links []*languagev1.Link) string
DOT returns Components and Links as a DOT graph description.
func Mermaid ¶ added in v0.5.0
func Mermaid(components []*languagev1.ComponentView, links []*languagev1.Link) string
Mermaid returns Components and Links as a mermaid graph.
func Module ¶ added in v0.1.2
Module - Controller can be initialized by passing options from Module() to fx app.
func NewComponentAndOptions ¶
func NewComponentAndOptions( componentProto *policylangv1.Component, componentIndex int, policyReadAPI iface.Policy, ) (runtime.CompiledComponent, []runtime.CompiledComponent, fx.Option, error)
NewComponentAndOptions creates component and its fx options.
func RegisterPolicyService ¶ added in v0.5.0
func RegisterPolicyService(server *grpc.Server, policyFactory *PolicyFactory)
RegisterPolicyService registers a service for policy.
Types ¶
type CompiledCircuit ¶
type CompiledCircuit []*CompiledComponent
CompiledCircuit is a list of CompiledComponent(s).
func CompilePolicy ¶
func CompilePolicy(policyMessage *policylangv1.Policy, registry status.Registry) (CompiledCircuit, error)
CompilePolicy takes policyMessage and returns a compiled policy. This is a helper method for standalone consumption of policy compiler.
func ValidateAndCompile ¶ added in v0.2.1
func ValidateAndCompile(ctx context.Context, name string, yamlSrc []byte) (CompiledCircuit, bool, string, error)
ValidateAndCompile checks the validity of a single Policy and compiles it.
type CompiledComponent ¶
type CompiledComponent struct { runtime.CompiledComponentAndPorts ComponentID string ParentComponentID string }
CompiledComponent is composed of runtime.CompiledComponent, ComponentID and ParentComponentID.
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 ¶
GetEvaluationInterval returns the ID of the policy.
func (*Policy) GetStatusRegistry ¶ added in v0.4.0
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) GetPolicyWrappers ¶ added in v0.5.0
func (factory *PolicyFactory) GetPolicyWrappers() map[string]*wrappersv1.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 (*PolicyService) GetPolicies ¶ added in v0.5.0
func (s *PolicyService) GetPolicies(ctx context.Context, _ *emptypb.Empty) (*policylangv1.GetPoliciesResponse, error)
GetPolicies returns all the policies running in 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).