github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v3/metric_descriptor/metric_descriptor.pb.validate.go (about) 1 // Code generated by protoc-gen-goten-validate 2 // File: edgelq/monitoring/proto/v3/metric_descriptor.proto 3 // DO NOT EDIT!!! 4 5 package metric_descriptor 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 api "github.com/cloudwan/edgelq-sdk/common/api" 24 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/common" 25 monitored_resource_descriptor "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/monitored_resource_descriptor" 26 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/project" 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 _ = api.LaunchStage(0) 46 _ = &common.LabelDescriptor{} 47 _ = &monitored_resource_descriptor.MonitoredResourceDescriptor{} 48 _ = &project.Project{} 49 _ = &meta.Meta{} 50 ) 51 52 func (obj *MetricDescriptor) 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("MetricDescriptor", "metadata", obj.Metadata, "nested object validation failed", err) 59 } 60 } 61 if len(obj.ResourceTypes) > 1 { 62 values := make(map[string]struct{}) 63 for _, v := range obj.ResourceTypes { 64 if _, ok := values[v]; ok { 65 return gotenvalidate.NewValidationError("MetricDescriptor", "resourceTypes", obj.ResourceTypes, "field must contain unique items", nil) 66 } 67 values[v] = struct{}{} 68 } 69 } 70 for idx, elem := range obj.Labels { 71 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 72 if err := subobj.GotenValidate(); err != nil { 73 return gotenvalidate.NewValidationError("MetricDescriptor", "labels", obj.Labels[idx], "nested object validation failed", err) 74 } 75 } 76 } 77 if subobj, ok := interface{}(obj.MetricDescriptorMetadata).(gotenvalidate.Validator); ok { 78 if err := subobj.GotenValidate(); err != nil { 79 return gotenvalidate.NewValidationError("MetricDescriptor", "metricDescriptorMetadata", obj.MetricDescriptorMetadata, "nested object validation failed", err) 80 } 81 } 82 if subobj, ok := interface{}(obj.DistributionBucketOptions).(gotenvalidate.Validator); ok { 83 if err := subobj.GotenValidate(); err != nil { 84 return gotenvalidate.NewValidationError("MetricDescriptor", "distributionBucketOptions", obj.DistributionBucketOptions, "nested object validation failed", err) 85 } 86 } 87 for idx, elem := range obj.PromotedLabelKeySets { 88 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 89 if err := subobj.GotenValidate(); err != nil { 90 return gotenvalidate.NewValidationError("MetricDescriptor", "promotedLabelKeySets", obj.PromotedLabelKeySets[idx], "nested object validation failed", err) 91 } 92 } 93 } 94 if subobj, ok := interface{}(obj.IndexSpec).(gotenvalidate.Validator); ok { 95 if err := subobj.GotenValidate(); err != nil { 96 return gotenvalidate.NewValidationError("MetricDescriptor", "indexSpec", obj.IndexSpec, "nested object validation failed", err) 97 } 98 } 99 if subobj, ok := interface{}(obj.StorageConfig).(gotenvalidate.Validator); ok { 100 if err := subobj.GotenValidate(); err != nil { 101 return gotenvalidate.NewValidationError("MetricDescriptor", "storageConfig", obj.StorageConfig, "nested object validation failed", err) 102 } 103 } 104 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 105 return cvobj.GotenCustomValidate() 106 } 107 return nil 108 } 109 func (obj *MetricDescriptor_MetricDescriptorMetadata) GotenValidate() error { 110 if obj == nil { 111 return nil 112 } 113 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 114 return cvobj.GotenCustomValidate() 115 } 116 return nil 117 } 118 func (obj *MetricDescriptor_IndexSpec) GotenValidate() error { 119 if obj == nil { 120 return nil 121 } 122 for idx, elem := range obj.PerResource { 123 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 124 if err := subobj.GotenValidate(); err != nil { 125 return gotenvalidate.NewValidationError("IndexSpec", "perResource", obj.PerResource[idx], "nested object validation failed", err) 126 } 127 } 128 } 129 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 130 return cvobj.GotenCustomValidate() 131 } 132 return nil 133 } 134 func (obj *MetricDescriptor_StorageConfig) GotenValidate() error { 135 if obj == nil { 136 return nil 137 } 138 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 139 return cvobj.GotenCustomValidate() 140 } 141 return nil 142 } 143 func (obj *MetricDescriptor_IndexSpec_Index) GotenValidate() error { 144 if obj == nil { 145 return nil 146 } 147 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 148 return cvobj.GotenCustomValidate() 149 } 150 return nil 151 } 152 func (obj *MetricDescriptor_IndexSpec_PerMonitoredResource) GotenValidate() error { 153 if obj == nil { 154 return nil 155 } 156 for idx, elem := range obj.Indices { 157 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 158 if err := subobj.GotenValidate(); err != nil { 159 return gotenvalidate.NewValidationError("PerMonitoredResource", "indices", obj.Indices[idx], "nested object validation failed", err) 160 } 161 } 162 } 163 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 164 return cvobj.GotenCustomValidate() 165 } 166 return nil 167 }