MCPcopy
hub / github.com/kubernetes/client-go / Decode

Method Decode

deprecated-dynamic/bad_debt.go:38–53  ·  view source on GitHub ↗
(data []byte, gvk *schema.GroupVersionKind, obj runtime.Object)

Source from the content-addressed store, hash-verified

36type dynamicCodec struct{}
37
38func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
39 obj, gvk, err := unstructured.UnstructuredJSONScheme.Decode(data, gvk, obj)
40 if err != nil {
41 return nil, nil, err
42 }
43
44 if _, ok := obj.(*metav1.Status); !ok && strings.ToLower(gvk.Kind) == "status" {
45 obj = &metav1.Status{}
46 err := json.Unmarshal(data, obj)
47 if err != nil {
48 return nil, nil, err
49 }
50 }
51
52 return obj, gvk, nil
53}
54
55func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error {
56 return unstructured.UnstructuredJSONScheme.Encode(obj, w)

Callers 6

CreateMethod · 0.45
UpdateMethod · 0.45
UpdateStatusMethod · 0.45
GetMethod · 0.45
ListMethod · 0.45
PatchMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected