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

Function walkPathForObjects

pkg/input/dir/source.go:216–243  ·  view source on GitHub ↗
(path string, fn resource.VisitorFunc)

Source from the content-addressed store, hash-verified

214}
215
216func walkPathForObjects(path string, fn resource.VisitorFunc) error {
217 f := kubectl.NewFactory(nil)
218
219 // todo: does "cacheDir" need to be parameterizable?
220 schema, err := f.Validator(false, "")
221 if err != nil {
222 return err
223 }
224
225 mapper, typer := f.Object()
226 result := resource.NewBuilder(mapper, typer, resource.DisabledClientForMapping{}, f.Decoder(true)).
227 ContinueOnError().
228 Schema(schema).
229 FilenameParam(false, path).
230 Flatten().
231 Do()
232
233 err = result.Err()
234 if err != nil && !checkErrNoResources(err) {
235 return err
236 }
237
238 err = result.Visit(fn)
239 if err != nil {
240 return err
241 }
242 return nil
243}
244
245// withExtensions returns the inputted string with the supported file extensions appended to it
246func withExtensions(begin string) []string {

Callers 3

ObjectsMethod · 0.85
rcsMethod · 0.85
podsMethod · 0.85

Calls 1

checkErrNoResourcesFunction · 0.85

Tested by

no test coverage detected