objectmeta

package
v0.23.3-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Coerce

func Coerce(pth *field.Path, obj interface{}, s *structuralschema.Structural, isResourceRoot, dropInvalidFields bool) *field.Error

Coerce checks types of embedded ObjectMeta and TypeMeta and prunes unknown fields inside the former. It does coerce ObjectMeta and TypeMeta at the root if isResourceRoot is true. If dropInvalidFields is true, fields of wrong type will be dropped.

func GetObjectMeta

func GetObjectMeta(obj map[string]interface{}, dropMalformedFields bool) (*metav1.ObjectMeta, bool, error)

GetObjectMeta does conversion of JSON to ObjectMeta. It first tries json.Unmarshal into a metav1.ObjectMeta type. If that does not work and dropMalformedFields is true, it does field-by-field best-effort conversion throwing away fields which lead to errors.

func SetObjectMeta

func SetObjectMeta(obj map[string]interface{}, objectMeta *metav1.ObjectMeta) error

SetObjectMeta writes back ObjectMeta into a JSON data structure.

func Validate

func Validate(pth *field.Path, obj interface{}, s *structuralschema.Structural, isResourceRoot bool) field.ErrorList

Validate validates embedded ObjectMeta and TypeMeta. It also validate those at the root if isResourceRoot is true.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL