Documentation ¶
Overview ¶
Package json implements a simple encoder and decoder for streams of watch events over io.Writer/Readers
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder implements the watch.Decoder interface for io.ReadClosers that have contents which consist of a series of watchEvent objects encoded via JSON. It will decode any object registered in the supplied codec.
func NewDecoder ¶
func NewDecoder(r io.ReadCloser, codec runtime.Codec) *Decoder
NewDecoder creates an Decoder for the given writer and codec.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder implements the json.Encoder interface for io.Writers that should serialize WatchEvent objects into JSON. It will encode any object registered in the supplied codec and return an error otherwies.
func NewEncoder ¶
NewEncoder creates an Encoder for the given writer and codec
type WatchEvent ¶ added in v0.11.0
type WatchEvent struct { // The type of the watch event; added, modified, deleted, or error. Type watch.EventType `json:"type,omitempty" description:"the type of watch event; may be ADDED, MODIFIED, DELETED, or ERROR"` // For added or modified objects, this is the new object; for deleted objects, // it's the state of the object immediately prior to its deletion. // For errors, it's an api.Status. Object runtime.RawExtension `` /* 151-byte string literal not displayed */ }
WatchEvent objects are streamed from the api server in response to a watch request. These are not API objects and may not be changed in a backward-incompatible way. TODO: move to a public, versioned object now that RawExtension conversions are possible in the schema.