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