rules

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRulesBranch added in v1.2.0

func AddRulesBranch(org, token, hostName string, tree treeprint.Tree) error

AddRulesBranch builds a tree for rules

func PushRules added in v1.0.0

func PushRules(pushDir, org, insightsToken, host string, deleteMissing, dryrun bool) error

PushRules pushes automation rules to insights

Types

type ActionItem added in v1.0.4

type ActionItem struct {
	TicketCreatedAt   *time.Time                      `json:"TicketCreatedAt,omitempty" yaml:"TicketCreatedAt,omitempty"`
	TicketLink        *string                         `json:"TicketLink,omitempty" yaml:"TicketLink,omitempty"`
	TicketProvider    *VerifyActionItemTicketProvider `json:"TicketProvider,omitempty" yaml:"TicketProvider,omitempty"`
	AssigneeEmail     *string                         `json:"assigneeEmail,omitempty" yaml:"assigneeEmail,omitempty"`
	Category          *string                         `json:"category,omitempty" yaml:"category,omitempty"`
	Cluster           *string                         `json:"cluster,omitempty" yaml:"cluster,omitempty"`
	DeletedAt         *time.Time                      `json:"deletedAt,omitempty" yaml:"deletedAt,omitempty"`
	Description       *string                         `json:"description,omitempty" yaml:"description,omitempty"`
	EventType         *string                         `json:"eventType,omitempty" yaml:"eventType,omitempty"`
	FirstSeen         *time.Time                      `json:"firstSeen,omitempty" yaml:"firstSeen,omitempty"`
	Fixed             *bool                           `json:"fixed,omitempty" yaml:"fixed,omitempty"`
	IsCustom          *bool                           `json:"isCustom,omitempty" yaml:"isCustom,omitempty"`
	LastReportedAt    *time.Time                      `json:"lastReportedAt,omitempty" yaml:"lastReportedAt,omitempty"`
	Notes             *string                         `json:"notes,omitempty" yaml:"notes,omitempty"`
	Organization      *string                         `json:"organization,omitempty" yaml:"organization,omitempty"`
	Remediation       *string                         `json:"remediation,omitempty" yaml:"remediation,omitempty"`
	ReportType        *string                         `json:"reportType,omitempty" yaml:"reportType,omitempty"`
	Resolution        *string                         `json:"resolution,omitempty" yaml:"resolution,omitempty"`
	ResourceContainer *string                         `json:"resourceContainer,omitempty" yaml:"resourceContainer,omitempty"`
	ResourceKind      *string                         `json:"resourceKind,omitempty" yaml:"resourceKind,omitempty"`
	ResourceLabels    map[string]string               `json:"resourceLabels,omitempty" yaml:"resourceLabels,omitempty"`
	ResourceName      *string                         `json:"resourceName,omitempty" yaml:"resourceName,omitempty"`
	ResourceNamespace *string                         `json:"resourceNamespace,omitempty" yaml:"resourceNamespace,omitempty"`
	Severity          *float32                        `json:"severity,omitempty" yaml:"severity,omitempty"`
	Tags              []string                        `json:"tags" yaml:"tags"`
	Title             string                          `json:"title" yaml:"title"`
}

func RunVerifyRule added in v1.0.4

func RunVerifyRule(org, token, hostName string, rule VerifyRule) (*ActionItem, error)

RunVerifyRule verifies rule against one action item

type CompareResults

type CompareResults struct {
	RuleInsert []Rule
	RuleUpdate []Rule
	RuleDelete []Rule
}

CompareResults holds the rules for inserting, updating, and deleting

type Rule

type Rule struct {
	ID          int
	Cluster     string
	Name        string
	Description string
	Context     string
	ReportType  string `json:"reportType" yaml:"reportType"`
	Repository  string
	Action      string
}

Rule is the struct to hold the information for a rule

type RuleExecutionContext added in v1.0.4

type RuleExecutionContext string

RuleExecutionContext defines model for RuleExecutionContext.

const (
	RuleExecutionContextAdmissionController RuleExecutionContext = "AdmissionController"
	RuleExecutionContextAgent               RuleExecutionContext = "Agent"
	RuleExecutionContextCICD                RuleExecutionContext = "CI/CD"
)

Defines values for RuleExecutionContext.

type VerifyActionItemTicketProvider added in v1.0.4

type VerifyActionItemTicketProvider string
const (
	VerifyActionItemTicketProviderAzure  VerifyActionItemTicketProvider = "Azure"
	VerifyActionItemTicketProviderGitHub VerifyActionItemTicketProvider = "GitHub"
	VerifyActionItemTicketProviderJira   VerifyActionItemTicketProvider = "Jira"
)

Defines values for VerifyActionItemTicketProvider.

type VerifyRule added in v1.0.4

type VerifyRule struct {
	ActionItem ActionItem           `json:"actionItem" yaml:"actionItem"`
	Context    RuleExecutionContext `json:"context" yaml:"context"`
	ReportType string               `json:"reportType" yaml:"reportType"`
	Script     string               `json:"script" yaml:"script"`
}

Jump to

Keyboard shortcuts

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