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