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