warnings

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package warnings contains useful functions to manage warnings in the status

Index

Constants

View Source
const (
	// MultipleWarningsReason represent contains multiple warnings
	MultipleWarningsReason = "MultipleWarnings"

	// DeprecatedClusterTaskReason indicates usage of deprecated ClusterTask
	DeprecatedClusterTaskReason = "DeprecatedClusterTask"
)
View Source
const (
	// WarningConditionType represents a warning condition
	WarningConditionType apis.ConditionType = "Warning"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type WarningRecord

type WarningRecord struct {
	// Reason is the reason for the warning
	// +optional
	Reason string `json:"reason,omitempty"`

	// Message is a human readable message indicating details about the warning.
	// +optional
	Message string `json:"message,omitempty"`

	// Annotations is an unstructured key value map stored with a detail about the warning.
	// +optional
	Annotations map[string]string `json:"annotations,omitempty"`
}

WarningRecord is a record of a warning

type WarningRecords

type WarningRecords []WarningRecord

WarningRecords is a list of warning records

func NewWarningRecords

func NewWarningRecords(warnings ...*WarningRecord) WarningRecords

NewWarningRecords creates a new warning record

func NewWarningRecordsFromJSON

func NewWarningRecordsFromJSON(raw string) WarningRecords

NewWarningRecordsFromJSON creates a new warning record from a json string

func (WarningRecords) Add

func (w WarningRecords) Add(others ...*WarningRecord) WarningRecords

Add adds a warning to the list

func (WarningRecords) AddIfNotPresent

func (w WarningRecords) AddIfNotPresent(others ...*WarningRecord) WarningRecords

AddIfNotPresent adds a warning to the list if it is not already present

func (WarningRecords) Deserialize

func (w WarningRecords) Deserialize(raw string) WarningRecords

Deserialize deserializes the warnings from the raw json string

func (WarningRecords) Has

func (w WarningRecords) Has(other *WarningRecord) bool

Has checks if the warning already exists

func (WarningRecords) MakeCondition

func (w WarningRecords) MakeCondition() (condition *apis.Condition)

MakeCondition generate condition according the warnings Example:

&apis.Condition{
	Type:     "Warning",
	Status:   "True",
	Severity: "Warning",
	Reason:   "DeprecatedClusterTask",
	Message:  "ClusterTask is deprecated\n",
}

&apis.Condition{
	Type:     "Warning",
	Status:   "True",
	Severity: "Warning",
	Reason:   "MultipleWarnings",
	Message:  "1. Warning 1\n2. Warning 2",
}

func (WarningRecords) Serialize

func (w WarningRecords) Serialize() string

Serialize serializes the warnings to a json string

Directories

Path Synopsis
Package condition provides a set of utilities for managing warning conditions and emitting warning events
Package condition provides a set of utilities for managing warning conditions and emitting warning events

Jump to

Keyboard shortcuts

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