github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/notification/notification.pb.fieldpath.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/monitoring/proto/v4/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/v4/alert" 27 alerting_condition "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_condition" 28 alerting_policy "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_policy" 29 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 30 notification_channel "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/notification_channel" 31 project "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/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_FieldPathSelectorAlerts Notification_FieldPathSelector = 2 86 Notification_FieldPathSelectorAlertSets 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_FieldPathSelectorAlerts: 97 return "alerts" 98 case Notification_FieldPathSelectorAlertSets: 99 return "alert_sets" 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 "alerts": 118 return &Notification_FieldTerminalPath{selector: Notification_FieldPathSelectorAlerts}, nil 119 case "alert_sets", "alertSets", "alert-sets": 120 return &Notification_FieldTerminalPath{selector: Notification_FieldPathSelectorAlertSets}, 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 "alert_sets", "alertSets", "alert-sets": 133 if subpath, err := BuildNotificationAlertsSet_FieldPath(fp[1:]); err != nil { 134 return nil, err 135 } else { 136 return &Notification_FieldSubPath{selector: Notification_FieldPathSelectorAlertSets, subPath: subpath}, nil 137 } 138 case "state": 139 if subpath, err := BuildNotificationState_FieldPath(fp[1:]); err != nil { 140 return nil, err 141 } else { 142 return &Notification_FieldSubPath{selector: Notification_FieldPathSelectorState, subPath: subpath}, nil 143 } 144 } 145 } 146 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification", fp) 147 } 148 149 func ParseNotification_FieldPath(rawField string) (Notification_FieldPath, error) { 150 fp, err := gotenobject.ParseRawFieldPath(rawField) 151 if err != nil { 152 return nil, err 153 } 154 return BuildNotification_FieldPath(fp) 155 } 156 157 func MustParseNotification_FieldPath(rawField string) Notification_FieldPath { 158 fp, err := ParseNotification_FieldPath(rawField) 159 if err != nil { 160 panic(err) 161 } 162 return fp 163 } 164 165 type Notification_FieldTerminalPath struct { 166 selector Notification_FieldPathSelector 167 } 168 169 var _ Notification_FieldPath = (*Notification_FieldTerminalPath)(nil) 170 171 func (fp *Notification_FieldTerminalPath) Selector() Notification_FieldPathSelector { 172 return fp.selector 173 } 174 175 // String returns path representation in proto convention 176 func (fp *Notification_FieldTerminalPath) String() string { 177 return fp.selector.String() 178 } 179 180 // JSONString returns path representation is JSON convention 181 func (fp *Notification_FieldTerminalPath) JSONString() string { 182 return strcase.ToLowerCamel(fp.String()) 183 } 184 185 // Get returns all values pointed by specific field from source Notification 186 func (fp *Notification_FieldTerminalPath) Get(source *Notification) (values []interface{}) { 187 if source != nil { 188 switch fp.selector { 189 case Notification_FieldPathSelectorName: 190 if source.Name != nil { 191 values = append(values, source.Name) 192 } 193 case Notification_FieldPathSelectorMetadata: 194 if source.Metadata != nil { 195 values = append(values, source.Metadata) 196 } 197 case Notification_FieldPathSelectorAlerts: 198 for _, value := range source.GetAlerts() { 199 values = append(values, value) 200 } 201 case Notification_FieldPathSelectorAlertSets: 202 for _, value := range source.GetAlertSets() { 203 values = append(values, value) 204 } 205 case Notification_FieldPathSelectorState: 206 if source.State != nil { 207 values = append(values, source.State) 208 } 209 default: 210 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 211 } 212 } 213 return 214 } 215 216 func (fp *Notification_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 217 return fp.Get(source.(*Notification)) 218 } 219 220 // GetSingle returns value pointed by specific field of from source Notification 221 func (fp *Notification_FieldTerminalPath) GetSingle(source *Notification) (interface{}, bool) { 222 switch fp.selector { 223 case Notification_FieldPathSelectorName: 224 res := source.GetName() 225 return res, res != nil 226 case Notification_FieldPathSelectorMetadata: 227 res := source.GetMetadata() 228 return res, res != nil 229 case Notification_FieldPathSelectorAlerts: 230 res := source.GetAlerts() 231 return res, res != nil 232 case Notification_FieldPathSelectorAlertSets: 233 res := source.GetAlertSets() 234 return res, res != nil 235 case Notification_FieldPathSelectorState: 236 res := source.GetState() 237 return res, res != nil 238 default: 239 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 240 } 241 } 242 243 func (fp *Notification_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 244 return fp.GetSingle(source.(*Notification)) 245 } 246 247 // GetDefault returns a default value of the field type 248 func (fp *Notification_FieldTerminalPath) GetDefault() interface{} { 249 switch fp.selector { 250 case Notification_FieldPathSelectorName: 251 return (*Name)(nil) 252 case Notification_FieldPathSelectorMetadata: 253 return (*meta.Meta)(nil) 254 case Notification_FieldPathSelectorAlerts: 255 return ([]*alert.Name)(nil) 256 case Notification_FieldPathSelectorAlertSets: 257 return ([]*Notification_AlertsSet)(nil) 258 case Notification_FieldPathSelectorState: 259 return (*Notification_State)(nil) 260 default: 261 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 262 } 263 } 264 265 func (fp *Notification_FieldTerminalPath) ClearValue(item *Notification) { 266 if item != nil { 267 switch fp.selector { 268 case Notification_FieldPathSelectorName: 269 item.Name = nil 270 case Notification_FieldPathSelectorMetadata: 271 item.Metadata = nil 272 case Notification_FieldPathSelectorAlerts: 273 item.Alerts = nil 274 case Notification_FieldPathSelectorAlertSets: 275 item.AlertSets = nil 276 case Notification_FieldPathSelectorState: 277 item.State = nil 278 default: 279 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 280 } 281 } 282 } 283 284 func (fp *Notification_FieldTerminalPath) ClearValueRaw(item proto.Message) { 285 fp.ClearValue(item.(*Notification)) 286 } 287 288 // IsLeaf - whether field path is holds simple value 289 func (fp *Notification_FieldTerminalPath) IsLeaf() bool { 290 return fp.selector == Notification_FieldPathSelectorName || 291 fp.selector == Notification_FieldPathSelectorAlerts 292 } 293 294 func (fp *Notification_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 295 return []gotenobject.FieldPath{fp} 296 } 297 298 func (fp *Notification_FieldTerminalPath) WithIValue(value interface{}) Notification_FieldPathValue { 299 switch fp.selector { 300 case Notification_FieldPathSelectorName: 301 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.(*Name)} 302 case Notification_FieldPathSelectorMetadata: 303 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.(*meta.Meta)} 304 case Notification_FieldPathSelectorAlerts: 305 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.([]*alert.Name)} 306 case Notification_FieldPathSelectorAlertSets: 307 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.([]*Notification_AlertsSet)} 308 case Notification_FieldPathSelectorState: 309 return &Notification_FieldTerminalPathValue{Notification_FieldTerminalPath: *fp, value: value.(*Notification_State)} 310 default: 311 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 312 } 313 } 314 315 func (fp *Notification_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 316 return fp.WithIValue(value) 317 } 318 319 func (fp *Notification_FieldTerminalPath) WithIArrayOfValues(values interface{}) Notification_FieldPathArrayOfValues { 320 fpaov := &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp} 321 switch fp.selector { 322 case Notification_FieldPathSelectorName: 323 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([]*Name)} 324 case Notification_FieldPathSelectorMetadata: 325 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([]*meta.Meta)} 326 case Notification_FieldPathSelectorAlerts: 327 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([][]*alert.Name)} 328 case Notification_FieldPathSelectorAlertSets: 329 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([][]*Notification_AlertsSet)} 330 case Notification_FieldPathSelectorState: 331 return &Notification_FieldTerminalPathArrayOfValues{Notification_FieldTerminalPath: *fp, values: values.([]*Notification_State)} 332 default: 333 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 334 } 335 return fpaov 336 } 337 338 func (fp *Notification_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 339 return fp.WithIArrayOfValues(values) 340 } 341 342 func (fp *Notification_FieldTerminalPath) WithIArrayItemValue(value interface{}) Notification_FieldPathArrayItemValue { 343 switch fp.selector { 344 case Notification_FieldPathSelectorAlerts: 345 return &Notification_FieldTerminalPathArrayItemValue{Notification_FieldTerminalPath: *fp, value: value.(*alert.Name)} 346 case Notification_FieldPathSelectorAlertSets: 347 return &Notification_FieldTerminalPathArrayItemValue{Notification_FieldTerminalPath: *fp, value: value.(*Notification_AlertsSet)} 348 default: 349 panic(fmt.Sprintf("Invalid selector for Notification: %d", fp.selector)) 350 } 351 } 352 353 func (fp *Notification_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 354 return fp.WithIArrayItemValue(value) 355 } 356 357 type Notification_FieldSubPath struct { 358 selector Notification_FieldPathSelector 359 subPath gotenobject.FieldPath 360 } 361 362 var _ Notification_FieldPath = (*Notification_FieldSubPath)(nil) 363 364 func (fps *Notification_FieldSubPath) Selector() Notification_FieldPathSelector { 365 return fps.selector 366 } 367 func (fps *Notification_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) { 368 res, ok := fps.subPath.(meta.Meta_FieldPath) 369 return res, ok 370 } 371 func (fps *Notification_FieldSubPath) AsAlertSetsSubPath() (NotificationAlertsSet_FieldPath, bool) { 372 res, ok := fps.subPath.(NotificationAlertsSet_FieldPath) 373 return res, ok 374 } 375 func (fps *Notification_FieldSubPath) AsStateSubPath() (NotificationState_FieldPath, bool) { 376 res, ok := fps.subPath.(NotificationState_FieldPath) 377 return res, ok 378 } 379 380 // String returns path representation in proto convention 381 func (fps *Notification_FieldSubPath) String() string { 382 return fps.selector.String() + "." + fps.subPath.String() 383 } 384 385 // JSONString returns path representation is JSON convention 386 func (fps *Notification_FieldSubPath) JSONString() string { 387 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 388 } 389 390 // Get returns all values pointed by selected field from source Notification 391 func (fps *Notification_FieldSubPath) Get(source *Notification) (values []interface{}) { 392 switch fps.selector { 393 case Notification_FieldPathSelectorMetadata: 394 values = append(values, fps.subPath.GetRaw(source.GetMetadata())...) 395 case Notification_FieldPathSelectorAlertSets: 396 for _, item := range source.GetAlertSets() { 397 values = append(values, fps.subPath.GetRaw(item)...) 398 } 399 case Notification_FieldPathSelectorState: 400 values = append(values, fps.subPath.GetRaw(source.GetState())...) 401 default: 402 panic(fmt.Sprintf("Invalid selector for Notification: %d", fps.selector)) 403 } 404 return 405 } 406 407 func (fps *Notification_FieldSubPath) GetRaw(source proto.Message) []interface{} { 408 return fps.Get(source.(*Notification)) 409 } 410 411 // GetSingle returns value of selected field from source Notification 412 func (fps *Notification_FieldSubPath) GetSingle(source *Notification) (interface{}, bool) { 413 switch fps.selector { 414 case Notification_FieldPathSelectorMetadata: 415 if source.GetMetadata() == nil { 416 return nil, false 417 } 418 return fps.subPath.GetSingleRaw(source.GetMetadata()) 419 case Notification_FieldPathSelectorAlertSets: 420 if len(source.GetAlertSets()) == 0 { 421 return nil, false 422 } 423 return fps.subPath.GetSingleRaw(source.GetAlertSets()[0]) 424 case Notification_FieldPathSelectorState: 425 if source.GetState() == nil { 426 return nil, false 427 } 428 return fps.subPath.GetSingleRaw(source.GetState()) 429 default: 430 panic(fmt.Sprintf("Invalid selector for Notification: %d", fps.selector)) 431 } 432 } 433 434 func (fps *Notification_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 435 return fps.GetSingle(source.(*Notification)) 436 } 437 438 // GetDefault returns a default value of the field type 439 func (fps *Notification_FieldSubPath) GetDefault() interface{} { 440 return fps.subPath.GetDefault() 441 } 442 443 func (fps *Notification_FieldSubPath) ClearValue(item *Notification) { 444 if item != nil { 445 switch fps.selector { 446 case Notification_FieldPathSelectorMetadata: 447 fps.subPath.ClearValueRaw(item.Metadata) 448 case Notification_FieldPathSelectorAlertSets: 449 for _, subItem := range item.AlertSets { 450 fps.subPath.ClearValueRaw(subItem) 451 } 452 case Notification_FieldPathSelectorState: 453 fps.subPath.ClearValueRaw(item.State) 454 default: 455 panic(fmt.Sprintf("Invalid selector for Notification: %d", fps.selector)) 456 } 457 } 458 } 459 460 func (fps *Notification_FieldSubPath) ClearValueRaw(item proto.Message) { 461 fps.ClearValue(item.(*Notification)) 462 } 463 464 // IsLeaf - whether field path is holds simple value 465 func (fps *Notification_FieldSubPath) IsLeaf() bool { 466 return fps.subPath.IsLeaf() 467 } 468 469 func (fps *Notification_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 470 iPaths := []gotenobject.FieldPath{&Notification_FieldTerminalPath{selector: fps.selector}} 471 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 472 return iPaths 473 } 474 475 func (fps *Notification_FieldSubPath) WithIValue(value interface{}) Notification_FieldPathValue { 476 return &Notification_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 477 } 478 479 func (fps *Notification_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 480 return fps.WithIValue(value) 481 } 482 483 func (fps *Notification_FieldSubPath) WithIArrayOfValues(values interface{}) Notification_FieldPathArrayOfValues { 484 return &Notification_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 485 } 486 487 func (fps *Notification_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 488 return fps.WithIArrayOfValues(values) 489 } 490 491 func (fps *Notification_FieldSubPath) WithIArrayItemValue(value interface{}) Notification_FieldPathArrayItemValue { 492 return &Notification_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 493 } 494 495 func (fps *Notification_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 496 return fps.WithIArrayItemValue(value) 497 } 498 499 // Notification_FieldPathValue allows storing values for Notification fields according to their type 500 type Notification_FieldPathValue interface { 501 Notification_FieldPath 502 gotenobject.FieldPathValue 503 SetTo(target **Notification) 504 CompareWith(*Notification) (cmp int, comparable bool) 505 } 506 507 func ParseNotification_FieldPathValue(pathStr, valueStr string) (Notification_FieldPathValue, error) { 508 fp, err := ParseNotification_FieldPath(pathStr) 509 if err != nil { 510 return nil, err 511 } 512 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 513 if err != nil { 514 return nil, status.Errorf(codes.InvalidArgument, "error parsing Notification field path value from %s: %v", valueStr, err) 515 } 516 return fpv.(Notification_FieldPathValue), nil 517 } 518 519 func MustParseNotification_FieldPathValue(pathStr, valueStr string) Notification_FieldPathValue { 520 fpv, err := ParseNotification_FieldPathValue(pathStr, valueStr) 521 if err != nil { 522 panic(err) 523 } 524 return fpv 525 } 526 527 type Notification_FieldTerminalPathValue struct { 528 Notification_FieldTerminalPath 529 value interface{} 530 } 531 532 var _ Notification_FieldPathValue = (*Notification_FieldTerminalPathValue)(nil) 533 534 // GetRawValue returns raw value stored under selected path for 'Notification' as interface{} 535 func (fpv *Notification_FieldTerminalPathValue) GetRawValue() interface{} { 536 return fpv.value 537 } 538 func (fpv *Notification_FieldTerminalPathValue) AsNameValue() (*Name, bool) { 539 res, ok := fpv.value.(*Name) 540 return res, ok 541 } 542 func (fpv *Notification_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) { 543 res, ok := fpv.value.(*meta.Meta) 544 return res, ok 545 } 546 func (fpv *Notification_FieldTerminalPathValue) AsAlertsValue() ([]*alert.Name, bool) { 547 res, ok := fpv.value.([]*alert.Name) 548 return res, ok 549 } 550 func (fpv *Notification_FieldTerminalPathValue) AsAlertSetsValue() ([]*Notification_AlertsSet, bool) { 551 res, ok := fpv.value.([]*Notification_AlertsSet) 552 return res, ok 553 } 554 func (fpv *Notification_FieldTerminalPathValue) AsStateValue() (*Notification_State, bool) { 555 res, ok := fpv.value.(*Notification_State) 556 return res, ok 557 } 558 559 // SetTo stores value for selected field for object Notification 560 func (fpv *Notification_FieldTerminalPathValue) SetTo(target **Notification) { 561 if *target == nil { 562 *target = new(Notification) 563 } 564 switch fpv.selector { 565 case Notification_FieldPathSelectorName: 566 (*target).Name = fpv.value.(*Name) 567 case Notification_FieldPathSelectorMetadata: 568 (*target).Metadata = fpv.value.(*meta.Meta) 569 case Notification_FieldPathSelectorAlerts: 570 (*target).Alerts = fpv.value.([]*alert.Name) 571 case Notification_FieldPathSelectorAlertSets: 572 (*target).AlertSets = fpv.value.([]*Notification_AlertsSet) 573 case Notification_FieldPathSelectorState: 574 (*target).State = fpv.value.(*Notification_State) 575 default: 576 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpv.selector)) 577 } 578 } 579 580 func (fpv *Notification_FieldTerminalPathValue) SetToRaw(target proto.Message) { 581 typedObject := target.(*Notification) 582 fpv.SetTo(&typedObject) 583 } 584 585 // CompareWith compares value in the 'Notification_FieldTerminalPathValue' with the value under path in 'Notification'. 586 func (fpv *Notification_FieldTerminalPathValue) CompareWith(source *Notification) (int, bool) { 587 switch fpv.selector { 588 case Notification_FieldPathSelectorName: 589 leftValue := fpv.value.(*Name) 590 rightValue := source.GetName() 591 if leftValue == nil { 592 if rightValue != nil { 593 return -1, true 594 } 595 return 0, true 596 } 597 if rightValue == nil { 598 return 1, true 599 } 600 if leftValue.String() == rightValue.String() { 601 return 0, true 602 } else if leftValue.String() < rightValue.String() { 603 return -1, true 604 } else { 605 return 1, true 606 } 607 case Notification_FieldPathSelectorMetadata: 608 return 0, false 609 case Notification_FieldPathSelectorAlerts: 610 return 0, false 611 case Notification_FieldPathSelectorAlertSets: 612 return 0, false 613 case Notification_FieldPathSelectorState: 614 return 0, false 615 default: 616 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpv.selector)) 617 } 618 } 619 620 func (fpv *Notification_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 621 return fpv.CompareWith(source.(*Notification)) 622 } 623 624 type Notification_FieldSubPathValue struct { 625 Notification_FieldPath 626 subPathValue gotenobject.FieldPathValue 627 } 628 629 var _ Notification_FieldPathValue = (*Notification_FieldSubPathValue)(nil) 630 631 func (fpvs *Notification_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) { 632 res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue) 633 return res, ok 634 } 635 func (fpvs *Notification_FieldSubPathValue) AsAlertSetsPathValue() (NotificationAlertsSet_FieldPathValue, bool) { 636 res, ok := fpvs.subPathValue.(NotificationAlertsSet_FieldPathValue) 637 return res, ok 638 } 639 func (fpvs *Notification_FieldSubPathValue) AsStatePathValue() (NotificationState_FieldPathValue, bool) { 640 res, ok := fpvs.subPathValue.(NotificationState_FieldPathValue) 641 return res, ok 642 } 643 644 func (fpvs *Notification_FieldSubPathValue) SetTo(target **Notification) { 645 if *target == nil { 646 *target = new(Notification) 647 } 648 switch fpvs.Selector() { 649 case Notification_FieldPathSelectorMetadata: 650 fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata) 651 case Notification_FieldPathSelectorAlertSets: 652 panic("FieldPath setter is unsupported for array subpaths") 653 case Notification_FieldPathSelectorState: 654 fpvs.subPathValue.(NotificationState_FieldPathValue).SetTo(&(*target).State) 655 default: 656 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpvs.Selector())) 657 } 658 } 659 660 func (fpvs *Notification_FieldSubPathValue) SetToRaw(target proto.Message) { 661 typedObject := target.(*Notification) 662 fpvs.SetTo(&typedObject) 663 } 664 665 func (fpvs *Notification_FieldSubPathValue) GetRawValue() interface{} { 666 return fpvs.subPathValue.GetRawValue() 667 } 668 669 func (fpvs *Notification_FieldSubPathValue) CompareWith(source *Notification) (int, bool) { 670 switch fpvs.Selector() { 671 case Notification_FieldPathSelectorMetadata: 672 return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata()) 673 case Notification_FieldPathSelectorAlertSets: 674 return 0, false // repeated field 675 case Notification_FieldPathSelectorState: 676 return fpvs.subPathValue.(NotificationState_FieldPathValue).CompareWith(source.GetState()) 677 default: 678 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpvs.Selector())) 679 } 680 } 681 682 func (fpvs *Notification_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 683 return fpvs.CompareWith(source.(*Notification)) 684 } 685 686 // Notification_FieldPathArrayItemValue allows storing single item in Path-specific values for Notification according to their type 687 // Present only for array (repeated) types. 688 type Notification_FieldPathArrayItemValue interface { 689 gotenobject.FieldPathArrayItemValue 690 Notification_FieldPath 691 ContainsValue(*Notification) bool 692 } 693 694 // ParseNotification_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 695 func ParseNotification_FieldPathArrayItemValue(pathStr, valueStr string) (Notification_FieldPathArrayItemValue, error) { 696 fp, err := ParseNotification_FieldPath(pathStr) 697 if err != nil { 698 return nil, err 699 } 700 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 701 if err != nil { 702 return nil, status.Errorf(codes.InvalidArgument, "error parsing Notification field path array item value from %s: %v", valueStr, err) 703 } 704 return fpaiv.(Notification_FieldPathArrayItemValue), nil 705 } 706 707 func MustParseNotification_FieldPathArrayItemValue(pathStr, valueStr string) Notification_FieldPathArrayItemValue { 708 fpaiv, err := ParseNotification_FieldPathArrayItemValue(pathStr, valueStr) 709 if err != nil { 710 panic(err) 711 } 712 return fpaiv 713 } 714 715 type Notification_FieldTerminalPathArrayItemValue struct { 716 Notification_FieldTerminalPath 717 value interface{} 718 } 719 720 var _ Notification_FieldPathArrayItemValue = (*Notification_FieldTerminalPathArrayItemValue)(nil) 721 722 // GetRawValue returns stored element value for array in object Notification as interface{} 723 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 724 return fpaiv.value 725 } 726 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) AsAlertsItemValue() (*alert.Name, bool) { 727 res, ok := fpaiv.value.(*alert.Name) 728 return res, ok 729 } 730 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) AsAlertSetsItemValue() (*Notification_AlertsSet, bool) { 731 res, ok := fpaiv.value.(*Notification_AlertsSet) 732 return res, ok 733 } 734 735 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) GetSingle(source *Notification) (interface{}, bool) { 736 return nil, false 737 } 738 739 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 740 return fpaiv.GetSingle(source.(*Notification)) 741 } 742 743 // Contains returns a boolean indicating if value that is being held is present in given 'Notification' 744 func (fpaiv *Notification_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification) bool { 745 slice := fpaiv.Notification_FieldTerminalPath.Get(source) 746 for _, v := range slice { 747 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 748 if proto.Equal(asProtoMsg, v.(proto.Message)) { 749 return true 750 } 751 } else if reflect.DeepEqual(v, fpaiv.value) { 752 return true 753 } 754 } 755 return false 756 } 757 758 type Notification_FieldSubPathArrayItemValue struct { 759 Notification_FieldPath 760 subPathItemValue gotenobject.FieldPathArrayItemValue 761 } 762 763 // GetRawValue returns stored array item value 764 func (fpaivs *Notification_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 765 return fpaivs.subPathItemValue.GetRawItemValue() 766 } 767 func (fpaivs *Notification_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) { 768 res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue) 769 return res, ok 770 } 771 func (fpaivs *Notification_FieldSubPathArrayItemValue) AsAlertSetsPathItemValue() (NotificationAlertsSet_FieldPathArrayItemValue, bool) { 772 res, ok := fpaivs.subPathItemValue.(NotificationAlertsSet_FieldPathArrayItemValue) 773 return res, ok 774 } 775 func (fpaivs *Notification_FieldSubPathArrayItemValue) AsStatePathItemValue() (NotificationState_FieldPathArrayItemValue, bool) { 776 res, ok := fpaivs.subPathItemValue.(NotificationState_FieldPathArrayItemValue) 777 return res, ok 778 } 779 780 // Contains returns a boolean indicating if value that is being held is present in given 'Notification' 781 func (fpaivs *Notification_FieldSubPathArrayItemValue) ContainsValue(source *Notification) bool { 782 switch fpaivs.Selector() { 783 case Notification_FieldPathSelectorMetadata: 784 return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata()) 785 case Notification_FieldPathSelectorAlertSets: 786 return false // repeated/map field 787 case Notification_FieldPathSelectorState: 788 return fpaivs.subPathItemValue.(NotificationState_FieldPathArrayItemValue).ContainsValue(source.GetState()) 789 default: 790 panic(fmt.Sprintf("Invalid selector for Notification: %d", fpaivs.Selector())) 791 } 792 } 793 794 // Notification_FieldPathArrayOfValues allows storing slice of values for Notification fields according to their type 795 type Notification_FieldPathArrayOfValues interface { 796 gotenobject.FieldPathArrayOfValues 797 Notification_FieldPath 798 } 799 800 func ParseNotification_FieldPathArrayOfValues(pathStr, valuesStr string) (Notification_FieldPathArrayOfValues, error) { 801 fp, err := ParseNotification_FieldPath(pathStr) 802 if err != nil { 803 return nil, err 804 } 805 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 806 if err != nil { 807 return nil, status.Errorf(codes.InvalidArgument, "error parsing Notification field path array of values from %s: %v", valuesStr, err) 808 } 809 return fpaov.(Notification_FieldPathArrayOfValues), nil 810 } 811 812 func MustParseNotification_FieldPathArrayOfValues(pathStr, valuesStr string) Notification_FieldPathArrayOfValues { 813 fpaov, err := ParseNotification_FieldPathArrayOfValues(pathStr, valuesStr) 814 if err != nil { 815 panic(err) 816 } 817 return fpaov 818 } 819 820 type Notification_FieldTerminalPathArrayOfValues struct { 821 Notification_FieldTerminalPath 822 values interface{} 823 } 824 825 var _ Notification_FieldPathArrayOfValues = (*Notification_FieldTerminalPathArrayOfValues)(nil) 826 827 func (fpaov *Notification_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 828 switch fpaov.selector { 829 case Notification_FieldPathSelectorName: 830 for _, v := range fpaov.values.([]*Name) { 831 values = append(values, v) 832 } 833 case Notification_FieldPathSelectorMetadata: 834 for _, v := range fpaov.values.([]*meta.Meta) { 835 values = append(values, v) 836 } 837 case Notification_FieldPathSelectorAlerts: 838 for _, v := range fpaov.values.([][]*alert.Name) { 839 values = append(values, v) 840 } 841 case Notification_FieldPathSelectorAlertSets: 842 for _, v := range fpaov.values.([][]*Notification_AlertsSet) { 843 values = append(values, v) 844 } 845 case Notification_FieldPathSelectorState: 846 for _, v := range fpaov.values.([]*Notification_State) { 847 values = append(values, v) 848 } 849 } 850 return 851 } 852 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) { 853 res, ok := fpaov.values.([]*Name) 854 return res, ok 855 } 856 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) { 857 res, ok := fpaov.values.([]*meta.Meta) 858 return res, ok 859 } 860 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsAlertsArrayOfValues() ([][]*alert.Name, bool) { 861 res, ok := fpaov.values.([][]*alert.Name) 862 return res, ok 863 } 864 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsAlertSetsArrayOfValues() ([][]*Notification_AlertsSet, bool) { 865 res, ok := fpaov.values.([][]*Notification_AlertsSet) 866 return res, ok 867 } 868 func (fpaov *Notification_FieldTerminalPathArrayOfValues) AsStateArrayOfValues() ([]*Notification_State, bool) { 869 res, ok := fpaov.values.([]*Notification_State) 870 return res, ok 871 } 872 873 type Notification_FieldSubPathArrayOfValues struct { 874 Notification_FieldPath 875 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 876 } 877 878 var _ Notification_FieldPathArrayOfValues = (*Notification_FieldSubPathArrayOfValues)(nil) 879 880 func (fpsaov *Notification_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 881 return fpsaov.subPathArrayOfValues.GetRawValues() 882 } 883 func (fpsaov *Notification_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) { 884 res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues) 885 return res, ok 886 } 887 func (fpsaov *Notification_FieldSubPathArrayOfValues) AsAlertSetsPathArrayOfValues() (NotificationAlertsSet_FieldPathArrayOfValues, bool) { 888 res, ok := fpsaov.subPathArrayOfValues.(NotificationAlertsSet_FieldPathArrayOfValues) 889 return res, ok 890 } 891 func (fpsaov *Notification_FieldSubPathArrayOfValues) AsStatePathArrayOfValues() (NotificationState_FieldPathArrayOfValues, bool) { 892 res, ok := fpsaov.subPathArrayOfValues.(NotificationState_FieldPathArrayOfValues) 893 return res, ok 894 } 895 896 // FieldPath provides implementation to handle 897 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 898 type NotificationAlertsSet_FieldPath interface { 899 gotenobject.FieldPath 900 Selector() NotificationAlertsSet_FieldPathSelector 901 Get(source *Notification_AlertsSet) []interface{} 902 GetSingle(source *Notification_AlertsSet) (interface{}, bool) 903 ClearValue(item *Notification_AlertsSet) 904 905 // Those methods build corresponding NotificationAlertsSet_FieldPathValue 906 // (or array of values) and holds passed value. Panics if injected type is incorrect. 907 WithIValue(value interface{}) NotificationAlertsSet_FieldPathValue 908 WithIArrayOfValues(values interface{}) NotificationAlertsSet_FieldPathArrayOfValues 909 WithIArrayItemValue(value interface{}) NotificationAlertsSet_FieldPathArrayItemValue 910 } 911 912 type NotificationAlertsSet_FieldPathSelector int32 913 914 const ( 915 NotificationAlertsSet_FieldPathSelectorCondition NotificationAlertsSet_FieldPathSelector = 0 916 NotificationAlertsSet_FieldPathSelectorIds NotificationAlertsSet_FieldPathSelector = 1 917 ) 918 919 func (s NotificationAlertsSet_FieldPathSelector) String() string { 920 switch s { 921 case NotificationAlertsSet_FieldPathSelectorCondition: 922 return "condition" 923 case NotificationAlertsSet_FieldPathSelectorIds: 924 return "ids" 925 default: 926 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", s)) 927 } 928 } 929 930 func BuildNotificationAlertsSet_FieldPath(fp gotenobject.RawFieldPath) (NotificationAlertsSet_FieldPath, error) { 931 if len(fp) == 0 { 932 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_AlertsSet") 933 } 934 if len(fp) == 1 { 935 switch fp[0] { 936 case "condition": 937 return &NotificationAlertsSet_FieldTerminalPath{selector: NotificationAlertsSet_FieldPathSelectorCondition}, nil 938 case "ids": 939 return &NotificationAlertsSet_FieldTerminalPath{selector: NotificationAlertsSet_FieldPathSelectorIds}, nil 940 } 941 } 942 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_AlertsSet", fp) 943 } 944 945 func ParseNotificationAlertsSet_FieldPath(rawField string) (NotificationAlertsSet_FieldPath, error) { 946 fp, err := gotenobject.ParseRawFieldPath(rawField) 947 if err != nil { 948 return nil, err 949 } 950 return BuildNotificationAlertsSet_FieldPath(fp) 951 } 952 953 func MustParseNotificationAlertsSet_FieldPath(rawField string) NotificationAlertsSet_FieldPath { 954 fp, err := ParseNotificationAlertsSet_FieldPath(rawField) 955 if err != nil { 956 panic(err) 957 } 958 return fp 959 } 960 961 type NotificationAlertsSet_FieldTerminalPath struct { 962 selector NotificationAlertsSet_FieldPathSelector 963 } 964 965 var _ NotificationAlertsSet_FieldPath = (*NotificationAlertsSet_FieldTerminalPath)(nil) 966 967 func (fp *NotificationAlertsSet_FieldTerminalPath) Selector() NotificationAlertsSet_FieldPathSelector { 968 return fp.selector 969 } 970 971 // String returns path representation in proto convention 972 func (fp *NotificationAlertsSet_FieldTerminalPath) String() string { 973 return fp.selector.String() 974 } 975 976 // JSONString returns path representation is JSON convention 977 func (fp *NotificationAlertsSet_FieldTerminalPath) JSONString() string { 978 return strcase.ToLowerCamel(fp.String()) 979 } 980 981 // Get returns all values pointed by specific field from source Notification_AlertsSet 982 func (fp *NotificationAlertsSet_FieldTerminalPath) Get(source *Notification_AlertsSet) (values []interface{}) { 983 if source != nil { 984 switch fp.selector { 985 case NotificationAlertsSet_FieldPathSelectorCondition: 986 if source.Condition != nil { 987 values = append(values, source.Condition) 988 } 989 case NotificationAlertsSet_FieldPathSelectorIds: 990 for _, value := range source.GetIds() { 991 values = append(values, value) 992 } 993 default: 994 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fp.selector)) 995 } 996 } 997 return 998 } 999 1000 func (fp *NotificationAlertsSet_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1001 return fp.Get(source.(*Notification_AlertsSet)) 1002 } 1003 1004 // GetSingle returns value pointed by specific field of from source Notification_AlertsSet 1005 func (fp *NotificationAlertsSet_FieldTerminalPath) GetSingle(source *Notification_AlertsSet) (interface{}, bool) { 1006 switch fp.selector { 1007 case NotificationAlertsSet_FieldPathSelectorCondition: 1008 res := source.GetCondition() 1009 return res, res != nil 1010 case NotificationAlertsSet_FieldPathSelectorIds: 1011 res := source.GetIds() 1012 return res, res != nil 1013 default: 1014 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fp.selector)) 1015 } 1016 } 1017 1018 func (fp *NotificationAlertsSet_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1019 return fp.GetSingle(source.(*Notification_AlertsSet)) 1020 } 1021 1022 // GetDefault returns a default value of the field type 1023 func (fp *NotificationAlertsSet_FieldTerminalPath) GetDefault() interface{} { 1024 switch fp.selector { 1025 case NotificationAlertsSet_FieldPathSelectorCondition: 1026 return (*alerting_condition.Name)(nil) 1027 case NotificationAlertsSet_FieldPathSelectorIds: 1028 return ([]string)(nil) 1029 default: 1030 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fp.selector)) 1031 } 1032 } 1033 1034 func (fp *NotificationAlertsSet_FieldTerminalPath) ClearValue(item *Notification_AlertsSet) { 1035 if item != nil { 1036 switch fp.selector { 1037 case NotificationAlertsSet_FieldPathSelectorCondition: 1038 item.Condition = nil 1039 case NotificationAlertsSet_FieldPathSelectorIds: 1040 item.Ids = nil 1041 default: 1042 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fp.selector)) 1043 } 1044 } 1045 } 1046 1047 func (fp *NotificationAlertsSet_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1048 fp.ClearValue(item.(*Notification_AlertsSet)) 1049 } 1050 1051 // IsLeaf - whether field path is holds simple value 1052 func (fp *NotificationAlertsSet_FieldTerminalPath) IsLeaf() bool { 1053 return fp.selector == NotificationAlertsSet_FieldPathSelectorCondition || 1054 fp.selector == NotificationAlertsSet_FieldPathSelectorIds 1055 } 1056 1057 func (fp *NotificationAlertsSet_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1058 return []gotenobject.FieldPath{fp} 1059 } 1060 1061 func (fp *NotificationAlertsSet_FieldTerminalPath) WithIValue(value interface{}) NotificationAlertsSet_FieldPathValue { 1062 switch fp.selector { 1063 case NotificationAlertsSet_FieldPathSelectorCondition: 1064 return &NotificationAlertsSet_FieldTerminalPathValue{NotificationAlertsSet_FieldTerminalPath: *fp, value: value.(*alerting_condition.Name)} 1065 case NotificationAlertsSet_FieldPathSelectorIds: 1066 return &NotificationAlertsSet_FieldTerminalPathValue{NotificationAlertsSet_FieldTerminalPath: *fp, value: value.([]string)} 1067 default: 1068 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fp.selector)) 1069 } 1070 } 1071 1072 func (fp *NotificationAlertsSet_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1073 return fp.WithIValue(value) 1074 } 1075 1076 func (fp *NotificationAlertsSet_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationAlertsSet_FieldPathArrayOfValues { 1077 fpaov := &NotificationAlertsSet_FieldTerminalPathArrayOfValues{NotificationAlertsSet_FieldTerminalPath: *fp} 1078 switch fp.selector { 1079 case NotificationAlertsSet_FieldPathSelectorCondition: 1080 return &NotificationAlertsSet_FieldTerminalPathArrayOfValues{NotificationAlertsSet_FieldTerminalPath: *fp, values: values.([]*alerting_condition.Name)} 1081 case NotificationAlertsSet_FieldPathSelectorIds: 1082 return &NotificationAlertsSet_FieldTerminalPathArrayOfValues{NotificationAlertsSet_FieldTerminalPath: *fp, values: values.([][]string)} 1083 default: 1084 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fp.selector)) 1085 } 1086 return fpaov 1087 } 1088 1089 func (fp *NotificationAlertsSet_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1090 return fp.WithIArrayOfValues(values) 1091 } 1092 1093 func (fp *NotificationAlertsSet_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationAlertsSet_FieldPathArrayItemValue { 1094 switch fp.selector { 1095 case NotificationAlertsSet_FieldPathSelectorIds: 1096 return &NotificationAlertsSet_FieldTerminalPathArrayItemValue{NotificationAlertsSet_FieldTerminalPath: *fp, value: value.(string)} 1097 default: 1098 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fp.selector)) 1099 } 1100 } 1101 1102 func (fp *NotificationAlertsSet_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1103 return fp.WithIArrayItemValue(value) 1104 } 1105 1106 // NotificationAlertsSet_FieldPathValue allows storing values for AlertsSet fields according to their type 1107 type NotificationAlertsSet_FieldPathValue interface { 1108 NotificationAlertsSet_FieldPath 1109 gotenobject.FieldPathValue 1110 SetTo(target **Notification_AlertsSet) 1111 CompareWith(*Notification_AlertsSet) (cmp int, comparable bool) 1112 } 1113 1114 func ParseNotificationAlertsSet_FieldPathValue(pathStr, valueStr string) (NotificationAlertsSet_FieldPathValue, error) { 1115 fp, err := ParseNotificationAlertsSet_FieldPath(pathStr) 1116 if err != nil { 1117 return nil, err 1118 } 1119 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1120 if err != nil { 1121 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertsSet field path value from %s: %v", valueStr, err) 1122 } 1123 return fpv.(NotificationAlertsSet_FieldPathValue), nil 1124 } 1125 1126 func MustParseNotificationAlertsSet_FieldPathValue(pathStr, valueStr string) NotificationAlertsSet_FieldPathValue { 1127 fpv, err := ParseNotificationAlertsSet_FieldPathValue(pathStr, valueStr) 1128 if err != nil { 1129 panic(err) 1130 } 1131 return fpv 1132 } 1133 1134 type NotificationAlertsSet_FieldTerminalPathValue struct { 1135 NotificationAlertsSet_FieldTerminalPath 1136 value interface{} 1137 } 1138 1139 var _ NotificationAlertsSet_FieldPathValue = (*NotificationAlertsSet_FieldTerminalPathValue)(nil) 1140 1141 // GetRawValue returns raw value stored under selected path for 'AlertsSet' as interface{} 1142 func (fpv *NotificationAlertsSet_FieldTerminalPathValue) GetRawValue() interface{} { 1143 return fpv.value 1144 } 1145 func (fpv *NotificationAlertsSet_FieldTerminalPathValue) AsConditionValue() (*alerting_condition.Name, bool) { 1146 res, ok := fpv.value.(*alerting_condition.Name) 1147 return res, ok 1148 } 1149 func (fpv *NotificationAlertsSet_FieldTerminalPathValue) AsIdsValue() ([]string, bool) { 1150 res, ok := fpv.value.([]string) 1151 return res, ok 1152 } 1153 1154 // SetTo stores value for selected field for object AlertsSet 1155 func (fpv *NotificationAlertsSet_FieldTerminalPathValue) SetTo(target **Notification_AlertsSet) { 1156 if *target == nil { 1157 *target = new(Notification_AlertsSet) 1158 } 1159 switch fpv.selector { 1160 case NotificationAlertsSet_FieldPathSelectorCondition: 1161 (*target).Condition = fpv.value.(*alerting_condition.Name) 1162 case NotificationAlertsSet_FieldPathSelectorIds: 1163 (*target).Ids = fpv.value.([]string) 1164 default: 1165 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fpv.selector)) 1166 } 1167 } 1168 1169 func (fpv *NotificationAlertsSet_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1170 typedObject := target.(*Notification_AlertsSet) 1171 fpv.SetTo(&typedObject) 1172 } 1173 1174 // CompareWith compares value in the 'NotificationAlertsSet_FieldTerminalPathValue' with the value under path in 'Notification_AlertsSet'. 1175 func (fpv *NotificationAlertsSet_FieldTerminalPathValue) CompareWith(source *Notification_AlertsSet) (int, bool) { 1176 switch fpv.selector { 1177 case NotificationAlertsSet_FieldPathSelectorCondition: 1178 leftValue := fpv.value.(*alerting_condition.Name) 1179 rightValue := source.GetCondition() 1180 if leftValue == nil { 1181 if rightValue != nil { 1182 return -1, true 1183 } 1184 return 0, true 1185 } 1186 if rightValue == nil { 1187 return 1, true 1188 } 1189 if leftValue.String() == rightValue.String() { 1190 return 0, true 1191 } else if leftValue.String() < rightValue.String() { 1192 return -1, true 1193 } else { 1194 return 1, true 1195 } 1196 case NotificationAlertsSet_FieldPathSelectorIds: 1197 return 0, false 1198 default: 1199 panic(fmt.Sprintf("Invalid selector for Notification_AlertsSet: %d", fpv.selector)) 1200 } 1201 } 1202 1203 func (fpv *NotificationAlertsSet_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1204 return fpv.CompareWith(source.(*Notification_AlertsSet)) 1205 } 1206 1207 // NotificationAlertsSet_FieldPathArrayItemValue allows storing single item in Path-specific values for AlertsSet according to their type 1208 // Present only for array (repeated) types. 1209 type NotificationAlertsSet_FieldPathArrayItemValue interface { 1210 gotenobject.FieldPathArrayItemValue 1211 NotificationAlertsSet_FieldPath 1212 ContainsValue(*Notification_AlertsSet) bool 1213 } 1214 1215 // ParseNotificationAlertsSet_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1216 func ParseNotificationAlertsSet_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationAlertsSet_FieldPathArrayItemValue, error) { 1217 fp, err := ParseNotificationAlertsSet_FieldPath(pathStr) 1218 if err != nil { 1219 return nil, err 1220 } 1221 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1222 if err != nil { 1223 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertsSet field path array item value from %s: %v", valueStr, err) 1224 } 1225 return fpaiv.(NotificationAlertsSet_FieldPathArrayItemValue), nil 1226 } 1227 1228 func MustParseNotificationAlertsSet_FieldPathArrayItemValue(pathStr, valueStr string) NotificationAlertsSet_FieldPathArrayItemValue { 1229 fpaiv, err := ParseNotificationAlertsSet_FieldPathArrayItemValue(pathStr, valueStr) 1230 if err != nil { 1231 panic(err) 1232 } 1233 return fpaiv 1234 } 1235 1236 type NotificationAlertsSet_FieldTerminalPathArrayItemValue struct { 1237 NotificationAlertsSet_FieldTerminalPath 1238 value interface{} 1239 } 1240 1241 var _ NotificationAlertsSet_FieldPathArrayItemValue = (*NotificationAlertsSet_FieldTerminalPathArrayItemValue)(nil) 1242 1243 // GetRawValue returns stored element value for array in object Notification_AlertsSet as interface{} 1244 func (fpaiv *NotificationAlertsSet_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1245 return fpaiv.value 1246 } 1247 func (fpaiv *NotificationAlertsSet_FieldTerminalPathArrayItemValue) AsIdsItemValue() (string, bool) { 1248 res, ok := fpaiv.value.(string) 1249 return res, ok 1250 } 1251 1252 func (fpaiv *NotificationAlertsSet_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_AlertsSet) (interface{}, bool) { 1253 return nil, false 1254 } 1255 1256 func (fpaiv *NotificationAlertsSet_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1257 return fpaiv.GetSingle(source.(*Notification_AlertsSet)) 1258 } 1259 1260 // Contains returns a boolean indicating if value that is being held is present in given 'AlertsSet' 1261 func (fpaiv *NotificationAlertsSet_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_AlertsSet) bool { 1262 slice := fpaiv.NotificationAlertsSet_FieldTerminalPath.Get(source) 1263 for _, v := range slice { 1264 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1265 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1266 return true 1267 } 1268 } else if reflect.DeepEqual(v, fpaiv.value) { 1269 return true 1270 } 1271 } 1272 return false 1273 } 1274 1275 // NotificationAlertsSet_FieldPathArrayOfValues allows storing slice of values for AlertsSet fields according to their type 1276 type NotificationAlertsSet_FieldPathArrayOfValues interface { 1277 gotenobject.FieldPathArrayOfValues 1278 NotificationAlertsSet_FieldPath 1279 } 1280 1281 func ParseNotificationAlertsSet_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationAlertsSet_FieldPathArrayOfValues, error) { 1282 fp, err := ParseNotificationAlertsSet_FieldPath(pathStr) 1283 if err != nil { 1284 return nil, err 1285 } 1286 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1287 if err != nil { 1288 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertsSet field path array of values from %s: %v", valuesStr, err) 1289 } 1290 return fpaov.(NotificationAlertsSet_FieldPathArrayOfValues), nil 1291 } 1292 1293 func MustParseNotificationAlertsSet_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationAlertsSet_FieldPathArrayOfValues { 1294 fpaov, err := ParseNotificationAlertsSet_FieldPathArrayOfValues(pathStr, valuesStr) 1295 if err != nil { 1296 panic(err) 1297 } 1298 return fpaov 1299 } 1300 1301 type NotificationAlertsSet_FieldTerminalPathArrayOfValues struct { 1302 NotificationAlertsSet_FieldTerminalPath 1303 values interface{} 1304 } 1305 1306 var _ NotificationAlertsSet_FieldPathArrayOfValues = (*NotificationAlertsSet_FieldTerminalPathArrayOfValues)(nil) 1307 1308 func (fpaov *NotificationAlertsSet_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1309 switch fpaov.selector { 1310 case NotificationAlertsSet_FieldPathSelectorCondition: 1311 for _, v := range fpaov.values.([]*alerting_condition.Name) { 1312 values = append(values, v) 1313 } 1314 case NotificationAlertsSet_FieldPathSelectorIds: 1315 for _, v := range fpaov.values.([][]string) { 1316 values = append(values, v) 1317 } 1318 } 1319 return 1320 } 1321 func (fpaov *NotificationAlertsSet_FieldTerminalPathArrayOfValues) AsConditionArrayOfValues() ([]*alerting_condition.Name, bool) { 1322 res, ok := fpaov.values.([]*alerting_condition.Name) 1323 return res, ok 1324 } 1325 func (fpaov *NotificationAlertsSet_FieldTerminalPathArrayOfValues) AsIdsArrayOfValues() ([][]string, bool) { 1326 res, ok := fpaov.values.([][]string) 1327 return res, ok 1328 } 1329 1330 // FieldPath provides implementation to handle 1331 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1332 type NotificationState_FieldPath interface { 1333 gotenobject.FieldPath 1334 Selector() NotificationState_FieldPathSelector 1335 Get(source *Notification_State) []interface{} 1336 GetSingle(source *Notification_State) (interface{}, bool) 1337 ClearValue(item *Notification_State) 1338 1339 // Those methods build corresponding NotificationState_FieldPathValue 1340 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1341 WithIValue(value interface{}) NotificationState_FieldPathValue 1342 WithIArrayOfValues(values interface{}) NotificationState_FieldPathArrayOfValues 1343 WithIArrayItemValue(value interface{}) NotificationState_FieldPathArrayItemValue 1344 } 1345 1346 type NotificationState_FieldPathSelector int32 1347 1348 const ( 1349 NotificationState_FieldPathSelectorIsResolved NotificationState_FieldPathSelector = 0 1350 NotificationState_FieldPathSelectorNotificationState NotificationState_FieldPathSelector = 1 1351 NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone NotificationState_FieldPathSelector = 2 1352 NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone NotificationState_FieldPathSelector = 3 1353 NotificationState_FieldPathSelectorAlertsLifetime NotificationState_FieldPathSelector = 4 1354 NotificationState_FieldPathSelectorResolutionNotificationState NotificationState_FieldPathSelector = 5 1355 NotificationState_FieldPathSelectorLifecycleCompleted NotificationState_FieldPathSelector = 6 1356 ) 1357 1358 func (s NotificationState_FieldPathSelector) String() string { 1359 switch s { 1360 case NotificationState_FieldPathSelectorIsResolved: 1361 return "is_resolved" 1362 case NotificationState_FieldPathSelectorNotificationState: 1363 return "notification_state" 1364 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1365 return "incident_notify_attempts_done" 1366 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1367 return "resolution_notify_attempts_done" 1368 case NotificationState_FieldPathSelectorAlertsLifetime: 1369 return "alerts_lifetime" 1370 case NotificationState_FieldPathSelectorResolutionNotificationState: 1371 return "resolution_notification_state" 1372 case NotificationState_FieldPathSelectorLifecycleCompleted: 1373 return "lifecycle_completed" 1374 default: 1375 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", s)) 1376 } 1377 } 1378 1379 func BuildNotificationState_FieldPath(fp gotenobject.RawFieldPath) (NotificationState_FieldPath, error) { 1380 if len(fp) == 0 { 1381 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State") 1382 } 1383 if len(fp) == 1 { 1384 switch fp[0] { 1385 case "is_resolved", "isResolved", "is-resolved": 1386 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorIsResolved}, nil 1387 case "notification_state", "notificationState", "notification-state": 1388 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorNotificationState}, nil 1389 case "incident_notify_attempts_done", "incidentNotifyAttemptsDone", "incident-notify-attempts-done": 1390 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone}, nil 1391 case "resolution_notify_attempts_done", "resolutionNotifyAttemptsDone", "resolution-notify-attempts-done": 1392 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone}, nil 1393 case "alerts_lifetime", "alertsLifetime", "alerts-lifetime": 1394 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorAlertsLifetime}, nil 1395 case "resolution_notification_state", "resolutionNotificationState", "resolution-notification-state": 1396 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorResolutionNotificationState}, nil 1397 case "lifecycle_completed", "lifecycleCompleted", "lifecycle-completed": 1398 return &NotificationState_FieldTerminalPath{selector: NotificationState_FieldPathSelectorLifecycleCompleted}, nil 1399 } 1400 } else { 1401 switch fp[0] { 1402 case "notification_state", "notificationState", "notification-state": 1403 if subpath, err := BuildNotificationStateNotificationState_FieldPath(fp[1:]); err != nil { 1404 return nil, err 1405 } else { 1406 return &NotificationState_FieldSubPath{selector: NotificationState_FieldPathSelectorNotificationState, subPath: subpath}, nil 1407 } 1408 case "alerts_lifetime", "alertsLifetime", "alerts-lifetime": 1409 if subpath, err := common.BuildTimeRange_FieldPath(fp[1:]); err != nil { 1410 return nil, err 1411 } else { 1412 return &NotificationState_FieldSubPath{selector: NotificationState_FieldPathSelectorAlertsLifetime, subPath: subpath}, nil 1413 } 1414 case "resolution_notification_state", "resolutionNotificationState", "resolution-notification-state": 1415 if subpath, err := BuildNotificationStateNotificationState_FieldPath(fp[1:]); err != nil { 1416 return nil, err 1417 } else { 1418 return &NotificationState_FieldSubPath{selector: NotificationState_FieldPathSelectorResolutionNotificationState, subPath: subpath}, nil 1419 } 1420 } 1421 } 1422 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State", fp) 1423 } 1424 1425 func ParseNotificationState_FieldPath(rawField string) (NotificationState_FieldPath, error) { 1426 fp, err := gotenobject.ParseRawFieldPath(rawField) 1427 if err != nil { 1428 return nil, err 1429 } 1430 return BuildNotificationState_FieldPath(fp) 1431 } 1432 1433 func MustParseNotificationState_FieldPath(rawField string) NotificationState_FieldPath { 1434 fp, err := ParseNotificationState_FieldPath(rawField) 1435 if err != nil { 1436 panic(err) 1437 } 1438 return fp 1439 } 1440 1441 type NotificationState_FieldTerminalPath struct { 1442 selector NotificationState_FieldPathSelector 1443 } 1444 1445 var _ NotificationState_FieldPath = (*NotificationState_FieldTerminalPath)(nil) 1446 1447 func (fp *NotificationState_FieldTerminalPath) Selector() NotificationState_FieldPathSelector { 1448 return fp.selector 1449 } 1450 1451 // String returns path representation in proto convention 1452 func (fp *NotificationState_FieldTerminalPath) String() string { 1453 return fp.selector.String() 1454 } 1455 1456 // JSONString returns path representation is JSON convention 1457 func (fp *NotificationState_FieldTerminalPath) JSONString() string { 1458 return strcase.ToLowerCamel(fp.String()) 1459 } 1460 1461 // Get returns all values pointed by specific field from source Notification_State 1462 func (fp *NotificationState_FieldTerminalPath) Get(source *Notification_State) (values []interface{}) { 1463 if source != nil { 1464 switch fp.selector { 1465 case NotificationState_FieldPathSelectorIsResolved: 1466 values = append(values, source.IsResolved) 1467 case NotificationState_FieldPathSelectorNotificationState: 1468 for _, value := range source.GetNotificationState() { 1469 values = append(values, value) 1470 } 1471 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1472 values = append(values, source.IncidentNotifyAttemptsDone) 1473 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1474 values = append(values, source.ResolutionNotifyAttemptsDone) 1475 case NotificationState_FieldPathSelectorAlertsLifetime: 1476 if source.AlertsLifetime != nil { 1477 values = append(values, source.AlertsLifetime) 1478 } 1479 case NotificationState_FieldPathSelectorResolutionNotificationState: 1480 for _, value := range source.GetResolutionNotificationState() { 1481 values = append(values, value) 1482 } 1483 case NotificationState_FieldPathSelectorLifecycleCompleted: 1484 values = append(values, source.LifecycleCompleted) 1485 default: 1486 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1487 } 1488 } 1489 return 1490 } 1491 1492 func (fp *NotificationState_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1493 return fp.Get(source.(*Notification_State)) 1494 } 1495 1496 // GetSingle returns value pointed by specific field of from source Notification_State 1497 func (fp *NotificationState_FieldTerminalPath) GetSingle(source *Notification_State) (interface{}, bool) { 1498 switch fp.selector { 1499 case NotificationState_FieldPathSelectorIsResolved: 1500 return source.GetIsResolved(), source != nil 1501 case NotificationState_FieldPathSelectorNotificationState: 1502 res := source.GetNotificationState() 1503 return res, res != nil 1504 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1505 return source.GetIncidentNotifyAttemptsDone(), source != nil 1506 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1507 return source.GetResolutionNotifyAttemptsDone(), source != nil 1508 case NotificationState_FieldPathSelectorAlertsLifetime: 1509 res := source.GetAlertsLifetime() 1510 return res, res != nil 1511 case NotificationState_FieldPathSelectorResolutionNotificationState: 1512 res := source.GetResolutionNotificationState() 1513 return res, res != nil 1514 case NotificationState_FieldPathSelectorLifecycleCompleted: 1515 return source.GetLifecycleCompleted(), source != nil 1516 default: 1517 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1518 } 1519 } 1520 1521 func (fp *NotificationState_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1522 return fp.GetSingle(source.(*Notification_State)) 1523 } 1524 1525 // GetDefault returns a default value of the field type 1526 func (fp *NotificationState_FieldTerminalPath) GetDefault() interface{} { 1527 switch fp.selector { 1528 case NotificationState_FieldPathSelectorIsResolved: 1529 return false 1530 case NotificationState_FieldPathSelectorNotificationState: 1531 return ([]*Notification_State_NotificationState)(nil) 1532 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1533 return false 1534 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1535 return false 1536 case NotificationState_FieldPathSelectorAlertsLifetime: 1537 return (*common.TimeRange)(nil) 1538 case NotificationState_FieldPathSelectorResolutionNotificationState: 1539 return ([]*Notification_State_NotificationState)(nil) 1540 case NotificationState_FieldPathSelectorLifecycleCompleted: 1541 return false 1542 default: 1543 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1544 } 1545 } 1546 1547 func (fp *NotificationState_FieldTerminalPath) ClearValue(item *Notification_State) { 1548 if item != nil { 1549 switch fp.selector { 1550 case NotificationState_FieldPathSelectorIsResolved: 1551 item.IsResolved = false 1552 case NotificationState_FieldPathSelectorNotificationState: 1553 item.NotificationState = nil 1554 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1555 item.IncidentNotifyAttemptsDone = false 1556 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1557 item.ResolutionNotifyAttemptsDone = false 1558 case NotificationState_FieldPathSelectorAlertsLifetime: 1559 item.AlertsLifetime = nil 1560 case NotificationState_FieldPathSelectorResolutionNotificationState: 1561 item.ResolutionNotificationState = nil 1562 case NotificationState_FieldPathSelectorLifecycleCompleted: 1563 item.LifecycleCompleted = false 1564 default: 1565 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1566 } 1567 } 1568 } 1569 1570 func (fp *NotificationState_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1571 fp.ClearValue(item.(*Notification_State)) 1572 } 1573 1574 // IsLeaf - whether field path is holds simple value 1575 func (fp *NotificationState_FieldTerminalPath) IsLeaf() bool { 1576 return fp.selector == NotificationState_FieldPathSelectorIsResolved || 1577 fp.selector == NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone || 1578 fp.selector == NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone || 1579 fp.selector == NotificationState_FieldPathSelectorLifecycleCompleted 1580 } 1581 1582 func (fp *NotificationState_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1583 return []gotenobject.FieldPath{fp} 1584 } 1585 1586 func (fp *NotificationState_FieldTerminalPath) WithIValue(value interface{}) NotificationState_FieldPathValue { 1587 switch fp.selector { 1588 case NotificationState_FieldPathSelectorIsResolved: 1589 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1590 case NotificationState_FieldPathSelectorNotificationState: 1591 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.([]*Notification_State_NotificationState)} 1592 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1593 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1594 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1595 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1596 case NotificationState_FieldPathSelectorAlertsLifetime: 1597 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(*common.TimeRange)} 1598 case NotificationState_FieldPathSelectorResolutionNotificationState: 1599 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.([]*Notification_State_NotificationState)} 1600 case NotificationState_FieldPathSelectorLifecycleCompleted: 1601 return &NotificationState_FieldTerminalPathValue{NotificationState_FieldTerminalPath: *fp, value: value.(bool)} 1602 default: 1603 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1604 } 1605 } 1606 1607 func (fp *NotificationState_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1608 return fp.WithIValue(value) 1609 } 1610 1611 func (fp *NotificationState_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationState_FieldPathArrayOfValues { 1612 fpaov := &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp} 1613 switch fp.selector { 1614 case NotificationState_FieldPathSelectorIsResolved: 1615 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1616 case NotificationState_FieldPathSelectorNotificationState: 1617 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([][]*Notification_State_NotificationState)} 1618 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1619 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1620 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1621 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1622 case NotificationState_FieldPathSelectorAlertsLifetime: 1623 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]*common.TimeRange)} 1624 case NotificationState_FieldPathSelectorResolutionNotificationState: 1625 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([][]*Notification_State_NotificationState)} 1626 case NotificationState_FieldPathSelectorLifecycleCompleted: 1627 return &NotificationState_FieldTerminalPathArrayOfValues{NotificationState_FieldTerminalPath: *fp, values: values.([]bool)} 1628 default: 1629 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1630 } 1631 return fpaov 1632 } 1633 1634 func (fp *NotificationState_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1635 return fp.WithIArrayOfValues(values) 1636 } 1637 1638 func (fp *NotificationState_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationState_FieldPathArrayItemValue { 1639 switch fp.selector { 1640 case NotificationState_FieldPathSelectorNotificationState: 1641 return &NotificationState_FieldTerminalPathArrayItemValue{NotificationState_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState)} 1642 case NotificationState_FieldPathSelectorResolutionNotificationState: 1643 return &NotificationState_FieldTerminalPathArrayItemValue{NotificationState_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState)} 1644 default: 1645 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fp.selector)) 1646 } 1647 } 1648 1649 func (fp *NotificationState_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1650 return fp.WithIArrayItemValue(value) 1651 } 1652 1653 type NotificationState_FieldSubPath struct { 1654 selector NotificationState_FieldPathSelector 1655 subPath gotenobject.FieldPath 1656 } 1657 1658 var _ NotificationState_FieldPath = (*NotificationState_FieldSubPath)(nil) 1659 1660 func (fps *NotificationState_FieldSubPath) Selector() NotificationState_FieldPathSelector { 1661 return fps.selector 1662 } 1663 func (fps *NotificationState_FieldSubPath) AsNotificationStateSubPath() (NotificationStateNotificationState_FieldPath, bool) { 1664 res, ok := fps.subPath.(NotificationStateNotificationState_FieldPath) 1665 return res, ok 1666 } 1667 func (fps *NotificationState_FieldSubPath) AsAlertsLifetimeSubPath() (common.TimeRange_FieldPath, bool) { 1668 res, ok := fps.subPath.(common.TimeRange_FieldPath) 1669 return res, ok 1670 } 1671 func (fps *NotificationState_FieldSubPath) AsResolutionNotificationStateSubPath() (NotificationStateNotificationState_FieldPath, bool) { 1672 res, ok := fps.subPath.(NotificationStateNotificationState_FieldPath) 1673 return res, ok 1674 } 1675 1676 // String returns path representation in proto convention 1677 func (fps *NotificationState_FieldSubPath) String() string { 1678 return fps.selector.String() + "." + fps.subPath.String() 1679 } 1680 1681 // JSONString returns path representation is JSON convention 1682 func (fps *NotificationState_FieldSubPath) JSONString() string { 1683 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 1684 } 1685 1686 // Get returns all values pointed by selected field from source Notification_State 1687 func (fps *NotificationState_FieldSubPath) Get(source *Notification_State) (values []interface{}) { 1688 switch fps.selector { 1689 case NotificationState_FieldPathSelectorNotificationState: 1690 for _, item := range source.GetNotificationState() { 1691 values = append(values, fps.subPath.GetRaw(item)...) 1692 } 1693 case NotificationState_FieldPathSelectorAlertsLifetime: 1694 values = append(values, fps.subPath.GetRaw(source.GetAlertsLifetime())...) 1695 case NotificationState_FieldPathSelectorResolutionNotificationState: 1696 for _, item := range source.GetResolutionNotificationState() { 1697 values = append(values, fps.subPath.GetRaw(item)...) 1698 } 1699 default: 1700 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fps.selector)) 1701 } 1702 return 1703 } 1704 1705 func (fps *NotificationState_FieldSubPath) GetRaw(source proto.Message) []interface{} { 1706 return fps.Get(source.(*Notification_State)) 1707 } 1708 1709 // GetSingle returns value of selected field from source Notification_State 1710 func (fps *NotificationState_FieldSubPath) GetSingle(source *Notification_State) (interface{}, bool) { 1711 switch fps.selector { 1712 case NotificationState_FieldPathSelectorNotificationState: 1713 if len(source.GetNotificationState()) == 0 { 1714 return nil, false 1715 } 1716 return fps.subPath.GetSingleRaw(source.GetNotificationState()[0]) 1717 case NotificationState_FieldPathSelectorAlertsLifetime: 1718 if source.GetAlertsLifetime() == nil { 1719 return nil, false 1720 } 1721 return fps.subPath.GetSingleRaw(source.GetAlertsLifetime()) 1722 case NotificationState_FieldPathSelectorResolutionNotificationState: 1723 if len(source.GetResolutionNotificationState()) == 0 { 1724 return nil, false 1725 } 1726 return fps.subPath.GetSingleRaw(source.GetResolutionNotificationState()[0]) 1727 default: 1728 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fps.selector)) 1729 } 1730 } 1731 1732 func (fps *NotificationState_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1733 return fps.GetSingle(source.(*Notification_State)) 1734 } 1735 1736 // GetDefault returns a default value of the field type 1737 func (fps *NotificationState_FieldSubPath) GetDefault() interface{} { 1738 return fps.subPath.GetDefault() 1739 } 1740 1741 func (fps *NotificationState_FieldSubPath) ClearValue(item *Notification_State) { 1742 if item != nil { 1743 switch fps.selector { 1744 case NotificationState_FieldPathSelectorNotificationState: 1745 for _, subItem := range item.NotificationState { 1746 fps.subPath.ClearValueRaw(subItem) 1747 } 1748 case NotificationState_FieldPathSelectorAlertsLifetime: 1749 fps.subPath.ClearValueRaw(item.AlertsLifetime) 1750 case NotificationState_FieldPathSelectorResolutionNotificationState: 1751 for _, subItem := range item.ResolutionNotificationState { 1752 fps.subPath.ClearValueRaw(subItem) 1753 } 1754 default: 1755 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fps.selector)) 1756 } 1757 } 1758 } 1759 1760 func (fps *NotificationState_FieldSubPath) ClearValueRaw(item proto.Message) { 1761 fps.ClearValue(item.(*Notification_State)) 1762 } 1763 1764 // IsLeaf - whether field path is holds simple value 1765 func (fps *NotificationState_FieldSubPath) IsLeaf() bool { 1766 return fps.subPath.IsLeaf() 1767 } 1768 1769 func (fps *NotificationState_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1770 iPaths := []gotenobject.FieldPath{&NotificationState_FieldTerminalPath{selector: fps.selector}} 1771 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 1772 return iPaths 1773 } 1774 1775 func (fps *NotificationState_FieldSubPath) WithIValue(value interface{}) NotificationState_FieldPathValue { 1776 return &NotificationState_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 1777 } 1778 1779 func (fps *NotificationState_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1780 return fps.WithIValue(value) 1781 } 1782 1783 func (fps *NotificationState_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationState_FieldPathArrayOfValues { 1784 return &NotificationState_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 1785 } 1786 1787 func (fps *NotificationState_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1788 return fps.WithIArrayOfValues(values) 1789 } 1790 1791 func (fps *NotificationState_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationState_FieldPathArrayItemValue { 1792 return &NotificationState_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 1793 } 1794 1795 func (fps *NotificationState_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1796 return fps.WithIArrayItemValue(value) 1797 } 1798 1799 // NotificationState_FieldPathValue allows storing values for State fields according to their type 1800 type NotificationState_FieldPathValue interface { 1801 NotificationState_FieldPath 1802 gotenobject.FieldPathValue 1803 SetTo(target **Notification_State) 1804 CompareWith(*Notification_State) (cmp int, comparable bool) 1805 } 1806 1807 func ParseNotificationState_FieldPathValue(pathStr, valueStr string) (NotificationState_FieldPathValue, error) { 1808 fp, err := ParseNotificationState_FieldPath(pathStr) 1809 if err != nil { 1810 return nil, err 1811 } 1812 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1813 if err != nil { 1814 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path value from %s: %v", valueStr, err) 1815 } 1816 return fpv.(NotificationState_FieldPathValue), nil 1817 } 1818 1819 func MustParseNotificationState_FieldPathValue(pathStr, valueStr string) NotificationState_FieldPathValue { 1820 fpv, err := ParseNotificationState_FieldPathValue(pathStr, valueStr) 1821 if err != nil { 1822 panic(err) 1823 } 1824 return fpv 1825 } 1826 1827 type NotificationState_FieldTerminalPathValue struct { 1828 NotificationState_FieldTerminalPath 1829 value interface{} 1830 } 1831 1832 var _ NotificationState_FieldPathValue = (*NotificationState_FieldTerminalPathValue)(nil) 1833 1834 // GetRawValue returns raw value stored under selected path for 'State' as interface{} 1835 func (fpv *NotificationState_FieldTerminalPathValue) GetRawValue() interface{} { 1836 return fpv.value 1837 } 1838 func (fpv *NotificationState_FieldTerminalPathValue) AsIsResolvedValue() (bool, bool) { 1839 res, ok := fpv.value.(bool) 1840 return res, ok 1841 } 1842 func (fpv *NotificationState_FieldTerminalPathValue) AsNotificationStateValue() ([]*Notification_State_NotificationState, bool) { 1843 res, ok := fpv.value.([]*Notification_State_NotificationState) 1844 return res, ok 1845 } 1846 func (fpv *NotificationState_FieldTerminalPathValue) AsIncidentNotifyAttemptsDoneValue() (bool, bool) { 1847 res, ok := fpv.value.(bool) 1848 return res, ok 1849 } 1850 func (fpv *NotificationState_FieldTerminalPathValue) AsResolutionNotifyAttemptsDoneValue() (bool, bool) { 1851 res, ok := fpv.value.(bool) 1852 return res, ok 1853 } 1854 func (fpv *NotificationState_FieldTerminalPathValue) AsAlertsLifetimeValue() (*common.TimeRange, bool) { 1855 res, ok := fpv.value.(*common.TimeRange) 1856 return res, ok 1857 } 1858 func (fpv *NotificationState_FieldTerminalPathValue) AsResolutionNotificationStateValue() ([]*Notification_State_NotificationState, bool) { 1859 res, ok := fpv.value.([]*Notification_State_NotificationState) 1860 return res, ok 1861 } 1862 func (fpv *NotificationState_FieldTerminalPathValue) AsLifecycleCompletedValue() (bool, bool) { 1863 res, ok := fpv.value.(bool) 1864 return res, ok 1865 } 1866 1867 // SetTo stores value for selected field for object State 1868 func (fpv *NotificationState_FieldTerminalPathValue) SetTo(target **Notification_State) { 1869 if *target == nil { 1870 *target = new(Notification_State) 1871 } 1872 switch fpv.selector { 1873 case NotificationState_FieldPathSelectorIsResolved: 1874 (*target).IsResolved = fpv.value.(bool) 1875 case NotificationState_FieldPathSelectorNotificationState: 1876 (*target).NotificationState = fpv.value.([]*Notification_State_NotificationState) 1877 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1878 (*target).IncidentNotifyAttemptsDone = fpv.value.(bool) 1879 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1880 (*target).ResolutionNotifyAttemptsDone = fpv.value.(bool) 1881 case NotificationState_FieldPathSelectorAlertsLifetime: 1882 (*target).AlertsLifetime = fpv.value.(*common.TimeRange) 1883 case NotificationState_FieldPathSelectorResolutionNotificationState: 1884 (*target).ResolutionNotificationState = fpv.value.([]*Notification_State_NotificationState) 1885 case NotificationState_FieldPathSelectorLifecycleCompleted: 1886 (*target).LifecycleCompleted = fpv.value.(bool) 1887 default: 1888 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpv.selector)) 1889 } 1890 } 1891 1892 func (fpv *NotificationState_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1893 typedObject := target.(*Notification_State) 1894 fpv.SetTo(&typedObject) 1895 } 1896 1897 // CompareWith compares value in the 'NotificationState_FieldTerminalPathValue' with the value under path in 'Notification_State'. 1898 func (fpv *NotificationState_FieldTerminalPathValue) CompareWith(source *Notification_State) (int, bool) { 1899 switch fpv.selector { 1900 case NotificationState_FieldPathSelectorIsResolved: 1901 leftValue := fpv.value.(bool) 1902 rightValue := source.GetIsResolved() 1903 if (leftValue) == (rightValue) { 1904 return 0, true 1905 } else if !(leftValue) && (rightValue) { 1906 return -1, true 1907 } else { 1908 return 1, true 1909 } 1910 case NotificationState_FieldPathSelectorNotificationState: 1911 return 0, false 1912 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 1913 leftValue := fpv.value.(bool) 1914 rightValue := source.GetIncidentNotifyAttemptsDone() 1915 if (leftValue) == (rightValue) { 1916 return 0, true 1917 } else if !(leftValue) && (rightValue) { 1918 return -1, true 1919 } else { 1920 return 1, true 1921 } 1922 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 1923 leftValue := fpv.value.(bool) 1924 rightValue := source.GetResolutionNotifyAttemptsDone() 1925 if (leftValue) == (rightValue) { 1926 return 0, true 1927 } else if !(leftValue) && (rightValue) { 1928 return -1, true 1929 } else { 1930 return 1, true 1931 } 1932 case NotificationState_FieldPathSelectorAlertsLifetime: 1933 return 0, false 1934 case NotificationState_FieldPathSelectorResolutionNotificationState: 1935 return 0, false 1936 case NotificationState_FieldPathSelectorLifecycleCompleted: 1937 leftValue := fpv.value.(bool) 1938 rightValue := source.GetLifecycleCompleted() 1939 if (leftValue) == (rightValue) { 1940 return 0, true 1941 } else if !(leftValue) && (rightValue) { 1942 return -1, true 1943 } else { 1944 return 1, true 1945 } 1946 default: 1947 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpv.selector)) 1948 } 1949 } 1950 1951 func (fpv *NotificationState_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1952 return fpv.CompareWith(source.(*Notification_State)) 1953 } 1954 1955 type NotificationState_FieldSubPathValue struct { 1956 NotificationState_FieldPath 1957 subPathValue gotenobject.FieldPathValue 1958 } 1959 1960 var _ NotificationState_FieldPathValue = (*NotificationState_FieldSubPathValue)(nil) 1961 1962 func (fpvs *NotificationState_FieldSubPathValue) AsNotificationStatePathValue() (NotificationStateNotificationState_FieldPathValue, bool) { 1963 res, ok := fpvs.subPathValue.(NotificationStateNotificationState_FieldPathValue) 1964 return res, ok 1965 } 1966 func (fpvs *NotificationState_FieldSubPathValue) AsAlertsLifetimePathValue() (common.TimeRange_FieldPathValue, bool) { 1967 res, ok := fpvs.subPathValue.(common.TimeRange_FieldPathValue) 1968 return res, ok 1969 } 1970 func (fpvs *NotificationState_FieldSubPathValue) AsResolutionNotificationStatePathValue() (NotificationStateNotificationState_FieldPathValue, bool) { 1971 res, ok := fpvs.subPathValue.(NotificationStateNotificationState_FieldPathValue) 1972 return res, ok 1973 } 1974 1975 func (fpvs *NotificationState_FieldSubPathValue) SetTo(target **Notification_State) { 1976 if *target == nil { 1977 *target = new(Notification_State) 1978 } 1979 switch fpvs.Selector() { 1980 case NotificationState_FieldPathSelectorNotificationState: 1981 panic("FieldPath setter is unsupported for array subpaths") 1982 case NotificationState_FieldPathSelectorAlertsLifetime: 1983 fpvs.subPathValue.(common.TimeRange_FieldPathValue).SetTo(&(*target).AlertsLifetime) 1984 case NotificationState_FieldPathSelectorResolutionNotificationState: 1985 panic("FieldPath setter is unsupported for array subpaths") 1986 default: 1987 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpvs.Selector())) 1988 } 1989 } 1990 1991 func (fpvs *NotificationState_FieldSubPathValue) SetToRaw(target proto.Message) { 1992 typedObject := target.(*Notification_State) 1993 fpvs.SetTo(&typedObject) 1994 } 1995 1996 func (fpvs *NotificationState_FieldSubPathValue) GetRawValue() interface{} { 1997 return fpvs.subPathValue.GetRawValue() 1998 } 1999 2000 func (fpvs *NotificationState_FieldSubPathValue) CompareWith(source *Notification_State) (int, bool) { 2001 switch fpvs.Selector() { 2002 case NotificationState_FieldPathSelectorNotificationState: 2003 return 0, false // repeated field 2004 case NotificationState_FieldPathSelectorAlertsLifetime: 2005 return fpvs.subPathValue.(common.TimeRange_FieldPathValue).CompareWith(source.GetAlertsLifetime()) 2006 case NotificationState_FieldPathSelectorResolutionNotificationState: 2007 return 0, false // repeated field 2008 default: 2009 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpvs.Selector())) 2010 } 2011 } 2012 2013 func (fpvs *NotificationState_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2014 return fpvs.CompareWith(source.(*Notification_State)) 2015 } 2016 2017 // NotificationState_FieldPathArrayItemValue allows storing single item in Path-specific values for State according to their type 2018 // Present only for array (repeated) types. 2019 type NotificationState_FieldPathArrayItemValue interface { 2020 gotenobject.FieldPathArrayItemValue 2021 NotificationState_FieldPath 2022 ContainsValue(*Notification_State) bool 2023 } 2024 2025 // ParseNotificationState_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2026 func ParseNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationState_FieldPathArrayItemValue, error) { 2027 fp, err := ParseNotificationState_FieldPath(pathStr) 2028 if err != nil { 2029 return nil, err 2030 } 2031 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2032 if err != nil { 2033 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path array item value from %s: %v", valueStr, err) 2034 } 2035 return fpaiv.(NotificationState_FieldPathArrayItemValue), nil 2036 } 2037 2038 func MustParseNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) NotificationState_FieldPathArrayItemValue { 2039 fpaiv, err := ParseNotificationState_FieldPathArrayItemValue(pathStr, valueStr) 2040 if err != nil { 2041 panic(err) 2042 } 2043 return fpaiv 2044 } 2045 2046 type NotificationState_FieldTerminalPathArrayItemValue struct { 2047 NotificationState_FieldTerminalPath 2048 value interface{} 2049 } 2050 2051 var _ NotificationState_FieldPathArrayItemValue = (*NotificationState_FieldTerminalPathArrayItemValue)(nil) 2052 2053 // GetRawValue returns stored element value for array in object Notification_State as interface{} 2054 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2055 return fpaiv.value 2056 } 2057 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) AsNotificationStateItemValue() (*Notification_State_NotificationState, bool) { 2058 res, ok := fpaiv.value.(*Notification_State_NotificationState) 2059 return res, ok 2060 } 2061 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) AsResolutionNotificationStateItemValue() (*Notification_State_NotificationState, bool) { 2062 res, ok := fpaiv.value.(*Notification_State_NotificationState) 2063 return res, ok 2064 } 2065 2066 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State) (interface{}, bool) { 2067 return nil, false 2068 } 2069 2070 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2071 return fpaiv.GetSingle(source.(*Notification_State)) 2072 } 2073 2074 // Contains returns a boolean indicating if value that is being held is present in given 'State' 2075 func (fpaiv *NotificationState_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State) bool { 2076 slice := fpaiv.NotificationState_FieldTerminalPath.Get(source) 2077 for _, v := range slice { 2078 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2079 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2080 return true 2081 } 2082 } else if reflect.DeepEqual(v, fpaiv.value) { 2083 return true 2084 } 2085 } 2086 return false 2087 } 2088 2089 type NotificationState_FieldSubPathArrayItemValue struct { 2090 NotificationState_FieldPath 2091 subPathItemValue gotenobject.FieldPathArrayItemValue 2092 } 2093 2094 // GetRawValue returns stored array item value 2095 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2096 return fpaivs.subPathItemValue.GetRawItemValue() 2097 } 2098 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) AsNotificationStatePathItemValue() (NotificationStateNotificationState_FieldPathArrayItemValue, bool) { 2099 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationState_FieldPathArrayItemValue) 2100 return res, ok 2101 } 2102 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) AsAlertsLifetimePathItemValue() (common.TimeRange_FieldPathArrayItemValue, bool) { 2103 res, ok := fpaivs.subPathItemValue.(common.TimeRange_FieldPathArrayItemValue) 2104 return res, ok 2105 } 2106 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) AsResolutionNotificationStatePathItemValue() (NotificationStateNotificationState_FieldPathArrayItemValue, bool) { 2107 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationState_FieldPathArrayItemValue) 2108 return res, ok 2109 } 2110 2111 // Contains returns a boolean indicating if value that is being held is present in given 'State' 2112 func (fpaivs *NotificationState_FieldSubPathArrayItemValue) ContainsValue(source *Notification_State) bool { 2113 switch fpaivs.Selector() { 2114 case NotificationState_FieldPathSelectorNotificationState: 2115 return false // repeated/map field 2116 case NotificationState_FieldPathSelectorAlertsLifetime: 2117 return fpaivs.subPathItemValue.(common.TimeRange_FieldPathArrayItemValue).ContainsValue(source.GetAlertsLifetime()) 2118 case NotificationState_FieldPathSelectorResolutionNotificationState: 2119 return false // repeated/map field 2120 default: 2121 panic(fmt.Sprintf("Invalid selector for Notification_State: %d", fpaivs.Selector())) 2122 } 2123 } 2124 2125 // NotificationState_FieldPathArrayOfValues allows storing slice of values for State fields according to their type 2126 type NotificationState_FieldPathArrayOfValues interface { 2127 gotenobject.FieldPathArrayOfValues 2128 NotificationState_FieldPath 2129 } 2130 2131 func ParseNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationState_FieldPathArrayOfValues, error) { 2132 fp, err := ParseNotificationState_FieldPath(pathStr) 2133 if err != nil { 2134 return nil, err 2135 } 2136 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2137 if err != nil { 2138 return nil, status.Errorf(codes.InvalidArgument, "error parsing State field path array of values from %s: %v", valuesStr, err) 2139 } 2140 return fpaov.(NotificationState_FieldPathArrayOfValues), nil 2141 } 2142 2143 func MustParseNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationState_FieldPathArrayOfValues { 2144 fpaov, err := ParseNotificationState_FieldPathArrayOfValues(pathStr, valuesStr) 2145 if err != nil { 2146 panic(err) 2147 } 2148 return fpaov 2149 } 2150 2151 type NotificationState_FieldTerminalPathArrayOfValues struct { 2152 NotificationState_FieldTerminalPath 2153 values interface{} 2154 } 2155 2156 var _ NotificationState_FieldPathArrayOfValues = (*NotificationState_FieldTerminalPathArrayOfValues)(nil) 2157 2158 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2159 switch fpaov.selector { 2160 case NotificationState_FieldPathSelectorIsResolved: 2161 for _, v := range fpaov.values.([]bool) { 2162 values = append(values, v) 2163 } 2164 case NotificationState_FieldPathSelectorNotificationState: 2165 for _, v := range fpaov.values.([][]*Notification_State_NotificationState) { 2166 values = append(values, v) 2167 } 2168 case NotificationState_FieldPathSelectorIncidentNotifyAttemptsDone: 2169 for _, v := range fpaov.values.([]bool) { 2170 values = append(values, v) 2171 } 2172 case NotificationState_FieldPathSelectorResolutionNotifyAttemptsDone: 2173 for _, v := range fpaov.values.([]bool) { 2174 values = append(values, v) 2175 } 2176 case NotificationState_FieldPathSelectorAlertsLifetime: 2177 for _, v := range fpaov.values.([]*common.TimeRange) { 2178 values = append(values, v) 2179 } 2180 case NotificationState_FieldPathSelectorResolutionNotificationState: 2181 for _, v := range fpaov.values.([][]*Notification_State_NotificationState) { 2182 values = append(values, v) 2183 } 2184 case NotificationState_FieldPathSelectorLifecycleCompleted: 2185 for _, v := range fpaov.values.([]bool) { 2186 values = append(values, v) 2187 } 2188 } 2189 return 2190 } 2191 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsIsResolvedArrayOfValues() ([]bool, bool) { 2192 res, ok := fpaov.values.([]bool) 2193 return res, ok 2194 } 2195 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsNotificationStateArrayOfValues() ([][]*Notification_State_NotificationState, bool) { 2196 res, ok := fpaov.values.([][]*Notification_State_NotificationState) 2197 return res, ok 2198 } 2199 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsIncidentNotifyAttemptsDoneArrayOfValues() ([]bool, bool) { 2200 res, ok := fpaov.values.([]bool) 2201 return res, ok 2202 } 2203 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsResolutionNotifyAttemptsDoneArrayOfValues() ([]bool, bool) { 2204 res, ok := fpaov.values.([]bool) 2205 return res, ok 2206 } 2207 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsAlertsLifetimeArrayOfValues() ([]*common.TimeRange, bool) { 2208 res, ok := fpaov.values.([]*common.TimeRange) 2209 return res, ok 2210 } 2211 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsResolutionNotificationStateArrayOfValues() ([][]*Notification_State_NotificationState, bool) { 2212 res, ok := fpaov.values.([][]*Notification_State_NotificationState) 2213 return res, ok 2214 } 2215 func (fpaov *NotificationState_FieldTerminalPathArrayOfValues) AsLifecycleCompletedArrayOfValues() ([]bool, bool) { 2216 res, ok := fpaov.values.([]bool) 2217 return res, ok 2218 } 2219 2220 type NotificationState_FieldSubPathArrayOfValues struct { 2221 NotificationState_FieldPath 2222 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2223 } 2224 2225 var _ NotificationState_FieldPathArrayOfValues = (*NotificationState_FieldSubPathArrayOfValues)(nil) 2226 2227 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2228 return fpsaov.subPathArrayOfValues.GetRawValues() 2229 } 2230 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) AsNotificationStatePathArrayOfValues() (NotificationStateNotificationState_FieldPathArrayOfValues, bool) { 2231 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationState_FieldPathArrayOfValues) 2232 return res, ok 2233 } 2234 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) AsAlertsLifetimePathArrayOfValues() (common.TimeRange_FieldPathArrayOfValues, bool) { 2235 res, ok := fpsaov.subPathArrayOfValues.(common.TimeRange_FieldPathArrayOfValues) 2236 return res, ok 2237 } 2238 func (fpsaov *NotificationState_FieldSubPathArrayOfValues) AsResolutionNotificationStatePathArrayOfValues() (NotificationStateNotificationState_FieldPathArrayOfValues, bool) { 2239 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationState_FieldPathArrayOfValues) 2240 return res, ok 2241 } 2242 2243 // FieldPath provides implementation to handle 2244 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2245 type NotificationStateNotificationState_FieldPath interface { 2246 gotenobject.FieldPath 2247 Selector() NotificationStateNotificationState_FieldPathSelector 2248 Get(source *Notification_State_NotificationState) []interface{} 2249 GetSingle(source *Notification_State_NotificationState) (interface{}, bool) 2250 ClearValue(item *Notification_State_NotificationState) 2251 2252 // Those methods build corresponding NotificationStateNotificationState_FieldPathValue 2253 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2254 WithIValue(value interface{}) NotificationStateNotificationState_FieldPathValue 2255 WithIArrayOfValues(values interface{}) NotificationStateNotificationState_FieldPathArrayOfValues 2256 WithIArrayItemValue(value interface{}) NotificationStateNotificationState_FieldPathArrayItemValue 2257 } 2258 2259 type NotificationStateNotificationState_FieldPathSelector int32 2260 2261 const ( 2262 NotificationStateNotificationState_FieldPathSelectorNotificationChannel NotificationStateNotificationState_FieldPathSelector = 0 2263 NotificationStateNotificationState_FieldPathSelectorStatus NotificationStateNotificationState_FieldPathSelector = 1 2264 NotificationStateNotificationState_FieldPathSelectorError NotificationStateNotificationState_FieldPathSelector = 2 2265 NotificationStateNotificationState_FieldPathSelectorProviderData NotificationStateNotificationState_FieldPathSelector = 3 2266 NotificationStateNotificationState_FieldPathSelectorNotifyAttempts NotificationStateNotificationState_FieldPathSelector = 4 2267 ) 2268 2269 func (s NotificationStateNotificationState_FieldPathSelector) String() string { 2270 switch s { 2271 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2272 return "notification_channel" 2273 case NotificationStateNotificationState_FieldPathSelectorStatus: 2274 return "status" 2275 case NotificationStateNotificationState_FieldPathSelectorError: 2276 return "error" 2277 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2278 return "provider_data" 2279 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2280 return "notify_attempts" 2281 default: 2282 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", s)) 2283 } 2284 } 2285 2286 func BuildNotificationStateNotificationState_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationState_FieldPath, error) { 2287 if len(fp) == 0 { 2288 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState") 2289 } 2290 if len(fp) == 1 { 2291 switch fp[0] { 2292 case "notification_channel", "notificationChannel", "notification-channel": 2293 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorNotificationChannel}, nil 2294 case "status": 2295 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorStatus}, nil 2296 case "error": 2297 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorError}, nil 2298 case "provider_data", "providerData", "provider-data": 2299 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorProviderData}, nil 2300 case "notify_attempts", "notifyAttempts", "notify-attempts": 2301 return &NotificationStateNotificationState_FieldTerminalPath{selector: NotificationStateNotificationState_FieldPathSelectorNotifyAttempts}, nil 2302 } 2303 } else { 2304 switch fp[0] { 2305 case "provider_data", "providerData", "provider-data": 2306 if subpath, err := BuildNotificationStateNotificationStateProviderData_FieldPath(fp[1:]); err != nil { 2307 return nil, err 2308 } else { 2309 return &NotificationStateNotificationState_FieldSubPath{selector: NotificationStateNotificationState_FieldPathSelectorProviderData, subPath: subpath}, nil 2310 } 2311 } 2312 } 2313 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState", fp) 2314 } 2315 2316 func ParseNotificationStateNotificationState_FieldPath(rawField string) (NotificationStateNotificationState_FieldPath, error) { 2317 fp, err := gotenobject.ParseRawFieldPath(rawField) 2318 if err != nil { 2319 return nil, err 2320 } 2321 return BuildNotificationStateNotificationState_FieldPath(fp) 2322 } 2323 2324 func MustParseNotificationStateNotificationState_FieldPath(rawField string) NotificationStateNotificationState_FieldPath { 2325 fp, err := ParseNotificationStateNotificationState_FieldPath(rawField) 2326 if err != nil { 2327 panic(err) 2328 } 2329 return fp 2330 } 2331 2332 type NotificationStateNotificationState_FieldTerminalPath struct { 2333 selector NotificationStateNotificationState_FieldPathSelector 2334 } 2335 2336 var _ NotificationStateNotificationState_FieldPath = (*NotificationStateNotificationState_FieldTerminalPath)(nil) 2337 2338 func (fp *NotificationStateNotificationState_FieldTerminalPath) Selector() NotificationStateNotificationState_FieldPathSelector { 2339 return fp.selector 2340 } 2341 2342 // String returns path representation in proto convention 2343 func (fp *NotificationStateNotificationState_FieldTerminalPath) String() string { 2344 return fp.selector.String() 2345 } 2346 2347 // JSONString returns path representation is JSON convention 2348 func (fp *NotificationStateNotificationState_FieldTerminalPath) JSONString() string { 2349 return strcase.ToLowerCamel(fp.String()) 2350 } 2351 2352 // Get returns all values pointed by specific field from source Notification_State_NotificationState 2353 func (fp *NotificationStateNotificationState_FieldTerminalPath) Get(source *Notification_State_NotificationState) (values []interface{}) { 2354 if source != nil { 2355 switch fp.selector { 2356 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2357 if source.NotificationChannel != nil { 2358 values = append(values, source.NotificationChannel) 2359 } 2360 case NotificationStateNotificationState_FieldPathSelectorStatus: 2361 values = append(values, source.Status) 2362 case NotificationStateNotificationState_FieldPathSelectorError: 2363 values = append(values, source.Error) 2364 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2365 if source.ProviderData != nil { 2366 values = append(values, source.ProviderData) 2367 } 2368 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2369 values = append(values, source.NotifyAttempts) 2370 default: 2371 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2372 } 2373 } 2374 return 2375 } 2376 2377 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2378 return fp.Get(source.(*Notification_State_NotificationState)) 2379 } 2380 2381 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState 2382 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState) (interface{}, bool) { 2383 switch fp.selector { 2384 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2385 res := source.GetNotificationChannel() 2386 return res, res != nil 2387 case NotificationStateNotificationState_FieldPathSelectorStatus: 2388 return source.GetStatus(), source != nil 2389 case NotificationStateNotificationState_FieldPathSelectorError: 2390 return source.GetError(), source != nil 2391 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2392 res := source.GetProviderData() 2393 return res, res != nil 2394 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2395 return source.GetNotifyAttempts(), source != nil 2396 default: 2397 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2398 } 2399 } 2400 2401 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2402 return fp.GetSingle(source.(*Notification_State_NotificationState)) 2403 } 2404 2405 // GetDefault returns a default value of the field type 2406 func (fp *NotificationStateNotificationState_FieldTerminalPath) GetDefault() interface{} { 2407 switch fp.selector { 2408 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2409 return (*notification_channel.Name)(nil) 2410 case NotificationStateNotificationState_FieldPathSelectorStatus: 2411 return Notification_State_NotificationState_UNKNOWN 2412 case NotificationStateNotificationState_FieldPathSelectorError: 2413 return "" 2414 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2415 return (*Notification_State_NotificationState_ProviderData)(nil) 2416 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2417 return int64(0) 2418 default: 2419 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2420 } 2421 } 2422 2423 func (fp *NotificationStateNotificationState_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState) { 2424 if item != nil { 2425 switch fp.selector { 2426 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2427 item.NotificationChannel = nil 2428 case NotificationStateNotificationState_FieldPathSelectorStatus: 2429 item.Status = Notification_State_NotificationState_UNKNOWN 2430 case NotificationStateNotificationState_FieldPathSelectorError: 2431 item.Error = "" 2432 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2433 item.ProviderData = nil 2434 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2435 item.NotifyAttempts = int64(0) 2436 default: 2437 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2438 } 2439 } 2440 } 2441 2442 func (fp *NotificationStateNotificationState_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2443 fp.ClearValue(item.(*Notification_State_NotificationState)) 2444 } 2445 2446 // IsLeaf - whether field path is holds simple value 2447 func (fp *NotificationStateNotificationState_FieldTerminalPath) IsLeaf() bool { 2448 return fp.selector == NotificationStateNotificationState_FieldPathSelectorNotificationChannel || 2449 fp.selector == NotificationStateNotificationState_FieldPathSelectorStatus || 2450 fp.selector == NotificationStateNotificationState_FieldPathSelectorError || 2451 fp.selector == NotificationStateNotificationState_FieldPathSelectorNotifyAttempts 2452 } 2453 2454 func (fp *NotificationStateNotificationState_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2455 return []gotenobject.FieldPath{fp} 2456 } 2457 2458 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationState_FieldPathValue { 2459 switch fp.selector { 2460 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2461 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(*notification_channel.Name)} 2462 case NotificationStateNotificationState_FieldPathSelectorStatus: 2463 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(Notification_State_NotificationState_Status)} 2464 case NotificationStateNotificationState_FieldPathSelectorError: 2465 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(string)} 2466 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2467 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData)} 2468 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2469 return &NotificationStateNotificationState_FieldTerminalPathValue{NotificationStateNotificationState_FieldTerminalPath: *fp, value: value.(int64)} 2470 default: 2471 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2472 } 2473 } 2474 2475 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2476 return fp.WithIValue(value) 2477 } 2478 2479 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationState_FieldPathArrayOfValues { 2480 fpaov := &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp} 2481 switch fp.selector { 2482 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2483 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]*notification_channel.Name)} 2484 case NotificationStateNotificationState_FieldPathSelectorStatus: 2485 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]Notification_State_NotificationState_Status)} 2486 case NotificationStateNotificationState_FieldPathSelectorError: 2487 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]string)} 2488 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2489 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]*Notification_State_NotificationState_ProviderData)} 2490 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2491 return &NotificationStateNotificationState_FieldTerminalPathArrayOfValues{NotificationStateNotificationState_FieldTerminalPath: *fp, values: values.([]int64)} 2492 default: 2493 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2494 } 2495 return fpaov 2496 } 2497 2498 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2499 return fp.WithIArrayOfValues(values) 2500 } 2501 2502 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationState_FieldPathArrayItemValue { 2503 switch fp.selector { 2504 default: 2505 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fp.selector)) 2506 } 2507 } 2508 2509 func (fp *NotificationStateNotificationState_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2510 return fp.WithIArrayItemValue(value) 2511 } 2512 2513 type NotificationStateNotificationState_FieldSubPath struct { 2514 selector NotificationStateNotificationState_FieldPathSelector 2515 subPath gotenobject.FieldPath 2516 } 2517 2518 var _ NotificationStateNotificationState_FieldPath = (*NotificationStateNotificationState_FieldSubPath)(nil) 2519 2520 func (fps *NotificationStateNotificationState_FieldSubPath) Selector() NotificationStateNotificationState_FieldPathSelector { 2521 return fps.selector 2522 } 2523 func (fps *NotificationStateNotificationState_FieldSubPath) AsProviderDataSubPath() (NotificationStateNotificationStateProviderData_FieldPath, bool) { 2524 res, ok := fps.subPath.(NotificationStateNotificationStateProviderData_FieldPath) 2525 return res, ok 2526 } 2527 2528 // String returns path representation in proto convention 2529 func (fps *NotificationStateNotificationState_FieldSubPath) String() string { 2530 return fps.selector.String() + "." + fps.subPath.String() 2531 } 2532 2533 // JSONString returns path representation is JSON convention 2534 func (fps *NotificationStateNotificationState_FieldSubPath) JSONString() string { 2535 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2536 } 2537 2538 // Get returns all values pointed by selected field from source Notification_State_NotificationState 2539 func (fps *NotificationStateNotificationState_FieldSubPath) Get(source *Notification_State_NotificationState) (values []interface{}) { 2540 switch fps.selector { 2541 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2542 values = append(values, fps.subPath.GetRaw(source.GetProviderData())...) 2543 default: 2544 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fps.selector)) 2545 } 2546 return 2547 } 2548 2549 func (fps *NotificationStateNotificationState_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2550 return fps.Get(source.(*Notification_State_NotificationState)) 2551 } 2552 2553 // GetSingle returns value of selected field from source Notification_State_NotificationState 2554 func (fps *NotificationStateNotificationState_FieldSubPath) GetSingle(source *Notification_State_NotificationState) (interface{}, bool) { 2555 switch fps.selector { 2556 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2557 if source.GetProviderData() == nil { 2558 return nil, false 2559 } 2560 return fps.subPath.GetSingleRaw(source.GetProviderData()) 2561 default: 2562 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fps.selector)) 2563 } 2564 } 2565 2566 func (fps *NotificationStateNotificationState_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2567 return fps.GetSingle(source.(*Notification_State_NotificationState)) 2568 } 2569 2570 // GetDefault returns a default value of the field type 2571 func (fps *NotificationStateNotificationState_FieldSubPath) GetDefault() interface{} { 2572 return fps.subPath.GetDefault() 2573 } 2574 2575 func (fps *NotificationStateNotificationState_FieldSubPath) ClearValue(item *Notification_State_NotificationState) { 2576 if item != nil { 2577 switch fps.selector { 2578 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2579 fps.subPath.ClearValueRaw(item.ProviderData) 2580 default: 2581 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fps.selector)) 2582 } 2583 } 2584 } 2585 2586 func (fps *NotificationStateNotificationState_FieldSubPath) ClearValueRaw(item proto.Message) { 2587 fps.ClearValue(item.(*Notification_State_NotificationState)) 2588 } 2589 2590 // IsLeaf - whether field path is holds simple value 2591 func (fps *NotificationStateNotificationState_FieldSubPath) IsLeaf() bool { 2592 return fps.subPath.IsLeaf() 2593 } 2594 2595 func (fps *NotificationStateNotificationState_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2596 iPaths := []gotenobject.FieldPath{&NotificationStateNotificationState_FieldTerminalPath{selector: fps.selector}} 2597 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2598 return iPaths 2599 } 2600 2601 func (fps *NotificationStateNotificationState_FieldSubPath) WithIValue(value interface{}) NotificationStateNotificationState_FieldPathValue { 2602 return &NotificationStateNotificationState_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2603 } 2604 2605 func (fps *NotificationStateNotificationState_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2606 return fps.WithIValue(value) 2607 } 2608 2609 func (fps *NotificationStateNotificationState_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationState_FieldPathArrayOfValues { 2610 return &NotificationStateNotificationState_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2611 } 2612 2613 func (fps *NotificationStateNotificationState_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2614 return fps.WithIArrayOfValues(values) 2615 } 2616 2617 func (fps *NotificationStateNotificationState_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationState_FieldPathArrayItemValue { 2618 return &NotificationStateNotificationState_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2619 } 2620 2621 func (fps *NotificationStateNotificationState_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2622 return fps.WithIArrayItemValue(value) 2623 } 2624 2625 // NotificationStateNotificationState_FieldPathValue allows storing values for NotificationState fields according to their type 2626 type NotificationStateNotificationState_FieldPathValue interface { 2627 NotificationStateNotificationState_FieldPath 2628 gotenobject.FieldPathValue 2629 SetTo(target **Notification_State_NotificationState) 2630 CompareWith(*Notification_State_NotificationState) (cmp int, comparable bool) 2631 } 2632 2633 func ParseNotificationStateNotificationState_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationState_FieldPathValue, error) { 2634 fp, err := ParseNotificationStateNotificationState_FieldPath(pathStr) 2635 if err != nil { 2636 return nil, err 2637 } 2638 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2639 if err != nil { 2640 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationState field path value from %s: %v", valueStr, err) 2641 } 2642 return fpv.(NotificationStateNotificationState_FieldPathValue), nil 2643 } 2644 2645 func MustParseNotificationStateNotificationState_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationState_FieldPathValue { 2646 fpv, err := ParseNotificationStateNotificationState_FieldPathValue(pathStr, valueStr) 2647 if err != nil { 2648 panic(err) 2649 } 2650 return fpv 2651 } 2652 2653 type NotificationStateNotificationState_FieldTerminalPathValue struct { 2654 NotificationStateNotificationState_FieldTerminalPath 2655 value interface{} 2656 } 2657 2658 var _ NotificationStateNotificationState_FieldPathValue = (*NotificationStateNotificationState_FieldTerminalPathValue)(nil) 2659 2660 // GetRawValue returns raw value stored under selected path for 'NotificationState' as interface{} 2661 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) GetRawValue() interface{} { 2662 return fpv.value 2663 } 2664 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsNotificationChannelValue() (*notification_channel.Name, bool) { 2665 res, ok := fpv.value.(*notification_channel.Name) 2666 return res, ok 2667 } 2668 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsStatusValue() (Notification_State_NotificationState_Status, bool) { 2669 res, ok := fpv.value.(Notification_State_NotificationState_Status) 2670 return res, ok 2671 } 2672 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsErrorValue() (string, bool) { 2673 res, ok := fpv.value.(string) 2674 return res, ok 2675 } 2676 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsProviderDataValue() (*Notification_State_NotificationState_ProviderData, bool) { 2677 res, ok := fpv.value.(*Notification_State_NotificationState_ProviderData) 2678 return res, ok 2679 } 2680 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) AsNotifyAttemptsValue() (int64, bool) { 2681 res, ok := fpv.value.(int64) 2682 return res, ok 2683 } 2684 2685 // SetTo stores value for selected field for object NotificationState 2686 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState) { 2687 if *target == nil { 2688 *target = new(Notification_State_NotificationState) 2689 } 2690 switch fpv.selector { 2691 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2692 (*target).NotificationChannel = fpv.value.(*notification_channel.Name) 2693 case NotificationStateNotificationState_FieldPathSelectorStatus: 2694 (*target).Status = fpv.value.(Notification_State_NotificationState_Status) 2695 case NotificationStateNotificationState_FieldPathSelectorError: 2696 (*target).Error = fpv.value.(string) 2697 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2698 (*target).ProviderData = fpv.value.(*Notification_State_NotificationState_ProviderData) 2699 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2700 (*target).NotifyAttempts = fpv.value.(int64) 2701 default: 2702 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpv.selector)) 2703 } 2704 } 2705 2706 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2707 typedObject := target.(*Notification_State_NotificationState) 2708 fpv.SetTo(&typedObject) 2709 } 2710 2711 // CompareWith compares value in the 'NotificationStateNotificationState_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState'. 2712 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState) (int, bool) { 2713 switch fpv.selector { 2714 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2715 leftValue := fpv.value.(*notification_channel.Name) 2716 rightValue := source.GetNotificationChannel() 2717 if leftValue == nil { 2718 if rightValue != nil { 2719 return -1, true 2720 } 2721 return 0, true 2722 } 2723 if rightValue == nil { 2724 return 1, true 2725 } 2726 if leftValue.String() == rightValue.String() { 2727 return 0, true 2728 } else if leftValue.String() < rightValue.String() { 2729 return -1, true 2730 } else { 2731 return 1, true 2732 } 2733 case NotificationStateNotificationState_FieldPathSelectorStatus: 2734 leftValue := fpv.value.(Notification_State_NotificationState_Status) 2735 rightValue := source.GetStatus() 2736 if (leftValue) == (rightValue) { 2737 return 0, true 2738 } else if (leftValue) < (rightValue) { 2739 return -1, true 2740 } else { 2741 return 1, true 2742 } 2743 case NotificationStateNotificationState_FieldPathSelectorError: 2744 leftValue := fpv.value.(string) 2745 rightValue := source.GetError() 2746 if (leftValue) == (rightValue) { 2747 return 0, true 2748 } else if (leftValue) < (rightValue) { 2749 return -1, true 2750 } else { 2751 return 1, true 2752 } 2753 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2754 return 0, false 2755 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2756 leftValue := fpv.value.(int64) 2757 rightValue := source.GetNotifyAttempts() 2758 if (leftValue) == (rightValue) { 2759 return 0, true 2760 } else if (leftValue) < (rightValue) { 2761 return -1, true 2762 } else { 2763 return 1, true 2764 } 2765 default: 2766 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpv.selector)) 2767 } 2768 } 2769 2770 func (fpv *NotificationStateNotificationState_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2771 return fpv.CompareWith(source.(*Notification_State_NotificationState)) 2772 } 2773 2774 type NotificationStateNotificationState_FieldSubPathValue struct { 2775 NotificationStateNotificationState_FieldPath 2776 subPathValue gotenobject.FieldPathValue 2777 } 2778 2779 var _ NotificationStateNotificationState_FieldPathValue = (*NotificationStateNotificationState_FieldSubPathValue)(nil) 2780 2781 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) AsProviderDataPathValue() (NotificationStateNotificationStateProviderData_FieldPathValue, bool) { 2782 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderData_FieldPathValue) 2783 return res, ok 2784 } 2785 2786 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) SetTo(target **Notification_State_NotificationState) { 2787 if *target == nil { 2788 *target = new(Notification_State_NotificationState) 2789 } 2790 switch fpvs.Selector() { 2791 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2792 fpvs.subPathValue.(NotificationStateNotificationStateProviderData_FieldPathValue).SetTo(&(*target).ProviderData) 2793 default: 2794 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpvs.Selector())) 2795 } 2796 } 2797 2798 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) SetToRaw(target proto.Message) { 2799 typedObject := target.(*Notification_State_NotificationState) 2800 fpvs.SetTo(&typedObject) 2801 } 2802 2803 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) GetRawValue() interface{} { 2804 return fpvs.subPathValue.GetRawValue() 2805 } 2806 2807 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) CompareWith(source *Notification_State_NotificationState) (int, bool) { 2808 switch fpvs.Selector() { 2809 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2810 return fpvs.subPathValue.(NotificationStateNotificationStateProviderData_FieldPathValue).CompareWith(source.GetProviderData()) 2811 default: 2812 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpvs.Selector())) 2813 } 2814 } 2815 2816 func (fpvs *NotificationStateNotificationState_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2817 return fpvs.CompareWith(source.(*Notification_State_NotificationState)) 2818 } 2819 2820 // NotificationStateNotificationState_FieldPathArrayItemValue allows storing single item in Path-specific values for NotificationState according to their type 2821 // Present only for array (repeated) types. 2822 type NotificationStateNotificationState_FieldPathArrayItemValue interface { 2823 gotenobject.FieldPathArrayItemValue 2824 NotificationStateNotificationState_FieldPath 2825 ContainsValue(*Notification_State_NotificationState) bool 2826 } 2827 2828 // ParseNotificationStateNotificationState_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2829 func ParseNotificationStateNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationState_FieldPathArrayItemValue, error) { 2830 fp, err := ParseNotificationStateNotificationState_FieldPath(pathStr) 2831 if err != nil { 2832 return nil, err 2833 } 2834 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2835 if err != nil { 2836 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationState field path array item value from %s: %v", valueStr, err) 2837 } 2838 return fpaiv.(NotificationStateNotificationState_FieldPathArrayItemValue), nil 2839 } 2840 2841 func MustParseNotificationStateNotificationState_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationState_FieldPathArrayItemValue { 2842 fpaiv, err := ParseNotificationStateNotificationState_FieldPathArrayItemValue(pathStr, valueStr) 2843 if err != nil { 2844 panic(err) 2845 } 2846 return fpaiv 2847 } 2848 2849 type NotificationStateNotificationState_FieldTerminalPathArrayItemValue struct { 2850 NotificationStateNotificationState_FieldTerminalPath 2851 value interface{} 2852 } 2853 2854 var _ NotificationStateNotificationState_FieldPathArrayItemValue = (*NotificationStateNotificationState_FieldTerminalPathArrayItemValue)(nil) 2855 2856 // GetRawValue returns stored element value for array in object Notification_State_NotificationState as interface{} 2857 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2858 return fpaiv.value 2859 } 2860 2861 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState) (interface{}, bool) { 2862 return nil, false 2863 } 2864 2865 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2866 return fpaiv.GetSingle(source.(*Notification_State_NotificationState)) 2867 } 2868 2869 // Contains returns a boolean indicating if value that is being held is present in given 'NotificationState' 2870 func (fpaiv *NotificationStateNotificationState_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState) bool { 2871 slice := fpaiv.NotificationStateNotificationState_FieldTerminalPath.Get(source) 2872 for _, v := range slice { 2873 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2874 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2875 return true 2876 } 2877 } else if reflect.DeepEqual(v, fpaiv.value) { 2878 return true 2879 } 2880 } 2881 return false 2882 } 2883 2884 type NotificationStateNotificationState_FieldSubPathArrayItemValue struct { 2885 NotificationStateNotificationState_FieldPath 2886 subPathItemValue gotenobject.FieldPathArrayItemValue 2887 } 2888 2889 // GetRawValue returns stored array item value 2890 func (fpaivs *NotificationStateNotificationState_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2891 return fpaivs.subPathItemValue.GetRawItemValue() 2892 } 2893 func (fpaivs *NotificationStateNotificationState_FieldSubPathArrayItemValue) AsProviderDataPathItemValue() (NotificationStateNotificationStateProviderData_FieldPathArrayItemValue, bool) { 2894 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderData_FieldPathArrayItemValue) 2895 return res, ok 2896 } 2897 2898 // Contains returns a boolean indicating if value that is being held is present in given 'NotificationState' 2899 func (fpaivs *NotificationStateNotificationState_FieldSubPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState) bool { 2900 switch fpaivs.Selector() { 2901 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2902 return fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderData_FieldPathArrayItemValue).ContainsValue(source.GetProviderData()) 2903 default: 2904 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState: %d", fpaivs.Selector())) 2905 } 2906 } 2907 2908 // NotificationStateNotificationState_FieldPathArrayOfValues allows storing slice of values for NotificationState fields according to their type 2909 type NotificationStateNotificationState_FieldPathArrayOfValues interface { 2910 gotenobject.FieldPathArrayOfValues 2911 NotificationStateNotificationState_FieldPath 2912 } 2913 2914 func ParseNotificationStateNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationState_FieldPathArrayOfValues, error) { 2915 fp, err := ParseNotificationStateNotificationState_FieldPath(pathStr) 2916 if err != nil { 2917 return nil, err 2918 } 2919 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2920 if err != nil { 2921 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationState field path array of values from %s: %v", valuesStr, err) 2922 } 2923 return fpaov.(NotificationStateNotificationState_FieldPathArrayOfValues), nil 2924 } 2925 2926 func MustParseNotificationStateNotificationState_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationState_FieldPathArrayOfValues { 2927 fpaov, err := ParseNotificationStateNotificationState_FieldPathArrayOfValues(pathStr, valuesStr) 2928 if err != nil { 2929 panic(err) 2930 } 2931 return fpaov 2932 } 2933 2934 type NotificationStateNotificationState_FieldTerminalPathArrayOfValues struct { 2935 NotificationStateNotificationState_FieldTerminalPath 2936 values interface{} 2937 } 2938 2939 var _ NotificationStateNotificationState_FieldPathArrayOfValues = (*NotificationStateNotificationState_FieldTerminalPathArrayOfValues)(nil) 2940 2941 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2942 switch fpaov.selector { 2943 case NotificationStateNotificationState_FieldPathSelectorNotificationChannel: 2944 for _, v := range fpaov.values.([]*notification_channel.Name) { 2945 values = append(values, v) 2946 } 2947 case NotificationStateNotificationState_FieldPathSelectorStatus: 2948 for _, v := range fpaov.values.([]Notification_State_NotificationState_Status) { 2949 values = append(values, v) 2950 } 2951 case NotificationStateNotificationState_FieldPathSelectorError: 2952 for _, v := range fpaov.values.([]string) { 2953 values = append(values, v) 2954 } 2955 case NotificationStateNotificationState_FieldPathSelectorProviderData: 2956 for _, v := range fpaov.values.([]*Notification_State_NotificationState_ProviderData) { 2957 values = append(values, v) 2958 } 2959 case NotificationStateNotificationState_FieldPathSelectorNotifyAttempts: 2960 for _, v := range fpaov.values.([]int64) { 2961 values = append(values, v) 2962 } 2963 } 2964 return 2965 } 2966 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsNotificationChannelArrayOfValues() ([]*notification_channel.Name, bool) { 2967 res, ok := fpaov.values.([]*notification_channel.Name) 2968 return res, ok 2969 } 2970 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsStatusArrayOfValues() ([]Notification_State_NotificationState_Status, bool) { 2971 res, ok := fpaov.values.([]Notification_State_NotificationState_Status) 2972 return res, ok 2973 } 2974 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsErrorArrayOfValues() ([]string, bool) { 2975 res, ok := fpaov.values.([]string) 2976 return res, ok 2977 } 2978 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsProviderDataArrayOfValues() ([]*Notification_State_NotificationState_ProviderData, bool) { 2979 res, ok := fpaov.values.([]*Notification_State_NotificationState_ProviderData) 2980 return res, ok 2981 } 2982 func (fpaov *NotificationStateNotificationState_FieldTerminalPathArrayOfValues) AsNotifyAttemptsArrayOfValues() ([]int64, bool) { 2983 res, ok := fpaov.values.([]int64) 2984 return res, ok 2985 } 2986 2987 type NotificationStateNotificationState_FieldSubPathArrayOfValues struct { 2988 NotificationStateNotificationState_FieldPath 2989 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2990 } 2991 2992 var _ NotificationStateNotificationState_FieldPathArrayOfValues = (*NotificationStateNotificationState_FieldSubPathArrayOfValues)(nil) 2993 2994 func (fpsaov *NotificationStateNotificationState_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2995 return fpsaov.subPathArrayOfValues.GetRawValues() 2996 } 2997 func (fpsaov *NotificationStateNotificationState_FieldSubPathArrayOfValues) AsProviderDataPathArrayOfValues() (NotificationStateNotificationStateProviderData_FieldPathArrayOfValues, bool) { 2998 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderData_FieldPathArrayOfValues) 2999 return res, ok 3000 } 3001 3002 // FieldPath provides implementation to handle 3003 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3004 type NotificationStateNotificationStateProviderData_FieldPath interface { 3005 gotenobject.FieldPath 3006 Selector() NotificationStateNotificationStateProviderData_FieldPathSelector 3007 Get(source *Notification_State_NotificationState_ProviderData) []interface{} 3008 GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) 3009 ClearValue(item *Notification_State_NotificationState_ProviderData) 3010 3011 // Those methods build corresponding NotificationStateNotificationStateProviderData_FieldPathValue 3012 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3013 WithIValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathValue 3014 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues 3015 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue 3016 } 3017 3018 type NotificationStateNotificationStateProviderData_FieldPathSelector int32 3019 3020 const ( 3021 NotificationStateNotificationStateProviderData_FieldPathSelectorSlack NotificationStateNotificationStateProviderData_FieldPathSelector = 0 3022 NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty NotificationStateNotificationStateProviderData_FieldPathSelector = 1 3023 NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook NotificationStateNotificationStateProviderData_FieldPathSelector = 2 3024 ) 3025 3026 func (s NotificationStateNotificationStateProviderData_FieldPathSelector) String() string { 3027 switch s { 3028 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3029 return "slack" 3030 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3031 return "pager_duty" 3032 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3033 return "webhook" 3034 default: 3035 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", s)) 3036 } 3037 } 3038 3039 func BuildNotificationStateNotificationStateProviderData_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderData_FieldPath, error) { 3040 if len(fp) == 0 { 3041 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData") 3042 } 3043 if len(fp) == 1 { 3044 switch fp[0] { 3045 case "slack": 3046 return &NotificationStateNotificationStateProviderData_FieldTerminalPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorSlack}, nil 3047 case "pager_duty", "pagerDuty", "pager-duty": 3048 return &NotificationStateNotificationStateProviderData_FieldTerminalPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty}, nil 3049 case "webhook": 3050 return &NotificationStateNotificationStateProviderData_FieldTerminalPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook}, nil 3051 } 3052 } else { 3053 switch fp[0] { 3054 case "slack": 3055 if subpath, err := BuildNotificationStateNotificationStateProviderDataSlack_FieldPath(fp[1:]); err != nil { 3056 return nil, err 3057 } else { 3058 return &NotificationStateNotificationStateProviderData_FieldSubPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorSlack, subPath: subpath}, nil 3059 } 3060 case "pager_duty", "pagerDuty", "pager-duty": 3061 if subpath, err := BuildNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(fp[1:]); err != nil { 3062 return nil, err 3063 } else { 3064 return &NotificationStateNotificationStateProviderData_FieldSubPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty, subPath: subpath}, nil 3065 } 3066 case "webhook": 3067 if subpath, err := BuildNotificationStateNotificationStateProviderDataWebHook_FieldPath(fp[1:]); err != nil { 3068 return nil, err 3069 } else { 3070 return &NotificationStateNotificationStateProviderData_FieldSubPath{selector: NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook, subPath: subpath}, nil 3071 } 3072 } 3073 } 3074 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData", fp) 3075 } 3076 3077 func ParseNotificationStateNotificationStateProviderData_FieldPath(rawField string) (NotificationStateNotificationStateProviderData_FieldPath, error) { 3078 fp, err := gotenobject.ParseRawFieldPath(rawField) 3079 if err != nil { 3080 return nil, err 3081 } 3082 return BuildNotificationStateNotificationStateProviderData_FieldPath(fp) 3083 } 3084 3085 func MustParseNotificationStateNotificationStateProviderData_FieldPath(rawField string) NotificationStateNotificationStateProviderData_FieldPath { 3086 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(rawField) 3087 if err != nil { 3088 panic(err) 3089 } 3090 return fp 3091 } 3092 3093 type NotificationStateNotificationStateProviderData_FieldTerminalPath struct { 3094 selector NotificationStateNotificationStateProviderData_FieldPathSelector 3095 } 3096 3097 var _ NotificationStateNotificationStateProviderData_FieldPath = (*NotificationStateNotificationStateProviderData_FieldTerminalPath)(nil) 3098 3099 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderData_FieldPathSelector { 3100 return fp.selector 3101 } 3102 3103 // String returns path representation in proto convention 3104 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) String() string { 3105 return fp.selector.String() 3106 } 3107 3108 // JSONString returns path representation is JSON convention 3109 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) JSONString() string { 3110 return strcase.ToLowerCamel(fp.String()) 3111 } 3112 3113 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData 3114 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData) (values []interface{}) { 3115 if source != nil { 3116 switch fp.selector { 3117 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3118 if source.Slack != nil { 3119 values = append(values, source.Slack) 3120 } 3121 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3122 if source.PagerDuty != nil { 3123 values = append(values, source.PagerDuty) 3124 } 3125 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3126 if source.Webhook != nil { 3127 values = append(values, source.Webhook) 3128 } 3129 default: 3130 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 3131 } 3132 } 3133 return 3134 } 3135 3136 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3137 return fp.Get(source.(*Notification_State_NotificationState_ProviderData)) 3138 } 3139 3140 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData 3141 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) { 3142 switch fp.selector { 3143 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3144 res := source.GetSlack() 3145 return res, res != nil 3146 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3147 res := source.GetPagerDuty() 3148 return res, res != nil 3149 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3150 res := source.GetWebhook() 3151 return res, res != nil 3152 default: 3153 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 3154 } 3155 } 3156 3157 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3158 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData)) 3159 } 3160 3161 // GetDefault returns a default value of the field type 3162 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) GetDefault() interface{} { 3163 switch fp.selector { 3164 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3165 return (*Notification_State_NotificationState_ProviderData_Slack)(nil) 3166 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3167 return (*Notification_State_NotificationState_ProviderData_PagerDuty)(nil) 3168 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3169 return (*Notification_State_NotificationState_ProviderData_WebHook)(nil) 3170 default: 3171 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 3172 } 3173 } 3174 3175 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData) { 3176 if item != nil { 3177 switch fp.selector { 3178 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3179 item.Slack = nil 3180 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3181 item.PagerDuty = nil 3182 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3183 item.Webhook = nil 3184 default: 3185 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 3186 } 3187 } 3188 } 3189 3190 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3191 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData)) 3192 } 3193 3194 // IsLeaf - whether field path is holds simple value 3195 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) IsLeaf() bool { 3196 return false 3197 } 3198 3199 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3200 return []gotenobject.FieldPath{fp} 3201 } 3202 3203 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathValue { 3204 switch fp.selector { 3205 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3206 return &NotificationStateNotificationStateProviderData_FieldTerminalPathValue{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData_Slack)} 3207 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3208 return &NotificationStateNotificationStateProviderData_FieldTerminalPathValue{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData_PagerDuty)} 3209 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3210 return &NotificationStateNotificationStateProviderData_FieldTerminalPathValue{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData_WebHook)} 3211 default: 3212 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 3213 } 3214 } 3215 3216 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3217 return fp.WithIValue(value) 3218 } 3219 3220 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues { 3221 fpaov := &NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp} 3222 switch fp.selector { 3223 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3224 return &NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, values: values.([]*Notification_State_NotificationState_ProviderData_Slack)} 3225 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3226 return &NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, values: values.([]*Notification_State_NotificationState_ProviderData_PagerDuty)} 3227 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3228 return &NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderData_FieldTerminalPath: *fp, values: values.([]*Notification_State_NotificationState_ProviderData_WebHook)} 3229 default: 3230 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 3231 } 3232 return fpaov 3233 } 3234 3235 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3236 return fp.WithIArrayOfValues(values) 3237 } 3238 3239 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue { 3240 switch fp.selector { 3241 default: 3242 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fp.selector)) 3243 } 3244 } 3245 3246 func (fp *NotificationStateNotificationStateProviderData_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3247 return fp.WithIArrayItemValue(value) 3248 } 3249 3250 type NotificationStateNotificationStateProviderData_FieldSubPath struct { 3251 selector NotificationStateNotificationStateProviderData_FieldPathSelector 3252 subPath gotenobject.FieldPath 3253 } 3254 3255 var _ NotificationStateNotificationStateProviderData_FieldPath = (*NotificationStateNotificationStateProviderData_FieldSubPath)(nil) 3256 3257 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) Selector() NotificationStateNotificationStateProviderData_FieldPathSelector { 3258 return fps.selector 3259 } 3260 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) AsSlackSubPath() (NotificationStateNotificationStateProviderDataSlack_FieldPath, bool) { 3261 res, ok := fps.subPath.(NotificationStateNotificationStateProviderDataSlack_FieldPath) 3262 return res, ok 3263 } 3264 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) AsPagerDutySubPath() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPath, bool) { 3265 res, ok := fps.subPath.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPath) 3266 return res, ok 3267 } 3268 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) AsWebhookSubPath() (NotificationStateNotificationStateProviderDataWebHook_FieldPath, bool) { 3269 res, ok := fps.subPath.(NotificationStateNotificationStateProviderDataWebHook_FieldPath) 3270 return res, ok 3271 } 3272 3273 // String returns path representation in proto convention 3274 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) String() string { 3275 return fps.selector.String() + "." + fps.subPath.String() 3276 } 3277 3278 // JSONString returns path representation is JSON convention 3279 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) JSONString() string { 3280 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 3281 } 3282 3283 // Get returns all values pointed by selected field from source Notification_State_NotificationState_ProviderData 3284 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) Get(source *Notification_State_NotificationState_ProviderData) (values []interface{}) { 3285 switch fps.selector { 3286 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3287 values = append(values, fps.subPath.GetRaw(source.GetSlack())...) 3288 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3289 values = append(values, fps.subPath.GetRaw(source.GetPagerDuty())...) 3290 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3291 values = append(values, fps.subPath.GetRaw(source.GetWebhook())...) 3292 default: 3293 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fps.selector)) 3294 } 3295 return 3296 } 3297 3298 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetRaw(source proto.Message) []interface{} { 3299 return fps.Get(source.(*Notification_State_NotificationState_ProviderData)) 3300 } 3301 3302 // GetSingle returns value of selected field from source Notification_State_NotificationState_ProviderData 3303 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) { 3304 switch fps.selector { 3305 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3306 if source.GetSlack() == nil { 3307 return nil, false 3308 } 3309 return fps.subPath.GetSingleRaw(source.GetSlack()) 3310 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3311 if source.GetPagerDuty() == nil { 3312 return nil, false 3313 } 3314 return fps.subPath.GetSingleRaw(source.GetPagerDuty()) 3315 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3316 if source.GetWebhook() == nil { 3317 return nil, false 3318 } 3319 return fps.subPath.GetSingleRaw(source.GetWebhook()) 3320 default: 3321 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fps.selector)) 3322 } 3323 } 3324 3325 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3326 return fps.GetSingle(source.(*Notification_State_NotificationState_ProviderData)) 3327 } 3328 3329 // GetDefault returns a default value of the field type 3330 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) GetDefault() interface{} { 3331 return fps.subPath.GetDefault() 3332 } 3333 3334 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) ClearValue(item *Notification_State_NotificationState_ProviderData) { 3335 if item != nil { 3336 switch fps.selector { 3337 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3338 fps.subPath.ClearValueRaw(item.Slack) 3339 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3340 fps.subPath.ClearValueRaw(item.PagerDuty) 3341 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3342 fps.subPath.ClearValueRaw(item.Webhook) 3343 default: 3344 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fps.selector)) 3345 } 3346 } 3347 } 3348 3349 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) ClearValueRaw(item proto.Message) { 3350 fps.ClearValue(item.(*Notification_State_NotificationState_ProviderData)) 3351 } 3352 3353 // IsLeaf - whether field path is holds simple value 3354 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) IsLeaf() bool { 3355 return fps.subPath.IsLeaf() 3356 } 3357 3358 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3359 iPaths := []gotenobject.FieldPath{&NotificationStateNotificationStateProviderData_FieldTerminalPath{selector: fps.selector}} 3360 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 3361 return iPaths 3362 } 3363 3364 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathValue { 3365 return &NotificationStateNotificationStateProviderData_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 3366 } 3367 3368 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3369 return fps.WithIValue(value) 3370 } 3371 3372 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues { 3373 return &NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 3374 } 3375 3376 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3377 return fps.WithIArrayOfValues(values) 3378 } 3379 3380 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue { 3381 return &NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 3382 } 3383 3384 func (fps *NotificationStateNotificationStateProviderData_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3385 return fps.WithIArrayItemValue(value) 3386 } 3387 3388 // NotificationStateNotificationStateProviderData_FieldPathValue allows storing values for ProviderData fields according to their type 3389 type NotificationStateNotificationStateProviderData_FieldPathValue interface { 3390 NotificationStateNotificationStateProviderData_FieldPath 3391 gotenobject.FieldPathValue 3392 SetTo(target **Notification_State_NotificationState_ProviderData) 3393 CompareWith(*Notification_State_NotificationState_ProviderData) (cmp int, comparable bool) 3394 } 3395 3396 func ParseNotificationStateNotificationStateProviderData_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderData_FieldPathValue, error) { 3397 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(pathStr) 3398 if err != nil { 3399 return nil, err 3400 } 3401 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3402 if err != nil { 3403 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProviderData field path value from %s: %v", valueStr, err) 3404 } 3405 return fpv.(NotificationStateNotificationStateProviderData_FieldPathValue), nil 3406 } 3407 3408 func MustParseNotificationStateNotificationStateProviderData_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderData_FieldPathValue { 3409 fpv, err := ParseNotificationStateNotificationStateProviderData_FieldPathValue(pathStr, valueStr) 3410 if err != nil { 3411 panic(err) 3412 } 3413 return fpv 3414 } 3415 3416 type NotificationStateNotificationStateProviderData_FieldTerminalPathValue struct { 3417 NotificationStateNotificationStateProviderData_FieldTerminalPath 3418 value interface{} 3419 } 3420 3421 var _ NotificationStateNotificationStateProviderData_FieldPathValue = (*NotificationStateNotificationStateProviderData_FieldTerminalPathValue)(nil) 3422 3423 // GetRawValue returns raw value stored under selected path for 'ProviderData' as interface{} 3424 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) GetRawValue() interface{} { 3425 return fpv.value 3426 } 3427 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) AsSlackValue() (*Notification_State_NotificationState_ProviderData_Slack, bool) { 3428 res, ok := fpv.value.(*Notification_State_NotificationState_ProviderData_Slack) 3429 return res, ok 3430 } 3431 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) AsPagerDutyValue() (*Notification_State_NotificationState_ProviderData_PagerDuty, bool) { 3432 res, ok := fpv.value.(*Notification_State_NotificationState_ProviderData_PagerDuty) 3433 return res, ok 3434 } 3435 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) AsWebhookValue() (*Notification_State_NotificationState_ProviderData_WebHook, bool) { 3436 res, ok := fpv.value.(*Notification_State_NotificationState_ProviderData_WebHook) 3437 return res, ok 3438 } 3439 3440 // SetTo stores value for selected field for object ProviderData 3441 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData) { 3442 if *target == nil { 3443 *target = new(Notification_State_NotificationState_ProviderData) 3444 } 3445 switch fpv.selector { 3446 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3447 (*target).Slack = fpv.value.(*Notification_State_NotificationState_ProviderData_Slack) 3448 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3449 (*target).PagerDuty = fpv.value.(*Notification_State_NotificationState_ProviderData_PagerDuty) 3450 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3451 (*target).Webhook = fpv.value.(*Notification_State_NotificationState_ProviderData_WebHook) 3452 default: 3453 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpv.selector)) 3454 } 3455 } 3456 3457 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3458 typedObject := target.(*Notification_State_NotificationState_ProviderData) 3459 fpv.SetTo(&typedObject) 3460 } 3461 3462 // CompareWith compares value in the 'NotificationStateNotificationStateProviderData_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData'. 3463 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData) (int, bool) { 3464 switch fpv.selector { 3465 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3466 return 0, false 3467 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3468 return 0, false 3469 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3470 return 0, false 3471 default: 3472 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpv.selector)) 3473 } 3474 } 3475 3476 func (fpv *NotificationStateNotificationStateProviderData_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3477 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData)) 3478 } 3479 3480 type NotificationStateNotificationStateProviderData_FieldSubPathValue struct { 3481 NotificationStateNotificationStateProviderData_FieldPath 3482 subPathValue gotenobject.FieldPathValue 3483 } 3484 3485 var _ NotificationStateNotificationStateProviderData_FieldPathValue = (*NotificationStateNotificationStateProviderData_FieldSubPathValue)(nil) 3486 3487 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) AsSlackPathValue() (NotificationStateNotificationStateProviderDataSlack_FieldPathValue, bool) { 3488 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue) 3489 return res, ok 3490 } 3491 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) AsPagerDutyPathValue() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue, bool) { 3492 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue) 3493 return res, ok 3494 } 3495 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) AsWebhookPathValue() (NotificationStateNotificationStateProviderDataWebHook_FieldPathValue, bool) { 3496 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderDataWebHook_FieldPathValue) 3497 return res, ok 3498 } 3499 3500 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) SetTo(target **Notification_State_NotificationState_ProviderData) { 3501 if *target == nil { 3502 *target = new(Notification_State_NotificationState_ProviderData) 3503 } 3504 switch fpvs.Selector() { 3505 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3506 fpvs.subPathValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue).SetTo(&(*target).Slack) 3507 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3508 fpvs.subPathValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue).SetTo(&(*target).PagerDuty) 3509 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3510 fpvs.subPathValue.(NotificationStateNotificationStateProviderDataWebHook_FieldPathValue).SetTo(&(*target).Webhook) 3511 default: 3512 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpvs.Selector())) 3513 } 3514 } 3515 3516 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) SetToRaw(target proto.Message) { 3517 typedObject := target.(*Notification_State_NotificationState_ProviderData) 3518 fpvs.SetTo(&typedObject) 3519 } 3520 3521 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) GetRawValue() interface{} { 3522 return fpvs.subPathValue.GetRawValue() 3523 } 3524 3525 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData) (int, bool) { 3526 switch fpvs.Selector() { 3527 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3528 return fpvs.subPathValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue).CompareWith(source.GetSlack()) 3529 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3530 return fpvs.subPathValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue).CompareWith(source.GetPagerDuty()) 3531 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3532 return fpvs.subPathValue.(NotificationStateNotificationStateProviderDataWebHook_FieldPathValue).CompareWith(source.GetWebhook()) 3533 default: 3534 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpvs.Selector())) 3535 } 3536 } 3537 3538 func (fpvs *NotificationStateNotificationStateProviderData_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3539 return fpvs.CompareWith(source.(*Notification_State_NotificationState_ProviderData)) 3540 } 3541 3542 // NotificationStateNotificationStateProviderData_FieldPathArrayItemValue allows storing single item in Path-specific values for ProviderData according to their type 3543 // Present only for array (repeated) types. 3544 type NotificationStateNotificationStateProviderData_FieldPathArrayItemValue interface { 3545 gotenobject.FieldPathArrayItemValue 3546 NotificationStateNotificationStateProviderData_FieldPath 3547 ContainsValue(*Notification_State_NotificationState_ProviderData) bool 3548 } 3549 3550 // ParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3551 func ParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderData_FieldPathArrayItemValue, error) { 3552 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(pathStr) 3553 if err != nil { 3554 return nil, err 3555 } 3556 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3557 if err != nil { 3558 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProviderData field path array item value from %s: %v", valueStr, err) 3559 } 3560 return fpaiv.(NotificationStateNotificationStateProviderData_FieldPathArrayItemValue), nil 3561 } 3562 3563 func MustParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderData_FieldPathArrayItemValue { 3564 fpaiv, err := ParseNotificationStateNotificationStateProviderData_FieldPathArrayItemValue(pathStr, valueStr) 3565 if err != nil { 3566 panic(err) 3567 } 3568 return fpaiv 3569 } 3570 3571 type NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue struct { 3572 NotificationStateNotificationStateProviderData_FieldTerminalPath 3573 value interface{} 3574 } 3575 3576 var _ NotificationStateNotificationStateProviderData_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue)(nil) 3577 3578 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData as interface{} 3579 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3580 return fpaiv.value 3581 } 3582 3583 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData) (interface{}, bool) { 3584 return nil, false 3585 } 3586 3587 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3588 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData)) 3589 } 3590 3591 // Contains returns a boolean indicating if value that is being held is present in given 'ProviderData' 3592 func (fpaiv *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData) bool { 3593 slice := fpaiv.NotificationStateNotificationStateProviderData_FieldTerminalPath.Get(source) 3594 for _, v := range slice { 3595 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3596 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3597 return true 3598 } 3599 } else if reflect.DeepEqual(v, fpaiv.value) { 3600 return true 3601 } 3602 } 3603 return false 3604 } 3605 3606 type NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue struct { 3607 NotificationStateNotificationStateProviderData_FieldPath 3608 subPathItemValue gotenobject.FieldPathArrayItemValue 3609 } 3610 3611 // GetRawValue returns stored array item value 3612 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 3613 return fpaivs.subPathItemValue.GetRawItemValue() 3614 } 3615 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) AsSlackPathItemValue() (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue, bool) { 3616 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue) 3617 return res, ok 3618 } 3619 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) AsPagerDutyPathItemValue() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue, bool) { 3620 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue) 3621 return res, ok 3622 } 3623 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) AsWebhookPathItemValue() (NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue, bool) { 3624 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue) 3625 return res, ok 3626 } 3627 3628 // Contains returns a boolean indicating if value that is being held is present in given 'ProviderData' 3629 func (fpaivs *NotificationStateNotificationStateProviderData_FieldSubPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData) bool { 3630 switch fpaivs.Selector() { 3631 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3632 return fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue).ContainsValue(source.GetSlack()) 3633 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3634 return fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue).ContainsValue(source.GetPagerDuty()) 3635 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3636 return fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue).ContainsValue(source.GetWebhook()) 3637 default: 3638 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData: %d", fpaivs.Selector())) 3639 } 3640 } 3641 3642 // NotificationStateNotificationStateProviderData_FieldPathArrayOfValues allows storing slice of values for ProviderData fields according to their type 3643 type NotificationStateNotificationStateProviderData_FieldPathArrayOfValues interface { 3644 gotenobject.FieldPathArrayOfValues 3645 NotificationStateNotificationStateProviderData_FieldPath 3646 } 3647 3648 func ParseNotificationStateNotificationStateProviderData_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderData_FieldPathArrayOfValues, error) { 3649 fp, err := ParseNotificationStateNotificationStateProviderData_FieldPath(pathStr) 3650 if err != nil { 3651 return nil, err 3652 } 3653 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3654 if err != nil { 3655 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProviderData field path array of values from %s: %v", valuesStr, err) 3656 } 3657 return fpaov.(NotificationStateNotificationStateProviderData_FieldPathArrayOfValues), nil 3658 } 3659 3660 func MustParseNotificationStateNotificationStateProviderData_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderData_FieldPathArrayOfValues { 3661 fpaov, err := ParseNotificationStateNotificationStateProviderData_FieldPathArrayOfValues(pathStr, valuesStr) 3662 if err != nil { 3663 panic(err) 3664 } 3665 return fpaov 3666 } 3667 3668 type NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues struct { 3669 NotificationStateNotificationStateProviderData_FieldTerminalPath 3670 values interface{} 3671 } 3672 3673 var _ NotificationStateNotificationStateProviderData_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues)(nil) 3674 3675 func (fpaov *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3676 switch fpaov.selector { 3677 case NotificationStateNotificationStateProviderData_FieldPathSelectorSlack: 3678 for _, v := range fpaov.values.([]*Notification_State_NotificationState_ProviderData_Slack) { 3679 values = append(values, v) 3680 } 3681 case NotificationStateNotificationStateProviderData_FieldPathSelectorPagerDuty: 3682 for _, v := range fpaov.values.([]*Notification_State_NotificationState_ProviderData_PagerDuty) { 3683 values = append(values, v) 3684 } 3685 case NotificationStateNotificationStateProviderData_FieldPathSelectorWebhook: 3686 for _, v := range fpaov.values.([]*Notification_State_NotificationState_ProviderData_WebHook) { 3687 values = append(values, v) 3688 } 3689 } 3690 return 3691 } 3692 func (fpaov *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues) AsSlackArrayOfValues() ([]*Notification_State_NotificationState_ProviderData_Slack, bool) { 3693 res, ok := fpaov.values.([]*Notification_State_NotificationState_ProviderData_Slack) 3694 return res, ok 3695 } 3696 func (fpaov *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues) AsPagerDutyArrayOfValues() ([]*Notification_State_NotificationState_ProviderData_PagerDuty, bool) { 3697 res, ok := fpaov.values.([]*Notification_State_NotificationState_ProviderData_PagerDuty) 3698 return res, ok 3699 } 3700 func (fpaov *NotificationStateNotificationStateProviderData_FieldTerminalPathArrayOfValues) AsWebhookArrayOfValues() ([]*Notification_State_NotificationState_ProviderData_WebHook, bool) { 3701 res, ok := fpaov.values.([]*Notification_State_NotificationState_ProviderData_WebHook) 3702 return res, ok 3703 } 3704 3705 type NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues struct { 3706 NotificationStateNotificationStateProviderData_FieldPath 3707 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 3708 } 3709 3710 var _ NotificationStateNotificationStateProviderData_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues)(nil) 3711 3712 func (fpsaov *NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 3713 return fpsaov.subPathArrayOfValues.GetRawValues() 3714 } 3715 func (fpsaov *NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues) AsSlackPathArrayOfValues() (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues, bool) { 3716 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues) 3717 return res, ok 3718 } 3719 func (fpsaov *NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues) AsPagerDutyPathArrayOfValues() (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues, bool) { 3720 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues) 3721 return res, ok 3722 } 3723 func (fpsaov *NotificationStateNotificationStateProviderData_FieldSubPathArrayOfValues) AsWebhookPathArrayOfValues() (NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues, bool) { 3724 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues) 3725 return res, ok 3726 } 3727 3728 // FieldPath provides implementation to handle 3729 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3730 type NotificationStateNotificationStateProviderDataSlack_FieldPath interface { 3731 gotenobject.FieldPath 3732 Selector() NotificationStateNotificationStateProviderDataSlack_FieldPathSelector 3733 Get(source *Notification_State_NotificationState_ProviderData_Slack) []interface{} 3734 GetSingle(source *Notification_State_NotificationState_ProviderData_Slack) (interface{}, bool) 3735 ClearValue(item *Notification_State_NotificationState_ProviderData_Slack) 3736 3737 // Those methods build corresponding NotificationStateNotificationStateProviderDataSlack_FieldPathValue 3738 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3739 WithIValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathValue 3740 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues 3741 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue 3742 } 3743 3744 type NotificationStateNotificationStateProviderDataSlack_FieldPathSelector int32 3745 3746 const ( 3747 NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs NotificationStateNotificationStateProviderDataSlack_FieldPathSelector = 0 3748 ) 3749 3750 func (s NotificationStateNotificationStateProviderDataSlack_FieldPathSelector) String() string { 3751 switch s { 3752 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3753 return "ts" 3754 default: 3755 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", s)) 3756 } 3757 } 3758 3759 func BuildNotificationStateNotificationStateProviderDataSlack_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderDataSlack_FieldPath, error) { 3760 if len(fp) == 0 { 3761 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData_Slack") 3762 } 3763 if len(fp) == 1 { 3764 switch fp[0] { 3765 case "ts": 3766 return &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs}, nil 3767 } 3768 } 3769 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData_Slack", fp) 3770 } 3771 3772 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(rawField string) (NotificationStateNotificationStateProviderDataSlack_FieldPath, error) { 3773 fp, err := gotenobject.ParseRawFieldPath(rawField) 3774 if err != nil { 3775 return nil, err 3776 } 3777 return BuildNotificationStateNotificationStateProviderDataSlack_FieldPath(fp) 3778 } 3779 3780 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPath(rawField string) NotificationStateNotificationStateProviderDataSlack_FieldPath { 3781 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(rawField) 3782 if err != nil { 3783 panic(err) 3784 } 3785 return fp 3786 } 3787 3788 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath struct { 3789 selector NotificationStateNotificationStateProviderDataSlack_FieldPathSelector 3790 } 3791 3792 var _ NotificationStateNotificationStateProviderDataSlack_FieldPath = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath)(nil) 3793 3794 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderDataSlack_FieldPathSelector { 3795 return fp.selector 3796 } 3797 3798 // String returns path representation in proto convention 3799 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) String() string { 3800 return fp.selector.String() 3801 } 3802 3803 // JSONString returns path representation is JSON convention 3804 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) JSONString() string { 3805 return strcase.ToLowerCamel(fp.String()) 3806 } 3807 3808 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData_Slack 3809 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData_Slack) (values []interface{}) { 3810 if source != nil { 3811 switch fp.selector { 3812 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3813 values = append(values, source.Ts) 3814 default: 3815 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3816 } 3817 } 3818 return 3819 } 3820 3821 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3822 return fp.Get(source.(*Notification_State_NotificationState_ProviderData_Slack)) 3823 } 3824 3825 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData_Slack 3826 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData_Slack) (interface{}, bool) { 3827 switch fp.selector { 3828 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3829 return source.GetTs(), source != nil 3830 default: 3831 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3832 } 3833 } 3834 3835 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3836 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData_Slack)) 3837 } 3838 3839 // GetDefault returns a default value of the field type 3840 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) GetDefault() interface{} { 3841 switch fp.selector { 3842 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3843 return "" 3844 default: 3845 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3846 } 3847 } 3848 3849 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData_Slack) { 3850 if item != nil { 3851 switch fp.selector { 3852 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3853 item.Ts = "" 3854 default: 3855 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3856 } 3857 } 3858 } 3859 3860 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3861 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData_Slack)) 3862 } 3863 3864 // IsLeaf - whether field path is holds simple value 3865 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) IsLeaf() bool { 3866 return fp.selector == NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs 3867 } 3868 3869 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3870 return []gotenobject.FieldPath{fp} 3871 } 3872 3873 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathValue { 3874 switch fp.selector { 3875 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3876 return &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath: *fp, value: value.(string)} 3877 default: 3878 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3879 } 3880 } 3881 3882 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3883 return fp.WithIValue(value) 3884 } 3885 3886 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues { 3887 fpaov := &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath: *fp} 3888 switch fp.selector { 3889 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3890 return &NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath: *fp, values: values.([]string)} 3891 default: 3892 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3893 } 3894 return fpaov 3895 } 3896 3897 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3898 return fp.WithIArrayOfValues(values) 3899 } 3900 3901 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue { 3902 switch fp.selector { 3903 default: 3904 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fp.selector)) 3905 } 3906 } 3907 3908 func (fp *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3909 return fp.WithIArrayItemValue(value) 3910 } 3911 3912 // NotificationStateNotificationStateProviderDataSlack_FieldPathValue allows storing values for Slack fields according to their type 3913 type NotificationStateNotificationStateProviderDataSlack_FieldPathValue interface { 3914 NotificationStateNotificationStateProviderDataSlack_FieldPath 3915 gotenobject.FieldPathValue 3916 SetTo(target **Notification_State_NotificationState_ProviderData_Slack) 3917 CompareWith(*Notification_State_NotificationState_ProviderData_Slack) (cmp int, comparable bool) 3918 } 3919 3920 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataSlack_FieldPathValue, error) { 3921 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(pathStr) 3922 if err != nil { 3923 return nil, err 3924 } 3925 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3926 if err != nil { 3927 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path value from %s: %v", valueStr, err) 3928 } 3929 return fpv.(NotificationStateNotificationStateProviderDataSlack_FieldPathValue), nil 3930 } 3931 3932 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataSlack_FieldPathValue { 3933 fpv, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPathValue(pathStr, valueStr) 3934 if err != nil { 3935 panic(err) 3936 } 3937 return fpv 3938 } 3939 3940 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue struct { 3941 NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath 3942 value interface{} 3943 } 3944 3945 var _ NotificationStateNotificationStateProviderDataSlack_FieldPathValue = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue)(nil) 3946 3947 // GetRawValue returns raw value stored under selected path for 'Slack' as interface{} 3948 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) GetRawValue() interface{} { 3949 return fpv.value 3950 } 3951 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) AsTsValue() (string, bool) { 3952 res, ok := fpv.value.(string) 3953 return res, ok 3954 } 3955 3956 // SetTo stores value for selected field for object Slack 3957 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData_Slack) { 3958 if *target == nil { 3959 *target = new(Notification_State_NotificationState_ProviderData_Slack) 3960 } 3961 switch fpv.selector { 3962 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3963 (*target).Ts = fpv.value.(string) 3964 default: 3965 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fpv.selector)) 3966 } 3967 } 3968 3969 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3970 typedObject := target.(*Notification_State_NotificationState_ProviderData_Slack) 3971 fpv.SetTo(&typedObject) 3972 } 3973 3974 // CompareWith compares value in the 'NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData_Slack'. 3975 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData_Slack) (int, bool) { 3976 switch fpv.selector { 3977 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 3978 leftValue := fpv.value.(string) 3979 rightValue := source.GetTs() 3980 if (leftValue) == (rightValue) { 3981 return 0, true 3982 } else if (leftValue) < (rightValue) { 3983 return -1, true 3984 } else { 3985 return 1, true 3986 } 3987 default: 3988 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_Slack: %d", fpv.selector)) 3989 } 3990 } 3991 3992 func (fpv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3993 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData_Slack)) 3994 } 3995 3996 // NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue allows storing single item in Path-specific values for Slack according to their type 3997 // Present only for array (repeated) types. 3998 type NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue interface { 3999 gotenobject.FieldPathArrayItemValue 4000 NotificationStateNotificationStateProviderDataSlack_FieldPath 4001 ContainsValue(*Notification_State_NotificationState_ProviderData_Slack) bool 4002 } 4003 4004 // ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4005 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue, error) { 4006 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(pathStr) 4007 if err != nil { 4008 return nil, err 4009 } 4010 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4011 if err != nil { 4012 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path array item value from %s: %v", valueStr, err) 4013 } 4014 return fpaiv.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue), nil 4015 } 4016 4017 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue { 4018 fpaiv, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue(pathStr, valueStr) 4019 if err != nil { 4020 panic(err) 4021 } 4022 return fpaiv 4023 } 4024 4025 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue struct { 4026 NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath 4027 value interface{} 4028 } 4029 4030 var _ NotificationStateNotificationStateProviderDataSlack_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue)(nil) 4031 4032 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData_Slack as interface{} 4033 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4034 return fpaiv.value 4035 } 4036 4037 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData_Slack) (interface{}, bool) { 4038 return nil, false 4039 } 4040 4041 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4042 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData_Slack)) 4043 } 4044 4045 // Contains returns a boolean indicating if value that is being held is present in given 'Slack' 4046 func (fpaiv *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData_Slack) bool { 4047 slice := fpaiv.NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath.Get(source) 4048 for _, v := range slice { 4049 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4050 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4051 return true 4052 } 4053 } else if reflect.DeepEqual(v, fpaiv.value) { 4054 return true 4055 } 4056 } 4057 return false 4058 } 4059 4060 // NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues allows storing slice of values for Slack fields according to their type 4061 type NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues interface { 4062 gotenobject.FieldPathArrayOfValues 4063 NotificationStateNotificationStateProviderDataSlack_FieldPath 4064 } 4065 4066 func ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues, error) { 4067 fp, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPath(pathStr) 4068 if err != nil { 4069 return nil, err 4070 } 4071 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4072 if err != nil { 4073 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path array of values from %s: %v", valuesStr, err) 4074 } 4075 return fpaov.(NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues), nil 4076 } 4077 4078 func MustParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues { 4079 fpaov, err := ParseNotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues(pathStr, valuesStr) 4080 if err != nil { 4081 panic(err) 4082 } 4083 return fpaov 4084 } 4085 4086 type NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues struct { 4087 NotificationStateNotificationStateProviderDataSlack_FieldTerminalPath 4088 values interface{} 4089 } 4090 4091 var _ NotificationStateNotificationStateProviderDataSlack_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues)(nil) 4092 4093 func (fpaov *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4094 switch fpaov.selector { 4095 case NotificationStateNotificationStateProviderDataSlack_FieldPathSelectorTs: 4096 for _, v := range fpaov.values.([]string) { 4097 values = append(values, v) 4098 } 4099 } 4100 return 4101 } 4102 func (fpaov *NotificationStateNotificationStateProviderDataSlack_FieldTerminalPathArrayOfValues) AsTsArrayOfValues() ([]string, bool) { 4103 res, ok := fpaov.values.([]string) 4104 return res, ok 4105 } 4106 4107 // FieldPath provides implementation to handle 4108 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4109 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPath interface { 4110 gotenobject.FieldPath 4111 Selector() NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector 4112 Get(source *Notification_State_NotificationState_ProviderData_PagerDuty) []interface{} 4113 GetSingle(source *Notification_State_NotificationState_ProviderData_PagerDuty) (interface{}, bool) 4114 ClearValue(item *Notification_State_NotificationState_ProviderData_PagerDuty) 4115 4116 // Those methods build corresponding NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue 4117 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4118 WithIValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue 4119 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues 4120 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue 4121 } 4122 4123 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector int32 4124 4125 const ( 4126 NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector = 0 4127 ) 4128 4129 func (s NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector) String() string { 4130 switch s { 4131 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4132 return "incident_key" 4133 default: 4134 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", s)) 4135 } 4136 } 4137 4138 func BuildNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPath, error) { 4139 if len(fp) == 0 { 4140 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData_PagerDuty") 4141 } 4142 if len(fp) == 1 { 4143 switch fp[0] { 4144 case "incident_key", "incidentKey", "incident-key": 4145 return &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey}, nil 4146 } 4147 } 4148 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData_PagerDuty", fp) 4149 } 4150 4151 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(rawField string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPath, error) { 4152 fp, err := gotenobject.ParseRawFieldPath(rawField) 4153 if err != nil { 4154 return nil, err 4155 } 4156 return BuildNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(fp) 4157 } 4158 4159 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(rawField string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPath { 4160 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(rawField) 4161 if err != nil { 4162 panic(err) 4163 } 4164 return fp 4165 } 4166 4167 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath struct { 4168 selector NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector 4169 } 4170 4171 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPath = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath)(nil) 4172 4173 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelector { 4174 return fp.selector 4175 } 4176 4177 // String returns path representation in proto convention 4178 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) String() string { 4179 return fp.selector.String() 4180 } 4181 4182 // JSONString returns path representation is JSON convention 4183 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) JSONString() string { 4184 return strcase.ToLowerCamel(fp.String()) 4185 } 4186 4187 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData_PagerDuty 4188 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData_PagerDuty) (values []interface{}) { 4189 if source != nil { 4190 switch fp.selector { 4191 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4192 values = append(values, source.IncidentKey) 4193 default: 4194 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 4195 } 4196 } 4197 return 4198 } 4199 4200 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4201 return fp.Get(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 4202 } 4203 4204 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData_PagerDuty 4205 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData_PagerDuty) (interface{}, bool) { 4206 switch fp.selector { 4207 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4208 return source.GetIncidentKey(), source != nil 4209 default: 4210 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 4211 } 4212 } 4213 4214 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4215 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 4216 } 4217 4218 // GetDefault returns a default value of the field type 4219 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) GetDefault() interface{} { 4220 switch fp.selector { 4221 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4222 return "" 4223 default: 4224 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 4225 } 4226 } 4227 4228 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData_PagerDuty) { 4229 if item != nil { 4230 switch fp.selector { 4231 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4232 item.IncidentKey = "" 4233 default: 4234 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 4235 } 4236 } 4237 } 4238 4239 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4240 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 4241 } 4242 4243 // IsLeaf - whether field path is holds simple value 4244 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) IsLeaf() bool { 4245 return fp.selector == NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey 4246 } 4247 4248 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4249 return []gotenobject.FieldPath{fp} 4250 } 4251 4252 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue { 4253 switch fp.selector { 4254 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4255 return &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath: *fp, value: value.(string)} 4256 default: 4257 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 4258 } 4259 } 4260 4261 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4262 return fp.WithIValue(value) 4263 } 4264 4265 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues { 4266 fpaov := &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath: *fp} 4267 switch fp.selector { 4268 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4269 return &NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath: *fp, values: values.([]string)} 4270 default: 4271 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 4272 } 4273 return fpaov 4274 } 4275 4276 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4277 return fp.WithIArrayOfValues(values) 4278 } 4279 4280 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue { 4281 switch fp.selector { 4282 default: 4283 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fp.selector)) 4284 } 4285 } 4286 4287 func (fp *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4288 return fp.WithIArrayItemValue(value) 4289 } 4290 4291 // NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue allows storing values for PagerDuty fields according to their type 4292 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue interface { 4293 NotificationStateNotificationStateProviderDataPagerDuty_FieldPath 4294 gotenobject.FieldPathValue 4295 SetTo(target **Notification_State_NotificationState_ProviderData_PagerDuty) 4296 CompareWith(*Notification_State_NotificationState_ProviderData_PagerDuty) (cmp int, comparable bool) 4297 } 4298 4299 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue, error) { 4300 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(pathStr) 4301 if err != nil { 4302 return nil, err 4303 } 4304 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4305 if err != nil { 4306 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path value from %s: %v", valueStr, err) 4307 } 4308 return fpv.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue), nil 4309 } 4310 4311 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue { 4312 fpv, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue(pathStr, valueStr) 4313 if err != nil { 4314 panic(err) 4315 } 4316 return fpv 4317 } 4318 4319 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue struct { 4320 NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath 4321 value interface{} 4322 } 4323 4324 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPathValue = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue)(nil) 4325 4326 // GetRawValue returns raw value stored under selected path for 'PagerDuty' as interface{} 4327 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) GetRawValue() interface{} { 4328 return fpv.value 4329 } 4330 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) AsIncidentKeyValue() (string, bool) { 4331 res, ok := fpv.value.(string) 4332 return res, ok 4333 } 4334 4335 // SetTo stores value for selected field for object PagerDuty 4336 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData_PagerDuty) { 4337 if *target == nil { 4338 *target = new(Notification_State_NotificationState_ProviderData_PagerDuty) 4339 } 4340 switch fpv.selector { 4341 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4342 (*target).IncidentKey = fpv.value.(string) 4343 default: 4344 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fpv.selector)) 4345 } 4346 } 4347 4348 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4349 typedObject := target.(*Notification_State_NotificationState_ProviderData_PagerDuty) 4350 fpv.SetTo(&typedObject) 4351 } 4352 4353 // CompareWith compares value in the 'NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData_PagerDuty'. 4354 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData_PagerDuty) (int, bool) { 4355 switch fpv.selector { 4356 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4357 leftValue := fpv.value.(string) 4358 rightValue := source.GetIncidentKey() 4359 if (leftValue) == (rightValue) { 4360 return 0, true 4361 } else if (leftValue) < (rightValue) { 4362 return -1, true 4363 } else { 4364 return 1, true 4365 } 4366 default: 4367 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_PagerDuty: %d", fpv.selector)) 4368 } 4369 } 4370 4371 func (fpv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4372 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 4373 } 4374 4375 // NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue allows storing single item in Path-specific values for PagerDuty according to their type 4376 // Present only for array (repeated) types. 4377 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue interface { 4378 gotenobject.FieldPathArrayItemValue 4379 NotificationStateNotificationStateProviderDataPagerDuty_FieldPath 4380 ContainsValue(*Notification_State_NotificationState_ProviderData_PagerDuty) bool 4381 } 4382 4383 // ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4384 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue, error) { 4385 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(pathStr) 4386 if err != nil { 4387 return nil, err 4388 } 4389 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4390 if err != nil { 4391 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path array item value from %s: %v", valueStr, err) 4392 } 4393 return fpaiv.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue), nil 4394 } 4395 4396 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue { 4397 fpaiv, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue(pathStr, valueStr) 4398 if err != nil { 4399 panic(err) 4400 } 4401 return fpaiv 4402 } 4403 4404 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue struct { 4405 NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath 4406 value interface{} 4407 } 4408 4409 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue)(nil) 4410 4411 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData_PagerDuty as interface{} 4412 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4413 return fpaiv.value 4414 } 4415 4416 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData_PagerDuty) (interface{}, bool) { 4417 return nil, false 4418 } 4419 4420 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4421 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData_PagerDuty)) 4422 } 4423 4424 // Contains returns a boolean indicating if value that is being held is present in given 'PagerDuty' 4425 func (fpaiv *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData_PagerDuty) bool { 4426 slice := fpaiv.NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath.Get(source) 4427 for _, v := range slice { 4428 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4429 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4430 return true 4431 } 4432 } else if reflect.DeepEqual(v, fpaiv.value) { 4433 return true 4434 } 4435 } 4436 return false 4437 } 4438 4439 // NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues allows storing slice of values for PagerDuty fields according to their type 4440 type NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues interface { 4441 gotenobject.FieldPathArrayOfValues 4442 NotificationStateNotificationStateProviderDataPagerDuty_FieldPath 4443 } 4444 4445 func ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues, error) { 4446 fp, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPath(pathStr) 4447 if err != nil { 4448 return nil, err 4449 } 4450 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4451 if err != nil { 4452 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path array of values from %s: %v", valuesStr, err) 4453 } 4454 return fpaov.(NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues), nil 4455 } 4456 4457 func MustParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues { 4458 fpaov, err := ParseNotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr) 4459 if err != nil { 4460 panic(err) 4461 } 4462 return fpaov 4463 } 4464 4465 type NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues struct { 4466 NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPath 4467 values interface{} 4468 } 4469 4470 var _ NotificationStateNotificationStateProviderDataPagerDuty_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues)(nil) 4471 4472 func (fpaov *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4473 switch fpaov.selector { 4474 case NotificationStateNotificationStateProviderDataPagerDuty_FieldPathSelectorIncidentKey: 4475 for _, v := range fpaov.values.([]string) { 4476 values = append(values, v) 4477 } 4478 } 4479 return 4480 } 4481 func (fpaov *NotificationStateNotificationStateProviderDataPagerDuty_FieldTerminalPathArrayOfValues) AsIncidentKeyArrayOfValues() ([]string, bool) { 4482 res, ok := fpaov.values.([]string) 4483 return res, ok 4484 } 4485 4486 // FieldPath provides implementation to handle 4487 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4488 type NotificationStateNotificationStateProviderDataWebHook_FieldPath interface { 4489 gotenobject.FieldPath 4490 Selector() NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector 4491 Get(source *Notification_State_NotificationState_ProviderData_WebHook) []interface{} 4492 GetSingle(source *Notification_State_NotificationState_ProviderData_WebHook) (interface{}, bool) 4493 ClearValue(item *Notification_State_NotificationState_ProviderData_WebHook) 4494 4495 // Those methods build corresponding NotificationStateNotificationStateProviderDataWebHook_FieldPathValue 4496 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4497 WithIValue(value interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathValue 4498 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues 4499 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue 4500 } 4501 4502 type NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector int32 4503 4504 const ( 4505 NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector = 0 4506 NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector = 1 4507 ) 4508 4509 func (s NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector) String() string { 4510 switch s { 4511 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4512 return "total_chunks" 4513 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4514 return "failed_chunks" 4515 default: 4516 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", s)) 4517 } 4518 } 4519 4520 func BuildNotificationStateNotificationStateProviderDataWebHook_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderDataWebHook_FieldPath, error) { 4521 if len(fp) == 0 { 4522 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData_WebHook") 4523 } 4524 if len(fp) == 1 { 4525 switch fp[0] { 4526 case "total_chunks", "totalChunks", "total-chunks": 4527 return &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks}, nil 4528 case "failed_chunks", "failedChunks", "failed-chunks": 4529 return &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks}, nil 4530 } 4531 } else { 4532 switch fp[0] { 4533 case "failed_chunks", "failedChunks", "failed-chunks": 4534 if subpath, err := BuildNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(fp[1:]); err != nil { 4535 return nil, err 4536 } else { 4537 return &NotificationStateNotificationStateProviderDataWebHook_FieldSubPath{selector: NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks, subPath: subpath}, nil 4538 } 4539 } 4540 } 4541 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData_WebHook", fp) 4542 } 4543 4544 func ParseNotificationStateNotificationStateProviderDataWebHook_FieldPath(rawField string) (NotificationStateNotificationStateProviderDataWebHook_FieldPath, error) { 4545 fp, err := gotenobject.ParseRawFieldPath(rawField) 4546 if err != nil { 4547 return nil, err 4548 } 4549 return BuildNotificationStateNotificationStateProviderDataWebHook_FieldPath(fp) 4550 } 4551 4552 func MustParseNotificationStateNotificationStateProviderDataWebHook_FieldPath(rawField string) NotificationStateNotificationStateProviderDataWebHook_FieldPath { 4553 fp, err := ParseNotificationStateNotificationStateProviderDataWebHook_FieldPath(rawField) 4554 if err != nil { 4555 panic(err) 4556 } 4557 return fp 4558 } 4559 4560 type NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath struct { 4561 selector NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector 4562 } 4563 4564 var _ NotificationStateNotificationStateProviderDataWebHook_FieldPath = (*NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath)(nil) 4565 4566 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector { 4567 return fp.selector 4568 } 4569 4570 // String returns path representation in proto convention 4571 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) String() string { 4572 return fp.selector.String() 4573 } 4574 4575 // JSONString returns path representation is JSON convention 4576 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) JSONString() string { 4577 return strcase.ToLowerCamel(fp.String()) 4578 } 4579 4580 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData_WebHook 4581 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData_WebHook) (values []interface{}) { 4582 if source != nil { 4583 switch fp.selector { 4584 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4585 values = append(values, source.TotalChunks) 4586 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4587 for _, value := range source.GetFailedChunks() { 4588 values = append(values, value) 4589 } 4590 default: 4591 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fp.selector)) 4592 } 4593 } 4594 return 4595 } 4596 4597 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4598 return fp.Get(source.(*Notification_State_NotificationState_ProviderData_WebHook)) 4599 } 4600 4601 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData_WebHook 4602 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData_WebHook) (interface{}, bool) { 4603 switch fp.selector { 4604 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4605 return source.GetTotalChunks(), source != nil 4606 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4607 res := source.GetFailedChunks() 4608 return res, res != nil 4609 default: 4610 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fp.selector)) 4611 } 4612 } 4613 4614 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4615 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData_WebHook)) 4616 } 4617 4618 // GetDefault returns a default value of the field type 4619 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) GetDefault() interface{} { 4620 switch fp.selector { 4621 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4622 return int64(0) 4623 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4624 return ([]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)(nil) 4625 default: 4626 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fp.selector)) 4627 } 4628 } 4629 4630 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData_WebHook) { 4631 if item != nil { 4632 switch fp.selector { 4633 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4634 item.TotalChunks = int64(0) 4635 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4636 item.FailedChunks = nil 4637 default: 4638 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fp.selector)) 4639 } 4640 } 4641 } 4642 4643 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4644 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData_WebHook)) 4645 } 4646 4647 // IsLeaf - whether field path is holds simple value 4648 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) IsLeaf() bool { 4649 return fp.selector == NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks 4650 } 4651 4652 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4653 return []gotenobject.FieldPath{fp} 4654 } 4655 4656 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathValue { 4657 switch fp.selector { 4658 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4659 return &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath: *fp, value: value.(int64)} 4660 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4661 return &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath: *fp, value: value.([]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)} 4662 default: 4663 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fp.selector)) 4664 } 4665 } 4666 4667 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4668 return fp.WithIValue(value) 4669 } 4670 4671 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues { 4672 fpaov := &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath: *fp} 4673 switch fp.selector { 4674 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4675 return &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath: *fp, values: values.([]int64)} 4676 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4677 return &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath: *fp, values: values.([][]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)} 4678 default: 4679 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fp.selector)) 4680 } 4681 return fpaov 4682 } 4683 4684 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4685 return fp.WithIArrayOfValues(values) 4686 } 4687 4688 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue { 4689 switch fp.selector { 4690 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4691 return &NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue{NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath: *fp, value: value.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)} 4692 default: 4693 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fp.selector)) 4694 } 4695 } 4696 4697 func (fp *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4698 return fp.WithIArrayItemValue(value) 4699 } 4700 4701 type NotificationStateNotificationStateProviderDataWebHook_FieldSubPath struct { 4702 selector NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector 4703 subPath gotenobject.FieldPath 4704 } 4705 4706 var _ NotificationStateNotificationStateProviderDataWebHook_FieldPath = (*NotificationStateNotificationStateProviderDataWebHook_FieldSubPath)(nil) 4707 4708 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) Selector() NotificationStateNotificationStateProviderDataWebHook_FieldPathSelector { 4709 return fps.selector 4710 } 4711 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) AsFailedChunksSubPath() (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath, bool) { 4712 res, ok := fps.subPath.(NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath) 4713 return res, ok 4714 } 4715 4716 // String returns path representation in proto convention 4717 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) String() string { 4718 return fps.selector.String() + "." + fps.subPath.String() 4719 } 4720 4721 // JSONString returns path representation is JSON convention 4722 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) JSONString() string { 4723 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 4724 } 4725 4726 // Get returns all values pointed by selected field from source Notification_State_NotificationState_ProviderData_WebHook 4727 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) Get(source *Notification_State_NotificationState_ProviderData_WebHook) (values []interface{}) { 4728 switch fps.selector { 4729 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4730 for _, item := range source.GetFailedChunks() { 4731 values = append(values, fps.subPath.GetRaw(item)...) 4732 } 4733 default: 4734 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fps.selector)) 4735 } 4736 return 4737 } 4738 4739 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) GetRaw(source proto.Message) []interface{} { 4740 return fps.Get(source.(*Notification_State_NotificationState_ProviderData_WebHook)) 4741 } 4742 4743 // GetSingle returns value of selected field from source Notification_State_NotificationState_ProviderData_WebHook 4744 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) GetSingle(source *Notification_State_NotificationState_ProviderData_WebHook) (interface{}, bool) { 4745 switch fps.selector { 4746 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4747 if len(source.GetFailedChunks()) == 0 { 4748 return nil, false 4749 } 4750 return fps.subPath.GetSingleRaw(source.GetFailedChunks()[0]) 4751 default: 4752 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fps.selector)) 4753 } 4754 } 4755 4756 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4757 return fps.GetSingle(source.(*Notification_State_NotificationState_ProviderData_WebHook)) 4758 } 4759 4760 // GetDefault returns a default value of the field type 4761 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) GetDefault() interface{} { 4762 return fps.subPath.GetDefault() 4763 } 4764 4765 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) ClearValue(item *Notification_State_NotificationState_ProviderData_WebHook) { 4766 if item != nil { 4767 switch fps.selector { 4768 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4769 for _, subItem := range item.FailedChunks { 4770 fps.subPath.ClearValueRaw(subItem) 4771 } 4772 default: 4773 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fps.selector)) 4774 } 4775 } 4776 } 4777 4778 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) ClearValueRaw(item proto.Message) { 4779 fps.ClearValue(item.(*Notification_State_NotificationState_ProviderData_WebHook)) 4780 } 4781 4782 // IsLeaf - whether field path is holds simple value 4783 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) IsLeaf() bool { 4784 return fps.subPath.IsLeaf() 4785 } 4786 4787 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4788 iPaths := []gotenobject.FieldPath{&NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath{selector: fps.selector}} 4789 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 4790 return iPaths 4791 } 4792 4793 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathValue { 4794 return &NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 4795 } 4796 4797 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4798 return fps.WithIValue(value) 4799 } 4800 4801 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues { 4802 return &NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 4803 } 4804 4805 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4806 return fps.WithIArrayOfValues(values) 4807 } 4808 4809 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue { 4810 return &NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 4811 } 4812 4813 func (fps *NotificationStateNotificationStateProviderDataWebHook_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4814 return fps.WithIArrayItemValue(value) 4815 } 4816 4817 // NotificationStateNotificationStateProviderDataWebHook_FieldPathValue allows storing values for WebHook fields according to their type 4818 type NotificationStateNotificationStateProviderDataWebHook_FieldPathValue interface { 4819 NotificationStateNotificationStateProviderDataWebHook_FieldPath 4820 gotenobject.FieldPathValue 4821 SetTo(target **Notification_State_NotificationState_ProviderData_WebHook) 4822 CompareWith(*Notification_State_NotificationState_ProviderData_WebHook) (cmp int, comparable bool) 4823 } 4824 4825 func ParseNotificationStateNotificationStateProviderDataWebHook_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataWebHook_FieldPathValue, error) { 4826 fp, err := ParseNotificationStateNotificationStateProviderDataWebHook_FieldPath(pathStr) 4827 if err != nil { 4828 return nil, err 4829 } 4830 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4831 if err != nil { 4832 return nil, status.Errorf(codes.InvalidArgument, "error parsing WebHook field path value from %s: %v", valueStr, err) 4833 } 4834 return fpv.(NotificationStateNotificationStateProviderDataWebHook_FieldPathValue), nil 4835 } 4836 4837 func MustParseNotificationStateNotificationStateProviderDataWebHook_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataWebHook_FieldPathValue { 4838 fpv, err := ParseNotificationStateNotificationStateProviderDataWebHook_FieldPathValue(pathStr, valueStr) 4839 if err != nil { 4840 panic(err) 4841 } 4842 return fpv 4843 } 4844 4845 type NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue struct { 4846 NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath 4847 value interface{} 4848 } 4849 4850 var _ NotificationStateNotificationStateProviderDataWebHook_FieldPathValue = (*NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue)(nil) 4851 4852 // GetRawValue returns raw value stored under selected path for 'WebHook' as interface{} 4853 func (fpv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue) GetRawValue() interface{} { 4854 return fpv.value 4855 } 4856 func (fpv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue) AsTotalChunksValue() (int64, bool) { 4857 res, ok := fpv.value.(int64) 4858 return res, ok 4859 } 4860 func (fpv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue) AsFailedChunksValue() ([]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks, bool) { 4861 res, ok := fpv.value.([]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 4862 return res, ok 4863 } 4864 4865 // SetTo stores value for selected field for object WebHook 4866 func (fpv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData_WebHook) { 4867 if *target == nil { 4868 *target = new(Notification_State_NotificationState_ProviderData_WebHook) 4869 } 4870 switch fpv.selector { 4871 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4872 (*target).TotalChunks = fpv.value.(int64) 4873 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4874 (*target).FailedChunks = fpv.value.([]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 4875 default: 4876 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fpv.selector)) 4877 } 4878 } 4879 4880 func (fpv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4881 typedObject := target.(*Notification_State_NotificationState_ProviderData_WebHook) 4882 fpv.SetTo(&typedObject) 4883 } 4884 4885 // CompareWith compares value in the 'NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData_WebHook'. 4886 func (fpv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData_WebHook) (int, bool) { 4887 switch fpv.selector { 4888 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 4889 leftValue := fpv.value.(int64) 4890 rightValue := source.GetTotalChunks() 4891 if (leftValue) == (rightValue) { 4892 return 0, true 4893 } else if (leftValue) < (rightValue) { 4894 return -1, true 4895 } else { 4896 return 1, true 4897 } 4898 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4899 return 0, false 4900 default: 4901 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fpv.selector)) 4902 } 4903 } 4904 4905 func (fpv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4906 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData_WebHook)) 4907 } 4908 4909 type NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue struct { 4910 NotificationStateNotificationStateProviderDataWebHook_FieldPath 4911 subPathValue gotenobject.FieldPathValue 4912 } 4913 4914 var _ NotificationStateNotificationStateProviderDataWebHook_FieldPathValue = (*NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue)(nil) 4915 4916 func (fpvs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue) AsFailedChunksPathValue() (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue, bool) { 4917 res, ok := fpvs.subPathValue.(NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue) 4918 return res, ok 4919 } 4920 4921 func (fpvs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue) SetTo(target **Notification_State_NotificationState_ProviderData_WebHook) { 4922 if *target == nil { 4923 *target = new(Notification_State_NotificationState_ProviderData_WebHook) 4924 } 4925 switch fpvs.Selector() { 4926 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4927 panic("FieldPath setter is unsupported for array subpaths") 4928 default: 4929 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fpvs.Selector())) 4930 } 4931 } 4932 4933 func (fpvs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue) SetToRaw(target proto.Message) { 4934 typedObject := target.(*Notification_State_NotificationState_ProviderData_WebHook) 4935 fpvs.SetTo(&typedObject) 4936 } 4937 4938 func (fpvs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue) GetRawValue() interface{} { 4939 return fpvs.subPathValue.GetRawValue() 4940 } 4941 4942 func (fpvs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData_WebHook) (int, bool) { 4943 switch fpvs.Selector() { 4944 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 4945 return 0, false // repeated field 4946 default: 4947 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fpvs.Selector())) 4948 } 4949 } 4950 4951 func (fpvs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4952 return fpvs.CompareWith(source.(*Notification_State_NotificationState_ProviderData_WebHook)) 4953 } 4954 4955 // NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue allows storing single item in Path-specific values for WebHook according to their type 4956 // Present only for array (repeated) types. 4957 type NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue interface { 4958 gotenobject.FieldPathArrayItemValue 4959 NotificationStateNotificationStateProviderDataWebHook_FieldPath 4960 ContainsValue(*Notification_State_NotificationState_ProviderData_WebHook) bool 4961 } 4962 4963 // ParseNotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4964 func ParseNotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue, error) { 4965 fp, err := ParseNotificationStateNotificationStateProviderDataWebHook_FieldPath(pathStr) 4966 if err != nil { 4967 return nil, err 4968 } 4969 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4970 if err != nil { 4971 return nil, status.Errorf(codes.InvalidArgument, "error parsing WebHook field path array item value from %s: %v", valueStr, err) 4972 } 4973 return fpaiv.(NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue), nil 4974 } 4975 4976 func MustParseNotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue { 4977 fpaiv, err := ParseNotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue(pathStr, valueStr) 4978 if err != nil { 4979 panic(err) 4980 } 4981 return fpaiv 4982 } 4983 4984 type NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue struct { 4985 NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath 4986 value interface{} 4987 } 4988 4989 var _ NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue)(nil) 4990 4991 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData_WebHook as interface{} 4992 func (fpaiv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4993 return fpaiv.value 4994 } 4995 func (fpaiv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue) AsFailedChunksItemValue() (*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks, bool) { 4996 res, ok := fpaiv.value.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 4997 return res, ok 4998 } 4999 5000 func (fpaiv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData_WebHook) (interface{}, bool) { 5001 return nil, false 5002 } 5003 5004 func (fpaiv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 5005 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData_WebHook)) 5006 } 5007 5008 // Contains returns a boolean indicating if value that is being held is present in given 'WebHook' 5009 func (fpaiv *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData_WebHook) bool { 5010 slice := fpaiv.NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath.Get(source) 5011 for _, v := range slice { 5012 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 5013 if proto.Equal(asProtoMsg, v.(proto.Message)) { 5014 return true 5015 } 5016 } else if reflect.DeepEqual(v, fpaiv.value) { 5017 return true 5018 } 5019 } 5020 return false 5021 } 5022 5023 type NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayItemValue struct { 5024 NotificationStateNotificationStateProviderDataWebHook_FieldPath 5025 subPathItemValue gotenobject.FieldPathArrayItemValue 5026 } 5027 5028 // GetRawValue returns stored array item value 5029 func (fpaivs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 5030 return fpaivs.subPathItemValue.GetRawItemValue() 5031 } 5032 func (fpaivs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayItemValue) AsFailedChunksPathItemValue() (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue, bool) { 5033 res, ok := fpaivs.subPathItemValue.(NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue) 5034 return res, ok 5035 } 5036 5037 // Contains returns a boolean indicating if value that is being held is present in given 'WebHook' 5038 func (fpaivs *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData_WebHook) bool { 5039 switch fpaivs.Selector() { 5040 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 5041 return false // repeated/map field 5042 default: 5043 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook: %d", fpaivs.Selector())) 5044 } 5045 } 5046 5047 // NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues allows storing slice of values for WebHook fields according to their type 5048 type NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues interface { 5049 gotenobject.FieldPathArrayOfValues 5050 NotificationStateNotificationStateProviderDataWebHook_FieldPath 5051 } 5052 5053 func ParseNotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues, error) { 5054 fp, err := ParseNotificationStateNotificationStateProviderDataWebHook_FieldPath(pathStr) 5055 if err != nil { 5056 return nil, err 5057 } 5058 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 5059 if err != nil { 5060 return nil, status.Errorf(codes.InvalidArgument, "error parsing WebHook field path array of values from %s: %v", valuesStr, err) 5061 } 5062 return fpaov.(NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues), nil 5063 } 5064 5065 func MustParseNotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues { 5066 fpaov, err := ParseNotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues(pathStr, valuesStr) 5067 if err != nil { 5068 panic(err) 5069 } 5070 return fpaov 5071 } 5072 5073 type NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues struct { 5074 NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPath 5075 values interface{} 5076 } 5077 5078 var _ NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues)(nil) 5079 5080 func (fpaov *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 5081 switch fpaov.selector { 5082 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorTotalChunks: 5083 for _, v := range fpaov.values.([]int64) { 5084 values = append(values, v) 5085 } 5086 case NotificationStateNotificationStateProviderDataWebHook_FieldPathSelectorFailedChunks: 5087 for _, v := range fpaov.values.([][]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) { 5088 values = append(values, v) 5089 } 5090 } 5091 return 5092 } 5093 func (fpaov *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues) AsTotalChunksArrayOfValues() ([]int64, bool) { 5094 res, ok := fpaov.values.([]int64) 5095 return res, ok 5096 } 5097 func (fpaov *NotificationStateNotificationStateProviderDataWebHook_FieldTerminalPathArrayOfValues) AsFailedChunksArrayOfValues() ([][]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks, bool) { 5098 res, ok := fpaov.values.([][]*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 5099 return res, ok 5100 } 5101 5102 type NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayOfValues struct { 5103 NotificationStateNotificationStateProviderDataWebHook_FieldPath 5104 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 5105 } 5106 5107 var _ NotificationStateNotificationStateProviderDataWebHook_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayOfValues)(nil) 5108 5109 func (fpsaov *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 5110 return fpsaov.subPathArrayOfValues.GetRawValues() 5111 } 5112 func (fpsaov *NotificationStateNotificationStateProviderDataWebHook_FieldSubPathArrayOfValues) AsFailedChunksPathArrayOfValues() (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues, bool) { 5113 res, ok := fpsaov.subPathArrayOfValues.(NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues) 5114 return res, ok 5115 } 5116 5117 // FieldPath provides implementation to handle 5118 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 5119 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath interface { 5120 gotenobject.FieldPath 5121 Selector() NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelector 5122 Get(source *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) []interface{} 5123 GetSingle(source *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) (interface{}, bool) 5124 ClearValue(item *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 5125 5126 // Those methods build corresponding NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue 5127 // (or array of values) and holds passed value. Panics if injected type is incorrect. 5128 WithIValue(value interface{}) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue 5129 WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues 5130 WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue 5131 } 5132 5133 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelector int32 5134 5135 const ( 5136 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelector = 0 5137 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelector = 1 5138 ) 5139 5140 func (s NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelector) String() string { 5141 switch s { 5142 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5143 return "alert_offset" 5144 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5145 return "error" 5146 default: 5147 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", s)) 5148 } 5149 } 5150 5151 func BuildNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(fp gotenobject.RawFieldPath) (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath, error) { 5152 if len(fp) == 0 { 5153 return nil, status.Error(codes.InvalidArgument, "empty field path for object Notification_State_NotificationState_ProviderData_WebHook_FailedChunks") 5154 } 5155 if len(fp) == 1 { 5156 switch fp[0] { 5157 case "alert_offset", "alertOffset", "alert-offset": 5158 return &NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset}, nil 5159 case "error": 5160 return &NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath{selector: NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError}, nil 5161 } 5162 } 5163 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object Notification_State_NotificationState_ProviderData_WebHook_FailedChunks", fp) 5164 } 5165 5166 func ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(rawField string) (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath, error) { 5167 fp, err := gotenobject.ParseRawFieldPath(rawField) 5168 if err != nil { 5169 return nil, err 5170 } 5171 return BuildNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(fp) 5172 } 5173 5174 func MustParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(rawField string) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath { 5175 fp, err := ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(rawField) 5176 if err != nil { 5177 panic(err) 5178 } 5179 return fp 5180 } 5181 5182 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath struct { 5183 selector NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelector 5184 } 5185 5186 var _ NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath = (*NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath)(nil) 5187 5188 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) Selector() NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelector { 5189 return fp.selector 5190 } 5191 5192 // String returns path representation in proto convention 5193 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) String() string { 5194 return fp.selector.String() 5195 } 5196 5197 // JSONString returns path representation is JSON convention 5198 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) JSONString() string { 5199 return strcase.ToLowerCamel(fp.String()) 5200 } 5201 5202 // Get returns all values pointed by specific field from source Notification_State_NotificationState_ProviderData_WebHook_FailedChunks 5203 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) Get(source *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) (values []interface{}) { 5204 if source != nil { 5205 switch fp.selector { 5206 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5207 values = append(values, source.AlertOffset) 5208 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5209 values = append(values, source.Error) 5210 default: 5211 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fp.selector)) 5212 } 5213 } 5214 return 5215 } 5216 5217 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 5218 return fp.Get(source.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)) 5219 } 5220 5221 // GetSingle returns value pointed by specific field of from source Notification_State_NotificationState_ProviderData_WebHook_FailedChunks 5222 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) GetSingle(source *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) (interface{}, bool) { 5223 switch fp.selector { 5224 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5225 return source.GetAlertOffset(), source != nil 5226 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5227 return source.GetError(), source != nil 5228 default: 5229 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fp.selector)) 5230 } 5231 } 5232 5233 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5234 return fp.GetSingle(source.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)) 5235 } 5236 5237 // GetDefault returns a default value of the field type 5238 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) GetDefault() interface{} { 5239 switch fp.selector { 5240 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5241 return int64(0) 5242 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5243 return "" 5244 default: 5245 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fp.selector)) 5246 } 5247 } 5248 5249 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) ClearValue(item *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) { 5250 if item != nil { 5251 switch fp.selector { 5252 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5253 item.AlertOffset = int64(0) 5254 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5255 item.Error = "" 5256 default: 5257 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fp.selector)) 5258 } 5259 } 5260 } 5261 5262 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) ClearValueRaw(item proto.Message) { 5263 fp.ClearValue(item.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)) 5264 } 5265 5266 // IsLeaf - whether field path is holds simple value 5267 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) IsLeaf() bool { 5268 return fp.selector == NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset || 5269 fp.selector == NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError 5270 } 5271 5272 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5273 return []gotenobject.FieldPath{fp} 5274 } 5275 5276 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) WithIValue(value interface{}) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue { 5277 switch fp.selector { 5278 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5279 return &NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath: *fp, value: value.(int64)} 5280 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5281 return &NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue{NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath: *fp, value: value.(string)} 5282 default: 5283 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fp.selector)) 5284 } 5285 } 5286 5287 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5288 return fp.WithIValue(value) 5289 } 5290 5291 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues { 5292 fpaov := &NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath: *fp} 5293 switch fp.selector { 5294 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5295 return &NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath: *fp, values: values.([]int64)} 5296 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5297 return &NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues{NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath: *fp, values: values.([]string)} 5298 default: 5299 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fp.selector)) 5300 } 5301 return fpaov 5302 } 5303 5304 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5305 return fp.WithIArrayOfValues(values) 5306 } 5307 5308 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue { 5309 switch fp.selector { 5310 default: 5311 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fp.selector)) 5312 } 5313 } 5314 5315 func (fp *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5316 return fp.WithIArrayItemValue(value) 5317 } 5318 5319 // NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue allows storing values for FailedChunks fields according to their type 5320 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue interface { 5321 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath 5322 gotenobject.FieldPathValue 5323 SetTo(target **Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 5324 CompareWith(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) (cmp int, comparable bool) 5325 } 5326 5327 func ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue, error) { 5328 fp, err := ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(pathStr) 5329 if err != nil { 5330 return nil, err 5331 } 5332 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 5333 if err != nil { 5334 return nil, status.Errorf(codes.InvalidArgument, "error parsing FailedChunks field path value from %s: %v", valueStr, err) 5335 } 5336 return fpv.(NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue), nil 5337 } 5338 5339 func MustParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue { 5340 fpv, err := ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue(pathStr, valueStr) 5341 if err != nil { 5342 panic(err) 5343 } 5344 return fpv 5345 } 5346 5347 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue struct { 5348 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath 5349 value interface{} 5350 } 5351 5352 var _ NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathValue = (*NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue)(nil) 5353 5354 // GetRawValue returns raw value stored under selected path for 'FailedChunks' as interface{} 5355 func (fpv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue) GetRawValue() interface{} { 5356 return fpv.value 5357 } 5358 func (fpv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue) AsAlertOffsetValue() (int64, bool) { 5359 res, ok := fpv.value.(int64) 5360 return res, ok 5361 } 5362 func (fpv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue) AsErrorValue() (string, bool) { 5363 res, ok := fpv.value.(string) 5364 return res, ok 5365 } 5366 5367 // SetTo stores value for selected field for object FailedChunks 5368 func (fpv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue) SetTo(target **Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) { 5369 if *target == nil { 5370 *target = new(Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 5371 } 5372 switch fpv.selector { 5373 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5374 (*target).AlertOffset = fpv.value.(int64) 5375 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5376 (*target).Error = fpv.value.(string) 5377 default: 5378 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fpv.selector)) 5379 } 5380 } 5381 5382 func (fpv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue) SetToRaw(target proto.Message) { 5383 typedObject := target.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) 5384 fpv.SetTo(&typedObject) 5385 } 5386 5387 // CompareWith compares value in the 'NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue' with the value under path in 'Notification_State_NotificationState_ProviderData_WebHook_FailedChunks'. 5388 func (fpv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue) CompareWith(source *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) (int, bool) { 5389 switch fpv.selector { 5390 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5391 leftValue := fpv.value.(int64) 5392 rightValue := source.GetAlertOffset() 5393 if (leftValue) == (rightValue) { 5394 return 0, true 5395 } else if (leftValue) < (rightValue) { 5396 return -1, true 5397 } else { 5398 return 1, true 5399 } 5400 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5401 leftValue := fpv.value.(string) 5402 rightValue := source.GetError() 5403 if (leftValue) == (rightValue) { 5404 return 0, true 5405 } else if (leftValue) < (rightValue) { 5406 return -1, true 5407 } else { 5408 return 1, true 5409 } 5410 default: 5411 panic(fmt.Sprintf("Invalid selector for Notification_State_NotificationState_ProviderData_WebHook_FailedChunks: %d", fpv.selector)) 5412 } 5413 } 5414 5415 func (fpv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5416 return fpv.CompareWith(source.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)) 5417 } 5418 5419 // NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue allows storing single item in Path-specific values for FailedChunks according to their type 5420 // Present only for array (repeated) types. 5421 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue interface { 5422 gotenobject.FieldPathArrayItemValue 5423 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath 5424 ContainsValue(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) bool 5425 } 5426 5427 // ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 5428 func ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue, error) { 5429 fp, err := ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(pathStr) 5430 if err != nil { 5431 return nil, err 5432 } 5433 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 5434 if err != nil { 5435 return nil, status.Errorf(codes.InvalidArgument, "error parsing FailedChunks field path array item value from %s: %v", valueStr, err) 5436 } 5437 return fpaiv.(NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue), nil 5438 } 5439 5440 func MustParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue(pathStr, valueStr string) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue { 5441 fpaiv, err := ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue(pathStr, valueStr) 5442 if err != nil { 5443 panic(err) 5444 } 5445 return fpaiv 5446 } 5447 5448 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayItemValue struct { 5449 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath 5450 value interface{} 5451 } 5452 5453 var _ NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayItemValue = (*NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayItemValue)(nil) 5454 5455 // GetRawValue returns stored element value for array in object Notification_State_NotificationState_ProviderData_WebHook_FailedChunks as interface{} 5456 func (fpaiv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 5457 return fpaiv.value 5458 } 5459 5460 func (fpaiv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayItemValue) GetSingle(source *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) (interface{}, bool) { 5461 return nil, false 5462 } 5463 5464 func (fpaiv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 5465 return fpaiv.GetSingle(source.(*Notification_State_NotificationState_ProviderData_WebHook_FailedChunks)) 5466 } 5467 5468 // Contains returns a boolean indicating if value that is being held is present in given 'FailedChunks' 5469 func (fpaiv *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayItemValue) ContainsValue(source *Notification_State_NotificationState_ProviderData_WebHook_FailedChunks) bool { 5470 slice := fpaiv.NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath.Get(source) 5471 for _, v := range slice { 5472 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 5473 if proto.Equal(asProtoMsg, v.(proto.Message)) { 5474 return true 5475 } 5476 } else if reflect.DeepEqual(v, fpaiv.value) { 5477 return true 5478 } 5479 } 5480 return false 5481 } 5482 5483 // NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues allows storing slice of values for FailedChunks fields according to their type 5484 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues interface { 5485 gotenobject.FieldPathArrayOfValues 5486 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath 5487 } 5488 5489 func ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues, error) { 5490 fp, err := ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPath(pathStr) 5491 if err != nil { 5492 return nil, err 5493 } 5494 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 5495 if err != nil { 5496 return nil, status.Errorf(codes.InvalidArgument, "error parsing FailedChunks field path array of values from %s: %v", valuesStr, err) 5497 } 5498 return fpaov.(NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues), nil 5499 } 5500 5501 func MustParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues { 5502 fpaov, err := ParseNotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues(pathStr, valuesStr) 5503 if err != nil { 5504 panic(err) 5505 } 5506 return fpaov 5507 } 5508 5509 type NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues struct { 5510 NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPath 5511 values interface{} 5512 } 5513 5514 var _ NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathArrayOfValues = (*NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues)(nil) 5515 5516 func (fpaov *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 5517 switch fpaov.selector { 5518 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorAlertOffset: 5519 for _, v := range fpaov.values.([]int64) { 5520 values = append(values, v) 5521 } 5522 case NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldPathSelectorError: 5523 for _, v := range fpaov.values.([]string) { 5524 values = append(values, v) 5525 } 5526 } 5527 return 5528 } 5529 func (fpaov *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues) AsAlertOffsetArrayOfValues() ([]int64, bool) { 5530 res, ok := fpaov.values.([]int64) 5531 return res, ok 5532 } 5533 func (fpaov *NotificationStateNotificationStateProviderDataWebHookFailedChunks_FieldTerminalPathArrayOfValues) AsErrorArrayOfValues() ([]string, bool) { 5534 res, ok := fpaov.values.([]string) 5535 return res, ok 5536 }