github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v3/notification/notification.pb.fieldpath.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/monitoring/proto/v3/notification.proto 3 // DO NOT EDIT!!! 4 5 package notification 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 alert "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/alert" 27 alerting_condition "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/alerting_condition" 28 alerting_policy "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/alerting_policy" 29 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/common" 30 notification_channel "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/notification_channel" 31 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/project" 32 meta "github.com/cloudwan/goten-sdk/types/meta" 33 ) 34 35 // ensure the imports are used 36 var ( 37 _ = new(json.Marshaler) 38 _ = new(fmt.Stringer) 39 _ = reflect.DeepEqual 40 _ = strings.Builder{} 41 _ = time.Second 42 43 _ = strcase.ToLowerCamel 44 _ = codes.NotFound 45 _ = status.Status{} 46 _ = protojson.UnmarshalOptions{} 47 _ = new(proto.Message) 48 _ = protoregistry.GlobalTypes 49 50 _ = new(gotenobject.FieldPath) 51 ) 52 53 // make sure we're using proto imports 54 var ( 55 _ = &alert.Alert{} 56 _ = &alerting_condition.AlertingCondition{} 57 _ = &alerting_policy.AlertingPolicy{} 58 _ = &common.LabelDescriptor{} 59 _ = ¬ification_channel.NotificationChannel{} 60 _ = &project.Project{} 61 _ = &meta.Meta{} 62 ) 63 64 // FieldPath provides implementation to handle 65 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 66 type Notification_FieldPath interface { 67 gotenobject.FieldPath 68 Selector() Notification_FieldPathSelector 69 Get(source *Notification) []interface{} 70 GetSingle(source *Notification) (interface{}, bool) 71 ClearValue(item *Notification) 72 73 // Those methods build corresponding Notification_FieldPathValue 74 // (or array of values) and holds passed value. Panics if injected type is incorrect. 75 WithIValue(value interface{}) Notification_FieldPathValue 76 WithIArrayOfValues(values interface{}) Notification_FieldPathArrayOfValues 77 WithIArrayItemValue(value interface{}) Notification_FieldPathArrayItemValue 78 } 79 80 type Notification_FieldPathSelector int32 81 82 const ( 83 Notification_FieldPathSelectorName Notification_FieldPathSelector = 0 84 Notification_FieldPathSelectorMetadata Notification_FieldPathSelector = 1 85 Notification_FieldPathSelectorAlertingPolicy Notification_FieldPathSelector = 2 86 Notification_FieldPathSelectorAlerts Notification_FieldPathSelector = 3 87 Notification_FieldPathSelectorState Notification_FieldPathSelector = 4 88 ) 89 90 func (s Notification_FieldPathSelector) String() string { 91 switch s { 92 case Notification_FieldPathSelectorName: 93 return "name" 94 case Notification_FieldPathSelectorMetadata: 95 return "metadata" 96 case Notification_FieldPathSelectorAlertingPolicy: 97 return "alerting_policy" 98 case Notification_FieldPathSelectorAlerts: 99 return "alerts" 100 case Notification_FieldPathSelectorState: 101 return "state" 102 default: 103 panic(fmt.Sprintf("Invalid selector for Notification: %d", s)) 104 } 105 } 106 107 func BuildNotification_FieldPath(fp gotenobject.RawFieldPath) (Notification_FieldPath, error) { 108 if len(fp) == 0 { 109 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification") 110 } 111 if len(fp) == 1 { 112 switch fp[0] { 113 case "name": 114 return &Notification_FieldTerminalPath{selector: Notification_FieldPathSelectorName}, nil 115 case "metadata": 116 return &Notification_FieldTerminalPath{selector: Notification_FieldPathSelectorMetadata}, nil 117 case "alerting_policy", "alertingPolicy", "alerting-policy": 118 return &Notification_FieldTerminalPath{selector: Notification_FieldPathSelectorAlertingPolicy}, nil 119 case "alerts": 120 return &Notification_FieldTerminalPath{selector: Notification_FieldPathSelectorAlerts}, nil 121 case "state": 122 return &Notification_FieldTerminalPath{selector: Notification_FieldPathSelectorState}, nil 123 } 124 } else { 125 switch fp[0] { 126 case "metadata": 127 if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil { 128 return nil, err 129 } else { 130 return &Notification_FieldSubPath{selector: Notification_FieldPathSelectorMetadata, subPath: subpath}, nil 131 } 132 case "state": 133 if subpath, err := BuildNotificationState_FieldPath(fp[1:]); err != nil { 134 return nil, err 135 } else { 136 return &Notification_FieldSubPath{selector: Notification_FieldPathSelectorState, subPath: subpath}, nil 137 } 138 } 139 } 140 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification", fp) 141 } 142 143 func ParseNotification_FieldPath(rawField string) (Notification_FieldPath, error) { 144 fp, err := gotenobject.ParseRawFieldPath(rawField) 145 if err != nil { 146 return nil, err 147 } 148 return BuildNotification_FieldPath(fp) 149 } 150 151 func MustParseNotification_FieldPath(rawField string) Notification_FieldPath { 152 fp, err := ParseNotification_FieldPath(rawField) 153 if err != nil { 154 panic(err) 155 } 156 return fp 157 } 158 159 type Notification_FieldTerminalPath struct { 160 selector Notification_FieldPathSelector 161 } 162 163 var _ Notification_FieldPath = (*Notification_FieldTerminalPath)(nil) 164 165 func (fp *Notification_FieldTerminalPath) Selector() Notification_FieldPathSelector { 166 return fp.selector 167 } 168 169 // String returns path representation in proto convention 170 func (fp *Notification_FieldTerminalPath) String() string { 171 return fp.selector.String() 172 } 173 174 // JSONString returns path representation is JSON convention 175 func (fp *Notification_FieldTerminalPath) JSONString() string { 176 return strcase.ToLowerCamel(fp.String()) 177 } 178 179 // Get returns all values pointed by specific field from source Notification 180 func (fp *Notification_FieldTerminalPath) Get(source *Notification) (values []interface{}) { 181 if source != nil { 182 switch fp.selector { 183 case Notification_FieldPathSelectorName: 184 if source.Name != nil { 185 values = append(values, source.Name) 186 } 187 case Notification_FieldPathSelectorMetadata: 188 if source.Metadata != nil { 189 values = append(values, source.Metadata) 190 } 191 case Notification_FieldPathSelectorAlertingPolicy: 192 if source.AlertingPolicy != nil { 193 values = append(values, source.AlertingPolicy) 194 } 195 case Notification_FieldPathSelectorAlerts: 196 for _, value := range source.GetAlerts() { 197 values = append(values, value) 198 } 199 case Notification_FieldPathSelectorState: 200 if source.State != nil { 201 values = append(values, source.State) 202 } 203 default: 204 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 205 } 206 } 207 return 208 } 209 210 func (fp *Notification_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 211 return fp.Get(source.(*Notification)) 212 } 213 214 // GetSingle returns value pointed by specific field of from source Notification 215 func (fp *Notification_FieldTerminalPath) GetSingle(source *Notification) (interface{}, bool) { 216 switch fp.selector { 217 case Notification_FieldPathSelectorName: 218 res := source.GetName() 219 return res, res != nil 220 case Notification_FieldPathSelectorMetadata: 221 res := source.GetMetadata() 222 return res, res != nil 223 case Notification_FieldPathSelectorAlertingPolicy: 224 res := source.GetAlertingPolicy() 225 return res, res != nil 226 case Notification_FieldPathSelectorAlerts: 227 res := source.GetAlerts() 228 return res, res != nil 229 case Notification_FieldPathSelectorState: 230 res := source.GetState() 231 return res, res != nil 232 default: 233 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 234 } 235 } 236 237 func (fp *Notification_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 238 return fp.GetSingle(source.(*Notification)) 239 } 240 241 // GetDefault returns a default value of the field type 242 func (fp *Notification_FieldTerminalPath) GetDefault() interface{} { 243 switch fp.selector { 244 case Notification_FieldPathSelectorName: 245 return (*Name)(nil) 246 case Notification_FieldPathSelectorMetadata: 247 return (*meta.Meta)(nil) 248 case Notification_FieldPathSelectorAlertingPolicy: 249 return (*alerting_policy.Name)(nil) 250 case Notification_FieldPathSelectorAlerts: 251 return ([]*alert.Name)(nil) 252 case Notification_FieldPathSelectorState: 253 return (*Notification_State)(nil) 254 default: 255 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 256 } 257 } 258 259 func (fp *Notification_FieldTerminalPath) ClearValue(item *Notification) { 260 if item != nil { 261 switch fp.selector { 262 case Notification_FieldPathSelectorName: 263 item.Name = nil 264 case Notification_FieldPathSelectorMetadata: 265 item.Metadata = nil 266 case Notification_FieldPathSelectorAlertingPolicy: 267 item.AlertingPolicy = nil 268 case Notification_FieldPathSelectorAlerts: 269 item.Alerts = nil 270 case Notification_FieldPathSelectorState: 271 item.State = nil 272 default: 273 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 274 } 275 } 276 } 277 278 func (fp *Notification_FieldTerminalPath) ClearValueRaw(item proto.Message) { 279 fp.ClearValue(item.(*Notification)) 280 } 281 282 // IsLeaf - whether field path is holds simple value 283 func (fp *Notification_FieldTerminalPath) IsLeaf() bool { 284 return fp.selector == Notification_FieldPathSelectorName || 285 fp.selector == Notification_FieldPathSelectorAlertingPolicy || 286 fp.selector == Notification_FieldPathSelectorAlerts 287 } 288 289 func (fp *Notification_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 290 return []gotenobject.FieldPath{fp} 291 } 292 293 func (fp *Notification_FieldTerminalPath) WithIValue(value interface{}) Notification_FieldPathValue { 294 switch fp.selector { 295 case Notification_FieldPathSelectorName: 296 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.(*Name)} 297 case Notification_FieldPathSelectorMetadata: 298 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.(*meta.Meta)} 299 case Notification_FieldPathSelectorAlertingPolicy: 300 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.(*alerting_policy.Name)} 301 case Notification_FieldPathSelectorAlerts: 302 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.([]*alert.Name)} 303 case Notification_FieldPathSelectorState: 304 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.(*Notification_State)} 305 default: 306 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 307 } 308 } 309 310 func (fp *Notification_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 311 return fp.WithIValue(value) 312 } 313 314 func (fp *Notification_FieldTerminalPath) WithIArrayOfValues(values interface{}) Notification_FieldPathArrayOfValues { 315 fpaov := &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp} 316 switch fp.selector { 317 case Notification_FieldPathSelectorName: 318 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([]*Name)} 319 case Notification_FieldPathSelectorMetadata: 320 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([]*meta.Meta)} 321 case Notification_FieldPathSelectorAlertingPolicy: 322 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([]*alerting_policy.Name)} 323 case Notification_FieldPathSelectorAlerts: 324 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([][]*alert.Name)} 325 case Notification_FieldPathSelectorState: 326 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([]*Notification_State)} 327 default: 328 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 329 } 330 return fpaov 331 } 332 333 func (fp *Notification_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 334 return fp.WithIArrayOfValues(values) 335 } 336 337 func (fp *Notification_FieldTerminalPath) WithIArrayItemValue(value interface{}) Notification_FieldPathArrayItemValue { 338 switch fp.selector { 339 case Notification_FieldPathSelectorAlerts: 340 return &Notification_FieldTerminalPathArrayItemValue{Notification_FieldTerminalPath: *fp, value: value.(*alert.Name)} 341 default: 342 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 343 } 344 } 345 346 func (fp *Notification_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 347 return fp.WithIArrayItemValue(value) 348 } 349 350 type Notification_FieldSubPath struct { 351 selector Notification_FieldPathSelector 352 subPath gotenobject.FieldPath 353 } 354 355 var _ Notification_FieldPath = (*Notification_FieldSubPath)(nil) 356 357 func (fps *Notification_FieldSubPath) Selector() Notification_FieldPathSelector { 358 return fps.selector 359 } 360 func (fps *Notification_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) { 361 res, ok := fps.subPath.(meta.Meta_FieldPath) 362 return res, ok 363 } 364 func (fps *Notification_FieldSubPath) AsStateSubPath() (NotificationState_FieldPath, bool) { 365 res, ok := fps.subPath.(NotificationState_FieldPath) 366 return res, ok 367 } 368 369 // String returns path representation in proto convention 370 func (fps *Notification_FieldSubPath) String() string { 371 return fps.selector.String() + "." + fps.subPath.String() 372 } 373 374 // JSONString returns path representation is JSON convention 375 func (fps *Notification_FieldSubPath) JSONString() string { 376 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 377 } 378 379 // Get returns all values pointed by selected field from source Notification 380 func (fps *Notification_FieldSubPath) Get(source *Notification) (values []interface{}) { 381 switch fps.selector { 382 case Notification_FieldPathSelectorMetadata: 383 values = append(values, fps.subPath.GetRaw(source.GetMetadata())...) 384 case Notification_FieldPathSelectorState: 385 values = append(values, fps.subPath.GetRaw(source.GetState())...) 386 default: 387 panic(fmt.Sprintf("Invalid selector for Notification: %d", fps.selector)) 388 } 389 return 390 } 391 392 func (fps *Notification_FieldSubPath) GetRaw(source proto.Message) []interface{} { 393 return fps.Get(source.(*Notification)) 394 } 395 396 // GetSingle returns value of selected field from source Notification 397 func (fps *Notification_FieldSubPath) GetSingle(source *Notification) (interface{}, bool) { 398 switch fps.selector { 399 case Notification_FieldPathSelectorMetadata: 400 if source.GetMetadata() == nil { 401 return nil, false 402 } 403 return fps.subPath.GetSingleRaw(source.GetMetadata()) 404 case Notification_FieldPathSelectorState: 405 if source.GetState() == nil { 406 return nil, false 407 } 408 return fps.subPath.GetSingleRaw(source.GetState()) 409 default: 410 panic(fmt.Sprintf("Invalid selector for Notification: %d", fps.selector)) 411 } 412 } 413 414 func (fps *Notification_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 415 return fps.GetSingle(source.(*Notification)) 416 } 417 418 // GetDefault returns a default value of the field type 419 func (fps *Notification_FieldSubPath) GetDefault() interface{} { 420 return fps.subPath.GetDefault() 421 } 422 423 func (fps *Notification_FieldSubPath) ClearValue(item *Notification) { 424 if item != nil { 425 switch fps.selector { 426 case Notification_FieldPathSelectorMetadata: 427 fps.subPath.ClearValueRaw(item.Metadata) 428 case Notification_FieldPathSelectorState: 429 fps.subPath.ClearValueRaw(item.State) 430 default: 431 panic(fmt.Sprintf("Invalid selector for Notification: %d", fps.selector)) 432 } 433 } 434 } 435 436 func (fps *Notification_FieldSubPath) ClearValueRaw(item proto.Message) { 437 fps.ClearValue(item.(*Notification)) 438 } 439 440 // IsLeaf - whether field path is holds simple value 441 func (fps *Notification_FieldSubPath) IsLeaf() bool { 442 return fps.subPath.IsLeaf() 443 } 444 445 func (fps *Notification_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 446 iPaths := []gotenobject.FieldPath{&Notification_FieldTerminalPath{selector: fps.selector}} 447 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 448 return iPaths 449 } 450 451 func (fps *Notification_FieldSubPath) WithIValue(value interface{}) Notification_FieldPathValue { 452 return &Notification_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 453 } 454 455 func (fps *Notification_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 456 return fps.WithIValue(value) 457 } 458 459 func (fps *Notification_FieldSubPath) WithIArrayOfValues(values interface{}) Notification_FieldPathArrayOfValues { 460 return &Notification_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 461 } 462 463 func (fps *Notification_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 464 return fps.WithIArrayOfValues(values) 465 } 466 467 func (fps *Notification_FieldSubPath) WithIArrayItemValue(value interface{}) Notification_FieldPathArrayItemValue { 468 return &Notification_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 469 } 470 471 func (fps *Notification_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 472 return fps.WithIArrayItemValue(value) 473 } 474 475 // Notification_FieldPathValue allows storing values for Notification fields according to their type 476 type Notification_FieldPathValue interface { 477 Notification_FieldPath 478 gotenobject.FieldPathValue 479 SetTo(target **Notification) 480 CompareWith(*Notification) (cmp int, comparable bool) 481 } 482 483 func ParseNotification_FieldPathValue(pathStr, valueStr string) (Notification_FieldPathValue, error) { 484 fp, err := ParseNotification_FieldPath(pathStr) 485 if err != nil { 486 return nil, err 487 } 488 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 489 if err != nil { 490 return nil, status.Errorf(codes.InvalidArgument, "error parsing Notification field path value from %s: %v", valueStr, err) 491 } 492 return fpv.(Notification_FieldPathValue), nil 493 } 494 495 func MustParseNotification_FieldPathValue(pathStr, valueStr string) Notification_FieldPathValue { 496 fpv, err := ParseNotification_FieldPathValue(pathStr, valueStr) 497 if err != nil { 498 panic(err) 499 } 500 return fpv 501 } 502 503 type Notification_FieldTerminalPathValue struct { 504 Notification_FieldTerminalPath 505 value interface{} 506 } 507 508 var _ Notification_FieldPathValue = (*Notification_FieldTerminalPathValue)(nil) 509 510 // GetRawValue returns raw value stored under selected path for 'Notification' as interface{} 511 func (fpv *Notification_FieldTerminalPathValue) GetRawValue() interface{} { 512 return fpv.value 513 } 514 func (fpv *Notification_FieldTerminalPathValue) AsNameValue() (*Name, bool) { 515 res, ok := fpv.value.(*Name) 516 return res, ok 517 } 518 func (fpv *Notification_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) { 519 res, ok := fpv.value.(*meta.Meta) 520 return res, ok 521 } 522 func (fpv *Notification_FieldTerminalPathValue) AsAlertingPolicyValue() (*alerting_policy.Name, bool) { 523 res, ok := fpv.value.(*alerting_policy.Name) 524 return res, ok 525 } 526 func (fpv *Notification_FieldTerminalPathValue) AsAlertsValue() ([]*alert.Name, bool) { 527 res, ok := fpv.value.([]*alert.Name) 528 return res, ok 529 } 530 func (fpv *Notification_FieldTerminalPathValue) AsStateValue() (*Notification_State, bool) { 531 res, ok := fpv.value.(*Notification_State) 532 return res, ok 533 } 534 535 // SetTo stores value for selected field for object Notification 536 func (fpv *Notification_FieldTerminalPathValue) SetTo(target **Notification) { 537 if *target == nil { 538 *target = new(Notification) 539 } 540 switch fpv.selector { 541 case Notification_FieldPathSelectorName: 542 (*target).Name = fpv.value.(*Name) 543 case Notification_FieldPathSelectorMetadata: 544 (*target).Metadata = fpv.value.(*meta.Meta) 545 case Notification_FieldPathSelectorAlertingPolicy: 546 (*target).AlertingPolicy = fpv.value.(*alerting_policy.Name) 547 case Notification_FieldPathSelectorAlerts: 548 (*target).Alerts = fpv.value.([]*alert.Name) 549 case Notification_FieldPathSelectorState: 550 (*target).State = fpv.value.(*Notification_State) 551 default: 552 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpv.selector)) 553 } 554 } 555 556 func (fpv *Notification_FieldTerminalPathValue) SetToRaw(target proto.Message) { 557 typedObject := target.(*Notification) 558 fpv.SetTo(&typedObject) 559 } 560 561 // CompareWith compares value in the 'Notification_FieldTerminalPathValue' with the value under path in 'Notification'. 562 func (fpv *Notification_FieldTerminalPathValue) CompareWith(source *Notification) (int, bool) { 563 switch fpv.selector { 564 case Notification_FieldPathSelectorName: 565 leftValue := fpv.value.(*Name) 566 rightValue := source.GetName() 567 if leftValue == nil { 568 if rightValue != nil { 569 return -1, true 570 } 571 return 0, true 572 } 573 if rightValue == nil { 574 return 1, true 575 } 576 if leftValue.String() == rightValue.String() { 577 return 0, true 578 } else if leftValue.String() < rightValue.String() { 579 return -1, true 580 } else { 581 return 1, true 582 } 583 case Notification_FieldPathSelectorMetadata: 584 return 0, false 585 case Notification_FieldPathSelectorAlertingPolicy: 586 leftValue := fpv.value.(*alerting_policy.Name) 587 rightValue := source.GetAlertingPolicy() 588 if leftValue == nil { 589 if rightValue != nil { 590 return -1, true 591 } 592 return 0, true 593 } 594 if rightValue == nil { 595 return 1, true 596 } 597 if leftValue.String() == rightValue.String() { 598 return 0, true 599 } else if leftValue.String() < rightValue.String() { 600 return -1, true 601 } else { 602 return 1, true 603 } 604 case Notification_FieldPathSelectorAlerts: 605 return 0, false 606 case Notification_FieldPathSelectorState: 607 return 0, false 608 default: 609 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpv.selector)) 610 } 611 } 612 613 func (fpv *Notification_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 614 return fpv.CompareWith(source.(*Notification)) 615 } 616 617 type Notification_FieldSubPathValue struct { 618 Notification_FieldPath 619 subPathValue gotenobject.FieldPathValue 620 } 621 622 var _ Notification_FieldPathValue = (*Notification_FieldSubPathValue)(nil) 623 624 func (fpvs *Notification_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) { 625 res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue) 626 return res, ok 627 } 628 func (fpvs *Notification_FieldSubPathValue) AsStatePathValue() (NotificationState_FieldPathValue, bool) { 629 res, ok := fpvs.subPathValue.(NotificationState_FieldPathValue) 630 return res, ok 631 } 632 633 func (fpvs *Notification_FieldSubPathValue) SetTo(target **Notification) { 634 if *target == nil { 635 *target = new(Notification) 636 } 637 switch fpvs.Selector() { 638 case Notification_FieldPathSelectorMetadata: 639 fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata) 640 case Notification_FieldPathSelectorState: 641 fpvs.subPathValue.(NotificationState_FieldPathValue).SetTo(&(*target).State) 642 default: 643 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpvs.Selector())) 644 } 645 } 646 647 func (fpvs *Notification_FieldSubPathValue) SetToRaw(target proto.Message) { 648 typedObject := target.(*Notification) 649 fpvs.SetTo(&typedObject) 650 } 651 652 func (fpvs *Notification_FieldSubPathValue) GetRawValue() interface{} { 653 return fpvs.subPathValue.GetRawValue() 654 } 655 656 func (fpvs *Notification_FieldSubPathValue) CompareWith(source *Notification) (int, bool) { 657 switch fpvs.Selector() { 658 case Notification_FieldPathSelectorMetadata: 659 return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata()) 660 case Notification_FieldPathSelectorState: 661 return fpvs.subPathValue.(NotificationState_FieldPathValue).CompareWith(source.GetState()) 662 default: 663 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpvs.Selector())) 664 } 665 } 666 667 func (fpvs *Notification_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 668 return fpvs.CompareWith(source.(*Notification)) 669 } 670 671 // Notification_FieldPathArrayItemValue allows storing single item in Path-specific values for Notification according to their type 672 // Present only for array (repeated) types. 673 type Notification_FieldPathArrayItemValue interface { 674 gotenobject.FieldPathArrayItemValue 675 Notification_FieldPath 676 ContainsValue(*Notification) bool 677 } 678 679 // ParseNotification_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 680 func ParseNotification_FieldPathArrayItemValue(pathStr, valueStr string) (Notification_FieldPathArrayItemValue, error) { 681 fp, err := ParseNotification_FieldPath(pathStr) 682 if err != nil { 683 return nil, err 684 } 685 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 686 if err != nil { 687 return nil, status.Errorf(codes.InvalidArgument, "error parsing Notification field path array item value from %s: %v", valueStr, err) 688 } 689 return fpaiv.(Notification_FieldPathArrayItemValue), nil 690 } 691 692 func MustParseNotification_FieldPathArrayItemValue(pathStr, valueStr string) Notification_FieldPathArrayItemValue { 693 fpaiv, err := ParseNotification_FieldPathArrayItemValue(pathStr, valueStr) 694 if err != nil { 695 panic(err) 696 } 697 return fpaiv 698 } 699 700 type Notification_FieldTerminalPathArrayItemValue struct { 701 Notification_FieldTerminalPath 702 value interface{} 703 } 704 705 var _ Notification_FieldPathArrayItemValue = (*Notification_FieldTerminalPathArrayItemValue)(nil) 706 707 // GetRawValue returns stored element value for array in object Notification as interface{} 708 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 709 return fpaiv.value 710 } 711 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) AsAlertsItemValue() (*alert.Name, bool) { 712 res, ok := fpaiv.value.(*alert.Name) 713 return res, ok 714 } 715 716 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) GetSingle(source *Notification) (interface{}, bool) { 717 return nil, false 718 } 719 720 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 721 return fpaiv.GetSingle(source.(*Notification)) 722 } 723 724 // Contains returns a boolean indicating if value that is being held is present in given 'Notification' 725 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification) bool { 726 slice := fpaiv.Notification_FieldTerminalPath.Get(source) 727 for _, v := range slice { 728 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 729 if proto.Equal(asProtoMsg, v.(proto.Message)) { 730 return true 731 } 732 } else if reflect.DeepEqual(v, fpaiv.value) { 733 return true 734 } 735 } 736 return false 737 } 738 739 type Notification_FieldSubPathArrayItemValue struct { 740 Notification_FieldPath 741 subPathItemValue gotenobject.FieldPathArrayItemValue 742 } 743 744 // GetRawValue returns stored array item value 745 func (fpaivs *Notification_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 746 return fpaivs.subPathItemValue.GetRawItemValue() 747 } 748 func (fpaivs *Notification_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) { 749 res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue) 750 return res, ok 751 } 752 func (fpaivs *Notification_FieldSubPathArrayItemValue) AsStatePathItemValue() (NotificationState_FieldPathArrayItemValue, bool) { 753 res, ok := fpaivs.subPathItemValue.(NotificationState_FieldPathArrayItemValue) 754 return res, ok 755 } 756 757 // Contains returns a boolean indicating if value that is being held is present in given 'Notification' 758 func (fpaivs *Notification_FieldSubPathArrayItemValue) ContainsValue(source *Notification) bool { 759 switch fpaivs.Selector() { 760 case Notification_FieldPathSelectorMetadata: 761 return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata()) 762 case Notification_FieldPathSelectorState: 763 return fpaivs.subPathItemValue.(NotificationState_FieldPathArrayItemValue).ContainsValue(source.GetState()) 764 default: 765 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpaivs.Selector())) 766 } 767 } 768 769 // Notification_FieldPathArrayOfValues allows storing slice of values for Notification fields according to their type 770 type Notification_FieldPathArrayOfValues interface { 771 gotenobject.FieldPathArrayOfValues 772 Notification_FieldPath 773 } 774 775 func ParseNotification_FieldPathArrayOfValues(pathStr, valuesStr string) (Notification_FieldPathArrayOfValues, error) { 776 fp, err := ParseNotification_FieldPath(pathStr) 777 if err != nil { 778 return nil, err 779 } 780 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 781 if err != nil { 782 return nil, status.Errorf(codes.InvalidArgument, "error parsing Notification field path array of values from %s: %v", valuesStr, err) 783 } 784 return fpaov.(Notification_FieldPathArrayOfValues), nil 785 } 786 787 func MustParseNotification_FieldPathArrayOfValues(pathStr, valuesStr string) Notification_FieldPathArrayOfValues { 788 fpaov, err := ParseNotification_FieldPathArrayOfValues(pathStr, valuesStr) 789 if err != nil { 790 panic(err) 791 } 792 return fpaov 793 } 794 795 type Notification_FieldTerminalPathArrayOfValues struct { 796 Notification_FieldTerminalPath 797 values interface{} 798 } 799 800 var _ Notification_FieldPathArrayOfValues = (*Notification_FieldTerminalPathArrayOfValues)(nil) 801 802 func (fpaov *Notification_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 803 switch fpaov.selector { 804 case Notification_FieldPathSelectorName: 805 for _, v := range fpaov.values.([]*Name) { 806 values = append(values, v) 807 } 808 case Notification_FieldPathSelectorMetadata: 809 for _, v := range fpaov.values.([]*meta.Meta) { 810 values = append(values, v) 811 } 812 case Notification_FieldPathSelectorAlertingPolicy: 813 for _, v := range fpaov.values.([]*alerting_policy.Name) { 814 values = append(values, v) 815 } 816 case Notification_FieldPathSelectorAlerts: 817 for _, v := range fpaov.values.([][]*alert.Name) { 818 values = append(values, v) 819 } 820 case Notification_FieldPathSelectorState: 821 for _, v := range fpaov.values.([]*Notification_State) { 822 values = append(values, v) 823 } 824 } 825 return 826 } 827 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) { 828 res, ok := fpaov.values.([]*Name) 829 return res, ok 830 } 831 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) { 832 res, ok := fpaov.values.([]*meta.Meta) 833 return res, ok 834 } 835 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsAlertingPolicyArrayOfValues() ([]*alerting_policy.Name, bool) { 836 res, ok := fpaov.values.([]*alerting_policy.Name) 837 return res, ok 838 } 839 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsAlertsArrayOfValues() ([][]*alert.Name, bool) { 840 res, ok := fpaov.values.([][]*alert.Name) 841 return res, ok 842 } 843 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsStateArrayOfValues() ([]*Notification_State, bool) { 844 res, ok := fpaov.values.([]*Notification_State) 845 return res, ok 846 } 847 848 type Notification_FieldSubPathArrayOfValues struct { 849 Notification_FieldPath 850 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 851 } 852 853 var _ Notification_FieldPathArrayOfValues = (*Notification_FieldSubPathArrayOfValues)(nil) 854 855 func (fpsaov *Notification_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 856 return fpsaov.subPathArrayOfValues.GetRawValues() 857 } 858 func (fpsaov *Notification_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) { 859 res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues) 860 return res, ok 861 } 862 func (fpsaov *Notification_FieldSubPathArrayOfValues) AsStatePathArrayOfValues() (NotificationState_FieldPathArrayOfValues, bool) { 863 res, ok := fpsaov.subPathArrayOfValues.(NotificationState_FieldPathArrayOfValues) 864 return res, ok 865 } 866 867 // FieldPath provides implementation to handle 868 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 869 type NotificationState_FieldPath interface { 870 gotenobject.FieldPath 871 Selector() NotificationState_FieldPathSelector 872 Get(source *Notification_State) []interface{} 873 GetSingle(source *Notification_State) (interface{}, bool) 874 ClearValue(item *Notification_State) 875 876 // Those methods build corresponding NotificationState_FieldPathValue 877 // (or array of values) and holds passed value. Panics if injected type is incorrect. 878 WithIValue(value interface{}) NotificationState_FieldPathValue 879 WithIArrayOfValues(values interface{}) NotificationState_FieldPathArrayOfValues 880 WithIArrayItemValue(value interface{}) NotificationState_FieldPathArrayItemValue 881 } 882 883 type NotificationState_FieldPathSelector int32 884 885 const ( 886 NotificationState_FieldPathSelectorIsResolved NotificationState_FieldPathSelector = 0 887 NotificationState_FieldPathSelectorNotificationState NotificationState_FieldPathSelector = 1 888 NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone NotificationState_FieldPathSelector = 2 889 NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone NotificationState_FieldPathSelector = 3 890 NotificationState_FieldPathSelectorAlertsLifetime NotificationState_FieldPathSelector = 4 891 NotificationState_FieldPathSelectorResolutionNotificationState NotificationState_FieldPathSelector = 5 892 NotificationState_FieldPathSelectorLifecycleCompleted NotificationState_FieldPathSelector = 6 893 ) 894 895 func (s NotificationState_FieldPathSelector) String() string { 896 switch s { 897 case NotificationState_FieldPathSelectorIsResolved: 898 return "is_resolved" 899 case NotificationState_FieldPathSelectorNotificationState: 900 return "notification_state" 901 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 902 return "incident_notify_attempts_done" 903 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 904 return "resolution_notify_attempts_done" 905 case NotificationState_FieldPathSelectorAlertsLifetime: 906 return "alerts_lifetime" 907 case NotificationState_FieldPathSelectorResolutionNotificationState: 908 return "resolution_notification_state" 909 case NotificationState_FieldPathSelectorLifecycleCompleted: 910 return "lifecycle_completed" 911 default: 912 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", s)) 913 } 914 } 915 916 func BuildNotificationState_FieldPath(fp gotenobject.RawFieldPath) (NotificationState_FieldPath, error) { 917 if len(fp) == 0 { 918 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State") 919 } 920 if len(fp) == 1 { 921 switch fp[0] { 922 case "is_resolved", "isResolved", "is-resolved": 923 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorIsResolved}, nil 924 case "notification_state", "notificationState", "notification-state": 925 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorNotificationState}, nil 926 case "incident_notify_attempts_done", "incidentNotifyAttemptsDone", "incident-notify-attempts-done": 927 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone}, nil 928 case "resolution_notify_attempts_done", "resolutionNotifyAttemptsDone", "resolution-notify-attempts-done": 929 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone}, nil 930 case "alerts_lifetime", "alertsLifetime", "alerts-lifetime": 931 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorAlertsLifetime}, nil 932 case "resolution_notification_state", "resolutionNotificationState", "resolution-notification-state": 933 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorResolutionNotificationState}, nil 934 case "lifecycle_completed", "lifecycleCompleted", "lifecycle-completed": 935 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorLifecycleCompleted}, nil 936 } 937 } else { 938 switch fp[0] { 939 case "notification_state", "notificationState", "notification-state": 940 if subpath, err := BuildNotificationStateNotificationState_FieldPath(fp[1:]); err != nil { 941 return nil, err 942 } else { 943 return &NotificationState_FieldSubPath{selector: NotificationState_FieldPathSelectorNotificationState, subPath: subpath}, nil 944 } 945 case "alerts_lifetime", "alertsLifetime", "alerts-lifetime": 946 if subpath, err := common.BuildTimeRange_FieldPath(fp[1:]); err != nil { 947 return nil, err 948 } else { 949 return &NotificationState_FieldSubPath{selector: NotificationState_FieldPathSelectorAlertsLifetime, subPath: subpath}, nil 950 } 951 case "resolution_notification_state", "resolutionNotificationState", "resolution-notification-state": 952 if subpath, err := BuildNotificationStateNotificationState_FieldPath(fp[1:]); err != nil { 953 return nil, err 954 } else { 955 return &NotificationState_FieldSubPath{selector: NotificationState_FieldPathSelectorResolutionNotificationState, subPath: subpath}, nil 956 } 957 } 958 } 959 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State", fp) 960 } 961 962 func ParseNotificationState_FieldPath(rawField string) (NotificationState_FieldPath, error) { 963 fp, err := gotenobject.ParseRawFieldPath(rawField) 964 if err != nil { 965 return nil, err 966 } 967 return BuildNotificationState_FieldPath(fp) 968 } 969 970 func MustParseNotificationState_FieldPath(rawField string) NotificationState_FieldPath { 971 fp, err := ParseNotificationState_FieldPath(rawField) 972 if err != nil { 973 panic(err) 974 } 975 return fp 976 } 977 978 type NotificationState_FieldTerminalPath struct { 979 selector NotificationState_FieldPathSelector 980 } 981 982 var _ NotificationState_FieldPath = (*NotificationState_FieldTerminalPath)(nil) 983 984 func (fp *NotificationState_FieldTerminalPath) Selector() NotificationState_FieldPathSelector { 985 return fp.selector 986 } 987 988 // String returns path representation in proto convention 989 func (fp *NotificationState_FieldTerminalPath) String() string { 990 return fp.selector.String() 991 } 992 993 // JSONString returns path representation is JSON convention 994 func (fp *NotificationState_FieldTerminalPath) JSONString() string { 995 return strcase.ToLowerCamel(fp.String()) 996 } 997 998 // Get returns all values pointed by specific field from source Notification_State 999 func (fp *NotificationState_FieldTerminalPath) Get(source *Notification_State) (values []interface{}) { 1000 if source != nil { 1001 switch fp.selector { 1002 case NotificationState_FieldPathSelectorIsResolved: 1003 values = append(values, source.IsResolved) 1004 case NotificationState_FieldPathSelectorNotificationState: 1005 for _, value := range source.GetNotificationState() { 1006 values = append(values, value) 1007 } 1008 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1009 values = append(values, source.IncidentNotifyAttemptsDone) 1010 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1011 values = append(values, source.ResolutionNotifyAttemptsDone) 1012 case NotificationState_FieldPathSelectorAlertsLifetime: 1013 if source.AlertsLifetime != nil { 1014 values = append(values, source.AlertsLifetime) 1015 } 1016 case NotificationState_FieldPathSelectorResolutionNotificationState: 1017 for _, value := range source.GetResolutionNotificationState() { 1018 values = append(values, value) 1019 } 1020 case NotificationState_FieldPathSelectorLifecycleCompleted: 1021 values = append(values, source.LifecycleCompleted) 1022 default: 1023 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1024 } 1025 } 1026 return 1027 } 1028 1029 func (fp *NotificationState_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1030 return fp.Get(source.(*Notification_State)) 1031 } 1032 1033 // GetSingle returns value pointed by specific field of from source Notification_State 1034 func (fp *NotificationState_FieldTerminalPath) GetSingle(source *Notification_State) (interface{}, bool) { 1035 switch fp.selector { 1036 case NotificationState_FieldPathSelectorIsResolved: 1037 return source.GetIsResolved(), source != nil 1038 case NotificationState_FieldPathSelectorNotificationState: 1039 res := source.GetNotificationState() 1040 return res, res != nil 1041 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1042 return source.GetIncidentNotifyAttemptsDone(), source != nil 1043 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1044 return source.GetResolutionNotifyAttemptsDone(), source != nil 1045 case NotificationState_FieldPathSelectorAlertsLifetime: 1046 res := source.GetAlertsLifetime() 1047 return res, res != nil 1048 case NotificationState_FieldPathSelectorResolutionNotificationState: 1049 res := source.GetResolutionNotificationState() 1050 return res, res != nil 1051 case NotificationState_FieldPathSelectorLifecycleCompleted: 1052 return source.GetLifecycleCompleted(), source != nil 1053 default: 1054 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1055 } 1056 } 1057 1058 func (fp *NotificationState_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1059 return fp.GetSingle(source.(*Notification_State)) 1060 } 1061 1062 // GetDefault returns a default value of the field type 1063 func (fp *NotificationState_FieldTerminalPath) GetDefault() interface{} { 1064 switch fp.selector { 1065 case NotificationState_FieldPathSelectorIsResolved: 1066 return false 1067 case NotificationState_FieldPathSelectorNotificationState: 1068 return ([]*Notification_State_NotificationState)(nil) 1069 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1070 return false 1071 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1072 return false 1073 case NotificationState_FieldPathSelectorAlertsLifetime: 1074 return (*common.TimeRange)(nil) 1075 case NotificationState_FieldPathSelectorResolutionNotificationState: 1076 return ([]*Notification_State_NotificationState)(nil) 1077 case NotificationState_FieldPathSelectorLifecycleCompleted: 1078 return false 1079 default: 1080 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1081 } 1082 } 1083 1084 func (fp *NotificationState_FieldTerminalPath) ClearValue(item *Notification_State) { 1085 if item != nil { 1086 switch fp.selector { 1087 case NotificationState_FieldPathSelectorIsResolved: 1088 item.IsResolved = false 1089 case NotificationState_FieldPathSelectorNotificationState: 1090 item.NotificationState = nil 1091 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1092 item.IncidentNotifyAttemptsDone = false 1093 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1094 item.ResolutionNotifyAttemptsDone = false 1095 case NotificationState_FieldPathSelectorAlertsLifetime: 1096 item.AlertsLifetime = nil 1097 case NotificationState_FieldPathSelectorResolutionNotificationState: 1098 item.ResolutionNotificationState = nil 1099 case NotificationState_FieldPathSelectorLifecycleCompleted: 1100 item.LifecycleCompleted = false 1101 default: 1102 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1103 } 1104 } 1105 } 1106 1107 func (fp *NotificationState_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1108 fp.ClearValue(item.(*Notification_State)) 1109 } 1110 1111 // IsLeaf - whether field path is holds simple value 1112 func (fp *NotificationState_FieldTerminalPath) IsLeaf() bool { 1113 return fp.selector == NotificationState_FieldPathSelectorIsResolved || 1114 fp.selector == NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone || 1115 fp.selector == NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone || 1116 fp.selector == NotificationState_FieldPathSelectorLifecycleCompleted 1117 } 1118 1119 func (fp *NotificationState_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1120 return []gotenobject.FieldPath{fp} 1121 } 1122 1123 func (fp *NotificationState_FieldTerminalPath) WithIValue(value interface{}) NotificationState_FieldPathValue { 1124 switch fp.selector { 1125 case NotificationState_FieldPathSelectorIsResolved: 1126 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1127 case NotificationState_FieldPathSelectorNotificationState: 1128 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.([]*Notification_State_NotificationState)} 1129 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1130 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1131 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1132 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1133 case NotificationState_FieldPathSelectorAlertsLifetime: 1134 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(*common.TimeRange)} 1135 case NotificationState_FieldPathSelectorResolutionNotificationState: 1136 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.([]*Notification_State_NotificationState)} 1137 case NotificationState_FieldPathSelectorLifecycleCompleted: 1138 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1139 default: 1140 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1141 } 1142 } 1143 1144 func (fp *NotificationState_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1145 return fp.WithIValue(value) 1146 } 1147 1148 func (fp *NotificationState_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationState_FieldPathArrayOfValues { 1149 fpaov := &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp} 1150 switch fp.selector { 1151 case NotificationState_FieldPathSelectorIsResolved: 1152 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1153 case NotificationState_FieldPathSelectorNotificationState: 1154 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([][]*Notification_State_NotificationState)} 1155 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1156 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1157 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1158 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1159 case NotificationState_FieldPathSelectorAlertsLifetime: 1160 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]*common.TimeRange)} 1161 case NotificationState_FieldPathSelectorResolutionNotificationState: 1162 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([][]*Notification_State_NotificationState)} 1163 case NotificationState_FieldPathSelectorLifecycleCompleted: 1164 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1165 default: 1166 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1167 } 1168 return fpaov 1169 } 1170 1171 func (fp *NotificationState_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1172 return fp.WithIArrayOfValues(values) 1173 } 1174 1175 func (fp *NotificationState_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationState_FieldPathArrayItemValue { 1176 switch fp.selector { 1177 case NotificationState_FieldPathSelectorNotificationState: 1178 return &NotificationState_FieldTerminalPathArrayItemValue{NotificationState_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState)} 1179 case NotificationState_FieldPathSelectorResolutionNotificationState: 1180 return &NotificationState_FieldTerminalPathArrayItemValue{NotificationState_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState)} 1181 default: 1182 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1183 } 1184 } 1185 1186 func (fp *NotificationState_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1187 return fp.WithIArrayItemValue(value) 1188 } 1189 1190 type NotificationState_FieldSubPath struct { 1191 selector NotificationState_FieldPathSelector 1192 subPath gotenobject.FieldPath 1193 } 1194 1195 var _ NotificationState_FieldPath = (*NotificationState_FieldSubPath)(nil) 1196 1197 func (fps *NotificationState_FieldSubPath) Selector() NotificationState_FieldPathSelector { 1198 return fps.selector 1199 } 1200 func (fps *NotificationState_FieldSubPath) AsNotificationStateSubPath() (NotificationStateNotificationState_FieldPath, bool) { 1201 res, ok := fps.subPath.(NotificationStateNotificationState_FieldPath) 1202 return res, ok 1203 } 1204 func (fps *NotificationState_FieldSubPath) AsAlertsLifetimeSubPath() (common.TimeRange_FieldPath, bool) { 1205 res, ok := fps.subPath.(common.TimeRange_FieldPath) 1206 return res, ok 1207 } 1208 func (fps *NotificationState_FieldSubPath) AsResolutionNotificationStateSubPath() (NotificationStateNotificationState_FieldPath, bool) { 1209 res, ok := fps.subPath.(NotificationStateNotificationState_FieldPath) 1210 return res, ok 1211 } 1212 1213 // String returns path representation in proto convention 1214 func (fps *NotificationState_FieldSubPath) String() string { 1215 return fps.selector.String() + "." + fps.subPath.String() 1216 } 1217 1218 // JSONString returns path representation is JSON convention 1219 func (fps *NotificationState_FieldSubPath) JSONString() string { 1220 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 1221 } 1222 1223 // Get returns all values pointed by selected field from source Notification_State 1224 func (fps *NotificationState_FieldSubPath) Get(source *Notification_State) (values []interface{}) { 1225 switch fps.selector { 1226 case NotificationState_FieldPathSelectorNotificationState: 1227 for _, item := range source.GetNotificationState() { 1228 values = append(values, fps.subPath.GetRaw(item)...) 1229 } 1230 case NotificationState_FieldPathSelectorAlertsLifetime: 1231 values = append(values, fps.subPath.GetRaw(source.GetAlertsLifetime())...) 1232 case NotificationState_FieldPathSelectorResolutionNotificationState: 1233 for _, item := range source.GetResolutionNotificationState() { 1234 values = append(values, fps.subPath.GetRaw(item)...) 1235 } 1236 default: 1237 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fps.selector)) 1238 } 1239 return 1240 } 1241 1242 func (fps *NotificationState_FieldSubPath) GetRaw(source proto.Message) []interface{} { 1243 return fps.Get(source.(*Notification_State)) 1244 } 1245 1246 // GetSingle returns value of selected field from source Notification_State 1247 func (fps *NotificationState_FieldSubPath) GetSingle(source *Notification_State) (interface{}, bool) { 1248 switch fps.selector { 1249 case NotificationState_FieldPathSelectorNotificationState: 1250 if len(source.GetNotificationState()) == 0 { 1251 return nil, false 1252 } 1253 return fps.subPath.GetSingleRaw(source.GetNotificationState()[0]) 1254 case NotificationState_FieldPathSelectorAlertsLifetime: 1255 if source.GetAlertsLifetime() == nil { 1256 return nil, false 1257 } 1258 return fps.subPath.GetSingleRaw(source.GetAlertsLifetime()) 1259 case NotificationState_FieldPathSelectorResolutionNotificationState: 1260 if len(source.GetResolutionNotificationState()) == 0 { 1261 return nil, false 1262 } 1263 return fps.subPath.GetSingleRaw(source.GetResolutionNotificationState()[0]) 1264 default: 1265 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fps.selector)) 1266 } 1267 } 1268 1269 func (fps *NotificationState_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1270 return fps.GetSingle(source.(*Notification_State)) 1271 } 1272 1273 // GetDefault returns a default value of the field type 1274 func (fps *NotificationState_FieldSubPath) GetDefault() interface{} { 1275 return fps.subPath.GetDefault() 1276 } 1277 1278 func (fps *NotificationState_FieldSubPath) ClearValue(item *Notification_State) { 1279 if item != nil { 1280 switch fps.selector { 1281 case NotificationState_FieldPathSelectorNotificationState: 1282 for _, subItem := range item.NotificationState { 1283 fps.subPath.ClearValueRaw(subItem) 1284 } 1285 case NotificationState_FieldPathSelectorAlertsLifetime: 1286 fps.subPath.ClearValueRaw(item.AlertsLifetime) 1287 case NotificationState_FieldPathSelectorResolutionNotificationState: 1288 for _, subItem := range item.ResolutionNotificationState { 1289 fps.subPath.ClearValueRaw(subItem) 1290 } 1291 default: 1292 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fps.selector)) 1293 } 1294 } 1295 } 1296 1297 func (fps *NotificationState_FieldSubPath) ClearValueRaw(item proto.Message) { 1298 fps.ClearValue(item.(*Notification_State)) 1299 } 1300 1301 // IsLeaf - whether field path is holds simple value 1302 func (fps *NotificationState_FieldSubPath) IsLeaf() bool { 1303 return fps.subPath.IsLeaf() 1304 } 1305 1306 func (fps *NotificationState_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1307 iPaths := []gotenobject.FieldPath{&NotificationState_FieldTerminalPath{selector: fps.selector}} 1308 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 1309 return iPaths 1310 } 1311 1312 func (fps *NotificationState_FieldSubPath) WithIValue(value interface{}) NotificationState_FieldPathValue { 1313 return &NotificationState_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 1314 } 1315 1316 func (fps *NotificationState_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1317 return fps.WithIValue(value) 1318 } 1319 1320 func (fps *NotificationState_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationState_FieldPathArrayOfValues { 1321 return &NotificationState_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 1322 } 1323 1324 func (fps *NotificationState_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1325 return fps.WithIArrayOfValues(values) 1326 } 1327 1328 func (fps *NotificationState_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationState_FieldPathArrayItemValue { 1329 return &NotificationState_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 1330 } 1331 1332 func (fps *NotificationState_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1333 return fps.WithIArrayItemValue(value) 1334 } 1335 1336 // NotificationState_FieldPathValue allows storing values for State fields according to their type 1337 type NotificationState_FieldPathValue interface { 1338 NotificationState_FieldPath 1339 gotenobject.FieldPathValue 1340 SetTo(target **Notification_State) 1341 CompareWith(*Notification_State) (cmp int, comparable bool) 1342 } 1343 1344 func ParseNotificationState_FieldPathValue(pathStr, valueStr string) (NotificationState_FieldPathValue, error) { 1345 fp, err := ParseNotificationState_FieldPath(pathStr) 1346 if err != nil { 1347 return nil, err 1348 } 1349 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1350 if err != nil { 1351 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path value from %s: %v", valueStr, err) 1352 } 1353 return fpv.(NotificationState_FieldPathValue), nil 1354 } 1355 1356 func MustParseNotificationState_FieldPathValue(pathStr, valueStr string) NotificationState_FieldPathValue { 1357 fpv, err := ParseNotificationState_FieldPathValue(pathStr, valueStr) 1358 if err != nil { 1359 panic(err) 1360 } 1361 return fpv 1362 } 1363 1364 type NotificationState_FieldTerminalPathValue struct { 1365 NotificationState_FieldTerminalPath 1366 value interface{} 1367 } 1368 1369 var _ NotificationState_FieldPathValue = (*NotificationState_FieldTerminalPathValue)(nil) 1370 1371 // GetRawValue returns raw value stored under selected path for 'State' as interface{} 1372 func (fpv *NotificationState_FieldTerminalPathValue) GetRawValue() interface{} { 1373 return fpv.value 1374 } 1375 func (fpv *NotificationState_FieldTerminalPathValue) AsIsResolvedValue() (bool, bool) { 1376 res, ok := fpv.value.(bool) 1377 return res, ok 1378 } 1379 func (fpv *NotificationState_FieldTerminalPathValue) AsNotificationStateValue() ([]*Notification_State_NotificationState, bool) { 1380 res, ok := fpv.value.([]*Notification_State_NotificationState) 1381 return res, ok 1382 } 1383 func (fpv *NotificationState_FieldTerminalPathValue) AsIncidentNotifyAttemptsDoneValue() (bool, bool) { 1384 res, ok := fpv.value.(bool) 1385 return res, ok 1386 } 1387 func (fpv *NotificationState_FieldTerminalPathValue) AsResolutionNotifyAttemptsDoneValue() (bool, bool) { 1388 res, ok := fpv.value.(bool) 1389 return res, ok 1390 } 1391 func (fpv *NotificationState_FieldTerminalPathValue) AsAlertsLifetimeValue() (*common.TimeRange, bool) { 1392 res, ok := fpv.value.(*common.TimeRange) 1393 return res, ok 1394 } 1395 func (fpv *NotificationState_FieldTerminalPathValue) AsResolutionNotificationStateValue() ([]*Notification_State_NotificationState, bool) { 1396 res, ok := fpv.value.([]*Notification_State_NotificationState) 1397 return res, ok 1398 } 1399 func (fpv *NotificationState_FieldTerminalPathValue) AsLifecycleCompletedValue() (bool, bool) { 1400 res, ok := fpv.value.(bool) 1401 return res, ok 1402 } 1403 1404 // SetTo stores value for selected field for object State 1405 func (fpv *NotificationState_FieldTerminalPathValue) SetTo(target **Notification_State) { 1406 if *target == nil { 1407 *target = new(Notification_State) 1408 } 1409 switch fpv.selector { 1410 case NotificationState_FieldPathSelectorIsResolved: 1411 (*target).IsResolved = fpv.value.(bool) 1412 case NotificationState_FieldPathSelectorNotificationState: 1413 (*target).NotificationState = fpv.value.([]*Notification_State_NotificationState) 1414 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1415 (*target).IncidentNotifyAttemptsDone = fpv.value.(bool) 1416 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1417 (*target).ResolutionNotifyAttemptsDone = fpv.value.(bool) 1418 case NotificationState_FieldPathSelectorAlertsLifetime: 1419 (*target).AlertsLifetime = fpv.value.(*common.TimeRange) 1420 case NotificationState_FieldPathSelectorResolutionNotificationState: 1421 (*target).ResolutionNotificationState = fpv.value.([]*Notification_State_NotificationState) 1422 case NotificationState_FieldPathSelectorLifecycleCompleted: 1423 (*target).LifecycleCompleted = fpv.value.(bool) 1424 default: 1425 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpv.selector)) 1426 } 1427 } 1428 1429 func (fpv *NotificationState_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1430 typedObject := target.(*Notification_State) 1431 fpv.SetTo(&typedObject) 1432 } 1433 1434 // CompareWith compares value in the 'NotificationState_FieldTerminalPathValue' with the value under path in 'Notification_State'. 1435 func (fpv *NotificationState_FieldTerminalPathValue) CompareWith(source *Notification_State) (int, bool) { 1436 switch fpv.selector { 1437 case NotificationState_FieldPathSelectorIsResolved: 1438 leftValue := fpv.value.(bool) 1439 rightValue := source.GetIsResolved() 1440 if (leftValue) == (rightValue) { 1441 return 0, true 1442 } else if !(leftValue) && (rightValue) { 1443 return -1, true 1444 } else { 1445 return 1, true 1446 } 1447 case NotificationState_FieldPathSelectorNotificationState: 1448 return 0, false 1449 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1450 leftValue := fpv.value.(bool) 1451 rightValue := source.GetIncidentNotifyAttemptsDone() 1452 if (leftValue) == (rightValue) { 1453 return 0, true 1454 } else if !(leftValue) && (rightValue) { 1455 return -1, true 1456 } else { 1457 return 1, true 1458 } 1459 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1460 leftValue := fpv.value.(bool) 1461 rightValue := source.GetResolutionNotifyAttemptsDone() 1462 if (leftValue) == (rightValue) { 1463 return 0, true 1464 } else if !(leftValue) && (rightValue) { 1465 return -1, true 1466 } else { 1467 return 1, true 1468 } 1469 case NotificationState_FieldPathSelectorAlertsLifetime: 1470 return 0, false 1471 case NotificationState_FieldPathSelectorResolutionNotificationState: 1472 return 0, false 1473 case NotificationState_FieldPathSelectorLifecycleCompleted: 1474 leftValue := fpv.value.(bool) 1475 rightValue := source.GetLifecycleCompleted() 1476 if (leftValue) == (rightValue) { 1477 return 0, true 1478 } else if !(leftValue) && (rightValue) { 1479 return -1, true 1480 } else { 1481 return 1, true 1482 } 1483 default: 1484 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpv.selector)) 1485 } 1486 } 1487 1488 func (fpv *NotificationState_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1489 return fpv.CompareWith(source.(*Notification_State)) 1490 } 1491 1492 type NotificationState_FieldSubPathValue struct { 1493 NotificationState_FieldPath 1494 subPathValue gotenobject.FieldPathValue 1495 } 1496 1497 var _ NotificationState_FieldPathValue = (*NotificationState_FieldSubPathValue)(nil) 1498 1499 func (fpvs *NotificationState_FieldSubPathValue) AsNotificationStatePathValue() (NotificationStateNotificationState_FieldPathValue, bool) { 1500 res, ok := fpvs.subPathValue.(NotificationStateNotificationState_FieldPathValue) 1501 return res, ok 1502 } 1503 func (fpvs *NotificationState_FieldSubPathValue) AsAlertsLifetimePathValue() (common.TimeRange_FieldPathValue, bool) { 1504 res, ok := fpvs.subPathValue.(common.TimeRange_FieldPathValue) 1505 return res, ok 1506 } 1507 func (fpvs *NotificationState_FieldSubPathValue) AsResolutionNotificationStatePathValue() (NotificationStateNotificationState_FieldPathValue, bool) { 1508 res, ok := fpvs.subPathValue.(NotificationStateNotificationState_FieldPathValue) 1509 return res, ok 1510 } 1511 1512 func (fpvs *NotificationState_FieldSubPathValue) SetTo(target **Notification_State) { 1513 if *target == nil { 1514 *target = new(Notification_State) 1515 } 1516 switch fpvs.Selector() { 1517 case NotificationState_FieldPathSelectorNotificationState: 1518 panic("FieldPath setter is unsupported for array subpaths") 1519 case NotificationState_FieldPathSelectorAlertsLifetime: 1520 fpvs.subPathValue.(common.TimeRange_FieldPathValue).SetTo(&(*target).AlertsLifetime) 1521 case NotificationState_FieldPathSelectorResolutionNotificationState: 1522 panic("FieldPath setter is unsupported for array subpaths") 1523 default: 1524 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpvs.Selector())) 1525 } 1526 } 1527 1528 func (fpvs *NotificationState_FieldSubPathValue) SetToRaw(target proto.Message) { 1529 typedObject := target.(*Notification_State) 1530 fpvs.SetTo(&typedObject) 1531 } 1532 1533 func (fpvs *NotificationState_FieldSubPathValue) GetRawValue() interface{} { 1534 return fpvs.subPathValue.GetRawValue() 1535 } 1536 1537 func (fpvs *NotificationState_FieldSubPathValue) CompareWith(source *Notification_State) (int, bool) { 1538 switch fpvs.Selector() { 1539 case NotificationState_FieldPathSelectorNotificationState: 1540 return 0, false // repeated field 1541 case NotificationState_FieldPathSelectorAlertsLifetime: 1542 return fpvs.subPathValue.(common.TimeRange_FieldPathValue).CompareWith(source.GetAlertsLifetime()) 1543 case NotificationState_FieldPathSelectorResolutionNotificationState: 1544 return 0, false // repeated field 1545 default: 1546 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpvs.Selector())) 1547 } 1548 } 1549 1550 func (fpvs *NotificationState_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1551 return fpvs.CompareWith(source.(*Notification_State)) 1552 } 1553 1554 // NotificationState_FieldPathArrayItemValue allows storing single item in Path-specific values for State according to their type 1555 // Present only for array (repeated) types. 1556 type NotificationState_FieldPathArrayItemValue interface { 1557 gotenobject.FieldPathArrayItemValue 1558 NotificationState_FieldPath 1559 ContainsValue(*Notification_State) bool 1560 } 1561 1562 // ParseNotificationState_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1563 func ParseNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationState_FieldPathArrayItemValue, error) { 1564 fp, err := ParseNotificationState_FieldPath(pathStr) 1565 if err != nil { 1566 return nil, err 1567 } 1568 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1569 if err != nil { 1570 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path array item value from %s: %v", valueStr, err) 1571 } 1572 return fpaiv.(NotificationState_FieldPathArrayItemValue), nil 1573 } 1574 1575 func MustParseNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) NotificationState_FieldPathArrayItemValue { 1576 fpaiv, err := ParseNotificationState_FieldPathArrayItemValue(pathStr, valueStr) 1577 if err != nil { 1578 panic(err) 1579 } 1580 return fpaiv 1581 } 1582 1583 type NotificationState_FieldTerminalPathArrayItemValue struct { 1584 NotificationState_FieldTerminalPath 1585 value interface{} 1586 } 1587 1588 var _ NotificationState_FieldPathArrayItemValue = (*NotificationState_FieldTerminalPathArrayItemValue)(nil) 1589 1590 // GetRawValue returns stored element value for array in object Notification_State as interface{} 1591 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1592 return fpaiv.value 1593 } 1594 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) AsNotificationStateItemValue() (*Notification_State_NotificationState, bool) { 1595 res, ok := fpaiv.value.(*Notification_State_NotificationState) 1596 return res, ok 1597 } 1598 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) AsResolutionNotificationStateItemValue() (*Notification_State_NotificationState, bool) { 1599 res, ok := fpaiv.value.(*Notification_State_NotificationState) 1600 return res, ok 1601 } 1602 1603 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State) (interface{}, bool) { 1604 return nil, false 1605 } 1606 1607 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1608 return fpaiv.GetSingle(source.(*Notification_State)) 1609 } 1610 1611 // Contains returns a boolean indicating if value that is being held is present in given 'State' 1612 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State) bool { 1613 slice := fpaiv.NotificationState_FieldTerminalPath.Get(source) 1614 for _, v := range slice { 1615 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1616 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1617 return true 1618 } 1619 } else if reflect.DeepEqual(v, fpaiv.value) { 1620 return true 1621 } 1622 } 1623 return false 1624 } 1625 1626 type NotificationState_FieldSubPathArrayItemValue struct { 1627 NotificationState_FieldPath 1628 subPathItemValue gotenobject.FieldPathArrayItemValue 1629 } 1630 1631 // GetRawValue returns stored array item value 1632 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 1633 return fpaivs.subPathItemValue.GetRawItemValue() 1634 } 1635 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) AsNotificationStatePathItemValue() (NotificationStateNotificationState_FieldPathArrayItemValue, bool) { 1636 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationState_FieldPathArrayItemValue) 1637 return res, ok 1638 } 1639 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) AsAlertsLifetimePathItemValue() (common.TimeRange_FieldPathArrayItemValue, bool) { 1640 res, ok := fpaivs.subPathItemValue.(common.TimeRange_FieldPathArrayItemValue) 1641 return res, ok 1642 } 1643 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) AsResolutionNotificationStatePathItemValue() (NotificationStateNotificationState_FieldPathArrayItemValue, bool) { 1644 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationState_FieldPathArrayItemValue) 1645 return res, ok 1646 } 1647 1648 // Contains returns a boolean indicating if value that is being held is present in given 'State' 1649 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) ContainsValue(source *Notification_State) bool { 1650 switch fpaivs.Selector() { 1651 case NotificationState_FieldPathSelectorNotificationState: 1652 return false // repeated/map field 1653 case NotificationState_FieldPathSelectorAlertsLifetime: 1654 return fpaivs.subPathItemValue.(common.TimeRange_FieldPathArrayItemValue).ContainsValue(source.GetAlertsLifetime()) 1655 case NotificationState_FieldPathSelectorResolutionNotificationState: 1656 return false // repeated/map field 1657 default: 1658 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpaivs.Selector())) 1659 } 1660 } 1661 1662 // NotificationState_FieldPathArrayOfValues allows storing slice of values for State fields according to their type 1663 type NotificationState_FieldPathArrayOfValues interface { 1664 gotenobject.FieldPathArrayOfValues 1665 NotificationState_FieldPath 1666 } 1667 1668 func ParseNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationState_FieldPathArrayOfValues, error) { 1669 fp, err := ParseNotificationState_FieldPath(pathStr) 1670 if err != nil { 1671 return nil, err 1672 } 1673 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1674 if err != nil { 1675 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path array of values from %s: %v", valuesStr, err) 1676 } 1677 return fpaov.(NotificationState_FieldPathArrayOfValues), nil 1678 } 1679 1680 func MustParseNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationState_FieldPathArrayOfValues { 1681 fpaov, err := ParseNotificationState_FieldPathArrayOfValues(pathStr, valuesStr) 1682 if err != nil { 1683 panic(err) 1684 } 1685 return fpaov 1686 } 1687 1688 type NotificationState_FieldTerminalPathArrayOfValues struct { 1689 NotificationState_FieldTerminalPath 1690 values interface{} 1691 } 1692 1693 var _ NotificationState_FieldPathArrayOfValues = (*NotificationState_FieldTerminalPathArrayOfValues)(nil) 1694 1695 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1696 switch fpaov.selector { 1697 case NotificationState_FieldPathSelectorIsResolved: 1698 for _, v := range fpaov.values.([]bool) { 1699 values = append(values, v) 1700 } 1701 case NotificationState_FieldPathSelectorNotificationState: 1702 for _, v := range fpaov.values.([][]*Notification_State_NotificationState) { 1703 values = append(values, v) 1704 } 1705 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1706 for _, v := range fpaov.values.([]bool) { 1707 values = append(values, v) 1708 } 1709 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1710 for _, v := range fpaov.values.([]bool) { 1711 values = append(values, v) 1712 } 1713 case NotificationState_FieldPathSelectorAlertsLifetime: 1714 for _, v := range fpaov.values.([]*common.TimeRange) { 1715 values = append(values, v) 1716 } 1717 case NotificationState_FieldPathSelectorResolutionNotificationState: 1718 for _, v := range fpaov.values.([][]*Notification_State_NotificationState) { 1719 values = append(values, v) 1720 } 1721 case NotificationState_FieldPathSelectorLifecycleCompleted: 1722 for _, v := range fpaov.values.([]bool) { 1723 values = append(values, v) 1724 } 1725 } 1726 return 1727 } 1728 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsIsResolvedArrayOfValues() ([]bool, bool) { 1729 res, ok := fpaov.values.([]bool) 1730 return res, ok 1731 } 1732 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsNotificationStateArrayOfValues() ([][]*Notification_State_NotificationState, bool) { 1733 res, ok := fpaov.values.([][]*Notification_State_NotificationState) 1734 return res, ok 1735 } 1736 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsIncidentNotifyAttemptsDoneArrayOfValues() ([]bool, bool) { 1737 res, ok := fpaov.values.([]bool) 1738 return res, ok 1739 } 1740 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsResolutionNotifyAttemptsDoneArrayOfValues() ([]bool, bool) { 1741 res, ok := fpaov.values.([]bool) 1742 return res, ok 1743 } 1744 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsAlertsLifetimeArrayOfValues() ([]*common.TimeRange, bool) { 1745 res, ok := fpaov.values.([]*common.TimeRange) 1746 return res, ok 1747 } 1748 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsResolutionNotificationStateArrayOfValues() ([][]*Notification_State_NotificationState, bool) { 1749 res, ok := fpaov.values.([][]*Notification_State_NotificationState) 1750 return res, ok 1751 } 1752 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsLifecycleCompletedArrayOfValues() ([]bool, bool) { 1753 res, ok := fpaov.values.([]bool) 1754 return res, ok 1755 } 1756 1757 type NotificationState_FieldSubPathArrayOfValues struct { 1758 NotificationState_FieldPath 1759 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 1760 } 1761 1762 var _ NotificationState_FieldPathArrayOfValues = (*NotificationState_FieldSubPathArrayOfValues)(nil) 1763 1764 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 1765 return fpsaov.subPathArrayOfValues.GetRawValues() 1766 } 1767 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) AsNotificationStatePathArrayOfValues() (NotificationStateNotificationState_FieldPathArrayOfValues, bool) { 1768 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationState_FieldPathArrayOfValues) 1769 return res, ok 1770 } 1771 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) AsAlertsLifetimePathArrayOfValues() (common.TimeRange_FieldPathArrayOfValues, bool) { 1772 res, ok := fpsaov.subPathArrayOfValues.(common.TimeRange_FieldPathArrayOfValues) 1773 return res, ok 1774 } 1775 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) AsResolutionNotificationStatePathArrayOfValues() (NotificationStateNotificationState_FieldPathArrayOfValues, bool) { 1776 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationState_FieldPathArrayOfValues) 1777 return res, ok 1778 } 1779 1780 // FieldPath provides implementation to handle 1781 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1782 type NotificationStateNotificationState_FieldPath interface { 1783 gotenobject.FieldPath 1784 Selector() NotificationStateNotificationState_FieldPathSelector 1785 Get(source *Notification_State_NotificationState) []interface{} 1786 GetSingle(source *Notification_State_NotificationState) (interface{}, bool) 1787 ClearValue(item *Notification_State_NotificationState) 1788 1789 // Those methods build corresponding NotificationStateNotificationState_FieldPathValue 1790 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1791 WithIValue(value interface{}) NotificationStateNotificationState_FieldPathValue 1792 WithIArrayOfValues(values interface{}) NotificationStateNotificationState_FieldPathArrayOfValues 1793 WithIArrayItemValue(value interface{}) NotificationStateNotificationState_FieldPathArrayItemValue 1794 } 1795 1796 type NotificationStateNotificationState_FieldPathSelector int32 1797 1798 const ( 1799 NotificationStateNotificationState_FieldPathSelectorNotificationChannel NotificationStateNotificationState_FieldPathSelector = 0 1800 NotificationStateNotificationState_FieldPathSelectorStatus NotificationStateNotificationState_FieldPathSelector = 1 1801 NotificationStateNotificationState_FieldPathSelectorError NotificationStateNotificationState_FieldPathSelector = 2 1802 NotificationStateNotificationState_FieldPathSelectorProviderData NotificationStateNotificationState_FieldPathSelector = 3 1803 NotificationStateNotificationState_FieldPathSelectorNotifyAttempts NotificationStateNotificationState_FieldPathSelector = 4 1804 ) 1805 1806 func (s NotificationStateNotificationState_FieldPathSelector) String() string { 1807 switch s { 1808 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 1809 return "notification_channel" 1810 case NotificationStateNotificationState_FieldPathSelectorStatus: 1811 return "status" 1812 case NotificationStateNotificationState_FieldPathSelectorError: 1813 return "error" 1814 case NotificationStateNotificationState_FieldPathSelectorProviderData: 1815 return "provider_data" 1816 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 1817 return "notify_attempts" 1818 default: 1819 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", s)) 1820 } 1821 } 1822 1823 func BuildNotificationStateNotificationState_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationState_FieldPath, error) { 1824 if len(fp) == 0 { 1825 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState") 1826 } 1827 if len(fp) == 1 { 1828 switch fp[0] { 1829 case "notification_channel", "notificationChannel", "notification-channel": 1830 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorNotificationChannel}, nil 1831 case "status": 1832 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorStatus}, nil 1833 case "error": 1834 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorError}, nil 1835 case "provider_data", "providerData", "provider-data": 1836 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorProviderData}, nil 1837 case "notify_attempts", "notifyAttempts", "notify-attempts": 1838 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorNotifyAttempts}, nil 1839 } 1840 } else { 1841 switch fp[0] { 1842 case "provider_data", "providerData", "provider-data": 1843 if subpath, err := BuildNotificationStateNotificationStateProviderData_FieldPath(fp[1:]); err != nil { 1844 return nil, err 1845 } else { 1846 return &NotificationStateNotificationState_FieldSubPath{selector: NotificationStateNotificationState_FieldPathSelectorProviderData, subPath: subpath}, nil 1847 } 1848 } 1849 } 1850 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState", fp) 1851 } 1852 1853 func ParseNotificationStateNotificationState_FieldPath(rawField string) (NotificationStateNotificationState_FieldPath, error) { 1854 fp, err := gotenobject.ParseRawFieldPath(rawField) 1855 if err != nil { 1856 return nil, err 1857 } 1858 return BuildNotificationStateNotificationState_FieldPath(fp) 1859 } 1860 1861 func MustParseNotificationStateNotificationState_FieldPath(rawField string) NotificationStateNotificationState_FieldPath { 1862 fp, err := ParseNotificationStateNotificationState_FieldPath(rawField) 1863 if err != nil { 1864 panic(err) 1865 } 1866 return fp 1867 } 1868 1869 type NotificationStateNotificationState_FieldTerminalPath struct { 1870 selector NotificationStateNotificationState_FieldPathSelector 1871 } 1872 1873 var _ NotificationStateNotificationState_FieldPath = (*NotificationStateNotificationState_FieldTerminalPath)(nil) 1874 1875 func (fp *NotificationStateNotificationState_FieldTerminalPath) Selector() NotificationStateNotificationState_FieldPathSelector { 1876 return fp.selector 1877 } 1878 1879 // String returns path representation in proto convention 1880 func (fp *NotificationStateNotificationState_FieldTerminalPath) String() string { 1881 return fp.selector.String() 1882 } 1883 1884 // JSONString returns path representation is JSON convention 1885 func (fp *NotificationStateNotificationState_FieldTerminalPath) JSONString() string { 1886 return strcase.ToLowerCamel(fp.String()) 1887 } 1888 1889 // Get returns all values pointed by specific field from source Notification_State_NotificationState 1890 func (fp *NotificationStateNotificationState_FieldTerminalPath) Get(source *Notification_State_NotificationState) (values []interface{}) { 1891 if source != nil { 1892 switch fp.selector { 1893 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 1894 if source.NotificationChannel != nil { 1895 values = append(values, source.NotificationChannel) 1896 } 1897 case NotificationStateNotificationState_FieldPathSelectorStatus: 1898 values = append(values, source.Status) 1899 case NotificationStateNotificationState_FieldPathSelectorError: 1900 values = append(values, source.Error) 1901 case NotificationStateNotificationState_FieldPathSelectorProviderData: 1902 if source.ProviderData != nil { 1903 values = append(values, source.ProviderData) 1904 } 1905 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 1906 values = append(values, source.NotifyAttempts) 1907 default: 1908 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 1909 } 1910 } 1911 return 1912 } 1913 1914 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1915 return fp.Get(source.(*Notification_State_NotificationState)) 1916 } 1917 1918 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState 1919 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState) (interface{}, bool) { 1920 switch fp.selector { 1921 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 1922 res := source.GetNotificationChannel() 1923 return res, res != nil 1924 case NotificationStateNotificationState_FieldPathSelectorStatus: 1925 return source.GetStatus(), source != nil 1926 case NotificationStateNotificationState_FieldPathSelectorError: 1927 return source.GetError(), source != nil 1928 case NotificationStateNotificationState_FieldPathSelectorProviderData: 1929 res := source.GetProviderData() 1930 return res, res != nil 1931 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 1932 return source.GetNotifyAttempts(), source != nil 1933 default: 1934 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 1935 } 1936 } 1937 1938 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1939 return fp.GetSingle(source.(*Notification_State_NotificationState)) 1940 } 1941 1942 // GetDefault returns a default value of the field type 1943 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetDefault() interface{} { 1944 switch fp.selector { 1945 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 1946 return (*notification_channel.Name)(nil) 1947 case NotificationStateNotificationState_FieldPathSelectorStatus: 1948 return Notification_State_NotificationState_UNKNOWN 1949 case NotificationStateNotificationState_FieldPathSelectorError: 1950 return "" 1951 case NotificationStateNotificationState_FieldPathSelectorProviderData: 1952 return (*Notification_State_NotificationState_ProviderData)(nil) 1953 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 1954 return int64(0) 1955 default: 1956 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 1957 } 1958 } 1959 1960 func (fp *NotificationStateNotificationState_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState) { 1961 if item != nil { 1962 switch fp.selector { 1963 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 1964 item.NotificationChannel = nil 1965 case NotificationStateNotificationState_FieldPathSelectorStatus: 1966 item.Status = Notification_State_NotificationState_UNKNOWN 1967 case NotificationStateNotificationState_FieldPathSelectorError: 1968 item.Error = "" 1969 case NotificationStateNotificationState_FieldPathSelectorProviderData: 1970 item.ProviderData = nil 1971 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 1972 item.NotifyAttempts = int64(0) 1973 default: 1974 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 1975 } 1976 } 1977 } 1978 1979 func (fp *NotificationStateNotificationState_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1980 fp.ClearValue(item.(*Notification_State_NotificationState)) 1981 } 1982 1983 // IsLeaf - whether field path is holds simple value 1984 func (fp *NotificationStateNotificationState_FieldTerminalPath) IsLeaf() bool { 1985 return fp.selector == NotificationStateNotificationState_FieldPathSelectorNotificationChannel || 1986 fp.selector == NotificationStateNotificationState_FieldPathSelectorStatus || 1987 fp.selector == NotificationStateNotificationState_FieldPathSelectorError || 1988 fp.selector == NotificationStateNotificationState_FieldPathSelectorNotifyAttempts 1989 } 1990 1991 func (fp *NotificationStateNotificationState_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1992 return []gotenobject.FieldPath{fp} 1993 } 1994 1995 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationState_FieldPathValue { 1996 switch fp.selector { 1997 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 1998 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(*notification_channel.Name)} 1999 case NotificationStateNotificationState_FieldPathSelectorStatus: 2000 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(Notification_State_NotificationState_Status)} 2001 case NotificationStateNotificationState_FieldPathSelectorError: 2002 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(string)} 2003 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2004 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData)} 2005 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2006 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(int64)} 2007 default: 2008 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2009 } 2010 } 2011 2012 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2013 return fp.WithIValue(value) 2014 } 2015 2016 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationState_FieldPathArrayOfValues { 2017 fpaov := &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp} 2018 switch fp.selector { 2019 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2020 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]*notification_channel.Name)} 2021 case NotificationStateNotificationState_FieldPathSelectorStatus: 2022 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]Notification_State_NotificationState_Status)} 2023 case NotificationStateNotificationState_FieldPathSelectorError: 2024 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]string)} 2025 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2026 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]*Notification_State_NotificationState_ProviderData)} 2027 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2028 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]int64)} 2029 default: 2030 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2031 } 2032 return fpaov 2033 } 2034 2035 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2036 return fp.WithIArrayOfValues(values) 2037 } 2038 2039 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationState_FieldPathArrayItemValue { 2040 switch fp.selector { 2041 default: 2042 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2043 } 2044 } 2045 2046 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2047 return fp.WithIArrayItemValue(value) 2048 } 2049 2050 type NotificationStateNotificationState_FieldSubPath struct { 2051 selector NotificationStateNotificationState_FieldPathSelector 2052 subPath gotenobject.FieldPath 2053 } 2054 2055 var _ NotificationStateNotificationState_FieldPath = (*NotificationStateNotificationState_FieldSubPath)(nil) 2056 2057 func (fps *NotificationStateNotificationState_FieldSubPath) Selector() NotificationStateNotificationState_FieldPathSelector { 2058 return fps.selector 2059 } 2060 func (fps *NotificationStateNotificationState_FieldSubPath) AsProviderDataSubPath() (NotificationStateNotificationStateProviderData_FieldPath, bool) { 2061 res, ok := fps.subPath.(NotificationStateNotificationStateProviderData_FieldPath) 2062 return res, ok 2063 } 2064 2065 // String returns path representation in proto convention 2066 func (fps *NotificationStateNotificationState_FieldSubPath) String() string { 2067 return fps.selector.String() + "." + fps.subPath.String() 2068 } 2069 2070 // JSONString returns path representation is JSON convention 2071 func (fps *NotificationStateNotificationState_FieldSubPath) JSONString() string { 2072 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2073 } 2074 2075 // Get returns all values pointed by selected field from source Notification_State_NotificationState 2076 func (fps *NotificationStateNotificationState_FieldSubPath) Get(source *Notification_State_NotificationState) (values []interface{}) { 2077 switch fps.selector { 2078 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2079 values = append(values, fps.subPath.GetRaw(source.GetProviderData())...) 2080 default: 2081 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fps.selector)) 2082 } 2083 return 2084 } 2085 2086 func (fps *NotificationStateNotificationState_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2087 return fps.Get(source.(*Notification_State_NotificationState)) 2088 } 2089 2090 // GetSingle returns value of selected field from source Notification_State_NotificationState 2091 func (fps *NotificationStateNotificationState_FieldSubPath) GetSingle(source *Notification_State_NotificationState) (interface{}, bool) { 2092 switch fps.selector { 2093 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2094 if source.GetProviderData() == nil { 2095 return nil, false 2096 } 2097 return fps.subPath.GetSingleRaw(source.GetProviderData()) 2098 default: 2099 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fps.selector)) 2100 } 2101 } 2102 2103 func (fps *NotificationStateNotificationState_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2104 return fps.GetSingle(source.(*Notification_State_NotificationState)) 2105 } 2106 2107 // GetDefault returns a default value of the field type 2108 func (fps *NotificationStateNotificationState_FieldSubPath) GetDefault() interface{} { 2109 return fps.subPath.GetDefault() 2110 } 2111 2112 func (fps *NotificationStateNotificationState_FieldSubPath) ClearValue(item *Notification_State_NotificationState) { 2113 if item != nil { 2114 switch fps.selector { 2115 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2116 fps.subPath.ClearValueRaw(item.ProviderData) 2117 default: 2118 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fps.selector)) 2119 } 2120 } 2121 } 2122 2123 func (fps *NotificationStateNotificationState_FieldSubPath) ClearValueRaw(item proto.Message) { 2124 fps.ClearValue(item.(*Notification_State_NotificationState)) 2125 } 2126 2127 // IsLeaf - whether field path is holds simple value 2128 func (fps *NotificationStateNotificationState_FieldSubPath) IsLeaf() bool { 2129 return fps.subPath.IsLeaf() 2130 } 2131 2132 func (fps *NotificationStateNotificationState_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2133 iPaths := []gotenobject.FieldPath{&NotificationStateNotificationState_FieldTerminalPath{selector: fps.selector}} 2134 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2135 return iPaths 2136 } 2137 2138 func (fps *NotificationStateNotificationState_FieldSubPath) WithIValue(value interface{}) NotificationStateNotificationState_FieldPathValue { 2139 return &NotificationStateNotificationState_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2140 } 2141 2142 func (fps *NotificationStateNotificationState_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2143 return fps.WithIValue(value) 2144 } 2145 2146 func (fps *NotificationStateNotificationState_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationState_FieldPathArrayOfValues { 2147 return &NotificationStateNotificationState_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2148 } 2149 2150 func (fps *NotificationStateNotificationState_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2151 return fps.WithIArrayOfValues(values) 2152 } 2153 2154 func (fps *NotificationStateNotificationState_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationState_FieldPathArrayItemValue { 2155 return &NotificationStateNotificationState_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2156 } 2157 2158 func (fps *NotificationStateNotificationState_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2159 return fps.WithIArrayItemValue(value) 2160 } 2161 2162 // NotificationStateNotificationState_FieldPathValue allows storing values for NotificationState fields according to their type 2163 type NotificationStateNotificationState_FieldPathValue interface { 2164 NotificationStateNotificationState_FieldPath 2165 gotenobject.FieldPathValue 2166 SetTo(target **Notification_State_NotificationState) 2167 CompareWith(*Notification_State_NotificationState) (cmp int, comparable bool) 2168 } 2169 2170 func ParseNotificationStateNotificationState_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationState_FieldPathValue, error) { 2171 fp, err := ParseNotificationStateNotificationState_FieldPath(pathStr) 2172 if err != nil { 2173 return nil, err 2174 } 2175 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2176 if err != nil { 2177 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationState field path value from %s: %v", valueStr, err) 2178 } 2179 return fpv.(NotificationStateNotificationState_FieldPathValue), nil 2180 } 2181 2182 func MustParseNotificationStateNotificationState_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationState_FieldPathValue { 2183 fpv, err := ParseNotificationStateNotificationState_FieldPathValue(pathStr, valueStr) 2184 if err != nil { 2185 panic(err) 2186 } 2187 return fpv 2188 } 2189 2190 type NotificationStateNotificationState_FieldTerminalPathValue struct { 2191 NotificationStateNotificationState_FieldTerminalPath 2192 value interface{} 2193 } 2194 2195 var _ NotificationStateNotificationState_FieldPathValue = (*NotificationStateNotificationState_FieldTerminalPathValue)(nil) 2196 2197 // GetRawValue returns raw value stored under selected path for 'NotificationState' as interface{} 2198 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) GetRawValue() interface{} { 2199 return fpv.value 2200 } 2201 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsNotificationChannelValue() (*notification_channel.Name, bool) { 2202 res, ok := fpv.value.(*notification_channel.Name) 2203 return res, ok 2204 } 2205 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsStatusValue() (Notification_State_NotificationState_Status, bool) { 2206 res, ok := fpv.value.(Notification_State_NotificationState_Status) 2207 return res, ok 2208 } 2209 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsErrorValue() (string, bool) { 2210 res, ok := fpv.value.(string) 2211 return res, ok 2212 } 2213 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsProviderDataValue() (*Notification_State_NotificationState_ProviderData, bool) { 2214 res, ok := fpv.value.(*Notification_State_NotificationState_ProviderData) 2215 return res, ok 2216 } 2217 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsNotifyAttemptsValue() (int64, bool) { 2218 res, ok := fpv.value.(int64) 2219 return res, ok 2220 } 2221 2222 // SetTo stores value for selected field for object NotificationState 2223 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState) { 2224 if *target == nil { 2225 *target = new(Notification_State_NotificationState) 2226 } 2227 switch fpv.selector { 2228 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2229 (*target).NotificationChannel = fpv.value.(*notification_channel.Name) 2230 case NotificationStateNotificationState_FieldPathSelectorStatus: 2231 (*target).Status = fpv.value.(Notification_State_NotificationState_Status) 2232 case NotificationStateNotificationState_FieldPathSelectorError: 2233 (*target).Error = fpv.value.(string) 2234 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2235 (*target).ProviderData = fpv.value.(*Notification_State_NotificationState_ProviderData) 2236 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2237 (*target).NotifyAttempts = fpv.value.(int64) 2238 default: 2239 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpv.selector)) 2240 } 2241 } 2242 2243 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2244 typedObject := target.(*Notification_State_NotificationState) 2245 fpv.SetTo(&typedObject) 2246 } 2247 2248 // CompareWith compares value in the 'NotificationStateNotificationState_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState'. 2249 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState) (int, bool) { 2250 switch fpv.selector { 2251 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2252 leftValue := fpv.value.(*notification_channel.Name) 2253 rightValue := source.GetNotificationChannel() 2254 if leftValue == nil { 2255 if rightValue != nil { 2256 return -1, true 2257 } 2258 return 0, true 2259 } 2260 if rightValue == nil { 2261 return 1, true 2262 } 2263 if leftValue.String() == rightValue.String() { 2264 return 0, true 2265 } else if leftValue.String() < rightValue.String() { 2266 return -1, true 2267 } else { 2268 return 1, true 2269 } 2270 case NotificationStateNotificationState_FieldPathSelectorStatus: 2271 leftValue := fpv.value.(Notification_State_NotificationState_Status) 2272 rightValue := source.GetStatus() 2273 if (leftValue) == (rightValue) { 2274 return 0, true 2275 } else if (leftValue) < (rightValue) { 2276 return -1, true 2277 } else { 2278 return 1, true 2279 } 2280 case NotificationStateNotificationState_FieldPathSelectorError: 2281 leftValue := fpv.value.(string) 2282 rightValue := source.GetError() 2283 if (leftValue) == (rightValue) { 2284 return 0, true 2285 } else if (leftValue) < (rightValue) { 2286 return -1, true 2287 } else { 2288 return 1, true 2289 } 2290 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2291 return 0, false 2292 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2293 leftValue := fpv.value.(int64) 2294 rightValue := source.GetNotifyAttempts() 2295 if (leftValue) == (rightValue) { 2296 return 0, true 2297 } else if (leftValue) < (rightValue) { 2298 return -1, true 2299 } else { 2300 return 1, true 2301 } 2302 default: 2303 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpv.selector)) 2304 } 2305 } 2306 2307 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2308 return fpv.CompareWith(source.(*Notification_State_NotificationState)) 2309 } 2310 2311 type NotificationStateNotificationState_FieldSubPathValue struct { 2312 NotificationStateNotificationState_FieldPath 2313 subPathValue gotenobject.FieldPathValue 2314 } 2315 2316 var _ NotificationStateNotificationState_FieldPathValue = (*NotificationStateNotificationState_FieldSubPathValue)(nil) 2317 2318 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) AsProviderDataPathValue() (NotificationStateNotificationStateProviderData_FieldPathValue, bool) { 2319 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderData_FieldPathValue) 2320 return res, ok 2321 } 2322 2323 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) SetTo(target **Notification_State_NotificationState) { 2324 if *target == nil { 2325 *target = new(Notification_State_NotificationState) 2326 } 2327 switch fpvs.Selector() { 2328 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2329 fpvs.subPathValue.(NotificationStateNotificationStateProviderData_FieldPathValue).SetTo(&(*target).ProviderData) 2330 default: 2331 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpvs.Selector())) 2332 } 2333 } 2334 2335 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) SetToRaw(target proto.Message) { 2336 typedObject := target.(*Notification_State_NotificationState) 2337 fpvs.SetTo(&typedObject) 2338 } 2339 2340 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) GetRawValue() interface{} { 2341 return fpvs.subPathValue.GetRawValue() 2342 } 2343 2344 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) CompareWith(source *Notification_State_NotificationState) (int, bool) { 2345 switch fpvs.Selector() { 2346 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2347 return fpvs.subPathValue.(NotificationStateNotificationStateProviderData_FieldPathValue).CompareWith(source.GetProviderData()) 2348 default: 2349 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpvs.Selector())) 2350 } 2351 } 2352 2353 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2354 return fpvs.CompareWith(source.(*Notification_State_NotificationState)) 2355 } 2356 2357 // NotificationStateNotificationState_FieldPathArrayItemValue allows storing single item in Path-specific values for NotificationState according to their type 2358 // Present only for array (repeated) types. 2359 type NotificationStateNotificationState_FieldPathArrayItemValue interface { 2360 gotenobject.FieldPathArrayItemValue 2361 NotificationStateNotificationState_FieldPath 2362 ContainsValue(*Notification_State_NotificationState) bool 2363 } 2364 2365 // ParseNotificationStateNotificationState_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2366 func ParseNotificationStateNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationState_FieldPathArrayItemValue, error) { 2367 fp, err := ParseNotificationStateNotificationState_FieldPath(pathStr) 2368 if err != nil { 2369 return nil, err 2370 } 2371 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2372 if err != nil { 2373 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationState field path array item value from %s: %v", valueStr, err) 2374 } 2375 return fpaiv.(NotificationStateNotificationState_FieldPathArrayItemValue), nil 2376 } 2377 2378 func MustParseNotificationStateNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationState_FieldPathArrayItemValue { 2379 fpaiv, err := ParseNotificationStateNotificationState_FieldPathArrayItemValue(pathStr, valueStr) 2380 if err != nil { 2381 panic(err) 2382 } 2383 return fpaiv 2384 } 2385 2386 type NotificationStateNotificationState_FieldTerminalPathArrayItemValue struct { 2387 NotificationStateNotificationState_FieldTerminalPath 2388 value interface{} 2389 } 2390 2391 var _ NotificationStateNotificationState_FieldPathArrayItemValue = (*NotificationStateNotificationState_FieldTerminalPathArrayItemValue)(nil) 2392 2393 // GetRawValue returns stored element value for array in object Notification_State_NotificationState as interface{} 2394 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2395 return fpaiv.value 2396 } 2397 2398 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState) (interface{}, bool) { 2399 return nil, false 2400 } 2401 2402 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2403 return fpaiv.GetSingle(source.(*Notification_State_NotificationState)) 2404 } 2405 2406 // Contains returns a boolean indicating if value that is being held is present in given 'NotificationState' 2407 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState) bool { 2408 slice := fpaiv.NotificationStateNotificationState_FieldTerminalPath.Get(source) 2409 for _, v := range slice { 2410 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2411 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2412 return true 2413 } 2414 } else if reflect.DeepEqual(v, fpaiv.value) { 2415 return true 2416 } 2417 } 2418 return false 2419 } 2420 2421 type NotificationStateNotificationState_FieldSubPathArrayItemValue struct { 2422 NotificationStateNotificationState_FieldPath 2423 subPathItemValue gotenobject.FieldPathArrayItemValue 2424 } 2425 2426 // GetRawValue returns stored array item value 2427 func (fpaivs *NotificationStateNotificationState_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2428 return fpaivs.subPathItemValue.GetRawItemValue() 2429 } 2430 func (fpaivs *NotificationStateNotificationState_FieldSubPathArrayItemValue) AsProviderDataPathItemValue() (NotificationStateNotificationStateProviderData_FieldPathArrayItemValue, bool) { 2431 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderData_FieldPathArrayItemValue) 2432 return res, ok 2433 } 2434 2435 // Contains returns a boolean indicating if value that is being held is present in given 'NotificationState' 2436 func (fpaivs *NotificationStateNotificationState_FieldSubPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState) bool { 2437 switch fpaivs.Selector() { 2438 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2439 return fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderData_FieldPathArrayItemValue).ContainsValue(source.GetProviderData()) 2440 default: 2441 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpaivs.Selector())) 2442 } 2443 } 2444 2445 // NotificationStateNotificationState_FieldPathArrayOfValues allows storing slice of values for NotificationState fields according to their type 2446 type NotificationStateNotificationState_FieldPathArrayOfValues interface { 2447 gotenobject.FieldPathArrayOfValues 2448 NotificationStateNotificationState_FieldPath 2449 } 2450 2451 func ParseNotificationStateNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationState_FieldPathArrayOfValues, error) { 2452 fp, err := ParseNotificationStateNotificationState_FieldPath(pathStr) 2453 if err != nil { 2454 return nil, err 2455 } 2456 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2457 if err != nil { 2458 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationState field path array of values from %s: %v", valuesStr, err) 2459 } 2460 return fpaov.(NotificationStateNotificationState_FieldPathArrayOfValues), nil 2461 } 2462 2463 func MustParseNotificationStateNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationState_FieldPathArrayOfValues { 2464 fpaov, err := ParseNotificationStateNotificationState_FieldPathArrayOfValues(pathStr, valuesStr) 2465 if err != nil { 2466 panic(err) 2467 } 2468 return fpaov 2469 } 2470 2471 type NotificationStateNotificationState_FieldTerminalPathArrayOfValues struct { 2472 NotificationStateNotificationState_FieldTerminalPath 2473 values interface{} 2474 } 2475 2476 var _ NotificationStateNotificationState_FieldPathArrayOfValues = (*NotificationStateNotificationState_FieldTerminalPathArrayOfValues)(nil) 2477 2478 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2479 switch fpaov.selector { 2480 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2481 for _, v := range fpaov.values.([]*notification_channel.Name) { 2482 values = append(values, v) 2483 } 2484 case NotificationStateNotificationState_FieldPathSelectorStatus: 2485 for _, v := range fpaov.values.([]Notification_State_NotificationState_Status) { 2486 values = append(values, v) 2487 } 2488 case NotificationStateNotificationState_FieldPathSelectorError: 2489 for _, v := range fpaov.values.([]string) { 2490 values = append(values, v) 2491 } 2492 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2493 for _, v := range fpaov.values.([]*Notification_State_NotificationState_ProviderData) { 2494 values = append(values, v) 2495 } 2496 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2497 for _, v := range fpaov.values.([]int64) { 2498 values = append(values, v) 2499 } 2500 } 2501 return 2502 } 2503 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsNotificationChannelArrayOfValues() ([]*notification_channel.Name, bool) { 2504 res, ok := fpaov.values.([]*notification_channel.Name) 2505 return res, ok 2506 } 2507 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsStatusArrayOfValues() ([]Notification_State_NotificationState_Status, bool) { 2508 res, ok := fpaov.values.([]Notification_State_NotificationState_Status) 2509 return res, ok 2510 } 2511 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsErrorArrayOfValues() ([]string, bool) { 2512 res, ok := fpaov.values.([]string) 2513 return res, ok 2514 } 2515 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsProviderDataArrayOfValues() ([]*Notification_State_NotificationState_ProviderData, bool) { 2516 res, ok := fpaov.values.([]*Notification_State_NotificationState_ProviderData) 2517 return res, ok 2518 } 2519 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsNotifyAttemptsArrayOfValues() ([]int64, bool) { 2520 res, ok := fpaov.values.([]int64) 2521 return res, ok 2522 } 2523 2524 type NotificationStateNotificationState_FieldSubPathArrayOfValues struct { 2525 NotificationStateNotificationState_FieldPath 2526 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2527 } 2528 2529 var _ NotificationStateNotificationState_FieldPathArrayOfValues = (*NotificationStateNotificationState_FieldSubPathArrayOfValues)(nil) 2530 2531 func (fpsaov *NotificationStateNotificationState_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2532 return fpsaov.subPathArrayOfValues.GetRawValues() 2533 } 2534 func (fpsaov *NotificationStateNotificationState_FieldSubPathArrayOfValues) AsProviderDataPathArrayOfValues() (NotificationStateNotificationStateProviderData_FieldPathArrayOfValues, bool) { 2535 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderData_FieldPathArrayOfValues) 2536 return res, ok 2537 } 2538 2539 // FieldPath provides implementation to handle 2540 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2541 type NotificationStateNotificationStateProviderData_FieldPath interface { 2542 gotenobject.FieldPath 2543 Selector() NotificationStateNotificationStateProviderData_FieldPathSelector 2544 Get(source *Notification_State_NotificationState_ProviderData) []interface{} 2545 GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) 2546 ClearValue(item *Notification_State_NotificationState_ProviderData) 2547 2548 // Those methods build corresponding NotificationStateNotificationStateProviderData_FieldPathValue 2549 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2550 WithIValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathValue 2551 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues 2552 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue 2553 } 2554 2555 type NotificationStateNotificationStateProviderData_FieldPathSelector int32 2556 2557 const ( 2558 NotificationStateNotificationStateProviderData_FieldPathSelectorSlack NotificationStateNotificationStateProviderData_FieldPathSelector = 0 2559 NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty NotificationStateNotificationStateProviderData_FieldPathSelector = 1 2560 ) 2561 2562 func (s NotificationStateNotificationStateProviderData_FieldPathSelector) String() string { 2563 switch s { 2564 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2565 return "slack" 2566 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2567 return "pager_duty" 2568 default: 2569 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", s)) 2570 } 2571 } 2572 2573 func BuildNotificationStateNotificationStateProviderData_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderData_FieldPath, error) { 2574 if len(fp) == 0 { 2575 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData") 2576 } 2577 if len(fp) == 1 { 2578 switch fp[0] { 2579 case "slack": 2580 return &NotificationStateNotificationStateProviderData_FieldTerminalPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorSlack}, nil 2581 case "pager_duty", "pagerDuty", "pager-duty": 2582 return &NotificationStateNotificationStateProviderData_FieldTerminalPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty}, nil 2583 } 2584 } else { 2585 switch fp[0] { 2586 case "slack": 2587 if subpath, err := BuildNotificationStateNotificationStateProviderDataSlack_FieldPath(fp[1:]); err != nil { 2588 return nil, err 2589 } else { 2590 return &NotificationStateNotificationStateProviderData_FieldSubPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorSlack, subPath: subpath}, nil 2591 } 2592 case "pager_duty", "pagerDuty", "pager-duty": 2593 if subpath, err := BuildNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(fp[1:]); err != nil { 2594 return nil, err 2595 } else { 2596 return &NotificationStateNotificationStateProviderData_FieldSubPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty, subPath: subpath}, nil 2597 } 2598 } 2599 } 2600 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData", fp) 2601 } 2602 2603 func ParseNotificationStateNotificationStateProviderData_FieldPath(rawField string) (NotificationStateNotificationStateProviderData_FieldPath, error) { 2604 fp, err := gotenobject.ParseRawFieldPath(rawField) 2605 if err != nil { 2606 return nil, err 2607 } 2608 return BuildNotificationStateNotificationStateProviderData_FieldPath(fp) 2609 } 2610 2611 func MustParseNotificationStateNotificationStateProviderData_FieldPath(rawField string) NotificationStateNotificationStateProviderData_FieldPath { 2612 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(rawField) 2613 if err != nil { 2614 panic(err) 2615 } 2616 return fp 2617 } 2618 2619 type NotificationStateNotificationStateProviderData_FieldTerminalPath struct { 2620 selector NotificationStateNotificationStateProviderData_FieldPathSelector 2621 } 2622 2623 var _ NotificationStateNotificationStateProviderData_FieldPath = (*NotificationStateNotificationStateProviderData_FieldTerminalPath)(nil) 2624 2625 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderData_FieldPathSelector { 2626 return fp.selector 2627 } 2628 2629 // String returns path representation in proto convention 2630 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) String() string { 2631 return fp.selector.String() 2632 } 2633 2634 // JSONString returns path representation is JSON convention 2635 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) JSONString() string { 2636 return strcase.ToLowerCamel(fp.String()) 2637 } 2638 2639 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData 2640 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData) (values []interface{}) { 2641 if source != nil { 2642 switch fp.selector { 2643 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2644 if source.Slack != nil { 2645 values = append(values, source.Slack) 2646 } 2647 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2648 if source.PagerDuty != nil { 2649 values = append(values, source.PagerDuty) 2650 } 2651 default: 2652 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 2653 } 2654 } 2655 return 2656 } 2657 2658 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2659 return fp.Get(source.(*Notification_State_NotificationState_ProviderData)) 2660 } 2661 2662 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData 2663 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) { 2664 switch fp.selector { 2665 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2666 res := source.GetSlack() 2667 return res, res != nil 2668 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2669 res := source.GetPagerDuty() 2670 return res, res != nil 2671 default: 2672 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 2673 } 2674 } 2675 2676 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2677 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData)) 2678 } 2679 2680 // GetDefault returns a default value of the field type 2681 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetDefault() interface{} { 2682 switch fp.selector { 2683 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2684 return (*Notification_State_NotificationState_ProviderData_Slack)(nil) 2685 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2686 return (*Notification_State_NotificationState_ProviderData_PagerDuty)(nil) 2687 default: 2688 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 2689 } 2690 } 2691 2692 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData) { 2693 if item != nil { 2694 switch fp.selector { 2695 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2696 item.Slack = nil 2697 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2698 item.PagerDuty = nil 2699 default: 2700 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 2701 } 2702 } 2703 } 2704 2705 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2706 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData)) 2707 } 2708 2709 // IsLeaf - whether field path is holds simple value 2710 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) IsLeaf() bool { 2711 return false 2712 } 2713 2714 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2715 return []gotenobject.FieldPath{fp} 2716 } 2717 2718 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathValue { 2719 switch fp.selector { 2720 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2721 return &NotificationStateNotificationStateProviderData_FieldTerminalPathValue{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData_Slack)} 2722 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2723 return &NotificationStateNotificationStateProviderData_FieldTerminalPathValue{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData_PagerDuty)} 2724 default: 2725 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 2726 } 2727 } 2728 2729 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2730 return fp.WithIValue(value) 2731 } 2732 2733 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues { 2734 fpaov := &NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp} 2735 switch fp.selector { 2736 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2737 return &NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, values: values.([]*Notification_State_NotificationState_ProviderData_Slack)} 2738 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2739 return &NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, values: values.([]*Notification_State_NotificationState_ProviderData_PagerDuty)} 2740 default: 2741 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 2742 } 2743 return fpaov 2744 } 2745 2746 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2747 return fp.WithIArrayOfValues(values) 2748 } 2749 2750 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue { 2751 switch fp.selector { 2752 default: 2753 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 2754 } 2755 } 2756 2757 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2758 return fp.WithIArrayItemValue(value) 2759 } 2760 2761 type NotificationStateNotificationStateProviderData_FieldSubPath struct { 2762 selector NotificationStateNotificationStateProviderData_FieldPathSelector 2763 subPath gotenobject.FieldPath 2764 } 2765 2766 var _ NotificationStateNotificationStateProviderData_FieldPath = (*NotificationStateNotificationStateProviderData_FieldSubPath)(nil) 2767 2768 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) Selector() NotificationStateNotificationStateProviderData_FieldPathSelector { 2769 return fps.selector 2770 } 2771 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) AsSlackSubPath() (NotificationStateNotificationStateProviderDataSlack_FieldPath, bool) { 2772 res, ok := fps.subPath.(NotificationStateNotificationStateProviderDataSlack_FieldPath) 2773 return res, ok 2774 } 2775 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) AsPagerDutySubPath() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPath, bool) { 2776 res, ok := fps.subPath.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPath) 2777 return res, ok 2778 } 2779 2780 // String returns path representation in proto convention 2781 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) String() string { 2782 return fps.selector.String() + "." + fps.subPath.String() 2783 } 2784 2785 // JSONString returns path representation is JSON convention 2786 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) JSONString() string { 2787 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2788 } 2789 2790 // Get returns all values pointed by selected field from source Notification_State_NotificationState_ProviderData 2791 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) Get(source *Notification_State_NotificationState_ProviderData) (values []interface{}) { 2792 switch fps.selector { 2793 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2794 values = append(values, fps.subPath.GetRaw(source.GetSlack())...) 2795 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2796 values = append(values, fps.subPath.GetRaw(source.GetPagerDuty())...) 2797 default: 2798 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fps.selector)) 2799 } 2800 return 2801 } 2802 2803 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2804 return fps.Get(source.(*Notification_State_NotificationState_ProviderData)) 2805 } 2806 2807 // GetSingle returns value of selected field from source Notification_State_NotificationState_ProviderData 2808 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) { 2809 switch fps.selector { 2810 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2811 if source.GetSlack() == nil { 2812 return nil, false 2813 } 2814 return fps.subPath.GetSingleRaw(source.GetSlack()) 2815 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2816 if source.GetPagerDuty() == nil { 2817 return nil, false 2818 } 2819 return fps.subPath.GetSingleRaw(source.GetPagerDuty()) 2820 default: 2821 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fps.selector)) 2822 } 2823 } 2824 2825 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2826 return fps.GetSingle(source.(*Notification_State_NotificationState_ProviderData)) 2827 } 2828 2829 // GetDefault returns a default value of the field type 2830 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetDefault() interface{} { 2831 return fps.subPath.GetDefault() 2832 } 2833 2834 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) ClearValue(item *Notification_State_NotificationState_ProviderData) { 2835 if item != nil { 2836 switch fps.selector { 2837 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2838 fps.subPath.ClearValueRaw(item.Slack) 2839 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2840 fps.subPath.ClearValueRaw(item.PagerDuty) 2841 default: 2842 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fps.selector)) 2843 } 2844 } 2845 } 2846 2847 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) ClearValueRaw(item proto.Message) { 2848 fps.ClearValue(item.(*Notification_State_NotificationState_ProviderData)) 2849 } 2850 2851 // IsLeaf - whether field path is holds simple value 2852 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) IsLeaf() bool { 2853 return fps.subPath.IsLeaf() 2854 } 2855 2856 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2857 iPaths := []gotenobject.FieldPath{&NotificationStateNotificationStateProviderData_FieldTerminalPath{selector: fps.selector}} 2858 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2859 return iPaths 2860 } 2861 2862 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathValue { 2863 return &NotificationStateNotificationStateProviderData_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2864 } 2865 2866 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2867 return fps.WithIValue(value) 2868 } 2869 2870 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues { 2871 return &NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2872 } 2873 2874 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2875 return fps.WithIArrayOfValues(values) 2876 } 2877 2878 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue { 2879 return &NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2880 } 2881 2882 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2883 return fps.WithIArrayItemValue(value) 2884 } 2885 2886 // NotificationStateNotificationStateProviderData_FieldPathValue allows storing values for ProviderData fields according to their type 2887 type NotificationStateNotificationStateProviderData_FieldPathValue interface { 2888 NotificationStateNotificationStateProviderData_FieldPath 2889 gotenobject.FieldPathValue 2890 SetTo(target **Notification_State_NotificationState_ProviderData) 2891 CompareWith(*Notification_State_NotificationState_ProviderData) (cmp int, comparable bool) 2892 } 2893 2894 func ParseNotificationStateNotificationStateProviderData_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderData_FieldPathValue, error) { 2895 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(pathStr) 2896 if err != nil { 2897 return nil, err 2898 } 2899 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2900 if err != nil { 2901 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProviderData field path value from %s: %v", valueStr, err) 2902 } 2903 return fpv.(NotificationStateNotificationStateProviderData_FieldPathValue), nil 2904 } 2905 2906 func MustParseNotificationStateNotificationStateProviderData_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderData_FieldPathValue { 2907 fpv, err := ParseNotificationStateNotificationStateProviderData_FieldPathValue(pathStr, valueStr) 2908 if err != nil { 2909 panic(err) 2910 } 2911 return fpv 2912 } 2913 2914 type NotificationStateNotificationStateProviderData_FieldTerminalPathValue struct { 2915 NotificationStateNotificationStateProviderData_FieldTerminalPath 2916 value interface{} 2917 } 2918 2919 var _ NotificationStateNotificationStateProviderData_FieldPathValue = (*NotificationStateNotificationStateProviderData_FieldTerminalPathValue)(nil) 2920 2921 // GetRawValue returns raw value stored under selected path for 'ProviderData' as interface{} 2922 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) GetRawValue() interface{} { 2923 return fpv.value 2924 } 2925 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) AsSlackValue() (*Notification_State_NotificationState_ProviderData_Slack, bool) { 2926 res, ok := fpv.value.(*Notification_State_NotificationState_ProviderData_Slack) 2927 return res, ok 2928 } 2929 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) AsPagerDutyValue() (*Notification_State_NotificationState_ProviderData_PagerDuty, bool) { 2930 res, ok := fpv.value.(*Notification_State_NotificationState_ProviderData_PagerDuty) 2931 return res, ok 2932 } 2933 2934 // SetTo stores value for selected field for object ProviderData 2935 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData) { 2936 if *target == nil { 2937 *target = new(Notification_State_NotificationState_ProviderData) 2938 } 2939 switch fpv.selector { 2940 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2941 (*target).Slack = fpv.value.(*Notification_State_NotificationState_ProviderData_Slack) 2942 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2943 (*target).PagerDuty = fpv.value.(*Notification_State_NotificationState_ProviderData_PagerDuty) 2944 default: 2945 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpv.selector)) 2946 } 2947 } 2948 2949 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2950 typedObject := target.(*Notification_State_NotificationState_ProviderData) 2951 fpv.SetTo(&typedObject) 2952 } 2953 2954 // CompareWith compares value in the 'NotificationStateNotificationStateProviderData_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData'. 2955 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData) (int, bool) { 2956 switch fpv.selector { 2957 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2958 return 0, false 2959 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2960 return 0, false 2961 default: 2962 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpv.selector)) 2963 } 2964 } 2965 2966 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2967 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData)) 2968 } 2969 2970 type NotificationStateNotificationStateProviderData_FieldSubPathValue struct { 2971 NotificationStateNotificationStateProviderData_FieldPath 2972 subPathValue gotenobject.FieldPathValue 2973 } 2974 2975 var _ NotificationStateNotificationStateProviderData_FieldPathValue = (*NotificationStateNotificationStateProviderData_FieldSubPathValue)(nil) 2976 2977 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) AsSlackPathValue() (NotificationStateNotificationStateProviderDataSlack_FieldPathValue, bool) { 2978 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue) 2979 return res, ok 2980 } 2981 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) AsPagerDutyPathValue() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue, bool) { 2982 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue) 2983 return res, ok 2984 } 2985 2986 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) SetTo(target **Notification_State_NotificationState_ProviderData) { 2987 if *target == nil { 2988 *target = new(Notification_State_NotificationState_ProviderData) 2989 } 2990 switch fpvs.Selector() { 2991 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 2992 fpvs.subPathValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue).SetTo(&(*target).Slack) 2993 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 2994 fpvs.subPathValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue).SetTo(&(*target).PagerDuty) 2995 default: 2996 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpvs.Selector())) 2997 } 2998 } 2999 3000 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) SetToRaw(target proto.Message) { 3001 typedObject := target.(*Notification_State_NotificationState_ProviderData) 3002 fpvs.SetTo(&typedObject) 3003 } 3004 3005 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) GetRawValue() interface{} { 3006 return fpvs.subPathValue.GetRawValue() 3007 } 3008 3009 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData) (int, bool) { 3010 switch fpvs.Selector() { 3011 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3012 return fpvs.subPathValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue).CompareWith(source.GetSlack()) 3013 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3014 return fpvs.subPathValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue).CompareWith(source.GetPagerDuty()) 3015 default: 3016 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpvs.Selector())) 3017 } 3018 } 3019 3020 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3021 return fpvs.CompareWith(source.(*Notification_State_NotificationState_ProviderData)) 3022 } 3023 3024 // NotificationStateNotificationStateProviderData_FieldPathArrayItemValue allows storing single item in Path-specific values for ProviderData according to their type 3025 // Present only for array (repeated) types. 3026 type NotificationStateNotificationStateProviderData_FieldPathArrayItemValue interface { 3027 gotenobject.FieldPathArrayItemValue 3028 NotificationStateNotificationStateProviderData_FieldPath 3029 ContainsValue(*Notification_State_NotificationState_ProviderData) bool 3030 } 3031 3032 // ParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3033 func ParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderData_FieldPathArrayItemValue, error) { 3034 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(pathStr) 3035 if err != nil { 3036 return nil, err 3037 } 3038 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3039 if err != nil { 3040 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProviderData field path array item value from %s: %v", valueStr, err) 3041 } 3042 return fpaiv.(NotificationStateNotificationStateProviderData_FieldPathArrayItemValue), nil 3043 } 3044 3045 func MustParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue { 3046 fpaiv, err := ParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue(pathStr, valueStr) 3047 if err != nil { 3048 panic(err) 3049 } 3050 return fpaiv 3051 } 3052 3053 type NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue struct { 3054 NotificationStateNotificationStateProviderData_FieldTerminalPath 3055 value interface{} 3056 } 3057 3058 var _ NotificationStateNotificationStateProviderData_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue)(nil) 3059 3060 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData as interface{} 3061 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3062 return fpaiv.value 3063 } 3064 3065 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) { 3066 return nil, false 3067 } 3068 3069 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3070 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData)) 3071 } 3072 3073 // Contains returns a boolean indicating if value that is being held is present in given 'ProviderData' 3074 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData) bool { 3075 slice := fpaiv.NotificationStateNotificationStateProviderData_FieldTerminalPath.Get(source) 3076 for _, v := range slice { 3077 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3078 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3079 return true 3080 } 3081 } else if reflect.DeepEqual(v, fpaiv.value) { 3082 return true 3083 } 3084 } 3085 return false 3086 } 3087 3088 type NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue struct { 3089 NotificationStateNotificationStateProviderData_FieldPath 3090 subPathItemValue gotenobject.FieldPathArrayItemValue 3091 } 3092 3093 // GetRawValue returns stored array item value 3094 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 3095 return fpaivs.subPathItemValue.GetRawItemValue() 3096 } 3097 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) AsSlackPathItemValue() (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue, bool) { 3098 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue) 3099 return res, ok 3100 } 3101 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) AsPagerDutyPathItemValue() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue, bool) { 3102 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue) 3103 return res, ok 3104 } 3105 3106 // Contains returns a boolean indicating if value that is being held is present in given 'ProviderData' 3107 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData) bool { 3108 switch fpaivs.Selector() { 3109 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3110 return fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue).ContainsValue(source.GetSlack()) 3111 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3112 return fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue).ContainsValue(source.GetPagerDuty()) 3113 default: 3114 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpaivs.Selector())) 3115 } 3116 } 3117 3118 // NotificationStateNotificationStateProviderData_FieldPathArrayOfValues allows storing slice of values for ProviderData fields according to their type 3119 type NotificationStateNotificationStateProviderData_FieldPathArrayOfValues interface { 3120 gotenobject.FieldPathArrayOfValues 3121 NotificationStateNotificationStateProviderData_FieldPath 3122 } 3123 3124 func ParseNotificationStateNotificationStateProviderData_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderData_FieldPathArrayOfValues, error) { 3125 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(pathStr) 3126 if err != nil { 3127 return nil, err 3128 } 3129 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3130 if err != nil { 3131 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProviderData field path array of values from %s: %v", valuesStr, err) 3132 } 3133 return fpaov.(NotificationStateNotificationStateProviderData_FieldPathArrayOfValues), nil 3134 } 3135 3136 func MustParseNotificationStateNotificationStateProviderData_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues { 3137 fpaov, err := ParseNotificationStateNotificationStateProviderData_FieldPathArrayOfValues(pathStr, valuesStr) 3138 if err != nil { 3139 panic(err) 3140 } 3141 return fpaov 3142 } 3143 3144 type NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues struct { 3145 NotificationStateNotificationStateProviderData_FieldTerminalPath 3146 values interface{} 3147 } 3148 3149 var _ NotificationStateNotificationStateProviderData_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues)(nil) 3150 3151 func (fpaov *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3152 switch fpaov.selector { 3153 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3154 for _, v := range fpaov.values.([]*Notification_State_NotificationState_ProviderData_Slack) { 3155 values = append(values, v) 3156 } 3157 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3158 for _, v := range fpaov.values.([]*Notification_State_NotificationState_ProviderData_PagerDuty) { 3159 values = append(values, v) 3160 } 3161 } 3162 return 3163 } 3164 func (fpaov *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues) AsSlackArrayOfValues() ([]*Notification_State_NotificationState_ProviderData_Slack, bool) { 3165 res, ok := fpaov.values.([]*Notification_State_NotificationState_ProviderData_Slack) 3166 return res, ok 3167 } 3168 func (fpaov *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues) AsPagerDutyArrayOfValues() ([]*Notification_State_NotificationState_ProviderData_PagerDuty, bool) { 3169 res, ok := fpaov.values.([]*Notification_State_NotificationState_ProviderData_PagerDuty) 3170 return res, ok 3171 } 3172 3173 type NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues struct { 3174 NotificationStateNotificationStateProviderData_FieldPath 3175 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 3176 } 3177 3178 var _ NotificationStateNotificationStateProviderData_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues)(nil) 3179 3180 func (fpsaov *NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 3181 return fpsaov.subPathArrayOfValues.GetRawValues() 3182 } 3183 func (fpsaov *NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues) AsSlackPathArrayOfValues() (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues, bool) { 3184 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues) 3185 return res, ok 3186 } 3187 func (fpsaov *NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues) AsPagerDutyPathArrayOfValues() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues, bool) { 3188 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues) 3189 return res, ok 3190 } 3191 3192 // FieldPath provides implementation to handle 3193 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3194 type NotificationStateNotificationStateProviderDataSlack_FieldPath interface { 3195 gotenobject.FieldPath 3196 Selector() NotificationStateNotificationStateProviderDataSlack_FieldPathSelector 3197 Get(source *Notification_State_NotificationState_ProviderData_Slack) []interface{} 3198 GetSingle(source *Notification_State_NotificationState_ProviderData_Slack) (interface{}, bool) 3199 ClearValue(item *Notification_State_NotificationState_ProviderData_Slack) 3200 3201 // Those methods build corresponding NotificationStateNotificationStateProviderDataSlack_FieldPathValue 3202 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3203 WithIValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathValue 3204 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues 3205 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue 3206 } 3207 3208 type NotificationStateNotificationStateProviderDataSlack_FieldPathSelector int32 3209 3210 const ( 3211 NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs NotificationStateNotificationStateProviderDataSlack_FieldPathSelector = 0 3212 ) 3213 3214 func (s NotificationStateNotificationStateProviderDataSlack_FieldPathSelector) String() string { 3215 switch s { 3216 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3217 return "ts" 3218 default: 3219 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", s)) 3220 } 3221 } 3222 3223 func BuildNotificationStateNotificationStateProviderDataSlack_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderDataSlack_FieldPath, error) { 3224 if len(fp) == 0 { 3225 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData_Slack") 3226 } 3227 if len(fp) == 1 { 3228 switch fp[0] { 3229 case "ts": 3230 return &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs}, nil 3231 } 3232 } 3233 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData_Slack", fp) 3234 } 3235 3236 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(rawField string) (NotificationStateNotificationStateProviderDataSlack_FieldPath, error) { 3237 fp, err := gotenobject.ParseRawFieldPath(rawField) 3238 if err != nil { 3239 return nil, err 3240 } 3241 return BuildNotificationStateNotificationStateProviderDataSlack_FieldPath(fp) 3242 } 3243 3244 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPath(rawField string) NotificationStateNotificationStateProviderDataSlack_FieldPath { 3245 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(rawField) 3246 if err != nil { 3247 panic(err) 3248 } 3249 return fp 3250 } 3251 3252 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath struct { 3253 selector NotificationStateNotificationStateProviderDataSlack_FieldPathSelector 3254 } 3255 3256 var _ NotificationStateNotificationStateProviderDataSlack_FieldPath = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath)(nil) 3257 3258 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderDataSlack_FieldPathSelector { 3259 return fp.selector 3260 } 3261 3262 // String returns path representation in proto convention 3263 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) String() string { 3264 return fp.selector.String() 3265 } 3266 3267 // JSONString returns path representation is JSON convention 3268 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) JSONString() string { 3269 return strcase.ToLowerCamel(fp.String()) 3270 } 3271 3272 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData_Slack 3273 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData_Slack) (values []interface{}) { 3274 if source != nil { 3275 switch fp.selector { 3276 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3277 values = append(values, source.Ts) 3278 default: 3279 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3280 } 3281 } 3282 return 3283 } 3284 3285 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3286 return fp.Get(source.(*Notification_State_NotificationState_ProviderData_Slack)) 3287 } 3288 3289 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData_Slack 3290 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData_Slack) (interface{}, bool) { 3291 switch fp.selector { 3292 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3293 return source.GetTs(), source != nil 3294 default: 3295 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3296 } 3297 } 3298 3299 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3300 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData_Slack)) 3301 } 3302 3303 // GetDefault returns a default value of the field type 3304 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetDefault() interface{} { 3305 switch fp.selector { 3306 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3307 return "" 3308 default: 3309 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3310 } 3311 } 3312 3313 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData_Slack) { 3314 if item != nil { 3315 switch fp.selector { 3316 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3317 item.Ts = "" 3318 default: 3319 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3320 } 3321 } 3322 } 3323 3324 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3325 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData_Slack)) 3326 } 3327 3328 // IsLeaf - whether field path is holds simple value 3329 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) IsLeaf() bool { 3330 return fp.selector == NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs 3331 } 3332 3333 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3334 return []gotenobject.FieldPath{fp} 3335 } 3336 3337 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathValue { 3338 switch fp.selector { 3339 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3340 return &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath: *fp, value: value.(string)} 3341 default: 3342 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3343 } 3344 } 3345 3346 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3347 return fp.WithIValue(value) 3348 } 3349 3350 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues { 3351 fpaov := &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath: *fp} 3352 switch fp.selector { 3353 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3354 return &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath: *fp, values: values.([]string)} 3355 default: 3356 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3357 } 3358 return fpaov 3359 } 3360 3361 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3362 return fp.WithIArrayOfValues(values) 3363 } 3364 3365 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue { 3366 switch fp.selector { 3367 default: 3368 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3369 } 3370 } 3371 3372 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3373 return fp.WithIArrayItemValue(value) 3374 } 3375 3376 // NotificationStateNotificationStateProviderDataSlack_FieldPathValue allows storing values for Slack fields according to their type 3377 type NotificationStateNotificationStateProviderDataSlack_FieldPathValue interface { 3378 NotificationStateNotificationStateProviderDataSlack_FieldPath 3379 gotenobject.FieldPathValue 3380 SetTo(target **Notification_State_NotificationState_ProviderData_Slack) 3381 CompareWith(*Notification_State_NotificationState_ProviderData_Slack) (cmp int, comparable bool) 3382 } 3383 3384 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataSlack_FieldPathValue, error) { 3385 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(pathStr) 3386 if err != nil { 3387 return nil, err 3388 } 3389 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3390 if err != nil { 3391 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path value from %s: %v", valueStr, err) 3392 } 3393 return fpv.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue), nil 3394 } 3395 3396 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataSlack_FieldPathValue { 3397 fpv, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPathValue(pathStr, valueStr) 3398 if err != nil { 3399 panic(err) 3400 } 3401 return fpv 3402 } 3403 3404 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue struct { 3405 NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath 3406 value interface{} 3407 } 3408 3409 var _ NotificationStateNotificationStateProviderDataSlack_FieldPathValue = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue)(nil) 3410 3411 // GetRawValue returns raw value stored under selected path for 'Slack' as interface{} 3412 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) GetRawValue() interface{} { 3413 return fpv.value 3414 } 3415 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) AsTsValue() (string, bool) { 3416 res, ok := fpv.value.(string) 3417 return res, ok 3418 } 3419 3420 // SetTo stores value for selected field for object Slack 3421 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData_Slack) { 3422 if *target == nil { 3423 *target = new(Notification_State_NotificationState_ProviderData_Slack) 3424 } 3425 switch fpv.selector { 3426 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3427 (*target).Ts = fpv.value.(string) 3428 default: 3429 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fpv.selector)) 3430 } 3431 } 3432 3433 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3434 typedObject := target.(*Notification_State_NotificationState_ProviderData_Slack) 3435 fpv.SetTo(&typedObject) 3436 } 3437 3438 // CompareWith compares value in the 'NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData_Slack'. 3439 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData_Slack) (int, bool) { 3440 switch fpv.selector { 3441 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3442 leftValue := fpv.value.(string) 3443 rightValue := source.GetTs() 3444 if (leftValue) == (rightValue) { 3445 return 0, true 3446 } else if (leftValue) < (rightValue) { 3447 return -1, true 3448 } else { 3449 return 1, true 3450 } 3451 default: 3452 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fpv.selector)) 3453 } 3454 } 3455 3456 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3457 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData_Slack)) 3458 } 3459 3460 // NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue allows storing single item in Path-specific values for Slack according to their type 3461 // Present only for array (repeated) types. 3462 type NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue interface { 3463 gotenobject.FieldPathArrayItemValue 3464 NotificationStateNotificationStateProviderDataSlack_FieldPath 3465 ContainsValue(*Notification_State_NotificationState_ProviderData_Slack) bool 3466 } 3467 3468 // ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3469 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue, error) { 3470 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(pathStr) 3471 if err != nil { 3472 return nil, err 3473 } 3474 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3475 if err != nil { 3476 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path array item value from %s: %v", valueStr, err) 3477 } 3478 return fpaiv.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue), nil 3479 } 3480 3481 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue { 3482 fpaiv, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue(pathStr, valueStr) 3483 if err != nil { 3484 panic(err) 3485 } 3486 return fpaiv 3487 } 3488 3489 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue struct { 3490 NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath 3491 value interface{} 3492 } 3493 3494 var _ NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue)(nil) 3495 3496 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData_Slack as interface{} 3497 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3498 return fpaiv.value 3499 } 3500 3501 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData_Slack) (interface{}, bool) { 3502 return nil, false 3503 } 3504 3505 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3506 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData_Slack)) 3507 } 3508 3509 // Contains returns a boolean indicating if value that is being held is present in given 'Slack' 3510 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData_Slack) bool { 3511 slice := fpaiv.NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath.Get(source) 3512 for _, v := range slice { 3513 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3514 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3515 return true 3516 } 3517 } else if reflect.DeepEqual(v, fpaiv.value) { 3518 return true 3519 } 3520 } 3521 return false 3522 } 3523 3524 // NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues allows storing slice of values for Slack fields according to their type 3525 type NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues interface { 3526 gotenobject.FieldPathArrayOfValues 3527 NotificationStateNotificationStateProviderDataSlack_FieldPath 3528 } 3529 3530 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues, error) { 3531 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(pathStr) 3532 if err != nil { 3533 return nil, err 3534 } 3535 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3536 if err != nil { 3537 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path array of values from %s: %v", valuesStr, err) 3538 } 3539 return fpaov.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues), nil 3540 } 3541 3542 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues { 3543 fpaov, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues(pathStr, valuesStr) 3544 if err != nil { 3545 panic(err) 3546 } 3547 return fpaov 3548 } 3549 3550 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues struct { 3551 NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath 3552 values interface{} 3553 } 3554 3555 var _ NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues)(nil) 3556 3557 func (fpaov *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3558 switch fpaov.selector { 3559 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3560 for _, v := range fpaov.values.([]string) { 3561 values = append(values, v) 3562 } 3563 } 3564 return 3565 } 3566 func (fpaov *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues) AsTsArrayOfValues() ([]string, bool) { 3567 res, ok := fpaov.values.([]string) 3568 return res, ok 3569 } 3570 3571 // FieldPath provides implementation to handle 3572 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3573 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPath interface { 3574 gotenobject.FieldPath 3575 Selector() NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector 3576 Get(source *Notification_State_NotificationState_ProviderData_PagerDuty) []interface{} 3577 GetSingle(source *Notification_State_NotificationState_ProviderData_PagerDuty) (interface{}, bool) 3578 ClearValue(item *Notification_State_NotificationState_ProviderData_PagerDuty) 3579 3580 // Those methods build corresponding NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue 3581 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3582 WithIValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue 3583 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues 3584 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue 3585 } 3586 3587 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector int32 3588 3589 const ( 3590 NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector = 0 3591 ) 3592 3593 func (s NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector) String() string { 3594 switch s { 3595 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3596 return "incident_key" 3597 default: 3598 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", s)) 3599 } 3600 } 3601 3602 func BuildNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPath, error) { 3603 if len(fp) == 0 { 3604 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData_PagerDuty") 3605 } 3606 if len(fp) == 1 { 3607 switch fp[0] { 3608 case "incident_key", "incidentKey", "incident-key": 3609 return &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey}, nil 3610 } 3611 } 3612 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData_PagerDuty", fp) 3613 } 3614 3615 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(rawField string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPath, error) { 3616 fp, err := gotenobject.ParseRawFieldPath(rawField) 3617 if err != nil { 3618 return nil, err 3619 } 3620 return BuildNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(fp) 3621 } 3622 3623 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(rawField string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPath { 3624 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(rawField) 3625 if err != nil { 3626 panic(err) 3627 } 3628 return fp 3629 } 3630 3631 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath struct { 3632 selector NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector 3633 } 3634 3635 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPath = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath)(nil) 3636 3637 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector { 3638 return fp.selector 3639 } 3640 3641 // String returns path representation in proto convention 3642 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) String() string { 3643 return fp.selector.String() 3644 } 3645 3646 // JSONString returns path representation is JSON convention 3647 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) JSONString() string { 3648 return strcase.ToLowerCamel(fp.String()) 3649 } 3650 3651 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData_PagerDuty 3652 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData_PagerDuty) (values []interface{}) { 3653 if source != nil { 3654 switch fp.selector { 3655 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3656 values = append(values, source.IncidentKey) 3657 default: 3658 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 3659 } 3660 } 3661 return 3662 } 3663 3664 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3665 return fp.Get(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 3666 } 3667 3668 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData_PagerDuty 3669 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData_PagerDuty) (interface{}, bool) { 3670 switch fp.selector { 3671 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3672 return source.GetIncidentKey(), source != nil 3673 default: 3674 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 3675 } 3676 } 3677 3678 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3679 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 3680 } 3681 3682 // GetDefault returns a default value of the field type 3683 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetDefault() interface{} { 3684 switch fp.selector { 3685 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3686 return "" 3687 default: 3688 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 3689 } 3690 } 3691 3692 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData_PagerDuty) { 3693 if item != nil { 3694 switch fp.selector { 3695 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3696 item.IncidentKey = "" 3697 default: 3698 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 3699 } 3700 } 3701 } 3702 3703 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3704 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 3705 } 3706 3707 // IsLeaf - whether field path is holds simple value 3708 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) IsLeaf() bool { 3709 return fp.selector == NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey 3710 } 3711 3712 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3713 return []gotenobject.FieldPath{fp} 3714 } 3715 3716 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue { 3717 switch fp.selector { 3718 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3719 return &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath: *fp, value: value.(string)} 3720 default: 3721 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 3722 } 3723 } 3724 3725 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3726 return fp.WithIValue(value) 3727 } 3728 3729 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues { 3730 fpaov := &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath: *fp} 3731 switch fp.selector { 3732 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3733 return &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath: *fp, values: values.([]string)} 3734 default: 3735 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 3736 } 3737 return fpaov 3738 } 3739 3740 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3741 return fp.WithIArrayOfValues(values) 3742 } 3743 3744 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue { 3745 switch fp.selector { 3746 default: 3747 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 3748 } 3749 } 3750 3751 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3752 return fp.WithIArrayItemValue(value) 3753 } 3754 3755 // NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue allows storing values for PagerDuty fields according to their type 3756 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue interface { 3757 NotificationStateNotificationStateProviderDataPagerDuty_FieldPath 3758 gotenobject.FieldPathValue 3759 SetTo(target **Notification_State_NotificationState_ProviderData_PagerDuty) 3760 CompareWith(*Notification_State_NotificationState_ProviderData_PagerDuty) (cmp int, comparable bool) 3761 } 3762 3763 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue, error) { 3764 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(pathStr) 3765 if err != nil { 3766 return nil, err 3767 } 3768 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3769 if err != nil { 3770 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path value from %s: %v", valueStr, err) 3771 } 3772 return fpv.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue), nil 3773 } 3774 3775 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue { 3776 fpv, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue(pathStr, valueStr) 3777 if err != nil { 3778 panic(err) 3779 } 3780 return fpv 3781 } 3782 3783 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue struct { 3784 NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath 3785 value interface{} 3786 } 3787 3788 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue)(nil) 3789 3790 // GetRawValue returns raw value stored under selected path for 'PagerDuty' as interface{} 3791 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) GetRawValue() interface{} { 3792 return fpv.value 3793 } 3794 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) AsIncidentKeyValue() (string, bool) { 3795 res, ok := fpv.value.(string) 3796 return res, ok 3797 } 3798 3799 // SetTo stores value for selected field for object PagerDuty 3800 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData_PagerDuty) { 3801 if *target == nil { 3802 *target = new(Notification_State_NotificationState_ProviderData_PagerDuty) 3803 } 3804 switch fpv.selector { 3805 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3806 (*target).IncidentKey = fpv.value.(string) 3807 default: 3808 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fpv.selector)) 3809 } 3810 } 3811 3812 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3813 typedObject := target.(*Notification_State_NotificationState_ProviderData_PagerDuty) 3814 fpv.SetTo(&typedObject) 3815 } 3816 3817 // CompareWith compares value in the 'NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData_PagerDuty'. 3818 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData_PagerDuty) (int, bool) { 3819 switch fpv.selector { 3820 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3821 leftValue := fpv.value.(string) 3822 rightValue := source.GetIncidentKey() 3823 if (leftValue) == (rightValue) { 3824 return 0, true 3825 } else if (leftValue) < (rightValue) { 3826 return -1, true 3827 } else { 3828 return 1, true 3829 } 3830 default: 3831 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fpv.selector)) 3832 } 3833 } 3834 3835 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3836 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 3837 } 3838 3839 // NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue allows storing single item in Path-specific values for PagerDuty according to their type 3840 // Present only for array (repeated) types. 3841 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue interface { 3842 gotenobject.FieldPathArrayItemValue 3843 NotificationStateNotificationStateProviderDataPagerDuty_FieldPath 3844 ContainsValue(*Notification_State_NotificationState_ProviderData_PagerDuty) bool 3845 } 3846 3847 // ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3848 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue, error) { 3849 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(pathStr) 3850 if err != nil { 3851 return nil, err 3852 } 3853 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3854 if err != nil { 3855 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path array item value from %s: %v", valueStr, err) 3856 } 3857 return fpaiv.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue), nil 3858 } 3859 3860 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue { 3861 fpaiv, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue(pathStr, valueStr) 3862 if err != nil { 3863 panic(err) 3864 } 3865 return fpaiv 3866 } 3867 3868 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue struct { 3869 NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath 3870 value interface{} 3871 } 3872 3873 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue)(nil) 3874 3875 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData_PagerDuty as interface{} 3876 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3877 return fpaiv.value 3878 } 3879 3880 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData_PagerDuty) (interface{}, bool) { 3881 return nil, false 3882 } 3883 3884 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3885 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 3886 } 3887 3888 // Contains returns a boolean indicating if value that is being held is present in given 'PagerDuty' 3889 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData_PagerDuty) bool { 3890 slice := fpaiv.NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath.Get(source) 3891 for _, v := range slice { 3892 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3893 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3894 return true 3895 } 3896 } else if reflect.DeepEqual(v, fpaiv.value) { 3897 return true 3898 } 3899 } 3900 return false 3901 } 3902 3903 // NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues allows storing slice of values for PagerDuty fields according to their type 3904 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues interface { 3905 gotenobject.FieldPathArrayOfValues 3906 NotificationStateNotificationStateProviderDataPagerDuty_FieldPath 3907 } 3908 3909 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues, error) { 3910 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(pathStr) 3911 if err != nil { 3912 return nil, err 3913 } 3914 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3915 if err != nil { 3916 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path array of values from %s: %v", valuesStr, err) 3917 } 3918 return fpaov.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues), nil 3919 } 3920 3921 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues { 3922 fpaov, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr) 3923 if err != nil { 3924 panic(err) 3925 } 3926 return fpaov 3927 } 3928 3929 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues struct { 3930 NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath 3931 values interface{} 3932 } 3933 3934 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues)(nil) 3935 3936 func (fpaov *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3937 switch fpaov.selector { 3938 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 3939 for _, v := range fpaov.values.([]string) { 3940 values = append(values, v) 3941 } 3942 } 3943 return 3944 } 3945 func (fpaov *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues) AsIncidentKeyArrayOfValues() ([]string, bool) { 3946 res, ok := fpaov.values.([]string) 3947 return res, ok 3948 }