Documentation ¶
Index ¶
- func CompilePolicy(policyMessage *policylangv1.Policy, registry status.Registry) (*circuitfactory.Circuit, error)
- func Module() fx.Option
- func ValidateAndCompile(ctx context.Context, name string, yamlSrc []byte) (*circuitfactory.Circuit, *policiesv1.Policy, error)
- type FxIn
- type FxOut
- type Policy
- type PolicyFactory
- type PolicyService
- func (s *PolicyService) DeletePolicy(ctx context.Context, policy *policylangv1.DeletePolicyRequest) (*emptypb.Empty, error)
- func (s *PolicyService) GetPolicies(ctx context.Context, _ *emptypb.Empty) (*policylangv1.GetPoliciesResponse, error)
- func (s *PolicyService) GetPolicy(ctx context.Context, request *policylangv1.GetPolicyRequest) (*policylangv1.GetPolicyResponse, error)
- func (s *PolicyService) PostDynamicConfig(ctx context.Context, req *policylangv1.PostDynamicConfigRequest) (*emptypb.Empty, error)
- func (s *PolicyService) UpsertPolicy(ctx context.Context, req *policylangv1.UpsertPolicyRequest) (*emptypb.Empty, error)
- type PolicySpecValidator
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 ValidateAndCompile ¶
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 ¶
type FxIn struct { fx.In Unmarshaller config.Unmarshaller }
FxIn is the input for the AddAgentInfoAttribute function.
type FxOut ¶
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 ¶
GetStatusRegistry returns the status registry of the policy.
type PolicyFactory ¶
type PolicyFactory struct {
// contains filtered or unexported fields
}
PolicyFactory factory for policies.
func (*PolicyFactory) GetPolicies ¶
func (factory *PolicyFactory) GetPolicies() *policylangv1.Policies
GetPolicies returns all policies.
func (*PolicyFactory) GetPolicy ¶
func (factory *PolicyFactory) GetPolicy(name string) *policylangv1.Policy
GetPolicy returns policy matching given name.
func (*PolicyFactory) GetPolicyWrappers ¶
func (factory *PolicyFactory) GetPolicyWrappers() map[string]*policysyncv1.PolicyWrapper
GetPolicyWrappers returns all policy wrappers.
type PolicyService ¶
type PolicyService struct { policylangv1.UnimplementedPolicyServiceServer // contains filtered or unexported fields }
PolicyService is the implementation of policylangv1.PolicyService interface.
func RegisterPolicyService ¶
func RegisterPolicyService( server *grpc.Server, policyFactory *PolicyFactory, etcdClient *etcdclient.Client, lifecycle fx.Lifecycle, ) *PolicyService
RegisterPolicyService registers a service for policy.
func (*PolicyService) DeletePolicy ¶
func (s *PolicyService) DeletePolicy(ctx context.Context, policy *policylangv1.DeletePolicyRequest) (*emptypb.Empty, error)
DeletePolicy deletes a policy from the system.
func (*PolicyService) GetPolicies ¶
func (s *PolicyService) GetPolicies(ctx context.Context, _ *emptypb.Empty) (*policylangv1.GetPoliciesResponse, error)
GetPolicies returns all the policies running in the system.
func (*PolicyService) GetPolicy ¶
func (s *PolicyService) GetPolicy(ctx context.Context, request *policylangv1.GetPolicyRequest) (*policylangv1.GetPolicyResponse, error)
GetPolicy returns the policy running in the system which matches the given name.
func (*PolicyService) PostDynamicConfig ¶
func (s *PolicyService) PostDynamicConfig(ctx context.Context, req *policylangv1.PostDynamicConfigRequest) (*emptypb.Empty, error)
PostDynamicConfig updates dynamic config to the system.
func (*PolicyService) UpsertPolicy ¶
func (s *PolicyService) UpsertPolicy(ctx context.Context, req *policylangv1.UpsertPolicyRequest) (*emptypb.Empty, error)
UpsertPolicy creates/updates policy to the system.
type PolicySpecValidator ¶
type PolicySpecValidator struct{}
PolicySpecValidator Policy implementation of PolicySpecValidator interface.
func (*PolicySpecValidator) ValidateSpec ¶
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).