response

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineResponse

type EngineResponse struct {
	// Resource patched with the engine action changes
	PatchedResource unstructured.Unstructured
	// Policy Response
	PolicyResponse PolicyResponse
}

EngineResponse engine response to the action

func (EngineResponse) GetFailedRules

func (er EngineResponse) GetFailedRules() []string

GetFailedRules returns failed rules

func (EngineResponse) GetPatches

func (er EngineResponse) GetPatches() [][]byte

GetPatches returns all the patches joined

func (EngineResponse) GetResourceSpec added in v1.3.0

func (er EngineResponse) GetResourceSpec() ResourceSpec

GetResourceSpec returns resourceSpec of er

func (EngineResponse) GetSuccessRules

func (er EngineResponse) GetSuccessRules() []string

GetSuccessRules returns success rules

func (EngineResponse) IsFailed added in v1.4.2

func (er EngineResponse) IsFailed() bool

IsFailed checks if any rule has succeeded or not

func (EngineResponse) IsSuccessful added in v1.2.0

func (er EngineResponse) IsSuccessful() bool

IsSuccessful checks if any rule has failed or not

type PolicyResponse

type PolicyResponse struct {
	// policy details
	Policy PolicySpec `json:"policy"`
	// resource details
	Resource ResourceSpec `json:"resource"`
	// policy statistics
	PolicyStats `json:",inline"`
	// rule response
	Rules []RuleResponse `json:"rules"`
	// ValidationFailureAction: audit (default) or enforce
	ValidationFailureAction string
}

PolicyResponse policy application response

type PolicySpec added in v1.4.2

type PolicySpec struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

PolicySpec policy

type PolicyStats

type PolicyStats struct {
	// time required to process the policy rules on a resource
	ProcessingTime time.Duration `json:"processingTime"`
	// Count of rules that were applied successfully
	RulesAppliedCount int `json:"rulesAppliedCount"`
	// Timestamp of the instant the Policy was triggered
	PolicyExecutionTimestamp int64 `json:"policyExecutionTimestamp"`
}

PolicyStats stores statistics for the single policy application

type ResourceSpec

type ResourceSpec struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Namespace  string `json:"namespace"`
	Name       string `json:"name"`

	// UID is not used to build the unique identifier
	// optional
	UID string `json:"uid"`
}

ResourceSpec resource action applied on

func (ResourceSpec) GetKey

func (rs ResourceSpec) GetKey() string

GetKey returns the key

type RuleResponse

type RuleResponse struct {
	// rule name specified in policy
	Name string `json:"name"`
	// rule type (Mutation,Generation,Validation) for Kyverno Policy
	Type string `json:"type"`
	// message response from the rule application
	Message string `json:"message"`
	// JSON patches, for mutation rules
	Patches [][]byte `json:"patches,omitempty"`
	// success/fail
	Success bool `json:"success"`
	// statistics
	RuleStats `json:",inline"`
}

RuleResponse details for each rule application

func (RuleResponse) ToString

func (rr RuleResponse) ToString() string

ToString ...

type RuleStats

type RuleStats struct {
	// time required to apply the rule on the resource
	ProcessingTime time.Duration `json:"processingTime"`
	// Timestamp of the instant the rule got triggered
	RuleExecutionTimestamp int64 `json:"ruleExecutionTimestamp"`
}

RuleStats stores the statistics for the single rule application

Jump to

Keyboard shortcuts

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