Documentation
¶
Overview ¶
Package warnings contains useful functions to manage warnings in the status
Index ¶
- Constants
- type WarningRecord
- type WarningRecords
- func (w WarningRecords) Add(others ...*WarningRecord) WarningRecords
- func (w WarningRecords) AddIfNotPresent(others ...*WarningRecord) WarningRecords
- func (w WarningRecords) Deserialize(raw string) WarningRecords
- func (w WarningRecords) Has(other *WarningRecord) bool
- func (w WarningRecords) MakeCondition() (condition *apis.Condition)
- func (w WarningRecords) Serialize() string
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
Click to show internal directories.
Click to hide internal directories.