本文整理匯總了Golang中github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors.ValidationErrorList.Prefix方法的典型用法代碼示例。如果您正苦於以下問題:Golang ValidationErrorList.Prefix方法的具體用法?Golang ValidationErrorList.Prefix怎麽用?Golang ValidationErrorList.Prefix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors.ValidationErrorList
的用法示例。
在下文中一共展示了ValidationErrorList.Prefix方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CreateObjects
// 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")
}