// CreateObjects creates bulk of resources provided by items list. Each item must // be valid API type. It requires ObjectTyper to parse the Version and Kind and // RESTMapper to get the resource URI and REST client that knows how to create // given type func CreateObjects(typer runtime.ObjectTyper, mapper meta.RESTMapper, clientFor ClientFunc, objects []runtime.Object) errs.ValidationErrorList { allErrors := errs.ValidationErrorList{} for i, obj := range objects { version, kind, err := typer.ObjectVersionAndKind(obj) if err != nil { reportError(&allErrors, i, errs.NewFieldInvalid("kind", obj)) continue } mapping, err := mapper.RESTMapping(version, kind) if err != nil { reportError(&allErrors, i, errs.NewFieldNotSupported("mapping", err)) continue } client, err := clientFor(mapping) if err != nil { reportError(&allErrors, i, errs.NewFieldNotSupported("client", obj)) continue } if err := CreateObject(client, mapping, obj); err != nil { reportError(&allErrors, i, *err) } } return allErrors.Prefix("Config") }