MCPcopy
hub / github.com/redspread/spread / KubeObjectFromDocument

Function KubeObjectFromDocument

pkg/deploy/object.go:49–65  ·  view source on GitHub ↗
(path string, doc *pb.Document)

Source from the content-addressed store, hash-verified

47}
48
49func KubeObjectFromDocument(path string, doc *pb.Document) (KubeObject, error) {
50 kind, err := kindFromPath(path)
51 if err != nil {
52 return nil, err
53 }
54
55 base := BaseObject(kind)
56 if base == nil {
57 return nil, fmt.Errorf("unable to find Kind for '%s'", kind)
58 }
59
60 err = data.Unmarshal(doc, &base)
61 if err != nil {
62 return nil, err
63 }
64 return base, nil
65}
66
67func kindFromPath(path string) (string, error) {
68 parts := strings.Split(path, "/")

Callers 1

DeploymentFromDocMapFunction · 0.85

Calls 2

kindFromPathFunction · 0.85
BaseObjectFunction · 0.85

Tested by

no test coverage detected