github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/alerting_condition/alerting_condition.pb.fieldpath.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/monitoring/proto/v4/alerting_condition.proto 3 // DO NOT EDIT!!! 4 5 package alerting_condition 6 7 import ( 8 "encoding/json" 9 "fmt" 10 "reflect" 11 "strings" 12 "time" 13 14 "google.golang.org/grpc/codes" 15 "google.golang.org/grpc/status" 16 "google.golang.org/protobuf/encoding/protojson" 17 "google.golang.org/protobuf/proto" 18 "google.golang.org/protobuf/reflect/protoregistry" 19 20 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 21 "github.com/cloudwan/goten-sdk/runtime/strcase" 22 ) 23 24 // proto imports 25 import ( 26 alerting_policy "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_policy" 27 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 28 time_serie "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/time_serie" 29 meta "github.com/cloudwan/goten-sdk/types/meta" 30 durationpb "google.golang.org/protobuf/types/known/durationpb" 31 ) 32 33 // ensure the imports are used 34 var ( 35 _ = new(json.Marshaler) 36 _ = new(fmt.Stringer) 37 _ = reflect.DeepEqual 38 _ = strings.Builder{} 39 _ = time.Second 40 41 _ = strcase.ToLowerCamel 42 _ = codes.NotFound 43 _ = status.Status{} 44 _ = protojson.UnmarshalOptions{} 45 _ = new(proto.Message) 46 _ = protoregistry.GlobalTypes 47 48 _ = new(gotenobject.FieldPath) 49 ) 50 51 // make sure we're using proto imports 52 var ( 53 _ = &alerting_policy.AlertingPolicy{} 54 _ = &common.LabelDescriptor{} 55 _ = &time_serie.Point{} 56 _ = &durationpb.Duration{} 57 _ = &meta.Meta{} 58 ) 59 60 // FieldPath provides implementation to handle 61 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 62 type AlertingCondition_FieldPath interface { 63 gotenobject.FieldPath 64 Selector() AlertingCondition_FieldPathSelector 65 Get(source *AlertingCondition) []interface{} 66 GetSingle(source *AlertingCondition) (interface{}, bool) 67 ClearValue(item *AlertingCondition) 68 69 // Those methods build corresponding AlertingCondition_FieldPathValue 70 // (or array of values) and holds passed value. Panics if injected type is incorrect. 71 WithIValue(value interface{}) AlertingCondition_FieldPathValue 72 WithIArrayOfValues(values interface{}) AlertingCondition_FieldPathArrayOfValues 73 WithIArrayItemValue(value interface{}) AlertingCondition_FieldPathArrayItemValue 74 } 75 76 type AlertingCondition_FieldPathSelector int32 77 78 const ( 79 AlertingCondition_FieldPathSelectorName AlertingCondition_FieldPathSelector = 0 80 AlertingCondition_FieldPathSelectorMetadata AlertingCondition_FieldPathSelector = 1 81 AlertingCondition_FieldPathSelectorDisplayName AlertingCondition_FieldPathSelector = 2 82 AlertingCondition_FieldPathSelectorDescription AlertingCondition_FieldPathSelector = 3 83 AlertingCondition_FieldPathSelectorSpec AlertingCondition_FieldPathSelector = 4 84 AlertingCondition_FieldPathSelectorState AlertingCondition_FieldPathSelector = 5 85 ) 86 87 func (s AlertingCondition_FieldPathSelector) String() string { 88 switch s { 89 case AlertingCondition_FieldPathSelectorName: 90 return "name" 91 case AlertingCondition_FieldPathSelectorMetadata: 92 return "metadata" 93 case AlertingCondition_FieldPathSelectorDisplayName: 94 return "display_name" 95 case AlertingCondition_FieldPathSelectorDescription: 96 return "description" 97 case AlertingCondition_FieldPathSelectorSpec: 98 return "spec" 99 case AlertingCondition_FieldPathSelectorState: 100 return "state" 101 default: 102 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", s)) 103 } 104 } 105 106 func BuildAlertingCondition_FieldPath(fp gotenobject.RawFieldPath) (AlertingCondition_FieldPath, error) { 107 if len(fp) == 0 { 108 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingCondition") 109 } 110 if len(fp) == 1 { 111 switch fp[0] { 112 case "name": 113 return &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorName}, nil 114 case "metadata": 115 return &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorMetadata}, nil 116 case "display_name", "displayName", "display-name": 117 return &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorDisplayName}, nil 118 case "description": 119 return &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorDescription}, nil 120 case "spec": 121 return &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorSpec}, nil 122 case "state": 123 return &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorState}, nil 124 } 125 } else { 126 switch fp[0] { 127 case "metadata": 128 if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil { 129 return nil, err 130 } else { 131 return &AlertingCondition_FieldSubPath{selector: AlertingCondition_FieldPathSelectorMetadata, subPath: subpath}, nil 132 } 133 case "spec": 134 if subpath, err := BuildAlertingConditionSpec_FieldPath(fp[1:]); err != nil { 135 return nil, err 136 } else { 137 return &AlertingCondition_FieldSubPath{selector: AlertingCondition_FieldPathSelectorSpec, subPath: subpath}, nil 138 } 139 case "state": 140 if subpath, err := BuildAlertingConditionState_FieldPath(fp[1:]); err != nil { 141 return nil, err 142 } else { 143 return &AlertingCondition_FieldSubPath{selector: AlertingCondition_FieldPathSelectorState, subPath: subpath}, nil 144 } 145 } 146 } 147 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingCondition", fp) 148 } 149 150 func ParseAlertingCondition_FieldPath(rawField string) (AlertingCondition_FieldPath, error) { 151 fp, err := gotenobject.ParseRawFieldPath(rawField) 152 if err != nil { 153 return nil, err 154 } 155 return BuildAlertingCondition_FieldPath(fp) 156 } 157 158 func MustParseAlertingCondition_FieldPath(rawField string) AlertingCondition_FieldPath { 159 fp, err := ParseAlertingCondition_FieldPath(rawField) 160 if err != nil { 161 panic(err) 162 } 163 return fp 164 } 165 166 type AlertingCondition_FieldTerminalPath struct { 167 selector AlertingCondition_FieldPathSelector 168 } 169 170 var _ AlertingCondition_FieldPath = (*AlertingCondition_FieldTerminalPath)(nil) 171 172 func (fp *AlertingCondition_FieldTerminalPath) Selector() AlertingCondition_FieldPathSelector { 173 return fp.selector 174 } 175 176 // String returns path representation in proto convention 177 func (fp *AlertingCondition_FieldTerminalPath) String() string { 178 return fp.selector.String() 179 } 180 181 // JSONString returns path representation is JSON convention 182 func (fp *AlertingCondition_FieldTerminalPath) JSONString() string { 183 return strcase.ToLowerCamel(fp.String()) 184 } 185 186 // Get returns all values pointed by specific field from source AlertingCondition 187 func (fp *AlertingCondition_FieldTerminalPath) Get(source *AlertingCondition) (values []interface{}) { 188 if source != nil { 189 switch fp.selector { 190 case AlertingCondition_FieldPathSelectorName: 191 if source.Name != nil { 192 values = append(values, source.Name) 193 } 194 case AlertingCondition_FieldPathSelectorMetadata: 195 if source.Metadata != nil { 196 values = append(values, source.Metadata) 197 } 198 case AlertingCondition_FieldPathSelectorDisplayName: 199 values = append(values, source.DisplayName) 200 case AlertingCondition_FieldPathSelectorDescription: 201 values = append(values, source.Description) 202 case AlertingCondition_FieldPathSelectorSpec: 203 if source.Spec != nil { 204 values = append(values, source.Spec) 205 } 206 case AlertingCondition_FieldPathSelectorState: 207 if source.State != nil { 208 values = append(values, source.State) 209 } 210 default: 211 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fp.selector)) 212 } 213 } 214 return 215 } 216 217 func (fp *AlertingCondition_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 218 return fp.Get(source.(*AlertingCondition)) 219 } 220 221 // GetSingle returns value pointed by specific field of from source AlertingCondition 222 func (fp *AlertingCondition_FieldTerminalPath) GetSingle(source *AlertingCondition) (interface{}, bool) { 223 switch fp.selector { 224 case AlertingCondition_FieldPathSelectorName: 225 res := source.GetName() 226 return res, res != nil 227 case AlertingCondition_FieldPathSelectorMetadata: 228 res := source.GetMetadata() 229 return res, res != nil 230 case AlertingCondition_FieldPathSelectorDisplayName: 231 return source.GetDisplayName(), source != nil 232 case AlertingCondition_FieldPathSelectorDescription: 233 return source.GetDescription(), source != nil 234 case AlertingCondition_FieldPathSelectorSpec: 235 res := source.GetSpec() 236 return res, res != nil 237 case AlertingCondition_FieldPathSelectorState: 238 res := source.GetState() 239 return res, res != nil 240 default: 241 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fp.selector)) 242 } 243 } 244 245 func (fp *AlertingCondition_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 246 return fp.GetSingle(source.(*AlertingCondition)) 247 } 248 249 // GetDefault returns a default value of the field type 250 func (fp *AlertingCondition_FieldTerminalPath) GetDefault() interface{} { 251 switch fp.selector { 252 case AlertingCondition_FieldPathSelectorName: 253 return (*Name)(nil) 254 case AlertingCondition_FieldPathSelectorMetadata: 255 return (*meta.Meta)(nil) 256 case AlertingCondition_FieldPathSelectorDisplayName: 257 return "" 258 case AlertingCondition_FieldPathSelectorDescription: 259 return "" 260 case AlertingCondition_FieldPathSelectorSpec: 261 return (*AlertingCondition_Spec)(nil) 262 case AlertingCondition_FieldPathSelectorState: 263 return (*AlertingCondition_State)(nil) 264 default: 265 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fp.selector)) 266 } 267 } 268 269 func (fp *AlertingCondition_FieldTerminalPath) ClearValue(item *AlertingCondition) { 270 if item != nil { 271 switch fp.selector { 272 case AlertingCondition_FieldPathSelectorName: 273 item.Name = nil 274 case AlertingCondition_FieldPathSelectorMetadata: 275 item.Metadata = nil 276 case AlertingCondition_FieldPathSelectorDisplayName: 277 item.DisplayName = "" 278 case AlertingCondition_FieldPathSelectorDescription: 279 item.Description = "" 280 case AlertingCondition_FieldPathSelectorSpec: 281 item.Spec = nil 282 case AlertingCondition_FieldPathSelectorState: 283 item.State = nil 284 default: 285 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fp.selector)) 286 } 287 } 288 } 289 290 func (fp *AlertingCondition_FieldTerminalPath) ClearValueRaw(item proto.Message) { 291 fp.ClearValue(item.(*AlertingCondition)) 292 } 293 294 // IsLeaf - whether field path is holds simple value 295 func (fp *AlertingCondition_FieldTerminalPath) IsLeaf() bool { 296 return fp.selector == AlertingCondition_FieldPathSelectorName || 297 fp.selector == AlertingCondition_FieldPathSelectorDisplayName || 298 fp.selector == AlertingCondition_FieldPathSelectorDescription 299 } 300 301 func (fp *AlertingCondition_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 302 return []gotenobject.FieldPath{fp} 303 } 304 305 func (fp *AlertingCondition_FieldTerminalPath) WithIValue(value interface{}) AlertingCondition_FieldPathValue { 306 switch fp.selector { 307 case AlertingCondition_FieldPathSelectorName: 308 return &AlertingCondition_FieldTerminalPathValue{AlertingCondition_FieldTerminalPath: *fp, value: value.(*Name)} 309 case AlertingCondition_FieldPathSelectorMetadata: 310 return &AlertingCondition_FieldTerminalPathValue{AlertingCondition_FieldTerminalPath: *fp, value: value.(*meta.Meta)} 311 case AlertingCondition_FieldPathSelectorDisplayName: 312 return &AlertingCondition_FieldTerminalPathValue{AlertingCondition_FieldTerminalPath: *fp, value: value.(string)} 313 case AlertingCondition_FieldPathSelectorDescription: 314 return &AlertingCondition_FieldTerminalPathValue{AlertingCondition_FieldTerminalPath: *fp, value: value.(string)} 315 case AlertingCondition_FieldPathSelectorSpec: 316 return &AlertingCondition_FieldTerminalPathValue{AlertingCondition_FieldTerminalPath: *fp, value: value.(*AlertingCondition_Spec)} 317 case AlertingCondition_FieldPathSelectorState: 318 return &AlertingCondition_FieldTerminalPathValue{AlertingCondition_FieldTerminalPath: *fp, value: value.(*AlertingCondition_State)} 319 default: 320 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fp.selector)) 321 } 322 } 323 324 func (fp *AlertingCondition_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 325 return fp.WithIValue(value) 326 } 327 328 func (fp *AlertingCondition_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingCondition_FieldPathArrayOfValues { 329 fpaov := &AlertingCondition_FieldTerminalPathArrayOfValues{AlertingCondition_FieldTerminalPath: *fp} 330 switch fp.selector { 331 case AlertingCondition_FieldPathSelectorName: 332 return &AlertingCondition_FieldTerminalPathArrayOfValues{AlertingCondition_FieldTerminalPath: *fp, values: values.([]*Name)} 333 case AlertingCondition_FieldPathSelectorMetadata: 334 return &AlertingCondition_FieldTerminalPathArrayOfValues{AlertingCondition_FieldTerminalPath: *fp, values: values.([]*meta.Meta)} 335 case AlertingCondition_FieldPathSelectorDisplayName: 336 return &AlertingCondition_FieldTerminalPathArrayOfValues{AlertingCondition_FieldTerminalPath: *fp, values: values.([]string)} 337 case AlertingCondition_FieldPathSelectorDescription: 338 return &AlertingCondition_FieldTerminalPathArrayOfValues{AlertingCondition_FieldTerminalPath: *fp, values: values.([]string)} 339 case AlertingCondition_FieldPathSelectorSpec: 340 return &AlertingCondition_FieldTerminalPathArrayOfValues{AlertingCondition_FieldTerminalPath: *fp, values: values.([]*AlertingCondition_Spec)} 341 case AlertingCondition_FieldPathSelectorState: 342 return &AlertingCondition_FieldTerminalPathArrayOfValues{AlertingCondition_FieldTerminalPath: *fp, values: values.([]*AlertingCondition_State)} 343 default: 344 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fp.selector)) 345 } 346 return fpaov 347 } 348 349 func (fp *AlertingCondition_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 350 return fp.WithIArrayOfValues(values) 351 } 352 353 func (fp *AlertingCondition_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingCondition_FieldPathArrayItemValue { 354 switch fp.selector { 355 default: 356 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fp.selector)) 357 } 358 } 359 360 func (fp *AlertingCondition_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 361 return fp.WithIArrayItemValue(value) 362 } 363 364 type AlertingCondition_FieldSubPath struct { 365 selector AlertingCondition_FieldPathSelector 366 subPath gotenobject.FieldPath 367 } 368 369 var _ AlertingCondition_FieldPath = (*AlertingCondition_FieldSubPath)(nil) 370 371 func (fps *AlertingCondition_FieldSubPath) Selector() AlertingCondition_FieldPathSelector { 372 return fps.selector 373 } 374 func (fps *AlertingCondition_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) { 375 res, ok := fps.subPath.(meta.Meta_FieldPath) 376 return res, ok 377 } 378 func (fps *AlertingCondition_FieldSubPath) AsSpecSubPath() (AlertingConditionSpec_FieldPath, bool) { 379 res, ok := fps.subPath.(AlertingConditionSpec_FieldPath) 380 return res, ok 381 } 382 func (fps *AlertingCondition_FieldSubPath) AsStateSubPath() (AlertingConditionState_FieldPath, bool) { 383 res, ok := fps.subPath.(AlertingConditionState_FieldPath) 384 return res, ok 385 } 386 387 // String returns path representation in proto convention 388 func (fps *AlertingCondition_FieldSubPath) String() string { 389 return fps.selector.String() + "." + fps.subPath.String() 390 } 391 392 // JSONString returns path representation is JSON convention 393 func (fps *AlertingCondition_FieldSubPath) JSONString() string { 394 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 395 } 396 397 // Get returns all values pointed by selected field from source AlertingCondition 398 func (fps *AlertingCondition_FieldSubPath) Get(source *AlertingCondition) (values []interface{}) { 399 switch fps.selector { 400 case AlertingCondition_FieldPathSelectorMetadata: 401 values = append(values, fps.subPath.GetRaw(source.GetMetadata())...) 402 case AlertingCondition_FieldPathSelectorSpec: 403 values = append(values, fps.subPath.GetRaw(source.GetSpec())...) 404 case AlertingCondition_FieldPathSelectorState: 405 values = append(values, fps.subPath.GetRaw(source.GetState())...) 406 default: 407 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fps.selector)) 408 } 409 return 410 } 411 412 func (fps *AlertingCondition_FieldSubPath) GetRaw(source proto.Message) []interface{} { 413 return fps.Get(source.(*AlertingCondition)) 414 } 415 416 // GetSingle returns value of selected field from source AlertingCondition 417 func (fps *AlertingCondition_FieldSubPath) GetSingle(source *AlertingCondition) (interface{}, bool) { 418 switch fps.selector { 419 case AlertingCondition_FieldPathSelectorMetadata: 420 if source.GetMetadata() == nil { 421 return nil, false 422 } 423 return fps.subPath.GetSingleRaw(source.GetMetadata()) 424 case AlertingCondition_FieldPathSelectorSpec: 425 if source.GetSpec() == nil { 426 return nil, false 427 } 428 return fps.subPath.GetSingleRaw(source.GetSpec()) 429 case AlertingCondition_FieldPathSelectorState: 430 if source.GetState() == nil { 431 return nil, false 432 } 433 return fps.subPath.GetSingleRaw(source.GetState()) 434 default: 435 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fps.selector)) 436 } 437 } 438 439 func (fps *AlertingCondition_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 440 return fps.GetSingle(source.(*AlertingCondition)) 441 } 442 443 // GetDefault returns a default value of the field type 444 func (fps *AlertingCondition_FieldSubPath) GetDefault() interface{} { 445 return fps.subPath.GetDefault() 446 } 447 448 func (fps *AlertingCondition_FieldSubPath) ClearValue(item *AlertingCondition) { 449 if item != nil { 450 switch fps.selector { 451 case AlertingCondition_FieldPathSelectorMetadata: 452 fps.subPath.ClearValueRaw(item.Metadata) 453 case AlertingCondition_FieldPathSelectorSpec: 454 fps.subPath.ClearValueRaw(item.Spec) 455 case AlertingCondition_FieldPathSelectorState: 456 fps.subPath.ClearValueRaw(item.State) 457 default: 458 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fps.selector)) 459 } 460 } 461 } 462 463 func (fps *AlertingCondition_FieldSubPath) ClearValueRaw(item proto.Message) { 464 fps.ClearValue(item.(*AlertingCondition)) 465 } 466 467 // IsLeaf - whether field path is holds simple value 468 func (fps *AlertingCondition_FieldSubPath) IsLeaf() bool { 469 return fps.subPath.IsLeaf() 470 } 471 472 func (fps *AlertingCondition_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 473 iPaths := []gotenobject.FieldPath{&AlertingCondition_FieldTerminalPath{selector: fps.selector}} 474 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 475 return iPaths 476 } 477 478 func (fps *AlertingCondition_FieldSubPath) WithIValue(value interface{}) AlertingCondition_FieldPathValue { 479 return &AlertingCondition_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 480 } 481 482 func (fps *AlertingCondition_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 483 return fps.WithIValue(value) 484 } 485 486 func (fps *AlertingCondition_FieldSubPath) WithIArrayOfValues(values interface{}) AlertingCondition_FieldPathArrayOfValues { 487 return &AlertingCondition_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 488 } 489 490 func (fps *AlertingCondition_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 491 return fps.WithIArrayOfValues(values) 492 } 493 494 func (fps *AlertingCondition_FieldSubPath) WithIArrayItemValue(value interface{}) AlertingCondition_FieldPathArrayItemValue { 495 return &AlertingCondition_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 496 } 497 498 func (fps *AlertingCondition_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 499 return fps.WithIArrayItemValue(value) 500 } 501 502 // AlertingCondition_FieldPathValue allows storing values for AlertingCondition fields according to their type 503 type AlertingCondition_FieldPathValue interface { 504 AlertingCondition_FieldPath 505 gotenobject.FieldPathValue 506 SetTo(target **AlertingCondition) 507 CompareWith(*AlertingCondition) (cmp int, comparable bool) 508 } 509 510 func ParseAlertingCondition_FieldPathValue(pathStr, valueStr string) (AlertingCondition_FieldPathValue, error) { 511 fp, err := ParseAlertingCondition_FieldPath(pathStr) 512 if err != nil { 513 return nil, err 514 } 515 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 516 if err != nil { 517 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingCondition field path value from %s: %v", valueStr, err) 518 } 519 return fpv.(AlertingCondition_FieldPathValue), nil 520 } 521 522 func MustParseAlertingCondition_FieldPathValue(pathStr, valueStr string) AlertingCondition_FieldPathValue { 523 fpv, err := ParseAlertingCondition_FieldPathValue(pathStr, valueStr) 524 if err != nil { 525 panic(err) 526 } 527 return fpv 528 } 529 530 type AlertingCondition_FieldTerminalPathValue struct { 531 AlertingCondition_FieldTerminalPath 532 value interface{} 533 } 534 535 var _ AlertingCondition_FieldPathValue = (*AlertingCondition_FieldTerminalPathValue)(nil) 536 537 // GetRawValue returns raw value stored under selected path for 'AlertingCondition' as interface{} 538 func (fpv *AlertingCondition_FieldTerminalPathValue) GetRawValue() interface{} { 539 return fpv.value 540 } 541 func (fpv *AlertingCondition_FieldTerminalPathValue) AsNameValue() (*Name, bool) { 542 res, ok := fpv.value.(*Name) 543 return res, ok 544 } 545 func (fpv *AlertingCondition_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) { 546 res, ok := fpv.value.(*meta.Meta) 547 return res, ok 548 } 549 func (fpv *AlertingCondition_FieldTerminalPathValue) AsDisplayNameValue() (string, bool) { 550 res, ok := fpv.value.(string) 551 return res, ok 552 } 553 func (fpv *AlertingCondition_FieldTerminalPathValue) AsDescriptionValue() (string, bool) { 554 res, ok := fpv.value.(string) 555 return res, ok 556 } 557 func (fpv *AlertingCondition_FieldTerminalPathValue) AsSpecValue() (*AlertingCondition_Spec, bool) { 558 res, ok := fpv.value.(*AlertingCondition_Spec) 559 return res, ok 560 } 561 func (fpv *AlertingCondition_FieldTerminalPathValue) AsStateValue() (*AlertingCondition_State, bool) { 562 res, ok := fpv.value.(*AlertingCondition_State) 563 return res, ok 564 } 565 566 // SetTo stores value for selected field for object AlertingCondition 567 func (fpv *AlertingCondition_FieldTerminalPathValue) SetTo(target **AlertingCondition) { 568 if *target == nil { 569 *target = new(AlertingCondition) 570 } 571 switch fpv.selector { 572 case AlertingCondition_FieldPathSelectorName: 573 (*target).Name = fpv.value.(*Name) 574 case AlertingCondition_FieldPathSelectorMetadata: 575 (*target).Metadata = fpv.value.(*meta.Meta) 576 case AlertingCondition_FieldPathSelectorDisplayName: 577 (*target).DisplayName = fpv.value.(string) 578 case AlertingCondition_FieldPathSelectorDescription: 579 (*target).Description = fpv.value.(string) 580 case AlertingCondition_FieldPathSelectorSpec: 581 (*target).Spec = fpv.value.(*AlertingCondition_Spec) 582 case AlertingCondition_FieldPathSelectorState: 583 (*target).State = fpv.value.(*AlertingCondition_State) 584 default: 585 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fpv.selector)) 586 } 587 } 588 589 func (fpv *AlertingCondition_FieldTerminalPathValue) SetToRaw(target proto.Message) { 590 typedObject := target.(*AlertingCondition) 591 fpv.SetTo(&typedObject) 592 } 593 594 // CompareWith compares value in the 'AlertingCondition_FieldTerminalPathValue' with the value under path in 'AlertingCondition'. 595 func (fpv *AlertingCondition_FieldTerminalPathValue) CompareWith(source *AlertingCondition) (int, bool) { 596 switch fpv.selector { 597 case AlertingCondition_FieldPathSelectorName: 598 leftValue := fpv.value.(*Name) 599 rightValue := source.GetName() 600 if leftValue == nil { 601 if rightValue != nil { 602 return -1, true 603 } 604 return 0, true 605 } 606 if rightValue == nil { 607 return 1, true 608 } 609 if leftValue.String() == rightValue.String() { 610 return 0, true 611 } else if leftValue.String() < rightValue.String() { 612 return -1, true 613 } else { 614 return 1, true 615 } 616 case AlertingCondition_FieldPathSelectorMetadata: 617 return 0, false 618 case AlertingCondition_FieldPathSelectorDisplayName: 619 leftValue := fpv.value.(string) 620 rightValue := source.GetDisplayName() 621 if (leftValue) == (rightValue) { 622 return 0, true 623 } else if (leftValue) < (rightValue) { 624 return -1, true 625 } else { 626 return 1, true 627 } 628 case AlertingCondition_FieldPathSelectorDescription: 629 leftValue := fpv.value.(string) 630 rightValue := source.GetDescription() 631 if (leftValue) == (rightValue) { 632 return 0, true 633 } else if (leftValue) < (rightValue) { 634 return -1, true 635 } else { 636 return 1, true 637 } 638 case AlertingCondition_FieldPathSelectorSpec: 639 return 0, false 640 case AlertingCondition_FieldPathSelectorState: 641 return 0, false 642 default: 643 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fpv.selector)) 644 } 645 } 646 647 func (fpv *AlertingCondition_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 648 return fpv.CompareWith(source.(*AlertingCondition)) 649 } 650 651 type AlertingCondition_FieldSubPathValue struct { 652 AlertingCondition_FieldPath 653 subPathValue gotenobject.FieldPathValue 654 } 655 656 var _ AlertingCondition_FieldPathValue = (*AlertingCondition_FieldSubPathValue)(nil) 657 658 func (fpvs *AlertingCondition_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) { 659 res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue) 660 return res, ok 661 } 662 func (fpvs *AlertingCondition_FieldSubPathValue) AsSpecPathValue() (AlertingConditionSpec_FieldPathValue, bool) { 663 res, ok := fpvs.subPathValue.(AlertingConditionSpec_FieldPathValue) 664 return res, ok 665 } 666 func (fpvs *AlertingCondition_FieldSubPathValue) AsStatePathValue() (AlertingConditionState_FieldPathValue, bool) { 667 res, ok := fpvs.subPathValue.(AlertingConditionState_FieldPathValue) 668 return res, ok 669 } 670 671 func (fpvs *AlertingCondition_FieldSubPathValue) SetTo(target **AlertingCondition) { 672 if *target == nil { 673 *target = new(AlertingCondition) 674 } 675 switch fpvs.Selector() { 676 case AlertingCondition_FieldPathSelectorMetadata: 677 fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata) 678 case AlertingCondition_FieldPathSelectorSpec: 679 fpvs.subPathValue.(AlertingConditionSpec_FieldPathValue).SetTo(&(*target).Spec) 680 case AlertingCondition_FieldPathSelectorState: 681 fpvs.subPathValue.(AlertingConditionState_FieldPathValue).SetTo(&(*target).State) 682 default: 683 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fpvs.Selector())) 684 } 685 } 686 687 func (fpvs *AlertingCondition_FieldSubPathValue) SetToRaw(target proto.Message) { 688 typedObject := target.(*AlertingCondition) 689 fpvs.SetTo(&typedObject) 690 } 691 692 func (fpvs *AlertingCondition_FieldSubPathValue) GetRawValue() interface{} { 693 return fpvs.subPathValue.GetRawValue() 694 } 695 696 func (fpvs *AlertingCondition_FieldSubPathValue) CompareWith(source *AlertingCondition) (int, bool) { 697 switch fpvs.Selector() { 698 case AlertingCondition_FieldPathSelectorMetadata: 699 return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata()) 700 case AlertingCondition_FieldPathSelectorSpec: 701 return fpvs.subPathValue.(AlertingConditionSpec_FieldPathValue).CompareWith(source.GetSpec()) 702 case AlertingCondition_FieldPathSelectorState: 703 return fpvs.subPathValue.(AlertingConditionState_FieldPathValue).CompareWith(source.GetState()) 704 default: 705 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fpvs.Selector())) 706 } 707 } 708 709 func (fpvs *AlertingCondition_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 710 return fpvs.CompareWith(source.(*AlertingCondition)) 711 } 712 713 // AlertingCondition_FieldPathArrayItemValue allows storing single item in Path-specific values for AlertingCondition according to their type 714 // Present only for array (repeated) types. 715 type AlertingCondition_FieldPathArrayItemValue interface { 716 gotenobject.FieldPathArrayItemValue 717 AlertingCondition_FieldPath 718 ContainsValue(*AlertingCondition) bool 719 } 720 721 // ParseAlertingCondition_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 722 func ParseAlertingCondition_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingCondition_FieldPathArrayItemValue, error) { 723 fp, err := ParseAlertingCondition_FieldPath(pathStr) 724 if err != nil { 725 return nil, err 726 } 727 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 728 if err != nil { 729 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingCondition field path array item value from %s: %v", valueStr, err) 730 } 731 return fpaiv.(AlertingCondition_FieldPathArrayItemValue), nil 732 } 733 734 func MustParseAlertingCondition_FieldPathArrayItemValue(pathStr, valueStr string) AlertingCondition_FieldPathArrayItemValue { 735 fpaiv, err := ParseAlertingCondition_FieldPathArrayItemValue(pathStr, valueStr) 736 if err != nil { 737 panic(err) 738 } 739 return fpaiv 740 } 741 742 type AlertingCondition_FieldTerminalPathArrayItemValue struct { 743 AlertingCondition_FieldTerminalPath 744 value interface{} 745 } 746 747 var _ AlertingCondition_FieldPathArrayItemValue = (*AlertingCondition_FieldTerminalPathArrayItemValue)(nil) 748 749 // GetRawValue returns stored element value for array in object AlertingCondition as interface{} 750 func (fpaiv *AlertingCondition_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 751 return fpaiv.value 752 } 753 754 func (fpaiv *AlertingCondition_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingCondition) (interface{}, bool) { 755 return nil, false 756 } 757 758 func (fpaiv *AlertingCondition_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 759 return fpaiv.GetSingle(source.(*AlertingCondition)) 760 } 761 762 // Contains returns a boolean indicating if value that is being held is present in given 'AlertingCondition' 763 func (fpaiv *AlertingCondition_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingCondition) bool { 764 slice := fpaiv.AlertingCondition_FieldTerminalPath.Get(source) 765 for _, v := range slice { 766 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 767 if proto.Equal(asProtoMsg, v.(proto.Message)) { 768 return true 769 } 770 } else if reflect.DeepEqual(v, fpaiv.value) { 771 return true 772 } 773 } 774 return false 775 } 776 777 type AlertingCondition_FieldSubPathArrayItemValue struct { 778 AlertingCondition_FieldPath 779 subPathItemValue gotenobject.FieldPathArrayItemValue 780 } 781 782 // GetRawValue returns stored array item value 783 func (fpaivs *AlertingCondition_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 784 return fpaivs.subPathItemValue.GetRawItemValue() 785 } 786 func (fpaivs *AlertingCondition_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) { 787 res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue) 788 return res, ok 789 } 790 func (fpaivs *AlertingCondition_FieldSubPathArrayItemValue) AsSpecPathItemValue() (AlertingConditionSpec_FieldPathArrayItemValue, bool) { 791 res, ok := fpaivs.subPathItemValue.(AlertingConditionSpec_FieldPathArrayItemValue) 792 return res, ok 793 } 794 func (fpaivs *AlertingCondition_FieldSubPathArrayItemValue) AsStatePathItemValue() (AlertingConditionState_FieldPathArrayItemValue, bool) { 795 res, ok := fpaivs.subPathItemValue.(AlertingConditionState_FieldPathArrayItemValue) 796 return res, ok 797 } 798 799 // Contains returns a boolean indicating if value that is being held is present in given 'AlertingCondition' 800 func (fpaivs *AlertingCondition_FieldSubPathArrayItemValue) ContainsValue(source *AlertingCondition) bool { 801 switch fpaivs.Selector() { 802 case AlertingCondition_FieldPathSelectorMetadata: 803 return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata()) 804 case AlertingCondition_FieldPathSelectorSpec: 805 return fpaivs.subPathItemValue.(AlertingConditionSpec_FieldPathArrayItemValue).ContainsValue(source.GetSpec()) 806 case AlertingCondition_FieldPathSelectorState: 807 return fpaivs.subPathItemValue.(AlertingConditionState_FieldPathArrayItemValue).ContainsValue(source.GetState()) 808 default: 809 panic(fmt.Sprintf("Invalid selector for AlertingCondition: %d", fpaivs.Selector())) 810 } 811 } 812 813 // AlertingCondition_FieldPathArrayOfValues allows storing slice of values for AlertingCondition fields according to their type 814 type AlertingCondition_FieldPathArrayOfValues interface { 815 gotenobject.FieldPathArrayOfValues 816 AlertingCondition_FieldPath 817 } 818 819 func ParseAlertingCondition_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingCondition_FieldPathArrayOfValues, error) { 820 fp, err := ParseAlertingCondition_FieldPath(pathStr) 821 if err != nil { 822 return nil, err 823 } 824 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 825 if err != nil { 826 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingCondition field path array of values from %s: %v", valuesStr, err) 827 } 828 return fpaov.(AlertingCondition_FieldPathArrayOfValues), nil 829 } 830 831 func MustParseAlertingCondition_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingCondition_FieldPathArrayOfValues { 832 fpaov, err := ParseAlertingCondition_FieldPathArrayOfValues(pathStr, valuesStr) 833 if err != nil { 834 panic(err) 835 } 836 return fpaov 837 } 838 839 type AlertingCondition_FieldTerminalPathArrayOfValues struct { 840 AlertingCondition_FieldTerminalPath 841 values interface{} 842 } 843 844 var _ AlertingCondition_FieldPathArrayOfValues = (*AlertingCondition_FieldTerminalPathArrayOfValues)(nil) 845 846 func (fpaov *AlertingCondition_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 847 switch fpaov.selector { 848 case AlertingCondition_FieldPathSelectorName: 849 for _, v := range fpaov.values.([]*Name) { 850 values = append(values, v) 851 } 852 case AlertingCondition_FieldPathSelectorMetadata: 853 for _, v := range fpaov.values.([]*meta.Meta) { 854 values = append(values, v) 855 } 856 case AlertingCondition_FieldPathSelectorDisplayName: 857 for _, v := range fpaov.values.([]string) { 858 values = append(values, v) 859 } 860 case AlertingCondition_FieldPathSelectorDescription: 861 for _, v := range fpaov.values.([]string) { 862 values = append(values, v) 863 } 864 case AlertingCondition_FieldPathSelectorSpec: 865 for _, v := range fpaov.values.([]*AlertingCondition_Spec) { 866 values = append(values, v) 867 } 868 case AlertingCondition_FieldPathSelectorState: 869 for _, v := range fpaov.values.([]*AlertingCondition_State) { 870 values = append(values, v) 871 } 872 } 873 return 874 } 875 func (fpaov *AlertingCondition_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) { 876 res, ok := fpaov.values.([]*Name) 877 return res, ok 878 } 879 func (fpaov *AlertingCondition_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) { 880 res, ok := fpaov.values.([]*meta.Meta) 881 return res, ok 882 } 883 func (fpaov *AlertingCondition_FieldTerminalPathArrayOfValues) AsDisplayNameArrayOfValues() ([]string, bool) { 884 res, ok := fpaov.values.([]string) 885 return res, ok 886 } 887 func (fpaov *AlertingCondition_FieldTerminalPathArrayOfValues) AsDescriptionArrayOfValues() ([]string, bool) { 888 res, ok := fpaov.values.([]string) 889 return res, ok 890 } 891 func (fpaov *AlertingCondition_FieldTerminalPathArrayOfValues) AsSpecArrayOfValues() ([]*AlertingCondition_Spec, bool) { 892 res, ok := fpaov.values.([]*AlertingCondition_Spec) 893 return res, ok 894 } 895 func (fpaov *AlertingCondition_FieldTerminalPathArrayOfValues) AsStateArrayOfValues() ([]*AlertingCondition_State, bool) { 896 res, ok := fpaov.values.([]*AlertingCondition_State) 897 return res, ok 898 } 899 900 type AlertingCondition_FieldSubPathArrayOfValues struct { 901 AlertingCondition_FieldPath 902 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 903 } 904 905 var _ AlertingCondition_FieldPathArrayOfValues = (*AlertingCondition_FieldSubPathArrayOfValues)(nil) 906 907 func (fpsaov *AlertingCondition_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 908 return fpsaov.subPathArrayOfValues.GetRawValues() 909 } 910 func (fpsaov *AlertingCondition_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) { 911 res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues) 912 return res, ok 913 } 914 func (fpsaov *AlertingCondition_FieldSubPathArrayOfValues) AsSpecPathArrayOfValues() (AlertingConditionSpec_FieldPathArrayOfValues, bool) { 915 res, ok := fpsaov.subPathArrayOfValues.(AlertingConditionSpec_FieldPathArrayOfValues) 916 return res, ok 917 } 918 func (fpsaov *AlertingCondition_FieldSubPathArrayOfValues) AsStatePathArrayOfValues() (AlertingConditionState_FieldPathArrayOfValues, bool) { 919 res, ok := fpsaov.subPathArrayOfValues.(AlertingConditionState_FieldPathArrayOfValues) 920 return res, ok 921 } 922 923 // FieldPath provides implementation to handle 924 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 925 type AlertingConditionSpec_FieldPath interface { 926 gotenobject.FieldPath 927 Selector() AlertingConditionSpec_FieldPathSelector 928 Get(source *AlertingCondition_Spec) []interface{} 929 GetSingle(source *AlertingCondition_Spec) (interface{}, bool) 930 ClearValue(item *AlertingCondition_Spec) 931 932 // Those methods build corresponding AlertingConditionSpec_FieldPathValue 933 // (or array of values) and holds passed value. Panics if injected type is incorrect. 934 WithIValue(value interface{}) AlertingConditionSpec_FieldPathValue 935 WithIArrayOfValues(values interface{}) AlertingConditionSpec_FieldPathArrayOfValues 936 WithIArrayItemValue(value interface{}) AlertingConditionSpec_FieldPathArrayItemValue 937 } 938 939 type AlertingConditionSpec_FieldPathSelector int32 940 941 const ( 942 AlertingConditionSpec_FieldPathSelectorTimeSeries AlertingConditionSpec_FieldPathSelector = 0 943 ) 944 945 func (s AlertingConditionSpec_FieldPathSelector) String() string { 946 switch s { 947 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 948 return "time_series" 949 default: 950 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", s)) 951 } 952 } 953 954 func BuildAlertingConditionSpec_FieldPath(fp gotenobject.RawFieldPath) (AlertingConditionSpec_FieldPath, error) { 955 if len(fp) == 0 { 956 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingCondition_Spec") 957 } 958 if len(fp) == 1 { 959 switch fp[0] { 960 case "time_series", "timeSeries", "time-series": 961 return &AlertingConditionSpec_FieldTerminalPath{selector: AlertingConditionSpec_FieldPathSelectorTimeSeries}, nil 962 } 963 } else { 964 switch fp[0] { 965 case "time_series", "timeSeries", "time-series": 966 if subpath, err := BuildAlertingConditionSpecTimeSeries_FieldPath(fp[1:]); err != nil { 967 return nil, err 968 } else { 969 return &AlertingConditionSpec_FieldSubPath{selector: AlertingConditionSpec_FieldPathSelectorTimeSeries, subPath: subpath}, nil 970 } 971 } 972 } 973 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingCondition_Spec", fp) 974 } 975 976 func ParseAlertingConditionSpec_FieldPath(rawField string) (AlertingConditionSpec_FieldPath, error) { 977 fp, err := gotenobject.ParseRawFieldPath(rawField) 978 if err != nil { 979 return nil, err 980 } 981 return BuildAlertingConditionSpec_FieldPath(fp) 982 } 983 984 func MustParseAlertingConditionSpec_FieldPath(rawField string) AlertingConditionSpec_FieldPath { 985 fp, err := ParseAlertingConditionSpec_FieldPath(rawField) 986 if err != nil { 987 panic(err) 988 } 989 return fp 990 } 991 992 type AlertingConditionSpec_FieldTerminalPath struct { 993 selector AlertingConditionSpec_FieldPathSelector 994 } 995 996 var _ AlertingConditionSpec_FieldPath = (*AlertingConditionSpec_FieldTerminalPath)(nil) 997 998 func (fp *AlertingConditionSpec_FieldTerminalPath) Selector() AlertingConditionSpec_FieldPathSelector { 999 return fp.selector 1000 } 1001 1002 // String returns path representation in proto convention 1003 func (fp *AlertingConditionSpec_FieldTerminalPath) String() string { 1004 return fp.selector.String() 1005 } 1006 1007 // JSONString returns path representation is JSON convention 1008 func (fp *AlertingConditionSpec_FieldTerminalPath) JSONString() string { 1009 return strcase.ToLowerCamel(fp.String()) 1010 } 1011 1012 // Get returns all values pointed by specific field from source AlertingCondition_Spec 1013 func (fp *AlertingConditionSpec_FieldTerminalPath) Get(source *AlertingCondition_Spec) (values []interface{}) { 1014 if source != nil { 1015 switch fp.selector { 1016 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1017 if source.TimeSeries != nil { 1018 values = append(values, source.TimeSeries) 1019 } 1020 default: 1021 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fp.selector)) 1022 } 1023 } 1024 return 1025 } 1026 1027 func (fp *AlertingConditionSpec_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1028 return fp.Get(source.(*AlertingCondition_Spec)) 1029 } 1030 1031 // GetSingle returns value pointed by specific field of from source AlertingCondition_Spec 1032 func (fp *AlertingConditionSpec_FieldTerminalPath) GetSingle(source *AlertingCondition_Spec) (interface{}, bool) { 1033 switch fp.selector { 1034 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1035 res := source.GetTimeSeries() 1036 return res, res != nil 1037 default: 1038 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fp.selector)) 1039 } 1040 } 1041 1042 func (fp *AlertingConditionSpec_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1043 return fp.GetSingle(source.(*AlertingCondition_Spec)) 1044 } 1045 1046 // GetDefault returns a default value of the field type 1047 func (fp *AlertingConditionSpec_FieldTerminalPath) GetDefault() interface{} { 1048 switch fp.selector { 1049 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1050 return (*AlertingCondition_Spec_TimeSeries)(nil) 1051 default: 1052 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fp.selector)) 1053 } 1054 } 1055 1056 func (fp *AlertingConditionSpec_FieldTerminalPath) ClearValue(item *AlertingCondition_Spec) { 1057 if item != nil { 1058 switch fp.selector { 1059 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1060 item.TimeSeries = nil 1061 default: 1062 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fp.selector)) 1063 } 1064 } 1065 } 1066 1067 func (fp *AlertingConditionSpec_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1068 fp.ClearValue(item.(*AlertingCondition_Spec)) 1069 } 1070 1071 // IsLeaf - whether field path is holds simple value 1072 func (fp *AlertingConditionSpec_FieldTerminalPath) IsLeaf() bool { 1073 return false 1074 } 1075 1076 func (fp *AlertingConditionSpec_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1077 return []gotenobject.FieldPath{fp} 1078 } 1079 1080 func (fp *AlertingConditionSpec_FieldTerminalPath) WithIValue(value interface{}) AlertingConditionSpec_FieldPathValue { 1081 switch fp.selector { 1082 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1083 return &AlertingConditionSpec_FieldTerminalPathValue{AlertingConditionSpec_FieldTerminalPath: *fp, value: value.(*AlertingCondition_Spec_TimeSeries)} 1084 default: 1085 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fp.selector)) 1086 } 1087 } 1088 1089 func (fp *AlertingConditionSpec_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1090 return fp.WithIValue(value) 1091 } 1092 1093 func (fp *AlertingConditionSpec_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingConditionSpec_FieldPathArrayOfValues { 1094 fpaov := &AlertingConditionSpec_FieldTerminalPathArrayOfValues{AlertingConditionSpec_FieldTerminalPath: *fp} 1095 switch fp.selector { 1096 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1097 return &AlertingConditionSpec_FieldTerminalPathArrayOfValues{AlertingConditionSpec_FieldTerminalPath: *fp, values: values.([]*AlertingCondition_Spec_TimeSeries)} 1098 default: 1099 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fp.selector)) 1100 } 1101 return fpaov 1102 } 1103 1104 func (fp *AlertingConditionSpec_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1105 return fp.WithIArrayOfValues(values) 1106 } 1107 1108 func (fp *AlertingConditionSpec_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingConditionSpec_FieldPathArrayItemValue { 1109 switch fp.selector { 1110 default: 1111 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fp.selector)) 1112 } 1113 } 1114 1115 func (fp *AlertingConditionSpec_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1116 return fp.WithIArrayItemValue(value) 1117 } 1118 1119 type AlertingConditionSpec_FieldSubPath struct { 1120 selector AlertingConditionSpec_FieldPathSelector 1121 subPath gotenobject.FieldPath 1122 } 1123 1124 var _ AlertingConditionSpec_FieldPath = (*AlertingConditionSpec_FieldSubPath)(nil) 1125 1126 func (fps *AlertingConditionSpec_FieldSubPath) Selector() AlertingConditionSpec_FieldPathSelector { 1127 return fps.selector 1128 } 1129 func (fps *AlertingConditionSpec_FieldSubPath) AsTimeSeriesSubPath() (AlertingConditionSpecTimeSeries_FieldPath, bool) { 1130 res, ok := fps.subPath.(AlertingConditionSpecTimeSeries_FieldPath) 1131 return res, ok 1132 } 1133 1134 // String returns path representation in proto convention 1135 func (fps *AlertingConditionSpec_FieldSubPath) String() string { 1136 return fps.selector.String() + "." + fps.subPath.String() 1137 } 1138 1139 // JSONString returns path representation is JSON convention 1140 func (fps *AlertingConditionSpec_FieldSubPath) JSONString() string { 1141 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 1142 } 1143 1144 // Get returns all values pointed by selected field from source AlertingCondition_Spec 1145 func (fps *AlertingConditionSpec_FieldSubPath) Get(source *AlertingCondition_Spec) (values []interface{}) { 1146 switch fps.selector { 1147 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1148 values = append(values, fps.subPath.GetRaw(source.GetTimeSeries())...) 1149 default: 1150 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fps.selector)) 1151 } 1152 return 1153 } 1154 1155 func (fps *AlertingConditionSpec_FieldSubPath) GetRaw(source proto.Message) []interface{} { 1156 return fps.Get(source.(*AlertingCondition_Spec)) 1157 } 1158 1159 // GetSingle returns value of selected field from source AlertingCondition_Spec 1160 func (fps *AlertingConditionSpec_FieldSubPath) GetSingle(source *AlertingCondition_Spec) (interface{}, bool) { 1161 switch fps.selector { 1162 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1163 if source.GetTimeSeries() == nil { 1164 return nil, false 1165 } 1166 return fps.subPath.GetSingleRaw(source.GetTimeSeries()) 1167 default: 1168 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fps.selector)) 1169 } 1170 } 1171 1172 func (fps *AlertingConditionSpec_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1173 return fps.GetSingle(source.(*AlertingCondition_Spec)) 1174 } 1175 1176 // GetDefault returns a default value of the field type 1177 func (fps *AlertingConditionSpec_FieldSubPath) GetDefault() interface{} { 1178 return fps.subPath.GetDefault() 1179 } 1180 1181 func (fps *AlertingConditionSpec_FieldSubPath) ClearValue(item *AlertingCondition_Spec) { 1182 if item != nil { 1183 switch fps.selector { 1184 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1185 fps.subPath.ClearValueRaw(item.TimeSeries) 1186 default: 1187 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fps.selector)) 1188 } 1189 } 1190 } 1191 1192 func (fps *AlertingConditionSpec_FieldSubPath) ClearValueRaw(item proto.Message) { 1193 fps.ClearValue(item.(*AlertingCondition_Spec)) 1194 } 1195 1196 // IsLeaf - whether field path is holds simple value 1197 func (fps *AlertingConditionSpec_FieldSubPath) IsLeaf() bool { 1198 return fps.subPath.IsLeaf() 1199 } 1200 1201 func (fps *AlertingConditionSpec_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1202 iPaths := []gotenobject.FieldPath{&AlertingConditionSpec_FieldTerminalPath{selector: fps.selector}} 1203 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 1204 return iPaths 1205 } 1206 1207 func (fps *AlertingConditionSpec_FieldSubPath) WithIValue(value interface{}) AlertingConditionSpec_FieldPathValue { 1208 return &AlertingConditionSpec_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 1209 } 1210 1211 func (fps *AlertingConditionSpec_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1212 return fps.WithIValue(value) 1213 } 1214 1215 func (fps *AlertingConditionSpec_FieldSubPath) WithIArrayOfValues(values interface{}) AlertingConditionSpec_FieldPathArrayOfValues { 1216 return &AlertingConditionSpec_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 1217 } 1218 1219 func (fps *AlertingConditionSpec_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1220 return fps.WithIArrayOfValues(values) 1221 } 1222 1223 func (fps *AlertingConditionSpec_FieldSubPath) WithIArrayItemValue(value interface{}) AlertingConditionSpec_FieldPathArrayItemValue { 1224 return &AlertingConditionSpec_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 1225 } 1226 1227 func (fps *AlertingConditionSpec_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1228 return fps.WithIArrayItemValue(value) 1229 } 1230 1231 // AlertingConditionSpec_FieldPathValue allows storing values for Spec fields according to their type 1232 type AlertingConditionSpec_FieldPathValue interface { 1233 AlertingConditionSpec_FieldPath 1234 gotenobject.FieldPathValue 1235 SetTo(target **AlertingCondition_Spec) 1236 CompareWith(*AlertingCondition_Spec) (cmp int, comparable bool) 1237 } 1238 1239 func ParseAlertingConditionSpec_FieldPathValue(pathStr, valueStr string) (AlertingConditionSpec_FieldPathValue, error) { 1240 fp, err := ParseAlertingConditionSpec_FieldPath(pathStr) 1241 if err != nil { 1242 return nil, err 1243 } 1244 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1245 if err != nil { 1246 return nil, status.Errorf(codes.InvalidArgument, "error parsing Spec field path value from %s: %v", valueStr, err) 1247 } 1248 return fpv.(AlertingConditionSpec_FieldPathValue), nil 1249 } 1250 1251 func MustParseAlertingConditionSpec_FieldPathValue(pathStr, valueStr string) AlertingConditionSpec_FieldPathValue { 1252 fpv, err := ParseAlertingConditionSpec_FieldPathValue(pathStr, valueStr) 1253 if err != nil { 1254 panic(err) 1255 } 1256 return fpv 1257 } 1258 1259 type AlertingConditionSpec_FieldTerminalPathValue struct { 1260 AlertingConditionSpec_FieldTerminalPath 1261 value interface{} 1262 } 1263 1264 var _ AlertingConditionSpec_FieldPathValue = (*AlertingConditionSpec_FieldTerminalPathValue)(nil) 1265 1266 // GetRawValue returns raw value stored under selected path for 'Spec' as interface{} 1267 func (fpv *AlertingConditionSpec_FieldTerminalPathValue) GetRawValue() interface{} { 1268 return fpv.value 1269 } 1270 func (fpv *AlertingConditionSpec_FieldTerminalPathValue) AsTimeSeriesValue() (*AlertingCondition_Spec_TimeSeries, bool) { 1271 res, ok := fpv.value.(*AlertingCondition_Spec_TimeSeries) 1272 return res, ok 1273 } 1274 1275 // SetTo stores value for selected field for object Spec 1276 func (fpv *AlertingConditionSpec_FieldTerminalPathValue) SetTo(target **AlertingCondition_Spec) { 1277 if *target == nil { 1278 *target = new(AlertingCondition_Spec) 1279 } 1280 switch fpv.selector { 1281 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1282 (*target).TimeSeries = fpv.value.(*AlertingCondition_Spec_TimeSeries) 1283 default: 1284 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fpv.selector)) 1285 } 1286 } 1287 1288 func (fpv *AlertingConditionSpec_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1289 typedObject := target.(*AlertingCondition_Spec) 1290 fpv.SetTo(&typedObject) 1291 } 1292 1293 // CompareWith compares value in the 'AlertingConditionSpec_FieldTerminalPathValue' with the value under path in 'AlertingCondition_Spec'. 1294 func (fpv *AlertingConditionSpec_FieldTerminalPathValue) CompareWith(source *AlertingCondition_Spec) (int, bool) { 1295 switch fpv.selector { 1296 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1297 return 0, false 1298 default: 1299 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fpv.selector)) 1300 } 1301 } 1302 1303 func (fpv *AlertingConditionSpec_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1304 return fpv.CompareWith(source.(*AlertingCondition_Spec)) 1305 } 1306 1307 type AlertingConditionSpec_FieldSubPathValue struct { 1308 AlertingConditionSpec_FieldPath 1309 subPathValue gotenobject.FieldPathValue 1310 } 1311 1312 var _ AlertingConditionSpec_FieldPathValue = (*AlertingConditionSpec_FieldSubPathValue)(nil) 1313 1314 func (fpvs *AlertingConditionSpec_FieldSubPathValue) AsTimeSeriesPathValue() (AlertingConditionSpecTimeSeries_FieldPathValue, bool) { 1315 res, ok := fpvs.subPathValue.(AlertingConditionSpecTimeSeries_FieldPathValue) 1316 return res, ok 1317 } 1318 1319 func (fpvs *AlertingConditionSpec_FieldSubPathValue) SetTo(target **AlertingCondition_Spec) { 1320 if *target == nil { 1321 *target = new(AlertingCondition_Spec) 1322 } 1323 switch fpvs.Selector() { 1324 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1325 fpvs.subPathValue.(AlertingConditionSpecTimeSeries_FieldPathValue).SetTo(&(*target).TimeSeries) 1326 default: 1327 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fpvs.Selector())) 1328 } 1329 } 1330 1331 func (fpvs *AlertingConditionSpec_FieldSubPathValue) SetToRaw(target proto.Message) { 1332 typedObject := target.(*AlertingCondition_Spec) 1333 fpvs.SetTo(&typedObject) 1334 } 1335 1336 func (fpvs *AlertingConditionSpec_FieldSubPathValue) GetRawValue() interface{} { 1337 return fpvs.subPathValue.GetRawValue() 1338 } 1339 1340 func (fpvs *AlertingConditionSpec_FieldSubPathValue) CompareWith(source *AlertingCondition_Spec) (int, bool) { 1341 switch fpvs.Selector() { 1342 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1343 return fpvs.subPathValue.(AlertingConditionSpecTimeSeries_FieldPathValue).CompareWith(source.GetTimeSeries()) 1344 default: 1345 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fpvs.Selector())) 1346 } 1347 } 1348 1349 func (fpvs *AlertingConditionSpec_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1350 return fpvs.CompareWith(source.(*AlertingCondition_Spec)) 1351 } 1352 1353 // AlertingConditionSpec_FieldPathArrayItemValue allows storing single item in Path-specific values for Spec according to their type 1354 // Present only for array (repeated) types. 1355 type AlertingConditionSpec_FieldPathArrayItemValue interface { 1356 gotenobject.FieldPathArrayItemValue 1357 AlertingConditionSpec_FieldPath 1358 ContainsValue(*AlertingCondition_Spec) bool 1359 } 1360 1361 // ParseAlertingConditionSpec_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1362 func ParseAlertingConditionSpec_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingConditionSpec_FieldPathArrayItemValue, error) { 1363 fp, err := ParseAlertingConditionSpec_FieldPath(pathStr) 1364 if err != nil { 1365 return nil, err 1366 } 1367 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1368 if err != nil { 1369 return nil, status.Errorf(codes.InvalidArgument, "error parsing Spec field path array item value from %s: %v", valueStr, err) 1370 } 1371 return fpaiv.(AlertingConditionSpec_FieldPathArrayItemValue), nil 1372 } 1373 1374 func MustParseAlertingConditionSpec_FieldPathArrayItemValue(pathStr, valueStr string) AlertingConditionSpec_FieldPathArrayItemValue { 1375 fpaiv, err := ParseAlertingConditionSpec_FieldPathArrayItemValue(pathStr, valueStr) 1376 if err != nil { 1377 panic(err) 1378 } 1379 return fpaiv 1380 } 1381 1382 type AlertingConditionSpec_FieldTerminalPathArrayItemValue struct { 1383 AlertingConditionSpec_FieldTerminalPath 1384 value interface{} 1385 } 1386 1387 var _ AlertingConditionSpec_FieldPathArrayItemValue = (*AlertingConditionSpec_FieldTerminalPathArrayItemValue)(nil) 1388 1389 // GetRawValue returns stored element value for array in object AlertingCondition_Spec as interface{} 1390 func (fpaiv *AlertingConditionSpec_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1391 return fpaiv.value 1392 } 1393 1394 func (fpaiv *AlertingConditionSpec_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingCondition_Spec) (interface{}, bool) { 1395 return nil, false 1396 } 1397 1398 func (fpaiv *AlertingConditionSpec_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1399 return fpaiv.GetSingle(source.(*AlertingCondition_Spec)) 1400 } 1401 1402 // Contains returns a boolean indicating if value that is being held is present in given 'Spec' 1403 func (fpaiv *AlertingConditionSpec_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec) bool { 1404 slice := fpaiv.AlertingConditionSpec_FieldTerminalPath.Get(source) 1405 for _, v := range slice { 1406 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1407 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1408 return true 1409 } 1410 } else if reflect.DeepEqual(v, fpaiv.value) { 1411 return true 1412 } 1413 } 1414 return false 1415 } 1416 1417 type AlertingConditionSpec_FieldSubPathArrayItemValue struct { 1418 AlertingConditionSpec_FieldPath 1419 subPathItemValue gotenobject.FieldPathArrayItemValue 1420 } 1421 1422 // GetRawValue returns stored array item value 1423 func (fpaivs *AlertingConditionSpec_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 1424 return fpaivs.subPathItemValue.GetRawItemValue() 1425 } 1426 func (fpaivs *AlertingConditionSpec_FieldSubPathArrayItemValue) AsTimeSeriesPathItemValue() (AlertingConditionSpecTimeSeries_FieldPathArrayItemValue, bool) { 1427 res, ok := fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeries_FieldPathArrayItemValue) 1428 return res, ok 1429 } 1430 1431 // Contains returns a boolean indicating if value that is being held is present in given 'Spec' 1432 func (fpaivs *AlertingConditionSpec_FieldSubPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec) bool { 1433 switch fpaivs.Selector() { 1434 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1435 return fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeries_FieldPathArrayItemValue).ContainsValue(source.GetTimeSeries()) 1436 default: 1437 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec: %d", fpaivs.Selector())) 1438 } 1439 } 1440 1441 // AlertingConditionSpec_FieldPathArrayOfValues allows storing slice of values for Spec fields according to their type 1442 type AlertingConditionSpec_FieldPathArrayOfValues interface { 1443 gotenobject.FieldPathArrayOfValues 1444 AlertingConditionSpec_FieldPath 1445 } 1446 1447 func ParseAlertingConditionSpec_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingConditionSpec_FieldPathArrayOfValues, error) { 1448 fp, err := ParseAlertingConditionSpec_FieldPath(pathStr) 1449 if err != nil { 1450 return nil, err 1451 } 1452 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1453 if err != nil { 1454 return nil, status.Errorf(codes.InvalidArgument, "error parsing Spec field path array of values from %s: %v", valuesStr, err) 1455 } 1456 return fpaov.(AlertingConditionSpec_FieldPathArrayOfValues), nil 1457 } 1458 1459 func MustParseAlertingConditionSpec_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingConditionSpec_FieldPathArrayOfValues { 1460 fpaov, err := ParseAlertingConditionSpec_FieldPathArrayOfValues(pathStr, valuesStr) 1461 if err != nil { 1462 panic(err) 1463 } 1464 return fpaov 1465 } 1466 1467 type AlertingConditionSpec_FieldTerminalPathArrayOfValues struct { 1468 AlertingConditionSpec_FieldTerminalPath 1469 values interface{} 1470 } 1471 1472 var _ AlertingConditionSpec_FieldPathArrayOfValues = (*AlertingConditionSpec_FieldTerminalPathArrayOfValues)(nil) 1473 1474 func (fpaov *AlertingConditionSpec_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1475 switch fpaov.selector { 1476 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 1477 for _, v := range fpaov.values.([]*AlertingCondition_Spec_TimeSeries) { 1478 values = append(values, v) 1479 } 1480 } 1481 return 1482 } 1483 func (fpaov *AlertingConditionSpec_FieldTerminalPathArrayOfValues) AsTimeSeriesArrayOfValues() ([]*AlertingCondition_Spec_TimeSeries, bool) { 1484 res, ok := fpaov.values.([]*AlertingCondition_Spec_TimeSeries) 1485 return res, ok 1486 } 1487 1488 type AlertingConditionSpec_FieldSubPathArrayOfValues struct { 1489 AlertingConditionSpec_FieldPath 1490 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 1491 } 1492 1493 var _ AlertingConditionSpec_FieldPathArrayOfValues = (*AlertingConditionSpec_FieldSubPathArrayOfValues)(nil) 1494 1495 func (fpsaov *AlertingConditionSpec_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 1496 return fpsaov.subPathArrayOfValues.GetRawValues() 1497 } 1498 func (fpsaov *AlertingConditionSpec_FieldSubPathArrayOfValues) AsTimeSeriesPathArrayOfValues() (AlertingConditionSpecTimeSeries_FieldPathArrayOfValues, bool) { 1499 res, ok := fpsaov.subPathArrayOfValues.(AlertingConditionSpecTimeSeries_FieldPathArrayOfValues) 1500 return res, ok 1501 } 1502 1503 // FieldPath provides implementation to handle 1504 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1505 type AlertingConditionState_FieldPath interface { 1506 gotenobject.FieldPath 1507 Selector() AlertingConditionState_FieldPathSelector 1508 Get(source *AlertingCondition_State) []interface{} 1509 GetSingle(source *AlertingCondition_State) (interface{}, bool) 1510 ClearValue(item *AlertingCondition_State) 1511 1512 // Those methods build corresponding AlertingConditionState_FieldPathValue 1513 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1514 WithIValue(value interface{}) AlertingConditionState_FieldPathValue 1515 WithIArrayOfValues(values interface{}) AlertingConditionState_FieldPathArrayOfValues 1516 WithIArrayItemValue(value interface{}) AlertingConditionState_FieldPathArrayItemValue 1517 } 1518 1519 type AlertingConditionState_FieldPathSelector int32 1520 1521 const ( 1522 AlertingConditionState_FieldPathSelectorFiringAlertsCount AlertingConditionState_FieldPathSelector = 0 1523 ) 1524 1525 func (s AlertingConditionState_FieldPathSelector) String() string { 1526 switch s { 1527 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1528 return "firing_alerts_count" 1529 default: 1530 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", s)) 1531 } 1532 } 1533 1534 func BuildAlertingConditionState_FieldPath(fp gotenobject.RawFieldPath) (AlertingConditionState_FieldPath, error) { 1535 if len(fp) == 0 { 1536 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingCondition_State") 1537 } 1538 if len(fp) == 1 { 1539 switch fp[0] { 1540 case "firing_alerts_count", "firingAlertsCount", "firing-alerts-count": 1541 return &AlertingConditionState_FieldTerminalPath{selector: AlertingConditionState_FieldPathSelectorFiringAlertsCount}, nil 1542 } 1543 } 1544 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingCondition_State", fp) 1545 } 1546 1547 func ParseAlertingConditionState_FieldPath(rawField string) (AlertingConditionState_FieldPath, error) { 1548 fp, err := gotenobject.ParseRawFieldPath(rawField) 1549 if err != nil { 1550 return nil, err 1551 } 1552 return BuildAlertingConditionState_FieldPath(fp) 1553 } 1554 1555 func MustParseAlertingConditionState_FieldPath(rawField string) AlertingConditionState_FieldPath { 1556 fp, err := ParseAlertingConditionState_FieldPath(rawField) 1557 if err != nil { 1558 panic(err) 1559 } 1560 return fp 1561 } 1562 1563 type AlertingConditionState_FieldTerminalPath struct { 1564 selector AlertingConditionState_FieldPathSelector 1565 } 1566 1567 var _ AlertingConditionState_FieldPath = (*AlertingConditionState_FieldTerminalPath)(nil) 1568 1569 func (fp *AlertingConditionState_FieldTerminalPath) Selector() AlertingConditionState_FieldPathSelector { 1570 return fp.selector 1571 } 1572 1573 // String returns path representation in proto convention 1574 func (fp *AlertingConditionState_FieldTerminalPath) String() string { 1575 return fp.selector.String() 1576 } 1577 1578 // JSONString returns path representation is JSON convention 1579 func (fp *AlertingConditionState_FieldTerminalPath) JSONString() string { 1580 return strcase.ToLowerCamel(fp.String()) 1581 } 1582 1583 // Get returns all values pointed by specific field from source AlertingCondition_State 1584 func (fp *AlertingConditionState_FieldTerminalPath) Get(source *AlertingCondition_State) (values []interface{}) { 1585 if source != nil { 1586 switch fp.selector { 1587 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1588 values = append(values, source.FiringAlertsCount) 1589 default: 1590 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fp.selector)) 1591 } 1592 } 1593 return 1594 } 1595 1596 func (fp *AlertingConditionState_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1597 return fp.Get(source.(*AlertingCondition_State)) 1598 } 1599 1600 // GetSingle returns value pointed by specific field of from source AlertingCondition_State 1601 func (fp *AlertingConditionState_FieldTerminalPath) GetSingle(source *AlertingCondition_State) (interface{}, bool) { 1602 switch fp.selector { 1603 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1604 return source.GetFiringAlertsCount(), source != nil 1605 default: 1606 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fp.selector)) 1607 } 1608 } 1609 1610 func (fp *AlertingConditionState_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1611 return fp.GetSingle(source.(*AlertingCondition_State)) 1612 } 1613 1614 // GetDefault returns a default value of the field type 1615 func (fp *AlertingConditionState_FieldTerminalPath) GetDefault() interface{} { 1616 switch fp.selector { 1617 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1618 return int64(0) 1619 default: 1620 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fp.selector)) 1621 } 1622 } 1623 1624 func (fp *AlertingConditionState_FieldTerminalPath) ClearValue(item *AlertingCondition_State) { 1625 if item != nil { 1626 switch fp.selector { 1627 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1628 item.FiringAlertsCount = int64(0) 1629 default: 1630 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fp.selector)) 1631 } 1632 } 1633 } 1634 1635 func (fp *AlertingConditionState_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1636 fp.ClearValue(item.(*AlertingCondition_State)) 1637 } 1638 1639 // IsLeaf - whether field path is holds simple value 1640 func (fp *AlertingConditionState_FieldTerminalPath) IsLeaf() bool { 1641 return fp.selector == AlertingConditionState_FieldPathSelectorFiringAlertsCount 1642 } 1643 1644 func (fp *AlertingConditionState_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1645 return []gotenobject.FieldPath{fp} 1646 } 1647 1648 func (fp *AlertingConditionState_FieldTerminalPath) WithIValue(value interface{}) AlertingConditionState_FieldPathValue { 1649 switch fp.selector { 1650 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1651 return &AlertingConditionState_FieldTerminalPathValue{AlertingConditionState_FieldTerminalPath: *fp, value: value.(int64)} 1652 default: 1653 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fp.selector)) 1654 } 1655 } 1656 1657 func (fp *AlertingConditionState_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1658 return fp.WithIValue(value) 1659 } 1660 1661 func (fp *AlertingConditionState_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingConditionState_FieldPathArrayOfValues { 1662 fpaov := &AlertingConditionState_FieldTerminalPathArrayOfValues{AlertingConditionState_FieldTerminalPath: *fp} 1663 switch fp.selector { 1664 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1665 return &AlertingConditionState_FieldTerminalPathArrayOfValues{AlertingConditionState_FieldTerminalPath: *fp, values: values.([]int64)} 1666 default: 1667 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fp.selector)) 1668 } 1669 return fpaov 1670 } 1671 1672 func (fp *AlertingConditionState_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1673 return fp.WithIArrayOfValues(values) 1674 } 1675 1676 func (fp *AlertingConditionState_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingConditionState_FieldPathArrayItemValue { 1677 switch fp.selector { 1678 default: 1679 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fp.selector)) 1680 } 1681 } 1682 1683 func (fp *AlertingConditionState_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1684 return fp.WithIArrayItemValue(value) 1685 } 1686 1687 // AlertingConditionState_FieldPathValue allows storing values for State fields according to their type 1688 type AlertingConditionState_FieldPathValue interface { 1689 AlertingConditionState_FieldPath 1690 gotenobject.FieldPathValue 1691 SetTo(target **AlertingCondition_State) 1692 CompareWith(*AlertingCondition_State) (cmp int, comparable bool) 1693 } 1694 1695 func ParseAlertingConditionState_FieldPathValue(pathStr, valueStr string) (AlertingConditionState_FieldPathValue, error) { 1696 fp, err := ParseAlertingConditionState_FieldPath(pathStr) 1697 if err != nil { 1698 return nil, err 1699 } 1700 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1701 if err != nil { 1702 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path value from %s: %v", valueStr, err) 1703 } 1704 return fpv.(AlertingConditionState_FieldPathValue), nil 1705 } 1706 1707 func MustParseAlertingConditionState_FieldPathValue(pathStr, valueStr string) AlertingConditionState_FieldPathValue { 1708 fpv, err := ParseAlertingConditionState_FieldPathValue(pathStr, valueStr) 1709 if err != nil { 1710 panic(err) 1711 } 1712 return fpv 1713 } 1714 1715 type AlertingConditionState_FieldTerminalPathValue struct { 1716 AlertingConditionState_FieldTerminalPath 1717 value interface{} 1718 } 1719 1720 var _ AlertingConditionState_FieldPathValue = (*AlertingConditionState_FieldTerminalPathValue)(nil) 1721 1722 // GetRawValue returns raw value stored under selected path for 'State' as interface{} 1723 func (fpv *AlertingConditionState_FieldTerminalPathValue) GetRawValue() interface{} { 1724 return fpv.value 1725 } 1726 func (fpv *AlertingConditionState_FieldTerminalPathValue) AsFiringAlertsCountValue() (int64, bool) { 1727 res, ok := fpv.value.(int64) 1728 return res, ok 1729 } 1730 1731 // SetTo stores value for selected field for object State 1732 func (fpv *AlertingConditionState_FieldTerminalPathValue) SetTo(target **AlertingCondition_State) { 1733 if *target == nil { 1734 *target = new(AlertingCondition_State) 1735 } 1736 switch fpv.selector { 1737 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1738 (*target).FiringAlertsCount = fpv.value.(int64) 1739 default: 1740 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fpv.selector)) 1741 } 1742 } 1743 1744 func (fpv *AlertingConditionState_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1745 typedObject := target.(*AlertingCondition_State) 1746 fpv.SetTo(&typedObject) 1747 } 1748 1749 // CompareWith compares value in the 'AlertingConditionState_FieldTerminalPathValue' with the value under path in 'AlertingCondition_State'. 1750 func (fpv *AlertingConditionState_FieldTerminalPathValue) CompareWith(source *AlertingCondition_State) (int, bool) { 1751 switch fpv.selector { 1752 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1753 leftValue := fpv.value.(int64) 1754 rightValue := source.GetFiringAlertsCount() 1755 if (leftValue) == (rightValue) { 1756 return 0, true 1757 } else if (leftValue) < (rightValue) { 1758 return -1, true 1759 } else { 1760 return 1, true 1761 } 1762 default: 1763 panic(fmt.Sprintf("Invalid selector for AlertingCondition_State: %d", fpv.selector)) 1764 } 1765 } 1766 1767 func (fpv *AlertingConditionState_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1768 return fpv.CompareWith(source.(*AlertingCondition_State)) 1769 } 1770 1771 // AlertingConditionState_FieldPathArrayItemValue allows storing single item in Path-specific values for State according to their type 1772 // Present only for array (repeated) types. 1773 type AlertingConditionState_FieldPathArrayItemValue interface { 1774 gotenobject.FieldPathArrayItemValue 1775 AlertingConditionState_FieldPath 1776 ContainsValue(*AlertingCondition_State) bool 1777 } 1778 1779 // ParseAlertingConditionState_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1780 func ParseAlertingConditionState_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingConditionState_FieldPathArrayItemValue, error) { 1781 fp, err := ParseAlertingConditionState_FieldPath(pathStr) 1782 if err != nil { 1783 return nil, err 1784 } 1785 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1786 if err != nil { 1787 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path array item value from %s: %v", valueStr, err) 1788 } 1789 return fpaiv.(AlertingConditionState_FieldPathArrayItemValue), nil 1790 } 1791 1792 func MustParseAlertingConditionState_FieldPathArrayItemValue(pathStr, valueStr string) AlertingConditionState_FieldPathArrayItemValue { 1793 fpaiv, err := ParseAlertingConditionState_FieldPathArrayItemValue(pathStr, valueStr) 1794 if err != nil { 1795 panic(err) 1796 } 1797 return fpaiv 1798 } 1799 1800 type AlertingConditionState_FieldTerminalPathArrayItemValue struct { 1801 AlertingConditionState_FieldTerminalPath 1802 value interface{} 1803 } 1804 1805 var _ AlertingConditionState_FieldPathArrayItemValue = (*AlertingConditionState_FieldTerminalPathArrayItemValue)(nil) 1806 1807 // GetRawValue returns stored element value for array in object AlertingCondition_State as interface{} 1808 func (fpaiv *AlertingConditionState_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1809 return fpaiv.value 1810 } 1811 1812 func (fpaiv *AlertingConditionState_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingCondition_State) (interface{}, bool) { 1813 return nil, false 1814 } 1815 1816 func (fpaiv *AlertingConditionState_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1817 return fpaiv.GetSingle(source.(*AlertingCondition_State)) 1818 } 1819 1820 // Contains returns a boolean indicating if value that is being held is present in given 'State' 1821 func (fpaiv *AlertingConditionState_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingCondition_State) bool { 1822 slice := fpaiv.AlertingConditionState_FieldTerminalPath.Get(source) 1823 for _, v := range slice { 1824 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1825 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1826 return true 1827 } 1828 } else if reflect.DeepEqual(v, fpaiv.value) { 1829 return true 1830 } 1831 } 1832 return false 1833 } 1834 1835 // AlertingConditionState_FieldPathArrayOfValues allows storing slice of values for State fields according to their type 1836 type AlertingConditionState_FieldPathArrayOfValues interface { 1837 gotenobject.FieldPathArrayOfValues 1838 AlertingConditionState_FieldPath 1839 } 1840 1841 func ParseAlertingConditionState_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingConditionState_FieldPathArrayOfValues, error) { 1842 fp, err := ParseAlertingConditionState_FieldPath(pathStr) 1843 if err != nil { 1844 return nil, err 1845 } 1846 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1847 if err != nil { 1848 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path array of values from %s: %v", valuesStr, err) 1849 } 1850 return fpaov.(AlertingConditionState_FieldPathArrayOfValues), nil 1851 } 1852 1853 func MustParseAlertingConditionState_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingConditionState_FieldPathArrayOfValues { 1854 fpaov, err := ParseAlertingConditionState_FieldPathArrayOfValues(pathStr, valuesStr) 1855 if err != nil { 1856 panic(err) 1857 } 1858 return fpaov 1859 } 1860 1861 type AlertingConditionState_FieldTerminalPathArrayOfValues struct { 1862 AlertingConditionState_FieldTerminalPath 1863 values interface{} 1864 } 1865 1866 var _ AlertingConditionState_FieldPathArrayOfValues = (*AlertingConditionState_FieldTerminalPathArrayOfValues)(nil) 1867 1868 func (fpaov *AlertingConditionState_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1869 switch fpaov.selector { 1870 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 1871 for _, v := range fpaov.values.([]int64) { 1872 values = append(values, v) 1873 } 1874 } 1875 return 1876 } 1877 func (fpaov *AlertingConditionState_FieldTerminalPathArrayOfValues) AsFiringAlertsCountArrayOfValues() ([]int64, bool) { 1878 res, ok := fpaov.values.([]int64) 1879 return res, ok 1880 } 1881 1882 // FieldPath provides implementation to handle 1883 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1884 type AlertingConditionSpecTimeSeries_FieldPath interface { 1885 gotenobject.FieldPath 1886 Selector() AlertingConditionSpecTimeSeries_FieldPathSelector 1887 Get(source *AlertingCondition_Spec_TimeSeries) []interface{} 1888 GetSingle(source *AlertingCondition_Spec_TimeSeries) (interface{}, bool) 1889 ClearValue(item *AlertingCondition_Spec_TimeSeries) 1890 1891 // Those methods build corresponding AlertingConditionSpecTimeSeries_FieldPathValue 1892 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1893 WithIValue(value interface{}) AlertingConditionSpecTimeSeries_FieldPathValue 1894 WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeries_FieldPathArrayOfValues 1895 WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeries_FieldPathArrayItemValue 1896 } 1897 1898 type AlertingConditionSpecTimeSeries_FieldPathSelector int32 1899 1900 const ( 1901 AlertingConditionSpecTimeSeries_FieldPathSelectorQuery AlertingConditionSpecTimeSeries_FieldPathSelector = 0 1902 AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold AlertingConditionSpecTimeSeries_FieldPathSelector = 1 1903 AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold AlertingConditionSpecTimeSeries_FieldPathSelector = 2 1904 AlertingConditionSpecTimeSeries_FieldPathSelectorDuration AlertingConditionSpecTimeSeries_FieldPathSelector = 3 1905 ) 1906 1907 func (s AlertingConditionSpecTimeSeries_FieldPathSelector) String() string { 1908 switch s { 1909 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 1910 return "query" 1911 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 1912 return "threshold" 1913 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 1914 return "combine_threshold" 1915 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 1916 return "duration" 1917 default: 1918 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", s)) 1919 } 1920 } 1921 1922 func BuildAlertingConditionSpecTimeSeries_FieldPath(fp gotenobject.RawFieldPath) (AlertingConditionSpecTimeSeries_FieldPath, error) { 1923 if len(fp) == 0 { 1924 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingCondition_Spec_TimeSeries") 1925 } 1926 if len(fp) == 1 { 1927 switch fp[0] { 1928 case "query": 1929 return &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorQuery}, nil 1930 case "threshold": 1931 return &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold}, nil 1932 case "combine_threshold", "combineThreshold", "combine-threshold": 1933 return &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold}, nil 1934 case "duration": 1935 return &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorDuration}, nil 1936 } 1937 } else { 1938 switch fp[0] { 1939 case "query": 1940 if subpath, err := BuildAlertingConditionSpecTimeSeriesQuery_FieldPath(fp[1:]); err != nil { 1941 return nil, err 1942 } else { 1943 return &AlertingConditionSpecTimeSeries_FieldSubPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorQuery, subPath: subpath}, nil 1944 } 1945 case "threshold": 1946 if subpath, err := BuildAlertingConditionSpecTimeSeriesThreshold_FieldPath(fp[1:]); err != nil { 1947 return nil, err 1948 } else { 1949 return &AlertingConditionSpecTimeSeries_FieldSubPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold, subPath: subpath}, nil 1950 } 1951 case "combine_threshold", "combineThreshold", "combine-threshold": 1952 if subpath, err := BuildAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(fp[1:]); err != nil { 1953 return nil, err 1954 } else { 1955 return &AlertingConditionSpecTimeSeries_FieldSubPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold, subPath: subpath}, nil 1956 } 1957 } 1958 } 1959 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingCondition_Spec_TimeSeries", fp) 1960 } 1961 1962 func ParseAlertingConditionSpecTimeSeries_FieldPath(rawField string) (AlertingConditionSpecTimeSeries_FieldPath, error) { 1963 fp, err := gotenobject.ParseRawFieldPath(rawField) 1964 if err != nil { 1965 return nil, err 1966 } 1967 return BuildAlertingConditionSpecTimeSeries_FieldPath(fp) 1968 } 1969 1970 func MustParseAlertingConditionSpecTimeSeries_FieldPath(rawField string) AlertingConditionSpecTimeSeries_FieldPath { 1971 fp, err := ParseAlertingConditionSpecTimeSeries_FieldPath(rawField) 1972 if err != nil { 1973 panic(err) 1974 } 1975 return fp 1976 } 1977 1978 type AlertingConditionSpecTimeSeries_FieldTerminalPath struct { 1979 selector AlertingConditionSpecTimeSeries_FieldPathSelector 1980 } 1981 1982 var _ AlertingConditionSpecTimeSeries_FieldPath = (*AlertingConditionSpecTimeSeries_FieldTerminalPath)(nil) 1983 1984 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) Selector() AlertingConditionSpecTimeSeries_FieldPathSelector { 1985 return fp.selector 1986 } 1987 1988 // String returns path representation in proto convention 1989 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) String() string { 1990 return fp.selector.String() 1991 } 1992 1993 // JSONString returns path representation is JSON convention 1994 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) JSONString() string { 1995 return strcase.ToLowerCamel(fp.String()) 1996 } 1997 1998 // Get returns all values pointed by specific field from source AlertingCondition_Spec_TimeSeries 1999 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) Get(source *AlertingCondition_Spec_TimeSeries) (values []interface{}) { 2000 if source != nil { 2001 switch fp.selector { 2002 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2003 if source.Query != nil { 2004 values = append(values, source.Query) 2005 } 2006 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2007 if source.Threshold != nil { 2008 values = append(values, source.Threshold) 2009 } 2010 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2011 if source.CombineThreshold != nil { 2012 values = append(values, source.CombineThreshold) 2013 } 2014 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2015 if source.Duration != nil { 2016 values = append(values, source.Duration) 2017 } 2018 default: 2019 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fp.selector)) 2020 } 2021 } 2022 return 2023 } 2024 2025 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2026 return fp.Get(source.(*AlertingCondition_Spec_TimeSeries)) 2027 } 2028 2029 // GetSingle returns value pointed by specific field of from source AlertingCondition_Spec_TimeSeries 2030 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) GetSingle(source *AlertingCondition_Spec_TimeSeries) (interface{}, bool) { 2031 switch fp.selector { 2032 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2033 res := source.GetQuery() 2034 return res, res != nil 2035 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2036 res := source.GetThreshold() 2037 return res, res != nil 2038 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2039 res := source.GetCombineThreshold() 2040 return res, res != nil 2041 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2042 res := source.GetDuration() 2043 return res, res != nil 2044 default: 2045 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fp.selector)) 2046 } 2047 } 2048 2049 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2050 return fp.GetSingle(source.(*AlertingCondition_Spec_TimeSeries)) 2051 } 2052 2053 // GetDefault returns a default value of the field type 2054 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) GetDefault() interface{} { 2055 switch fp.selector { 2056 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2057 return (*AlertingCondition_Spec_TimeSeries_Query)(nil) 2058 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2059 return (*AlertingCondition_Spec_TimeSeries_Threshold)(nil) 2060 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2061 return (*AlertingCondition_Spec_TimeSeries_CombineThreshold)(nil) 2062 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2063 return (*durationpb.Duration)(nil) 2064 default: 2065 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fp.selector)) 2066 } 2067 } 2068 2069 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) ClearValue(item *AlertingCondition_Spec_TimeSeries) { 2070 if item != nil { 2071 switch fp.selector { 2072 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2073 item.Query = nil 2074 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2075 item.Threshold = nil 2076 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2077 item.CombineThreshold = nil 2078 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2079 item.Duration = nil 2080 default: 2081 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fp.selector)) 2082 } 2083 } 2084 } 2085 2086 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2087 fp.ClearValue(item.(*AlertingCondition_Spec_TimeSeries)) 2088 } 2089 2090 // IsLeaf - whether field path is holds simple value 2091 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) IsLeaf() bool { 2092 return fp.selector == AlertingConditionSpecTimeSeries_FieldPathSelectorDuration 2093 } 2094 2095 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2096 return []gotenobject.FieldPath{fp} 2097 } 2098 2099 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) WithIValue(value interface{}) AlertingConditionSpecTimeSeries_FieldPathValue { 2100 switch fp.selector { 2101 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2102 return &AlertingConditionSpecTimeSeries_FieldTerminalPathValue{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, value: value.(*AlertingCondition_Spec_TimeSeries_Query)} 2103 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2104 return &AlertingConditionSpecTimeSeries_FieldTerminalPathValue{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, value: value.(*AlertingCondition_Spec_TimeSeries_Threshold)} 2105 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2106 return &AlertingConditionSpecTimeSeries_FieldTerminalPathValue{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, value: value.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)} 2107 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2108 return &AlertingConditionSpecTimeSeries_FieldTerminalPathValue{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 2109 default: 2110 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fp.selector)) 2111 } 2112 } 2113 2114 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2115 return fp.WithIValue(value) 2116 } 2117 2118 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeries_FieldPathArrayOfValues { 2119 fpaov := &AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp} 2120 switch fp.selector { 2121 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2122 return &AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, values: values.([]*AlertingCondition_Spec_TimeSeries_Query)} 2123 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2124 return &AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, values: values.([]*AlertingCondition_Spec_TimeSeries_Threshold)} 2125 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2126 return &AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, values: values.([]*AlertingCondition_Spec_TimeSeries_CombineThreshold)} 2127 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2128 return &AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeries_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 2129 default: 2130 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fp.selector)) 2131 } 2132 return fpaov 2133 } 2134 2135 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2136 return fp.WithIArrayOfValues(values) 2137 } 2138 2139 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeries_FieldPathArrayItemValue { 2140 switch fp.selector { 2141 default: 2142 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fp.selector)) 2143 } 2144 } 2145 2146 func (fp *AlertingConditionSpecTimeSeries_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2147 return fp.WithIArrayItemValue(value) 2148 } 2149 2150 type AlertingConditionSpecTimeSeries_FieldSubPath struct { 2151 selector AlertingConditionSpecTimeSeries_FieldPathSelector 2152 subPath gotenobject.FieldPath 2153 } 2154 2155 var _ AlertingConditionSpecTimeSeries_FieldPath = (*AlertingConditionSpecTimeSeries_FieldSubPath)(nil) 2156 2157 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) Selector() AlertingConditionSpecTimeSeries_FieldPathSelector { 2158 return fps.selector 2159 } 2160 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) AsQuerySubPath() (AlertingConditionSpecTimeSeriesQuery_FieldPath, bool) { 2161 res, ok := fps.subPath.(AlertingConditionSpecTimeSeriesQuery_FieldPath) 2162 return res, ok 2163 } 2164 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) AsThresholdSubPath() (AlertingConditionSpecTimeSeriesThreshold_FieldPath, bool) { 2165 res, ok := fps.subPath.(AlertingConditionSpecTimeSeriesThreshold_FieldPath) 2166 return res, ok 2167 } 2168 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) AsCombineThresholdSubPath() (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath, bool) { 2169 res, ok := fps.subPath.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath) 2170 return res, ok 2171 } 2172 2173 // String returns path representation in proto convention 2174 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) String() string { 2175 return fps.selector.String() + "." + fps.subPath.String() 2176 } 2177 2178 // JSONString returns path representation is JSON convention 2179 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) JSONString() string { 2180 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2181 } 2182 2183 // Get returns all values pointed by selected field from source AlertingCondition_Spec_TimeSeries 2184 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) Get(source *AlertingCondition_Spec_TimeSeries) (values []interface{}) { 2185 switch fps.selector { 2186 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2187 values = append(values, fps.subPath.GetRaw(source.GetQuery())...) 2188 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2189 values = append(values, fps.subPath.GetRaw(source.GetThreshold())...) 2190 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2191 values = append(values, fps.subPath.GetRaw(source.GetCombineThreshold())...) 2192 default: 2193 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fps.selector)) 2194 } 2195 return 2196 } 2197 2198 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2199 return fps.Get(source.(*AlertingCondition_Spec_TimeSeries)) 2200 } 2201 2202 // GetSingle returns value of selected field from source AlertingCondition_Spec_TimeSeries 2203 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) GetSingle(source *AlertingCondition_Spec_TimeSeries) (interface{}, bool) { 2204 switch fps.selector { 2205 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2206 if source.GetQuery() == nil { 2207 return nil, false 2208 } 2209 return fps.subPath.GetSingleRaw(source.GetQuery()) 2210 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2211 if source.GetThreshold() == nil { 2212 return nil, false 2213 } 2214 return fps.subPath.GetSingleRaw(source.GetThreshold()) 2215 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2216 if source.GetCombineThreshold() == nil { 2217 return nil, false 2218 } 2219 return fps.subPath.GetSingleRaw(source.GetCombineThreshold()) 2220 default: 2221 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fps.selector)) 2222 } 2223 } 2224 2225 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2226 return fps.GetSingle(source.(*AlertingCondition_Spec_TimeSeries)) 2227 } 2228 2229 // GetDefault returns a default value of the field type 2230 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) GetDefault() interface{} { 2231 return fps.subPath.GetDefault() 2232 } 2233 2234 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) ClearValue(item *AlertingCondition_Spec_TimeSeries) { 2235 if item != nil { 2236 switch fps.selector { 2237 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2238 fps.subPath.ClearValueRaw(item.Query) 2239 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2240 fps.subPath.ClearValueRaw(item.Threshold) 2241 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2242 fps.subPath.ClearValueRaw(item.CombineThreshold) 2243 default: 2244 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fps.selector)) 2245 } 2246 } 2247 } 2248 2249 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) ClearValueRaw(item proto.Message) { 2250 fps.ClearValue(item.(*AlertingCondition_Spec_TimeSeries)) 2251 } 2252 2253 // IsLeaf - whether field path is holds simple value 2254 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) IsLeaf() bool { 2255 return fps.subPath.IsLeaf() 2256 } 2257 2258 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2259 iPaths := []gotenobject.FieldPath{&AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: fps.selector}} 2260 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2261 return iPaths 2262 } 2263 2264 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) WithIValue(value interface{}) AlertingConditionSpecTimeSeries_FieldPathValue { 2265 return &AlertingConditionSpecTimeSeries_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2266 } 2267 2268 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2269 return fps.WithIValue(value) 2270 } 2271 2272 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeries_FieldPathArrayOfValues { 2273 return &AlertingConditionSpecTimeSeries_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2274 } 2275 2276 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2277 return fps.WithIArrayOfValues(values) 2278 } 2279 2280 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeries_FieldPathArrayItemValue { 2281 return &AlertingConditionSpecTimeSeries_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2282 } 2283 2284 func (fps *AlertingConditionSpecTimeSeries_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2285 return fps.WithIArrayItemValue(value) 2286 } 2287 2288 // AlertingConditionSpecTimeSeries_FieldPathValue allows storing values for TimeSeries fields according to their type 2289 type AlertingConditionSpecTimeSeries_FieldPathValue interface { 2290 AlertingConditionSpecTimeSeries_FieldPath 2291 gotenobject.FieldPathValue 2292 SetTo(target **AlertingCondition_Spec_TimeSeries) 2293 CompareWith(*AlertingCondition_Spec_TimeSeries) (cmp int, comparable bool) 2294 } 2295 2296 func ParseAlertingConditionSpecTimeSeries_FieldPathValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeries_FieldPathValue, error) { 2297 fp, err := ParseAlertingConditionSpecTimeSeries_FieldPath(pathStr) 2298 if err != nil { 2299 return nil, err 2300 } 2301 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2302 if err != nil { 2303 return nil, status.Errorf(codes.InvalidArgument, "error parsing TimeSeries field path value from %s: %v", valueStr, err) 2304 } 2305 return fpv.(AlertingConditionSpecTimeSeries_FieldPathValue), nil 2306 } 2307 2308 func MustParseAlertingConditionSpecTimeSeries_FieldPathValue(pathStr, valueStr string) AlertingConditionSpecTimeSeries_FieldPathValue { 2309 fpv, err := ParseAlertingConditionSpecTimeSeries_FieldPathValue(pathStr, valueStr) 2310 if err != nil { 2311 panic(err) 2312 } 2313 return fpv 2314 } 2315 2316 type AlertingConditionSpecTimeSeries_FieldTerminalPathValue struct { 2317 AlertingConditionSpecTimeSeries_FieldTerminalPath 2318 value interface{} 2319 } 2320 2321 var _ AlertingConditionSpecTimeSeries_FieldPathValue = (*AlertingConditionSpecTimeSeries_FieldTerminalPathValue)(nil) 2322 2323 // GetRawValue returns raw value stored under selected path for 'TimeSeries' as interface{} 2324 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) GetRawValue() interface{} { 2325 return fpv.value 2326 } 2327 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) AsQueryValue() (*AlertingCondition_Spec_TimeSeries_Query, bool) { 2328 res, ok := fpv.value.(*AlertingCondition_Spec_TimeSeries_Query) 2329 return res, ok 2330 } 2331 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) AsThresholdValue() (*AlertingCondition_Spec_TimeSeries_Threshold, bool) { 2332 res, ok := fpv.value.(*AlertingCondition_Spec_TimeSeries_Threshold) 2333 return res, ok 2334 } 2335 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) AsCombineThresholdValue() (*AlertingCondition_Spec_TimeSeries_CombineThreshold, bool) { 2336 res, ok := fpv.value.(*AlertingCondition_Spec_TimeSeries_CombineThreshold) 2337 return res, ok 2338 } 2339 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) AsDurationValue() (*durationpb.Duration, bool) { 2340 res, ok := fpv.value.(*durationpb.Duration) 2341 return res, ok 2342 } 2343 2344 // SetTo stores value for selected field for object TimeSeries 2345 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) SetTo(target **AlertingCondition_Spec_TimeSeries) { 2346 if *target == nil { 2347 *target = new(AlertingCondition_Spec_TimeSeries) 2348 } 2349 switch fpv.selector { 2350 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2351 (*target).Query = fpv.value.(*AlertingCondition_Spec_TimeSeries_Query) 2352 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2353 (*target).Threshold = fpv.value.(*AlertingCondition_Spec_TimeSeries_Threshold) 2354 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2355 (*target).CombineThreshold = fpv.value.(*AlertingCondition_Spec_TimeSeries_CombineThreshold) 2356 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2357 (*target).Duration = fpv.value.(*durationpb.Duration) 2358 default: 2359 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fpv.selector)) 2360 } 2361 } 2362 2363 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2364 typedObject := target.(*AlertingCondition_Spec_TimeSeries) 2365 fpv.SetTo(&typedObject) 2366 } 2367 2368 // CompareWith compares value in the 'AlertingConditionSpecTimeSeries_FieldTerminalPathValue' with the value under path in 'AlertingCondition_Spec_TimeSeries'. 2369 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) CompareWith(source *AlertingCondition_Spec_TimeSeries) (int, bool) { 2370 switch fpv.selector { 2371 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2372 return 0, false 2373 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2374 return 0, false 2375 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2376 return 0, false 2377 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2378 leftValue := fpv.value.(*durationpb.Duration) 2379 rightValue := source.GetDuration() 2380 if leftValue == nil { 2381 if rightValue != nil { 2382 return -1, true 2383 } 2384 return 0, true 2385 } 2386 if rightValue == nil { 2387 return 1, true 2388 } 2389 if leftValue.AsDuration() == rightValue.AsDuration() { 2390 return 0, true 2391 } else if leftValue.AsDuration() < rightValue.AsDuration() { 2392 return -1, true 2393 } else { 2394 return 1, true 2395 } 2396 default: 2397 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fpv.selector)) 2398 } 2399 } 2400 2401 func (fpv *AlertingConditionSpecTimeSeries_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2402 return fpv.CompareWith(source.(*AlertingCondition_Spec_TimeSeries)) 2403 } 2404 2405 type AlertingConditionSpecTimeSeries_FieldSubPathValue struct { 2406 AlertingConditionSpecTimeSeries_FieldPath 2407 subPathValue gotenobject.FieldPathValue 2408 } 2409 2410 var _ AlertingConditionSpecTimeSeries_FieldPathValue = (*AlertingConditionSpecTimeSeries_FieldSubPathValue)(nil) 2411 2412 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) AsQueryPathValue() (AlertingConditionSpecTimeSeriesQuery_FieldPathValue, bool) { 2413 res, ok := fpvs.subPathValue.(AlertingConditionSpecTimeSeriesQuery_FieldPathValue) 2414 return res, ok 2415 } 2416 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) AsThresholdPathValue() (AlertingConditionSpecTimeSeriesThreshold_FieldPathValue, bool) { 2417 res, ok := fpvs.subPathValue.(AlertingConditionSpecTimeSeriesThreshold_FieldPathValue) 2418 return res, ok 2419 } 2420 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) AsCombineThresholdPathValue() (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue, bool) { 2421 res, ok := fpvs.subPathValue.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue) 2422 return res, ok 2423 } 2424 2425 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) SetTo(target **AlertingCondition_Spec_TimeSeries) { 2426 if *target == nil { 2427 *target = new(AlertingCondition_Spec_TimeSeries) 2428 } 2429 switch fpvs.Selector() { 2430 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2431 fpvs.subPathValue.(AlertingConditionSpecTimeSeriesQuery_FieldPathValue).SetTo(&(*target).Query) 2432 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2433 fpvs.subPathValue.(AlertingConditionSpecTimeSeriesThreshold_FieldPathValue).SetTo(&(*target).Threshold) 2434 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2435 fpvs.subPathValue.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue).SetTo(&(*target).CombineThreshold) 2436 default: 2437 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fpvs.Selector())) 2438 } 2439 } 2440 2441 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) SetToRaw(target proto.Message) { 2442 typedObject := target.(*AlertingCondition_Spec_TimeSeries) 2443 fpvs.SetTo(&typedObject) 2444 } 2445 2446 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) GetRawValue() interface{} { 2447 return fpvs.subPathValue.GetRawValue() 2448 } 2449 2450 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) CompareWith(source *AlertingCondition_Spec_TimeSeries) (int, bool) { 2451 switch fpvs.Selector() { 2452 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2453 return fpvs.subPathValue.(AlertingConditionSpecTimeSeriesQuery_FieldPathValue).CompareWith(source.GetQuery()) 2454 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2455 return fpvs.subPathValue.(AlertingConditionSpecTimeSeriesThreshold_FieldPathValue).CompareWith(source.GetThreshold()) 2456 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2457 return fpvs.subPathValue.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue).CompareWith(source.GetCombineThreshold()) 2458 default: 2459 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fpvs.Selector())) 2460 } 2461 } 2462 2463 func (fpvs *AlertingConditionSpecTimeSeries_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2464 return fpvs.CompareWith(source.(*AlertingCondition_Spec_TimeSeries)) 2465 } 2466 2467 // AlertingConditionSpecTimeSeries_FieldPathArrayItemValue allows storing single item in Path-specific values for TimeSeries according to their type 2468 // Present only for array (repeated) types. 2469 type AlertingConditionSpecTimeSeries_FieldPathArrayItemValue interface { 2470 gotenobject.FieldPathArrayItemValue 2471 AlertingConditionSpecTimeSeries_FieldPath 2472 ContainsValue(*AlertingCondition_Spec_TimeSeries) bool 2473 } 2474 2475 // ParseAlertingConditionSpecTimeSeries_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2476 func ParseAlertingConditionSpecTimeSeries_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeries_FieldPathArrayItemValue, error) { 2477 fp, err := ParseAlertingConditionSpecTimeSeries_FieldPath(pathStr) 2478 if err != nil { 2479 return nil, err 2480 } 2481 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2482 if err != nil { 2483 return nil, status.Errorf(codes.InvalidArgument, "error parsing TimeSeries field path array item value from %s: %v", valueStr, err) 2484 } 2485 return fpaiv.(AlertingConditionSpecTimeSeries_FieldPathArrayItemValue), nil 2486 } 2487 2488 func MustParseAlertingConditionSpecTimeSeries_FieldPathArrayItemValue(pathStr, valueStr string) AlertingConditionSpecTimeSeries_FieldPathArrayItemValue { 2489 fpaiv, err := ParseAlertingConditionSpecTimeSeries_FieldPathArrayItemValue(pathStr, valueStr) 2490 if err != nil { 2491 panic(err) 2492 } 2493 return fpaiv 2494 } 2495 2496 type AlertingConditionSpecTimeSeries_FieldTerminalPathArrayItemValue struct { 2497 AlertingConditionSpecTimeSeries_FieldTerminalPath 2498 value interface{} 2499 } 2500 2501 var _ AlertingConditionSpecTimeSeries_FieldPathArrayItemValue = (*AlertingConditionSpecTimeSeries_FieldTerminalPathArrayItemValue)(nil) 2502 2503 // GetRawValue returns stored element value for array in object AlertingCondition_Spec_TimeSeries as interface{} 2504 func (fpaiv *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2505 return fpaiv.value 2506 } 2507 2508 func (fpaiv *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingCondition_Spec_TimeSeries) (interface{}, bool) { 2509 return nil, false 2510 } 2511 2512 func (fpaiv *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2513 return fpaiv.GetSingle(source.(*AlertingCondition_Spec_TimeSeries)) 2514 } 2515 2516 // Contains returns a boolean indicating if value that is being held is present in given 'TimeSeries' 2517 func (fpaiv *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec_TimeSeries) bool { 2518 slice := fpaiv.AlertingConditionSpecTimeSeries_FieldTerminalPath.Get(source) 2519 for _, v := range slice { 2520 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2521 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2522 return true 2523 } 2524 } else if reflect.DeepEqual(v, fpaiv.value) { 2525 return true 2526 } 2527 } 2528 return false 2529 } 2530 2531 type AlertingConditionSpecTimeSeries_FieldSubPathArrayItemValue struct { 2532 AlertingConditionSpecTimeSeries_FieldPath 2533 subPathItemValue gotenobject.FieldPathArrayItemValue 2534 } 2535 2536 // GetRawValue returns stored array item value 2537 func (fpaivs *AlertingConditionSpecTimeSeries_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2538 return fpaivs.subPathItemValue.GetRawItemValue() 2539 } 2540 func (fpaivs *AlertingConditionSpecTimeSeries_FieldSubPathArrayItemValue) AsQueryPathItemValue() (AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue, bool) { 2541 res, ok := fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue) 2542 return res, ok 2543 } 2544 func (fpaivs *AlertingConditionSpecTimeSeries_FieldSubPathArrayItemValue) AsThresholdPathItemValue() (AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue, bool) { 2545 res, ok := fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue) 2546 return res, ok 2547 } 2548 func (fpaivs *AlertingConditionSpecTimeSeries_FieldSubPathArrayItemValue) AsCombineThresholdPathItemValue() (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue, bool) { 2549 res, ok := fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue) 2550 return res, ok 2551 } 2552 2553 // Contains returns a boolean indicating if value that is being held is present in given 'TimeSeries' 2554 func (fpaivs *AlertingConditionSpecTimeSeries_FieldSubPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec_TimeSeries) bool { 2555 switch fpaivs.Selector() { 2556 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2557 return fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue).ContainsValue(source.GetQuery()) 2558 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2559 return fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue).ContainsValue(source.GetThreshold()) 2560 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2561 return fpaivs.subPathItemValue.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue).ContainsValue(source.GetCombineThreshold()) 2562 default: 2563 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries: %d", fpaivs.Selector())) 2564 } 2565 } 2566 2567 // AlertingConditionSpecTimeSeries_FieldPathArrayOfValues allows storing slice of values for TimeSeries fields according to their type 2568 type AlertingConditionSpecTimeSeries_FieldPathArrayOfValues interface { 2569 gotenobject.FieldPathArrayOfValues 2570 AlertingConditionSpecTimeSeries_FieldPath 2571 } 2572 2573 func ParseAlertingConditionSpecTimeSeries_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingConditionSpecTimeSeries_FieldPathArrayOfValues, error) { 2574 fp, err := ParseAlertingConditionSpecTimeSeries_FieldPath(pathStr) 2575 if err != nil { 2576 return nil, err 2577 } 2578 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2579 if err != nil { 2580 return nil, status.Errorf(codes.InvalidArgument, "error parsing TimeSeries field path array of values from %s: %v", valuesStr, err) 2581 } 2582 return fpaov.(AlertingConditionSpecTimeSeries_FieldPathArrayOfValues), nil 2583 } 2584 2585 func MustParseAlertingConditionSpecTimeSeries_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingConditionSpecTimeSeries_FieldPathArrayOfValues { 2586 fpaov, err := ParseAlertingConditionSpecTimeSeries_FieldPathArrayOfValues(pathStr, valuesStr) 2587 if err != nil { 2588 panic(err) 2589 } 2590 return fpaov 2591 } 2592 2593 type AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues struct { 2594 AlertingConditionSpecTimeSeries_FieldTerminalPath 2595 values interface{} 2596 } 2597 2598 var _ AlertingConditionSpecTimeSeries_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues)(nil) 2599 2600 func (fpaov *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2601 switch fpaov.selector { 2602 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 2603 for _, v := range fpaov.values.([]*AlertingCondition_Spec_TimeSeries_Query) { 2604 values = append(values, v) 2605 } 2606 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 2607 for _, v := range fpaov.values.([]*AlertingCondition_Spec_TimeSeries_Threshold) { 2608 values = append(values, v) 2609 } 2610 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 2611 for _, v := range fpaov.values.([]*AlertingCondition_Spec_TimeSeries_CombineThreshold) { 2612 values = append(values, v) 2613 } 2614 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 2615 for _, v := range fpaov.values.([]*durationpb.Duration) { 2616 values = append(values, v) 2617 } 2618 } 2619 return 2620 } 2621 func (fpaov *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues) AsQueryArrayOfValues() ([]*AlertingCondition_Spec_TimeSeries_Query, bool) { 2622 res, ok := fpaov.values.([]*AlertingCondition_Spec_TimeSeries_Query) 2623 return res, ok 2624 } 2625 func (fpaov *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues) AsThresholdArrayOfValues() ([]*AlertingCondition_Spec_TimeSeries_Threshold, bool) { 2626 res, ok := fpaov.values.([]*AlertingCondition_Spec_TimeSeries_Threshold) 2627 return res, ok 2628 } 2629 func (fpaov *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues) AsCombineThresholdArrayOfValues() ([]*AlertingCondition_Spec_TimeSeries_CombineThreshold, bool) { 2630 res, ok := fpaov.values.([]*AlertingCondition_Spec_TimeSeries_CombineThreshold) 2631 return res, ok 2632 } 2633 func (fpaov *AlertingConditionSpecTimeSeries_FieldTerminalPathArrayOfValues) AsDurationArrayOfValues() ([]*durationpb.Duration, bool) { 2634 res, ok := fpaov.values.([]*durationpb.Duration) 2635 return res, ok 2636 } 2637 2638 type AlertingConditionSpecTimeSeries_FieldSubPathArrayOfValues struct { 2639 AlertingConditionSpecTimeSeries_FieldPath 2640 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2641 } 2642 2643 var _ AlertingConditionSpecTimeSeries_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeries_FieldSubPathArrayOfValues)(nil) 2644 2645 func (fpsaov *AlertingConditionSpecTimeSeries_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2646 return fpsaov.subPathArrayOfValues.GetRawValues() 2647 } 2648 func (fpsaov *AlertingConditionSpecTimeSeries_FieldSubPathArrayOfValues) AsQueryPathArrayOfValues() (AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues, bool) { 2649 res, ok := fpsaov.subPathArrayOfValues.(AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues) 2650 return res, ok 2651 } 2652 func (fpsaov *AlertingConditionSpecTimeSeries_FieldSubPathArrayOfValues) AsThresholdPathArrayOfValues() (AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues, bool) { 2653 res, ok := fpsaov.subPathArrayOfValues.(AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues) 2654 return res, ok 2655 } 2656 func (fpsaov *AlertingConditionSpecTimeSeries_FieldSubPathArrayOfValues) AsCombineThresholdPathArrayOfValues() (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues, bool) { 2657 res, ok := fpsaov.subPathArrayOfValues.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues) 2658 return res, ok 2659 } 2660 2661 // FieldPath provides implementation to handle 2662 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2663 type AlertingConditionSpecTimeSeriesQuery_FieldPath interface { 2664 gotenobject.FieldPath 2665 Selector() AlertingConditionSpecTimeSeriesQuery_FieldPathSelector 2666 Get(source *AlertingCondition_Spec_TimeSeries_Query) []interface{} 2667 GetSingle(source *AlertingCondition_Spec_TimeSeries_Query) (interface{}, bool) 2668 ClearValue(item *AlertingCondition_Spec_TimeSeries_Query) 2669 2670 // Those methods build corresponding AlertingConditionSpecTimeSeriesQuery_FieldPathValue 2671 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2672 WithIValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathValue 2673 WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues 2674 WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue 2675 } 2676 2677 type AlertingConditionSpecTimeSeriesQuery_FieldPathSelector int32 2678 2679 const ( 2680 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter AlertingConditionSpecTimeSeriesQuery_FieldPathSelector = 0 2681 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector AlertingConditionSpecTimeSeriesQuery_FieldPathSelector = 1 2682 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation AlertingConditionSpecTimeSeriesQuery_FieldPathSelector = 2 2683 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations AlertingConditionSpecTimeSeriesQuery_FieldPathSelector = 3 2684 ) 2685 2686 func (s AlertingConditionSpecTimeSeriesQuery_FieldPathSelector) String() string { 2687 switch s { 2688 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 2689 return "filter" 2690 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 2691 return "selector" 2692 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 2693 return "aggregation" 2694 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2695 return "per_metric_aggregations" 2696 default: 2697 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", s)) 2698 } 2699 } 2700 2701 func BuildAlertingConditionSpecTimeSeriesQuery_FieldPath(fp gotenobject.RawFieldPath) (AlertingConditionSpecTimeSeriesQuery_FieldPath, error) { 2702 if len(fp) == 0 { 2703 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingCondition_Spec_TimeSeries_Query") 2704 } 2705 if len(fp) == 1 { 2706 switch fp[0] { 2707 case "filter": 2708 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter}, nil 2709 case "selector": 2710 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector}, nil 2711 case "aggregation": 2712 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation}, nil 2713 case "per_metric_aggregations", "perMetricAggregations", "per-metric-aggregations": 2714 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations}, nil 2715 } 2716 } else { 2717 switch fp[0] { 2718 case "selector": 2719 if subpath, err := common.BuildTimeSeriesSelector_FieldPath(fp[1:]); err != nil { 2720 return nil, err 2721 } else { 2722 return &AlertingConditionSpecTimeSeriesQuery_FieldSubPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector, subPath: subpath}, nil 2723 } 2724 case "aggregation": 2725 if subpath, err := common.BuildAggregation_FieldPath(fp[1:]); err != nil { 2726 return nil, err 2727 } else { 2728 return &AlertingConditionSpecTimeSeriesQuery_FieldSubPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation, subPath: subpath}, nil 2729 } 2730 case "per_metric_aggregations", "perMetricAggregations", "per-metric-aggregations": 2731 if len(fp) > 2 { 2732 return nil, status.Errorf(codes.InvalidArgument, "sub path for maps ('%s') are not supported (object AlertingCondition_Spec_TimeSeries_Query)", fp) 2733 } 2734 return &AlertingConditionSpecTimeSeriesQuery_FieldPathMap{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations, key: fp[1]}, nil 2735 } 2736 } 2737 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingCondition_Spec_TimeSeries_Query", fp) 2738 } 2739 2740 func ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(rawField string) (AlertingConditionSpecTimeSeriesQuery_FieldPath, error) { 2741 fp, err := gotenobject.ParseRawFieldPath(rawField) 2742 if err != nil { 2743 return nil, err 2744 } 2745 return BuildAlertingConditionSpecTimeSeriesQuery_FieldPath(fp) 2746 } 2747 2748 func MustParseAlertingConditionSpecTimeSeriesQuery_FieldPath(rawField string) AlertingConditionSpecTimeSeriesQuery_FieldPath { 2749 fp, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(rawField) 2750 if err != nil { 2751 panic(err) 2752 } 2753 return fp 2754 } 2755 2756 type AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath struct { 2757 selector AlertingConditionSpecTimeSeriesQuery_FieldPathSelector 2758 } 2759 2760 var _ AlertingConditionSpecTimeSeriesQuery_FieldPath = (*AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath)(nil) 2761 2762 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) Selector() AlertingConditionSpecTimeSeriesQuery_FieldPathSelector { 2763 return fp.selector 2764 } 2765 2766 // String returns path representation in proto convention 2767 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) String() string { 2768 return fp.selector.String() 2769 } 2770 2771 // JSONString returns path representation is JSON convention 2772 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) JSONString() string { 2773 return strcase.ToLowerCamel(fp.String()) 2774 } 2775 2776 // Get returns all values pointed by specific field from source AlertingCondition_Spec_TimeSeries_Query 2777 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) Get(source *AlertingCondition_Spec_TimeSeries_Query) (values []interface{}) { 2778 if source != nil { 2779 switch fp.selector { 2780 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 2781 if source.Filter != nil { 2782 values = append(values, source.Filter) 2783 } 2784 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 2785 if source.Selector != nil { 2786 values = append(values, source.Selector) 2787 } 2788 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 2789 if source.Aggregation != nil { 2790 values = append(values, source.Aggregation) 2791 } 2792 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2793 if source.PerMetricAggregations != nil { 2794 values = append(values, source.PerMetricAggregations) 2795 } 2796 default: 2797 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fp.selector)) 2798 } 2799 } 2800 return 2801 } 2802 2803 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2804 return fp.Get(source.(*AlertingCondition_Spec_TimeSeries_Query)) 2805 } 2806 2807 // GetSingle returns value pointed by specific field of from source AlertingCondition_Spec_TimeSeries_Query 2808 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) GetSingle(source *AlertingCondition_Spec_TimeSeries_Query) (interface{}, bool) { 2809 switch fp.selector { 2810 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 2811 res := source.GetFilter() 2812 return res, res != nil 2813 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 2814 res := source.GetSelector() 2815 return res, res != nil 2816 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 2817 res := source.GetAggregation() 2818 return res, res != nil 2819 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2820 res := source.GetPerMetricAggregations() 2821 return res, res != nil 2822 default: 2823 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fp.selector)) 2824 } 2825 } 2826 2827 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2828 return fp.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_Query)) 2829 } 2830 2831 // GetDefault returns a default value of the field type 2832 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) GetDefault() interface{} { 2833 switch fp.selector { 2834 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 2835 return (*time_serie.Filter)(nil) 2836 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 2837 return (*common.TimeSeriesSelector)(nil) 2838 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 2839 return (*common.Aggregation)(nil) 2840 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2841 return (map[string]*common.Aggregation)(nil) 2842 default: 2843 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fp.selector)) 2844 } 2845 } 2846 2847 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) ClearValue(item *AlertingCondition_Spec_TimeSeries_Query) { 2848 if item != nil { 2849 switch fp.selector { 2850 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 2851 item.Filter = nil 2852 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 2853 item.Selector = nil 2854 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 2855 item.Aggregation = nil 2856 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2857 item.PerMetricAggregations = nil 2858 default: 2859 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fp.selector)) 2860 } 2861 } 2862 } 2863 2864 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2865 fp.ClearValue(item.(*AlertingCondition_Spec_TimeSeries_Query)) 2866 } 2867 2868 // IsLeaf - whether field path is holds simple value 2869 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) IsLeaf() bool { 2870 return fp.selector == AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter 2871 } 2872 2873 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2874 return []gotenobject.FieldPath{fp} 2875 } 2876 2877 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) WithIValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathValue { 2878 switch fp.selector { 2879 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 2880 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, value: value.(*time_serie.Filter)} 2881 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 2882 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, value: value.(*common.TimeSeriesSelector)} 2883 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 2884 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, value: value.(*common.Aggregation)} 2885 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2886 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, value: value.(map[string]*common.Aggregation)} 2887 default: 2888 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fp.selector)) 2889 } 2890 } 2891 2892 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2893 return fp.WithIValue(value) 2894 } 2895 2896 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues { 2897 fpaov := &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp} 2898 switch fp.selector { 2899 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 2900 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, values: values.([]*time_serie.Filter)} 2901 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 2902 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, values: values.([]*common.TimeSeriesSelector)} 2903 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 2904 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, values: values.([]*common.Aggregation)} 2905 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2906 return &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: *fp, values: values.([]map[string]*common.Aggregation)} 2907 default: 2908 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fp.selector)) 2909 } 2910 return fpaov 2911 } 2912 2913 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2914 return fp.WithIArrayOfValues(values) 2915 } 2916 2917 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue { 2918 switch fp.selector { 2919 default: 2920 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fp.selector)) 2921 } 2922 } 2923 2924 func (fp *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2925 return fp.WithIArrayItemValue(value) 2926 } 2927 2928 // FieldPath for map type with additional Key information 2929 type AlertingConditionSpecTimeSeriesQuery_FieldPathMap struct { 2930 key string 2931 selector AlertingConditionSpecTimeSeriesQuery_FieldPathSelector 2932 } 2933 2934 var _ AlertingConditionSpecTimeSeriesQuery_FieldPath = (*AlertingConditionSpecTimeSeriesQuery_FieldPathMap)(nil) 2935 2936 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) Selector() AlertingConditionSpecTimeSeriesQuery_FieldPathSelector { 2937 return fpm.selector 2938 } 2939 2940 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) Key() string { 2941 return fpm.key 2942 } 2943 2944 // String returns path representation in proto convention 2945 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) String() string { 2946 return fpm.selector.String() + "." + fpm.key 2947 } 2948 2949 // JSONString returns path representation is JSON convention. Note that map keys are not transformed 2950 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) JSONString() string { 2951 return strcase.ToLowerCamel(fpm.selector.String()) + "." + fpm.key 2952 } 2953 2954 // Get returns all values pointed by selected field map key from source AlertingCondition_Spec_TimeSeries_Query 2955 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) Get(source *AlertingCondition_Spec_TimeSeries_Query) (values []interface{}) { 2956 switch fpm.selector { 2957 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2958 if value, ok := source.GetPerMetricAggregations()[fpm.key]; ok { 2959 values = append(values, value) 2960 } 2961 default: 2962 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpm.selector)) 2963 } 2964 return 2965 } 2966 2967 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) GetRaw(source proto.Message) []interface{} { 2968 return fpm.Get(source.(*AlertingCondition_Spec_TimeSeries_Query)) 2969 } 2970 2971 // GetSingle returns value by selected field map key from source AlertingCondition_Spec_TimeSeries_Query 2972 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) GetSingle(source *AlertingCondition_Spec_TimeSeries_Query) (interface{}, bool) { 2973 switch fpm.selector { 2974 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2975 res, ok := source.GetPerMetricAggregations()[fpm.key] 2976 return res, ok 2977 default: 2978 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpm.selector)) 2979 } 2980 } 2981 2982 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) GetSingleRaw(source proto.Message) (interface{}, bool) { 2983 return fpm.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_Query)) 2984 } 2985 2986 // GetDefault returns a default value of the field type 2987 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) GetDefault() interface{} { 2988 switch fpm.selector { 2989 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 2990 var v *common.Aggregation 2991 return v 2992 default: 2993 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpm.selector)) 2994 } 2995 } 2996 2997 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) ClearValue(item *AlertingCondition_Spec_TimeSeries_Query) { 2998 if item != nil { 2999 switch fpm.selector { 3000 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3001 delete(item.PerMetricAggregations, fpm.key) 3002 default: 3003 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpm.selector)) 3004 } 3005 } 3006 } 3007 3008 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) ClearValueRaw(item proto.Message) { 3009 fpm.ClearValue(item.(*AlertingCondition_Spec_TimeSeries_Query)) 3010 } 3011 3012 // IsLeaf - whether field path is holds simple value 3013 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) IsLeaf() bool { 3014 switch fpm.selector { 3015 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3016 return false 3017 default: 3018 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpm.selector)) 3019 } 3020 } 3021 3022 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3023 return []gotenobject.FieldPath{fpm} 3024 } 3025 3026 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) WithIValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathValue { 3027 switch fpm.selector { 3028 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3029 return &AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue{AlertingConditionSpecTimeSeriesQuery_FieldPathMap: *fpm, value: value.(*common.Aggregation)} 3030 default: 3031 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpm.selector)) 3032 } 3033 } 3034 3035 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3036 return fpm.WithIValue(value) 3037 } 3038 3039 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues { 3040 switch fpm.selector { 3041 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3042 return &AlertingConditionSpecTimeSeriesQuery_FieldPathMapArrayOfValues{AlertingConditionSpecTimeSeriesQuery_FieldPathMap: *fpm, values: values.([]*common.Aggregation)} 3043 default: 3044 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpm.selector)) 3045 } 3046 } 3047 3048 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3049 return fpm.WithIArrayOfValues(values) 3050 } 3051 3052 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue { 3053 panic("Cannot create array item value from map fieldpath") 3054 } 3055 3056 func (fpm *AlertingConditionSpecTimeSeriesQuery_FieldPathMap) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3057 return fpm.WithIArrayItemValue(value) 3058 } 3059 3060 type AlertingConditionSpecTimeSeriesQuery_FieldSubPath struct { 3061 selector AlertingConditionSpecTimeSeriesQuery_FieldPathSelector 3062 subPath gotenobject.FieldPath 3063 } 3064 3065 var _ AlertingConditionSpecTimeSeriesQuery_FieldPath = (*AlertingConditionSpecTimeSeriesQuery_FieldSubPath)(nil) 3066 3067 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) Selector() AlertingConditionSpecTimeSeriesQuery_FieldPathSelector { 3068 return fps.selector 3069 } 3070 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) AsSelectorSubPath() (common.TimeSeriesSelector_FieldPath, bool) { 3071 res, ok := fps.subPath.(common.TimeSeriesSelector_FieldPath) 3072 return res, ok 3073 } 3074 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) AsAggregationSubPath() (common.Aggregation_FieldPath, bool) { 3075 res, ok := fps.subPath.(common.Aggregation_FieldPath) 3076 return res, ok 3077 } 3078 3079 // String returns path representation in proto convention 3080 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) String() string { 3081 return fps.selector.String() + "." + fps.subPath.String() 3082 } 3083 3084 // JSONString returns path representation is JSON convention 3085 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) JSONString() string { 3086 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 3087 } 3088 3089 // Get returns all values pointed by selected field from source AlertingCondition_Spec_TimeSeries_Query 3090 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) Get(source *AlertingCondition_Spec_TimeSeries_Query) (values []interface{}) { 3091 switch fps.selector { 3092 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3093 values = append(values, fps.subPath.GetRaw(source.GetSelector())...) 3094 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3095 values = append(values, fps.subPath.GetRaw(source.GetAggregation())...) 3096 default: 3097 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fps.selector)) 3098 } 3099 return 3100 } 3101 3102 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) GetRaw(source proto.Message) []interface{} { 3103 return fps.Get(source.(*AlertingCondition_Spec_TimeSeries_Query)) 3104 } 3105 3106 // GetSingle returns value of selected field from source AlertingCondition_Spec_TimeSeries_Query 3107 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) GetSingle(source *AlertingCondition_Spec_TimeSeries_Query) (interface{}, bool) { 3108 switch fps.selector { 3109 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3110 if source.GetSelector() == nil { 3111 return nil, false 3112 } 3113 return fps.subPath.GetSingleRaw(source.GetSelector()) 3114 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3115 if source.GetAggregation() == nil { 3116 return nil, false 3117 } 3118 return fps.subPath.GetSingleRaw(source.GetAggregation()) 3119 default: 3120 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fps.selector)) 3121 } 3122 } 3123 3124 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3125 return fps.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_Query)) 3126 } 3127 3128 // GetDefault returns a default value of the field type 3129 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) GetDefault() interface{} { 3130 return fps.subPath.GetDefault() 3131 } 3132 3133 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) ClearValue(item *AlertingCondition_Spec_TimeSeries_Query) { 3134 if item != nil { 3135 switch fps.selector { 3136 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3137 fps.subPath.ClearValueRaw(item.Selector) 3138 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3139 fps.subPath.ClearValueRaw(item.Aggregation) 3140 default: 3141 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fps.selector)) 3142 } 3143 } 3144 } 3145 3146 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) ClearValueRaw(item proto.Message) { 3147 fps.ClearValue(item.(*AlertingCondition_Spec_TimeSeries_Query)) 3148 } 3149 3150 // IsLeaf - whether field path is holds simple value 3151 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) IsLeaf() bool { 3152 return fps.subPath.IsLeaf() 3153 } 3154 3155 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3156 iPaths := []gotenobject.FieldPath{&AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: fps.selector}} 3157 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 3158 return iPaths 3159 } 3160 3161 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) WithIValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathValue { 3162 return &AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 3163 } 3164 3165 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3166 return fps.WithIValue(value) 3167 } 3168 3169 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues { 3170 return &AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 3171 } 3172 3173 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3174 return fps.WithIArrayOfValues(values) 3175 } 3176 3177 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue { 3178 return &AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 3179 } 3180 3181 func (fps *AlertingConditionSpecTimeSeriesQuery_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3182 return fps.WithIArrayItemValue(value) 3183 } 3184 3185 // AlertingConditionSpecTimeSeriesQuery_FieldPathValue allows storing values for Query fields according to their type 3186 type AlertingConditionSpecTimeSeriesQuery_FieldPathValue interface { 3187 AlertingConditionSpecTimeSeriesQuery_FieldPath 3188 gotenobject.FieldPathValue 3189 SetTo(target **AlertingCondition_Spec_TimeSeries_Query) 3190 CompareWith(*AlertingCondition_Spec_TimeSeries_Query) (cmp int, comparable bool) 3191 } 3192 3193 func ParseAlertingConditionSpecTimeSeriesQuery_FieldPathValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeriesQuery_FieldPathValue, error) { 3194 fp, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(pathStr) 3195 if err != nil { 3196 return nil, err 3197 } 3198 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3199 if err != nil { 3200 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path value from %s: %v", valueStr, err) 3201 } 3202 return fpv.(AlertingConditionSpecTimeSeriesQuery_FieldPathValue), nil 3203 } 3204 3205 func MustParseAlertingConditionSpecTimeSeriesQuery_FieldPathValue(pathStr, valueStr string) AlertingConditionSpecTimeSeriesQuery_FieldPathValue { 3206 fpv, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPathValue(pathStr, valueStr) 3207 if err != nil { 3208 panic(err) 3209 } 3210 return fpv 3211 } 3212 3213 type AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue struct { 3214 AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath 3215 value interface{} 3216 } 3217 3218 var _ AlertingConditionSpecTimeSeriesQuery_FieldPathValue = (*AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue)(nil) 3219 3220 // GetRawValue returns raw value stored under selected path for 'Query' as interface{} 3221 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) GetRawValue() interface{} { 3222 return fpv.value 3223 } 3224 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) AsFilterValue() (*time_serie.Filter, bool) { 3225 res, ok := fpv.value.(*time_serie.Filter) 3226 return res, ok 3227 } 3228 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) AsSelectorValue() (*common.TimeSeriesSelector, bool) { 3229 res, ok := fpv.value.(*common.TimeSeriesSelector) 3230 return res, ok 3231 } 3232 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) AsAggregationValue() (*common.Aggregation, bool) { 3233 res, ok := fpv.value.(*common.Aggregation) 3234 return res, ok 3235 } 3236 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) AsPerMetricAggregationsValue() (map[string]*common.Aggregation, bool) { 3237 res, ok := fpv.value.(map[string]*common.Aggregation) 3238 return res, ok 3239 } 3240 3241 // SetTo stores value for selected field for object Query 3242 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) SetTo(target **AlertingCondition_Spec_TimeSeries_Query) { 3243 if *target == nil { 3244 *target = new(AlertingCondition_Spec_TimeSeries_Query) 3245 } 3246 switch fpv.selector { 3247 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 3248 (*target).Filter = fpv.value.(*time_serie.Filter) 3249 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3250 (*target).Selector = fpv.value.(*common.TimeSeriesSelector) 3251 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3252 (*target).Aggregation = fpv.value.(*common.Aggregation) 3253 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3254 (*target).PerMetricAggregations = fpv.value.(map[string]*common.Aggregation) 3255 default: 3256 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpv.selector)) 3257 } 3258 } 3259 3260 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3261 typedObject := target.(*AlertingCondition_Spec_TimeSeries_Query) 3262 fpv.SetTo(&typedObject) 3263 } 3264 3265 // CompareWith compares value in the 'AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue' with the value under path in 'AlertingCondition_Spec_TimeSeries_Query'. 3266 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) CompareWith(source *AlertingCondition_Spec_TimeSeries_Query) (int, bool) { 3267 switch fpv.selector { 3268 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 3269 return 0, false 3270 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3271 return 0, false 3272 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3273 return 0, false 3274 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3275 return 0, false 3276 default: 3277 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpv.selector)) 3278 } 3279 } 3280 3281 func (fpv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3282 return fpv.CompareWith(source.(*AlertingCondition_Spec_TimeSeries_Query)) 3283 } 3284 3285 type AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue struct { 3286 AlertingConditionSpecTimeSeriesQuery_FieldPathMap 3287 value interface{} 3288 } 3289 3290 var _ AlertingConditionSpecTimeSeriesQuery_FieldPathValue = (*AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue)(nil) 3291 3292 // GetValue returns value stored under selected field in Query as interface{} 3293 func (fpmv *AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue) GetRawValue() interface{} { 3294 return fpmv.value 3295 } 3296 func (fpmv *AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue) AsPerMetricAggregationsElementValue() (*common.Aggregation, bool) { 3297 res, ok := fpmv.value.(*common.Aggregation) 3298 return res, ok 3299 } 3300 3301 // SetTo stores value for selected field in Query 3302 func (fpmv *AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue) SetTo(target **AlertingCondition_Spec_TimeSeries_Query) { 3303 if *target == nil { 3304 *target = new(AlertingCondition_Spec_TimeSeries_Query) 3305 } 3306 switch fpmv.selector { 3307 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3308 if (*target).PerMetricAggregations == nil { 3309 (*target).PerMetricAggregations = make(map[string]*common.Aggregation) 3310 } 3311 (*target).PerMetricAggregations[fpmv.key] = fpmv.value.(*common.Aggregation) 3312 default: 3313 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpmv.selector)) 3314 } 3315 } 3316 3317 func (fpmv *AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue) SetToRaw(target proto.Message) { 3318 typedObject := target.(*AlertingCondition_Spec_TimeSeries_Query) 3319 fpmv.SetTo(&typedObject) 3320 } 3321 3322 // CompareWith compares value in the 'AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue' with the value under path in 'AlertingCondition_Spec_TimeSeries_Query'. 3323 func (fpmv *AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue) CompareWith(source *AlertingCondition_Spec_TimeSeries_Query) (int, bool) { 3324 switch fpmv.selector { 3325 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3326 return 0, false 3327 default: 3328 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpmv.selector)) 3329 } 3330 } 3331 3332 func (fpmv *AlertingConditionSpecTimeSeriesQuery_FieldPathMapValue) CompareWithRaw(source proto.Message) (int, bool) { 3333 return fpmv.CompareWith(source.(*AlertingCondition_Spec_TimeSeries_Query)) 3334 } 3335 3336 type AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue struct { 3337 AlertingConditionSpecTimeSeriesQuery_FieldPath 3338 subPathValue gotenobject.FieldPathValue 3339 } 3340 3341 var _ AlertingConditionSpecTimeSeriesQuery_FieldPathValue = (*AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue)(nil) 3342 3343 func (fpvs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue) AsSelectorPathValue() (common.TimeSeriesSelector_FieldPathValue, bool) { 3344 res, ok := fpvs.subPathValue.(common.TimeSeriesSelector_FieldPathValue) 3345 return res, ok 3346 } 3347 func (fpvs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue) AsAggregationPathValue() (common.Aggregation_FieldPathValue, bool) { 3348 res, ok := fpvs.subPathValue.(common.Aggregation_FieldPathValue) 3349 return res, ok 3350 } 3351 3352 func (fpvs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue) SetTo(target **AlertingCondition_Spec_TimeSeries_Query) { 3353 if *target == nil { 3354 *target = new(AlertingCondition_Spec_TimeSeries_Query) 3355 } 3356 switch fpvs.Selector() { 3357 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3358 fpvs.subPathValue.(common.TimeSeriesSelector_FieldPathValue).SetTo(&(*target).Selector) 3359 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3360 fpvs.subPathValue.(common.Aggregation_FieldPathValue).SetTo(&(*target).Aggregation) 3361 default: 3362 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpvs.Selector())) 3363 } 3364 } 3365 3366 func (fpvs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue) SetToRaw(target proto.Message) { 3367 typedObject := target.(*AlertingCondition_Spec_TimeSeries_Query) 3368 fpvs.SetTo(&typedObject) 3369 } 3370 3371 func (fpvs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue) GetRawValue() interface{} { 3372 return fpvs.subPathValue.GetRawValue() 3373 } 3374 3375 func (fpvs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue) CompareWith(source *AlertingCondition_Spec_TimeSeries_Query) (int, bool) { 3376 switch fpvs.Selector() { 3377 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3378 return fpvs.subPathValue.(common.TimeSeriesSelector_FieldPathValue).CompareWith(source.GetSelector()) 3379 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3380 return fpvs.subPathValue.(common.Aggregation_FieldPathValue).CompareWith(source.GetAggregation()) 3381 default: 3382 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpvs.Selector())) 3383 } 3384 } 3385 3386 func (fpvs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3387 return fpvs.CompareWith(source.(*AlertingCondition_Spec_TimeSeries_Query)) 3388 } 3389 3390 // AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for Query according to their type 3391 // Present only for array (repeated) types. 3392 type AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue interface { 3393 gotenobject.FieldPathArrayItemValue 3394 AlertingConditionSpecTimeSeriesQuery_FieldPath 3395 ContainsValue(*AlertingCondition_Spec_TimeSeries_Query) bool 3396 } 3397 3398 // ParseAlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3399 func ParseAlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue, error) { 3400 fp, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(pathStr) 3401 if err != nil { 3402 return nil, err 3403 } 3404 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3405 if err != nil { 3406 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path array item value from %s: %v", valueStr, err) 3407 } 3408 return fpaiv.(AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue), nil 3409 } 3410 3411 func MustParseAlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue(pathStr, valueStr string) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue { 3412 fpaiv, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue(pathStr, valueStr) 3413 if err != nil { 3414 panic(err) 3415 } 3416 return fpaiv 3417 } 3418 3419 type AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayItemValue struct { 3420 AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath 3421 value interface{} 3422 } 3423 3424 var _ AlertingConditionSpecTimeSeriesQuery_FieldPathArrayItemValue = (*AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayItemValue)(nil) 3425 3426 // GetRawValue returns stored element value for array in object AlertingCondition_Spec_TimeSeries_Query as interface{} 3427 func (fpaiv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3428 return fpaiv.value 3429 } 3430 3431 func (fpaiv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingCondition_Spec_TimeSeries_Query) (interface{}, bool) { 3432 return nil, false 3433 } 3434 3435 func (fpaiv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3436 return fpaiv.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_Query)) 3437 } 3438 3439 // Contains returns a boolean indicating if value that is being held is present in given 'Query' 3440 func (fpaiv *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec_TimeSeries_Query) bool { 3441 slice := fpaiv.AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath.Get(source) 3442 for _, v := range slice { 3443 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3444 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3445 return true 3446 } 3447 } else if reflect.DeepEqual(v, fpaiv.value) { 3448 return true 3449 } 3450 } 3451 return false 3452 } 3453 3454 type AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayItemValue struct { 3455 AlertingConditionSpecTimeSeriesQuery_FieldPath 3456 subPathItemValue gotenobject.FieldPathArrayItemValue 3457 } 3458 3459 // GetRawValue returns stored array item value 3460 func (fpaivs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 3461 return fpaivs.subPathItemValue.GetRawItemValue() 3462 } 3463 func (fpaivs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayItemValue) AsSelectorPathItemValue() (common.TimeSeriesSelector_FieldPathArrayItemValue, bool) { 3464 res, ok := fpaivs.subPathItemValue.(common.TimeSeriesSelector_FieldPathArrayItemValue) 3465 return res, ok 3466 } 3467 func (fpaivs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayItemValue) AsAggregationPathItemValue() (common.Aggregation_FieldPathArrayItemValue, bool) { 3468 res, ok := fpaivs.subPathItemValue.(common.Aggregation_FieldPathArrayItemValue) 3469 return res, ok 3470 } 3471 3472 // Contains returns a boolean indicating if value that is being held is present in given 'Query' 3473 func (fpaivs *AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec_TimeSeries_Query) bool { 3474 switch fpaivs.Selector() { 3475 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3476 return fpaivs.subPathItemValue.(common.TimeSeriesSelector_FieldPathArrayItemValue).ContainsValue(source.GetSelector()) 3477 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3478 return fpaivs.subPathItemValue.(common.Aggregation_FieldPathArrayItemValue).ContainsValue(source.GetAggregation()) 3479 default: 3480 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Query: %d", fpaivs.Selector())) 3481 } 3482 } 3483 3484 // AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues allows storing slice of values for Query fields according to their type 3485 type AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues interface { 3486 gotenobject.FieldPathArrayOfValues 3487 AlertingConditionSpecTimeSeriesQuery_FieldPath 3488 } 3489 3490 func ParseAlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues, error) { 3491 fp, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(pathStr) 3492 if err != nil { 3493 return nil, err 3494 } 3495 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3496 if err != nil { 3497 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path array of values from %s: %v", valuesStr, err) 3498 } 3499 return fpaov.(AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues), nil 3500 } 3501 3502 func MustParseAlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues { 3503 fpaov, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues(pathStr, valuesStr) 3504 if err != nil { 3505 panic(err) 3506 } 3507 return fpaov 3508 } 3509 3510 type AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues struct { 3511 AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath 3512 values interface{} 3513 } 3514 3515 var _ AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues)(nil) 3516 3517 func (fpaov *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3518 switch fpaov.selector { 3519 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 3520 for _, v := range fpaov.values.([]*time_serie.Filter) { 3521 values = append(values, v) 3522 } 3523 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 3524 for _, v := range fpaov.values.([]*common.TimeSeriesSelector) { 3525 values = append(values, v) 3526 } 3527 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 3528 for _, v := range fpaov.values.([]*common.Aggregation) { 3529 values = append(values, v) 3530 } 3531 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3532 for _, v := range fpaov.values.([]map[string]*common.Aggregation) { 3533 values = append(values, v) 3534 } 3535 } 3536 return 3537 } 3538 func (fpaov *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues) AsFilterArrayOfValues() ([]*time_serie.Filter, bool) { 3539 res, ok := fpaov.values.([]*time_serie.Filter) 3540 return res, ok 3541 } 3542 func (fpaov *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues) AsSelectorArrayOfValues() ([]*common.TimeSeriesSelector, bool) { 3543 res, ok := fpaov.values.([]*common.TimeSeriesSelector) 3544 return res, ok 3545 } 3546 func (fpaov *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues) AsAggregationArrayOfValues() ([]*common.Aggregation, bool) { 3547 res, ok := fpaov.values.([]*common.Aggregation) 3548 return res, ok 3549 } 3550 func (fpaov *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPathArrayOfValues) AsPerMetricAggregationsArrayOfValues() ([]map[string]*common.Aggregation, bool) { 3551 res, ok := fpaov.values.([]map[string]*common.Aggregation) 3552 return res, ok 3553 } 3554 3555 type AlertingConditionSpecTimeSeriesQuery_FieldPathMapArrayOfValues struct { 3556 AlertingConditionSpecTimeSeriesQuery_FieldPathMap 3557 values interface{} 3558 } 3559 3560 var _ AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeriesQuery_FieldPathMapArrayOfValues)(nil) 3561 3562 func (fpmaov *AlertingConditionSpecTimeSeriesQuery_FieldPathMapArrayOfValues) GetRawValues() (values []interface{}) { 3563 switch fpmaov.selector { 3564 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 3565 for _, v := range fpmaov.values.([]*common.Aggregation) { 3566 values = append(values, v) 3567 } 3568 } 3569 return 3570 } 3571 func (fpmaov *AlertingConditionSpecTimeSeriesQuery_FieldPathMapArrayOfValues) AsPerMetricAggregationsArrayOfElementValues() ([]*common.Aggregation, bool) { 3572 res, ok := fpmaov.values.([]*common.Aggregation) 3573 return res, ok 3574 } 3575 3576 type AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayOfValues struct { 3577 AlertingConditionSpecTimeSeriesQuery_FieldPath 3578 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 3579 } 3580 3581 var _ AlertingConditionSpecTimeSeriesQuery_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayOfValues)(nil) 3582 3583 func (fpsaov *AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 3584 return fpsaov.subPathArrayOfValues.GetRawValues() 3585 } 3586 func (fpsaov *AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayOfValues) AsSelectorPathArrayOfValues() (common.TimeSeriesSelector_FieldPathArrayOfValues, bool) { 3587 res, ok := fpsaov.subPathArrayOfValues.(common.TimeSeriesSelector_FieldPathArrayOfValues) 3588 return res, ok 3589 } 3590 func (fpsaov *AlertingConditionSpecTimeSeriesQuery_FieldSubPathArrayOfValues) AsAggregationPathArrayOfValues() (common.Aggregation_FieldPathArrayOfValues, bool) { 3591 res, ok := fpsaov.subPathArrayOfValues.(common.Aggregation_FieldPathArrayOfValues) 3592 return res, ok 3593 } 3594 3595 // FieldPath provides implementation to handle 3596 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3597 type AlertingConditionSpecTimeSeriesThreshold_FieldPath interface { 3598 gotenobject.FieldPath 3599 Selector() AlertingConditionSpecTimeSeriesThreshold_FieldPathSelector 3600 Get(source *AlertingCondition_Spec_TimeSeries_Threshold) []interface{} 3601 GetSingle(source *AlertingCondition_Spec_TimeSeries_Threshold) (interface{}, bool) 3602 ClearValue(item *AlertingCondition_Spec_TimeSeries_Threshold) 3603 3604 // Those methods build corresponding AlertingConditionSpecTimeSeriesThreshold_FieldPathValue 3605 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3606 WithIValue(value interface{}) AlertingConditionSpecTimeSeriesThreshold_FieldPathValue 3607 WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues 3608 WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue 3609 } 3610 3611 type AlertingConditionSpecTimeSeriesThreshold_FieldPathSelector int32 3612 3613 const ( 3614 AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare AlertingConditionSpecTimeSeriesThreshold_FieldPathSelector = 0 3615 AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue AlertingConditionSpecTimeSeriesThreshold_FieldPathSelector = 1 3616 ) 3617 3618 func (s AlertingConditionSpecTimeSeriesThreshold_FieldPathSelector) String() string { 3619 switch s { 3620 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3621 return "compare" 3622 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3623 return "value" 3624 default: 3625 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", s)) 3626 } 3627 } 3628 3629 func BuildAlertingConditionSpecTimeSeriesThreshold_FieldPath(fp gotenobject.RawFieldPath) (AlertingConditionSpecTimeSeriesThreshold_FieldPath, error) { 3630 if len(fp) == 0 { 3631 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingCondition_Spec_TimeSeries_Threshold") 3632 } 3633 if len(fp) == 1 { 3634 switch fp[0] { 3635 case "compare": 3636 return &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare}, nil 3637 case "value": 3638 return &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue}, nil 3639 } 3640 } 3641 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingCondition_Spec_TimeSeries_Threshold", fp) 3642 } 3643 3644 func ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(rawField string) (AlertingConditionSpecTimeSeriesThreshold_FieldPath, error) { 3645 fp, err := gotenobject.ParseRawFieldPath(rawField) 3646 if err != nil { 3647 return nil, err 3648 } 3649 return BuildAlertingConditionSpecTimeSeriesThreshold_FieldPath(fp) 3650 } 3651 3652 func MustParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(rawField string) AlertingConditionSpecTimeSeriesThreshold_FieldPath { 3653 fp, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(rawField) 3654 if err != nil { 3655 panic(err) 3656 } 3657 return fp 3658 } 3659 3660 type AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath struct { 3661 selector AlertingConditionSpecTimeSeriesThreshold_FieldPathSelector 3662 } 3663 3664 var _ AlertingConditionSpecTimeSeriesThreshold_FieldPath = (*AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath)(nil) 3665 3666 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) Selector() AlertingConditionSpecTimeSeriesThreshold_FieldPathSelector { 3667 return fp.selector 3668 } 3669 3670 // String returns path representation in proto convention 3671 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) String() string { 3672 return fp.selector.String() 3673 } 3674 3675 // JSONString returns path representation is JSON convention 3676 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) JSONString() string { 3677 return strcase.ToLowerCamel(fp.String()) 3678 } 3679 3680 // Get returns all values pointed by specific field from source AlertingCondition_Spec_TimeSeries_Threshold 3681 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) Get(source *AlertingCondition_Spec_TimeSeries_Threshold) (values []interface{}) { 3682 if source != nil { 3683 switch fp.selector { 3684 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3685 values = append(values, source.Compare) 3686 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3687 values = append(values, source.Value) 3688 default: 3689 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fp.selector)) 3690 } 3691 } 3692 return 3693 } 3694 3695 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3696 return fp.Get(source.(*AlertingCondition_Spec_TimeSeries_Threshold)) 3697 } 3698 3699 // GetSingle returns value pointed by specific field of from source AlertingCondition_Spec_TimeSeries_Threshold 3700 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) GetSingle(source *AlertingCondition_Spec_TimeSeries_Threshold) (interface{}, bool) { 3701 switch fp.selector { 3702 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3703 return source.GetCompare(), source != nil 3704 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3705 return source.GetValue(), source != nil 3706 default: 3707 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fp.selector)) 3708 } 3709 } 3710 3711 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3712 return fp.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_Threshold)) 3713 } 3714 3715 // GetDefault returns a default value of the field type 3716 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) GetDefault() interface{} { 3717 switch fp.selector { 3718 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3719 return AlertingCondition_Spec_TimeSeries_Threshold_COMPARE_UNSPECIFIED 3720 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3721 return float64(0) 3722 default: 3723 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fp.selector)) 3724 } 3725 } 3726 3727 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) ClearValue(item *AlertingCondition_Spec_TimeSeries_Threshold) { 3728 if item != nil { 3729 switch fp.selector { 3730 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3731 item.Compare = AlertingCondition_Spec_TimeSeries_Threshold_COMPARE_UNSPECIFIED 3732 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3733 item.Value = float64(0) 3734 default: 3735 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fp.selector)) 3736 } 3737 } 3738 } 3739 3740 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3741 fp.ClearValue(item.(*AlertingCondition_Spec_TimeSeries_Threshold)) 3742 } 3743 3744 // IsLeaf - whether field path is holds simple value 3745 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) IsLeaf() bool { 3746 return fp.selector == AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare || 3747 fp.selector == AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue 3748 } 3749 3750 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3751 return []gotenobject.FieldPath{fp} 3752 } 3753 3754 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) WithIValue(value interface{}) AlertingConditionSpecTimeSeriesThreshold_FieldPathValue { 3755 switch fp.selector { 3756 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3757 return &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath: *fp, value: value.(AlertingCondition_Spec_TimeSeries_Threshold_Compare)} 3758 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3759 return &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath: *fp, value: value.(float64)} 3760 default: 3761 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fp.selector)) 3762 } 3763 } 3764 3765 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3766 return fp.WithIValue(value) 3767 } 3768 3769 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues { 3770 fpaov := &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath: *fp} 3771 switch fp.selector { 3772 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3773 return &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath: *fp, values: values.([]AlertingCondition_Spec_TimeSeries_Threshold_Compare)} 3774 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3775 return &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath: *fp, values: values.([]float64)} 3776 default: 3777 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fp.selector)) 3778 } 3779 return fpaov 3780 } 3781 3782 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3783 return fp.WithIArrayOfValues(values) 3784 } 3785 3786 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue { 3787 switch fp.selector { 3788 default: 3789 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fp.selector)) 3790 } 3791 } 3792 3793 func (fp *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3794 return fp.WithIArrayItemValue(value) 3795 } 3796 3797 // AlertingConditionSpecTimeSeriesThreshold_FieldPathValue allows storing values for Threshold fields according to their type 3798 type AlertingConditionSpecTimeSeriesThreshold_FieldPathValue interface { 3799 AlertingConditionSpecTimeSeriesThreshold_FieldPath 3800 gotenobject.FieldPathValue 3801 SetTo(target **AlertingCondition_Spec_TimeSeries_Threshold) 3802 CompareWith(*AlertingCondition_Spec_TimeSeries_Threshold) (cmp int, comparable bool) 3803 } 3804 3805 func ParseAlertingConditionSpecTimeSeriesThreshold_FieldPathValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeriesThreshold_FieldPathValue, error) { 3806 fp, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(pathStr) 3807 if err != nil { 3808 return nil, err 3809 } 3810 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3811 if err != nil { 3812 return nil, status.Errorf(codes.InvalidArgument, "error parsing Threshold field path value from %s: %v", valueStr, err) 3813 } 3814 return fpv.(AlertingConditionSpecTimeSeriesThreshold_FieldPathValue), nil 3815 } 3816 3817 func MustParseAlertingConditionSpecTimeSeriesThreshold_FieldPathValue(pathStr, valueStr string) AlertingConditionSpecTimeSeriesThreshold_FieldPathValue { 3818 fpv, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPathValue(pathStr, valueStr) 3819 if err != nil { 3820 panic(err) 3821 } 3822 return fpv 3823 } 3824 3825 type AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue struct { 3826 AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath 3827 value interface{} 3828 } 3829 3830 var _ AlertingConditionSpecTimeSeriesThreshold_FieldPathValue = (*AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue)(nil) 3831 3832 // GetRawValue returns raw value stored under selected path for 'Threshold' as interface{} 3833 func (fpv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue) GetRawValue() interface{} { 3834 return fpv.value 3835 } 3836 func (fpv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue) AsCompareValue() (AlertingCondition_Spec_TimeSeries_Threshold_Compare, bool) { 3837 res, ok := fpv.value.(AlertingCondition_Spec_TimeSeries_Threshold_Compare) 3838 return res, ok 3839 } 3840 func (fpv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue) AsValueValue() (float64, bool) { 3841 res, ok := fpv.value.(float64) 3842 return res, ok 3843 } 3844 3845 // SetTo stores value for selected field for object Threshold 3846 func (fpv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue) SetTo(target **AlertingCondition_Spec_TimeSeries_Threshold) { 3847 if *target == nil { 3848 *target = new(AlertingCondition_Spec_TimeSeries_Threshold) 3849 } 3850 switch fpv.selector { 3851 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3852 (*target).Compare = fpv.value.(AlertingCondition_Spec_TimeSeries_Threshold_Compare) 3853 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3854 (*target).Value = fpv.value.(float64) 3855 default: 3856 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fpv.selector)) 3857 } 3858 } 3859 3860 func (fpv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3861 typedObject := target.(*AlertingCondition_Spec_TimeSeries_Threshold) 3862 fpv.SetTo(&typedObject) 3863 } 3864 3865 // CompareWith compares value in the 'AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue' with the value under path in 'AlertingCondition_Spec_TimeSeries_Threshold'. 3866 func (fpv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue) CompareWith(source *AlertingCondition_Spec_TimeSeries_Threshold) (int, bool) { 3867 switch fpv.selector { 3868 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3869 leftValue := fpv.value.(AlertingCondition_Spec_TimeSeries_Threshold_Compare) 3870 rightValue := source.GetCompare() 3871 if (leftValue) == (rightValue) { 3872 return 0, true 3873 } else if (leftValue) < (rightValue) { 3874 return -1, true 3875 } else { 3876 return 1, true 3877 } 3878 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 3879 leftValue := fpv.value.(float64) 3880 rightValue := source.GetValue() 3881 if (leftValue) == (rightValue) { 3882 return 0, true 3883 } else if (leftValue) < (rightValue) { 3884 return -1, true 3885 } else { 3886 return 1, true 3887 } 3888 default: 3889 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_Threshold: %d", fpv.selector)) 3890 } 3891 } 3892 3893 func (fpv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3894 return fpv.CompareWith(source.(*AlertingCondition_Spec_TimeSeries_Threshold)) 3895 } 3896 3897 // AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue allows storing single item in Path-specific values for Threshold according to their type 3898 // Present only for array (repeated) types. 3899 type AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue interface { 3900 gotenobject.FieldPathArrayItemValue 3901 AlertingConditionSpecTimeSeriesThreshold_FieldPath 3902 ContainsValue(*AlertingCondition_Spec_TimeSeries_Threshold) bool 3903 } 3904 3905 // ParseAlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3906 func ParseAlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue, error) { 3907 fp, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(pathStr) 3908 if err != nil { 3909 return nil, err 3910 } 3911 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3912 if err != nil { 3913 return nil, status.Errorf(codes.InvalidArgument, "error parsing Threshold field path array item value from %s: %v", valueStr, err) 3914 } 3915 return fpaiv.(AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue), nil 3916 } 3917 3918 func MustParseAlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue(pathStr, valueStr string) AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue { 3919 fpaiv, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue(pathStr, valueStr) 3920 if err != nil { 3921 panic(err) 3922 } 3923 return fpaiv 3924 } 3925 3926 type AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayItemValue struct { 3927 AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath 3928 value interface{} 3929 } 3930 3931 var _ AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayItemValue = (*AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayItemValue)(nil) 3932 3933 // GetRawValue returns stored element value for array in object AlertingCondition_Spec_TimeSeries_Threshold as interface{} 3934 func (fpaiv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3935 return fpaiv.value 3936 } 3937 3938 func (fpaiv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingCondition_Spec_TimeSeries_Threshold) (interface{}, bool) { 3939 return nil, false 3940 } 3941 3942 func (fpaiv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3943 return fpaiv.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_Threshold)) 3944 } 3945 3946 // Contains returns a boolean indicating if value that is being held is present in given 'Threshold' 3947 func (fpaiv *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec_TimeSeries_Threshold) bool { 3948 slice := fpaiv.AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath.Get(source) 3949 for _, v := range slice { 3950 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3951 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3952 return true 3953 } 3954 } else if reflect.DeepEqual(v, fpaiv.value) { 3955 return true 3956 } 3957 } 3958 return false 3959 } 3960 3961 // AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues allows storing slice of values for Threshold fields according to their type 3962 type AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues interface { 3963 gotenobject.FieldPathArrayOfValues 3964 AlertingConditionSpecTimeSeriesThreshold_FieldPath 3965 } 3966 3967 func ParseAlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues, error) { 3968 fp, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(pathStr) 3969 if err != nil { 3970 return nil, err 3971 } 3972 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3973 if err != nil { 3974 return nil, status.Errorf(codes.InvalidArgument, "error parsing Threshold field path array of values from %s: %v", valuesStr, err) 3975 } 3976 return fpaov.(AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues), nil 3977 } 3978 3979 func MustParseAlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues { 3980 fpaov, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues(pathStr, valuesStr) 3981 if err != nil { 3982 panic(err) 3983 } 3984 return fpaov 3985 } 3986 3987 type AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues struct { 3988 AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath 3989 values interface{} 3990 } 3991 3992 var _ AlertingConditionSpecTimeSeriesThreshold_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues)(nil) 3993 3994 func (fpaov *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3995 switch fpaov.selector { 3996 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 3997 for _, v := range fpaov.values.([]AlertingCondition_Spec_TimeSeries_Threshold_Compare) { 3998 values = append(values, v) 3999 } 4000 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 4001 for _, v := range fpaov.values.([]float64) { 4002 values = append(values, v) 4003 } 4004 } 4005 return 4006 } 4007 func (fpaov *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues) AsCompareArrayOfValues() ([]AlertingCondition_Spec_TimeSeries_Threshold_Compare, bool) { 4008 res, ok := fpaov.values.([]AlertingCondition_Spec_TimeSeries_Threshold_Compare) 4009 return res, ok 4010 } 4011 func (fpaov *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPathArrayOfValues) AsValueArrayOfValues() ([]float64, bool) { 4012 res, ok := fpaov.values.([]float64) 4013 return res, ok 4014 } 4015 4016 // FieldPath provides implementation to handle 4017 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4018 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath interface { 4019 gotenobject.FieldPath 4020 Selector() AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector 4021 Get(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) []interface{} 4022 GetSingle(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (interface{}, bool) 4023 ClearValue(item *AlertingCondition_Spec_TimeSeries_CombineThreshold) 4024 4025 // Those methods build corresponding AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue 4026 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4027 WithIValue(value interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue 4028 WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues 4029 WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue 4030 } 4031 4032 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector int32 4033 4034 const ( 4035 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector = 0 4036 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector = 1 4037 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector = 2 4038 ) 4039 4040 func (s AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector) String() string { 4041 switch s { 4042 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4043 return "per_metric" 4044 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4045 return "main_metric_type" 4046 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4047 return "per_metric_type_kv" 4048 default: 4049 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", s)) 4050 } 4051 } 4052 4053 func BuildAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(fp gotenobject.RawFieldPath) (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath, error) { 4054 if len(fp) == 0 { 4055 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingCondition_Spec_TimeSeries_CombineThreshold") 4056 } 4057 if len(fp) == 1 { 4058 switch fp[0] { 4059 case "per_metric", "perMetric", "per-metric": 4060 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric}, nil 4061 case "main_metric_type", "mainMetricType", "main-metric-type": 4062 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType}, nil 4063 case "per_metric_type_kv", "perMetricTypeKv", "per-metric-type-kv": 4064 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv}, nil 4065 } 4066 } else { 4067 switch fp[0] { 4068 case "per_metric", "perMetric", "per-metric": 4069 if len(fp) > 2 { 4070 return nil, status.Errorf(codes.InvalidArgument, "sub path for maps ('%s') are not supported (object AlertingCondition_Spec_TimeSeries_CombineThreshold)", fp) 4071 } 4072 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric, key: fp[1]}, nil 4073 case "per_metric_type_kv", "perMetricTypeKv", "per-metric-type-kv": 4074 if len(fp) > 2 { 4075 return nil, status.Errorf(codes.InvalidArgument, "sub path for maps ('%s') are not supported (object AlertingCondition_Spec_TimeSeries_CombineThreshold)", fp) 4076 } 4077 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv, key: fp[1]}, nil 4078 } 4079 } 4080 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingCondition_Spec_TimeSeries_CombineThreshold", fp) 4081 } 4082 4083 func ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(rawField string) (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath, error) { 4084 fp, err := gotenobject.ParseRawFieldPath(rawField) 4085 if err != nil { 4086 return nil, err 4087 } 4088 return BuildAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(fp) 4089 } 4090 4091 func MustParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(rawField string) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath { 4092 fp, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(rawField) 4093 if err != nil { 4094 panic(err) 4095 } 4096 return fp 4097 } 4098 4099 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath struct { 4100 selector AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector 4101 } 4102 4103 var _ AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath = (*AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath)(nil) 4104 4105 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) Selector() AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector { 4106 return fp.selector 4107 } 4108 4109 // String returns path representation in proto convention 4110 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) String() string { 4111 return fp.selector.String() 4112 } 4113 4114 // JSONString returns path representation is JSON convention 4115 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) JSONString() string { 4116 return strcase.ToLowerCamel(fp.String()) 4117 } 4118 4119 // Get returns all values pointed by specific field from source AlertingCondition_Spec_TimeSeries_CombineThreshold 4120 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) Get(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (values []interface{}) { 4121 if source != nil { 4122 switch fp.selector { 4123 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4124 if source.PerMetric != nil { 4125 values = append(values, source.PerMetric) 4126 } 4127 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4128 values = append(values, source.MainMetricType) 4129 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4130 if source.PerMetricTypeKv != nil { 4131 values = append(values, source.PerMetricTypeKv) 4132 } 4133 default: 4134 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fp.selector)) 4135 } 4136 } 4137 return 4138 } 4139 4140 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4141 return fp.Get(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4142 } 4143 4144 // GetSingle returns value pointed by specific field of from source AlertingCondition_Spec_TimeSeries_CombineThreshold 4145 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) GetSingle(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (interface{}, bool) { 4146 switch fp.selector { 4147 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4148 res := source.GetPerMetric() 4149 return res, res != nil 4150 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4151 return source.GetMainMetricType(), source != nil 4152 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4153 res := source.GetPerMetricTypeKv() 4154 return res, res != nil 4155 default: 4156 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fp.selector)) 4157 } 4158 } 4159 4160 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4161 return fp.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4162 } 4163 4164 // GetDefault returns a default value of the field type 4165 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) GetDefault() interface{} { 4166 switch fp.selector { 4167 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4168 return (map[string]*AlertingCondition_Spec_TimeSeries_Threshold)(nil) 4169 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4170 return "" 4171 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4172 return (map[string][]byte)(nil) 4173 default: 4174 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fp.selector)) 4175 } 4176 } 4177 4178 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) ClearValue(item *AlertingCondition_Spec_TimeSeries_CombineThreshold) { 4179 if item != nil { 4180 switch fp.selector { 4181 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4182 item.PerMetric = nil 4183 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4184 item.MainMetricType = "" 4185 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4186 item.PerMetricTypeKv = nil 4187 default: 4188 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fp.selector)) 4189 } 4190 } 4191 } 4192 4193 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4194 fp.ClearValue(item.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4195 } 4196 4197 // IsLeaf - whether field path is holds simple value 4198 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) IsLeaf() bool { 4199 return fp.selector == AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType || 4200 fp.selector == AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv 4201 } 4202 4203 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4204 return []gotenobject.FieldPath{fp} 4205 } 4206 4207 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) WithIValue(value interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue { 4208 switch fp.selector { 4209 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4210 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: *fp, value: value.(map[string]*AlertingCondition_Spec_TimeSeries_Threshold)} 4211 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4212 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: *fp, value: value.(string)} 4213 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4214 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue{AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: *fp, value: value.(map[string][]byte)} 4215 default: 4216 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fp.selector)) 4217 } 4218 } 4219 4220 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4221 return fp.WithIValue(value) 4222 } 4223 4224 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues { 4225 fpaov := &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: *fp} 4226 switch fp.selector { 4227 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4228 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: *fp, values: values.([]map[string]*AlertingCondition_Spec_TimeSeries_Threshold)} 4229 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4230 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: *fp, values: values.([]string)} 4231 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4232 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues{AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: *fp, values: values.([]map[string][]byte)} 4233 default: 4234 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fp.selector)) 4235 } 4236 return fpaov 4237 } 4238 4239 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4240 return fp.WithIArrayOfValues(values) 4241 } 4242 4243 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue { 4244 switch fp.selector { 4245 default: 4246 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fp.selector)) 4247 } 4248 } 4249 4250 func (fp *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4251 return fp.WithIArrayItemValue(value) 4252 } 4253 4254 // FieldPath for map type with additional Key information 4255 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap struct { 4256 key string 4257 selector AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector 4258 } 4259 4260 var _ AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath = (*AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap)(nil) 4261 4262 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) Selector() AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelector { 4263 return fpm.selector 4264 } 4265 4266 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) Key() string { 4267 return fpm.key 4268 } 4269 4270 // String returns path representation in proto convention 4271 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) String() string { 4272 return fpm.selector.String() + "." + fpm.key 4273 } 4274 4275 // JSONString returns path representation is JSON convention. Note that map keys are not transformed 4276 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) JSONString() string { 4277 return strcase.ToLowerCamel(fpm.selector.String()) + "." + fpm.key 4278 } 4279 4280 // Get returns all values pointed by selected field map key from source AlertingCondition_Spec_TimeSeries_CombineThreshold 4281 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) Get(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (values []interface{}) { 4282 switch fpm.selector { 4283 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4284 if value, ok := source.GetPerMetric()[fpm.key]; ok { 4285 values = append(values, value) 4286 } 4287 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4288 if value, ok := source.GetPerMetricTypeKv()[fpm.key]; ok { 4289 values = append(values, value) 4290 } 4291 default: 4292 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpm.selector)) 4293 } 4294 return 4295 } 4296 4297 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) GetRaw(source proto.Message) []interface{} { 4298 return fpm.Get(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4299 } 4300 4301 // GetSingle returns value by selected field map key from source AlertingCondition_Spec_TimeSeries_CombineThreshold 4302 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) GetSingle(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (interface{}, bool) { 4303 switch fpm.selector { 4304 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4305 res, ok := source.GetPerMetric()[fpm.key] 4306 return res, ok 4307 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4308 res, ok := source.GetPerMetricTypeKv()[fpm.key] 4309 return res, ok 4310 default: 4311 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpm.selector)) 4312 } 4313 } 4314 4315 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) GetSingleRaw(source proto.Message) (interface{}, bool) { 4316 return fpm.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4317 } 4318 4319 // GetDefault returns a default value of the field type 4320 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) GetDefault() interface{} { 4321 switch fpm.selector { 4322 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4323 var v *AlertingCondition_Spec_TimeSeries_Threshold 4324 return v 4325 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4326 var v []byte 4327 return v 4328 default: 4329 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpm.selector)) 4330 } 4331 } 4332 4333 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) ClearValue(item *AlertingCondition_Spec_TimeSeries_CombineThreshold) { 4334 if item != nil { 4335 switch fpm.selector { 4336 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4337 delete(item.PerMetric, fpm.key) 4338 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4339 delete(item.PerMetricTypeKv, fpm.key) 4340 default: 4341 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpm.selector)) 4342 } 4343 } 4344 } 4345 4346 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) ClearValueRaw(item proto.Message) { 4347 fpm.ClearValue(item.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4348 } 4349 4350 // IsLeaf - whether field path is holds simple value 4351 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) IsLeaf() bool { 4352 switch fpm.selector { 4353 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4354 return false 4355 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4356 return true 4357 default: 4358 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpm.selector)) 4359 } 4360 } 4361 4362 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4363 return []gotenobject.FieldPath{fpm} 4364 } 4365 4366 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) WithIValue(value interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue { 4367 switch fpm.selector { 4368 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4369 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue{AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap: *fpm, value: value.(*AlertingCondition_Spec_TimeSeries_Threshold)} 4370 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4371 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue{AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap: *fpm, value: value.([]byte)} 4372 default: 4373 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpm.selector)) 4374 } 4375 } 4376 4377 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4378 return fpm.WithIValue(value) 4379 } 4380 4381 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) WithIArrayOfValues(values interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues { 4382 switch fpm.selector { 4383 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4384 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapArrayOfValues{AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap: *fpm, values: values.([]*AlertingCondition_Spec_TimeSeries_Threshold)} 4385 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4386 return &AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapArrayOfValues{AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap: *fpm, values: values.([][]byte)} 4387 default: 4388 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpm.selector)) 4389 } 4390 } 4391 4392 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4393 return fpm.WithIArrayOfValues(values) 4394 } 4395 4396 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) WithIArrayItemValue(value interface{}) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue { 4397 panic("Cannot create array item value from map fieldpath") 4398 } 4399 4400 func (fpm *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4401 return fpm.WithIArrayItemValue(value) 4402 } 4403 4404 // AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue allows storing values for CombineThreshold fields according to their type 4405 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue interface { 4406 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath 4407 gotenobject.FieldPathValue 4408 SetTo(target **AlertingCondition_Spec_TimeSeries_CombineThreshold) 4409 CompareWith(*AlertingCondition_Spec_TimeSeries_CombineThreshold) (cmp int, comparable bool) 4410 } 4411 4412 func ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue, error) { 4413 fp, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(pathStr) 4414 if err != nil { 4415 return nil, err 4416 } 4417 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4418 if err != nil { 4419 return nil, status.Errorf(codes.InvalidArgument, "error parsing CombineThreshold field path value from %s: %v", valueStr, err) 4420 } 4421 return fpv.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue), nil 4422 } 4423 4424 func MustParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue(pathStr, valueStr string) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue { 4425 fpv, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue(pathStr, valueStr) 4426 if err != nil { 4427 panic(err) 4428 } 4429 return fpv 4430 } 4431 4432 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue struct { 4433 AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath 4434 value interface{} 4435 } 4436 4437 var _ AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue = (*AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue)(nil) 4438 4439 // GetRawValue returns raw value stored under selected path for 'CombineThreshold' as interface{} 4440 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) GetRawValue() interface{} { 4441 return fpv.value 4442 } 4443 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) AsPerMetricValue() (map[string]*AlertingCondition_Spec_TimeSeries_Threshold, bool) { 4444 res, ok := fpv.value.(map[string]*AlertingCondition_Spec_TimeSeries_Threshold) 4445 return res, ok 4446 } 4447 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) AsMainMetricTypeValue() (string, bool) { 4448 res, ok := fpv.value.(string) 4449 return res, ok 4450 } 4451 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) AsPerMetricTypeKvValue() (map[string][]byte, bool) { 4452 res, ok := fpv.value.(map[string][]byte) 4453 return res, ok 4454 } 4455 4456 // SetTo stores value for selected field for object CombineThreshold 4457 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) SetTo(target **AlertingCondition_Spec_TimeSeries_CombineThreshold) { 4458 if *target == nil { 4459 *target = new(AlertingCondition_Spec_TimeSeries_CombineThreshold) 4460 } 4461 switch fpv.selector { 4462 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4463 (*target).PerMetric = fpv.value.(map[string]*AlertingCondition_Spec_TimeSeries_Threshold) 4464 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4465 (*target).MainMetricType = fpv.value.(string) 4466 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4467 (*target).PerMetricTypeKv = fpv.value.(map[string][]byte) 4468 default: 4469 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpv.selector)) 4470 } 4471 } 4472 4473 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4474 typedObject := target.(*AlertingCondition_Spec_TimeSeries_CombineThreshold) 4475 fpv.SetTo(&typedObject) 4476 } 4477 4478 // CompareWith compares value in the 'AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue' with the value under path in 'AlertingCondition_Spec_TimeSeries_CombineThreshold'. 4479 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) CompareWith(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (int, bool) { 4480 switch fpv.selector { 4481 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4482 return 0, false 4483 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4484 leftValue := fpv.value.(string) 4485 rightValue := source.GetMainMetricType() 4486 if (leftValue) == (rightValue) { 4487 return 0, true 4488 } else if (leftValue) < (rightValue) { 4489 return -1, true 4490 } else { 4491 return 1, true 4492 } 4493 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4494 return 0, false 4495 default: 4496 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpv.selector)) 4497 } 4498 } 4499 4500 func (fpv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4501 return fpv.CompareWith(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4502 } 4503 4504 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue struct { 4505 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap 4506 value interface{} 4507 } 4508 4509 var _ AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathValue = (*AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue)(nil) 4510 4511 // GetValue returns value stored under selected field in CombineThreshold as interface{} 4512 func (fpmv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue) GetRawValue() interface{} { 4513 return fpmv.value 4514 } 4515 func (fpmv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue) AsPerMetricElementValue() (*AlertingCondition_Spec_TimeSeries_Threshold, bool) { 4516 res, ok := fpmv.value.(*AlertingCondition_Spec_TimeSeries_Threshold) 4517 return res, ok 4518 } 4519 func (fpmv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue) AsPerMetricTypeKvElementValue() ([]byte, bool) { 4520 res, ok := fpmv.value.([]byte) 4521 return res, ok 4522 } 4523 4524 // SetTo stores value for selected field in CombineThreshold 4525 func (fpmv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue) SetTo(target **AlertingCondition_Spec_TimeSeries_CombineThreshold) { 4526 if *target == nil { 4527 *target = new(AlertingCondition_Spec_TimeSeries_CombineThreshold) 4528 } 4529 switch fpmv.selector { 4530 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4531 if (*target).PerMetric == nil { 4532 (*target).PerMetric = make(map[string]*AlertingCondition_Spec_TimeSeries_Threshold) 4533 } 4534 (*target).PerMetric[fpmv.key] = fpmv.value.(*AlertingCondition_Spec_TimeSeries_Threshold) 4535 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4536 if (*target).PerMetricTypeKv == nil { 4537 (*target).PerMetricTypeKv = make(map[string][]byte) 4538 } 4539 (*target).PerMetricTypeKv[fpmv.key] = fpmv.value.([]byte) 4540 default: 4541 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpmv.selector)) 4542 } 4543 } 4544 4545 func (fpmv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue) SetToRaw(target proto.Message) { 4546 typedObject := target.(*AlertingCondition_Spec_TimeSeries_CombineThreshold) 4547 fpmv.SetTo(&typedObject) 4548 } 4549 4550 // CompareWith compares value in the 'AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue' with the value under path in 'AlertingCondition_Spec_TimeSeries_CombineThreshold'. 4551 func (fpmv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue) CompareWith(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (int, bool) { 4552 switch fpmv.selector { 4553 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4554 return 0, false 4555 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4556 return 0, false 4557 default: 4558 panic(fmt.Sprintf("Invalid selector for AlertingCondition_Spec_TimeSeries_CombineThreshold: %d", fpmv.selector)) 4559 } 4560 } 4561 4562 func (fpmv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapValue) CompareWithRaw(source proto.Message) (int, bool) { 4563 return fpmv.CompareWith(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4564 } 4565 4566 // AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue allows storing single item in Path-specific values for CombineThreshold according to their type 4567 // Present only for array (repeated) types. 4568 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue interface { 4569 gotenobject.FieldPathArrayItemValue 4570 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath 4571 ContainsValue(*AlertingCondition_Spec_TimeSeries_CombineThreshold) bool 4572 } 4573 4574 // ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4575 func ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue, error) { 4576 fp, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(pathStr) 4577 if err != nil { 4578 return nil, err 4579 } 4580 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4581 if err != nil { 4582 return nil, status.Errorf(codes.InvalidArgument, "error parsing CombineThreshold field path array item value from %s: %v", valueStr, err) 4583 } 4584 return fpaiv.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue), nil 4585 } 4586 4587 func MustParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue(pathStr, valueStr string) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue { 4588 fpaiv, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue(pathStr, valueStr) 4589 if err != nil { 4590 panic(err) 4591 } 4592 return fpaiv 4593 } 4594 4595 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayItemValue struct { 4596 AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath 4597 value interface{} 4598 } 4599 4600 var _ AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayItemValue = (*AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayItemValue)(nil) 4601 4602 // GetRawValue returns stored element value for array in object AlertingCondition_Spec_TimeSeries_CombineThreshold as interface{} 4603 func (fpaiv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4604 return fpaiv.value 4605 } 4606 4607 func (fpaiv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) (interface{}, bool) { 4608 return nil, false 4609 } 4610 4611 func (fpaiv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4612 return fpaiv.GetSingle(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 4613 } 4614 4615 // Contains returns a boolean indicating if value that is being held is present in given 'CombineThreshold' 4616 func (fpaiv *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) bool { 4617 slice := fpaiv.AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath.Get(source) 4618 for _, v := range slice { 4619 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4620 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4621 return true 4622 } 4623 } else if reflect.DeepEqual(v, fpaiv.value) { 4624 return true 4625 } 4626 } 4627 return false 4628 } 4629 4630 // AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues allows storing slice of values for CombineThreshold fields according to their type 4631 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues interface { 4632 gotenobject.FieldPathArrayOfValues 4633 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath 4634 } 4635 4636 func ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues, error) { 4637 fp, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(pathStr) 4638 if err != nil { 4639 return nil, err 4640 } 4641 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4642 if err != nil { 4643 return nil, status.Errorf(codes.InvalidArgument, "error parsing CombineThreshold field path array of values from %s: %v", valuesStr, err) 4644 } 4645 return fpaov.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues), nil 4646 } 4647 4648 func MustParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues { 4649 fpaov, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues(pathStr, valuesStr) 4650 if err != nil { 4651 panic(err) 4652 } 4653 return fpaov 4654 } 4655 4656 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues struct { 4657 AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath 4658 values interface{} 4659 } 4660 4661 var _ AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues)(nil) 4662 4663 func (fpaov *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4664 switch fpaov.selector { 4665 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4666 for _, v := range fpaov.values.([]map[string]*AlertingCondition_Spec_TimeSeries_Threshold) { 4667 values = append(values, v) 4668 } 4669 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 4670 for _, v := range fpaov.values.([]string) { 4671 values = append(values, v) 4672 } 4673 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4674 for _, v := range fpaov.values.([]map[string][]byte) { 4675 values = append(values, v) 4676 } 4677 } 4678 return 4679 } 4680 func (fpaov *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues) AsPerMetricArrayOfValues() ([]map[string]*AlertingCondition_Spec_TimeSeries_Threshold, bool) { 4681 res, ok := fpaov.values.([]map[string]*AlertingCondition_Spec_TimeSeries_Threshold) 4682 return res, ok 4683 } 4684 func (fpaov *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues) AsMainMetricTypeArrayOfValues() ([]string, bool) { 4685 res, ok := fpaov.values.([]string) 4686 return res, ok 4687 } 4688 func (fpaov *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPathArrayOfValues) AsPerMetricTypeKvArrayOfValues() ([]map[string][]byte, bool) { 4689 res, ok := fpaov.values.([]map[string][]byte) 4690 return res, ok 4691 } 4692 4693 type AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapArrayOfValues struct { 4694 AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap 4695 values interface{} 4696 } 4697 4698 var _ AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathArrayOfValues = (*AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapArrayOfValues)(nil) 4699 4700 func (fpmaov *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapArrayOfValues) GetRawValues() (values []interface{}) { 4701 switch fpmaov.selector { 4702 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 4703 for _, v := range fpmaov.values.([]*AlertingCondition_Spec_TimeSeries_Threshold) { 4704 values = append(values, v) 4705 } 4706 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 4707 for _, v := range fpmaov.values.([][]byte) { 4708 values = append(values, v) 4709 } 4710 } 4711 return 4712 } 4713 func (fpmaov *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapArrayOfValues) AsPerMetricArrayOfElementValues() ([]*AlertingCondition_Spec_TimeSeries_Threshold, bool) { 4714 res, ok := fpmaov.values.([]*AlertingCondition_Spec_TimeSeries_Threshold) 4715 return res, ok 4716 } 4717 func (fpmaov *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMapArrayOfValues) AsPerMetricTypeKvArrayOfElementValues() ([][]byte, bool) { 4718 res, ok := fpmaov.values.([][]byte) 4719 return res, ok 4720 }