kubernetes: k8s.io/kubernetes/pkg/fieldpath Index | Files

package fieldpath

import "k8s.io/kubernetes/pkg/fieldpath"

Package fieldpath supplies methods for extracting fields from objects given a path to a field.


Package Files

doc.go fieldpath.go

func ExtractFieldPathAsString Uses

func ExtractFieldPathAsString(obj interface{}, fieldPath string) (string, error)

ExtractFieldPathAsString extracts the field from the given object and returns it as a string. The object must be a pointer to an API type.

func FormatMap Uses

func FormatMap(m map[string]string) (fmtStr string)

FormatMap formats map[string]string to a string.

func SplitMaybeSubscriptedPath Uses

func SplitMaybeSubscriptedPath(fieldPath string) (string, string, bool)

SplitMaybeSubscriptedPath checks whether the specified fieldPath is subscripted, and

- if yes, this function splits the fieldPath into path and subscript, and
  returns (path, subscript, true).
- if no, this function returns (fieldPath, "", false).

Example inputs and outputs:

- "metadata.annotations['myKey']" --> ("metadata.annotations", "myKey", true)
- "metadata.annotations['a[b]c']" --> ("metadata.annotations", "a[b]c", true)
- "metadata.labels['']"           --> ("metadata.labels", "", true)
- "metadata.labels"               --> ("metadata.labels", "", false)

Package fieldpath imports 5 packages (graph) and is imported by 419 packages. Updated 2019-07-31. Refresh now. Tools for package owners.