github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/metric_descriptor/metric_descriptor.pb.validate.go (about) 1 // Code generated by protoc-gen-goten-validate 2 // File: edgelq/monitoring/proto/v4/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/v4/common" 25 monitored_resource_descriptor "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/monitored_resource_descriptor" 26 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/project" 27 meta "github.com/cloudwan/goten-sdk/types/meta" 28 durationpb "google.golang.org/protobuf/types/known/durationpb" 29 ) 30 31 var ( 32 _ = bytes.Equal 33 _ = errors.New 34 _ = fmt.Errorf 35 _ = net.ParseIP 36 _ = regexp.Match 37 _ = strings.Split 38 _ = time.Now 39 _ = utf8.RuneCountInString 40 _ = url.Parse 41 _ = gotenvalidate.NewValidationError 42 43 validation_regex_LabelsGroup_metric_keys_3767d375e69c51f9742b2f17e9eb21a2 = regexp.MustCompile("^[_A-Za-z][_A-Za-z0-9]{0,31}$") 44 validation_regex_LabelsGroup_resource_keys_3767d375e69c51f9742b2f17e9eb21a2 = regexp.MustCompile("^[_A-Za-z][_A-Za-z0-9]{0,31}$") 45 validation_regex_PaginationView_filterable_metric_keys_3767d375e69c51f9742b2f17e9eb21a2 = regexp.MustCompile("^[_A-Za-z][_A-Za-z0-9]{0,31}$") 46 validation_regex_PaginationView_filterable_resource_keys_3767d375e69c51f9742b2f17e9eb21a2 = regexp.MustCompile("^[_A-Za-z][_A-Za-z0-9]{0,31}$") 47 validation_regex_PaginationView_paginated_metric_keys_3767d375e69c51f9742b2f17e9eb21a2 = regexp.MustCompile("^[_A-Za-z][_A-Za-z0-9]{0,31}$") 48 validation_regex_PaginationView_paginated_resource_keys_3767d375e69c51f9742b2f17e9eb21a2 = regexp.MustCompile("^[_A-Za-z][_A-Za-z0-9]{0,31}$") 49 ) 50 51 // make sure we're using proto imports 52 var ( 53 _ = api.LaunchStage(0) 54 _ = &common.LabelDescriptor{} 55 _ = &monitored_resource_descriptor.MonitoredResourceDescriptor{} 56 _ = &project.Project{} 57 _ = &durationpb.Duration{} 58 _ = &meta.Meta{} 59 ) 60 61 func (obj *MetricDescriptor) GotenValidate() error { 62 if obj == nil { 63 return nil 64 } 65 if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok { 66 if err := subobj.GotenValidate(); err != nil { 67 return gotenvalidate.NewValidationError("MetricDescriptor", "metadata", obj.Metadata, "nested object validation failed", err) 68 } 69 } 70 if len(obj.Type) > 256 { 71 return gotenvalidate.NewValidationError("MetricDescriptor", "type", obj.Type, "field must contain at most 256 characters", nil) 72 } 73 if len(obj.ResourceTypes) > 25 { 74 return gotenvalidate.NewValidationError("MetricDescriptor", "resourceTypes", obj.ResourceTypes, "field must have at most 25 items", nil) 75 } 76 if len(obj.ResourceTypes) > 1 { 77 values := make(map[string]struct{}) 78 for _, v := range obj.ResourceTypes { 79 if _, ok := values[v]; ok { 80 return gotenvalidate.NewValidationError("MetricDescriptor", "resourceTypes", obj.ResourceTypes, "field must contain unique items", nil) 81 } 82 values[v] = struct{}{} 83 } 84 } 85 for _, el := range obj.ResourceTypes { 86 87 if len(el) > 256 { 88 return gotenvalidate.NewValidationError("MetricDescriptor", "resourceTypes", el, "field must contain at most 256 characters", nil) 89 } 90 } 91 for idx, elem := range obj.Labels { 92 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 93 if err := subobj.GotenValidate(); err != nil { 94 return gotenvalidate.NewValidationError("MetricDescriptor", "labels", obj.Labels[idx], "nested object validation failed", err) 95 } 96 } 97 } 98 { 99 rlen := utf8.RuneCountInString(obj.Unit) 100 if rlen > 32 { 101 return gotenvalidate.NewValidationError("MetricDescriptor", "unit", obj.Unit, "field must contain at most 32 characters", nil) 102 } 103 } 104 { 105 rlen := utf8.RuneCountInString(obj.Description) 106 if rlen > 512 { 107 return gotenvalidate.NewValidationError("MetricDescriptor", "description", obj.Description, "field must contain at most 512 characters", nil) 108 } 109 } 110 { 111 rlen := utf8.RuneCountInString(obj.DisplayName) 112 if rlen > 128 { 113 return gotenvalidate.NewValidationError("MetricDescriptor", "displayName", obj.DisplayName, "field must contain at most 128 characters", nil) 114 } 115 } 116 if subobj, ok := interface{}(obj.MetricDescriptorMetadata).(gotenvalidate.Validator); ok { 117 if err := subobj.GotenValidate(); err != nil { 118 return gotenvalidate.NewValidationError("MetricDescriptor", "metricDescriptorMetadata", obj.MetricDescriptorMetadata, "nested object validation failed", err) 119 } 120 } 121 if subobj, ok := interface{}(obj.DistributionBucketOptions).(gotenvalidate.Validator); ok { 122 if err := subobj.GotenValidate(); err != nil { 123 return gotenvalidate.NewValidationError("MetricDescriptor", "distributionBucketOptions", obj.DistributionBucketOptions, "nested object validation failed", err) 124 } 125 } 126 for idx, elem := range obj.PromotedLabelKeySets { 127 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 128 if err := subobj.GotenValidate(); err != nil { 129 return gotenvalidate.NewValidationError("MetricDescriptor", "promotedLabelKeySets", obj.PromotedLabelKeySets[idx], "nested object validation failed", err) 130 } 131 } 132 } 133 if subobj, ok := interface{}(obj.IndexSpec).(gotenvalidate.Validator); ok { 134 if err := subobj.GotenValidate(); err != nil { 135 return gotenvalidate.NewValidationError("MetricDescriptor", "indexSpec", obj.IndexSpec, "nested object validation failed", err) 136 } 137 } 138 if subobj, ok := interface{}(obj.Indices).(gotenvalidate.Validator); ok { 139 if err := subobj.GotenValidate(); err != nil { 140 return gotenvalidate.NewValidationError("MetricDescriptor", "indices", obj.Indices, "nested object validation failed", err) 141 } 142 } 143 if subobj, ok := interface{}(obj.StorageConfig).(gotenvalidate.Validator); ok { 144 if err := subobj.GotenValidate(); err != nil { 145 return gotenvalidate.NewValidationError("MetricDescriptor", "storageConfig", obj.StorageConfig, "nested object validation failed", err) 146 } 147 } 148 if subobj, ok := interface{}(obj.BinaryIndices).(gotenvalidate.Validator); ok { 149 if err := subobj.GotenValidate(); err != nil { 150 return gotenvalidate.NewValidationError("MetricDescriptor", "binaryIndices", obj.BinaryIndices, "nested object validation failed", err) 151 } 152 } 153 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 154 return cvobj.GotenCustomValidate() 155 } 156 return nil 157 } 158 func (obj *MetricDescriptor_MetricDescriptorMetadata) GotenValidate() error { 159 if obj == nil { 160 return nil 161 } 162 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 163 return cvobj.GotenCustomValidate() 164 } 165 return nil 166 } 167 func (obj *MetricDescriptor_IndexSpec) GotenValidate() error { 168 if obj == nil { 169 return nil 170 } 171 for idx, elem := range obj.PerResource { 172 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 173 if err := subobj.GotenValidate(); err != nil { 174 return gotenvalidate.NewValidationError("IndexSpec", "perResource", obj.PerResource[idx], "nested object validation failed", err) 175 } 176 } 177 } 178 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 179 return cvobj.GotenCustomValidate() 180 } 181 return nil 182 } 183 func (obj *MetricDescriptor_Indices) GotenValidate() error { 184 if obj == nil { 185 return nil 186 } 187 if subobj, ok := interface{}(obj.BuiltIn).(gotenvalidate.Validator); ok { 188 if err := subobj.GotenValidate(); err != nil { 189 return gotenvalidate.NewValidationError("Indices", "builtIn", obj.BuiltIn, "nested object validation failed", err) 190 } 191 } 192 if subobj, ok := interface{}(obj.UserDefined).(gotenvalidate.Validator); ok { 193 if err := subobj.GotenValidate(); err != nil { 194 return gotenvalidate.NewValidationError("Indices", "userDefined", obj.UserDefined, "nested object validation failed", err) 195 } 196 } 197 for idx, elem := range obj.LegacyMigrated { 198 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 199 if err := subobj.GotenValidate(); err != nil { 200 return gotenvalidate.NewValidationError("Indices", "legacyMigrated", obj.LegacyMigrated[idx], "nested object validation failed", err) 201 } 202 } 203 } 204 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 205 return cvobj.GotenCustomValidate() 206 } 207 return nil 208 } 209 func (obj *MetricDescriptor_StorageConfig) GotenValidate() error { 210 if obj == nil { 211 return nil 212 } 213 if obj.MaxAp != nil && obj.MaxAp.CheckValid() != nil { 214 err := obj.MaxAp.CheckValid() 215 return gotenvalidate.NewValidationError("StorageConfig", "maxAp", obj.MaxAp, "could not validate duration", err) 216 } else { 217 d := obj.MaxAp.AsDuration() 218 219 if obj.MaxAp != nil { 220 if d != time.Duration(0) && d != time.Duration(60000000000) && d != time.Duration(180000000000) && d != time.Duration(300000000000) && d != time.Duration(900000000000) && d != time.Duration(1800000000000) && d != time.Duration(3600000000000) && d != time.Duration(10800000000000) && d != time.Duration(21600000000000) && d != time.Duration(43200000000000) && d != time.Duration(86400000000000) { 221 return gotenvalidate.NewValidationError("StorageConfig", "maxAp", d, "field must be equal to exactly one of the following values: 0s, 1m0s, 3m0s, 5m0s, 15m0s, 30m0s, 1h0m0s, 3h0m0s, 6h0m0s, 12h0m0s, 24h0m0s", nil) 222 } 223 } 224 } 225 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 226 return cvobj.GotenCustomValidate() 227 } 228 return nil 229 } 230 func (obj *MetricDescriptor_BinaryIndices) GotenValidate() error { 231 if obj == nil { 232 return nil 233 } 234 for idx, elem := range obj.ByResources { 235 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 236 if err := subobj.GotenValidate(); err != nil { 237 return gotenvalidate.NewValidationError("BinaryIndices", "byResources", obj.ByResources[idx], "nested object validation failed", err) 238 } 239 } 240 } 241 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 242 return cvobj.GotenCustomValidate() 243 } 244 return nil 245 } 246 func (obj *MetricDescriptor_IndexSpec_Index) GotenValidate() error { 247 if obj == nil { 248 return nil 249 } 250 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 251 return cvobj.GotenCustomValidate() 252 } 253 return nil 254 } 255 func (obj *MetricDescriptor_IndexSpec_PerMonitoredResource) GotenValidate() error { 256 if obj == nil { 257 return nil 258 } 259 for idx, elem := range obj.Indices { 260 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 261 if err := subobj.GotenValidate(); err != nil { 262 return gotenvalidate.NewValidationError("PerMonitoredResource", "indices", obj.Indices[idx], "nested object validation failed", err) 263 } 264 } 265 } 266 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 267 return cvobj.GotenCustomValidate() 268 } 269 return nil 270 } 271 func (obj *MetricDescriptor_Indices_LabelsGroup) GotenValidate() error { 272 if obj == nil { 273 return nil 274 } 275 { 276 rlen := utf8.RuneCountInString(obj.Name) 277 if rlen < 1 { 278 return gotenvalidate.NewValidationError("LabelsGroup", "name", obj.Name, "field must contain at least 1 characters", nil) 279 } 280 if rlen > 64 { 281 return gotenvalidate.NewValidationError("LabelsGroup", "name", obj.Name, "field must contain at most 64 characters", nil) 282 } 283 } 284 if len(obj.MetricKeys) > 16 { 285 return gotenvalidate.NewValidationError("LabelsGroup", "metricKeys", obj.MetricKeys, "field must have at most 16 items", nil) 286 } 287 for _, el := range obj.MetricKeys { 288 289 if !validation_regex_LabelsGroup_metric_keys_3767d375e69c51f9742b2f17e9eb21a2.Match([]byte(el)) { 290 return gotenvalidate.NewValidationError("LabelsGroup", "metricKeys", el, "field must match the regex ^[_A-Za-z][_A-Za-z0-9]{0,31}$", nil) 291 } 292 } 293 if len(obj.ResourceKeys) > 16 { 294 return gotenvalidate.NewValidationError("LabelsGroup", "resourceKeys", obj.ResourceKeys, "field must have at most 16 items", nil) 295 } 296 for _, el := range obj.ResourceKeys { 297 298 if !validation_regex_LabelsGroup_resource_keys_3767d375e69c51f9742b2f17e9eb21a2.Match([]byte(el)) { 299 return gotenvalidate.NewValidationError("LabelsGroup", "resourceKeys", el, "field must match the regex ^[_A-Za-z][_A-Za-z0-9]{0,31}$", nil) 300 } 301 } 302 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 303 return cvobj.GotenCustomValidate() 304 } 305 return nil 306 } 307 func (obj *MetricDescriptor_Indices_PaginationView) GotenValidate() error { 308 if obj == nil { 309 return nil 310 } 311 { 312 rlen := utf8.RuneCountInString(obj.Name) 313 if rlen < 1 { 314 return gotenvalidate.NewValidationError("PaginationView", "name", obj.Name, "field must contain at least 1 characters", nil) 315 } 316 if rlen > 64 { 317 return gotenvalidate.NewValidationError("PaginationView", "name", obj.Name, "field must contain at most 64 characters", nil) 318 } 319 } 320 if len(obj.FilterableMetricKeys) > 16 { 321 return gotenvalidate.NewValidationError("PaginationView", "filterableMetricKeys", obj.FilterableMetricKeys, "field must have at most 16 items", nil) 322 } 323 for _, el := range obj.FilterableMetricKeys { 324 325 if !validation_regex_PaginationView_filterable_metric_keys_3767d375e69c51f9742b2f17e9eb21a2.Match([]byte(el)) { 326 return gotenvalidate.NewValidationError("PaginationView", "filterableMetricKeys", el, "field must match the regex ^[_A-Za-z][_A-Za-z0-9]{0,31}$", nil) 327 } 328 } 329 if len(obj.FilterableResourceKeys) > 16 { 330 return gotenvalidate.NewValidationError("PaginationView", "filterableResourceKeys", obj.FilterableResourceKeys, "field must have at most 16 items", nil) 331 } 332 for _, el := range obj.FilterableResourceKeys { 333 334 if !validation_regex_PaginationView_filterable_resource_keys_3767d375e69c51f9742b2f17e9eb21a2.Match([]byte(el)) { 335 return gotenvalidate.NewValidationError("PaginationView", "filterableResourceKeys", el, "field must match the regex ^[_A-Za-z][_A-Za-z0-9]{0,31}$", nil) 336 } 337 } 338 if len(obj.PaginatedMetricKeys) > 16 { 339 return gotenvalidate.NewValidationError("PaginationView", "paginatedMetricKeys", obj.PaginatedMetricKeys, "field must have at most 16 items", nil) 340 } 341 for _, el := range obj.PaginatedMetricKeys { 342 343 if !validation_regex_PaginationView_paginated_metric_keys_3767d375e69c51f9742b2f17e9eb21a2.Match([]byte(el)) { 344 return gotenvalidate.NewValidationError("PaginationView", "paginatedMetricKeys", el, "field must match the regex ^[_A-Za-z][_A-Za-z0-9]{0,31}$", nil) 345 } 346 } 347 if len(obj.PaginatedResourceKeys) > 16 { 348 return gotenvalidate.NewValidationError("PaginationView", "paginatedResourceKeys", obj.PaginatedResourceKeys, "field must have at most 16 items", nil) 349 } 350 for _, el := range obj.PaginatedResourceKeys { 351 352 if !validation_regex_PaginationView_paginated_resource_keys_3767d375e69c51f9742b2f17e9eb21a2.Match([]byte(el)) { 353 return gotenvalidate.NewValidationError("PaginationView", "paginatedResourceKeys", el, "field must match the regex ^[_A-Za-z][_A-Za-z0-9]{0,31}$", nil) 354 } 355 } 356 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 357 return cvobj.GotenCustomValidate() 358 } 359 return nil 360 } 361 func (obj *MetricDescriptor_Indices_AggregationsGroup) GotenValidate() error { 362 if obj == nil { 363 return nil 364 } 365 { 366 rlen := utf8.RuneCountInString(obj.Name) 367 if rlen < 1 { 368 return gotenvalidate.NewValidationError("AggregationsGroup", "name", obj.Name, "field must contain at least 1 characters", nil) 369 } 370 if rlen > 64 { 371 return gotenvalidate.NewValidationError("AggregationsGroup", "name", obj.Name, "field must contain at most 64 characters", nil) 372 } 373 } 374 if len(obj.PerSeriesAligners) < 1 { 375 return gotenvalidate.NewValidationError("AggregationsGroup", "perSeriesAligners", obj.PerSeriesAligners, "field must have at least 1 items", nil) 376 } 377 if len(obj.PerSeriesAligners) > 1 { 378 values := make(map[common.Aggregation_Aligner]struct{}) 379 for _, v := range obj.PerSeriesAligners { 380 if _, ok := values[v]; ok { 381 return gotenvalidate.NewValidationError("AggregationsGroup", "perSeriesAligners", obj.PerSeriesAligners, "field must contain unique items", nil) 382 } 383 values[v] = struct{}{} 384 } 385 } 386 if len(obj.CrossSeriesReducers) > 1 { 387 values := make(map[common.Aggregation_Reducer]struct{}) 388 for _, v := range obj.CrossSeriesReducers { 389 if _, ok := values[v]; ok { 390 return gotenvalidate.NewValidationError("AggregationsGroup", "crossSeriesReducers", obj.CrossSeriesReducers, "field must contain unique items", nil) 391 } 392 values[v] = struct{}{} 393 } 394 } 395 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 396 return cvobj.GotenCustomValidate() 397 } 398 return nil 399 } 400 func (obj *MetricDescriptor_Indices_SortingFunction) GotenValidate() error { 401 if obj == nil { 402 return nil 403 } 404 if _, ok := MetricDescriptor_Indices_SortingFunction_Direction_name[int32(obj.Sorting)]; !ok { 405 return gotenvalidate.NewValidationError("SortingFunction", "sorting", obj.Sorting, "field must be a defined enum value", nil) 406 } 407 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 408 return cvobj.GotenCustomValidate() 409 } 410 return nil 411 } 412 func (obj *MetricDescriptor_Indices_PreAggregatedIndices) GotenValidate() error { 413 if obj == nil { 414 return nil 415 } 416 { 417 rlen := utf8.RuneCountInString(obj.Name) 418 if rlen < 1 { 419 return gotenvalidate.NewValidationError("PreAggregatedIndices", "name", obj.Name, "field must contain at least 1 characters", nil) 420 } 421 if rlen > 64 { 422 return gotenvalidate.NewValidationError("PreAggregatedIndices", "name", obj.Name, "field must contain at most 64 characters", nil) 423 } 424 } 425 if len(obj.ResourceTypes) < 1 { 426 return gotenvalidate.NewValidationError("PreAggregatedIndices", "resourceTypes", obj.ResourceTypes, "field must have at least 1 items", nil) 427 } 428 if len(obj.ResourceTypes) > 8 { 429 return gotenvalidate.NewValidationError("PreAggregatedIndices", "resourceTypes", obj.ResourceTypes, "field must have at most 8 items", nil) 430 } 431 if len(obj.ResourceTypes) > 1 { 432 values := make(map[string]struct{}) 433 for _, v := range obj.ResourceTypes { 434 if _, ok := values[v]; ok { 435 return gotenvalidate.NewValidationError("PreAggregatedIndices", "resourceTypes", obj.ResourceTypes, "field must contain unique items", nil) 436 } 437 values[v] = struct{}{} 438 } 439 } 440 for _, el := range obj.ResourceTypes { 441 442 { 443 rlen := utf8.RuneCountInString(el) 444 if rlen < 1 { 445 return gotenvalidate.NewValidationError("PreAggregatedIndices", "resourceTypes", el, "field must contain at least 1 characters", nil) 446 } 447 if rlen > 64 { 448 return gotenvalidate.NewValidationError("PreAggregatedIndices", "resourceTypes", el, "field must contain at most 64 characters", nil) 449 } 450 } 451 } 452 for idx, elem := range obj.PartitionLabelSets { 453 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 454 if err := subobj.GotenValidate(); err != nil { 455 return gotenvalidate.NewValidationError("PreAggregatedIndices", "partitionLabelSets", obj.PartitionLabelSets[idx], "nested object validation failed", err) 456 } 457 } 458 } 459 for idx, elem := range obj.FilterAndGroupLabelSets { 460 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 461 if err := subobj.GotenValidate(); err != nil { 462 return gotenvalidate.NewValidationError("PreAggregatedIndices", "filterAndGroupLabelSets", obj.FilterAndGroupLabelSets[idx], "nested object validation failed", err) 463 } 464 } 465 } 466 for idx, elem := range obj.SupportedAggregations { 467 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 468 if err := subobj.GotenValidate(); err != nil { 469 return gotenvalidate.NewValidationError("PreAggregatedIndices", "supportedAggregations", obj.SupportedAggregations[idx], "nested object validation failed", err) 470 } 471 } 472 } 473 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 474 return cvobj.GotenCustomValidate() 475 } 476 return nil 477 } 478 func (obj *MetricDescriptor_Indices_NonAggregatedIndices) GotenValidate() error { 479 if obj == nil { 480 return nil 481 } 482 { 483 rlen := utf8.RuneCountInString(obj.Name) 484 if rlen < 1 { 485 return gotenvalidate.NewValidationError("NonAggregatedIndices", "name", obj.Name, "field must contain at least 1 characters", nil) 486 } 487 if rlen > 64 { 488 return gotenvalidate.NewValidationError("NonAggregatedIndices", "name", obj.Name, "field must contain at most 64 characters", nil) 489 } 490 } 491 if len(obj.ResourceTypes) < 1 { 492 return gotenvalidate.NewValidationError("NonAggregatedIndices", "resourceTypes", obj.ResourceTypes, "field must have at least 1 items", nil) 493 } 494 if len(obj.ResourceTypes) > 8 { 495 return gotenvalidate.NewValidationError("NonAggregatedIndices", "resourceTypes", obj.ResourceTypes, "field must have at most 8 items", nil) 496 } 497 if len(obj.ResourceTypes) > 1 { 498 values := make(map[string]struct{}) 499 for _, v := range obj.ResourceTypes { 500 if _, ok := values[v]; ok { 501 return gotenvalidate.NewValidationError("NonAggregatedIndices", "resourceTypes", obj.ResourceTypes, "field must contain unique items", nil) 502 } 503 values[v] = struct{}{} 504 } 505 } 506 for _, el := range obj.ResourceTypes { 507 508 { 509 rlen := utf8.RuneCountInString(el) 510 if rlen < 1 { 511 return gotenvalidate.NewValidationError("NonAggregatedIndices", "resourceTypes", el, "field must contain at least 1 characters", nil) 512 } 513 if rlen > 64 { 514 return gotenvalidate.NewValidationError("NonAggregatedIndices", "resourceTypes", el, "field must contain at most 64 characters", nil) 515 } 516 } 517 } 518 for idx, elem := range obj.PartitionLabelSets { 519 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 520 if err := subobj.GotenValidate(); err != nil { 521 return gotenvalidate.NewValidationError("NonAggregatedIndices", "partitionLabelSets", obj.PartitionLabelSets[idx], "nested object validation failed", err) 522 } 523 } 524 } 525 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 526 return cvobj.GotenCustomValidate() 527 } 528 return nil 529 } 530 func (obj *MetricDescriptor_Indices_PaginationIndices) GotenValidate() error { 531 if obj == nil { 532 return nil 533 } 534 { 535 rlen := utf8.RuneCountInString(obj.Name) 536 if rlen < 1 { 537 return gotenvalidate.NewValidationError("PaginationIndices", "name", obj.Name, "field must contain at least 1 characters", nil) 538 } 539 if rlen > 64 { 540 return gotenvalidate.NewValidationError("PaginationIndices", "name", obj.Name, "field must contain at most 64 characters", nil) 541 } 542 } 543 if len(obj.ResourceTypes) < 1 { 544 return gotenvalidate.NewValidationError("PaginationIndices", "resourceTypes", obj.ResourceTypes, "field must have at least 1 items", nil) 545 } 546 if len(obj.ResourceTypes) > 8 { 547 return gotenvalidate.NewValidationError("PaginationIndices", "resourceTypes", obj.ResourceTypes, "field must have at most 8 items", nil) 548 } 549 if len(obj.ResourceTypes) > 1 { 550 values := make(map[string]struct{}) 551 for _, v := range obj.ResourceTypes { 552 if _, ok := values[v]; ok { 553 return gotenvalidate.NewValidationError("PaginationIndices", "resourceTypes", obj.ResourceTypes, "field must contain unique items", nil) 554 } 555 values[v] = struct{}{} 556 } 557 } 558 for _, el := range obj.ResourceTypes { 559 560 { 561 rlen := utf8.RuneCountInString(el) 562 if rlen < 1 { 563 return gotenvalidate.NewValidationError("PaginationIndices", "resourceTypes", el, "field must contain at least 1 characters", nil) 564 } 565 if rlen > 64 { 566 return gotenvalidate.NewValidationError("PaginationIndices", "resourceTypes", el, "field must contain at most 64 characters", nil) 567 } 568 } 569 } 570 for idx, elem := range obj.PartitionLabelSets { 571 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 572 if err := subobj.GotenValidate(); err != nil { 573 return gotenvalidate.NewValidationError("PaginationIndices", "partitionLabelSets", obj.PartitionLabelSets[idx], "nested object validation failed", err) 574 } 575 } 576 } 577 for idx, elem := range obj.Views { 578 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 579 if err := subobj.GotenValidate(); err != nil { 580 return gotenvalidate.NewValidationError("PaginationIndices", "views", obj.Views[idx], "nested object validation failed", err) 581 } 582 } 583 } 584 for idx, elem := range obj.Functions { 585 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 586 if err := subobj.GotenValidate(); err != nil { 587 return gotenvalidate.NewValidationError("PaginationIndices", "functions", obj.Functions[idx], "nested object validation failed", err) 588 } 589 } 590 } 591 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 592 return cvobj.GotenCustomValidate() 593 } 594 return nil 595 } 596 func (obj *MetricDescriptor_Indices_IndexGroups) GotenValidate() error { 597 if obj == nil { 598 return nil 599 } 600 for idx, elem := range obj.PreAggregatedIndices { 601 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 602 if err := subobj.GotenValidate(); err != nil { 603 return gotenvalidate.NewValidationError("IndexGroups", "preAggregatedIndices", obj.PreAggregatedIndices[idx], "nested object validation failed", err) 604 } 605 } 606 } 607 for idx, elem := range obj.NonAggregatedIndices { 608 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 609 if err := subobj.GotenValidate(); err != nil { 610 return gotenvalidate.NewValidationError("IndexGroups", "nonAggregatedIndices", obj.NonAggregatedIndices[idx], "nested object validation failed", err) 611 } 612 } 613 } 614 for idx, elem := range obj.PaginationIndices { 615 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 616 if err := subobj.GotenValidate(); err != nil { 617 return gotenvalidate.NewValidationError("IndexGroups", "paginationIndices", obj.PaginationIndices[idx], "nested object validation failed", err) 618 } 619 } 620 } 621 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 622 return cvobj.GotenCustomValidate() 623 } 624 return nil 625 } 626 func (obj *MetricDescriptor_BinaryIndices_PreAggregatedIndex) GotenValidate() error { 627 if obj == nil { 628 return nil 629 } 630 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 631 return cvobj.GotenCustomValidate() 632 } 633 return nil 634 } 635 func (obj *MetricDescriptor_BinaryIndices_PaginatingIndex) GotenValidate() error { 636 if obj == nil { 637 return nil 638 } 639 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 640 return cvobj.GotenCustomValidate() 641 } 642 return nil 643 } 644 func (obj *MetricDescriptor_BinaryIndices_ByResourceType) GotenValidate() error { 645 if obj == nil { 646 return nil 647 } 648 for idx, elem := range obj.PreAggregatedIndices { 649 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 650 if err := subobj.GotenValidate(); err != nil { 651 return gotenvalidate.NewValidationError("ByResourceType", "preAggregatedIndices", obj.PreAggregatedIndices[idx], "nested object validation failed", err) 652 } 653 } 654 } 655 for idx, elem := range obj.PaginatingIndices { 656 if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok { 657 if err := subobj.GotenValidate(); err != nil { 658 return gotenvalidate.NewValidationError("ByResourceType", "paginatingIndices", obj.PaginatingIndices[idx], "nested object validation failed", err) 659 } 660 } 661 } 662 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 663 return cvobj.GotenCustomValidate() 664 } 665 return nil 666 }