github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/alerting_policy/alerting_policy.pb.validate.go (about) 1 // Code generated by protoc-gen-goten-validate 2 // File: edgelq/monitoring/proto/v4/alerting_policy.proto 3 // DO NOT EDIT!!! 4 5 package alerting_policy 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 notification_channel "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/notification_channel" 24 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project" 25 meta "github.com/cloudwan/goten-sdk/types/meta" 26 ) 27 28 var ( 29 _ = bytes.Equal 30 _ = errors.New 31 _ = fmt.Errorf 32 _ = net.ParseIP 33 _ = regexp.Match 34 _ = strings.Split 35 _ = time.Now 36 _ = utf8.RuneCountInString 37 _ = url.Parse 38 _ = gotenvalidate.NewValidationError 39 ) 40 41 // make sure we're using proto imports 42 var ( 43 _ = ¬ification_channel.NotificationChannel{} 44 _ = &project.Project{} 45 _ = &meta.Meta{} 46 ) 47 48 func (obj *AlertingPolicy) GotenValidate() error { 49 if obj == nil { 50 return nil 51 } 52 if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok { 53 if err := subobj.GotenValidate(); err != nil { 54 return gotenvalidate.NewValidationError("AlertingPolicy", "metadata", obj.Metadata, "nested object validation failed", err) 55 } 56 } 57 { 58 rlen := utf8.RuneCountInString(obj.Description) 59 if rlen > 256 { 60 return gotenvalidate.NewValidationError("AlertingPolicy", "description", obj.Description, "field must contain at most 256 characters", nil) 61 } 62 } 63 if subobj, ok := interface{}(obj.Documentation).(gotenvalidate.Validator); ok { 64 if err := subobj.GotenValidate(); err != nil { 65 return gotenvalidate.NewValidationError("AlertingPolicy", "documentation", obj.Documentation, "nested object validation failed", err) 66 } 67 } 68 if subobj, ok := interface{}(obj.Spec).(gotenvalidate.Validator); ok { 69 if err := subobj.GotenValidate(); err != nil { 70 return gotenvalidate.NewValidationError("AlertingPolicy", "spec", obj.Spec, "nested object validation failed", err) 71 } 72 } 73 if subobj, ok := interface{}(obj.State).(gotenvalidate.Validator); ok { 74 if err := subobj.GotenValidate(); err != nil { 75 return gotenvalidate.NewValidationError("AlertingPolicy", "state", obj.State, "nested object validation failed", err) 76 } 77 } 78 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 79 return cvobj.GotenCustomValidate() 80 } 81 return nil 82 } 83 func (obj *AlertingPolicy_Documentation) GotenValidate() error { 84 if obj == nil { 85 return nil 86 } 87 if obj.MimeType != "text/markdown" { 88 return gotenvalidate.NewValidationError("Documentation", "mimeType", obj.MimeType, "field must be equal to exactly one of the following values: text/markdown", nil) 89 } 90 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 91 return cvobj.GotenCustomValidate() 92 } 93 return nil 94 } 95 func (obj *AlertingPolicy_Spec) GotenValidate() error { 96 if obj == nil { 97 return nil 98 } 99 if obj.ConditionCombiner != 0 { 100 return gotenvalidate.NewValidationError("Spec", "conditionCombiner", obj.ConditionCombiner, "field must be equal to exactly one of the following values: 0", nil) 101 } 102 if subobj, ok := interface{}(obj.Notification).(gotenvalidate.Validator); ok { 103 if err := subobj.GotenValidate(); err != nil { 104 return gotenvalidate.NewValidationError("Spec", "notification", obj.Notification, "nested object validation failed", err) 105 } 106 } 107 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 108 return cvobj.GotenCustomValidate() 109 } 110 return nil 111 } 112 func (obj *AlertingPolicy_State) GotenValidate() error { 113 if obj == nil { 114 return nil 115 } 116 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 117 return cvobj.GotenCustomValidate() 118 } 119 return nil 120 } 121 func (obj *AlertingPolicy_Spec_Notification) GotenValidate() error { 122 if obj == nil { 123 return nil 124 } 125 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 126 return cvobj.GotenCustomValidate() 127 } 128 return nil 129 }