Documentation ¶
Overview ¶
Package fieldpath provides utilities for working with field paths.
Field paths reference a field within a Kubernetes object via a simple string. API conventions describe the syntax as "standard JavaScript syntax for accessing that field, assuming the JSON object was transformed into a JavaScript object, without the leading dot, such as metadata.name".
Valid examples:
* metadata.name * spec.containers[0].name * data[.config.yml] * metadata.annotations['crossplane.io/external-name'] * spec.items[0][8] * apiVersion * [42]
Invalid examples:
* .metadata.name - Leading period. * metadata..name - Double period. * metadata.name. - Trailing period. * spec.containers[] - Empty brackets. * spec.containers.[0].name - Period before open bracket.
Index ¶
- type Paved
- func (p *Paved) GetBool(path string) (bool, error)
- func (p *Paved) GetNumber(path string) (float64, error)
- func (p *Paved) GetString(path string) (string, error)
- func (p *Paved) GetStringArray(path string) ([]string, error)
- func (p *Paved) GetStringObject(path string) (map[string]string, error)
- func (p *Paved) GetValue(path string) (interface{}, error)
- func (p Paved) MarshalJSON() ([]byte, error)
- func (p *Paved) SetBool(path string, value bool) error
- func (p *Paved) SetNumber(path string, value float64) error
- func (p *Paved) SetString(path, value string) error
- func (p *Paved) SetUnstructuredContent(content map[string]interface{})
- func (p *Paved) SetValue(path string, value interface{}) error
- func (p *Paved) UnmarshalJSON(data []byte) error
- func (p *Paved) UnstructuredContent() map[string]interface{}
- type Segment
- type SegmentType
- type Segments
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Paved ¶
type Paved struct {
// contains filtered or unexported fields
}
A Paved JSON object supports getting and setting values by their field path.
func (*Paved) GetStringArray ¶
GetStringArray value of the supplied field path.
func (*Paved) GetStringObject ¶
GetStringObject value of the supplied field path.
func (Paved) MarshalJSON ¶
MarshalJSON to the underlying object.
func (*Paved) SetUnstructuredContent ¶
SetUnstructuredContent sets the JSON serialisable content of this Paved.
func (*Paved) UnmarshalJSON ¶
UnmarshalJSON from the underlying object.
func (*Paved) UnstructuredContent ¶
UnstructuredContent returns the JSON serialisable content of this Paved.
type Segment ¶
type Segment struct { Type SegmentType Field string Index uint }
A Segment of a field path.
func Field ¶
Field produces a new segment from the supplied string. The segment is always considered to be an object field name.
func FieldOrIndex ¶
FieldOrIndex produces a new segment from the supplied string. The segment is considered to be an array index if the string can be interpreted as an unsigned 32 bit integer. Anything else is interpreted as an object field name.
type SegmentType ¶
type SegmentType int
A SegmentType within a field path; either a field within an object, or an index within an array.
const ( SegmentField SegmentType SegmentIndex )
Segment types.