github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/bucket/bucket.pb.validate.go (about) 1 // Code generated by protoc-gen-goten-validate 2 // File: edgelq/monitoring/proto/v4/bucket.proto 3 // DO NOT EDIT!!! 4 5 package bucket 6 7 import ( 8 "bytes" 9 "errors" 10 "fmt" 11 "net" 12 "net/url" 13 "regexp" 14 "strings" 15 "time" 16 "unicode/utf8" 17 18 gotenvalidate "github.com/cloudwan/goten-sdk/runtime/validate" 19 ) 20 21 // proto imports 22 import ( 23 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project" 24 meta "github.com/cloudwan/goten-sdk/types/meta" 25 ) 26 27 var ( 28 _ = bytes.Equal 29 _ = errors.New 30 _ = fmt.Errorf 31 _ = net.ParseIP 32 _ = regexp.Match 33 _ = strings.Split 34 _ = time.Now 35 _ = utf8.RuneCountInString 36 _ = url.Parse 37 _ = gotenvalidate.NewValidationError 38 ) 39 40 // make sure we're using proto imports 41 var ( 42 _ = &project.Project{} 43 _ = &meta.Meta{} 44 ) 45 46 func (obj *Bucket) GotenValidate() error { 47 if obj == nil { 48 return nil 49 } 50 if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok { 51 if err := subobj.GotenValidate(); err != nil { 52 return gotenvalidate.NewValidationError("Bucket", "metadata", obj.Metadata, "nested object validation failed", err) 53 } 54 } 55 for idx, elem := range obj.Metrics { 56 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 57 if err := subobj.GotenValidate(); err != nil { 58 return gotenvalidate.NewValidationError("Bucket", "metrics", obj.Metrics[idx], "nested object validation failed", err) 59 } 60 } 61 } 62 for idx, elem := range obj.Resources { 63 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 64 if err := subobj.GotenValidate(); err != nil { 65 return gotenvalidate.NewValidationError("Bucket", "resources", obj.Resources[idx], "nested object validation failed", err) 66 } 67 } 68 } 69 for idx, elem := range obj.RequiredAltKvs { 70 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 71 if err := subobj.GotenValidate(); err != nil { 72 return gotenvalidate.NewValidationError("Bucket", "requiredAltKvs", obj.RequiredAltKvs[idx], "nested object validation failed", err) 73 } 74 } 75 } 76 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 77 return cvobj.GotenCustomValidate() 78 } 79 return nil 80 } 81 func (obj *Bucket_ResolvedValues) GotenValidate() error { 82 if obj == nil { 83 return nil 84 } 85 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 86 return cvobj.GotenCustomValidate() 87 } 88 return nil 89 } 90 func (obj *Bucket_ResolvedKeysWithValues) GotenValidate() error { 91 if obj == nil { 92 return nil 93 } 94 for idx, elem := range obj.ResolvedKvs { 95 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 96 if err := subobj.GotenValidate(); err != nil { 97 return gotenvalidate.NewValidationError("ResolvedKeysWithValues", "resolvedKvs", obj.ResolvedKvs[idx], "nested object validation failed", err) 98 } 99 } 100 } 101 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 102 return cvobj.GotenCustomValidate() 103 } 104 return nil 105 } 106 func (obj *Bucket_RequiredTypedLabels) GotenValidate() error { 107 if obj == nil { 108 return nil 109 } 110 if len(obj.Types) < 1 { 111 return gotenvalidate.NewValidationError("RequiredTypedLabels", "types", obj.Types, "field must have at least 1 items", nil) 112 } 113 if len(obj.Types) > 1 { 114 values := make(map[string]struct{}) 115 for _, v := range obj.Types { 116 if _, ok := values[v]; ok { 117 return gotenvalidate.NewValidationError("RequiredTypedLabels", "types", obj.Types, "field must contain unique items", nil) 118 } 119 values[v] = struct{}{} 120 } 121 } 122 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 123 return cvobj.GotenCustomValidate() 124 } 125 return nil 126 } 127 func (obj *Bucket_RequiredTypedLabels_Strings) GotenValidate() error { 128 if obj == nil { 129 return nil 130 } 131 if len(obj.Strings) < 1 { 132 return gotenvalidate.NewValidationError("Strings", "strings", obj.Strings, "field must have at least 1 items", nil) 133 } 134 if len(obj.Strings) > 1 { 135 values := make(map[string]struct{}) 136 for _, v := range obj.Strings { 137 if _, ok := values[v]; ok { 138 return gotenvalidate.NewValidationError("Strings", "strings", obj.Strings, "field must contain unique items", nil) 139 } 140 values[v] = struct{}{} 141 } 142 } 143 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 144 return cvobj.GotenCustomValidate() 145 } 146 return nil 147 }