{"modulePath":"github.com/AlaudaDevops/pkg","version":"v0.14.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package warnings\n\nPackage warnings contains useful functions to manage warnings in the status\n\n## Constants\n\n```go\nconst (\n\t// MultipleWarningsReason represent contains multiple warnings\n\tMultipleWarningsReason = \"MultipleWarnings\"\n\n\t// DeprecatedClusterTaskReason indicates usage of deprecated ClusterTask\n\tDeprecatedClusterTaskReason = \"DeprecatedClusterTask\"\n)\n```\n\n```go\nconst (\n\t// WarningConditionType represents a warning condition\n\tWarningConditionType apis.ConditionType = \"Warning\"\n)\n```\n\n## Types\n\n```go\ntype WarningRecord struct {\n\t// Reason is the reason for the warning\n\t// +optional\n\tReason string `json:\"reason,omitempty\"`\n\n\t// Message is a human readable message indicating details about the warning.\n\t// +optional\n\tMessage string `json:\"message,omitempty\"`\n\n\t// Annotations is an unstructured key value map stored with a detail about the warning.\n\t// +optional\n\tAnnotations map[string]string `json:\"annotations,omitempty\"`\n}\n```\nWarningRecord is a record of a warning\n\n```go\ntype WarningRecords []WarningRecord\n```\nWarningRecords is a list of warning records\n\n```go\nfunc NewWarningRecords(warnings ...*WarningRecord) WarningRecords\n```\nNewWarningRecords creates a new warning record\n\n```go\nfunc NewWarningRecordsFromJSON(raw string) WarningRecords\n```\nNewWarningRecordsFromJSON creates a new warning record from a json string\n\n```go\nfunc (w WarningRecords) Add(others ...*WarningRecord) WarningRecords\n```\nAdd adds a warning to the list\n\n```go\nfunc (w WarningRecords) AddIfNotPresent(others ...*WarningRecord) WarningRecords\n```\nAddIfNotPresent adds a warning to the list if it is not already present\n\n```go\nfunc (w WarningRecords) Deserialize(raw string) WarningRecords\n```\nDeserialize deserializes the warnings from the raw json string\n\n```go\nfunc (w WarningRecords) Has(other *WarningRecord) bool\n```\nHas checks if the warning already exists\n\n```go\nfunc (w WarningRecords) MakeCondition() (condition *apis.Condition)\n```\nMakeCondition generate condition according the warnings Example:\n\n\t\u0026apis.Condition{\n\t\tType:     \"Warning\",\n\t\tStatus:   \"True\",\n\t\tSeverity: \"Warning\",\n\t\tReason:   \"DeprecatedClusterTask\",\n\t\tMessage:  \"ClusterTask is deprecated\\n\",\n\t}\n\n\t\u0026apis.Condition{\n\t\tType:     \"Warning\",\n\t\tStatus:   \"True\",\n\t\tSeverity: \"Warning\",\n\t\tReason:   \"MultipleWarnings\",\n\t\tMessage:  \"1. Warning 1\\n2. Warning 2\",\n\t}\n\n```go\nfunc (w WarningRecords) Serialize() string\n```\nSerialize serializes the warnings to a json string\n\n","path":"github.com/AlaudaDevops/pkg/warnings","name":"warnings","synopsis":"Package warnings contains useful functions to manage warnings in the status","isRedistributable":true}
