apiserverk8s.io/apiserver/pkg/warning Index | Files

package warning

import "k8s.io/apiserver/pkg/warning"

Index

Functions

func AddWarning

func AddWarning(ctx context.Context, agent string, text string)

AddWarning records a warning for the specified agent and text to the Recorder added to the provided context using WithWarningRecorder(). If no Recorder exists in the provided context, this is a no-op. agent must be valid UTF-8, and must not contain spaces, quotes, backslashes, or control characters. text must be valid UTF-8, and must not contain control characters.

func WithWarningRecorder

func WithWarningRecorder(ctx context.Context, recorder Recorder) context.Context

WithWarningRecorder returns a new context that wraps the provided context and contains the provided Recorder implementation. The returned context can be passed to AddWarning().

Types

type Recorder

type Recorder interface {
	// AddWarning adds the specified warning to the response.
	// agent must be valid UTF-8, and must not contain spaces, quotes, backslashes, or control characters.
	// text must be valid UTF-8, and must not contain control characters.
	AddWarning(agent, text string)
}

Recorder provides a method for recording warnings

Source Files

context.go

Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
1 hour ago

Tools for package owners.