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