MCPcopy Create free account
hub / github.com/flant/shell-operator / ParseOperations

Function ParseOperations

pkg/kube/object_patch/operation.go:66–86  ·  view source on GitHub ↗
(specBytes []byte)

Source from the content-addressed store, hash-verified

64}
65
66func ParseOperations(specBytes []byte) ([]sdkpkg.PatchCollectorOperation, error) {
67 log.Debug("parsing patcher operations", slog.String(pkg.LogKeyValue, string(specBytes)))
68
69 specs, err := unmarshalFromJSONOrYAML(specBytes)
70 if err != nil {
71 return nil, err
72 }
73
74 validationErrors := &multierror.Error{}
75 ops := make([]sdkpkg.PatchCollectorOperation, 0)
76 for _, spec := range specs {
77 err = ValidateOperationSpec(spec, GetSchema("v0"), "")
78 if err != nil {
79 validationErrors = multierror.Append(validationErrors, err)
80 break
81 }
82 ops = append(ops, NewFromOperationSpec(spec))
83 }
84
85 return ops, validationErrors.ErrorOrNil()
86}
87
88type createOperation struct {
89 object any

Callers 4

Test_ParseOperationsFunction · 0.85
Test_PatchOperationsFunction · 0.85
Test_CreateOperationsFunction · 0.85
Test_DeleteOperationsFunction · 0.85

Calls 5

unmarshalFromJSONOrYAMLFunction · 0.85
ValidateOperationSpecFunction · 0.85
NewFromOperationSpecFunction · 0.85
GetSchemaFunction · 0.70
StringMethod · 0.45

Tested by 4

Test_ParseOperationsFunction · 0.68
Test_PatchOperationsFunction · 0.68
Test_CreateOperationsFunction · 0.68
Test_DeleteOperationsFunction · 0.68