| 64 | } |
| 65 | |
| 66 | func 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 | |
| 88 | type createOperation struct { |
| 89 | object any |