model

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SelectPolicyAll

func SelectPolicyAll(meta *PolicyMetadata) bool

Types

type Alert

type Alert struct {
	ID        AlertID   `json:"id"`
	Title     string    `json:"title"`
	Timestamp time.Time `json:"timestamp"`
	Attrs     Attrs     `json:"attrs"`
}

type AlertID

type AlertID string

type Attrs

type Attrs map[string]any

type JobID

type JobID string

func NewJobID

func NewJobID() JobID

type PolicyMetadata

type PolicyMetadata struct {
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Tags        []string  `json:"tags"`
	Input       []QueryID `json:"input"`
	Package     string    `json:"package"`
	Location    string    `json:"location"`
}

func NewPolicyMetadataFromAnnotation

func NewPolicyMetadataFromAnnotation(ref *ast.AnnotationsRef) (*PolicyMetadata, error)

func (*PolicyMetadata) HasTag

func (x *PolicyMetadata) HasTag(tag string) bool

type PolicyMetadataSet

type PolicyMetadataSet []*PolicyMetadata

func NewPolicyMetadataSetFromAnnotation

func NewPolicyMetadataSetFromAnnotation(refs ast.FlatAnnotationsRefSet) (PolicyMetadataSet, error)

func (PolicyMetadataSet) Filter

func (PolicyMetadataSet) RequiredQueries

func (x PolicyMetadataSet) RequiredQueries(base Queries) Queries

type PolicySelector

type PolicySelector func(meta *PolicyMetadata) bool

func SelectPolicyByTag

func SelectPolicyByTag(tags ...string) PolicySelector

type Queries

type Queries []*Query

func (Queries) FindByID

func (x Queries) FindByID(id QueryID) *Query

func (Queries) Validate

func (x Queries) Validate() error

type Query

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

func MustNewQuery

func MustNewQuery(data []byte) *Query

func NewQuery

func NewQuery(data []byte) (*Query, error)

func (*Query) ID

func (x *Query) ID() QueryID

func (*Query) String

func (x *Query) String() string

func (*Query) Validate

func (x *Query) Validate() error

type QueryID

type QueryID string

type QueryInput

type QueryInput map[QueryID]any

type QueryOutput

type QueryOutput struct {
	Alert []Alert `json:"alert"`
}

Jump to

Keyboard shortcuts

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