本文整理匯總了Golang中k8s/io/kubernetes/pkg/api/validation.ValidateEvent函數的典型用法代碼示例。如果您正苦於以下問題:Golang ValidateEvent函數的具體用法?Golang ValidateEvent怎麽用?Golang ValidateEvent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ValidateEvent函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Create
func (rs *REST) Create(ctx api.Context, obj runtime.Object) (runtime.Object, error) {
event, ok := obj.(*api.Event)
if !ok {
return nil, errors.NewInternalError(fmt.Errorf("received object is not of type event: %#v", obj))
}
if api.NamespaceValue(ctx) != "" {
if !api.ValidNamespace(ctx, &event.ObjectMeta) {
return nil, errors.NewConflict("event", event.Namespace, fmt.Errorf("event.namespace does not match the provided context"))
}
}
if errs := validation.ValidateEvent(event); len(errs) > 0 {
return nil, errors.NewInvalid("event", event.Name, errs)
}
api.FillObjectMetaSystemFields(ctx, &event.ObjectMeta)
err := rs.registry.CreateWithName(ctx, event.Name, event)
if err != nil {
return nil, err
}
return rs.registry.Get(ctx, event.Name)
}
示例2: ValidateUpdate
func (eventStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
event := obj.(*api.Event)
return validation.ValidateEvent(event)
}
示例3: Validate
func (eventStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
event := obj.(*api.Event)
return validation.ValidateEvent(event)
}
示例4: Validate
func (eventStrategy) Validate(ctx api.Context, obj runtime.Object) utilvalidation.ErrorList {
event := obj.(*api.Event)
return validation.ValidateEvent(event)
}