mirror of
https://github.com/agent-substrate/substrate.git
synced 2026-11-11 10:23:17 +08:00
Adds a temporary converter that allows each Actor workflow to use the substrate resource rather than CRD, to prevent regression while we are in the parallel state. * Allows each workflow to use the ActorTemplate substrate proto under the hood, in preparation for the full cut over, e2e tests start testing the new code path. * Changes any functions that consumes the ActorTemplate CRD to use the substrate proto instead. * The converter will be deleted once we fully cutover to the substrate resource.
1853 lines
61 KiB
Go
1853 lines
61 KiB
Go
//go:build !ignore_autogenerated
|
|
// +build !ignore_autogenerated
|
|
|
|
// Copyright 2026 Google LLC
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// Code generated by validation-gen. DO NOT EDIT.
|
|
|
|
package controlapi
|
|
|
|
import (
|
|
context "context"
|
|
|
|
ateapipb "github.com/agent-substrate/substrate/pkg/proto/ateapipb"
|
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
|
operation "k8s.io/apimachinery/pkg/api/operation"
|
|
safe "k8s.io/apimachinery/pkg/api/safe"
|
|
validate "k8s.io/apimachinery/pkg/api/validate"
|
|
field "k8s.io/apimachinery/pkg/util/validation/field"
|
|
)
|
|
|
|
// Validate_Actor validates an instance of Actor according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_Actor(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Actor) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.Actor.Metadata
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ResourceMetadata,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
func() { // cohort = "atespace"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.Immutable).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ResourceMetadata(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Actor) *ateapipb.ResourceMetadata {
|
|
return oldObj.Metadata
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("metadata"), obj.Metadata, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.Actor.ActorTemplateNamespace
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Actor) *string {
|
|
return &oldObj.ActorTemplateNamespace
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("actor_template_namespace"), &obj.ActorTemplateNamespace, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.Actor.ActorTemplateName
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Actor) *string {
|
|
return &oldObj.ActorTemplateName
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("actor_template_name"), &obj.ActorTemplateName, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.Actor.ActorTemplate
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ObjectRef,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
func() { // cohort = "atespace"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Actor) *ateapipb.ObjectRef {
|
|
return oldObj.ActorTemplate
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("actor_template"), obj.ActorTemplate, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.Actor.WorkerSelector
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Selector,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_Selector(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Actor) *ateapipb.Selector {
|
|
return oldObj.WorkerSelector
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker_selector"), obj.WorkerSelector, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.Actor.SourceSnapshotTag
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ObjectRef,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
func() { // cohort = "atespace"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.RequiredValue).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Actor) *ateapipb.ObjectRef {
|
|
return oldObj.SourceSnapshotTag
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("source_snapshot_tag"), obj.SourceSnapshotTag, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.Actor.Status
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorStatus,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ActorStatus(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Actor) *ateapipb.ActorStatus {
|
|
return oldObj.Status
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("status"), obj.Status, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_ActorMetadataDataSource validates an instance of ActorMetadataDataSource according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_ActorMetadataDataSource(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorMetadataDataSource) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.ActorMetadataDataSource.Items
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj []*ateapipb.ActorMetadataItem,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.PtrSliceNoNils[ateapipb.ActorMetadataItem](ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.RequiredSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.MinItems(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
// lists with map semantics require unique keys
|
|
if e := validate.PtrSliceUnique(ctx, op, fldPath, obj, oldObj,
|
|
func(a *ateapipb.ActorMetadataItem, b *ateapipb.ActorMetadataItem) bool { return a.Field == b.Field }); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
// iterate the list and call the type's validation function
|
|
if e := validate.EachPtrSliceVal(ctx, op, fldPath, obj, oldObj,
|
|
func(a *ateapipb.ActorMetadataItem, b *ateapipb.ActorMetadataItem) bool { return a.Field == b.Field }, deepEqualImpl_, Validate_ActorMetadataItem); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ActorMetadataDataSource) []*ateapipb.ActorMetadataItem {
|
|
return oldObj.Items
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("items"), obj.Items, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_ActorMetadataItem validates an instance of ActorMetadataItem according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_ActorMetadataItem(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorMetadataItem) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.ActorMetadataItem.Field
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorMetadataField,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ActorMetadataItem) *ateapipb.ActorMetadataField {
|
|
return &oldObj.Field
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("field"), &obj.Field, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ActorMetadataItem.Path
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 255); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
if e := validate.MinLength(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ActorMetadataItem) *string {
|
|
return &oldObj.Path
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("path"), &obj.Path, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_ActorStatus validates an instance of ActorStatus according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_ActorStatus(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorStatus) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.ActorStatus.State
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorState,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 8); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ActorStatus) *ateapipb.ActorState {
|
|
return &oldObj.State
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("state"), &obj.State, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ActorStatus.WorkerAssignment
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.WorkerAssignment,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoModify).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_WorkerAssignment(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ActorStatus) *ateapipb.WorkerAssignment {
|
|
return oldObj.WorkerAssignment
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker_assignment"), obj.WorkerAssignment, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
// field ateapipb.ActorStatus.InProgressSnapshotName has no validation
|
|
// field ateapipb.ActorStatus.LatestSnapshot has no validation
|
|
// field ateapipb.ActorStatus.LocalSnapshotInfo has no validation
|
|
// field ateapipb.ActorStatus.InProgressSnapshotSourceActorVersion has no validation
|
|
// field ateapipb.ActorStatus.ActorVolumes has no validation
|
|
// field ateapipb.ActorStatus.InProgressLocalSnapshotName has no validation
|
|
// field ateapipb.ActorStatus.SourceSnapshot has no validation
|
|
return errs
|
|
}
|
|
|
|
// Validate_ActorTemplate validates an instance of ActorTemplate according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_ActorTemplate(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorTemplate) (errs field.ErrorList) {
|
|
|
|
// field ateapipb.ActorTemplate.Metadata has no validation
|
|
// field ateapipb.ActorTemplate.WorkerSelector has no validation
|
|
// field ateapipb.ActorTemplate.Containers has no validation
|
|
|
|
{ // field ateapipb.ActorTemplate.Volumes
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj []*ateapipb.Volume,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.PtrSliceNoNils[ateapipb.Volume](ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// iterate the list and call the type's validation function
|
|
if e := validate.EachPtrSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_Volume); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ActorTemplate) []*ateapipb.Volume {
|
|
return oldObj.Volumes
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("volumes"), obj.Volumes, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
// field ateapipb.ActorTemplate.SnapshotsConfig has no validation
|
|
// field ateapipb.ActorTemplate.SandboxConfig has no validation
|
|
// field ateapipb.ActorTemplate.Resources has no validation
|
|
// field ateapipb.ActorTemplate.Status has no validation
|
|
return errs
|
|
}
|
|
|
|
// Validate_Atespace validates an instance of Atespace according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_Atespace(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Atespace) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.Atespace.Metadata
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ResourceMetadata,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
func() { // cohort = "atespace"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.Immutable).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ResourceMetadata) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ResourceMetadata(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Atespace) *ateapipb.ResourceMetadata {
|
|
return oldObj.Metadata
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("metadata"), obj.Metadata, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_CreateActorRequest validates an instance of CreateActorRequest according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_CreateActorRequest(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.CreateActorRequest) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.CreateActorRequest.Actor
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Actor,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_Actor(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.CreateActorRequest) *ateapipb.Actor {
|
|
return oldObj.Actor
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("actor"), obj.Actor, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_CreateActorTemplateRequest validates an instance of CreateActorTemplateRequest according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_CreateActorTemplateRequest(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.CreateActorTemplateRequest) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.CreateActorTemplateRequest.ActorTemplate
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorTemplate,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ActorTemplate(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.CreateActorTemplateRequest) *ateapipb.ActorTemplate {
|
|
return oldObj.ActorTemplate
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("actor_template"), obj.ActorTemplate, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_CreateAtespaceRequest validates an instance of CreateAtespaceRequest according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_CreateAtespaceRequest(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.CreateAtespaceRequest) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.CreateAtespaceRequest.Atespace
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Atespace,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_Atespace(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.CreateAtespaceRequest) *ateapipb.Atespace {
|
|
return oldObj.Atespace
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("atespace"), obj.Atespace, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_DeleteAtespaceRequest validates an instance of DeleteAtespaceRequest according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_DeleteAtespaceRequest(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.DeleteAtespaceRequest) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.DeleteAtespaceRequest.Atespace
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ObjectRef,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
func() { // cohort = "atespace"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.DeleteAtespaceRequest) *ateapipb.ObjectRef {
|
|
return oldObj.Atespace
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("atespace"), obj.Atespace, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_GetAtespaceRequest validates an instance of GetAtespaceRequest according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_GetAtespaceRequest(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.GetAtespaceRequest) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.GetAtespaceRequest.Atespace
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ObjectRef,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
func() { // cohort = "atespace"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.GetAtespaceRequest) *ateapipb.ObjectRef {
|
|
return oldObj.Atespace
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("atespace"), obj.Atespace, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_ListAtespacesRequest validates an instance of ListAtespacesRequest according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_ListAtespacesRequest(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ListAtespacesRequest) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.ListAtespacesRequest.PageSize
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *int32,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ListAtespacesRequest) *int32 {
|
|
return &oldObj.PageSize
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("page_size"), &obj.PageSize, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ListAtespacesRequest.PageToken
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 256); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ListAtespacesRequest) *string {
|
|
return &oldObj.PageToken
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("page_token"), &obj.PageToken, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_ObjectRef validates an instance of ObjectRef according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_ObjectRef(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ObjectRef) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.ObjectRef.Atespace
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ObjectRef) *string {
|
|
return &oldObj.Atespace
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("atespace"), &obj.Atespace, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ObjectRef.Name
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ObjectRef) *string {
|
|
return &oldObj.Name
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_ResourceMetadata validates an instance of ResourceMetadata according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_ResourceMetadata(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ResourceMetadata) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.ResourceMetadata.Atespace
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ResourceMetadata) *string {
|
|
return &oldObj.Atespace
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("atespace"), &obj.Atespace, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ResourceMetadata.Name
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ResourceMetadata) *string {
|
|
return &oldObj.Name
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ResourceMetadata.Uid
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.UUID(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ResourceMetadata) *string {
|
|
return &oldObj.Uid
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("uid"), &obj.Uid, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ResourceMetadata.Version
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *int64,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.UpdateValue(ctx, op, fldPath, obj, oldObj,
|
|
func(a int64, b int64) bool { return a == b }, validate.NoUnset).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.Monotonic(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ResourceMetadata) *int64 {
|
|
return &oldObj.Version
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("version"), &obj.Version, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ResourceMetadata.CreateTime
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *timestamppb.Timestamp,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ResourceMetadata) *timestamppb.Timestamp {
|
|
return oldObj.CreateTime
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("create_time"), obj.CreateTime, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.ResourceMetadata.UpdateTime
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *timestamppb.Timestamp,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoUnset).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.ResourceMetadata) *timestamppb.Timestamp {
|
|
return oldObj.UpdateTime
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("update_time"), obj.UpdateTime, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
var unionMembershipFor_github_com_agent_substrate_substrate_pkg_proto_ateapipb_Selector_ = validate.NewUnionMembership(validate.NewUnionMember("match_labels"))
|
|
|
|
// Validate_Selector validates an instance of Selector according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_Selector(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Selector) (errs field.ErrorList) {
|
|
|
|
if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_github_com_agent_substrate_substrate_pkg_proto_ateapipb_Selector_,
|
|
func(obj *ateapipb.Selector) bool {
|
|
if obj == nil {
|
|
return false
|
|
}
|
|
return len(obj.MatchLabels) != 0
|
|
}); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
|
|
{ // field ateapipb.Selector.MatchLabels
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj map[string]string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.MaxProperties(ctx, op, fldPath, obj, oldObj, 10).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalMap(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.EachMapKey(ctx, op, fldPath, obj, oldObj, validate.LabelKey); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
if e := validate.MinProperties(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
if e := validate.EachMapVal(ctx, op, fldPath, obj, oldObj, validate.DirectEqual, validate.LabelValue); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Selector) map[string]string {
|
|
return oldObj.MatchLabels
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("match_labels"), obj.MatchLabels, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
var unionMembershipFor_github_com_agent_substrate_substrate_pkg_proto_ateapipb_SystemInfoDataSource_ = validate.NewUnionMembership(validate.NewUnionMember("actor_metadata"), validate.NewUnionMember("trust_bundle"))
|
|
|
|
// Validate_SystemInfoDataSource validates an instance of SystemInfoDataSource according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_SystemInfoDataSource(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.SystemInfoDataSource) (errs field.ErrorList) {
|
|
|
|
if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_github_com_agent_substrate_substrate_pkg_proto_ateapipb_SystemInfoDataSource_,
|
|
func(obj *ateapipb.SystemInfoDataSource) bool {
|
|
if obj == nil {
|
|
return false
|
|
}
|
|
return obj.ActorMetadata != nil
|
|
},
|
|
func(obj *ateapipb.SystemInfoDataSource) bool {
|
|
if obj == nil {
|
|
return false
|
|
}
|
|
return obj.TrustBundle != nil
|
|
}); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
|
|
{ // field ateapipb.SystemInfoDataSource.ActorMetadata
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ActorMetadataDataSource,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ActorMetadataDataSource(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.SystemInfoDataSource) *ateapipb.ActorMetadataDataSource {
|
|
return oldObj.ActorMetadata
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("actor_metadata"), obj.ActorMetadata, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.SystemInfoDataSource.TrustBundle
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.TrustBundleDataSource,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_TrustBundleDataSource(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.SystemInfoDataSource) *ateapipb.TrustBundleDataSource {
|
|
return oldObj.TrustBundle
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("trust_bundle"), obj.TrustBundle, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_SystemInfoVolumeSource validates an instance of SystemInfoVolumeSource according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_SystemInfoVolumeSource(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.SystemInfoVolumeSource) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.SystemInfoVolumeSource.DataSources
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj []*ateapipb.SystemInfoDataSource,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.PtrSliceNoNils[ateapipb.SystemInfoDataSource](ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// iterate the list and call the type's validation function
|
|
if e := validate.EachPtrSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_SystemInfoDataSource); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.SystemInfoVolumeSource) []*ateapipb.SystemInfoDataSource {
|
|
return oldObj.DataSources
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("data_sources"), obj.DataSources, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_TrustBundleDataSource validates an instance of TrustBundleDataSource according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_TrustBundleDataSource(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.TrustBundleDataSource) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.TrustBundleDataSource.Name
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 253); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
if e := validate.MinLength(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.TrustBundleDataSource) *string {
|
|
return &oldObj.Name
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.TrustBundleDataSource.Path
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.MaxLength(ctx, op, fldPath, obj, oldObj, 255); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
if e := validate.MinLength(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.TrustBundleDataSource) *string {
|
|
return &oldObj.Path
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("path"), &obj.Path, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_UpdateActorRequest validates an instance of UpdateActorRequest according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_UpdateActorRequest(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.UpdateActorRequest) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.UpdateActorRequest.Actor
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Actor,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// custom validation
|
|
if e := ValidateCustom_UpdateActorRequest_Actor(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
func() { // cohort = "metadata"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "metadata",
|
|
func(o *ateapipb.Actor) *ateapipb.ResourceMetadata { return o.Metadata }, deepEqualImpl_, validate.RequiredPointer).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.UpdateActorRequest) *ateapipb.Actor {
|
|
return oldObj.Actor
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("actor"), obj.Actor, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// Validate_Volume validates an instance of Volume according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_Volume(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.Volume) (errs field.ErrorList) {
|
|
|
|
// field ateapipb.Volume.Name has no validation
|
|
// field ateapipb.Volume.DurableDir has no validation
|
|
// field ateapipb.Volume.ExternalVolumeTemplate has no validation
|
|
|
|
{ // field ateapipb.Volume.SystemInfo
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.SystemInfoVolumeSource,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_SystemInfoVolumeSource(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.Volume) *ateapipb.SystemInfoVolumeSource {
|
|
return oldObj.SystemInfo
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("system_info"), obj.SystemInfo, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
// field ateapipb.Volume.Image has no validation
|
|
// field ateapipb.Volume.Type has no validation
|
|
return errs
|
|
}
|
|
|
|
// Validate_WorkerAssignment validates an instance of WorkerAssignment according
|
|
// to declarative validation rules in the API schema.
|
|
func Validate_WorkerAssignment(
|
|
ctx context.Context, op operation.Operation, fldPath *field.Path,
|
|
obj, oldObj *ateapipb.WorkerAssignment) (errs field.ErrorList) {
|
|
|
|
{ // field ateapipb.WorkerAssignment.Worker
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *ateapipb.ObjectRef,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if ateDeepEqual(obj, oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
func() { // cohort = "atespace"
|
|
earlyReturn := false
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.ForbiddenValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "atespace",
|
|
func(o *ateapipb.ObjectRef) *string { return &o.Atespace }, validate.DirectEqual, validate.OptionalValue).MarkBeta().MarkShortCircuit(); len(e) != 0 {
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
}()
|
|
// call the type's validation function
|
|
errs = append(errs, Validate_ObjectRef(ctx, op, fldPath, obj, oldObj)...)
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.WorkerAssignment) *ateapipb.ObjectRef {
|
|
return oldObj.Worker
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker"), obj.Worker, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.WorkerAssignment.WorkerNamespace
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.WorkerAssignment) *string {
|
|
return &oldObj.WorkerNamespace
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker_namespace"), &obj.WorkerNamespace, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.WorkerAssignment.WorkerPool
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.WorkerAssignment) *string {
|
|
return &oldObj.WorkerPool
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker_pool"), &obj.WorkerPool, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.WorkerAssignment.WorkerPod
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.WorkerAssignment) *string {
|
|
return &oldObj.WorkerPod
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker_pod"), &obj.WorkerPod, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.WorkerAssignment.WorkerPodUid
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
if e := validate.UUID(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.WorkerAssignment) *string {
|
|
return &oldObj.WorkerPodUid
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker_pod_uid"), &obj.WorkerPodUid, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
{ // field ateapipb.WorkerAssignment.WorkerPodIp
|
|
fn := func(
|
|
fldPath *field.Path,
|
|
obj, oldObj *string,
|
|
oldValueCorrelated bool) (errs field.ErrorList) {
|
|
// don't revalidate unchanged data
|
|
if oldValueCorrelated && op.Type == operation.Update {
|
|
if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
|
|
return nil
|
|
}
|
|
}
|
|
// call field-attached validations
|
|
earlyReturn := false
|
|
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
earlyReturn = true
|
|
}
|
|
if earlyReturn {
|
|
return // do not proceed
|
|
}
|
|
// custom validation
|
|
if e := ValidateCustom_WorkerAssignment_WorkerPodIp(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
|
errs = append(errs, e...)
|
|
}
|
|
return
|
|
}
|
|
oldVal := safe.Field(oldObj,
|
|
func(oldObj *ateapipb.WorkerAssignment) *string {
|
|
return &oldObj.WorkerPodIp
|
|
})
|
|
errs = append(errs, fn(fldPath.Child("worker_pod_ip"), &obj.WorkerPodIp, oldVal, oldObj != nil)...)
|
|
}
|
|
|
|
return errs
|
|
}
|
|
|
|
// deepEqualImpl_ is a validate.MatchFunc which allows the implementation of deep-equality to be defined at codegen time.
|
|
func deepEqualImpl_[T any](a, b T) bool {
|
|
return ateDeepEqual(a, b)
|
|
}
|