github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/common/specs.pb.fieldpath.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/alerting/proto/v1/specs.proto 3 // DO NOT EDIT!!! 4 5 package rcommon 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 logging_log "github.com/cloudwan/edgelq-sdk/logging/resources/v1/log" 27 monitoring_common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 28 monitoring_time_serie "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/time_serie" 29 meta_resource "github.com/cloudwan/goten-sdk/meta-service/resources/v1/resource" 30 durationpb "google.golang.org/protobuf/types/known/durationpb" 31 fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 32 ) 33 34 // ensure the imports are used 35 var ( 36 _ = new(json.Marshaler) 37 _ = new(fmt.Stringer) 38 _ = reflect.DeepEqual 39 _ = strings.Builder{} 40 _ = time.Second 41 42 _ = strcase.ToLowerCamel 43 _ = codes.NotFound 44 _ = status.Status{} 45 _ = protojson.UnmarshalOptions{} 46 _ = new(proto.Message) 47 _ = protoregistry.GlobalTypes 48 49 _ = new(gotenobject.FieldPath) 50 ) 51 52 // make sure we're using proto imports 53 var ( 54 _ = &logging_log.Log{} 55 _ = &monitoring_common.LabelDescriptor{} 56 _ = &monitoring_time_serie.Point{} 57 _ = &durationpb.Duration{} 58 _ = &fieldmaskpb.FieldMask{} 59 _ = &meta_resource.Resource{} 60 ) 61 62 // FieldPath provides implementation to handle 63 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 64 type LogCndSpec_FieldPath interface { 65 gotenobject.FieldPath 66 Selector() LogCndSpec_FieldPathSelector 67 Get(source *LogCndSpec) []interface{} 68 GetSingle(source *LogCndSpec) (interface{}, bool) 69 ClearValue(item *LogCndSpec) 70 71 // Those methods build corresponding LogCndSpec_FieldPathValue 72 // (or array of values) and holds passed value. Panics if injected type is incorrect. 73 WithIValue(value interface{}) LogCndSpec_FieldPathValue 74 WithIArrayOfValues(values interface{}) LogCndSpec_FieldPathArrayOfValues 75 WithIArrayItemValue(value interface{}) LogCndSpec_FieldPathArrayItemValue 76 } 77 78 type LogCndSpec_FieldPathSelector int32 79 80 const ( 81 LogCndSpec_FieldPathSelectorQuery LogCndSpec_FieldPathSelector = 0 82 LogCndSpec_FieldPathSelectorGroupByLabels LogCndSpec_FieldPathSelector = 1 83 ) 84 85 func (s LogCndSpec_FieldPathSelector) String() string { 86 switch s { 87 case LogCndSpec_FieldPathSelectorQuery: 88 return "query" 89 case LogCndSpec_FieldPathSelectorGroupByLabels: 90 return "group_by_labels" 91 default: 92 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", s)) 93 } 94 } 95 96 func BuildLogCndSpec_FieldPath(fp gotenobject.RawFieldPath) (LogCndSpec_FieldPath, error) { 97 if len(fp) == 0 { 98 return nil, status.Error(codes.InvalidArgument, "empty field path for object LogCndSpec") 99 } 100 if len(fp) == 1 { 101 switch fp[0] { 102 case "query": 103 return &LogCndSpec_FieldTerminalPath{selector: LogCndSpec_FieldPathSelectorQuery}, nil 104 case "group_by_labels", "groupByLabels", "group-by-labels": 105 return &LogCndSpec_FieldTerminalPath{selector: LogCndSpec_FieldPathSelectorGroupByLabels}, nil 106 } 107 } else { 108 switch fp[0] { 109 case "query": 110 if subpath, err := BuildLogCndSpecQuery_FieldPath(fp[1:]); err != nil { 111 return nil, err 112 } else { 113 return &LogCndSpec_FieldSubPath{selector: LogCndSpec_FieldPathSelectorQuery, subPath: subpath}, nil 114 } 115 } 116 } 117 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object LogCndSpec", fp) 118 } 119 120 func ParseLogCndSpec_FieldPath(rawField string) (LogCndSpec_FieldPath, error) { 121 fp, err := gotenobject.ParseRawFieldPath(rawField) 122 if err != nil { 123 return nil, err 124 } 125 return BuildLogCndSpec_FieldPath(fp) 126 } 127 128 func MustParseLogCndSpec_FieldPath(rawField string) LogCndSpec_FieldPath { 129 fp, err := ParseLogCndSpec_FieldPath(rawField) 130 if err != nil { 131 panic(err) 132 } 133 return fp 134 } 135 136 type LogCndSpec_FieldTerminalPath struct { 137 selector LogCndSpec_FieldPathSelector 138 } 139 140 var _ LogCndSpec_FieldPath = (*LogCndSpec_FieldTerminalPath)(nil) 141 142 func (fp *LogCndSpec_FieldTerminalPath) Selector() LogCndSpec_FieldPathSelector { 143 return fp.selector 144 } 145 146 // String returns path representation in proto convention 147 func (fp *LogCndSpec_FieldTerminalPath) String() string { 148 return fp.selector.String() 149 } 150 151 // JSONString returns path representation is JSON convention 152 func (fp *LogCndSpec_FieldTerminalPath) JSONString() string { 153 return strcase.ToLowerCamel(fp.String()) 154 } 155 156 // Get returns all values pointed by specific field from source LogCndSpec 157 func (fp *LogCndSpec_FieldTerminalPath) Get(source *LogCndSpec) (values []interface{}) { 158 if source != nil { 159 switch fp.selector { 160 case LogCndSpec_FieldPathSelectorQuery: 161 if source.Query != nil { 162 values = append(values, source.Query) 163 } 164 case LogCndSpec_FieldPathSelectorGroupByLabels: 165 for _, value := range source.GetGroupByLabels() { 166 values = append(values, value) 167 } 168 default: 169 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fp.selector)) 170 } 171 } 172 return 173 } 174 175 func (fp *LogCndSpec_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 176 return fp.Get(source.(*LogCndSpec)) 177 } 178 179 // GetSingle returns value pointed by specific field of from source LogCndSpec 180 func (fp *LogCndSpec_FieldTerminalPath) GetSingle(source *LogCndSpec) (interface{}, bool) { 181 switch fp.selector { 182 case LogCndSpec_FieldPathSelectorQuery: 183 res := source.GetQuery() 184 return res, res != nil 185 case LogCndSpec_FieldPathSelectorGroupByLabels: 186 res := source.GetGroupByLabels() 187 return res, res != nil 188 default: 189 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fp.selector)) 190 } 191 } 192 193 func (fp *LogCndSpec_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 194 return fp.GetSingle(source.(*LogCndSpec)) 195 } 196 197 // GetDefault returns a default value of the field type 198 func (fp *LogCndSpec_FieldTerminalPath) GetDefault() interface{} { 199 switch fp.selector { 200 case LogCndSpec_FieldPathSelectorQuery: 201 return (*LogCndSpec_Query)(nil) 202 case LogCndSpec_FieldPathSelectorGroupByLabels: 203 return ([]string)(nil) 204 default: 205 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fp.selector)) 206 } 207 } 208 209 func (fp *LogCndSpec_FieldTerminalPath) ClearValue(item *LogCndSpec) { 210 if item != nil { 211 switch fp.selector { 212 case LogCndSpec_FieldPathSelectorQuery: 213 item.Query = nil 214 case LogCndSpec_FieldPathSelectorGroupByLabels: 215 item.GroupByLabels = nil 216 default: 217 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fp.selector)) 218 } 219 } 220 } 221 222 func (fp *LogCndSpec_FieldTerminalPath) ClearValueRaw(item proto.Message) { 223 fp.ClearValue(item.(*LogCndSpec)) 224 } 225 226 // IsLeaf - whether field path is holds simple value 227 func (fp *LogCndSpec_FieldTerminalPath) IsLeaf() bool { 228 return fp.selector == LogCndSpec_FieldPathSelectorGroupByLabels 229 } 230 231 func (fp *LogCndSpec_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 232 return []gotenobject.FieldPath{fp} 233 } 234 235 func (fp *LogCndSpec_FieldTerminalPath) WithIValue(value interface{}) LogCndSpec_FieldPathValue { 236 switch fp.selector { 237 case LogCndSpec_FieldPathSelectorQuery: 238 return &LogCndSpec_FieldTerminalPathValue{LogCndSpec_FieldTerminalPath: *fp, value: value.(*LogCndSpec_Query)} 239 case LogCndSpec_FieldPathSelectorGroupByLabels: 240 return &LogCndSpec_FieldTerminalPathValue{LogCndSpec_FieldTerminalPath: *fp, value: value.([]string)} 241 default: 242 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fp.selector)) 243 } 244 } 245 246 func (fp *LogCndSpec_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 247 return fp.WithIValue(value) 248 } 249 250 func (fp *LogCndSpec_FieldTerminalPath) WithIArrayOfValues(values interface{}) LogCndSpec_FieldPathArrayOfValues { 251 fpaov := &LogCndSpec_FieldTerminalPathArrayOfValues{LogCndSpec_FieldTerminalPath: *fp} 252 switch fp.selector { 253 case LogCndSpec_FieldPathSelectorQuery: 254 return &LogCndSpec_FieldTerminalPathArrayOfValues{LogCndSpec_FieldTerminalPath: *fp, values: values.([]*LogCndSpec_Query)} 255 case LogCndSpec_FieldPathSelectorGroupByLabels: 256 return &LogCndSpec_FieldTerminalPathArrayOfValues{LogCndSpec_FieldTerminalPath: *fp, values: values.([][]string)} 257 default: 258 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fp.selector)) 259 } 260 return fpaov 261 } 262 263 func (fp *LogCndSpec_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 264 return fp.WithIArrayOfValues(values) 265 } 266 267 func (fp *LogCndSpec_FieldTerminalPath) WithIArrayItemValue(value interface{}) LogCndSpec_FieldPathArrayItemValue { 268 switch fp.selector { 269 case LogCndSpec_FieldPathSelectorGroupByLabels: 270 return &LogCndSpec_FieldTerminalPathArrayItemValue{LogCndSpec_FieldTerminalPath: *fp, value: value.(string)} 271 default: 272 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fp.selector)) 273 } 274 } 275 276 func (fp *LogCndSpec_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 277 return fp.WithIArrayItemValue(value) 278 } 279 280 type LogCndSpec_FieldSubPath struct { 281 selector LogCndSpec_FieldPathSelector 282 subPath gotenobject.FieldPath 283 } 284 285 var _ LogCndSpec_FieldPath = (*LogCndSpec_FieldSubPath)(nil) 286 287 func (fps *LogCndSpec_FieldSubPath) Selector() LogCndSpec_FieldPathSelector { 288 return fps.selector 289 } 290 func (fps *LogCndSpec_FieldSubPath) AsQuerySubPath() (LogCndSpecQuery_FieldPath, bool) { 291 res, ok := fps.subPath.(LogCndSpecQuery_FieldPath) 292 return res, ok 293 } 294 295 // String returns path representation in proto convention 296 func (fps *LogCndSpec_FieldSubPath) String() string { 297 return fps.selector.String() + "." + fps.subPath.String() 298 } 299 300 // JSONString returns path representation is JSON convention 301 func (fps *LogCndSpec_FieldSubPath) JSONString() string { 302 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 303 } 304 305 // Get returns all values pointed by selected field from source LogCndSpec 306 func (fps *LogCndSpec_FieldSubPath) Get(source *LogCndSpec) (values []interface{}) { 307 switch fps.selector { 308 case LogCndSpec_FieldPathSelectorQuery: 309 values = append(values, fps.subPath.GetRaw(source.GetQuery())...) 310 default: 311 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fps.selector)) 312 } 313 return 314 } 315 316 func (fps *LogCndSpec_FieldSubPath) GetRaw(source proto.Message) []interface{} { 317 return fps.Get(source.(*LogCndSpec)) 318 } 319 320 // GetSingle returns value of selected field from source LogCndSpec 321 func (fps *LogCndSpec_FieldSubPath) GetSingle(source *LogCndSpec) (interface{}, bool) { 322 switch fps.selector { 323 case LogCndSpec_FieldPathSelectorQuery: 324 if source.GetQuery() == nil { 325 return nil, false 326 } 327 return fps.subPath.GetSingleRaw(source.GetQuery()) 328 default: 329 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fps.selector)) 330 } 331 } 332 333 func (fps *LogCndSpec_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 334 return fps.GetSingle(source.(*LogCndSpec)) 335 } 336 337 // GetDefault returns a default value of the field type 338 func (fps *LogCndSpec_FieldSubPath) GetDefault() interface{} { 339 return fps.subPath.GetDefault() 340 } 341 342 func (fps *LogCndSpec_FieldSubPath) ClearValue(item *LogCndSpec) { 343 if item != nil { 344 switch fps.selector { 345 case LogCndSpec_FieldPathSelectorQuery: 346 fps.subPath.ClearValueRaw(item.Query) 347 default: 348 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fps.selector)) 349 } 350 } 351 } 352 353 func (fps *LogCndSpec_FieldSubPath) ClearValueRaw(item proto.Message) { 354 fps.ClearValue(item.(*LogCndSpec)) 355 } 356 357 // IsLeaf - whether field path is holds simple value 358 func (fps *LogCndSpec_FieldSubPath) IsLeaf() bool { 359 return fps.subPath.IsLeaf() 360 } 361 362 func (fps *LogCndSpec_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 363 iPaths := []gotenobject.FieldPath{&LogCndSpec_FieldTerminalPath{selector: fps.selector}} 364 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 365 return iPaths 366 } 367 368 func (fps *LogCndSpec_FieldSubPath) WithIValue(value interface{}) LogCndSpec_FieldPathValue { 369 return &LogCndSpec_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 370 } 371 372 func (fps *LogCndSpec_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 373 return fps.WithIValue(value) 374 } 375 376 func (fps *LogCndSpec_FieldSubPath) WithIArrayOfValues(values interface{}) LogCndSpec_FieldPathArrayOfValues { 377 return &LogCndSpec_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 378 } 379 380 func (fps *LogCndSpec_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 381 return fps.WithIArrayOfValues(values) 382 } 383 384 func (fps *LogCndSpec_FieldSubPath) WithIArrayItemValue(value interface{}) LogCndSpec_FieldPathArrayItemValue { 385 return &LogCndSpec_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 386 } 387 388 func (fps *LogCndSpec_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 389 return fps.WithIArrayItemValue(value) 390 } 391 392 // LogCndSpec_FieldPathValue allows storing values for LogCndSpec fields according to their type 393 type LogCndSpec_FieldPathValue interface { 394 LogCndSpec_FieldPath 395 gotenobject.FieldPathValue 396 SetTo(target **LogCndSpec) 397 CompareWith(*LogCndSpec) (cmp int, comparable bool) 398 } 399 400 func ParseLogCndSpec_FieldPathValue(pathStr, valueStr string) (LogCndSpec_FieldPathValue, error) { 401 fp, err := ParseLogCndSpec_FieldPath(pathStr) 402 if err != nil { 403 return nil, err 404 } 405 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 406 if err != nil { 407 return nil, status.Errorf(codes.InvalidArgument, "error parsing LogCndSpec field path value from %s: %v", valueStr, err) 408 } 409 return fpv.(LogCndSpec_FieldPathValue), nil 410 } 411 412 func MustParseLogCndSpec_FieldPathValue(pathStr, valueStr string) LogCndSpec_FieldPathValue { 413 fpv, err := ParseLogCndSpec_FieldPathValue(pathStr, valueStr) 414 if err != nil { 415 panic(err) 416 } 417 return fpv 418 } 419 420 type LogCndSpec_FieldTerminalPathValue struct { 421 LogCndSpec_FieldTerminalPath 422 value interface{} 423 } 424 425 var _ LogCndSpec_FieldPathValue = (*LogCndSpec_FieldTerminalPathValue)(nil) 426 427 // GetRawValue returns raw value stored under selected path for 'LogCndSpec' as interface{} 428 func (fpv *LogCndSpec_FieldTerminalPathValue) GetRawValue() interface{} { 429 return fpv.value 430 } 431 func (fpv *LogCndSpec_FieldTerminalPathValue) AsQueryValue() (*LogCndSpec_Query, bool) { 432 res, ok := fpv.value.(*LogCndSpec_Query) 433 return res, ok 434 } 435 func (fpv *LogCndSpec_FieldTerminalPathValue) AsGroupByLabelsValue() ([]string, bool) { 436 res, ok := fpv.value.([]string) 437 return res, ok 438 } 439 440 // SetTo stores value for selected field for object LogCndSpec 441 func (fpv *LogCndSpec_FieldTerminalPathValue) SetTo(target **LogCndSpec) { 442 if *target == nil { 443 *target = new(LogCndSpec) 444 } 445 switch fpv.selector { 446 case LogCndSpec_FieldPathSelectorQuery: 447 (*target).Query = fpv.value.(*LogCndSpec_Query) 448 case LogCndSpec_FieldPathSelectorGroupByLabels: 449 (*target).GroupByLabels = fpv.value.([]string) 450 default: 451 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fpv.selector)) 452 } 453 } 454 455 func (fpv *LogCndSpec_FieldTerminalPathValue) SetToRaw(target proto.Message) { 456 typedObject := target.(*LogCndSpec) 457 fpv.SetTo(&typedObject) 458 } 459 460 // CompareWith compares value in the 'LogCndSpec_FieldTerminalPathValue' with the value under path in 'LogCndSpec'. 461 func (fpv *LogCndSpec_FieldTerminalPathValue) CompareWith(source *LogCndSpec) (int, bool) { 462 switch fpv.selector { 463 case LogCndSpec_FieldPathSelectorQuery: 464 return 0, false 465 case LogCndSpec_FieldPathSelectorGroupByLabels: 466 return 0, false 467 default: 468 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fpv.selector)) 469 } 470 } 471 472 func (fpv *LogCndSpec_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 473 return fpv.CompareWith(source.(*LogCndSpec)) 474 } 475 476 type LogCndSpec_FieldSubPathValue struct { 477 LogCndSpec_FieldPath 478 subPathValue gotenobject.FieldPathValue 479 } 480 481 var _ LogCndSpec_FieldPathValue = (*LogCndSpec_FieldSubPathValue)(nil) 482 483 func (fpvs *LogCndSpec_FieldSubPathValue) AsQueryPathValue() (LogCndSpecQuery_FieldPathValue, bool) { 484 res, ok := fpvs.subPathValue.(LogCndSpecQuery_FieldPathValue) 485 return res, ok 486 } 487 488 func (fpvs *LogCndSpec_FieldSubPathValue) SetTo(target **LogCndSpec) { 489 if *target == nil { 490 *target = new(LogCndSpec) 491 } 492 switch fpvs.Selector() { 493 case LogCndSpec_FieldPathSelectorQuery: 494 fpvs.subPathValue.(LogCndSpecQuery_FieldPathValue).SetTo(&(*target).Query) 495 default: 496 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fpvs.Selector())) 497 } 498 } 499 500 func (fpvs *LogCndSpec_FieldSubPathValue) SetToRaw(target proto.Message) { 501 typedObject := target.(*LogCndSpec) 502 fpvs.SetTo(&typedObject) 503 } 504 505 func (fpvs *LogCndSpec_FieldSubPathValue) GetRawValue() interface{} { 506 return fpvs.subPathValue.GetRawValue() 507 } 508 509 func (fpvs *LogCndSpec_FieldSubPathValue) CompareWith(source *LogCndSpec) (int, bool) { 510 switch fpvs.Selector() { 511 case LogCndSpec_FieldPathSelectorQuery: 512 return fpvs.subPathValue.(LogCndSpecQuery_FieldPathValue).CompareWith(source.GetQuery()) 513 default: 514 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fpvs.Selector())) 515 } 516 } 517 518 func (fpvs *LogCndSpec_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 519 return fpvs.CompareWith(source.(*LogCndSpec)) 520 } 521 522 // LogCndSpec_FieldPathArrayItemValue allows storing single item in Path-specific values for LogCndSpec according to their type 523 // Present only for array (repeated) types. 524 type LogCndSpec_FieldPathArrayItemValue interface { 525 gotenobject.FieldPathArrayItemValue 526 LogCndSpec_FieldPath 527 ContainsValue(*LogCndSpec) bool 528 } 529 530 // ParseLogCndSpec_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 531 func ParseLogCndSpec_FieldPathArrayItemValue(pathStr, valueStr string) (LogCndSpec_FieldPathArrayItemValue, error) { 532 fp, err := ParseLogCndSpec_FieldPath(pathStr) 533 if err != nil { 534 return nil, err 535 } 536 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 537 if err != nil { 538 return nil, status.Errorf(codes.InvalidArgument, "error parsing LogCndSpec field path array item value from %s: %v", valueStr, err) 539 } 540 return fpaiv.(LogCndSpec_FieldPathArrayItemValue), nil 541 } 542 543 func MustParseLogCndSpec_FieldPathArrayItemValue(pathStr, valueStr string) LogCndSpec_FieldPathArrayItemValue { 544 fpaiv, err := ParseLogCndSpec_FieldPathArrayItemValue(pathStr, valueStr) 545 if err != nil { 546 panic(err) 547 } 548 return fpaiv 549 } 550 551 type LogCndSpec_FieldTerminalPathArrayItemValue struct { 552 LogCndSpec_FieldTerminalPath 553 value interface{} 554 } 555 556 var _ LogCndSpec_FieldPathArrayItemValue = (*LogCndSpec_FieldTerminalPathArrayItemValue)(nil) 557 558 // GetRawValue returns stored element value for array in object LogCndSpec as interface{} 559 func (fpaiv *LogCndSpec_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 560 return fpaiv.value 561 } 562 func (fpaiv *LogCndSpec_FieldTerminalPathArrayItemValue) AsGroupByLabelsItemValue() (string, bool) { 563 res, ok := fpaiv.value.(string) 564 return res, ok 565 } 566 567 func (fpaiv *LogCndSpec_FieldTerminalPathArrayItemValue) GetSingle(source *LogCndSpec) (interface{}, bool) { 568 return nil, false 569 } 570 571 func (fpaiv *LogCndSpec_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 572 return fpaiv.GetSingle(source.(*LogCndSpec)) 573 } 574 575 // Contains returns a boolean indicating if value that is being held is present in given 'LogCndSpec' 576 func (fpaiv *LogCndSpec_FieldTerminalPathArrayItemValue) ContainsValue(source *LogCndSpec) bool { 577 slice := fpaiv.LogCndSpec_FieldTerminalPath.Get(source) 578 for _, v := range slice { 579 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 580 if proto.Equal(asProtoMsg, v.(proto.Message)) { 581 return true 582 } 583 } else if reflect.DeepEqual(v, fpaiv.value) { 584 return true 585 } 586 } 587 return false 588 } 589 590 type LogCndSpec_FieldSubPathArrayItemValue struct { 591 LogCndSpec_FieldPath 592 subPathItemValue gotenobject.FieldPathArrayItemValue 593 } 594 595 // GetRawValue returns stored array item value 596 func (fpaivs *LogCndSpec_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 597 return fpaivs.subPathItemValue.GetRawItemValue() 598 } 599 func (fpaivs *LogCndSpec_FieldSubPathArrayItemValue) AsQueryPathItemValue() (LogCndSpecQuery_FieldPathArrayItemValue, bool) { 600 res, ok := fpaivs.subPathItemValue.(LogCndSpecQuery_FieldPathArrayItemValue) 601 return res, ok 602 } 603 604 // Contains returns a boolean indicating if value that is being held is present in given 'LogCndSpec' 605 func (fpaivs *LogCndSpec_FieldSubPathArrayItemValue) ContainsValue(source *LogCndSpec) bool { 606 switch fpaivs.Selector() { 607 case LogCndSpec_FieldPathSelectorQuery: 608 return fpaivs.subPathItemValue.(LogCndSpecQuery_FieldPathArrayItemValue).ContainsValue(source.GetQuery()) 609 default: 610 panic(fmt.Sprintf("Invalid selector for LogCndSpec: %d", fpaivs.Selector())) 611 } 612 } 613 614 // LogCndSpec_FieldPathArrayOfValues allows storing slice of values for LogCndSpec fields according to their type 615 type LogCndSpec_FieldPathArrayOfValues interface { 616 gotenobject.FieldPathArrayOfValues 617 LogCndSpec_FieldPath 618 } 619 620 func ParseLogCndSpec_FieldPathArrayOfValues(pathStr, valuesStr string) (LogCndSpec_FieldPathArrayOfValues, error) { 621 fp, err := ParseLogCndSpec_FieldPath(pathStr) 622 if err != nil { 623 return nil, err 624 } 625 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 626 if err != nil { 627 return nil, status.Errorf(codes.InvalidArgument, "error parsing LogCndSpec field path array of values from %s: %v", valuesStr, err) 628 } 629 return fpaov.(LogCndSpec_FieldPathArrayOfValues), nil 630 } 631 632 func MustParseLogCndSpec_FieldPathArrayOfValues(pathStr, valuesStr string) LogCndSpec_FieldPathArrayOfValues { 633 fpaov, err := ParseLogCndSpec_FieldPathArrayOfValues(pathStr, valuesStr) 634 if err != nil { 635 panic(err) 636 } 637 return fpaov 638 } 639 640 type LogCndSpec_FieldTerminalPathArrayOfValues struct { 641 LogCndSpec_FieldTerminalPath 642 values interface{} 643 } 644 645 var _ LogCndSpec_FieldPathArrayOfValues = (*LogCndSpec_FieldTerminalPathArrayOfValues)(nil) 646 647 func (fpaov *LogCndSpec_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 648 switch fpaov.selector { 649 case LogCndSpec_FieldPathSelectorQuery: 650 for _, v := range fpaov.values.([]*LogCndSpec_Query) { 651 values = append(values, v) 652 } 653 case LogCndSpec_FieldPathSelectorGroupByLabels: 654 for _, v := range fpaov.values.([][]string) { 655 values = append(values, v) 656 } 657 } 658 return 659 } 660 func (fpaov *LogCndSpec_FieldTerminalPathArrayOfValues) AsQueryArrayOfValues() ([]*LogCndSpec_Query, bool) { 661 res, ok := fpaov.values.([]*LogCndSpec_Query) 662 return res, ok 663 } 664 func (fpaov *LogCndSpec_FieldTerminalPathArrayOfValues) AsGroupByLabelsArrayOfValues() ([][]string, bool) { 665 res, ok := fpaov.values.([][]string) 666 return res, ok 667 } 668 669 type LogCndSpec_FieldSubPathArrayOfValues struct { 670 LogCndSpec_FieldPath 671 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 672 } 673 674 var _ LogCndSpec_FieldPathArrayOfValues = (*LogCndSpec_FieldSubPathArrayOfValues)(nil) 675 676 func (fpsaov *LogCndSpec_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 677 return fpsaov.subPathArrayOfValues.GetRawValues() 678 } 679 func (fpsaov *LogCndSpec_FieldSubPathArrayOfValues) AsQueryPathArrayOfValues() (LogCndSpecQuery_FieldPathArrayOfValues, bool) { 680 res, ok := fpsaov.subPathArrayOfValues.(LogCndSpecQuery_FieldPathArrayOfValues) 681 return res, ok 682 } 683 684 // FieldPath provides implementation to handle 685 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 686 type LogCndSpecQuery_FieldPath interface { 687 gotenobject.FieldPath 688 Selector() LogCndSpecQuery_FieldPathSelector 689 Get(source *LogCndSpec_Query) []interface{} 690 GetSingle(source *LogCndSpec_Query) (interface{}, bool) 691 ClearValue(item *LogCndSpec_Query) 692 693 // Those methods build corresponding LogCndSpecQuery_FieldPathValue 694 // (or array of values) and holds passed value. Panics if injected type is incorrect. 695 WithIValue(value interface{}) LogCndSpecQuery_FieldPathValue 696 WithIArrayOfValues(values interface{}) LogCndSpecQuery_FieldPathArrayOfValues 697 WithIArrayItemValue(value interface{}) LogCndSpecQuery_FieldPathArrayItemValue 698 } 699 700 type LogCndSpecQuery_FieldPathSelector int32 701 702 const ( 703 LogCndSpecQuery_FieldPathSelectorFilter LogCndSpecQuery_FieldPathSelector = 0 704 LogCndSpecQuery_FieldPathSelectorTrigger LogCndSpecQuery_FieldPathSelector = 1 705 LogCndSpecQuery_FieldPathSelectorMinDuration LogCndSpecQuery_FieldPathSelector = 2 706 ) 707 708 func (s LogCndSpecQuery_FieldPathSelector) String() string { 709 switch s { 710 case LogCndSpecQuery_FieldPathSelectorFilter: 711 return "filter" 712 case LogCndSpecQuery_FieldPathSelectorTrigger: 713 return "trigger" 714 case LogCndSpecQuery_FieldPathSelectorMinDuration: 715 return "min_duration" 716 default: 717 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", s)) 718 } 719 } 720 721 func BuildLogCndSpecQuery_FieldPath(fp gotenobject.RawFieldPath) (LogCndSpecQuery_FieldPath, error) { 722 if len(fp) == 0 { 723 return nil, status.Error(codes.InvalidArgument, "empty field path for object LogCndSpec_Query") 724 } 725 if len(fp) == 1 { 726 switch fp[0] { 727 case "filter": 728 return &LogCndSpecQuery_FieldTerminalPath{selector: LogCndSpecQuery_FieldPathSelectorFilter}, nil 729 case "trigger": 730 return &LogCndSpecQuery_FieldTerminalPath{selector: LogCndSpecQuery_FieldPathSelectorTrigger}, nil 731 case "min_duration", "minDuration", "min-duration": 732 return &LogCndSpecQuery_FieldTerminalPath{selector: LogCndSpecQuery_FieldPathSelectorMinDuration}, nil 733 } 734 } 735 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object LogCndSpec_Query", fp) 736 } 737 738 func ParseLogCndSpecQuery_FieldPath(rawField string) (LogCndSpecQuery_FieldPath, error) { 739 fp, err := gotenobject.ParseRawFieldPath(rawField) 740 if err != nil { 741 return nil, err 742 } 743 return BuildLogCndSpecQuery_FieldPath(fp) 744 } 745 746 func MustParseLogCndSpecQuery_FieldPath(rawField string) LogCndSpecQuery_FieldPath { 747 fp, err := ParseLogCndSpecQuery_FieldPath(rawField) 748 if err != nil { 749 panic(err) 750 } 751 return fp 752 } 753 754 type LogCndSpecQuery_FieldTerminalPath struct { 755 selector LogCndSpecQuery_FieldPathSelector 756 } 757 758 var _ LogCndSpecQuery_FieldPath = (*LogCndSpecQuery_FieldTerminalPath)(nil) 759 760 func (fp *LogCndSpecQuery_FieldTerminalPath) Selector() LogCndSpecQuery_FieldPathSelector { 761 return fp.selector 762 } 763 764 // String returns path representation in proto convention 765 func (fp *LogCndSpecQuery_FieldTerminalPath) String() string { 766 return fp.selector.String() 767 } 768 769 // JSONString returns path representation is JSON convention 770 func (fp *LogCndSpecQuery_FieldTerminalPath) JSONString() string { 771 return strcase.ToLowerCamel(fp.String()) 772 } 773 774 // Get returns all values pointed by specific field from source LogCndSpec_Query 775 func (fp *LogCndSpecQuery_FieldTerminalPath) Get(source *LogCndSpec_Query) (values []interface{}) { 776 if source != nil { 777 switch fp.selector { 778 case LogCndSpecQuery_FieldPathSelectorFilter: 779 if source.Filter != nil { 780 values = append(values, source.Filter) 781 } 782 case LogCndSpecQuery_FieldPathSelectorTrigger: 783 if source.Trigger != nil { 784 values = append(values, source.Trigger) 785 } 786 case LogCndSpecQuery_FieldPathSelectorMinDuration: 787 if source.MinDuration != nil { 788 values = append(values, source.MinDuration) 789 } 790 default: 791 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fp.selector)) 792 } 793 } 794 return 795 } 796 797 func (fp *LogCndSpecQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 798 return fp.Get(source.(*LogCndSpec_Query)) 799 } 800 801 // GetSingle returns value pointed by specific field of from source LogCndSpec_Query 802 func (fp *LogCndSpecQuery_FieldTerminalPath) GetSingle(source *LogCndSpec_Query) (interface{}, bool) { 803 switch fp.selector { 804 case LogCndSpecQuery_FieldPathSelectorFilter: 805 res := source.GetFilter() 806 return res, res != nil 807 case LogCndSpecQuery_FieldPathSelectorTrigger: 808 res := source.GetTrigger() 809 return res, res != nil 810 case LogCndSpecQuery_FieldPathSelectorMinDuration: 811 res := source.GetMinDuration() 812 return res, res != nil 813 default: 814 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fp.selector)) 815 } 816 } 817 818 func (fp *LogCndSpecQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 819 return fp.GetSingle(source.(*LogCndSpec_Query)) 820 } 821 822 // GetDefault returns a default value of the field type 823 func (fp *LogCndSpecQuery_FieldTerminalPath) GetDefault() interface{} { 824 switch fp.selector { 825 case LogCndSpecQuery_FieldPathSelectorFilter: 826 return (*logging_log.Filter)(nil) 827 case LogCndSpecQuery_FieldPathSelectorTrigger: 828 return (*LogCndSpec_Query_TriggerCnd)(nil) 829 case LogCndSpecQuery_FieldPathSelectorMinDuration: 830 return (*durationpb.Duration)(nil) 831 default: 832 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fp.selector)) 833 } 834 } 835 836 func (fp *LogCndSpecQuery_FieldTerminalPath) ClearValue(item *LogCndSpec_Query) { 837 if item != nil { 838 switch fp.selector { 839 case LogCndSpecQuery_FieldPathSelectorFilter: 840 item.Filter = nil 841 case LogCndSpecQuery_FieldPathSelectorTrigger: 842 item.Trigger = nil 843 case LogCndSpecQuery_FieldPathSelectorMinDuration: 844 item.MinDuration = nil 845 default: 846 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fp.selector)) 847 } 848 } 849 } 850 851 func (fp *LogCndSpecQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 852 fp.ClearValue(item.(*LogCndSpec_Query)) 853 } 854 855 // IsLeaf - whether field path is holds simple value 856 func (fp *LogCndSpecQuery_FieldTerminalPath) IsLeaf() bool { 857 return fp.selector == LogCndSpecQuery_FieldPathSelectorFilter || 858 fp.selector == LogCndSpecQuery_FieldPathSelectorTrigger || 859 fp.selector == LogCndSpecQuery_FieldPathSelectorMinDuration 860 } 861 862 func (fp *LogCndSpecQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 863 return []gotenobject.FieldPath{fp} 864 } 865 866 func (fp *LogCndSpecQuery_FieldTerminalPath) WithIValue(value interface{}) LogCndSpecQuery_FieldPathValue { 867 switch fp.selector { 868 case LogCndSpecQuery_FieldPathSelectorFilter: 869 return &LogCndSpecQuery_FieldTerminalPathValue{LogCndSpecQuery_FieldTerminalPath: *fp, value: value.(*logging_log.Filter)} 870 case LogCndSpecQuery_FieldPathSelectorTrigger: 871 return &LogCndSpecQuery_FieldTerminalPathValue{LogCndSpecQuery_FieldTerminalPath: *fp, value: value.(*LogCndSpec_Query_TriggerCnd)} 872 case LogCndSpecQuery_FieldPathSelectorMinDuration: 873 return &LogCndSpecQuery_FieldTerminalPathValue{LogCndSpecQuery_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 874 default: 875 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fp.selector)) 876 } 877 } 878 879 func (fp *LogCndSpecQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 880 return fp.WithIValue(value) 881 } 882 883 func (fp *LogCndSpecQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) LogCndSpecQuery_FieldPathArrayOfValues { 884 fpaov := &LogCndSpecQuery_FieldTerminalPathArrayOfValues{LogCndSpecQuery_FieldTerminalPath: *fp} 885 switch fp.selector { 886 case LogCndSpecQuery_FieldPathSelectorFilter: 887 return &LogCndSpecQuery_FieldTerminalPathArrayOfValues{LogCndSpecQuery_FieldTerminalPath: *fp, values: values.([]*logging_log.Filter)} 888 case LogCndSpecQuery_FieldPathSelectorTrigger: 889 return &LogCndSpecQuery_FieldTerminalPathArrayOfValues{LogCndSpecQuery_FieldTerminalPath: *fp, values: values.([]*LogCndSpec_Query_TriggerCnd)} 890 case LogCndSpecQuery_FieldPathSelectorMinDuration: 891 return &LogCndSpecQuery_FieldTerminalPathArrayOfValues{LogCndSpecQuery_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 892 default: 893 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fp.selector)) 894 } 895 return fpaov 896 } 897 898 func (fp *LogCndSpecQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 899 return fp.WithIArrayOfValues(values) 900 } 901 902 func (fp *LogCndSpecQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) LogCndSpecQuery_FieldPathArrayItemValue { 903 switch fp.selector { 904 default: 905 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fp.selector)) 906 } 907 } 908 909 func (fp *LogCndSpecQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 910 return fp.WithIArrayItemValue(value) 911 } 912 913 // LogCndSpecQuery_FieldPathValue allows storing values for Query fields according to their type 914 type LogCndSpecQuery_FieldPathValue interface { 915 LogCndSpecQuery_FieldPath 916 gotenobject.FieldPathValue 917 SetTo(target **LogCndSpec_Query) 918 CompareWith(*LogCndSpec_Query) (cmp int, comparable bool) 919 } 920 921 func ParseLogCndSpecQuery_FieldPathValue(pathStr, valueStr string) (LogCndSpecQuery_FieldPathValue, error) { 922 fp, err := ParseLogCndSpecQuery_FieldPath(pathStr) 923 if err != nil { 924 return nil, err 925 } 926 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 927 if err != nil { 928 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path value from %s: %v", valueStr, err) 929 } 930 return fpv.(LogCndSpecQuery_FieldPathValue), nil 931 } 932 933 func MustParseLogCndSpecQuery_FieldPathValue(pathStr, valueStr string) LogCndSpecQuery_FieldPathValue { 934 fpv, err := ParseLogCndSpecQuery_FieldPathValue(pathStr, valueStr) 935 if err != nil { 936 panic(err) 937 } 938 return fpv 939 } 940 941 type LogCndSpecQuery_FieldTerminalPathValue struct { 942 LogCndSpecQuery_FieldTerminalPath 943 value interface{} 944 } 945 946 var _ LogCndSpecQuery_FieldPathValue = (*LogCndSpecQuery_FieldTerminalPathValue)(nil) 947 948 // GetRawValue returns raw value stored under selected path for 'Query' as interface{} 949 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) GetRawValue() interface{} { 950 return fpv.value 951 } 952 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) AsFilterValue() (*logging_log.Filter, bool) { 953 res, ok := fpv.value.(*logging_log.Filter) 954 return res, ok 955 } 956 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) AsTriggerValue() (*LogCndSpec_Query_TriggerCnd, bool) { 957 res, ok := fpv.value.(*LogCndSpec_Query_TriggerCnd) 958 return res, ok 959 } 960 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) AsMinDurationValue() (*durationpb.Duration, bool) { 961 res, ok := fpv.value.(*durationpb.Duration) 962 return res, ok 963 } 964 965 // SetTo stores value for selected field for object Query 966 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) SetTo(target **LogCndSpec_Query) { 967 if *target == nil { 968 *target = new(LogCndSpec_Query) 969 } 970 switch fpv.selector { 971 case LogCndSpecQuery_FieldPathSelectorFilter: 972 (*target).Filter = fpv.value.(*logging_log.Filter) 973 case LogCndSpecQuery_FieldPathSelectorTrigger: 974 (*target).Trigger = fpv.value.(*LogCndSpec_Query_TriggerCnd) 975 case LogCndSpecQuery_FieldPathSelectorMinDuration: 976 (*target).MinDuration = fpv.value.(*durationpb.Duration) 977 default: 978 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fpv.selector)) 979 } 980 } 981 982 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 983 typedObject := target.(*LogCndSpec_Query) 984 fpv.SetTo(&typedObject) 985 } 986 987 // CompareWith compares value in the 'LogCndSpecQuery_FieldTerminalPathValue' with the value under path in 'LogCndSpec_Query'. 988 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) CompareWith(source *LogCndSpec_Query) (int, bool) { 989 switch fpv.selector { 990 case LogCndSpecQuery_FieldPathSelectorFilter: 991 return 0, false 992 case LogCndSpecQuery_FieldPathSelectorTrigger: 993 return 0, false 994 case LogCndSpecQuery_FieldPathSelectorMinDuration: 995 leftValue := fpv.value.(*durationpb.Duration) 996 rightValue := source.GetMinDuration() 997 if leftValue == nil { 998 if rightValue != nil { 999 return -1, true 1000 } 1001 return 0, true 1002 } 1003 if rightValue == nil { 1004 return 1, true 1005 } 1006 if leftValue.AsDuration() == rightValue.AsDuration() { 1007 return 0, true 1008 } else if leftValue.AsDuration() < rightValue.AsDuration() { 1009 return -1, true 1010 } else { 1011 return 1, true 1012 } 1013 default: 1014 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query: %d", fpv.selector)) 1015 } 1016 } 1017 1018 func (fpv *LogCndSpecQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1019 return fpv.CompareWith(source.(*LogCndSpec_Query)) 1020 } 1021 1022 // LogCndSpecQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for Query according to their type 1023 // Present only for array (repeated) types. 1024 type LogCndSpecQuery_FieldPathArrayItemValue interface { 1025 gotenobject.FieldPathArrayItemValue 1026 LogCndSpecQuery_FieldPath 1027 ContainsValue(*LogCndSpec_Query) bool 1028 } 1029 1030 // ParseLogCndSpecQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1031 func ParseLogCndSpecQuery_FieldPathArrayItemValue(pathStr, valueStr string) (LogCndSpecQuery_FieldPathArrayItemValue, error) { 1032 fp, err := ParseLogCndSpecQuery_FieldPath(pathStr) 1033 if err != nil { 1034 return nil, err 1035 } 1036 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1037 if err != nil { 1038 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path array item value from %s: %v", valueStr, err) 1039 } 1040 return fpaiv.(LogCndSpecQuery_FieldPathArrayItemValue), nil 1041 } 1042 1043 func MustParseLogCndSpecQuery_FieldPathArrayItemValue(pathStr, valueStr string) LogCndSpecQuery_FieldPathArrayItemValue { 1044 fpaiv, err := ParseLogCndSpecQuery_FieldPathArrayItemValue(pathStr, valueStr) 1045 if err != nil { 1046 panic(err) 1047 } 1048 return fpaiv 1049 } 1050 1051 type LogCndSpecQuery_FieldTerminalPathArrayItemValue struct { 1052 LogCndSpecQuery_FieldTerminalPath 1053 value interface{} 1054 } 1055 1056 var _ LogCndSpecQuery_FieldPathArrayItemValue = (*LogCndSpecQuery_FieldTerminalPathArrayItemValue)(nil) 1057 1058 // GetRawValue returns stored element value for array in object LogCndSpec_Query as interface{} 1059 func (fpaiv *LogCndSpecQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1060 return fpaiv.value 1061 } 1062 1063 func (fpaiv *LogCndSpecQuery_FieldTerminalPathArrayItemValue) GetSingle(source *LogCndSpec_Query) (interface{}, bool) { 1064 return nil, false 1065 } 1066 1067 func (fpaiv *LogCndSpecQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1068 return fpaiv.GetSingle(source.(*LogCndSpec_Query)) 1069 } 1070 1071 // Contains returns a boolean indicating if value that is being held is present in given 'Query' 1072 func (fpaiv *LogCndSpecQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *LogCndSpec_Query) bool { 1073 slice := fpaiv.LogCndSpecQuery_FieldTerminalPath.Get(source) 1074 for _, v := range slice { 1075 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1076 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1077 return true 1078 } 1079 } else if reflect.DeepEqual(v, fpaiv.value) { 1080 return true 1081 } 1082 } 1083 return false 1084 } 1085 1086 // LogCndSpecQuery_FieldPathArrayOfValues allows storing slice of values for Query fields according to their type 1087 type LogCndSpecQuery_FieldPathArrayOfValues interface { 1088 gotenobject.FieldPathArrayOfValues 1089 LogCndSpecQuery_FieldPath 1090 } 1091 1092 func ParseLogCndSpecQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (LogCndSpecQuery_FieldPathArrayOfValues, error) { 1093 fp, err := ParseLogCndSpecQuery_FieldPath(pathStr) 1094 if err != nil { 1095 return nil, err 1096 } 1097 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1098 if err != nil { 1099 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path array of values from %s: %v", valuesStr, err) 1100 } 1101 return fpaov.(LogCndSpecQuery_FieldPathArrayOfValues), nil 1102 } 1103 1104 func MustParseLogCndSpecQuery_FieldPathArrayOfValues(pathStr, valuesStr string) LogCndSpecQuery_FieldPathArrayOfValues { 1105 fpaov, err := ParseLogCndSpecQuery_FieldPathArrayOfValues(pathStr, valuesStr) 1106 if err != nil { 1107 panic(err) 1108 } 1109 return fpaov 1110 } 1111 1112 type LogCndSpecQuery_FieldTerminalPathArrayOfValues struct { 1113 LogCndSpecQuery_FieldTerminalPath 1114 values interface{} 1115 } 1116 1117 var _ LogCndSpecQuery_FieldPathArrayOfValues = (*LogCndSpecQuery_FieldTerminalPathArrayOfValues)(nil) 1118 1119 func (fpaov *LogCndSpecQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1120 switch fpaov.selector { 1121 case LogCndSpecQuery_FieldPathSelectorFilter: 1122 for _, v := range fpaov.values.([]*logging_log.Filter) { 1123 values = append(values, v) 1124 } 1125 case LogCndSpecQuery_FieldPathSelectorTrigger: 1126 for _, v := range fpaov.values.([]*LogCndSpec_Query_TriggerCnd) { 1127 values = append(values, v) 1128 } 1129 case LogCndSpecQuery_FieldPathSelectorMinDuration: 1130 for _, v := range fpaov.values.([]*durationpb.Duration) { 1131 values = append(values, v) 1132 } 1133 } 1134 return 1135 } 1136 func (fpaov *LogCndSpecQuery_FieldTerminalPathArrayOfValues) AsFilterArrayOfValues() ([]*logging_log.Filter, bool) { 1137 res, ok := fpaov.values.([]*logging_log.Filter) 1138 return res, ok 1139 } 1140 func (fpaov *LogCndSpecQuery_FieldTerminalPathArrayOfValues) AsTriggerArrayOfValues() ([]*LogCndSpec_Query_TriggerCnd, bool) { 1141 res, ok := fpaov.values.([]*LogCndSpec_Query_TriggerCnd) 1142 return res, ok 1143 } 1144 func (fpaov *LogCndSpecQuery_FieldTerminalPathArrayOfValues) AsMinDurationArrayOfValues() ([]*durationpb.Duration, bool) { 1145 res, ok := fpaov.values.([]*durationpb.Duration) 1146 return res, ok 1147 } 1148 1149 // FieldPath provides implementation to handle 1150 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1151 type LogCndSpecQueryLabelTrigger_FieldPath interface { 1152 gotenobject.FieldPath 1153 Selector() LogCndSpecQueryLabelTrigger_FieldPathSelector 1154 Get(source *LogCndSpec_Query_LabelTrigger) []interface{} 1155 GetSingle(source *LogCndSpec_Query_LabelTrigger) (interface{}, bool) 1156 ClearValue(item *LogCndSpec_Query_LabelTrigger) 1157 1158 // Those methods build corresponding LogCndSpecQueryLabelTrigger_FieldPathValue 1159 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1160 WithIValue(value interface{}) LogCndSpecQueryLabelTrigger_FieldPathValue 1161 WithIArrayOfValues(values interface{}) LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues 1162 WithIArrayItemValue(value interface{}) LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue 1163 } 1164 1165 type LogCndSpecQueryLabelTrigger_FieldPathSelector int32 1166 1167 const ( 1168 LogCndSpecQueryLabelTrigger_FieldPathSelectorKey LogCndSpecQueryLabelTrigger_FieldPathSelector = 0 1169 LogCndSpecQueryLabelTrigger_FieldPathSelectorValues LogCndSpecQueryLabelTrigger_FieldPathSelector = 1 1170 ) 1171 1172 func (s LogCndSpecQueryLabelTrigger_FieldPathSelector) String() string { 1173 switch s { 1174 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1175 return "key" 1176 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1177 return "values" 1178 default: 1179 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", s)) 1180 } 1181 } 1182 1183 func BuildLogCndSpecQueryLabelTrigger_FieldPath(fp gotenobject.RawFieldPath) (LogCndSpecQueryLabelTrigger_FieldPath, error) { 1184 if len(fp) == 0 { 1185 return nil, status.Error(codes.InvalidArgument, "empty field path for object LogCndSpec_Query_LabelTrigger") 1186 } 1187 if len(fp) == 1 { 1188 switch fp[0] { 1189 case "key": 1190 return &LogCndSpecQueryLabelTrigger_FieldTerminalPath{selector: LogCndSpecQueryLabelTrigger_FieldPathSelectorKey}, nil 1191 case "values": 1192 return &LogCndSpecQueryLabelTrigger_FieldTerminalPath{selector: LogCndSpecQueryLabelTrigger_FieldPathSelectorValues}, nil 1193 } 1194 } 1195 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object LogCndSpec_Query_LabelTrigger", fp) 1196 } 1197 1198 func ParseLogCndSpecQueryLabelTrigger_FieldPath(rawField string) (LogCndSpecQueryLabelTrigger_FieldPath, error) { 1199 fp, err := gotenobject.ParseRawFieldPath(rawField) 1200 if err != nil { 1201 return nil, err 1202 } 1203 return BuildLogCndSpecQueryLabelTrigger_FieldPath(fp) 1204 } 1205 1206 func MustParseLogCndSpecQueryLabelTrigger_FieldPath(rawField string) LogCndSpecQueryLabelTrigger_FieldPath { 1207 fp, err := ParseLogCndSpecQueryLabelTrigger_FieldPath(rawField) 1208 if err != nil { 1209 panic(err) 1210 } 1211 return fp 1212 } 1213 1214 type LogCndSpecQueryLabelTrigger_FieldTerminalPath struct { 1215 selector LogCndSpecQueryLabelTrigger_FieldPathSelector 1216 } 1217 1218 var _ LogCndSpecQueryLabelTrigger_FieldPath = (*LogCndSpecQueryLabelTrigger_FieldTerminalPath)(nil) 1219 1220 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) Selector() LogCndSpecQueryLabelTrigger_FieldPathSelector { 1221 return fp.selector 1222 } 1223 1224 // String returns path representation in proto convention 1225 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) String() string { 1226 return fp.selector.String() 1227 } 1228 1229 // JSONString returns path representation is JSON convention 1230 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) JSONString() string { 1231 return strcase.ToLowerCamel(fp.String()) 1232 } 1233 1234 // Get returns all values pointed by specific field from source LogCndSpec_Query_LabelTrigger 1235 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) Get(source *LogCndSpec_Query_LabelTrigger) (values []interface{}) { 1236 if source != nil { 1237 switch fp.selector { 1238 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1239 values = append(values, source.Key) 1240 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1241 for _, value := range source.GetValues() { 1242 values = append(values, value) 1243 } 1244 default: 1245 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fp.selector)) 1246 } 1247 } 1248 return 1249 } 1250 1251 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1252 return fp.Get(source.(*LogCndSpec_Query_LabelTrigger)) 1253 } 1254 1255 // GetSingle returns value pointed by specific field of from source LogCndSpec_Query_LabelTrigger 1256 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) GetSingle(source *LogCndSpec_Query_LabelTrigger) (interface{}, bool) { 1257 switch fp.selector { 1258 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1259 return source.GetKey(), source != nil 1260 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1261 res := source.GetValues() 1262 return res, res != nil 1263 default: 1264 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fp.selector)) 1265 } 1266 } 1267 1268 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1269 return fp.GetSingle(source.(*LogCndSpec_Query_LabelTrigger)) 1270 } 1271 1272 // GetDefault returns a default value of the field type 1273 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) GetDefault() interface{} { 1274 switch fp.selector { 1275 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1276 return "" 1277 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1278 return ([]string)(nil) 1279 default: 1280 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fp.selector)) 1281 } 1282 } 1283 1284 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) ClearValue(item *LogCndSpec_Query_LabelTrigger) { 1285 if item != nil { 1286 switch fp.selector { 1287 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1288 item.Key = "" 1289 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1290 item.Values = nil 1291 default: 1292 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fp.selector)) 1293 } 1294 } 1295 } 1296 1297 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1298 fp.ClearValue(item.(*LogCndSpec_Query_LabelTrigger)) 1299 } 1300 1301 // IsLeaf - whether field path is holds simple value 1302 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) IsLeaf() bool { 1303 return fp.selector == LogCndSpecQueryLabelTrigger_FieldPathSelectorKey || 1304 fp.selector == LogCndSpecQueryLabelTrigger_FieldPathSelectorValues 1305 } 1306 1307 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1308 return []gotenobject.FieldPath{fp} 1309 } 1310 1311 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) WithIValue(value interface{}) LogCndSpecQueryLabelTrigger_FieldPathValue { 1312 switch fp.selector { 1313 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1314 return &LogCndSpecQueryLabelTrigger_FieldTerminalPathValue{LogCndSpecQueryLabelTrigger_FieldTerminalPath: *fp, value: value.(string)} 1315 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1316 return &LogCndSpecQueryLabelTrigger_FieldTerminalPathValue{LogCndSpecQueryLabelTrigger_FieldTerminalPath: *fp, value: value.([]string)} 1317 default: 1318 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fp.selector)) 1319 } 1320 } 1321 1322 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1323 return fp.WithIValue(value) 1324 } 1325 1326 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) WithIArrayOfValues(values interface{}) LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues { 1327 fpaov := &LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryLabelTrigger_FieldTerminalPath: *fp} 1328 switch fp.selector { 1329 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1330 return &LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryLabelTrigger_FieldTerminalPath: *fp, values: values.([]string)} 1331 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1332 return &LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryLabelTrigger_FieldTerminalPath: *fp, values: values.([][]string)} 1333 default: 1334 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fp.selector)) 1335 } 1336 return fpaov 1337 } 1338 1339 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1340 return fp.WithIArrayOfValues(values) 1341 } 1342 1343 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) WithIArrayItemValue(value interface{}) LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue { 1344 switch fp.selector { 1345 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1346 return &LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue{LogCndSpecQueryLabelTrigger_FieldTerminalPath: *fp, value: value.(string)} 1347 default: 1348 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fp.selector)) 1349 } 1350 } 1351 1352 func (fp *LogCndSpecQueryLabelTrigger_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1353 return fp.WithIArrayItemValue(value) 1354 } 1355 1356 // LogCndSpecQueryLabelTrigger_FieldPathValue allows storing values for LabelTrigger fields according to their type 1357 type LogCndSpecQueryLabelTrigger_FieldPathValue interface { 1358 LogCndSpecQueryLabelTrigger_FieldPath 1359 gotenobject.FieldPathValue 1360 SetTo(target **LogCndSpec_Query_LabelTrigger) 1361 CompareWith(*LogCndSpec_Query_LabelTrigger) (cmp int, comparable bool) 1362 } 1363 1364 func ParseLogCndSpecQueryLabelTrigger_FieldPathValue(pathStr, valueStr string) (LogCndSpecQueryLabelTrigger_FieldPathValue, error) { 1365 fp, err := ParseLogCndSpecQueryLabelTrigger_FieldPath(pathStr) 1366 if err != nil { 1367 return nil, err 1368 } 1369 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1370 if err != nil { 1371 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelTrigger field path value from %s: %v", valueStr, err) 1372 } 1373 return fpv.(LogCndSpecQueryLabelTrigger_FieldPathValue), nil 1374 } 1375 1376 func MustParseLogCndSpecQueryLabelTrigger_FieldPathValue(pathStr, valueStr string) LogCndSpecQueryLabelTrigger_FieldPathValue { 1377 fpv, err := ParseLogCndSpecQueryLabelTrigger_FieldPathValue(pathStr, valueStr) 1378 if err != nil { 1379 panic(err) 1380 } 1381 return fpv 1382 } 1383 1384 type LogCndSpecQueryLabelTrigger_FieldTerminalPathValue struct { 1385 LogCndSpecQueryLabelTrigger_FieldTerminalPath 1386 value interface{} 1387 } 1388 1389 var _ LogCndSpecQueryLabelTrigger_FieldPathValue = (*LogCndSpecQueryLabelTrigger_FieldTerminalPathValue)(nil) 1390 1391 // GetRawValue returns raw value stored under selected path for 'LabelTrigger' as interface{} 1392 func (fpv *LogCndSpecQueryLabelTrigger_FieldTerminalPathValue) GetRawValue() interface{} { 1393 return fpv.value 1394 } 1395 func (fpv *LogCndSpecQueryLabelTrigger_FieldTerminalPathValue) AsKeyValue() (string, bool) { 1396 res, ok := fpv.value.(string) 1397 return res, ok 1398 } 1399 func (fpv *LogCndSpecQueryLabelTrigger_FieldTerminalPathValue) AsValuesValue() ([]string, bool) { 1400 res, ok := fpv.value.([]string) 1401 return res, ok 1402 } 1403 1404 // SetTo stores value for selected field for object LabelTrigger 1405 func (fpv *LogCndSpecQueryLabelTrigger_FieldTerminalPathValue) SetTo(target **LogCndSpec_Query_LabelTrigger) { 1406 if *target == nil { 1407 *target = new(LogCndSpec_Query_LabelTrigger) 1408 } 1409 switch fpv.selector { 1410 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1411 (*target).Key = fpv.value.(string) 1412 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1413 (*target).Values = fpv.value.([]string) 1414 default: 1415 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fpv.selector)) 1416 } 1417 } 1418 1419 func (fpv *LogCndSpecQueryLabelTrigger_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1420 typedObject := target.(*LogCndSpec_Query_LabelTrigger) 1421 fpv.SetTo(&typedObject) 1422 } 1423 1424 // CompareWith compares value in the 'LogCndSpecQueryLabelTrigger_FieldTerminalPathValue' with the value under path in 'LogCndSpec_Query_LabelTrigger'. 1425 func (fpv *LogCndSpecQueryLabelTrigger_FieldTerminalPathValue) CompareWith(source *LogCndSpec_Query_LabelTrigger) (int, bool) { 1426 switch fpv.selector { 1427 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1428 leftValue := fpv.value.(string) 1429 rightValue := source.GetKey() 1430 if (leftValue) == (rightValue) { 1431 return 0, true 1432 } else if (leftValue) < (rightValue) { 1433 return -1, true 1434 } else { 1435 return 1, true 1436 } 1437 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1438 return 0, false 1439 default: 1440 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_LabelTrigger: %d", fpv.selector)) 1441 } 1442 } 1443 1444 func (fpv *LogCndSpecQueryLabelTrigger_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1445 return fpv.CompareWith(source.(*LogCndSpec_Query_LabelTrigger)) 1446 } 1447 1448 // LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue allows storing single item in Path-specific values for LabelTrigger according to their type 1449 // Present only for array (repeated) types. 1450 type LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue interface { 1451 gotenobject.FieldPathArrayItemValue 1452 LogCndSpecQueryLabelTrigger_FieldPath 1453 ContainsValue(*LogCndSpec_Query_LabelTrigger) bool 1454 } 1455 1456 // ParseLogCndSpecQueryLabelTrigger_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1457 func ParseLogCndSpecQueryLabelTrigger_FieldPathArrayItemValue(pathStr, valueStr string) (LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue, error) { 1458 fp, err := ParseLogCndSpecQueryLabelTrigger_FieldPath(pathStr) 1459 if err != nil { 1460 return nil, err 1461 } 1462 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1463 if err != nil { 1464 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelTrigger field path array item value from %s: %v", valueStr, err) 1465 } 1466 return fpaiv.(LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue), nil 1467 } 1468 1469 func MustParseLogCndSpecQueryLabelTrigger_FieldPathArrayItemValue(pathStr, valueStr string) LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue { 1470 fpaiv, err := ParseLogCndSpecQueryLabelTrigger_FieldPathArrayItemValue(pathStr, valueStr) 1471 if err != nil { 1472 panic(err) 1473 } 1474 return fpaiv 1475 } 1476 1477 type LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue struct { 1478 LogCndSpecQueryLabelTrigger_FieldTerminalPath 1479 value interface{} 1480 } 1481 1482 var _ LogCndSpecQueryLabelTrigger_FieldPathArrayItemValue = (*LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue)(nil) 1483 1484 // GetRawValue returns stored element value for array in object LogCndSpec_Query_LabelTrigger as interface{} 1485 func (fpaiv *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1486 return fpaiv.value 1487 } 1488 func (fpaiv *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue) AsValuesItemValue() (string, bool) { 1489 res, ok := fpaiv.value.(string) 1490 return res, ok 1491 } 1492 1493 func (fpaiv *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue) GetSingle(source *LogCndSpec_Query_LabelTrigger) (interface{}, bool) { 1494 return nil, false 1495 } 1496 1497 func (fpaiv *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1498 return fpaiv.GetSingle(source.(*LogCndSpec_Query_LabelTrigger)) 1499 } 1500 1501 // Contains returns a boolean indicating if value that is being held is present in given 'LabelTrigger' 1502 func (fpaiv *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayItemValue) ContainsValue(source *LogCndSpec_Query_LabelTrigger) bool { 1503 slice := fpaiv.LogCndSpecQueryLabelTrigger_FieldTerminalPath.Get(source) 1504 for _, v := range slice { 1505 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1506 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1507 return true 1508 } 1509 } else if reflect.DeepEqual(v, fpaiv.value) { 1510 return true 1511 } 1512 } 1513 return false 1514 } 1515 1516 // LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues allows storing slice of values for LabelTrigger fields according to their type 1517 type LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues interface { 1518 gotenobject.FieldPathArrayOfValues 1519 LogCndSpecQueryLabelTrigger_FieldPath 1520 } 1521 1522 func ParseLogCndSpecQueryLabelTrigger_FieldPathArrayOfValues(pathStr, valuesStr string) (LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues, error) { 1523 fp, err := ParseLogCndSpecQueryLabelTrigger_FieldPath(pathStr) 1524 if err != nil { 1525 return nil, err 1526 } 1527 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1528 if err != nil { 1529 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelTrigger field path array of values from %s: %v", valuesStr, err) 1530 } 1531 return fpaov.(LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues), nil 1532 } 1533 1534 func MustParseLogCndSpecQueryLabelTrigger_FieldPathArrayOfValues(pathStr, valuesStr string) LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues { 1535 fpaov, err := ParseLogCndSpecQueryLabelTrigger_FieldPathArrayOfValues(pathStr, valuesStr) 1536 if err != nil { 1537 panic(err) 1538 } 1539 return fpaov 1540 } 1541 1542 type LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues struct { 1543 LogCndSpecQueryLabelTrigger_FieldTerminalPath 1544 values interface{} 1545 } 1546 1547 var _ LogCndSpecQueryLabelTrigger_FieldPathArrayOfValues = (*LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues)(nil) 1548 1549 func (fpaov *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1550 switch fpaov.selector { 1551 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 1552 for _, v := range fpaov.values.([]string) { 1553 values = append(values, v) 1554 } 1555 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 1556 for _, v := range fpaov.values.([][]string) { 1557 values = append(values, v) 1558 } 1559 } 1560 return 1561 } 1562 func (fpaov *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues) AsKeyArrayOfValues() ([]string, bool) { 1563 res, ok := fpaov.values.([]string) 1564 return res, ok 1565 } 1566 func (fpaov *LogCndSpecQueryLabelTrigger_FieldTerminalPathArrayOfValues) AsValuesArrayOfValues() ([][]string, bool) { 1567 res, ok := fpaov.values.([][]string) 1568 return res, ok 1569 } 1570 1571 // FieldPath provides implementation to handle 1572 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1573 type LogCndSpecQueryStringPayloadTrigger_FieldPath interface { 1574 gotenobject.FieldPath 1575 Selector() LogCndSpecQueryStringPayloadTrigger_FieldPathSelector 1576 Get(source *LogCndSpec_Query_StringPayloadTrigger) []interface{} 1577 GetSingle(source *LogCndSpec_Query_StringPayloadTrigger) (interface{}, bool) 1578 ClearValue(item *LogCndSpec_Query_StringPayloadTrigger) 1579 1580 // Those methods build corresponding LogCndSpecQueryStringPayloadTrigger_FieldPathValue 1581 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1582 WithIValue(value interface{}) LogCndSpecQueryStringPayloadTrigger_FieldPathValue 1583 WithIArrayOfValues(values interface{}) LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues 1584 WithIArrayItemValue(value interface{}) LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue 1585 } 1586 1587 type LogCndSpecQueryStringPayloadTrigger_FieldPathSelector int32 1588 1589 const ( 1590 LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector LogCndSpecQueryStringPayloadTrigger_FieldPathSelector = 0 1591 LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex LogCndSpecQueryStringPayloadTrigger_FieldPathSelector = 1 1592 ) 1593 1594 func (s LogCndSpecQueryStringPayloadTrigger_FieldPathSelector) String() string { 1595 switch s { 1596 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1597 return "object_selector" 1598 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1599 return "regex" 1600 default: 1601 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", s)) 1602 } 1603 } 1604 1605 func BuildLogCndSpecQueryStringPayloadTrigger_FieldPath(fp gotenobject.RawFieldPath) (LogCndSpecQueryStringPayloadTrigger_FieldPath, error) { 1606 if len(fp) == 0 { 1607 return nil, status.Error(codes.InvalidArgument, "empty field path for object LogCndSpec_Query_StringPayloadTrigger") 1608 } 1609 if len(fp) == 1 { 1610 switch fp[0] { 1611 case "object_selector", "objectSelector", "object-selector": 1612 return &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath{selector: LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector}, nil 1613 case "regex": 1614 return &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath{selector: LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex}, nil 1615 } 1616 } 1617 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object LogCndSpec_Query_StringPayloadTrigger", fp) 1618 } 1619 1620 func ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(rawField string) (LogCndSpecQueryStringPayloadTrigger_FieldPath, error) { 1621 fp, err := gotenobject.ParseRawFieldPath(rawField) 1622 if err != nil { 1623 return nil, err 1624 } 1625 return BuildLogCndSpecQueryStringPayloadTrigger_FieldPath(fp) 1626 } 1627 1628 func MustParseLogCndSpecQueryStringPayloadTrigger_FieldPath(rawField string) LogCndSpecQueryStringPayloadTrigger_FieldPath { 1629 fp, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(rawField) 1630 if err != nil { 1631 panic(err) 1632 } 1633 return fp 1634 } 1635 1636 type LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath struct { 1637 selector LogCndSpecQueryStringPayloadTrigger_FieldPathSelector 1638 } 1639 1640 var _ LogCndSpecQueryStringPayloadTrigger_FieldPath = (*LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath)(nil) 1641 1642 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) Selector() LogCndSpecQueryStringPayloadTrigger_FieldPathSelector { 1643 return fp.selector 1644 } 1645 1646 // String returns path representation in proto convention 1647 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) String() string { 1648 return fp.selector.String() 1649 } 1650 1651 // JSONString returns path representation is JSON convention 1652 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) JSONString() string { 1653 return strcase.ToLowerCamel(fp.String()) 1654 } 1655 1656 // Get returns all values pointed by specific field from source LogCndSpec_Query_StringPayloadTrigger 1657 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) Get(source *LogCndSpec_Query_StringPayloadTrigger) (values []interface{}) { 1658 if source != nil { 1659 switch fp.selector { 1660 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1661 values = append(values, source.ObjectSelector) 1662 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1663 values = append(values, source.Regex) 1664 default: 1665 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fp.selector)) 1666 } 1667 } 1668 return 1669 } 1670 1671 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1672 return fp.Get(source.(*LogCndSpec_Query_StringPayloadTrigger)) 1673 } 1674 1675 // GetSingle returns value pointed by specific field of from source LogCndSpec_Query_StringPayloadTrigger 1676 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) GetSingle(source *LogCndSpec_Query_StringPayloadTrigger) (interface{}, bool) { 1677 switch fp.selector { 1678 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1679 return source.GetObjectSelector(), source != nil 1680 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1681 return source.GetRegex(), source != nil 1682 default: 1683 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fp.selector)) 1684 } 1685 } 1686 1687 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1688 return fp.GetSingle(source.(*LogCndSpec_Query_StringPayloadTrigger)) 1689 } 1690 1691 // GetDefault returns a default value of the field type 1692 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) GetDefault() interface{} { 1693 switch fp.selector { 1694 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1695 return "" 1696 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1697 return "" 1698 default: 1699 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fp.selector)) 1700 } 1701 } 1702 1703 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) ClearValue(item *LogCndSpec_Query_StringPayloadTrigger) { 1704 if item != nil { 1705 switch fp.selector { 1706 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1707 item.ObjectSelector = "" 1708 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1709 item.Regex = "" 1710 default: 1711 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fp.selector)) 1712 } 1713 } 1714 } 1715 1716 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1717 fp.ClearValue(item.(*LogCndSpec_Query_StringPayloadTrigger)) 1718 } 1719 1720 // IsLeaf - whether field path is holds simple value 1721 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) IsLeaf() bool { 1722 return fp.selector == LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector || 1723 fp.selector == LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex 1724 } 1725 1726 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1727 return []gotenobject.FieldPath{fp} 1728 } 1729 1730 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) WithIValue(value interface{}) LogCndSpecQueryStringPayloadTrigger_FieldPathValue { 1731 switch fp.selector { 1732 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1733 return &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue{LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath: *fp, value: value.(string)} 1734 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1735 return &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue{LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath: *fp, value: value.(string)} 1736 default: 1737 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fp.selector)) 1738 } 1739 } 1740 1741 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1742 return fp.WithIValue(value) 1743 } 1744 1745 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) WithIArrayOfValues(values interface{}) LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues { 1746 fpaov := &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath: *fp} 1747 switch fp.selector { 1748 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1749 return &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath: *fp, values: values.([]string)} 1750 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1751 return &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath: *fp, values: values.([]string)} 1752 default: 1753 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fp.selector)) 1754 } 1755 return fpaov 1756 } 1757 1758 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1759 return fp.WithIArrayOfValues(values) 1760 } 1761 1762 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) WithIArrayItemValue(value interface{}) LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue { 1763 switch fp.selector { 1764 default: 1765 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fp.selector)) 1766 } 1767 } 1768 1769 func (fp *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1770 return fp.WithIArrayItemValue(value) 1771 } 1772 1773 // LogCndSpecQueryStringPayloadTrigger_FieldPathValue allows storing values for StringPayloadTrigger fields according to their type 1774 type LogCndSpecQueryStringPayloadTrigger_FieldPathValue interface { 1775 LogCndSpecQueryStringPayloadTrigger_FieldPath 1776 gotenobject.FieldPathValue 1777 SetTo(target **LogCndSpec_Query_StringPayloadTrigger) 1778 CompareWith(*LogCndSpec_Query_StringPayloadTrigger) (cmp int, comparable bool) 1779 } 1780 1781 func ParseLogCndSpecQueryStringPayloadTrigger_FieldPathValue(pathStr, valueStr string) (LogCndSpecQueryStringPayloadTrigger_FieldPathValue, error) { 1782 fp, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(pathStr) 1783 if err != nil { 1784 return nil, err 1785 } 1786 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1787 if err != nil { 1788 return nil, status.Errorf(codes.InvalidArgument, "error parsing StringPayloadTrigger field path value from %s: %v", valueStr, err) 1789 } 1790 return fpv.(LogCndSpecQueryStringPayloadTrigger_FieldPathValue), nil 1791 } 1792 1793 func MustParseLogCndSpecQueryStringPayloadTrigger_FieldPathValue(pathStr, valueStr string) LogCndSpecQueryStringPayloadTrigger_FieldPathValue { 1794 fpv, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPathValue(pathStr, valueStr) 1795 if err != nil { 1796 panic(err) 1797 } 1798 return fpv 1799 } 1800 1801 type LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue struct { 1802 LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath 1803 value interface{} 1804 } 1805 1806 var _ LogCndSpecQueryStringPayloadTrigger_FieldPathValue = (*LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue)(nil) 1807 1808 // GetRawValue returns raw value stored under selected path for 'StringPayloadTrigger' as interface{} 1809 func (fpv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue) GetRawValue() interface{} { 1810 return fpv.value 1811 } 1812 func (fpv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue) AsObjectSelectorValue() (string, bool) { 1813 res, ok := fpv.value.(string) 1814 return res, ok 1815 } 1816 func (fpv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue) AsRegexValue() (string, bool) { 1817 res, ok := fpv.value.(string) 1818 return res, ok 1819 } 1820 1821 // SetTo stores value for selected field for object StringPayloadTrigger 1822 func (fpv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue) SetTo(target **LogCndSpec_Query_StringPayloadTrigger) { 1823 if *target == nil { 1824 *target = new(LogCndSpec_Query_StringPayloadTrigger) 1825 } 1826 switch fpv.selector { 1827 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1828 (*target).ObjectSelector = fpv.value.(string) 1829 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1830 (*target).Regex = fpv.value.(string) 1831 default: 1832 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fpv.selector)) 1833 } 1834 } 1835 1836 func (fpv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1837 typedObject := target.(*LogCndSpec_Query_StringPayloadTrigger) 1838 fpv.SetTo(&typedObject) 1839 } 1840 1841 // CompareWith compares value in the 'LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue' with the value under path in 'LogCndSpec_Query_StringPayloadTrigger'. 1842 func (fpv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue) CompareWith(source *LogCndSpec_Query_StringPayloadTrigger) (int, bool) { 1843 switch fpv.selector { 1844 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1845 leftValue := fpv.value.(string) 1846 rightValue := source.GetObjectSelector() 1847 if (leftValue) == (rightValue) { 1848 return 0, true 1849 } else if (leftValue) < (rightValue) { 1850 return -1, true 1851 } else { 1852 return 1, true 1853 } 1854 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1855 leftValue := fpv.value.(string) 1856 rightValue := source.GetRegex() 1857 if (leftValue) == (rightValue) { 1858 return 0, true 1859 } else if (leftValue) < (rightValue) { 1860 return -1, true 1861 } else { 1862 return 1, true 1863 } 1864 default: 1865 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_StringPayloadTrigger: %d", fpv.selector)) 1866 } 1867 } 1868 1869 func (fpv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1870 return fpv.CompareWith(source.(*LogCndSpec_Query_StringPayloadTrigger)) 1871 } 1872 1873 // LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue allows storing single item in Path-specific values for StringPayloadTrigger according to their type 1874 // Present only for array (repeated) types. 1875 type LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue interface { 1876 gotenobject.FieldPathArrayItemValue 1877 LogCndSpecQueryStringPayloadTrigger_FieldPath 1878 ContainsValue(*LogCndSpec_Query_StringPayloadTrigger) bool 1879 } 1880 1881 // ParseLogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1882 func ParseLogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue(pathStr, valueStr string) (LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue, error) { 1883 fp, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(pathStr) 1884 if err != nil { 1885 return nil, err 1886 } 1887 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1888 if err != nil { 1889 return nil, status.Errorf(codes.InvalidArgument, "error parsing StringPayloadTrigger field path array item value from %s: %v", valueStr, err) 1890 } 1891 return fpaiv.(LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue), nil 1892 } 1893 1894 func MustParseLogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue(pathStr, valueStr string) LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue { 1895 fpaiv, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue(pathStr, valueStr) 1896 if err != nil { 1897 panic(err) 1898 } 1899 return fpaiv 1900 } 1901 1902 type LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayItemValue struct { 1903 LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath 1904 value interface{} 1905 } 1906 1907 var _ LogCndSpecQueryStringPayloadTrigger_FieldPathArrayItemValue = (*LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayItemValue)(nil) 1908 1909 // GetRawValue returns stored element value for array in object LogCndSpec_Query_StringPayloadTrigger as interface{} 1910 func (fpaiv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1911 return fpaiv.value 1912 } 1913 1914 func (fpaiv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayItemValue) GetSingle(source *LogCndSpec_Query_StringPayloadTrigger) (interface{}, bool) { 1915 return nil, false 1916 } 1917 1918 func (fpaiv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1919 return fpaiv.GetSingle(source.(*LogCndSpec_Query_StringPayloadTrigger)) 1920 } 1921 1922 // Contains returns a boolean indicating if value that is being held is present in given 'StringPayloadTrigger' 1923 func (fpaiv *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayItemValue) ContainsValue(source *LogCndSpec_Query_StringPayloadTrigger) bool { 1924 slice := fpaiv.LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath.Get(source) 1925 for _, v := range slice { 1926 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1927 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1928 return true 1929 } 1930 } else if reflect.DeepEqual(v, fpaiv.value) { 1931 return true 1932 } 1933 } 1934 return false 1935 } 1936 1937 // LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues allows storing slice of values for StringPayloadTrigger fields according to their type 1938 type LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues interface { 1939 gotenobject.FieldPathArrayOfValues 1940 LogCndSpecQueryStringPayloadTrigger_FieldPath 1941 } 1942 1943 func ParseLogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues(pathStr, valuesStr string) (LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues, error) { 1944 fp, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(pathStr) 1945 if err != nil { 1946 return nil, err 1947 } 1948 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1949 if err != nil { 1950 return nil, status.Errorf(codes.InvalidArgument, "error parsing StringPayloadTrigger field path array of values from %s: %v", valuesStr, err) 1951 } 1952 return fpaov.(LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues), nil 1953 } 1954 1955 func MustParseLogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues(pathStr, valuesStr string) LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues { 1956 fpaov, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues(pathStr, valuesStr) 1957 if err != nil { 1958 panic(err) 1959 } 1960 return fpaov 1961 } 1962 1963 type LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues struct { 1964 LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath 1965 values interface{} 1966 } 1967 1968 var _ LogCndSpecQueryStringPayloadTrigger_FieldPathArrayOfValues = (*LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues)(nil) 1969 1970 func (fpaov *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1971 switch fpaov.selector { 1972 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 1973 for _, v := range fpaov.values.([]string) { 1974 values = append(values, v) 1975 } 1976 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1977 for _, v := range fpaov.values.([]string) { 1978 values = append(values, v) 1979 } 1980 } 1981 return 1982 } 1983 func (fpaov *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues) AsObjectSelectorArrayOfValues() ([]string, bool) { 1984 res, ok := fpaov.values.([]string) 1985 return res, ok 1986 } 1987 func (fpaov *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPathArrayOfValues) AsRegexArrayOfValues() ([]string, bool) { 1988 res, ok := fpaov.values.([]string) 1989 return res, ok 1990 } 1991 1992 // FieldPath provides implementation to handle 1993 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1994 type LogCndSpecQueryCompositeTrigger_FieldPath interface { 1995 gotenobject.FieldPath 1996 Selector() LogCndSpecQueryCompositeTrigger_FieldPathSelector 1997 Get(source *LogCndSpec_Query_CompositeTrigger) []interface{} 1998 GetSingle(source *LogCndSpec_Query_CompositeTrigger) (interface{}, bool) 1999 ClearValue(item *LogCndSpec_Query_CompositeTrigger) 2000 2001 // Those methods build corresponding LogCndSpecQueryCompositeTrigger_FieldPathValue 2002 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2003 WithIValue(value interface{}) LogCndSpecQueryCompositeTrigger_FieldPathValue 2004 WithIArrayOfValues(values interface{}) LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues 2005 WithIArrayItemValue(value interface{}) LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue 2006 } 2007 2008 type LogCndSpecQueryCompositeTrigger_FieldPathSelector int32 2009 2010 const ( 2011 LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers LogCndSpecQueryCompositeTrigger_FieldPathSelector = 0 2012 LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator LogCndSpecQueryCompositeTrigger_FieldPathSelector = 1 2013 ) 2014 2015 func (s LogCndSpecQueryCompositeTrigger_FieldPathSelector) String() string { 2016 switch s { 2017 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2018 return "triggers" 2019 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2020 return "operator" 2021 default: 2022 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", s)) 2023 } 2024 } 2025 2026 func BuildLogCndSpecQueryCompositeTrigger_FieldPath(fp gotenobject.RawFieldPath) (LogCndSpecQueryCompositeTrigger_FieldPath, error) { 2027 if len(fp) == 0 { 2028 return nil, status.Error(codes.InvalidArgument, "empty field path for object LogCndSpec_Query_CompositeTrigger") 2029 } 2030 if len(fp) == 1 { 2031 switch fp[0] { 2032 case "triggers": 2033 return &LogCndSpecQueryCompositeTrigger_FieldTerminalPath{selector: LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers}, nil 2034 case "operator": 2035 return &LogCndSpecQueryCompositeTrigger_FieldTerminalPath{selector: LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator}, nil 2036 } 2037 } 2038 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object LogCndSpec_Query_CompositeTrigger", fp) 2039 } 2040 2041 func ParseLogCndSpecQueryCompositeTrigger_FieldPath(rawField string) (LogCndSpecQueryCompositeTrigger_FieldPath, error) { 2042 fp, err := gotenobject.ParseRawFieldPath(rawField) 2043 if err != nil { 2044 return nil, err 2045 } 2046 return BuildLogCndSpecQueryCompositeTrigger_FieldPath(fp) 2047 } 2048 2049 func MustParseLogCndSpecQueryCompositeTrigger_FieldPath(rawField string) LogCndSpecQueryCompositeTrigger_FieldPath { 2050 fp, err := ParseLogCndSpecQueryCompositeTrigger_FieldPath(rawField) 2051 if err != nil { 2052 panic(err) 2053 } 2054 return fp 2055 } 2056 2057 type LogCndSpecQueryCompositeTrigger_FieldTerminalPath struct { 2058 selector LogCndSpecQueryCompositeTrigger_FieldPathSelector 2059 } 2060 2061 var _ LogCndSpecQueryCompositeTrigger_FieldPath = (*LogCndSpecQueryCompositeTrigger_FieldTerminalPath)(nil) 2062 2063 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) Selector() LogCndSpecQueryCompositeTrigger_FieldPathSelector { 2064 return fp.selector 2065 } 2066 2067 // String returns path representation in proto convention 2068 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) String() string { 2069 return fp.selector.String() 2070 } 2071 2072 // JSONString returns path representation is JSON convention 2073 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) JSONString() string { 2074 return strcase.ToLowerCamel(fp.String()) 2075 } 2076 2077 // Get returns all values pointed by specific field from source LogCndSpec_Query_CompositeTrigger 2078 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) Get(source *LogCndSpec_Query_CompositeTrigger) (values []interface{}) { 2079 if source != nil { 2080 switch fp.selector { 2081 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2082 for _, value := range source.GetTriggers() { 2083 values = append(values, value) 2084 } 2085 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2086 values = append(values, source.Operator) 2087 default: 2088 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fp.selector)) 2089 } 2090 } 2091 return 2092 } 2093 2094 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2095 return fp.Get(source.(*LogCndSpec_Query_CompositeTrigger)) 2096 } 2097 2098 // GetSingle returns value pointed by specific field of from source LogCndSpec_Query_CompositeTrigger 2099 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) GetSingle(source *LogCndSpec_Query_CompositeTrigger) (interface{}, bool) { 2100 switch fp.selector { 2101 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2102 res := source.GetTriggers() 2103 return res, res != nil 2104 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2105 return source.GetOperator(), source != nil 2106 default: 2107 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fp.selector)) 2108 } 2109 } 2110 2111 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2112 return fp.GetSingle(source.(*LogCndSpec_Query_CompositeTrigger)) 2113 } 2114 2115 // GetDefault returns a default value of the field type 2116 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) GetDefault() interface{} { 2117 switch fp.selector { 2118 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2119 return ([]*LogCndSpec_Query_TriggerCnd)(nil) 2120 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2121 return LogCndSpec_Query_CompositeTrigger_UNDEFINED 2122 default: 2123 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fp.selector)) 2124 } 2125 } 2126 2127 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) ClearValue(item *LogCndSpec_Query_CompositeTrigger) { 2128 if item != nil { 2129 switch fp.selector { 2130 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2131 item.Triggers = nil 2132 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2133 item.Operator = LogCndSpec_Query_CompositeTrigger_UNDEFINED 2134 default: 2135 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fp.selector)) 2136 } 2137 } 2138 } 2139 2140 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2141 fp.ClearValue(item.(*LogCndSpec_Query_CompositeTrigger)) 2142 } 2143 2144 // IsLeaf - whether field path is holds simple value 2145 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) IsLeaf() bool { 2146 return fp.selector == LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers || 2147 fp.selector == LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator 2148 } 2149 2150 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2151 return []gotenobject.FieldPath{fp} 2152 } 2153 2154 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) WithIValue(value interface{}) LogCndSpecQueryCompositeTrigger_FieldPathValue { 2155 switch fp.selector { 2156 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2157 return &LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue{LogCndSpecQueryCompositeTrigger_FieldTerminalPath: *fp, value: value.([]*LogCndSpec_Query_TriggerCnd)} 2158 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2159 return &LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue{LogCndSpecQueryCompositeTrigger_FieldTerminalPath: *fp, value: value.(LogCndSpec_Query_CompositeTrigger_Operator)} 2160 default: 2161 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fp.selector)) 2162 } 2163 } 2164 2165 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2166 return fp.WithIValue(value) 2167 } 2168 2169 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) WithIArrayOfValues(values interface{}) LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues { 2170 fpaov := &LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryCompositeTrigger_FieldTerminalPath: *fp} 2171 switch fp.selector { 2172 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2173 return &LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryCompositeTrigger_FieldTerminalPath: *fp, values: values.([][]*LogCndSpec_Query_TriggerCnd)} 2174 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2175 return &LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues{LogCndSpecQueryCompositeTrigger_FieldTerminalPath: *fp, values: values.([]LogCndSpec_Query_CompositeTrigger_Operator)} 2176 default: 2177 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fp.selector)) 2178 } 2179 return fpaov 2180 } 2181 2182 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2183 return fp.WithIArrayOfValues(values) 2184 } 2185 2186 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) WithIArrayItemValue(value interface{}) LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue { 2187 switch fp.selector { 2188 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2189 return &LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue{LogCndSpecQueryCompositeTrigger_FieldTerminalPath: *fp, value: value.(*LogCndSpec_Query_TriggerCnd)} 2190 default: 2191 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fp.selector)) 2192 } 2193 } 2194 2195 func (fp *LogCndSpecQueryCompositeTrigger_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2196 return fp.WithIArrayItemValue(value) 2197 } 2198 2199 // LogCndSpecQueryCompositeTrigger_FieldPathValue allows storing values for CompositeTrigger fields according to their type 2200 type LogCndSpecQueryCompositeTrigger_FieldPathValue interface { 2201 LogCndSpecQueryCompositeTrigger_FieldPath 2202 gotenobject.FieldPathValue 2203 SetTo(target **LogCndSpec_Query_CompositeTrigger) 2204 CompareWith(*LogCndSpec_Query_CompositeTrigger) (cmp int, comparable bool) 2205 } 2206 2207 func ParseLogCndSpecQueryCompositeTrigger_FieldPathValue(pathStr, valueStr string) (LogCndSpecQueryCompositeTrigger_FieldPathValue, error) { 2208 fp, err := ParseLogCndSpecQueryCompositeTrigger_FieldPath(pathStr) 2209 if err != nil { 2210 return nil, err 2211 } 2212 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2213 if err != nil { 2214 return nil, status.Errorf(codes.InvalidArgument, "error parsing CompositeTrigger field path value from %s: %v", valueStr, err) 2215 } 2216 return fpv.(LogCndSpecQueryCompositeTrigger_FieldPathValue), nil 2217 } 2218 2219 func MustParseLogCndSpecQueryCompositeTrigger_FieldPathValue(pathStr, valueStr string) LogCndSpecQueryCompositeTrigger_FieldPathValue { 2220 fpv, err := ParseLogCndSpecQueryCompositeTrigger_FieldPathValue(pathStr, valueStr) 2221 if err != nil { 2222 panic(err) 2223 } 2224 return fpv 2225 } 2226 2227 type LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue struct { 2228 LogCndSpecQueryCompositeTrigger_FieldTerminalPath 2229 value interface{} 2230 } 2231 2232 var _ LogCndSpecQueryCompositeTrigger_FieldPathValue = (*LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue)(nil) 2233 2234 // GetRawValue returns raw value stored under selected path for 'CompositeTrigger' as interface{} 2235 func (fpv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue) GetRawValue() interface{} { 2236 return fpv.value 2237 } 2238 func (fpv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue) AsTriggersValue() ([]*LogCndSpec_Query_TriggerCnd, bool) { 2239 res, ok := fpv.value.([]*LogCndSpec_Query_TriggerCnd) 2240 return res, ok 2241 } 2242 func (fpv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue) AsOperatorValue() (LogCndSpec_Query_CompositeTrigger_Operator, bool) { 2243 res, ok := fpv.value.(LogCndSpec_Query_CompositeTrigger_Operator) 2244 return res, ok 2245 } 2246 2247 // SetTo stores value for selected field for object CompositeTrigger 2248 func (fpv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue) SetTo(target **LogCndSpec_Query_CompositeTrigger) { 2249 if *target == nil { 2250 *target = new(LogCndSpec_Query_CompositeTrigger) 2251 } 2252 switch fpv.selector { 2253 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2254 (*target).Triggers = fpv.value.([]*LogCndSpec_Query_TriggerCnd) 2255 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2256 (*target).Operator = fpv.value.(LogCndSpec_Query_CompositeTrigger_Operator) 2257 default: 2258 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fpv.selector)) 2259 } 2260 } 2261 2262 func (fpv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2263 typedObject := target.(*LogCndSpec_Query_CompositeTrigger) 2264 fpv.SetTo(&typedObject) 2265 } 2266 2267 // CompareWith compares value in the 'LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue' with the value under path in 'LogCndSpec_Query_CompositeTrigger'. 2268 func (fpv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue) CompareWith(source *LogCndSpec_Query_CompositeTrigger) (int, bool) { 2269 switch fpv.selector { 2270 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2271 return 0, false 2272 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2273 leftValue := fpv.value.(LogCndSpec_Query_CompositeTrigger_Operator) 2274 rightValue := source.GetOperator() 2275 if (leftValue) == (rightValue) { 2276 return 0, true 2277 } else if (leftValue) < (rightValue) { 2278 return -1, true 2279 } else { 2280 return 1, true 2281 } 2282 default: 2283 panic(fmt.Sprintf("Invalid selector for LogCndSpec_Query_CompositeTrigger: %d", fpv.selector)) 2284 } 2285 } 2286 2287 func (fpv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2288 return fpv.CompareWith(source.(*LogCndSpec_Query_CompositeTrigger)) 2289 } 2290 2291 // LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue allows storing single item in Path-specific values for CompositeTrigger according to their type 2292 // Present only for array (repeated) types. 2293 type LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue interface { 2294 gotenobject.FieldPathArrayItemValue 2295 LogCndSpecQueryCompositeTrigger_FieldPath 2296 ContainsValue(*LogCndSpec_Query_CompositeTrigger) bool 2297 } 2298 2299 // ParseLogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2300 func ParseLogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue(pathStr, valueStr string) (LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue, error) { 2301 fp, err := ParseLogCndSpecQueryCompositeTrigger_FieldPath(pathStr) 2302 if err != nil { 2303 return nil, err 2304 } 2305 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2306 if err != nil { 2307 return nil, status.Errorf(codes.InvalidArgument, "error parsing CompositeTrigger field path array item value from %s: %v", valueStr, err) 2308 } 2309 return fpaiv.(LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue), nil 2310 } 2311 2312 func MustParseLogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue(pathStr, valueStr string) LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue { 2313 fpaiv, err := ParseLogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue(pathStr, valueStr) 2314 if err != nil { 2315 panic(err) 2316 } 2317 return fpaiv 2318 } 2319 2320 type LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue struct { 2321 LogCndSpecQueryCompositeTrigger_FieldTerminalPath 2322 value interface{} 2323 } 2324 2325 var _ LogCndSpecQueryCompositeTrigger_FieldPathArrayItemValue = (*LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue)(nil) 2326 2327 // GetRawValue returns stored element value for array in object LogCndSpec_Query_CompositeTrigger as interface{} 2328 func (fpaiv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2329 return fpaiv.value 2330 } 2331 func (fpaiv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue) AsTriggersItemValue() (*LogCndSpec_Query_TriggerCnd, bool) { 2332 res, ok := fpaiv.value.(*LogCndSpec_Query_TriggerCnd) 2333 return res, ok 2334 } 2335 2336 func (fpaiv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue) GetSingle(source *LogCndSpec_Query_CompositeTrigger) (interface{}, bool) { 2337 return nil, false 2338 } 2339 2340 func (fpaiv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2341 return fpaiv.GetSingle(source.(*LogCndSpec_Query_CompositeTrigger)) 2342 } 2343 2344 // Contains returns a boolean indicating if value that is being held is present in given 'CompositeTrigger' 2345 func (fpaiv *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayItemValue) ContainsValue(source *LogCndSpec_Query_CompositeTrigger) bool { 2346 slice := fpaiv.LogCndSpecQueryCompositeTrigger_FieldTerminalPath.Get(source) 2347 for _, v := range slice { 2348 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2349 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2350 return true 2351 } 2352 } else if reflect.DeepEqual(v, fpaiv.value) { 2353 return true 2354 } 2355 } 2356 return false 2357 } 2358 2359 // LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues allows storing slice of values for CompositeTrigger fields according to their type 2360 type LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues interface { 2361 gotenobject.FieldPathArrayOfValues 2362 LogCndSpecQueryCompositeTrigger_FieldPath 2363 } 2364 2365 func ParseLogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues(pathStr, valuesStr string) (LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues, error) { 2366 fp, err := ParseLogCndSpecQueryCompositeTrigger_FieldPath(pathStr) 2367 if err != nil { 2368 return nil, err 2369 } 2370 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2371 if err != nil { 2372 return nil, status.Errorf(codes.InvalidArgument, "error parsing CompositeTrigger field path array of values from %s: %v", valuesStr, err) 2373 } 2374 return fpaov.(LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues), nil 2375 } 2376 2377 func MustParseLogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues(pathStr, valuesStr string) LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues { 2378 fpaov, err := ParseLogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues(pathStr, valuesStr) 2379 if err != nil { 2380 panic(err) 2381 } 2382 return fpaov 2383 } 2384 2385 type LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues struct { 2386 LogCndSpecQueryCompositeTrigger_FieldTerminalPath 2387 values interface{} 2388 } 2389 2390 var _ LogCndSpecQueryCompositeTrigger_FieldPathArrayOfValues = (*LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues)(nil) 2391 2392 func (fpaov *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2393 switch fpaov.selector { 2394 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 2395 for _, v := range fpaov.values.([][]*LogCndSpec_Query_TriggerCnd) { 2396 values = append(values, v) 2397 } 2398 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 2399 for _, v := range fpaov.values.([]LogCndSpec_Query_CompositeTrigger_Operator) { 2400 values = append(values, v) 2401 } 2402 } 2403 return 2404 } 2405 func (fpaov *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues) AsTriggersArrayOfValues() ([][]*LogCndSpec_Query_TriggerCnd, bool) { 2406 res, ok := fpaov.values.([][]*LogCndSpec_Query_TriggerCnd) 2407 return res, ok 2408 } 2409 func (fpaov *LogCndSpecQueryCompositeTrigger_FieldTerminalPathArrayOfValues) AsOperatorArrayOfValues() ([]LogCndSpec_Query_CompositeTrigger_Operator, bool) { 2410 res, ok := fpaov.values.([]LogCndSpec_Query_CompositeTrigger_Operator) 2411 return res, ok 2412 } 2413 2414 // FieldPath provides implementation to handle 2415 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2416 type TsCndSpec_FieldPath interface { 2417 gotenobject.FieldPath 2418 Selector() TsCndSpec_FieldPathSelector 2419 Get(source *TsCndSpec) []interface{} 2420 GetSingle(source *TsCndSpec) (interface{}, bool) 2421 ClearValue(item *TsCndSpec) 2422 2423 // Those methods build corresponding TsCndSpec_FieldPathValue 2424 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2425 WithIValue(value interface{}) TsCndSpec_FieldPathValue 2426 WithIArrayOfValues(values interface{}) TsCndSpec_FieldPathArrayOfValues 2427 WithIArrayItemValue(value interface{}) TsCndSpec_FieldPathArrayItemValue 2428 } 2429 2430 type TsCndSpec_FieldPathSelector int32 2431 2432 const ( 2433 TsCndSpec_FieldPathSelectorQueries TsCndSpec_FieldPathSelector = 0 2434 TsCndSpec_FieldPathSelectorQueryGroupBy TsCndSpec_FieldPathSelector = 1 2435 TsCndSpec_FieldPathSelectorThresholdAlerting TsCndSpec_FieldPathSelector = 2 2436 TsCndSpec_FieldPathSelectorAnomalyAlerting TsCndSpec_FieldPathSelector = 3 2437 ) 2438 2439 func (s TsCndSpec_FieldPathSelector) String() string { 2440 switch s { 2441 case TsCndSpec_FieldPathSelectorQueries: 2442 return "queries" 2443 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2444 return "query_group_by" 2445 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2446 return "threshold_alerting" 2447 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2448 return "anomaly_alerting" 2449 default: 2450 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", s)) 2451 } 2452 } 2453 2454 func BuildTsCndSpec_FieldPath(fp gotenobject.RawFieldPath) (TsCndSpec_FieldPath, error) { 2455 if len(fp) == 0 { 2456 return nil, status.Error(codes.InvalidArgument, "empty field path for object TsCndSpec") 2457 } 2458 if len(fp) == 1 { 2459 switch fp[0] { 2460 case "queries": 2461 return &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorQueries}, nil 2462 case "query_group_by", "queryGroupBy", "query-group-by": 2463 return &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorQueryGroupBy}, nil 2464 case "threshold_alerting", "thresholdAlerting", "threshold-alerting": 2465 return &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorThresholdAlerting}, nil 2466 case "anomaly_alerting", "anomalyAlerting", "anomaly-alerting": 2467 return &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorAnomalyAlerting}, nil 2468 } 2469 } else { 2470 switch fp[0] { 2471 case "queries": 2472 if subpath, err := BuildTsCndSpecQuery_FieldPath(fp[1:]); err != nil { 2473 return nil, err 2474 } else { 2475 return &TsCndSpec_FieldSubPath{selector: TsCndSpec_FieldPathSelectorQueries, subPath: subpath}, nil 2476 } 2477 case "threshold_alerting", "thresholdAlerting", "threshold-alerting": 2478 if subpath, err := BuildTsCndSpecThresholdAlertingCfg_FieldPath(fp[1:]); err != nil { 2479 return nil, err 2480 } else { 2481 return &TsCndSpec_FieldSubPath{selector: TsCndSpec_FieldPathSelectorThresholdAlerting, subPath: subpath}, nil 2482 } 2483 case "anomaly_alerting", "anomalyAlerting", "anomaly-alerting": 2484 if subpath, err := BuildTsCndSpecAnomalyAlertingCfg_FieldPath(fp[1:]); err != nil { 2485 return nil, err 2486 } else { 2487 return &TsCndSpec_FieldSubPath{selector: TsCndSpec_FieldPathSelectorAnomalyAlerting, subPath: subpath}, nil 2488 } 2489 } 2490 } 2491 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object TsCndSpec", fp) 2492 } 2493 2494 func ParseTsCndSpec_FieldPath(rawField string) (TsCndSpec_FieldPath, error) { 2495 fp, err := gotenobject.ParseRawFieldPath(rawField) 2496 if err != nil { 2497 return nil, err 2498 } 2499 return BuildTsCndSpec_FieldPath(fp) 2500 } 2501 2502 func MustParseTsCndSpec_FieldPath(rawField string) TsCndSpec_FieldPath { 2503 fp, err := ParseTsCndSpec_FieldPath(rawField) 2504 if err != nil { 2505 panic(err) 2506 } 2507 return fp 2508 } 2509 2510 type TsCndSpec_FieldTerminalPath struct { 2511 selector TsCndSpec_FieldPathSelector 2512 } 2513 2514 var _ TsCndSpec_FieldPath = (*TsCndSpec_FieldTerminalPath)(nil) 2515 2516 func (fp *TsCndSpec_FieldTerminalPath) Selector() TsCndSpec_FieldPathSelector { 2517 return fp.selector 2518 } 2519 2520 // String returns path representation in proto convention 2521 func (fp *TsCndSpec_FieldTerminalPath) String() string { 2522 return fp.selector.String() 2523 } 2524 2525 // JSONString returns path representation is JSON convention 2526 func (fp *TsCndSpec_FieldTerminalPath) JSONString() string { 2527 return strcase.ToLowerCamel(fp.String()) 2528 } 2529 2530 // Get returns all values pointed by specific field from source TsCndSpec 2531 func (fp *TsCndSpec_FieldTerminalPath) Get(source *TsCndSpec) (values []interface{}) { 2532 if source != nil { 2533 switch fp.selector { 2534 case TsCndSpec_FieldPathSelectorQueries: 2535 for _, value := range source.GetQueries() { 2536 values = append(values, value) 2537 } 2538 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2539 for _, value := range source.GetQueryGroupBy() { 2540 values = append(values, value) 2541 } 2542 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2543 if source.ThresholdAlerting != nil { 2544 values = append(values, source.ThresholdAlerting) 2545 } 2546 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2547 for _, value := range source.GetAnomalyAlerting() { 2548 values = append(values, value) 2549 } 2550 default: 2551 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fp.selector)) 2552 } 2553 } 2554 return 2555 } 2556 2557 func (fp *TsCndSpec_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2558 return fp.Get(source.(*TsCndSpec)) 2559 } 2560 2561 // GetSingle returns value pointed by specific field of from source TsCndSpec 2562 func (fp *TsCndSpec_FieldTerminalPath) GetSingle(source *TsCndSpec) (interface{}, bool) { 2563 switch fp.selector { 2564 case TsCndSpec_FieldPathSelectorQueries: 2565 res := source.GetQueries() 2566 return res, res != nil 2567 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2568 res := source.GetQueryGroupBy() 2569 return res, res != nil 2570 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2571 res := source.GetThresholdAlerting() 2572 return res, res != nil 2573 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2574 res := source.GetAnomalyAlerting() 2575 return res, res != nil 2576 default: 2577 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fp.selector)) 2578 } 2579 } 2580 2581 func (fp *TsCndSpec_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2582 return fp.GetSingle(source.(*TsCndSpec)) 2583 } 2584 2585 // GetDefault returns a default value of the field type 2586 func (fp *TsCndSpec_FieldTerminalPath) GetDefault() interface{} { 2587 switch fp.selector { 2588 case TsCndSpec_FieldPathSelectorQueries: 2589 return ([]*TsCndSpec_Query)(nil) 2590 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2591 return ([]string)(nil) 2592 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2593 return (*TsCndSpec_ThresholdAlertingCfg)(nil) 2594 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2595 return ([]*TsCndSpec_AnomalyAlertingCfg)(nil) 2596 default: 2597 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fp.selector)) 2598 } 2599 } 2600 2601 func (fp *TsCndSpec_FieldTerminalPath) ClearValue(item *TsCndSpec) { 2602 if item != nil { 2603 switch fp.selector { 2604 case TsCndSpec_FieldPathSelectorQueries: 2605 item.Queries = nil 2606 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2607 item.QueryGroupBy = nil 2608 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2609 item.ThresholdAlerting = nil 2610 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2611 item.AnomalyAlerting = nil 2612 default: 2613 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fp.selector)) 2614 } 2615 } 2616 } 2617 2618 func (fp *TsCndSpec_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2619 fp.ClearValue(item.(*TsCndSpec)) 2620 } 2621 2622 // IsLeaf - whether field path is holds simple value 2623 func (fp *TsCndSpec_FieldTerminalPath) IsLeaf() bool { 2624 return fp.selector == TsCndSpec_FieldPathSelectorQueryGroupBy 2625 } 2626 2627 func (fp *TsCndSpec_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2628 return []gotenobject.FieldPath{fp} 2629 } 2630 2631 func (fp *TsCndSpec_FieldTerminalPath) WithIValue(value interface{}) TsCndSpec_FieldPathValue { 2632 switch fp.selector { 2633 case TsCndSpec_FieldPathSelectorQueries: 2634 return &TsCndSpec_FieldTerminalPathValue{TsCndSpec_FieldTerminalPath: *fp, value: value.([]*TsCndSpec_Query)} 2635 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2636 return &TsCndSpec_FieldTerminalPathValue{TsCndSpec_FieldTerminalPath: *fp, value: value.([]string)} 2637 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2638 return &TsCndSpec_FieldTerminalPathValue{TsCndSpec_FieldTerminalPath: *fp, value: value.(*TsCndSpec_ThresholdAlertingCfg)} 2639 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2640 return &TsCndSpec_FieldTerminalPathValue{TsCndSpec_FieldTerminalPath: *fp, value: value.([]*TsCndSpec_AnomalyAlertingCfg)} 2641 default: 2642 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fp.selector)) 2643 } 2644 } 2645 2646 func (fp *TsCndSpec_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2647 return fp.WithIValue(value) 2648 } 2649 2650 func (fp *TsCndSpec_FieldTerminalPath) WithIArrayOfValues(values interface{}) TsCndSpec_FieldPathArrayOfValues { 2651 fpaov := &TsCndSpec_FieldTerminalPathArrayOfValues{TsCndSpec_FieldTerminalPath: *fp} 2652 switch fp.selector { 2653 case TsCndSpec_FieldPathSelectorQueries: 2654 return &TsCndSpec_FieldTerminalPathArrayOfValues{TsCndSpec_FieldTerminalPath: *fp, values: values.([][]*TsCndSpec_Query)} 2655 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2656 return &TsCndSpec_FieldTerminalPathArrayOfValues{TsCndSpec_FieldTerminalPath: *fp, values: values.([][]string)} 2657 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2658 return &TsCndSpec_FieldTerminalPathArrayOfValues{TsCndSpec_FieldTerminalPath: *fp, values: values.([]*TsCndSpec_ThresholdAlertingCfg)} 2659 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2660 return &TsCndSpec_FieldTerminalPathArrayOfValues{TsCndSpec_FieldTerminalPath: *fp, values: values.([][]*TsCndSpec_AnomalyAlertingCfg)} 2661 default: 2662 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fp.selector)) 2663 } 2664 return fpaov 2665 } 2666 2667 func (fp *TsCndSpec_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2668 return fp.WithIArrayOfValues(values) 2669 } 2670 2671 func (fp *TsCndSpec_FieldTerminalPath) WithIArrayItemValue(value interface{}) TsCndSpec_FieldPathArrayItemValue { 2672 switch fp.selector { 2673 case TsCndSpec_FieldPathSelectorQueries: 2674 return &TsCndSpec_FieldTerminalPathArrayItemValue{TsCndSpec_FieldTerminalPath: *fp, value: value.(*TsCndSpec_Query)} 2675 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2676 return &TsCndSpec_FieldTerminalPathArrayItemValue{TsCndSpec_FieldTerminalPath: *fp, value: value.(string)} 2677 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2678 return &TsCndSpec_FieldTerminalPathArrayItemValue{TsCndSpec_FieldTerminalPath: *fp, value: value.(*TsCndSpec_AnomalyAlertingCfg)} 2679 default: 2680 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fp.selector)) 2681 } 2682 } 2683 2684 func (fp *TsCndSpec_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2685 return fp.WithIArrayItemValue(value) 2686 } 2687 2688 type TsCndSpec_FieldSubPath struct { 2689 selector TsCndSpec_FieldPathSelector 2690 subPath gotenobject.FieldPath 2691 } 2692 2693 var _ TsCndSpec_FieldPath = (*TsCndSpec_FieldSubPath)(nil) 2694 2695 func (fps *TsCndSpec_FieldSubPath) Selector() TsCndSpec_FieldPathSelector { 2696 return fps.selector 2697 } 2698 func (fps *TsCndSpec_FieldSubPath) AsQueriesSubPath() (TsCndSpecQuery_FieldPath, bool) { 2699 res, ok := fps.subPath.(TsCndSpecQuery_FieldPath) 2700 return res, ok 2701 } 2702 func (fps *TsCndSpec_FieldSubPath) AsThresholdAlertingSubPath() (TsCndSpecThresholdAlertingCfg_FieldPath, bool) { 2703 res, ok := fps.subPath.(TsCndSpecThresholdAlertingCfg_FieldPath) 2704 return res, ok 2705 } 2706 func (fps *TsCndSpec_FieldSubPath) AsAnomalyAlertingSubPath() (TsCndSpecAnomalyAlertingCfg_FieldPath, bool) { 2707 res, ok := fps.subPath.(TsCndSpecAnomalyAlertingCfg_FieldPath) 2708 return res, ok 2709 } 2710 2711 // String returns path representation in proto convention 2712 func (fps *TsCndSpec_FieldSubPath) String() string { 2713 return fps.selector.String() + "." + fps.subPath.String() 2714 } 2715 2716 // JSONString returns path representation is JSON convention 2717 func (fps *TsCndSpec_FieldSubPath) JSONString() string { 2718 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2719 } 2720 2721 // Get returns all values pointed by selected field from source TsCndSpec 2722 func (fps *TsCndSpec_FieldSubPath) Get(source *TsCndSpec) (values []interface{}) { 2723 switch fps.selector { 2724 case TsCndSpec_FieldPathSelectorQueries: 2725 for _, item := range source.GetQueries() { 2726 values = append(values, fps.subPath.GetRaw(item)...) 2727 } 2728 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2729 values = append(values, fps.subPath.GetRaw(source.GetThresholdAlerting())...) 2730 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2731 for _, item := range source.GetAnomalyAlerting() { 2732 values = append(values, fps.subPath.GetRaw(item)...) 2733 } 2734 default: 2735 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fps.selector)) 2736 } 2737 return 2738 } 2739 2740 func (fps *TsCndSpec_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2741 return fps.Get(source.(*TsCndSpec)) 2742 } 2743 2744 // GetSingle returns value of selected field from source TsCndSpec 2745 func (fps *TsCndSpec_FieldSubPath) GetSingle(source *TsCndSpec) (interface{}, bool) { 2746 switch fps.selector { 2747 case TsCndSpec_FieldPathSelectorQueries: 2748 if len(source.GetQueries()) == 0 { 2749 return nil, false 2750 } 2751 return fps.subPath.GetSingleRaw(source.GetQueries()[0]) 2752 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2753 if source.GetThresholdAlerting() == nil { 2754 return nil, false 2755 } 2756 return fps.subPath.GetSingleRaw(source.GetThresholdAlerting()) 2757 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2758 if len(source.GetAnomalyAlerting()) == 0 { 2759 return nil, false 2760 } 2761 return fps.subPath.GetSingleRaw(source.GetAnomalyAlerting()[0]) 2762 default: 2763 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fps.selector)) 2764 } 2765 } 2766 2767 func (fps *TsCndSpec_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2768 return fps.GetSingle(source.(*TsCndSpec)) 2769 } 2770 2771 // GetDefault returns a default value of the field type 2772 func (fps *TsCndSpec_FieldSubPath) GetDefault() interface{} { 2773 return fps.subPath.GetDefault() 2774 } 2775 2776 func (fps *TsCndSpec_FieldSubPath) ClearValue(item *TsCndSpec) { 2777 if item != nil { 2778 switch fps.selector { 2779 case TsCndSpec_FieldPathSelectorQueries: 2780 for _, subItem := range item.Queries { 2781 fps.subPath.ClearValueRaw(subItem) 2782 } 2783 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2784 fps.subPath.ClearValueRaw(item.ThresholdAlerting) 2785 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2786 for _, subItem := range item.AnomalyAlerting { 2787 fps.subPath.ClearValueRaw(subItem) 2788 } 2789 default: 2790 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fps.selector)) 2791 } 2792 } 2793 } 2794 2795 func (fps *TsCndSpec_FieldSubPath) ClearValueRaw(item proto.Message) { 2796 fps.ClearValue(item.(*TsCndSpec)) 2797 } 2798 2799 // IsLeaf - whether field path is holds simple value 2800 func (fps *TsCndSpec_FieldSubPath) IsLeaf() bool { 2801 return fps.subPath.IsLeaf() 2802 } 2803 2804 func (fps *TsCndSpec_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2805 iPaths := []gotenobject.FieldPath{&TsCndSpec_FieldTerminalPath{selector: fps.selector}} 2806 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2807 return iPaths 2808 } 2809 2810 func (fps *TsCndSpec_FieldSubPath) WithIValue(value interface{}) TsCndSpec_FieldPathValue { 2811 return &TsCndSpec_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2812 } 2813 2814 func (fps *TsCndSpec_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2815 return fps.WithIValue(value) 2816 } 2817 2818 func (fps *TsCndSpec_FieldSubPath) WithIArrayOfValues(values interface{}) TsCndSpec_FieldPathArrayOfValues { 2819 return &TsCndSpec_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2820 } 2821 2822 func (fps *TsCndSpec_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2823 return fps.WithIArrayOfValues(values) 2824 } 2825 2826 func (fps *TsCndSpec_FieldSubPath) WithIArrayItemValue(value interface{}) TsCndSpec_FieldPathArrayItemValue { 2827 return &TsCndSpec_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2828 } 2829 2830 func (fps *TsCndSpec_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2831 return fps.WithIArrayItemValue(value) 2832 } 2833 2834 // TsCndSpec_FieldPathValue allows storing values for TsCndSpec fields according to their type 2835 type TsCndSpec_FieldPathValue interface { 2836 TsCndSpec_FieldPath 2837 gotenobject.FieldPathValue 2838 SetTo(target **TsCndSpec) 2839 CompareWith(*TsCndSpec) (cmp int, comparable bool) 2840 } 2841 2842 func ParseTsCndSpec_FieldPathValue(pathStr, valueStr string) (TsCndSpec_FieldPathValue, error) { 2843 fp, err := ParseTsCndSpec_FieldPath(pathStr) 2844 if err != nil { 2845 return nil, err 2846 } 2847 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2848 if err != nil { 2849 return nil, status.Errorf(codes.InvalidArgument, "error parsing TsCndSpec field path value from %s: %v", valueStr, err) 2850 } 2851 return fpv.(TsCndSpec_FieldPathValue), nil 2852 } 2853 2854 func MustParseTsCndSpec_FieldPathValue(pathStr, valueStr string) TsCndSpec_FieldPathValue { 2855 fpv, err := ParseTsCndSpec_FieldPathValue(pathStr, valueStr) 2856 if err != nil { 2857 panic(err) 2858 } 2859 return fpv 2860 } 2861 2862 type TsCndSpec_FieldTerminalPathValue struct { 2863 TsCndSpec_FieldTerminalPath 2864 value interface{} 2865 } 2866 2867 var _ TsCndSpec_FieldPathValue = (*TsCndSpec_FieldTerminalPathValue)(nil) 2868 2869 // GetRawValue returns raw value stored under selected path for 'TsCndSpec' as interface{} 2870 func (fpv *TsCndSpec_FieldTerminalPathValue) GetRawValue() interface{} { 2871 return fpv.value 2872 } 2873 func (fpv *TsCndSpec_FieldTerminalPathValue) AsQueriesValue() ([]*TsCndSpec_Query, bool) { 2874 res, ok := fpv.value.([]*TsCndSpec_Query) 2875 return res, ok 2876 } 2877 func (fpv *TsCndSpec_FieldTerminalPathValue) AsQueryGroupByValue() ([]string, bool) { 2878 res, ok := fpv.value.([]string) 2879 return res, ok 2880 } 2881 func (fpv *TsCndSpec_FieldTerminalPathValue) AsThresholdAlertingValue() (*TsCndSpec_ThresholdAlertingCfg, bool) { 2882 res, ok := fpv.value.(*TsCndSpec_ThresholdAlertingCfg) 2883 return res, ok 2884 } 2885 func (fpv *TsCndSpec_FieldTerminalPathValue) AsAnomalyAlertingValue() ([]*TsCndSpec_AnomalyAlertingCfg, bool) { 2886 res, ok := fpv.value.([]*TsCndSpec_AnomalyAlertingCfg) 2887 return res, ok 2888 } 2889 2890 // SetTo stores value for selected field for object TsCndSpec 2891 func (fpv *TsCndSpec_FieldTerminalPathValue) SetTo(target **TsCndSpec) { 2892 if *target == nil { 2893 *target = new(TsCndSpec) 2894 } 2895 switch fpv.selector { 2896 case TsCndSpec_FieldPathSelectorQueries: 2897 (*target).Queries = fpv.value.([]*TsCndSpec_Query) 2898 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2899 (*target).QueryGroupBy = fpv.value.([]string) 2900 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2901 (*target).ThresholdAlerting = fpv.value.(*TsCndSpec_ThresholdAlertingCfg) 2902 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2903 (*target).AnomalyAlerting = fpv.value.([]*TsCndSpec_AnomalyAlertingCfg) 2904 default: 2905 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fpv.selector)) 2906 } 2907 } 2908 2909 func (fpv *TsCndSpec_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2910 typedObject := target.(*TsCndSpec) 2911 fpv.SetTo(&typedObject) 2912 } 2913 2914 // CompareWith compares value in the 'TsCndSpec_FieldTerminalPathValue' with the value under path in 'TsCndSpec'. 2915 func (fpv *TsCndSpec_FieldTerminalPathValue) CompareWith(source *TsCndSpec) (int, bool) { 2916 switch fpv.selector { 2917 case TsCndSpec_FieldPathSelectorQueries: 2918 return 0, false 2919 case TsCndSpec_FieldPathSelectorQueryGroupBy: 2920 return 0, false 2921 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2922 return 0, false 2923 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2924 return 0, false 2925 default: 2926 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fpv.selector)) 2927 } 2928 } 2929 2930 func (fpv *TsCndSpec_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2931 return fpv.CompareWith(source.(*TsCndSpec)) 2932 } 2933 2934 type TsCndSpec_FieldSubPathValue struct { 2935 TsCndSpec_FieldPath 2936 subPathValue gotenobject.FieldPathValue 2937 } 2938 2939 var _ TsCndSpec_FieldPathValue = (*TsCndSpec_FieldSubPathValue)(nil) 2940 2941 func (fpvs *TsCndSpec_FieldSubPathValue) AsQueriesPathValue() (TsCndSpecQuery_FieldPathValue, bool) { 2942 res, ok := fpvs.subPathValue.(TsCndSpecQuery_FieldPathValue) 2943 return res, ok 2944 } 2945 func (fpvs *TsCndSpec_FieldSubPathValue) AsThresholdAlertingPathValue() (TsCndSpecThresholdAlertingCfg_FieldPathValue, bool) { 2946 res, ok := fpvs.subPathValue.(TsCndSpecThresholdAlertingCfg_FieldPathValue) 2947 return res, ok 2948 } 2949 func (fpvs *TsCndSpec_FieldSubPathValue) AsAnomalyAlertingPathValue() (TsCndSpecAnomalyAlertingCfg_FieldPathValue, bool) { 2950 res, ok := fpvs.subPathValue.(TsCndSpecAnomalyAlertingCfg_FieldPathValue) 2951 return res, ok 2952 } 2953 2954 func (fpvs *TsCndSpec_FieldSubPathValue) SetTo(target **TsCndSpec) { 2955 if *target == nil { 2956 *target = new(TsCndSpec) 2957 } 2958 switch fpvs.Selector() { 2959 case TsCndSpec_FieldPathSelectorQueries: 2960 panic("FieldPath setter is unsupported for array subpaths") 2961 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2962 fpvs.subPathValue.(TsCndSpecThresholdAlertingCfg_FieldPathValue).SetTo(&(*target).ThresholdAlerting) 2963 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2964 panic("FieldPath setter is unsupported for array subpaths") 2965 default: 2966 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fpvs.Selector())) 2967 } 2968 } 2969 2970 func (fpvs *TsCndSpec_FieldSubPathValue) SetToRaw(target proto.Message) { 2971 typedObject := target.(*TsCndSpec) 2972 fpvs.SetTo(&typedObject) 2973 } 2974 2975 func (fpvs *TsCndSpec_FieldSubPathValue) GetRawValue() interface{} { 2976 return fpvs.subPathValue.GetRawValue() 2977 } 2978 2979 func (fpvs *TsCndSpec_FieldSubPathValue) CompareWith(source *TsCndSpec) (int, bool) { 2980 switch fpvs.Selector() { 2981 case TsCndSpec_FieldPathSelectorQueries: 2982 return 0, false // repeated field 2983 case TsCndSpec_FieldPathSelectorThresholdAlerting: 2984 return fpvs.subPathValue.(TsCndSpecThresholdAlertingCfg_FieldPathValue).CompareWith(source.GetThresholdAlerting()) 2985 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 2986 return 0, false // repeated field 2987 default: 2988 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fpvs.Selector())) 2989 } 2990 } 2991 2992 func (fpvs *TsCndSpec_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2993 return fpvs.CompareWith(source.(*TsCndSpec)) 2994 } 2995 2996 // TsCndSpec_FieldPathArrayItemValue allows storing single item in Path-specific values for TsCndSpec according to their type 2997 // Present only for array (repeated) types. 2998 type TsCndSpec_FieldPathArrayItemValue interface { 2999 gotenobject.FieldPathArrayItemValue 3000 TsCndSpec_FieldPath 3001 ContainsValue(*TsCndSpec) bool 3002 } 3003 3004 // ParseTsCndSpec_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3005 func ParseTsCndSpec_FieldPathArrayItemValue(pathStr, valueStr string) (TsCndSpec_FieldPathArrayItemValue, error) { 3006 fp, err := ParseTsCndSpec_FieldPath(pathStr) 3007 if err != nil { 3008 return nil, err 3009 } 3010 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3011 if err != nil { 3012 return nil, status.Errorf(codes.InvalidArgument, "error parsing TsCndSpec field path array item value from %s: %v", valueStr, err) 3013 } 3014 return fpaiv.(TsCndSpec_FieldPathArrayItemValue), nil 3015 } 3016 3017 func MustParseTsCndSpec_FieldPathArrayItemValue(pathStr, valueStr string) TsCndSpec_FieldPathArrayItemValue { 3018 fpaiv, err := ParseTsCndSpec_FieldPathArrayItemValue(pathStr, valueStr) 3019 if err != nil { 3020 panic(err) 3021 } 3022 return fpaiv 3023 } 3024 3025 type TsCndSpec_FieldTerminalPathArrayItemValue struct { 3026 TsCndSpec_FieldTerminalPath 3027 value interface{} 3028 } 3029 3030 var _ TsCndSpec_FieldPathArrayItemValue = (*TsCndSpec_FieldTerminalPathArrayItemValue)(nil) 3031 3032 // GetRawValue returns stored element value for array in object TsCndSpec as interface{} 3033 func (fpaiv *TsCndSpec_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3034 return fpaiv.value 3035 } 3036 func (fpaiv *TsCndSpec_FieldTerminalPathArrayItemValue) AsQueriesItemValue() (*TsCndSpec_Query, bool) { 3037 res, ok := fpaiv.value.(*TsCndSpec_Query) 3038 return res, ok 3039 } 3040 func (fpaiv *TsCndSpec_FieldTerminalPathArrayItemValue) AsQueryGroupByItemValue() (string, bool) { 3041 res, ok := fpaiv.value.(string) 3042 return res, ok 3043 } 3044 func (fpaiv *TsCndSpec_FieldTerminalPathArrayItemValue) AsAnomalyAlertingItemValue() (*TsCndSpec_AnomalyAlertingCfg, bool) { 3045 res, ok := fpaiv.value.(*TsCndSpec_AnomalyAlertingCfg) 3046 return res, ok 3047 } 3048 3049 func (fpaiv *TsCndSpec_FieldTerminalPathArrayItemValue) GetSingle(source *TsCndSpec) (interface{}, bool) { 3050 return nil, false 3051 } 3052 3053 func (fpaiv *TsCndSpec_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3054 return fpaiv.GetSingle(source.(*TsCndSpec)) 3055 } 3056 3057 // Contains returns a boolean indicating if value that is being held is present in given 'TsCndSpec' 3058 func (fpaiv *TsCndSpec_FieldTerminalPathArrayItemValue) ContainsValue(source *TsCndSpec) bool { 3059 slice := fpaiv.TsCndSpec_FieldTerminalPath.Get(source) 3060 for _, v := range slice { 3061 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3062 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3063 return true 3064 } 3065 } else if reflect.DeepEqual(v, fpaiv.value) { 3066 return true 3067 } 3068 } 3069 return false 3070 } 3071 3072 type TsCndSpec_FieldSubPathArrayItemValue struct { 3073 TsCndSpec_FieldPath 3074 subPathItemValue gotenobject.FieldPathArrayItemValue 3075 } 3076 3077 // GetRawValue returns stored array item value 3078 func (fpaivs *TsCndSpec_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 3079 return fpaivs.subPathItemValue.GetRawItemValue() 3080 } 3081 func (fpaivs *TsCndSpec_FieldSubPathArrayItemValue) AsQueriesPathItemValue() (TsCndSpecQuery_FieldPathArrayItemValue, bool) { 3082 res, ok := fpaivs.subPathItemValue.(TsCndSpecQuery_FieldPathArrayItemValue) 3083 return res, ok 3084 } 3085 func (fpaivs *TsCndSpec_FieldSubPathArrayItemValue) AsThresholdAlertingPathItemValue() (TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue, bool) { 3086 res, ok := fpaivs.subPathItemValue.(TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue) 3087 return res, ok 3088 } 3089 func (fpaivs *TsCndSpec_FieldSubPathArrayItemValue) AsAnomalyAlertingPathItemValue() (TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue, bool) { 3090 res, ok := fpaivs.subPathItemValue.(TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue) 3091 return res, ok 3092 } 3093 3094 // Contains returns a boolean indicating if value that is being held is present in given 'TsCndSpec' 3095 func (fpaivs *TsCndSpec_FieldSubPathArrayItemValue) ContainsValue(source *TsCndSpec) bool { 3096 switch fpaivs.Selector() { 3097 case TsCndSpec_FieldPathSelectorQueries: 3098 return false // repeated/map field 3099 case TsCndSpec_FieldPathSelectorThresholdAlerting: 3100 return fpaivs.subPathItemValue.(TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue).ContainsValue(source.GetThresholdAlerting()) 3101 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 3102 return false // repeated/map field 3103 default: 3104 panic(fmt.Sprintf("Invalid selector for TsCndSpec: %d", fpaivs.Selector())) 3105 } 3106 } 3107 3108 // TsCndSpec_FieldPathArrayOfValues allows storing slice of values for TsCndSpec fields according to their type 3109 type TsCndSpec_FieldPathArrayOfValues interface { 3110 gotenobject.FieldPathArrayOfValues 3111 TsCndSpec_FieldPath 3112 } 3113 3114 func ParseTsCndSpec_FieldPathArrayOfValues(pathStr, valuesStr string) (TsCndSpec_FieldPathArrayOfValues, error) { 3115 fp, err := ParseTsCndSpec_FieldPath(pathStr) 3116 if err != nil { 3117 return nil, err 3118 } 3119 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3120 if err != nil { 3121 return nil, status.Errorf(codes.InvalidArgument, "error parsing TsCndSpec field path array of values from %s: %v", valuesStr, err) 3122 } 3123 return fpaov.(TsCndSpec_FieldPathArrayOfValues), nil 3124 } 3125 3126 func MustParseTsCndSpec_FieldPathArrayOfValues(pathStr, valuesStr string) TsCndSpec_FieldPathArrayOfValues { 3127 fpaov, err := ParseTsCndSpec_FieldPathArrayOfValues(pathStr, valuesStr) 3128 if err != nil { 3129 panic(err) 3130 } 3131 return fpaov 3132 } 3133 3134 type TsCndSpec_FieldTerminalPathArrayOfValues struct { 3135 TsCndSpec_FieldTerminalPath 3136 values interface{} 3137 } 3138 3139 var _ TsCndSpec_FieldPathArrayOfValues = (*TsCndSpec_FieldTerminalPathArrayOfValues)(nil) 3140 3141 func (fpaov *TsCndSpec_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3142 switch fpaov.selector { 3143 case TsCndSpec_FieldPathSelectorQueries: 3144 for _, v := range fpaov.values.([][]*TsCndSpec_Query) { 3145 values = append(values, v) 3146 } 3147 case TsCndSpec_FieldPathSelectorQueryGroupBy: 3148 for _, v := range fpaov.values.([][]string) { 3149 values = append(values, v) 3150 } 3151 case TsCndSpec_FieldPathSelectorThresholdAlerting: 3152 for _, v := range fpaov.values.([]*TsCndSpec_ThresholdAlertingCfg) { 3153 values = append(values, v) 3154 } 3155 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 3156 for _, v := range fpaov.values.([][]*TsCndSpec_AnomalyAlertingCfg) { 3157 values = append(values, v) 3158 } 3159 } 3160 return 3161 } 3162 func (fpaov *TsCndSpec_FieldTerminalPathArrayOfValues) AsQueriesArrayOfValues() ([][]*TsCndSpec_Query, bool) { 3163 res, ok := fpaov.values.([][]*TsCndSpec_Query) 3164 return res, ok 3165 } 3166 func (fpaov *TsCndSpec_FieldTerminalPathArrayOfValues) AsQueryGroupByArrayOfValues() ([][]string, bool) { 3167 res, ok := fpaov.values.([][]string) 3168 return res, ok 3169 } 3170 func (fpaov *TsCndSpec_FieldTerminalPathArrayOfValues) AsThresholdAlertingArrayOfValues() ([]*TsCndSpec_ThresholdAlertingCfg, bool) { 3171 res, ok := fpaov.values.([]*TsCndSpec_ThresholdAlertingCfg) 3172 return res, ok 3173 } 3174 func (fpaov *TsCndSpec_FieldTerminalPathArrayOfValues) AsAnomalyAlertingArrayOfValues() ([][]*TsCndSpec_AnomalyAlertingCfg, bool) { 3175 res, ok := fpaov.values.([][]*TsCndSpec_AnomalyAlertingCfg) 3176 return res, ok 3177 } 3178 3179 type TsCndSpec_FieldSubPathArrayOfValues struct { 3180 TsCndSpec_FieldPath 3181 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 3182 } 3183 3184 var _ TsCndSpec_FieldPathArrayOfValues = (*TsCndSpec_FieldSubPathArrayOfValues)(nil) 3185 3186 func (fpsaov *TsCndSpec_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 3187 return fpsaov.subPathArrayOfValues.GetRawValues() 3188 } 3189 func (fpsaov *TsCndSpec_FieldSubPathArrayOfValues) AsQueriesPathArrayOfValues() (TsCndSpecQuery_FieldPathArrayOfValues, bool) { 3190 res, ok := fpsaov.subPathArrayOfValues.(TsCndSpecQuery_FieldPathArrayOfValues) 3191 return res, ok 3192 } 3193 func (fpsaov *TsCndSpec_FieldSubPathArrayOfValues) AsThresholdAlertingPathArrayOfValues() (TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues, bool) { 3194 res, ok := fpsaov.subPathArrayOfValues.(TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues) 3195 return res, ok 3196 } 3197 func (fpsaov *TsCndSpec_FieldSubPathArrayOfValues) AsAnomalyAlertingPathArrayOfValues() (TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues, bool) { 3198 res, ok := fpsaov.subPathArrayOfValues.(TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues) 3199 return res, ok 3200 } 3201 3202 // FieldPath provides implementation to handle 3203 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3204 type TsCndSpecQuery_FieldPath interface { 3205 gotenobject.FieldPath 3206 Selector() TsCndSpecQuery_FieldPathSelector 3207 Get(source *TsCndSpec_Query) []interface{} 3208 GetSingle(source *TsCndSpec_Query) (interface{}, bool) 3209 ClearValue(item *TsCndSpec_Query) 3210 3211 // Those methods build corresponding TsCndSpecQuery_FieldPathValue 3212 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3213 WithIValue(value interface{}) TsCndSpecQuery_FieldPathValue 3214 WithIArrayOfValues(values interface{}) TsCndSpecQuery_FieldPathArrayOfValues 3215 WithIArrayItemValue(value interface{}) TsCndSpecQuery_FieldPathArrayItemValue 3216 } 3217 3218 type TsCndSpecQuery_FieldPathSelector int32 3219 3220 const ( 3221 TsCndSpecQuery_FieldPathSelectorName TsCndSpecQuery_FieldPathSelector = 0 3222 TsCndSpecQuery_FieldPathSelectorFilter TsCndSpecQuery_FieldPathSelector = 1 3223 TsCndSpecQuery_FieldPathSelectorAligner TsCndSpecQuery_FieldPathSelector = 2 3224 TsCndSpecQuery_FieldPathSelectorReducer TsCndSpecQuery_FieldPathSelector = 3 3225 TsCndSpecQuery_FieldPathSelectorMaxValue TsCndSpecQuery_FieldPathSelector = 4 3226 ) 3227 3228 func (s TsCndSpecQuery_FieldPathSelector) String() string { 3229 switch s { 3230 case TsCndSpecQuery_FieldPathSelectorName: 3231 return "name" 3232 case TsCndSpecQuery_FieldPathSelectorFilter: 3233 return "filter" 3234 case TsCndSpecQuery_FieldPathSelectorAligner: 3235 return "aligner" 3236 case TsCndSpecQuery_FieldPathSelectorReducer: 3237 return "reducer" 3238 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3239 return "max_value" 3240 default: 3241 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", s)) 3242 } 3243 } 3244 3245 func BuildTsCndSpecQuery_FieldPath(fp gotenobject.RawFieldPath) (TsCndSpecQuery_FieldPath, error) { 3246 if len(fp) == 0 { 3247 return nil, status.Error(codes.InvalidArgument, "empty field path for object TsCndSpec_Query") 3248 } 3249 if len(fp) == 1 { 3250 switch fp[0] { 3251 case "name": 3252 return &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorName}, nil 3253 case "filter": 3254 return &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorFilter}, nil 3255 case "aligner": 3256 return &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorAligner}, nil 3257 case "reducer": 3258 return &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorReducer}, nil 3259 case "max_value", "maxValue", "max-value": 3260 return &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorMaxValue}, nil 3261 } 3262 } 3263 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object TsCndSpec_Query", fp) 3264 } 3265 3266 func ParseTsCndSpecQuery_FieldPath(rawField string) (TsCndSpecQuery_FieldPath, error) { 3267 fp, err := gotenobject.ParseRawFieldPath(rawField) 3268 if err != nil { 3269 return nil, err 3270 } 3271 return BuildTsCndSpecQuery_FieldPath(fp) 3272 } 3273 3274 func MustParseTsCndSpecQuery_FieldPath(rawField string) TsCndSpecQuery_FieldPath { 3275 fp, err := ParseTsCndSpecQuery_FieldPath(rawField) 3276 if err != nil { 3277 panic(err) 3278 } 3279 return fp 3280 } 3281 3282 type TsCndSpecQuery_FieldTerminalPath struct { 3283 selector TsCndSpecQuery_FieldPathSelector 3284 } 3285 3286 var _ TsCndSpecQuery_FieldPath = (*TsCndSpecQuery_FieldTerminalPath)(nil) 3287 3288 func (fp *TsCndSpecQuery_FieldTerminalPath) Selector() TsCndSpecQuery_FieldPathSelector { 3289 return fp.selector 3290 } 3291 3292 // String returns path representation in proto convention 3293 func (fp *TsCndSpecQuery_FieldTerminalPath) String() string { 3294 return fp.selector.String() 3295 } 3296 3297 // JSONString returns path representation is JSON convention 3298 func (fp *TsCndSpecQuery_FieldTerminalPath) JSONString() string { 3299 return strcase.ToLowerCamel(fp.String()) 3300 } 3301 3302 // Get returns all values pointed by specific field from source TsCndSpec_Query 3303 func (fp *TsCndSpecQuery_FieldTerminalPath) Get(source *TsCndSpec_Query) (values []interface{}) { 3304 if source != nil { 3305 switch fp.selector { 3306 case TsCndSpecQuery_FieldPathSelectorName: 3307 values = append(values, source.Name) 3308 case TsCndSpecQuery_FieldPathSelectorFilter: 3309 if source.Filter != nil { 3310 values = append(values, source.Filter) 3311 } 3312 case TsCndSpecQuery_FieldPathSelectorAligner: 3313 values = append(values, source.Aligner) 3314 case TsCndSpecQuery_FieldPathSelectorReducer: 3315 values = append(values, source.Reducer) 3316 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3317 values = append(values, source.MaxValue) 3318 default: 3319 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fp.selector)) 3320 } 3321 } 3322 return 3323 } 3324 3325 func (fp *TsCndSpecQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3326 return fp.Get(source.(*TsCndSpec_Query)) 3327 } 3328 3329 // GetSingle returns value pointed by specific field of from source TsCndSpec_Query 3330 func (fp *TsCndSpecQuery_FieldTerminalPath) GetSingle(source *TsCndSpec_Query) (interface{}, bool) { 3331 switch fp.selector { 3332 case TsCndSpecQuery_FieldPathSelectorName: 3333 return source.GetName(), source != nil 3334 case TsCndSpecQuery_FieldPathSelectorFilter: 3335 res := source.GetFilter() 3336 return res, res != nil 3337 case TsCndSpecQuery_FieldPathSelectorAligner: 3338 return source.GetAligner(), source != nil 3339 case TsCndSpecQuery_FieldPathSelectorReducer: 3340 return source.GetReducer(), source != nil 3341 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3342 return source.GetMaxValue(), source != nil 3343 default: 3344 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fp.selector)) 3345 } 3346 } 3347 3348 func (fp *TsCndSpecQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3349 return fp.GetSingle(source.(*TsCndSpec_Query)) 3350 } 3351 3352 // GetDefault returns a default value of the field type 3353 func (fp *TsCndSpecQuery_FieldTerminalPath) GetDefault() interface{} { 3354 switch fp.selector { 3355 case TsCndSpecQuery_FieldPathSelectorName: 3356 return "" 3357 case TsCndSpecQuery_FieldPathSelectorFilter: 3358 return (*monitoring_time_serie.Filter)(nil) 3359 case TsCndSpecQuery_FieldPathSelectorAligner: 3360 return monitoring_common.Aggregation_ALIGN_NONE 3361 case TsCndSpecQuery_FieldPathSelectorReducer: 3362 return monitoring_common.Aggregation_REDUCE_NONE 3363 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3364 return float64(0) 3365 default: 3366 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fp.selector)) 3367 } 3368 } 3369 3370 func (fp *TsCndSpecQuery_FieldTerminalPath) ClearValue(item *TsCndSpec_Query) { 3371 if item != nil { 3372 switch fp.selector { 3373 case TsCndSpecQuery_FieldPathSelectorName: 3374 item.Name = "" 3375 case TsCndSpecQuery_FieldPathSelectorFilter: 3376 item.Filter = nil 3377 case TsCndSpecQuery_FieldPathSelectorAligner: 3378 item.Aligner = monitoring_common.Aggregation_ALIGN_NONE 3379 case TsCndSpecQuery_FieldPathSelectorReducer: 3380 item.Reducer = monitoring_common.Aggregation_REDUCE_NONE 3381 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3382 item.MaxValue = float64(0) 3383 default: 3384 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fp.selector)) 3385 } 3386 } 3387 } 3388 3389 func (fp *TsCndSpecQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3390 fp.ClearValue(item.(*TsCndSpec_Query)) 3391 } 3392 3393 // IsLeaf - whether field path is holds simple value 3394 func (fp *TsCndSpecQuery_FieldTerminalPath) IsLeaf() bool { 3395 return fp.selector == TsCndSpecQuery_FieldPathSelectorName || 3396 fp.selector == TsCndSpecQuery_FieldPathSelectorFilter || 3397 fp.selector == TsCndSpecQuery_FieldPathSelectorAligner || 3398 fp.selector == TsCndSpecQuery_FieldPathSelectorReducer || 3399 fp.selector == TsCndSpecQuery_FieldPathSelectorMaxValue 3400 } 3401 3402 func (fp *TsCndSpecQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3403 return []gotenobject.FieldPath{fp} 3404 } 3405 3406 func (fp *TsCndSpecQuery_FieldTerminalPath) WithIValue(value interface{}) TsCndSpecQuery_FieldPathValue { 3407 switch fp.selector { 3408 case TsCndSpecQuery_FieldPathSelectorName: 3409 return &TsCndSpecQuery_FieldTerminalPathValue{TsCndSpecQuery_FieldTerminalPath: *fp, value: value.(string)} 3410 case TsCndSpecQuery_FieldPathSelectorFilter: 3411 return &TsCndSpecQuery_FieldTerminalPathValue{TsCndSpecQuery_FieldTerminalPath: *fp, value: value.(*monitoring_time_serie.Filter)} 3412 case TsCndSpecQuery_FieldPathSelectorAligner: 3413 return &TsCndSpecQuery_FieldTerminalPathValue{TsCndSpecQuery_FieldTerminalPath: *fp, value: value.(monitoring_common.Aggregation_Aligner)} 3414 case TsCndSpecQuery_FieldPathSelectorReducer: 3415 return &TsCndSpecQuery_FieldTerminalPathValue{TsCndSpecQuery_FieldTerminalPath: *fp, value: value.(monitoring_common.Aggregation_Reducer)} 3416 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3417 return &TsCndSpecQuery_FieldTerminalPathValue{TsCndSpecQuery_FieldTerminalPath: *fp, value: value.(float64)} 3418 default: 3419 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fp.selector)) 3420 } 3421 } 3422 3423 func (fp *TsCndSpecQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3424 return fp.WithIValue(value) 3425 } 3426 3427 func (fp *TsCndSpecQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) TsCndSpecQuery_FieldPathArrayOfValues { 3428 fpaov := &TsCndSpecQuery_FieldTerminalPathArrayOfValues{TsCndSpecQuery_FieldTerminalPath: *fp} 3429 switch fp.selector { 3430 case TsCndSpecQuery_FieldPathSelectorName: 3431 return &TsCndSpecQuery_FieldTerminalPathArrayOfValues{TsCndSpecQuery_FieldTerminalPath: *fp, values: values.([]string)} 3432 case TsCndSpecQuery_FieldPathSelectorFilter: 3433 return &TsCndSpecQuery_FieldTerminalPathArrayOfValues{TsCndSpecQuery_FieldTerminalPath: *fp, values: values.([]*monitoring_time_serie.Filter)} 3434 case TsCndSpecQuery_FieldPathSelectorAligner: 3435 return &TsCndSpecQuery_FieldTerminalPathArrayOfValues{TsCndSpecQuery_FieldTerminalPath: *fp, values: values.([]monitoring_common.Aggregation_Aligner)} 3436 case TsCndSpecQuery_FieldPathSelectorReducer: 3437 return &TsCndSpecQuery_FieldTerminalPathArrayOfValues{TsCndSpecQuery_FieldTerminalPath: *fp, values: values.([]monitoring_common.Aggregation_Reducer)} 3438 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3439 return &TsCndSpecQuery_FieldTerminalPathArrayOfValues{TsCndSpecQuery_FieldTerminalPath: *fp, values: values.([]float64)} 3440 default: 3441 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fp.selector)) 3442 } 3443 return fpaov 3444 } 3445 3446 func (fp *TsCndSpecQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3447 return fp.WithIArrayOfValues(values) 3448 } 3449 3450 func (fp *TsCndSpecQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) TsCndSpecQuery_FieldPathArrayItemValue { 3451 switch fp.selector { 3452 default: 3453 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fp.selector)) 3454 } 3455 } 3456 3457 func (fp *TsCndSpecQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3458 return fp.WithIArrayItemValue(value) 3459 } 3460 3461 // TsCndSpecQuery_FieldPathValue allows storing values for Query fields according to their type 3462 type TsCndSpecQuery_FieldPathValue interface { 3463 TsCndSpecQuery_FieldPath 3464 gotenobject.FieldPathValue 3465 SetTo(target **TsCndSpec_Query) 3466 CompareWith(*TsCndSpec_Query) (cmp int, comparable bool) 3467 } 3468 3469 func ParseTsCndSpecQuery_FieldPathValue(pathStr, valueStr string) (TsCndSpecQuery_FieldPathValue, error) { 3470 fp, err := ParseTsCndSpecQuery_FieldPath(pathStr) 3471 if err != nil { 3472 return nil, err 3473 } 3474 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3475 if err != nil { 3476 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path value from %s: %v", valueStr, err) 3477 } 3478 return fpv.(TsCndSpecQuery_FieldPathValue), nil 3479 } 3480 3481 func MustParseTsCndSpecQuery_FieldPathValue(pathStr, valueStr string) TsCndSpecQuery_FieldPathValue { 3482 fpv, err := ParseTsCndSpecQuery_FieldPathValue(pathStr, valueStr) 3483 if err != nil { 3484 panic(err) 3485 } 3486 return fpv 3487 } 3488 3489 type TsCndSpecQuery_FieldTerminalPathValue struct { 3490 TsCndSpecQuery_FieldTerminalPath 3491 value interface{} 3492 } 3493 3494 var _ TsCndSpecQuery_FieldPathValue = (*TsCndSpecQuery_FieldTerminalPathValue)(nil) 3495 3496 // GetRawValue returns raw value stored under selected path for 'Query' as interface{} 3497 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) GetRawValue() interface{} { 3498 return fpv.value 3499 } 3500 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) AsNameValue() (string, bool) { 3501 res, ok := fpv.value.(string) 3502 return res, ok 3503 } 3504 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) AsFilterValue() (*monitoring_time_serie.Filter, bool) { 3505 res, ok := fpv.value.(*monitoring_time_serie.Filter) 3506 return res, ok 3507 } 3508 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) AsAlignerValue() (monitoring_common.Aggregation_Aligner, bool) { 3509 res, ok := fpv.value.(monitoring_common.Aggregation_Aligner) 3510 return res, ok 3511 } 3512 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) AsReducerValue() (monitoring_common.Aggregation_Reducer, bool) { 3513 res, ok := fpv.value.(monitoring_common.Aggregation_Reducer) 3514 return res, ok 3515 } 3516 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) AsMaxValueValue() (float64, bool) { 3517 res, ok := fpv.value.(float64) 3518 return res, ok 3519 } 3520 3521 // SetTo stores value for selected field for object Query 3522 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) SetTo(target **TsCndSpec_Query) { 3523 if *target == nil { 3524 *target = new(TsCndSpec_Query) 3525 } 3526 switch fpv.selector { 3527 case TsCndSpecQuery_FieldPathSelectorName: 3528 (*target).Name = fpv.value.(string) 3529 case TsCndSpecQuery_FieldPathSelectorFilter: 3530 (*target).Filter = fpv.value.(*monitoring_time_serie.Filter) 3531 case TsCndSpecQuery_FieldPathSelectorAligner: 3532 (*target).Aligner = fpv.value.(monitoring_common.Aggregation_Aligner) 3533 case TsCndSpecQuery_FieldPathSelectorReducer: 3534 (*target).Reducer = fpv.value.(monitoring_common.Aggregation_Reducer) 3535 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3536 (*target).MaxValue = fpv.value.(float64) 3537 default: 3538 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fpv.selector)) 3539 } 3540 } 3541 3542 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3543 typedObject := target.(*TsCndSpec_Query) 3544 fpv.SetTo(&typedObject) 3545 } 3546 3547 // CompareWith compares value in the 'TsCndSpecQuery_FieldTerminalPathValue' with the value under path in 'TsCndSpec_Query'. 3548 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) CompareWith(source *TsCndSpec_Query) (int, bool) { 3549 switch fpv.selector { 3550 case TsCndSpecQuery_FieldPathSelectorName: 3551 leftValue := fpv.value.(string) 3552 rightValue := source.GetName() 3553 if (leftValue) == (rightValue) { 3554 return 0, true 3555 } else if (leftValue) < (rightValue) { 3556 return -1, true 3557 } else { 3558 return 1, true 3559 } 3560 case TsCndSpecQuery_FieldPathSelectorFilter: 3561 return 0, false 3562 case TsCndSpecQuery_FieldPathSelectorAligner: 3563 leftValue := fpv.value.(monitoring_common.Aggregation_Aligner) 3564 rightValue := source.GetAligner() 3565 if (leftValue) == (rightValue) { 3566 return 0, true 3567 } else if (leftValue) < (rightValue) { 3568 return -1, true 3569 } else { 3570 return 1, true 3571 } 3572 case TsCndSpecQuery_FieldPathSelectorReducer: 3573 leftValue := fpv.value.(monitoring_common.Aggregation_Reducer) 3574 rightValue := source.GetReducer() 3575 if (leftValue) == (rightValue) { 3576 return 0, true 3577 } else if (leftValue) < (rightValue) { 3578 return -1, true 3579 } else { 3580 return 1, true 3581 } 3582 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3583 leftValue := fpv.value.(float64) 3584 rightValue := source.GetMaxValue() 3585 if (leftValue) == (rightValue) { 3586 return 0, true 3587 } else if (leftValue) < (rightValue) { 3588 return -1, true 3589 } else { 3590 return 1, true 3591 } 3592 default: 3593 panic(fmt.Sprintf("Invalid selector for TsCndSpec_Query: %d", fpv.selector)) 3594 } 3595 } 3596 3597 func (fpv *TsCndSpecQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3598 return fpv.CompareWith(source.(*TsCndSpec_Query)) 3599 } 3600 3601 // TsCndSpecQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for Query according to their type 3602 // Present only for array (repeated) types. 3603 type TsCndSpecQuery_FieldPathArrayItemValue interface { 3604 gotenobject.FieldPathArrayItemValue 3605 TsCndSpecQuery_FieldPath 3606 ContainsValue(*TsCndSpec_Query) bool 3607 } 3608 3609 // ParseTsCndSpecQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3610 func ParseTsCndSpecQuery_FieldPathArrayItemValue(pathStr, valueStr string) (TsCndSpecQuery_FieldPathArrayItemValue, error) { 3611 fp, err := ParseTsCndSpecQuery_FieldPath(pathStr) 3612 if err != nil { 3613 return nil, err 3614 } 3615 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3616 if err != nil { 3617 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path array item value from %s: %v", valueStr, err) 3618 } 3619 return fpaiv.(TsCndSpecQuery_FieldPathArrayItemValue), nil 3620 } 3621 3622 func MustParseTsCndSpecQuery_FieldPathArrayItemValue(pathStr, valueStr string) TsCndSpecQuery_FieldPathArrayItemValue { 3623 fpaiv, err := ParseTsCndSpecQuery_FieldPathArrayItemValue(pathStr, valueStr) 3624 if err != nil { 3625 panic(err) 3626 } 3627 return fpaiv 3628 } 3629 3630 type TsCndSpecQuery_FieldTerminalPathArrayItemValue struct { 3631 TsCndSpecQuery_FieldTerminalPath 3632 value interface{} 3633 } 3634 3635 var _ TsCndSpecQuery_FieldPathArrayItemValue = (*TsCndSpecQuery_FieldTerminalPathArrayItemValue)(nil) 3636 3637 // GetRawValue returns stored element value for array in object TsCndSpec_Query as interface{} 3638 func (fpaiv *TsCndSpecQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3639 return fpaiv.value 3640 } 3641 3642 func (fpaiv *TsCndSpecQuery_FieldTerminalPathArrayItemValue) GetSingle(source *TsCndSpec_Query) (interface{}, bool) { 3643 return nil, false 3644 } 3645 3646 func (fpaiv *TsCndSpecQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3647 return fpaiv.GetSingle(source.(*TsCndSpec_Query)) 3648 } 3649 3650 // Contains returns a boolean indicating if value that is being held is present in given 'Query' 3651 func (fpaiv *TsCndSpecQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *TsCndSpec_Query) bool { 3652 slice := fpaiv.TsCndSpecQuery_FieldTerminalPath.Get(source) 3653 for _, v := range slice { 3654 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3655 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3656 return true 3657 } 3658 } else if reflect.DeepEqual(v, fpaiv.value) { 3659 return true 3660 } 3661 } 3662 return false 3663 } 3664 3665 // TsCndSpecQuery_FieldPathArrayOfValues allows storing slice of values for Query fields according to their type 3666 type TsCndSpecQuery_FieldPathArrayOfValues interface { 3667 gotenobject.FieldPathArrayOfValues 3668 TsCndSpecQuery_FieldPath 3669 } 3670 3671 func ParseTsCndSpecQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (TsCndSpecQuery_FieldPathArrayOfValues, error) { 3672 fp, err := ParseTsCndSpecQuery_FieldPath(pathStr) 3673 if err != nil { 3674 return nil, err 3675 } 3676 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3677 if err != nil { 3678 return nil, status.Errorf(codes.InvalidArgument, "error parsing Query field path array of values from %s: %v", valuesStr, err) 3679 } 3680 return fpaov.(TsCndSpecQuery_FieldPathArrayOfValues), nil 3681 } 3682 3683 func MustParseTsCndSpecQuery_FieldPathArrayOfValues(pathStr, valuesStr string) TsCndSpecQuery_FieldPathArrayOfValues { 3684 fpaov, err := ParseTsCndSpecQuery_FieldPathArrayOfValues(pathStr, valuesStr) 3685 if err != nil { 3686 panic(err) 3687 } 3688 return fpaov 3689 } 3690 3691 type TsCndSpecQuery_FieldTerminalPathArrayOfValues struct { 3692 TsCndSpecQuery_FieldTerminalPath 3693 values interface{} 3694 } 3695 3696 var _ TsCndSpecQuery_FieldPathArrayOfValues = (*TsCndSpecQuery_FieldTerminalPathArrayOfValues)(nil) 3697 3698 func (fpaov *TsCndSpecQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3699 switch fpaov.selector { 3700 case TsCndSpecQuery_FieldPathSelectorName: 3701 for _, v := range fpaov.values.([]string) { 3702 values = append(values, v) 3703 } 3704 case TsCndSpecQuery_FieldPathSelectorFilter: 3705 for _, v := range fpaov.values.([]*monitoring_time_serie.Filter) { 3706 values = append(values, v) 3707 } 3708 case TsCndSpecQuery_FieldPathSelectorAligner: 3709 for _, v := range fpaov.values.([]monitoring_common.Aggregation_Aligner) { 3710 values = append(values, v) 3711 } 3712 case TsCndSpecQuery_FieldPathSelectorReducer: 3713 for _, v := range fpaov.values.([]monitoring_common.Aggregation_Reducer) { 3714 values = append(values, v) 3715 } 3716 case TsCndSpecQuery_FieldPathSelectorMaxValue: 3717 for _, v := range fpaov.values.([]float64) { 3718 values = append(values, v) 3719 } 3720 } 3721 return 3722 } 3723 func (fpaov *TsCndSpecQuery_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 3724 res, ok := fpaov.values.([]string) 3725 return res, ok 3726 } 3727 func (fpaov *TsCndSpecQuery_FieldTerminalPathArrayOfValues) AsFilterArrayOfValues() ([]*monitoring_time_serie.Filter, bool) { 3728 res, ok := fpaov.values.([]*monitoring_time_serie.Filter) 3729 return res, ok 3730 } 3731 func (fpaov *TsCndSpecQuery_FieldTerminalPathArrayOfValues) AsAlignerArrayOfValues() ([]monitoring_common.Aggregation_Aligner, bool) { 3732 res, ok := fpaov.values.([]monitoring_common.Aggregation_Aligner) 3733 return res, ok 3734 } 3735 func (fpaov *TsCndSpecQuery_FieldTerminalPathArrayOfValues) AsReducerArrayOfValues() ([]monitoring_common.Aggregation_Reducer, bool) { 3736 res, ok := fpaov.values.([]monitoring_common.Aggregation_Reducer) 3737 return res, ok 3738 } 3739 func (fpaov *TsCndSpecQuery_FieldTerminalPathArrayOfValues) AsMaxValueArrayOfValues() ([]float64, bool) { 3740 res, ok := fpaov.values.([]float64) 3741 return res, ok 3742 } 3743 3744 // FieldPath provides implementation to handle 3745 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3746 type TsCndSpecThresholdAlertingCfg_FieldPath interface { 3747 gotenobject.FieldPath 3748 Selector() TsCndSpecThresholdAlertingCfg_FieldPathSelector 3749 Get(source *TsCndSpec_ThresholdAlertingCfg) []interface{} 3750 GetSingle(source *TsCndSpec_ThresholdAlertingCfg) (interface{}, bool) 3751 ClearValue(item *TsCndSpec_ThresholdAlertingCfg) 3752 3753 // Those methods build corresponding TsCndSpecThresholdAlertingCfg_FieldPathValue 3754 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3755 WithIValue(value interface{}) TsCndSpecThresholdAlertingCfg_FieldPathValue 3756 WithIArrayOfValues(values interface{}) TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues 3757 WithIArrayItemValue(value interface{}) TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue 3758 } 3759 3760 type TsCndSpecThresholdAlertingCfg_FieldPathSelector int32 3761 3762 const ( 3763 TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator TsCndSpecThresholdAlertingCfg_FieldPathSelector = 0 3764 TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod TsCndSpecThresholdAlertingCfg_FieldPathSelector = 1 3765 TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter TsCndSpecThresholdAlertingCfg_FieldPathSelector = 2 3766 TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter TsCndSpecThresholdAlertingCfg_FieldPathSelector = 3 3767 TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds TsCndSpecThresholdAlertingCfg_FieldPathSelector = 4 3768 TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod TsCndSpecThresholdAlertingCfg_FieldPathSelector = 5 3769 ) 3770 3771 func (s TsCndSpecThresholdAlertingCfg_FieldPathSelector) String() string { 3772 switch s { 3773 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 3774 return "operator" 3775 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 3776 return "alignment_period" 3777 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 3778 return "raise_after" 3779 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 3780 return "silence_after" 3781 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 3782 return "per_query_thresholds" 3783 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 3784 return "adaptive_thresholds_detection_period" 3785 default: 3786 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", s)) 3787 } 3788 } 3789 3790 func BuildTsCndSpecThresholdAlertingCfg_FieldPath(fp gotenobject.RawFieldPath) (TsCndSpecThresholdAlertingCfg_FieldPath, error) { 3791 if len(fp) == 0 { 3792 return nil, status.Error(codes.InvalidArgument, "empty field path for object TsCndSpec_ThresholdAlertingCfg") 3793 } 3794 if len(fp) == 1 { 3795 switch fp[0] { 3796 case "operator": 3797 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator}, nil 3798 case "alignment_period", "alignmentPeriod", "alignment-period": 3799 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod}, nil 3800 case "raise_after", "raiseAfter", "raise-after": 3801 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter}, nil 3802 case "silence_after", "silenceAfter", "silence-after": 3803 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter}, nil 3804 case "per_query_thresholds", "perQueryThresholds", "per-query-thresholds": 3805 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds}, nil 3806 case "adaptive_thresholds_detection_period", "adaptiveThresholdsDetectionPeriod", "adaptive-thresholds-detection-period": 3807 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod}, nil 3808 } 3809 } else { 3810 switch fp[0] { 3811 case "per_query_thresholds", "perQueryThresholds", "per-query-thresholds": 3812 if subpath, err := BuildTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(fp[1:]); err != nil { 3813 return nil, err 3814 } else { 3815 return &TsCndSpecThresholdAlertingCfg_FieldSubPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds, subPath: subpath}, nil 3816 } 3817 } 3818 } 3819 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object TsCndSpec_ThresholdAlertingCfg", fp) 3820 } 3821 3822 func ParseTsCndSpecThresholdAlertingCfg_FieldPath(rawField string) (TsCndSpecThresholdAlertingCfg_FieldPath, error) { 3823 fp, err := gotenobject.ParseRawFieldPath(rawField) 3824 if err != nil { 3825 return nil, err 3826 } 3827 return BuildTsCndSpecThresholdAlertingCfg_FieldPath(fp) 3828 } 3829 3830 func MustParseTsCndSpecThresholdAlertingCfg_FieldPath(rawField string) TsCndSpecThresholdAlertingCfg_FieldPath { 3831 fp, err := ParseTsCndSpecThresholdAlertingCfg_FieldPath(rawField) 3832 if err != nil { 3833 panic(err) 3834 } 3835 return fp 3836 } 3837 3838 type TsCndSpecThresholdAlertingCfg_FieldTerminalPath struct { 3839 selector TsCndSpecThresholdAlertingCfg_FieldPathSelector 3840 } 3841 3842 var _ TsCndSpecThresholdAlertingCfg_FieldPath = (*TsCndSpecThresholdAlertingCfg_FieldTerminalPath)(nil) 3843 3844 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) Selector() TsCndSpecThresholdAlertingCfg_FieldPathSelector { 3845 return fp.selector 3846 } 3847 3848 // String returns path representation in proto convention 3849 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) String() string { 3850 return fp.selector.String() 3851 } 3852 3853 // JSONString returns path representation is JSON convention 3854 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) JSONString() string { 3855 return strcase.ToLowerCamel(fp.String()) 3856 } 3857 3858 // Get returns all values pointed by specific field from source TsCndSpec_ThresholdAlertingCfg 3859 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) Get(source *TsCndSpec_ThresholdAlertingCfg) (values []interface{}) { 3860 if source != nil { 3861 switch fp.selector { 3862 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 3863 values = append(values, source.Operator) 3864 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 3865 if source.AlignmentPeriod != nil { 3866 values = append(values, source.AlignmentPeriod) 3867 } 3868 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 3869 if source.RaiseAfter != nil { 3870 values = append(values, source.RaiseAfter) 3871 } 3872 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 3873 if source.SilenceAfter != nil { 3874 values = append(values, source.SilenceAfter) 3875 } 3876 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 3877 for _, value := range source.GetPerQueryThresholds() { 3878 values = append(values, value) 3879 } 3880 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 3881 if source.AdaptiveThresholdsDetectionPeriod != nil { 3882 values = append(values, source.AdaptiveThresholdsDetectionPeriod) 3883 } 3884 default: 3885 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fp.selector)) 3886 } 3887 } 3888 return 3889 } 3890 3891 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3892 return fp.Get(source.(*TsCndSpec_ThresholdAlertingCfg)) 3893 } 3894 3895 // GetSingle returns value pointed by specific field of from source TsCndSpec_ThresholdAlertingCfg 3896 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) GetSingle(source *TsCndSpec_ThresholdAlertingCfg) (interface{}, bool) { 3897 switch fp.selector { 3898 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 3899 return source.GetOperator(), source != nil 3900 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 3901 res := source.GetAlignmentPeriod() 3902 return res, res != nil 3903 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 3904 res := source.GetRaiseAfter() 3905 return res, res != nil 3906 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 3907 res := source.GetSilenceAfter() 3908 return res, res != nil 3909 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 3910 res := source.GetPerQueryThresholds() 3911 return res, res != nil 3912 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 3913 res := source.GetAdaptiveThresholdsDetectionPeriod() 3914 return res, res != nil 3915 default: 3916 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fp.selector)) 3917 } 3918 } 3919 3920 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3921 return fp.GetSingle(source.(*TsCndSpec_ThresholdAlertingCfg)) 3922 } 3923 3924 // GetDefault returns a default value of the field type 3925 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) GetDefault() interface{} { 3926 switch fp.selector { 3927 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 3928 return TsCndSpec_ThresholdAlertingCfg_UNDEFINED 3929 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 3930 return (*durationpb.Duration)(nil) 3931 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 3932 return (*durationpb.Duration)(nil) 3933 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 3934 return (*durationpb.Duration)(nil) 3935 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 3936 return ([]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)(nil) 3937 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 3938 return (*durationpb.Duration)(nil) 3939 default: 3940 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fp.selector)) 3941 } 3942 } 3943 3944 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) ClearValue(item *TsCndSpec_ThresholdAlertingCfg) { 3945 if item != nil { 3946 switch fp.selector { 3947 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 3948 item.Operator = TsCndSpec_ThresholdAlertingCfg_UNDEFINED 3949 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 3950 item.AlignmentPeriod = nil 3951 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 3952 item.RaiseAfter = nil 3953 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 3954 item.SilenceAfter = nil 3955 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 3956 item.PerQueryThresholds = nil 3957 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 3958 item.AdaptiveThresholdsDetectionPeriod = nil 3959 default: 3960 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fp.selector)) 3961 } 3962 } 3963 } 3964 3965 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3966 fp.ClearValue(item.(*TsCndSpec_ThresholdAlertingCfg)) 3967 } 3968 3969 // IsLeaf - whether field path is holds simple value 3970 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) IsLeaf() bool { 3971 return fp.selector == TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator || 3972 fp.selector == TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod || 3973 fp.selector == TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter || 3974 fp.selector == TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter || 3975 fp.selector == TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod 3976 } 3977 3978 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3979 return []gotenobject.FieldPath{fp} 3980 } 3981 3982 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) WithIValue(value interface{}) TsCndSpecThresholdAlertingCfg_FieldPathValue { 3983 switch fp.selector { 3984 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 3985 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, value: value.(TsCndSpec_ThresholdAlertingCfg_Operator)} 3986 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 3987 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 3988 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 3989 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 3990 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 3991 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 3992 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 3993 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, value: value.([]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)} 3994 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 3995 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 3996 default: 3997 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fp.selector)) 3998 } 3999 } 4000 4001 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4002 return fp.WithIValue(value) 4003 } 4004 4005 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) WithIArrayOfValues(values interface{}) TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues { 4006 fpaov := &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp} 4007 switch fp.selector { 4008 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 4009 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, values: values.([]TsCndSpec_ThresholdAlertingCfg_Operator)} 4010 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 4011 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4012 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 4013 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4014 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 4015 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4016 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4017 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, values: values.([][]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)} 4018 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 4019 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4020 default: 4021 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fp.selector)) 4022 } 4023 return fpaov 4024 } 4025 4026 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4027 return fp.WithIArrayOfValues(values) 4028 } 4029 4030 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) WithIArrayItemValue(value interface{}) TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue { 4031 switch fp.selector { 4032 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4033 return &TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue{TsCndSpecThresholdAlertingCfg_FieldTerminalPath: *fp, value: value.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)} 4034 default: 4035 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fp.selector)) 4036 } 4037 } 4038 4039 func (fp *TsCndSpecThresholdAlertingCfg_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4040 return fp.WithIArrayItemValue(value) 4041 } 4042 4043 type TsCndSpecThresholdAlertingCfg_FieldSubPath struct { 4044 selector TsCndSpecThresholdAlertingCfg_FieldPathSelector 4045 subPath gotenobject.FieldPath 4046 } 4047 4048 var _ TsCndSpecThresholdAlertingCfg_FieldPath = (*TsCndSpecThresholdAlertingCfg_FieldSubPath)(nil) 4049 4050 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) Selector() TsCndSpecThresholdAlertingCfg_FieldPathSelector { 4051 return fps.selector 4052 } 4053 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) AsPerQueryThresholdsSubPath() (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath, bool) { 4054 res, ok := fps.subPath.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath) 4055 return res, ok 4056 } 4057 4058 // String returns path representation in proto convention 4059 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) String() string { 4060 return fps.selector.String() + "." + fps.subPath.String() 4061 } 4062 4063 // JSONString returns path representation is JSON convention 4064 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) JSONString() string { 4065 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 4066 } 4067 4068 // Get returns all values pointed by selected field from source TsCndSpec_ThresholdAlertingCfg 4069 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) Get(source *TsCndSpec_ThresholdAlertingCfg) (values []interface{}) { 4070 switch fps.selector { 4071 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4072 for _, item := range source.GetPerQueryThresholds() { 4073 values = append(values, fps.subPath.GetRaw(item)...) 4074 } 4075 default: 4076 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fps.selector)) 4077 } 4078 return 4079 } 4080 4081 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) GetRaw(source proto.Message) []interface{} { 4082 return fps.Get(source.(*TsCndSpec_ThresholdAlertingCfg)) 4083 } 4084 4085 // GetSingle returns value of selected field from source TsCndSpec_ThresholdAlertingCfg 4086 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) GetSingle(source *TsCndSpec_ThresholdAlertingCfg) (interface{}, bool) { 4087 switch fps.selector { 4088 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4089 if len(source.GetPerQueryThresholds()) == 0 { 4090 return nil, false 4091 } 4092 return fps.subPath.GetSingleRaw(source.GetPerQueryThresholds()[0]) 4093 default: 4094 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fps.selector)) 4095 } 4096 } 4097 4098 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4099 return fps.GetSingle(source.(*TsCndSpec_ThresholdAlertingCfg)) 4100 } 4101 4102 // GetDefault returns a default value of the field type 4103 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) GetDefault() interface{} { 4104 return fps.subPath.GetDefault() 4105 } 4106 4107 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) ClearValue(item *TsCndSpec_ThresholdAlertingCfg) { 4108 if item != nil { 4109 switch fps.selector { 4110 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4111 for _, subItem := range item.PerQueryThresholds { 4112 fps.subPath.ClearValueRaw(subItem) 4113 } 4114 default: 4115 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fps.selector)) 4116 } 4117 } 4118 } 4119 4120 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) ClearValueRaw(item proto.Message) { 4121 fps.ClearValue(item.(*TsCndSpec_ThresholdAlertingCfg)) 4122 } 4123 4124 // IsLeaf - whether field path is holds simple value 4125 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) IsLeaf() bool { 4126 return fps.subPath.IsLeaf() 4127 } 4128 4129 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4130 iPaths := []gotenobject.FieldPath{&TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: fps.selector}} 4131 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 4132 return iPaths 4133 } 4134 4135 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) WithIValue(value interface{}) TsCndSpecThresholdAlertingCfg_FieldPathValue { 4136 return &TsCndSpecThresholdAlertingCfg_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 4137 } 4138 4139 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4140 return fps.WithIValue(value) 4141 } 4142 4143 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) WithIArrayOfValues(values interface{}) TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues { 4144 return &TsCndSpecThresholdAlertingCfg_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 4145 } 4146 4147 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4148 return fps.WithIArrayOfValues(values) 4149 } 4150 4151 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) WithIArrayItemValue(value interface{}) TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue { 4152 return &TsCndSpecThresholdAlertingCfg_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 4153 } 4154 4155 func (fps *TsCndSpecThresholdAlertingCfg_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4156 return fps.WithIArrayItemValue(value) 4157 } 4158 4159 // TsCndSpecThresholdAlertingCfg_FieldPathValue allows storing values for ThresholdAlertingCfg fields according to their type 4160 type TsCndSpecThresholdAlertingCfg_FieldPathValue interface { 4161 TsCndSpecThresholdAlertingCfg_FieldPath 4162 gotenobject.FieldPathValue 4163 SetTo(target **TsCndSpec_ThresholdAlertingCfg) 4164 CompareWith(*TsCndSpec_ThresholdAlertingCfg) (cmp int, comparable bool) 4165 } 4166 4167 func ParseTsCndSpecThresholdAlertingCfg_FieldPathValue(pathStr, valueStr string) (TsCndSpecThresholdAlertingCfg_FieldPathValue, error) { 4168 fp, err := ParseTsCndSpecThresholdAlertingCfg_FieldPath(pathStr) 4169 if err != nil { 4170 return nil, err 4171 } 4172 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4173 if err != nil { 4174 return nil, status.Errorf(codes.InvalidArgument, "error parsing ThresholdAlertingCfg field path value from %s: %v", valueStr, err) 4175 } 4176 return fpv.(TsCndSpecThresholdAlertingCfg_FieldPathValue), nil 4177 } 4178 4179 func MustParseTsCndSpecThresholdAlertingCfg_FieldPathValue(pathStr, valueStr string) TsCndSpecThresholdAlertingCfg_FieldPathValue { 4180 fpv, err := ParseTsCndSpecThresholdAlertingCfg_FieldPathValue(pathStr, valueStr) 4181 if err != nil { 4182 panic(err) 4183 } 4184 return fpv 4185 } 4186 4187 type TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue struct { 4188 TsCndSpecThresholdAlertingCfg_FieldTerminalPath 4189 value interface{} 4190 } 4191 4192 var _ TsCndSpecThresholdAlertingCfg_FieldPathValue = (*TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue)(nil) 4193 4194 // GetRawValue returns raw value stored under selected path for 'ThresholdAlertingCfg' as interface{} 4195 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) GetRawValue() interface{} { 4196 return fpv.value 4197 } 4198 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) AsOperatorValue() (TsCndSpec_ThresholdAlertingCfg_Operator, bool) { 4199 res, ok := fpv.value.(TsCndSpec_ThresholdAlertingCfg_Operator) 4200 return res, ok 4201 } 4202 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) AsAlignmentPeriodValue() (*durationpb.Duration, bool) { 4203 res, ok := fpv.value.(*durationpb.Duration) 4204 return res, ok 4205 } 4206 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) AsRaiseAfterValue() (*durationpb.Duration, bool) { 4207 res, ok := fpv.value.(*durationpb.Duration) 4208 return res, ok 4209 } 4210 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) AsSilenceAfterValue() (*durationpb.Duration, bool) { 4211 res, ok := fpv.value.(*durationpb.Duration) 4212 return res, ok 4213 } 4214 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) AsPerQueryThresholdsValue() ([]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds, bool) { 4215 res, ok := fpv.value.([]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 4216 return res, ok 4217 } 4218 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) AsAdaptiveThresholdsDetectionPeriodValue() (*durationpb.Duration, bool) { 4219 res, ok := fpv.value.(*durationpb.Duration) 4220 return res, ok 4221 } 4222 4223 // SetTo stores value for selected field for object ThresholdAlertingCfg 4224 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) SetTo(target **TsCndSpec_ThresholdAlertingCfg) { 4225 if *target == nil { 4226 *target = new(TsCndSpec_ThresholdAlertingCfg) 4227 } 4228 switch fpv.selector { 4229 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 4230 (*target).Operator = fpv.value.(TsCndSpec_ThresholdAlertingCfg_Operator) 4231 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 4232 (*target).AlignmentPeriod = fpv.value.(*durationpb.Duration) 4233 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 4234 (*target).RaiseAfter = fpv.value.(*durationpb.Duration) 4235 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 4236 (*target).SilenceAfter = fpv.value.(*durationpb.Duration) 4237 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4238 (*target).PerQueryThresholds = fpv.value.([]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 4239 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 4240 (*target).AdaptiveThresholdsDetectionPeriod = fpv.value.(*durationpb.Duration) 4241 default: 4242 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fpv.selector)) 4243 } 4244 } 4245 4246 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4247 typedObject := target.(*TsCndSpec_ThresholdAlertingCfg) 4248 fpv.SetTo(&typedObject) 4249 } 4250 4251 // CompareWith compares value in the 'TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue' with the value under path in 'TsCndSpec_ThresholdAlertingCfg'. 4252 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) CompareWith(source *TsCndSpec_ThresholdAlertingCfg) (int, bool) { 4253 switch fpv.selector { 4254 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 4255 leftValue := fpv.value.(TsCndSpec_ThresholdAlertingCfg_Operator) 4256 rightValue := source.GetOperator() 4257 if (leftValue) == (rightValue) { 4258 return 0, true 4259 } else if (leftValue) < (rightValue) { 4260 return -1, true 4261 } else { 4262 return 1, true 4263 } 4264 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 4265 leftValue := fpv.value.(*durationpb.Duration) 4266 rightValue := source.GetAlignmentPeriod() 4267 if leftValue == nil { 4268 if rightValue != nil { 4269 return -1, true 4270 } 4271 return 0, true 4272 } 4273 if rightValue == nil { 4274 return 1, true 4275 } 4276 if leftValue.AsDuration() == rightValue.AsDuration() { 4277 return 0, true 4278 } else if leftValue.AsDuration() < rightValue.AsDuration() { 4279 return -1, true 4280 } else { 4281 return 1, true 4282 } 4283 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 4284 leftValue := fpv.value.(*durationpb.Duration) 4285 rightValue := source.GetRaiseAfter() 4286 if leftValue == nil { 4287 if rightValue != nil { 4288 return -1, true 4289 } 4290 return 0, true 4291 } 4292 if rightValue == nil { 4293 return 1, true 4294 } 4295 if leftValue.AsDuration() == rightValue.AsDuration() { 4296 return 0, true 4297 } else if leftValue.AsDuration() < rightValue.AsDuration() { 4298 return -1, true 4299 } else { 4300 return 1, true 4301 } 4302 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 4303 leftValue := fpv.value.(*durationpb.Duration) 4304 rightValue := source.GetSilenceAfter() 4305 if leftValue == nil { 4306 if rightValue != nil { 4307 return -1, true 4308 } 4309 return 0, true 4310 } 4311 if rightValue == nil { 4312 return 1, true 4313 } 4314 if leftValue.AsDuration() == rightValue.AsDuration() { 4315 return 0, true 4316 } else if leftValue.AsDuration() < rightValue.AsDuration() { 4317 return -1, true 4318 } else { 4319 return 1, true 4320 } 4321 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4322 return 0, false 4323 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 4324 leftValue := fpv.value.(*durationpb.Duration) 4325 rightValue := source.GetAdaptiveThresholdsDetectionPeriod() 4326 if leftValue == nil { 4327 if rightValue != nil { 4328 return -1, true 4329 } 4330 return 0, true 4331 } 4332 if rightValue == nil { 4333 return 1, true 4334 } 4335 if leftValue.AsDuration() == rightValue.AsDuration() { 4336 return 0, true 4337 } else if leftValue.AsDuration() < rightValue.AsDuration() { 4338 return -1, true 4339 } else { 4340 return 1, true 4341 } 4342 default: 4343 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fpv.selector)) 4344 } 4345 } 4346 4347 func (fpv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4348 return fpv.CompareWith(source.(*TsCndSpec_ThresholdAlertingCfg)) 4349 } 4350 4351 type TsCndSpecThresholdAlertingCfg_FieldSubPathValue struct { 4352 TsCndSpecThresholdAlertingCfg_FieldPath 4353 subPathValue gotenobject.FieldPathValue 4354 } 4355 4356 var _ TsCndSpecThresholdAlertingCfg_FieldPathValue = (*TsCndSpecThresholdAlertingCfg_FieldSubPathValue)(nil) 4357 4358 func (fpvs *TsCndSpecThresholdAlertingCfg_FieldSubPathValue) AsPerQueryThresholdsPathValue() (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue, bool) { 4359 res, ok := fpvs.subPathValue.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue) 4360 return res, ok 4361 } 4362 4363 func (fpvs *TsCndSpecThresholdAlertingCfg_FieldSubPathValue) SetTo(target **TsCndSpec_ThresholdAlertingCfg) { 4364 if *target == nil { 4365 *target = new(TsCndSpec_ThresholdAlertingCfg) 4366 } 4367 switch fpvs.Selector() { 4368 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4369 panic("FieldPath setter is unsupported for array subpaths") 4370 default: 4371 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fpvs.Selector())) 4372 } 4373 } 4374 4375 func (fpvs *TsCndSpecThresholdAlertingCfg_FieldSubPathValue) SetToRaw(target proto.Message) { 4376 typedObject := target.(*TsCndSpec_ThresholdAlertingCfg) 4377 fpvs.SetTo(&typedObject) 4378 } 4379 4380 func (fpvs *TsCndSpecThresholdAlertingCfg_FieldSubPathValue) GetRawValue() interface{} { 4381 return fpvs.subPathValue.GetRawValue() 4382 } 4383 4384 func (fpvs *TsCndSpecThresholdAlertingCfg_FieldSubPathValue) CompareWith(source *TsCndSpec_ThresholdAlertingCfg) (int, bool) { 4385 switch fpvs.Selector() { 4386 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4387 return 0, false // repeated field 4388 default: 4389 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fpvs.Selector())) 4390 } 4391 } 4392 4393 func (fpvs *TsCndSpecThresholdAlertingCfg_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4394 return fpvs.CompareWith(source.(*TsCndSpec_ThresholdAlertingCfg)) 4395 } 4396 4397 // TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue allows storing single item in Path-specific values for ThresholdAlertingCfg according to their type 4398 // Present only for array (repeated) types. 4399 type TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue interface { 4400 gotenobject.FieldPathArrayItemValue 4401 TsCndSpecThresholdAlertingCfg_FieldPath 4402 ContainsValue(*TsCndSpec_ThresholdAlertingCfg) bool 4403 } 4404 4405 // ParseTsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4406 func ParseTsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue(pathStr, valueStr string) (TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue, error) { 4407 fp, err := ParseTsCndSpecThresholdAlertingCfg_FieldPath(pathStr) 4408 if err != nil { 4409 return nil, err 4410 } 4411 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4412 if err != nil { 4413 return nil, status.Errorf(codes.InvalidArgument, "error parsing ThresholdAlertingCfg field path array item value from %s: %v", valueStr, err) 4414 } 4415 return fpaiv.(TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue), nil 4416 } 4417 4418 func MustParseTsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue(pathStr, valueStr string) TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue { 4419 fpaiv, err := ParseTsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue(pathStr, valueStr) 4420 if err != nil { 4421 panic(err) 4422 } 4423 return fpaiv 4424 } 4425 4426 type TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue struct { 4427 TsCndSpecThresholdAlertingCfg_FieldTerminalPath 4428 value interface{} 4429 } 4430 4431 var _ TsCndSpecThresholdAlertingCfg_FieldPathArrayItemValue = (*TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue)(nil) 4432 4433 // GetRawValue returns stored element value for array in object TsCndSpec_ThresholdAlertingCfg as interface{} 4434 func (fpaiv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4435 return fpaiv.value 4436 } 4437 func (fpaiv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue) AsPerQueryThresholdsItemValue() (*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds, bool) { 4438 res, ok := fpaiv.value.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 4439 return res, ok 4440 } 4441 4442 func (fpaiv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue) GetSingle(source *TsCndSpec_ThresholdAlertingCfg) (interface{}, bool) { 4443 return nil, false 4444 } 4445 4446 func (fpaiv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4447 return fpaiv.GetSingle(source.(*TsCndSpec_ThresholdAlertingCfg)) 4448 } 4449 4450 // Contains returns a boolean indicating if value that is being held is present in given 'ThresholdAlertingCfg' 4451 func (fpaiv *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayItemValue) ContainsValue(source *TsCndSpec_ThresholdAlertingCfg) bool { 4452 slice := fpaiv.TsCndSpecThresholdAlertingCfg_FieldTerminalPath.Get(source) 4453 for _, v := range slice { 4454 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4455 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4456 return true 4457 } 4458 } else if reflect.DeepEqual(v, fpaiv.value) { 4459 return true 4460 } 4461 } 4462 return false 4463 } 4464 4465 type TsCndSpecThresholdAlertingCfg_FieldSubPathArrayItemValue struct { 4466 TsCndSpecThresholdAlertingCfg_FieldPath 4467 subPathItemValue gotenobject.FieldPathArrayItemValue 4468 } 4469 4470 // GetRawValue returns stored array item value 4471 func (fpaivs *TsCndSpecThresholdAlertingCfg_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 4472 return fpaivs.subPathItemValue.GetRawItemValue() 4473 } 4474 func (fpaivs *TsCndSpecThresholdAlertingCfg_FieldSubPathArrayItemValue) AsPerQueryThresholdsPathItemValue() (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue, bool) { 4475 res, ok := fpaivs.subPathItemValue.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue) 4476 return res, ok 4477 } 4478 4479 // Contains returns a boolean indicating if value that is being held is present in given 'ThresholdAlertingCfg' 4480 func (fpaivs *TsCndSpecThresholdAlertingCfg_FieldSubPathArrayItemValue) ContainsValue(source *TsCndSpec_ThresholdAlertingCfg) bool { 4481 switch fpaivs.Selector() { 4482 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4483 return false // repeated/map field 4484 default: 4485 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg: %d", fpaivs.Selector())) 4486 } 4487 } 4488 4489 // TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues allows storing slice of values for ThresholdAlertingCfg fields according to their type 4490 type TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues interface { 4491 gotenobject.FieldPathArrayOfValues 4492 TsCndSpecThresholdAlertingCfg_FieldPath 4493 } 4494 4495 func ParseTsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues(pathStr, valuesStr string) (TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues, error) { 4496 fp, err := ParseTsCndSpecThresholdAlertingCfg_FieldPath(pathStr) 4497 if err != nil { 4498 return nil, err 4499 } 4500 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4501 if err != nil { 4502 return nil, status.Errorf(codes.InvalidArgument, "error parsing ThresholdAlertingCfg field path array of values from %s: %v", valuesStr, err) 4503 } 4504 return fpaov.(TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues), nil 4505 } 4506 4507 func MustParseTsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues(pathStr, valuesStr string) TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues { 4508 fpaov, err := ParseTsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues(pathStr, valuesStr) 4509 if err != nil { 4510 panic(err) 4511 } 4512 return fpaov 4513 } 4514 4515 type TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues struct { 4516 TsCndSpecThresholdAlertingCfg_FieldTerminalPath 4517 values interface{} 4518 } 4519 4520 var _ TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues = (*TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues)(nil) 4521 4522 func (fpaov *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4523 switch fpaov.selector { 4524 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 4525 for _, v := range fpaov.values.([]TsCndSpec_ThresholdAlertingCfg_Operator) { 4526 values = append(values, v) 4527 } 4528 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 4529 for _, v := range fpaov.values.([]*durationpb.Duration) { 4530 values = append(values, v) 4531 } 4532 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 4533 for _, v := range fpaov.values.([]*durationpb.Duration) { 4534 values = append(values, v) 4535 } 4536 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 4537 for _, v := range fpaov.values.([]*durationpb.Duration) { 4538 values = append(values, v) 4539 } 4540 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 4541 for _, v := range fpaov.values.([][]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) { 4542 values = append(values, v) 4543 } 4544 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 4545 for _, v := range fpaov.values.([]*durationpb.Duration) { 4546 values = append(values, v) 4547 } 4548 } 4549 return 4550 } 4551 func (fpaov *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues) AsOperatorArrayOfValues() ([]TsCndSpec_ThresholdAlertingCfg_Operator, bool) { 4552 res, ok := fpaov.values.([]TsCndSpec_ThresholdAlertingCfg_Operator) 4553 return res, ok 4554 } 4555 func (fpaov *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues) AsAlignmentPeriodArrayOfValues() ([]*durationpb.Duration, bool) { 4556 res, ok := fpaov.values.([]*durationpb.Duration) 4557 return res, ok 4558 } 4559 func (fpaov *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues) AsRaiseAfterArrayOfValues() ([]*durationpb.Duration, bool) { 4560 res, ok := fpaov.values.([]*durationpb.Duration) 4561 return res, ok 4562 } 4563 func (fpaov *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues) AsSilenceAfterArrayOfValues() ([]*durationpb.Duration, bool) { 4564 res, ok := fpaov.values.([]*durationpb.Duration) 4565 return res, ok 4566 } 4567 func (fpaov *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues) AsPerQueryThresholdsArrayOfValues() ([][]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds, bool) { 4568 res, ok := fpaov.values.([][]*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 4569 return res, ok 4570 } 4571 func (fpaov *TsCndSpecThresholdAlertingCfg_FieldTerminalPathArrayOfValues) AsAdaptiveThresholdsDetectionPeriodArrayOfValues() ([]*durationpb.Duration, bool) { 4572 res, ok := fpaov.values.([]*durationpb.Duration) 4573 return res, ok 4574 } 4575 4576 type TsCndSpecThresholdAlertingCfg_FieldSubPathArrayOfValues struct { 4577 TsCndSpecThresholdAlertingCfg_FieldPath 4578 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 4579 } 4580 4581 var _ TsCndSpecThresholdAlertingCfg_FieldPathArrayOfValues = (*TsCndSpecThresholdAlertingCfg_FieldSubPathArrayOfValues)(nil) 4582 4583 func (fpsaov *TsCndSpecThresholdAlertingCfg_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 4584 return fpsaov.subPathArrayOfValues.GetRawValues() 4585 } 4586 func (fpsaov *TsCndSpecThresholdAlertingCfg_FieldSubPathArrayOfValues) AsPerQueryThresholdsPathArrayOfValues() (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues, bool) { 4587 res, ok := fpsaov.subPathArrayOfValues.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues) 4588 return res, ok 4589 } 4590 4591 // FieldPath provides implementation to handle 4592 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4593 type TsCndSpecAnomalyAlertingCfg_FieldPath interface { 4594 gotenobject.FieldPath 4595 Selector() TsCndSpecAnomalyAlertingCfg_FieldPathSelector 4596 Get(source *TsCndSpec_AnomalyAlertingCfg) []interface{} 4597 GetSingle(source *TsCndSpec_AnomalyAlertingCfg) (interface{}, bool) 4598 ClearValue(item *TsCndSpec_AnomalyAlertingCfg) 4599 4600 // Those methods build corresponding TsCndSpecAnomalyAlertingCfg_FieldPathValue 4601 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4602 WithIValue(value interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathValue 4603 WithIArrayOfValues(values interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues 4604 WithIArrayItemValue(value interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue 4605 } 4606 4607 type TsCndSpecAnomalyAlertingCfg_FieldPathSelector int32 4608 4609 const ( 4610 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow TsCndSpecAnomalyAlertingCfg_FieldPathSelector = 0 4611 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval TsCndSpecAnomalyAlertingCfg_FieldPathSelector = 1 4612 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval TsCndSpecAnomalyAlertingCfg_FieldPathSelector = 2 4613 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod TsCndSpecAnomalyAlertingCfg_FieldPathSelector = 3 4614 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder TsCndSpecAnomalyAlertingCfg_FieldPathSelector = 4 4615 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter TsCndSpecAnomalyAlertingCfg_FieldPathSelector = 5 4616 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter TsCndSpecAnomalyAlertingCfg_FieldPathSelector = 6 4617 ) 4618 4619 func (s TsCndSpecAnomalyAlertingCfg_FieldPathSelector) String() string { 4620 switch s { 4621 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 4622 return "analysis_window" 4623 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 4624 return "step_interval" 4625 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 4626 return "train_step_interval" 4627 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 4628 return "alignment_period" 4629 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4630 return "lstm_autoencoder" 4631 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 4632 return "raise_after" 4633 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 4634 return "silence_after" 4635 default: 4636 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", s)) 4637 } 4638 } 4639 4640 func BuildTsCndSpecAnomalyAlertingCfg_FieldPath(fp gotenobject.RawFieldPath) (TsCndSpecAnomalyAlertingCfg_FieldPath, error) { 4641 if len(fp) == 0 { 4642 return nil, status.Error(codes.InvalidArgument, "empty field path for object TsCndSpec_AnomalyAlertingCfg") 4643 } 4644 if len(fp) == 1 { 4645 switch fp[0] { 4646 case "analysis_window", "analysisWindow", "analysis-window": 4647 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow}, nil 4648 case "step_interval", "stepInterval", "step-interval": 4649 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval}, nil 4650 case "train_step_interval", "trainStepInterval", "train-step-interval": 4651 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval}, nil 4652 case "alignment_period", "alignmentPeriod", "alignment-period": 4653 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod}, nil 4654 case "lstm_autoencoder", "lstmAutoencoder", "lstm-autoencoder": 4655 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder}, nil 4656 case "raise_after", "raiseAfter", "raise-after": 4657 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter}, nil 4658 case "silence_after", "silenceAfter", "silence-after": 4659 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter}, nil 4660 } 4661 } else { 4662 switch fp[0] { 4663 case "lstm_autoencoder", "lstmAutoencoder", "lstm-autoencoder": 4664 if subpath, err := BuildTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(fp[1:]); err != nil { 4665 return nil, err 4666 } else { 4667 return &TsCndSpecAnomalyAlertingCfg_FieldSubPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder, subPath: subpath}, nil 4668 } 4669 } 4670 } 4671 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object TsCndSpec_AnomalyAlertingCfg", fp) 4672 } 4673 4674 func ParseTsCndSpecAnomalyAlertingCfg_FieldPath(rawField string) (TsCndSpecAnomalyAlertingCfg_FieldPath, error) { 4675 fp, err := gotenobject.ParseRawFieldPath(rawField) 4676 if err != nil { 4677 return nil, err 4678 } 4679 return BuildTsCndSpecAnomalyAlertingCfg_FieldPath(fp) 4680 } 4681 4682 func MustParseTsCndSpecAnomalyAlertingCfg_FieldPath(rawField string) TsCndSpecAnomalyAlertingCfg_FieldPath { 4683 fp, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPath(rawField) 4684 if err != nil { 4685 panic(err) 4686 } 4687 return fp 4688 } 4689 4690 type TsCndSpecAnomalyAlertingCfg_FieldTerminalPath struct { 4691 selector TsCndSpecAnomalyAlertingCfg_FieldPathSelector 4692 } 4693 4694 var _ TsCndSpecAnomalyAlertingCfg_FieldPath = (*TsCndSpecAnomalyAlertingCfg_FieldTerminalPath)(nil) 4695 4696 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) Selector() TsCndSpecAnomalyAlertingCfg_FieldPathSelector { 4697 return fp.selector 4698 } 4699 4700 // String returns path representation in proto convention 4701 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) String() string { 4702 return fp.selector.String() 4703 } 4704 4705 // JSONString returns path representation is JSON convention 4706 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) JSONString() string { 4707 return strcase.ToLowerCamel(fp.String()) 4708 } 4709 4710 // Get returns all values pointed by specific field from source TsCndSpec_AnomalyAlertingCfg 4711 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) Get(source *TsCndSpec_AnomalyAlertingCfg) (values []interface{}) { 4712 if source != nil { 4713 switch fp.selector { 4714 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 4715 if source.AnalysisWindow != nil { 4716 values = append(values, source.AnalysisWindow) 4717 } 4718 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 4719 if source.StepInterval != nil { 4720 values = append(values, source.StepInterval) 4721 } 4722 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 4723 if source.TrainStepInterval != nil { 4724 values = append(values, source.TrainStepInterval) 4725 } 4726 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 4727 if source.AlignmentPeriod != nil { 4728 values = append(values, source.AlignmentPeriod) 4729 } 4730 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4731 if source, ok := source.Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder); ok && source != nil { 4732 if source.LstmAutoencoder != nil { 4733 values = append(values, source.LstmAutoencoder) 4734 } 4735 } 4736 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 4737 if source.RaiseAfter != nil { 4738 values = append(values, source.RaiseAfter) 4739 } 4740 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 4741 if source.SilenceAfter != nil { 4742 values = append(values, source.SilenceAfter) 4743 } 4744 default: 4745 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fp.selector)) 4746 } 4747 } 4748 return 4749 } 4750 4751 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4752 return fp.Get(source.(*TsCndSpec_AnomalyAlertingCfg)) 4753 } 4754 4755 // GetSingle returns value pointed by specific field of from source TsCndSpec_AnomalyAlertingCfg 4756 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) GetSingle(source *TsCndSpec_AnomalyAlertingCfg) (interface{}, bool) { 4757 switch fp.selector { 4758 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 4759 res := source.GetAnalysisWindow() 4760 return res, res != nil 4761 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 4762 res := source.GetStepInterval() 4763 return res, res != nil 4764 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 4765 res := source.GetTrainStepInterval() 4766 return res, res != nil 4767 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 4768 res := source.GetAlignmentPeriod() 4769 return res, res != nil 4770 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4771 // if object nil or oneof not active, return "default" type with false flag. 4772 if source == nil { 4773 return source.GetLstmAutoencoder(), false 4774 } 4775 _, oneOfSelected := source.Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder) 4776 if !oneOfSelected { 4777 return source.GetLstmAutoencoder(), false // to return "type" information 4778 } 4779 res := source.GetLstmAutoencoder() 4780 return res, res != nil 4781 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 4782 res := source.GetRaiseAfter() 4783 return res, res != nil 4784 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 4785 res := source.GetSilenceAfter() 4786 return res, res != nil 4787 default: 4788 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fp.selector)) 4789 } 4790 } 4791 4792 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4793 return fp.GetSingle(source.(*TsCndSpec_AnomalyAlertingCfg)) 4794 } 4795 4796 // GetDefault returns a default value of the field type 4797 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) GetDefault() interface{} { 4798 switch fp.selector { 4799 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 4800 return (*durationpb.Duration)(nil) 4801 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 4802 return (*durationpb.Duration)(nil) 4803 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 4804 return (*durationpb.Duration)(nil) 4805 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 4806 return (*durationpb.Duration)(nil) 4807 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4808 return (*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)(nil) 4809 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 4810 return (*durationpb.Duration)(nil) 4811 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 4812 return (*durationpb.Duration)(nil) 4813 default: 4814 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fp.selector)) 4815 } 4816 } 4817 4818 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) ClearValue(item *TsCndSpec_AnomalyAlertingCfg) { 4819 if item != nil { 4820 switch fp.selector { 4821 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 4822 item.AnalysisWindow = nil 4823 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 4824 item.StepInterval = nil 4825 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 4826 item.TrainStepInterval = nil 4827 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 4828 item.AlignmentPeriod = nil 4829 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4830 if item, ok := item.Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder); ok { 4831 item.LstmAutoencoder = nil 4832 } 4833 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 4834 item.RaiseAfter = nil 4835 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 4836 item.SilenceAfter = nil 4837 default: 4838 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fp.selector)) 4839 } 4840 } 4841 } 4842 4843 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4844 fp.ClearValue(item.(*TsCndSpec_AnomalyAlertingCfg)) 4845 } 4846 4847 // IsLeaf - whether field path is holds simple value 4848 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) IsLeaf() bool { 4849 return fp.selector == TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow || 4850 fp.selector == TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval || 4851 fp.selector == TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval || 4852 fp.selector == TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod || 4853 fp.selector == TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter || 4854 fp.selector == TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter 4855 } 4856 4857 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4858 return []gotenobject.FieldPath{fp} 4859 } 4860 4861 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) WithIValue(value interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathValue { 4862 switch fp.selector { 4863 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 4864 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 4865 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 4866 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 4867 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 4868 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 4869 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 4870 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 4871 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4872 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, value: value.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)} 4873 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 4874 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 4875 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 4876 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 4877 default: 4878 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fp.selector)) 4879 } 4880 } 4881 4882 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4883 return fp.WithIValue(value) 4884 } 4885 4886 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) WithIArrayOfValues(values interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues { 4887 fpaov := &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp} 4888 switch fp.selector { 4889 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 4890 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4891 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 4892 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4893 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 4894 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4895 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 4896 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4897 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4898 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, values: values.([]*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)} 4899 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 4900 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4901 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 4902 return &TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 4903 default: 4904 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fp.selector)) 4905 } 4906 return fpaov 4907 } 4908 4909 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4910 return fp.WithIArrayOfValues(values) 4911 } 4912 4913 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) WithIArrayItemValue(value interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue { 4914 switch fp.selector { 4915 default: 4916 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fp.selector)) 4917 } 4918 } 4919 4920 func (fp *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4921 return fp.WithIArrayItemValue(value) 4922 } 4923 4924 type TsCndSpecAnomalyAlertingCfg_FieldSubPath struct { 4925 selector TsCndSpecAnomalyAlertingCfg_FieldPathSelector 4926 subPath gotenobject.FieldPath 4927 } 4928 4929 var _ TsCndSpecAnomalyAlertingCfg_FieldPath = (*TsCndSpecAnomalyAlertingCfg_FieldSubPath)(nil) 4930 4931 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) Selector() TsCndSpecAnomalyAlertingCfg_FieldPathSelector { 4932 return fps.selector 4933 } 4934 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) AsLstmAutoencoderSubPath() (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath, bool) { 4935 res, ok := fps.subPath.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath) 4936 return res, ok 4937 } 4938 4939 // String returns path representation in proto convention 4940 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) String() string { 4941 return fps.selector.String() + "." + fps.subPath.String() 4942 } 4943 4944 // JSONString returns path representation is JSON convention 4945 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) JSONString() string { 4946 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 4947 } 4948 4949 // Get returns all values pointed by selected field from source TsCndSpec_AnomalyAlertingCfg 4950 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) Get(source *TsCndSpec_AnomalyAlertingCfg) (values []interface{}) { 4951 switch fps.selector { 4952 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4953 values = append(values, fps.subPath.GetRaw(source.GetLstmAutoencoder())...) 4954 default: 4955 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fps.selector)) 4956 } 4957 return 4958 } 4959 4960 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) GetRaw(source proto.Message) []interface{} { 4961 return fps.Get(source.(*TsCndSpec_AnomalyAlertingCfg)) 4962 } 4963 4964 // GetSingle returns value of selected field from source TsCndSpec_AnomalyAlertingCfg 4965 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) GetSingle(source *TsCndSpec_AnomalyAlertingCfg) (interface{}, bool) { 4966 switch fps.selector { 4967 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4968 if source.GetLstmAutoencoder() == nil { 4969 return nil, false 4970 } 4971 return fps.subPath.GetSingleRaw(source.GetLstmAutoencoder()) 4972 default: 4973 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fps.selector)) 4974 } 4975 } 4976 4977 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4978 return fps.GetSingle(source.(*TsCndSpec_AnomalyAlertingCfg)) 4979 } 4980 4981 // GetDefault returns a default value of the field type 4982 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) GetDefault() interface{} { 4983 return fps.subPath.GetDefault() 4984 } 4985 4986 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) ClearValue(item *TsCndSpec_AnomalyAlertingCfg) { 4987 if item != nil { 4988 switch fps.selector { 4989 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 4990 if item.Model != nil { 4991 if item, ok := item.Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder); ok { 4992 fps.subPath.ClearValueRaw(item.LstmAutoencoder) 4993 } 4994 } 4995 default: 4996 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fps.selector)) 4997 } 4998 } 4999 } 5000 5001 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) ClearValueRaw(item proto.Message) { 5002 fps.ClearValue(item.(*TsCndSpec_AnomalyAlertingCfg)) 5003 } 5004 5005 // IsLeaf - whether field path is holds simple value 5006 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) IsLeaf() bool { 5007 return fps.subPath.IsLeaf() 5008 } 5009 5010 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5011 iPaths := []gotenobject.FieldPath{&TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: fps.selector}} 5012 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 5013 return iPaths 5014 } 5015 5016 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) WithIValue(value interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathValue { 5017 return &TsCndSpecAnomalyAlertingCfg_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 5018 } 5019 5020 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5021 return fps.WithIValue(value) 5022 } 5023 5024 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) WithIArrayOfValues(values interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues { 5025 return &TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 5026 } 5027 5028 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5029 return fps.WithIArrayOfValues(values) 5030 } 5031 5032 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) WithIArrayItemValue(value interface{}) TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue { 5033 return &TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 5034 } 5035 5036 func (fps *TsCndSpecAnomalyAlertingCfg_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5037 return fps.WithIArrayItemValue(value) 5038 } 5039 5040 // TsCndSpecAnomalyAlertingCfg_FieldPathValue allows storing values for AnomalyAlertingCfg fields according to their type 5041 type TsCndSpecAnomalyAlertingCfg_FieldPathValue interface { 5042 TsCndSpecAnomalyAlertingCfg_FieldPath 5043 gotenobject.FieldPathValue 5044 SetTo(target **TsCndSpec_AnomalyAlertingCfg) 5045 CompareWith(*TsCndSpec_AnomalyAlertingCfg) (cmp int, comparable bool) 5046 } 5047 5048 func ParseTsCndSpecAnomalyAlertingCfg_FieldPathValue(pathStr, valueStr string) (TsCndSpecAnomalyAlertingCfg_FieldPathValue, error) { 5049 fp, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPath(pathStr) 5050 if err != nil { 5051 return nil, err 5052 } 5053 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 5054 if err != nil { 5055 return nil, status.Errorf(codes.InvalidArgument, "error parsing AnomalyAlertingCfg field path value from %s: %v", valueStr, err) 5056 } 5057 return fpv.(TsCndSpecAnomalyAlertingCfg_FieldPathValue), nil 5058 } 5059 5060 func MustParseTsCndSpecAnomalyAlertingCfg_FieldPathValue(pathStr, valueStr string) TsCndSpecAnomalyAlertingCfg_FieldPathValue { 5061 fpv, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPathValue(pathStr, valueStr) 5062 if err != nil { 5063 panic(err) 5064 } 5065 return fpv 5066 } 5067 5068 type TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue struct { 5069 TsCndSpecAnomalyAlertingCfg_FieldTerminalPath 5070 value interface{} 5071 } 5072 5073 var _ TsCndSpecAnomalyAlertingCfg_FieldPathValue = (*TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue)(nil) 5074 5075 // GetRawValue returns raw value stored under selected path for 'AnomalyAlertingCfg' as interface{} 5076 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) GetRawValue() interface{} { 5077 return fpv.value 5078 } 5079 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) AsAnalysisWindowValue() (*durationpb.Duration, bool) { 5080 res, ok := fpv.value.(*durationpb.Duration) 5081 return res, ok 5082 } 5083 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) AsStepIntervalValue() (*durationpb.Duration, bool) { 5084 res, ok := fpv.value.(*durationpb.Duration) 5085 return res, ok 5086 } 5087 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) AsTrainStepIntervalValue() (*durationpb.Duration, bool) { 5088 res, ok := fpv.value.(*durationpb.Duration) 5089 return res, ok 5090 } 5091 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) AsAlignmentPeriodValue() (*durationpb.Duration, bool) { 5092 res, ok := fpv.value.(*durationpb.Duration) 5093 return res, ok 5094 } 5095 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) AsLstmAutoencoderValue() (*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder, bool) { 5096 res, ok := fpv.value.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) 5097 return res, ok 5098 } 5099 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) AsRaiseAfterValue() (*durationpb.Duration, bool) { 5100 res, ok := fpv.value.(*durationpb.Duration) 5101 return res, ok 5102 } 5103 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) AsSilenceAfterValue() (*durationpb.Duration, bool) { 5104 res, ok := fpv.value.(*durationpb.Duration) 5105 return res, ok 5106 } 5107 5108 // SetTo stores value for selected field for object AnomalyAlertingCfg 5109 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) SetTo(target **TsCndSpec_AnomalyAlertingCfg) { 5110 if *target == nil { 5111 *target = new(TsCndSpec_AnomalyAlertingCfg) 5112 } 5113 switch fpv.selector { 5114 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 5115 (*target).AnalysisWindow = fpv.value.(*durationpb.Duration) 5116 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 5117 (*target).StepInterval = fpv.value.(*durationpb.Duration) 5118 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 5119 (*target).TrainStepInterval = fpv.value.(*durationpb.Duration) 5120 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 5121 (*target).AlignmentPeriod = fpv.value.(*durationpb.Duration) 5122 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 5123 if _, ok := (*target).Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder); !ok { 5124 (*target).Model = &TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder{} 5125 } 5126 (*target).Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder).LstmAutoencoder = fpv.value.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) 5127 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 5128 (*target).RaiseAfter = fpv.value.(*durationpb.Duration) 5129 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 5130 (*target).SilenceAfter = fpv.value.(*durationpb.Duration) 5131 default: 5132 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fpv.selector)) 5133 } 5134 } 5135 5136 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) SetToRaw(target proto.Message) { 5137 typedObject := target.(*TsCndSpec_AnomalyAlertingCfg) 5138 fpv.SetTo(&typedObject) 5139 } 5140 5141 // CompareWith compares value in the 'TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue' with the value under path in 'TsCndSpec_AnomalyAlertingCfg'. 5142 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) CompareWith(source *TsCndSpec_AnomalyAlertingCfg) (int, bool) { 5143 switch fpv.selector { 5144 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 5145 leftValue := fpv.value.(*durationpb.Duration) 5146 rightValue := source.GetAnalysisWindow() 5147 if leftValue == nil { 5148 if rightValue != nil { 5149 return -1, true 5150 } 5151 return 0, true 5152 } 5153 if rightValue == nil { 5154 return 1, true 5155 } 5156 if leftValue.AsDuration() == rightValue.AsDuration() { 5157 return 0, true 5158 } else if leftValue.AsDuration() < rightValue.AsDuration() { 5159 return -1, true 5160 } else { 5161 return 1, true 5162 } 5163 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 5164 leftValue := fpv.value.(*durationpb.Duration) 5165 rightValue := source.GetStepInterval() 5166 if leftValue == nil { 5167 if rightValue != nil { 5168 return -1, true 5169 } 5170 return 0, true 5171 } 5172 if rightValue == nil { 5173 return 1, true 5174 } 5175 if leftValue.AsDuration() == rightValue.AsDuration() { 5176 return 0, true 5177 } else if leftValue.AsDuration() < rightValue.AsDuration() { 5178 return -1, true 5179 } else { 5180 return 1, true 5181 } 5182 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 5183 leftValue := fpv.value.(*durationpb.Duration) 5184 rightValue := source.GetTrainStepInterval() 5185 if leftValue == nil { 5186 if rightValue != nil { 5187 return -1, true 5188 } 5189 return 0, true 5190 } 5191 if rightValue == nil { 5192 return 1, true 5193 } 5194 if leftValue.AsDuration() == rightValue.AsDuration() { 5195 return 0, true 5196 } else if leftValue.AsDuration() < rightValue.AsDuration() { 5197 return -1, true 5198 } else { 5199 return 1, true 5200 } 5201 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 5202 leftValue := fpv.value.(*durationpb.Duration) 5203 rightValue := source.GetAlignmentPeriod() 5204 if leftValue == nil { 5205 if rightValue != nil { 5206 return -1, true 5207 } 5208 return 0, true 5209 } 5210 if rightValue == nil { 5211 return 1, true 5212 } 5213 if leftValue.AsDuration() == rightValue.AsDuration() { 5214 return 0, true 5215 } else if leftValue.AsDuration() < rightValue.AsDuration() { 5216 return -1, true 5217 } else { 5218 return 1, true 5219 } 5220 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 5221 return 0, false 5222 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 5223 leftValue := fpv.value.(*durationpb.Duration) 5224 rightValue := source.GetRaiseAfter() 5225 if leftValue == nil { 5226 if rightValue != nil { 5227 return -1, true 5228 } 5229 return 0, true 5230 } 5231 if rightValue == nil { 5232 return 1, true 5233 } 5234 if leftValue.AsDuration() == rightValue.AsDuration() { 5235 return 0, true 5236 } else if leftValue.AsDuration() < rightValue.AsDuration() { 5237 return -1, true 5238 } else { 5239 return 1, true 5240 } 5241 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 5242 leftValue := fpv.value.(*durationpb.Duration) 5243 rightValue := source.GetSilenceAfter() 5244 if leftValue == nil { 5245 if rightValue != nil { 5246 return -1, true 5247 } 5248 return 0, true 5249 } 5250 if rightValue == nil { 5251 return 1, true 5252 } 5253 if leftValue.AsDuration() == rightValue.AsDuration() { 5254 return 0, true 5255 } else if leftValue.AsDuration() < rightValue.AsDuration() { 5256 return -1, true 5257 } else { 5258 return 1, true 5259 } 5260 default: 5261 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fpv.selector)) 5262 } 5263 } 5264 5265 func (fpv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5266 return fpv.CompareWith(source.(*TsCndSpec_AnomalyAlertingCfg)) 5267 } 5268 5269 type TsCndSpecAnomalyAlertingCfg_FieldSubPathValue struct { 5270 TsCndSpecAnomalyAlertingCfg_FieldPath 5271 subPathValue gotenobject.FieldPathValue 5272 } 5273 5274 var _ TsCndSpecAnomalyAlertingCfg_FieldPathValue = (*TsCndSpecAnomalyAlertingCfg_FieldSubPathValue)(nil) 5275 5276 func (fpvs *TsCndSpecAnomalyAlertingCfg_FieldSubPathValue) AsLstmAutoencoderPathValue() (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue, bool) { 5277 res, ok := fpvs.subPathValue.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue) 5278 return res, ok 5279 } 5280 5281 func (fpvs *TsCndSpecAnomalyAlertingCfg_FieldSubPathValue) SetTo(target **TsCndSpec_AnomalyAlertingCfg) { 5282 if *target == nil { 5283 *target = new(TsCndSpec_AnomalyAlertingCfg) 5284 } 5285 switch fpvs.Selector() { 5286 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 5287 if _, ok := (*target).Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder); !ok { 5288 (*target).Model = &TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder{} 5289 } 5290 fpvs.subPathValue.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue).SetTo(&(*target).Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder).LstmAutoencoder) 5291 default: 5292 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fpvs.Selector())) 5293 } 5294 } 5295 5296 func (fpvs *TsCndSpecAnomalyAlertingCfg_FieldSubPathValue) SetToRaw(target proto.Message) { 5297 typedObject := target.(*TsCndSpec_AnomalyAlertingCfg) 5298 fpvs.SetTo(&typedObject) 5299 } 5300 5301 func (fpvs *TsCndSpecAnomalyAlertingCfg_FieldSubPathValue) GetRawValue() interface{} { 5302 return fpvs.subPathValue.GetRawValue() 5303 } 5304 5305 func (fpvs *TsCndSpecAnomalyAlertingCfg_FieldSubPathValue) CompareWith(source *TsCndSpec_AnomalyAlertingCfg) (int, bool) { 5306 switch fpvs.Selector() { 5307 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 5308 return fpvs.subPathValue.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue).CompareWith(source.GetLstmAutoencoder()) 5309 default: 5310 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fpvs.Selector())) 5311 } 5312 } 5313 5314 func (fpvs *TsCndSpecAnomalyAlertingCfg_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5315 return fpvs.CompareWith(source.(*TsCndSpec_AnomalyAlertingCfg)) 5316 } 5317 5318 // TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue allows storing single item in Path-specific values for AnomalyAlertingCfg according to their type 5319 // Present only for array (repeated) types. 5320 type TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue interface { 5321 gotenobject.FieldPathArrayItemValue 5322 TsCndSpecAnomalyAlertingCfg_FieldPath 5323 ContainsValue(*TsCndSpec_AnomalyAlertingCfg) bool 5324 } 5325 5326 // ParseTsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 5327 func ParseTsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue(pathStr, valueStr string) (TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue, error) { 5328 fp, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPath(pathStr) 5329 if err != nil { 5330 return nil, err 5331 } 5332 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 5333 if err != nil { 5334 return nil, status.Errorf(codes.InvalidArgument, "error parsing AnomalyAlertingCfg field path array item value from %s: %v", valueStr, err) 5335 } 5336 return fpaiv.(TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue), nil 5337 } 5338 5339 func MustParseTsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue(pathStr, valueStr string) TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue { 5340 fpaiv, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue(pathStr, valueStr) 5341 if err != nil { 5342 panic(err) 5343 } 5344 return fpaiv 5345 } 5346 5347 type TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayItemValue struct { 5348 TsCndSpecAnomalyAlertingCfg_FieldTerminalPath 5349 value interface{} 5350 } 5351 5352 var _ TsCndSpecAnomalyAlertingCfg_FieldPathArrayItemValue = (*TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayItemValue)(nil) 5353 5354 // GetRawValue returns stored element value for array in object TsCndSpec_AnomalyAlertingCfg as interface{} 5355 func (fpaiv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 5356 return fpaiv.value 5357 } 5358 5359 func (fpaiv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayItemValue) GetSingle(source *TsCndSpec_AnomalyAlertingCfg) (interface{}, bool) { 5360 return nil, false 5361 } 5362 5363 func (fpaiv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 5364 return fpaiv.GetSingle(source.(*TsCndSpec_AnomalyAlertingCfg)) 5365 } 5366 5367 // Contains returns a boolean indicating if value that is being held is present in given 'AnomalyAlertingCfg' 5368 func (fpaiv *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayItemValue) ContainsValue(source *TsCndSpec_AnomalyAlertingCfg) bool { 5369 slice := fpaiv.TsCndSpecAnomalyAlertingCfg_FieldTerminalPath.Get(source) 5370 for _, v := range slice { 5371 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 5372 if proto.Equal(asProtoMsg, v.(proto.Message)) { 5373 return true 5374 } 5375 } else if reflect.DeepEqual(v, fpaiv.value) { 5376 return true 5377 } 5378 } 5379 return false 5380 } 5381 5382 type TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayItemValue struct { 5383 TsCndSpecAnomalyAlertingCfg_FieldPath 5384 subPathItemValue gotenobject.FieldPathArrayItemValue 5385 } 5386 5387 // GetRawValue returns stored array item value 5388 func (fpaivs *TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 5389 return fpaivs.subPathItemValue.GetRawItemValue() 5390 } 5391 func (fpaivs *TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayItemValue) AsLstmAutoencoderPathItemValue() (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue, bool) { 5392 res, ok := fpaivs.subPathItemValue.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue) 5393 return res, ok 5394 } 5395 5396 // Contains returns a boolean indicating if value that is being held is present in given 'AnomalyAlertingCfg' 5397 func (fpaivs *TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayItemValue) ContainsValue(source *TsCndSpec_AnomalyAlertingCfg) bool { 5398 switch fpaivs.Selector() { 5399 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 5400 return fpaivs.subPathItemValue.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue).ContainsValue(source.GetLstmAutoencoder()) 5401 default: 5402 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg: %d", fpaivs.Selector())) 5403 } 5404 } 5405 5406 // TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues allows storing slice of values for AnomalyAlertingCfg fields according to their type 5407 type TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues interface { 5408 gotenobject.FieldPathArrayOfValues 5409 TsCndSpecAnomalyAlertingCfg_FieldPath 5410 } 5411 5412 func ParseTsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues(pathStr, valuesStr string) (TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues, error) { 5413 fp, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPath(pathStr) 5414 if err != nil { 5415 return nil, err 5416 } 5417 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 5418 if err != nil { 5419 return nil, status.Errorf(codes.InvalidArgument, "error parsing AnomalyAlertingCfg field path array of values from %s: %v", valuesStr, err) 5420 } 5421 return fpaov.(TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues), nil 5422 } 5423 5424 func MustParseTsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues(pathStr, valuesStr string) TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues { 5425 fpaov, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues(pathStr, valuesStr) 5426 if err != nil { 5427 panic(err) 5428 } 5429 return fpaov 5430 } 5431 5432 type TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues struct { 5433 TsCndSpecAnomalyAlertingCfg_FieldTerminalPath 5434 values interface{} 5435 } 5436 5437 var _ TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues = (*TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues)(nil) 5438 5439 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 5440 switch fpaov.selector { 5441 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 5442 for _, v := range fpaov.values.([]*durationpb.Duration) { 5443 values = append(values, v) 5444 } 5445 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 5446 for _, v := range fpaov.values.([]*durationpb.Duration) { 5447 values = append(values, v) 5448 } 5449 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 5450 for _, v := range fpaov.values.([]*durationpb.Duration) { 5451 values = append(values, v) 5452 } 5453 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 5454 for _, v := range fpaov.values.([]*durationpb.Duration) { 5455 values = append(values, v) 5456 } 5457 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 5458 for _, v := range fpaov.values.([]*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) { 5459 values = append(values, v) 5460 } 5461 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 5462 for _, v := range fpaov.values.([]*durationpb.Duration) { 5463 values = append(values, v) 5464 } 5465 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 5466 for _, v := range fpaov.values.([]*durationpb.Duration) { 5467 values = append(values, v) 5468 } 5469 } 5470 return 5471 } 5472 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) AsAnalysisWindowArrayOfValues() ([]*durationpb.Duration, bool) { 5473 res, ok := fpaov.values.([]*durationpb.Duration) 5474 return res, ok 5475 } 5476 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) AsStepIntervalArrayOfValues() ([]*durationpb.Duration, bool) { 5477 res, ok := fpaov.values.([]*durationpb.Duration) 5478 return res, ok 5479 } 5480 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) AsTrainStepIntervalArrayOfValues() ([]*durationpb.Duration, bool) { 5481 res, ok := fpaov.values.([]*durationpb.Duration) 5482 return res, ok 5483 } 5484 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) AsAlignmentPeriodArrayOfValues() ([]*durationpb.Duration, bool) { 5485 res, ok := fpaov.values.([]*durationpb.Duration) 5486 return res, ok 5487 } 5488 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) AsLstmAutoencoderArrayOfValues() ([]*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder, bool) { 5489 res, ok := fpaov.values.([]*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) 5490 return res, ok 5491 } 5492 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) AsRaiseAfterArrayOfValues() ([]*durationpb.Duration, bool) { 5493 res, ok := fpaov.values.([]*durationpb.Duration) 5494 return res, ok 5495 } 5496 func (fpaov *TsCndSpecAnomalyAlertingCfg_FieldTerminalPathArrayOfValues) AsSilenceAfterArrayOfValues() ([]*durationpb.Duration, bool) { 5497 res, ok := fpaov.values.([]*durationpb.Duration) 5498 return res, ok 5499 } 5500 5501 type TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayOfValues struct { 5502 TsCndSpecAnomalyAlertingCfg_FieldPath 5503 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 5504 } 5505 5506 var _ TsCndSpecAnomalyAlertingCfg_FieldPathArrayOfValues = (*TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayOfValues)(nil) 5507 5508 func (fpsaov *TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 5509 return fpsaov.subPathArrayOfValues.GetRawValues() 5510 } 5511 func (fpsaov *TsCndSpecAnomalyAlertingCfg_FieldSubPathArrayOfValues) AsLstmAutoencoderPathArrayOfValues() (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues, bool) { 5512 res, ok := fpsaov.subPathArrayOfValues.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues) 5513 return res, ok 5514 } 5515 5516 // FieldPath provides implementation to handle 5517 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 5518 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath interface { 5519 gotenobject.FieldPath 5520 Selector() TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector 5521 Get(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) []interface{} 5522 GetSingle(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (interface{}, bool) 5523 ClearValue(item *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 5524 5525 // Those methods build corresponding TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue 5526 // (or array of values) and holds passed value. Panics if injected type is incorrect. 5527 WithIValue(value interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue 5528 WithIArrayOfValues(values interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues 5529 WithIArrayItemValue(value interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue 5530 } 5531 5532 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector int32 5533 5534 const ( 5535 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector = 0 5536 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector = 1 5537 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector = 2 5538 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector = 3 5539 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector = 4 5540 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector = 5 5541 ) 5542 5543 func (s TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector) String() string { 5544 switch s { 5545 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 5546 return "auto_adapt_upper" 5547 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 5548 return "auto_adapt_lower" 5549 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5550 return "max_upper" 5551 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5552 return "max_lower" 5553 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5554 return "min_upper" 5555 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5556 return "min_lower" 5557 default: 5558 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", s)) 5559 } 5560 } 5561 5562 func BuildTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(fp gotenobject.RawFieldPath) (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath, error) { 5563 if len(fp) == 0 { 5564 return nil, status.Error(codes.InvalidArgument, "empty field path for object TsCndSpec_ThresholdAlertingCfg_AlertingThresholds") 5565 } 5566 if len(fp) == 1 { 5567 switch fp[0] { 5568 case "auto_adapt_upper", "autoAdaptUpper", "auto-adapt-upper": 5569 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper}, nil 5570 case "auto_adapt_lower", "autoAdaptLower", "auto-adapt-lower": 5571 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower}, nil 5572 case "max_upper", "maxUpper", "max-upper": 5573 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper}, nil 5574 case "max_lower", "maxLower", "max-lower": 5575 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower}, nil 5576 case "min_upper", "minUpper", "min-upper": 5577 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper}, nil 5578 case "min_lower", "minLower", "min-lower": 5579 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower}, nil 5580 } 5581 } else { 5582 switch fp[0] { 5583 case "max_upper", "maxUpper", "max-upper": 5584 if subpath, err := BuildAlertingThreshold_FieldPath(fp[1:]); err != nil { 5585 return nil, err 5586 } else { 5587 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper, subPath: subpath}, nil 5588 } 5589 case "max_lower", "maxLower", "max-lower": 5590 if subpath, err := BuildAlertingThreshold_FieldPath(fp[1:]); err != nil { 5591 return nil, err 5592 } else { 5593 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower, subPath: subpath}, nil 5594 } 5595 case "min_upper", "minUpper", "min-upper": 5596 if subpath, err := BuildAlertingThreshold_FieldPath(fp[1:]); err != nil { 5597 return nil, err 5598 } else { 5599 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper, subPath: subpath}, nil 5600 } 5601 case "min_lower", "minLower", "min-lower": 5602 if subpath, err := BuildAlertingThreshold_FieldPath(fp[1:]); err != nil { 5603 return nil, err 5604 } else { 5605 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower, subPath: subpath}, nil 5606 } 5607 } 5608 } 5609 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object TsCndSpec_ThresholdAlertingCfg_AlertingThresholds", fp) 5610 } 5611 5612 func ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(rawField string) (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath, error) { 5613 fp, err := gotenobject.ParseRawFieldPath(rawField) 5614 if err != nil { 5615 return nil, err 5616 } 5617 return BuildTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(fp) 5618 } 5619 5620 func MustParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(rawField string) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath { 5621 fp, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(rawField) 5622 if err != nil { 5623 panic(err) 5624 } 5625 return fp 5626 } 5627 5628 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath struct { 5629 selector TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector 5630 } 5631 5632 var _ TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath = (*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath)(nil) 5633 5634 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) Selector() TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector { 5635 return fp.selector 5636 } 5637 5638 // String returns path representation in proto convention 5639 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) String() string { 5640 return fp.selector.String() 5641 } 5642 5643 // JSONString returns path representation is JSON convention 5644 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) JSONString() string { 5645 return strcase.ToLowerCamel(fp.String()) 5646 } 5647 5648 // Get returns all values pointed by specific field from source TsCndSpec_ThresholdAlertingCfg_AlertingThresholds 5649 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) Get(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (values []interface{}) { 5650 if source != nil { 5651 switch fp.selector { 5652 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 5653 values = append(values, source.AutoAdaptUpper) 5654 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 5655 values = append(values, source.AutoAdaptLower) 5656 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5657 if source.MaxUpper != nil { 5658 values = append(values, source.MaxUpper) 5659 } 5660 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5661 if source.MaxLower != nil { 5662 values = append(values, source.MaxLower) 5663 } 5664 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5665 if source.MinUpper != nil { 5666 values = append(values, source.MinUpper) 5667 } 5668 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5669 if source.MinLower != nil { 5670 values = append(values, source.MinLower) 5671 } 5672 default: 5673 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fp.selector)) 5674 } 5675 } 5676 return 5677 } 5678 5679 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 5680 return fp.Get(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 5681 } 5682 5683 // GetSingle returns value pointed by specific field of from source TsCndSpec_ThresholdAlertingCfg_AlertingThresholds 5684 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) GetSingle(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (interface{}, bool) { 5685 switch fp.selector { 5686 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 5687 return source.GetAutoAdaptUpper(), source != nil 5688 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 5689 return source.GetAutoAdaptLower(), source != nil 5690 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5691 res := source.GetMaxUpper() 5692 return res, res != nil 5693 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5694 res := source.GetMaxLower() 5695 return res, res != nil 5696 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5697 res := source.GetMinUpper() 5698 return res, res != nil 5699 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5700 res := source.GetMinLower() 5701 return res, res != nil 5702 default: 5703 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fp.selector)) 5704 } 5705 } 5706 5707 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5708 return fp.GetSingle(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 5709 } 5710 5711 // GetDefault returns a default value of the field type 5712 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) GetDefault() interface{} { 5713 switch fp.selector { 5714 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 5715 return false 5716 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 5717 return false 5718 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5719 return (*AlertingThreshold)(nil) 5720 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5721 return (*AlertingThreshold)(nil) 5722 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5723 return (*AlertingThreshold)(nil) 5724 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5725 return (*AlertingThreshold)(nil) 5726 default: 5727 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fp.selector)) 5728 } 5729 } 5730 5731 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) ClearValue(item *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) { 5732 if item != nil { 5733 switch fp.selector { 5734 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 5735 item.AutoAdaptUpper = false 5736 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 5737 item.AutoAdaptLower = false 5738 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5739 item.MaxUpper = nil 5740 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5741 item.MaxLower = nil 5742 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5743 item.MinUpper = nil 5744 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5745 item.MinLower = nil 5746 default: 5747 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fp.selector)) 5748 } 5749 } 5750 } 5751 5752 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) ClearValueRaw(item proto.Message) { 5753 fp.ClearValue(item.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 5754 } 5755 5756 // IsLeaf - whether field path is holds simple value 5757 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) IsLeaf() bool { 5758 return fp.selector == TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper || 5759 fp.selector == TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower 5760 } 5761 5762 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5763 return []gotenobject.FieldPath{fp} 5764 } 5765 5766 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) WithIValue(value interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue { 5767 switch fp.selector { 5768 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 5769 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, value: value.(bool)} 5770 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 5771 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, value: value.(bool)} 5772 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5773 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, value: value.(*AlertingThreshold)} 5774 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5775 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, value: value.(*AlertingThreshold)} 5776 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5777 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, value: value.(*AlertingThreshold)} 5778 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5779 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, value: value.(*AlertingThreshold)} 5780 default: 5781 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fp.selector)) 5782 } 5783 } 5784 5785 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5786 return fp.WithIValue(value) 5787 } 5788 5789 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) WithIArrayOfValues(values interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues { 5790 fpaov := &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp} 5791 switch fp.selector { 5792 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 5793 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, values: values.([]bool)} 5794 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 5795 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, values: values.([]bool)} 5796 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5797 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, values: values.([]*AlertingThreshold)} 5798 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5799 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, values: values.([]*AlertingThreshold)} 5800 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5801 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, values: values.([]*AlertingThreshold)} 5802 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5803 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues{TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: *fp, values: values.([]*AlertingThreshold)} 5804 default: 5805 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fp.selector)) 5806 } 5807 return fpaov 5808 } 5809 5810 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5811 return fp.WithIArrayOfValues(values) 5812 } 5813 5814 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) WithIArrayItemValue(value interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue { 5815 switch fp.selector { 5816 default: 5817 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fp.selector)) 5818 } 5819 } 5820 5821 func (fp *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5822 return fp.WithIArrayItemValue(value) 5823 } 5824 5825 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath struct { 5826 selector TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector 5827 subPath gotenobject.FieldPath 5828 } 5829 5830 var _ TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath = (*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath)(nil) 5831 5832 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) Selector() TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector { 5833 return fps.selector 5834 } 5835 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) AsMaxUpperSubPath() (AlertingThreshold_FieldPath, bool) { 5836 res, ok := fps.subPath.(AlertingThreshold_FieldPath) 5837 return res, ok 5838 } 5839 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) AsMaxLowerSubPath() (AlertingThreshold_FieldPath, bool) { 5840 res, ok := fps.subPath.(AlertingThreshold_FieldPath) 5841 return res, ok 5842 } 5843 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) AsMinUpperSubPath() (AlertingThreshold_FieldPath, bool) { 5844 res, ok := fps.subPath.(AlertingThreshold_FieldPath) 5845 return res, ok 5846 } 5847 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) AsMinLowerSubPath() (AlertingThreshold_FieldPath, bool) { 5848 res, ok := fps.subPath.(AlertingThreshold_FieldPath) 5849 return res, ok 5850 } 5851 5852 // String returns path representation in proto convention 5853 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) String() string { 5854 return fps.selector.String() + "." + fps.subPath.String() 5855 } 5856 5857 // JSONString returns path representation is JSON convention 5858 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) JSONString() string { 5859 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 5860 } 5861 5862 // Get returns all values pointed by selected field from source TsCndSpec_ThresholdAlertingCfg_AlertingThresholds 5863 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) Get(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (values []interface{}) { 5864 switch fps.selector { 5865 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5866 values = append(values, fps.subPath.GetRaw(source.GetMaxUpper())...) 5867 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5868 values = append(values, fps.subPath.GetRaw(source.GetMaxLower())...) 5869 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5870 values = append(values, fps.subPath.GetRaw(source.GetMinUpper())...) 5871 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5872 values = append(values, fps.subPath.GetRaw(source.GetMinLower())...) 5873 default: 5874 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fps.selector)) 5875 } 5876 return 5877 } 5878 5879 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) GetRaw(source proto.Message) []interface{} { 5880 return fps.Get(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 5881 } 5882 5883 // GetSingle returns value of selected field from source TsCndSpec_ThresholdAlertingCfg_AlertingThresholds 5884 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) GetSingle(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (interface{}, bool) { 5885 switch fps.selector { 5886 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5887 if source.GetMaxUpper() == nil { 5888 return nil, false 5889 } 5890 return fps.subPath.GetSingleRaw(source.GetMaxUpper()) 5891 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5892 if source.GetMaxLower() == nil { 5893 return nil, false 5894 } 5895 return fps.subPath.GetSingleRaw(source.GetMaxLower()) 5896 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5897 if source.GetMinUpper() == nil { 5898 return nil, false 5899 } 5900 return fps.subPath.GetSingleRaw(source.GetMinUpper()) 5901 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5902 if source.GetMinLower() == nil { 5903 return nil, false 5904 } 5905 return fps.subPath.GetSingleRaw(source.GetMinLower()) 5906 default: 5907 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fps.selector)) 5908 } 5909 } 5910 5911 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5912 return fps.GetSingle(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 5913 } 5914 5915 // GetDefault returns a default value of the field type 5916 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) GetDefault() interface{} { 5917 return fps.subPath.GetDefault() 5918 } 5919 5920 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) ClearValue(item *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) { 5921 if item != nil { 5922 switch fps.selector { 5923 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 5924 fps.subPath.ClearValueRaw(item.MaxUpper) 5925 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 5926 fps.subPath.ClearValueRaw(item.MaxLower) 5927 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 5928 fps.subPath.ClearValueRaw(item.MinUpper) 5929 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 5930 fps.subPath.ClearValueRaw(item.MinLower) 5931 default: 5932 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fps.selector)) 5933 } 5934 } 5935 } 5936 5937 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) ClearValueRaw(item proto.Message) { 5938 fps.ClearValue(item.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 5939 } 5940 5941 // IsLeaf - whether field path is holds simple value 5942 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) IsLeaf() bool { 5943 return fps.subPath.IsLeaf() 5944 } 5945 5946 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5947 iPaths := []gotenobject.FieldPath{&TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: fps.selector}} 5948 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 5949 return iPaths 5950 } 5951 5952 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) WithIValue(value interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue { 5953 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 5954 } 5955 5956 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5957 return fps.WithIValue(value) 5958 } 5959 5960 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) WithIArrayOfValues(values interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues { 5961 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 5962 } 5963 5964 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5965 return fps.WithIArrayOfValues(values) 5966 } 5967 5968 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) WithIArrayItemValue(value interface{}) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue { 5969 return &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 5970 } 5971 5972 func (fps *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5973 return fps.WithIArrayItemValue(value) 5974 } 5975 5976 // TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue allows storing values for AlertingThresholds fields according to their type 5977 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue interface { 5978 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath 5979 gotenobject.FieldPathValue 5980 SetTo(target **TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 5981 CompareWith(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (cmp int, comparable bool) 5982 } 5983 5984 func ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue(pathStr, valueStr string) (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue, error) { 5985 fp, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(pathStr) 5986 if err != nil { 5987 return nil, err 5988 } 5989 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 5990 if err != nil { 5991 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingThresholds field path value from %s: %v", valueStr, err) 5992 } 5993 return fpv.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue), nil 5994 } 5995 5996 func MustParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue(pathStr, valueStr string) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue { 5997 fpv, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue(pathStr, valueStr) 5998 if err != nil { 5999 panic(err) 6000 } 6001 return fpv 6002 } 6003 6004 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue struct { 6005 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath 6006 value interface{} 6007 } 6008 6009 var _ TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue = (*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue)(nil) 6010 6011 // GetRawValue returns raw value stored under selected path for 'AlertingThresholds' as interface{} 6012 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) GetRawValue() interface{} { 6013 return fpv.value 6014 } 6015 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) AsAutoAdaptUpperValue() (bool, bool) { 6016 res, ok := fpv.value.(bool) 6017 return res, ok 6018 } 6019 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) AsAutoAdaptLowerValue() (bool, bool) { 6020 res, ok := fpv.value.(bool) 6021 return res, ok 6022 } 6023 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) AsMaxUpperValue() (*AlertingThreshold, bool) { 6024 res, ok := fpv.value.(*AlertingThreshold) 6025 return res, ok 6026 } 6027 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) AsMaxLowerValue() (*AlertingThreshold, bool) { 6028 res, ok := fpv.value.(*AlertingThreshold) 6029 return res, ok 6030 } 6031 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) AsMinUpperValue() (*AlertingThreshold, bool) { 6032 res, ok := fpv.value.(*AlertingThreshold) 6033 return res, ok 6034 } 6035 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) AsMinLowerValue() (*AlertingThreshold, bool) { 6036 res, ok := fpv.value.(*AlertingThreshold) 6037 return res, ok 6038 } 6039 6040 // SetTo stores value for selected field for object AlertingThresholds 6041 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) SetTo(target **TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) { 6042 if *target == nil { 6043 *target = new(TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 6044 } 6045 switch fpv.selector { 6046 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 6047 (*target).AutoAdaptUpper = fpv.value.(bool) 6048 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 6049 (*target).AutoAdaptLower = fpv.value.(bool) 6050 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 6051 (*target).MaxUpper = fpv.value.(*AlertingThreshold) 6052 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 6053 (*target).MaxLower = fpv.value.(*AlertingThreshold) 6054 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 6055 (*target).MinUpper = fpv.value.(*AlertingThreshold) 6056 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 6057 (*target).MinLower = fpv.value.(*AlertingThreshold) 6058 default: 6059 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fpv.selector)) 6060 } 6061 } 6062 6063 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) SetToRaw(target proto.Message) { 6064 typedObject := target.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 6065 fpv.SetTo(&typedObject) 6066 } 6067 6068 // CompareWith compares value in the 'TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue' with the value under path in 'TsCndSpec_ThresholdAlertingCfg_AlertingThresholds'. 6069 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) CompareWith(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (int, bool) { 6070 switch fpv.selector { 6071 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 6072 leftValue := fpv.value.(bool) 6073 rightValue := source.GetAutoAdaptUpper() 6074 if (leftValue) == (rightValue) { 6075 return 0, true 6076 } else if !(leftValue) && (rightValue) { 6077 return -1, true 6078 } else { 6079 return 1, true 6080 } 6081 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 6082 leftValue := fpv.value.(bool) 6083 rightValue := source.GetAutoAdaptLower() 6084 if (leftValue) == (rightValue) { 6085 return 0, true 6086 } else if !(leftValue) && (rightValue) { 6087 return -1, true 6088 } else { 6089 return 1, true 6090 } 6091 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 6092 return 0, false 6093 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 6094 return 0, false 6095 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 6096 return 0, false 6097 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 6098 return 0, false 6099 default: 6100 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fpv.selector)) 6101 } 6102 } 6103 6104 func (fpv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6105 return fpv.CompareWith(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 6106 } 6107 6108 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue struct { 6109 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath 6110 subPathValue gotenobject.FieldPathValue 6111 } 6112 6113 var _ TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathValue = (*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue)(nil) 6114 6115 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) AsMaxUpperPathValue() (AlertingThreshold_FieldPathValue, bool) { 6116 res, ok := fpvs.subPathValue.(AlertingThreshold_FieldPathValue) 6117 return res, ok 6118 } 6119 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) AsMaxLowerPathValue() (AlertingThreshold_FieldPathValue, bool) { 6120 res, ok := fpvs.subPathValue.(AlertingThreshold_FieldPathValue) 6121 return res, ok 6122 } 6123 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) AsMinUpperPathValue() (AlertingThreshold_FieldPathValue, bool) { 6124 res, ok := fpvs.subPathValue.(AlertingThreshold_FieldPathValue) 6125 return res, ok 6126 } 6127 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) AsMinLowerPathValue() (AlertingThreshold_FieldPathValue, bool) { 6128 res, ok := fpvs.subPathValue.(AlertingThreshold_FieldPathValue) 6129 return res, ok 6130 } 6131 6132 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) SetTo(target **TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) { 6133 if *target == nil { 6134 *target = new(TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 6135 } 6136 switch fpvs.Selector() { 6137 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 6138 fpvs.subPathValue.(AlertingThreshold_FieldPathValue).SetTo(&(*target).MaxUpper) 6139 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 6140 fpvs.subPathValue.(AlertingThreshold_FieldPathValue).SetTo(&(*target).MaxLower) 6141 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 6142 fpvs.subPathValue.(AlertingThreshold_FieldPathValue).SetTo(&(*target).MinUpper) 6143 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 6144 fpvs.subPathValue.(AlertingThreshold_FieldPathValue).SetTo(&(*target).MinLower) 6145 default: 6146 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fpvs.Selector())) 6147 } 6148 } 6149 6150 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) SetToRaw(target proto.Message) { 6151 typedObject := target.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) 6152 fpvs.SetTo(&typedObject) 6153 } 6154 6155 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) GetRawValue() interface{} { 6156 return fpvs.subPathValue.GetRawValue() 6157 } 6158 6159 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) CompareWith(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (int, bool) { 6160 switch fpvs.Selector() { 6161 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 6162 return fpvs.subPathValue.(AlertingThreshold_FieldPathValue).CompareWith(source.GetMaxUpper()) 6163 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 6164 return fpvs.subPathValue.(AlertingThreshold_FieldPathValue).CompareWith(source.GetMaxLower()) 6165 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 6166 return fpvs.subPathValue.(AlertingThreshold_FieldPathValue).CompareWith(source.GetMinUpper()) 6167 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 6168 return fpvs.subPathValue.(AlertingThreshold_FieldPathValue).CompareWith(source.GetMinLower()) 6169 default: 6170 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fpvs.Selector())) 6171 } 6172 } 6173 6174 func (fpvs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6175 return fpvs.CompareWith(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 6176 } 6177 6178 // TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue allows storing single item in Path-specific values for AlertingThresholds according to their type 6179 // Present only for array (repeated) types. 6180 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue interface { 6181 gotenobject.FieldPathArrayItemValue 6182 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath 6183 ContainsValue(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) bool 6184 } 6185 6186 // ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 6187 func ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue(pathStr, valueStr string) (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue, error) { 6188 fp, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(pathStr) 6189 if err != nil { 6190 return nil, err 6191 } 6192 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 6193 if err != nil { 6194 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingThresholds field path array item value from %s: %v", valueStr, err) 6195 } 6196 return fpaiv.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue), nil 6197 } 6198 6199 func MustParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue(pathStr, valueStr string) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue { 6200 fpaiv, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue(pathStr, valueStr) 6201 if err != nil { 6202 panic(err) 6203 } 6204 return fpaiv 6205 } 6206 6207 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayItemValue struct { 6208 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath 6209 value interface{} 6210 } 6211 6212 var _ TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayItemValue = (*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayItemValue)(nil) 6213 6214 // GetRawValue returns stored element value for array in object TsCndSpec_ThresholdAlertingCfg_AlertingThresholds as interface{} 6215 func (fpaiv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 6216 return fpaiv.value 6217 } 6218 6219 func (fpaiv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayItemValue) GetSingle(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) (interface{}, bool) { 6220 return nil, false 6221 } 6222 6223 func (fpaiv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 6224 return fpaiv.GetSingle(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 6225 } 6226 6227 // Contains returns a boolean indicating if value that is being held is present in given 'AlertingThresholds' 6228 func (fpaiv *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayItemValue) ContainsValue(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) bool { 6229 slice := fpaiv.TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath.Get(source) 6230 for _, v := range slice { 6231 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 6232 if proto.Equal(asProtoMsg, v.(proto.Message)) { 6233 return true 6234 } 6235 } else if reflect.DeepEqual(v, fpaiv.value) { 6236 return true 6237 } 6238 } 6239 return false 6240 } 6241 6242 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue struct { 6243 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath 6244 subPathItemValue gotenobject.FieldPathArrayItemValue 6245 } 6246 6247 // GetRawValue returns stored array item value 6248 func (fpaivs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 6249 return fpaivs.subPathItemValue.GetRawItemValue() 6250 } 6251 func (fpaivs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue) AsMaxUpperPathItemValue() (AlertingThreshold_FieldPathArrayItemValue, bool) { 6252 res, ok := fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue) 6253 return res, ok 6254 } 6255 func (fpaivs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue) AsMaxLowerPathItemValue() (AlertingThreshold_FieldPathArrayItemValue, bool) { 6256 res, ok := fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue) 6257 return res, ok 6258 } 6259 func (fpaivs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue) AsMinUpperPathItemValue() (AlertingThreshold_FieldPathArrayItemValue, bool) { 6260 res, ok := fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue) 6261 return res, ok 6262 } 6263 func (fpaivs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue) AsMinLowerPathItemValue() (AlertingThreshold_FieldPathArrayItemValue, bool) { 6264 res, ok := fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue) 6265 return res, ok 6266 } 6267 6268 // Contains returns a boolean indicating if value that is being held is present in given 'AlertingThresholds' 6269 func (fpaivs *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayItemValue) ContainsValue(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) bool { 6270 switch fpaivs.Selector() { 6271 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 6272 return fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue).ContainsValue(source.GetMaxUpper()) 6273 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 6274 return fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue).ContainsValue(source.GetMaxLower()) 6275 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 6276 return fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue).ContainsValue(source.GetMinUpper()) 6277 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 6278 return fpaivs.subPathItemValue.(AlertingThreshold_FieldPathArrayItemValue).ContainsValue(source.GetMinLower()) 6279 default: 6280 panic(fmt.Sprintf("Invalid selector for TsCndSpec_ThresholdAlertingCfg_AlertingThresholds: %d", fpaivs.Selector())) 6281 } 6282 } 6283 6284 // TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues allows storing slice of values for AlertingThresholds fields according to their type 6285 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues interface { 6286 gotenobject.FieldPathArrayOfValues 6287 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath 6288 } 6289 6290 func ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues(pathStr, valuesStr string) (TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues, error) { 6291 fp, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(pathStr) 6292 if err != nil { 6293 return nil, err 6294 } 6295 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 6296 if err != nil { 6297 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingThresholds field path array of values from %s: %v", valuesStr, err) 6298 } 6299 return fpaov.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues), nil 6300 } 6301 6302 func MustParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues(pathStr, valuesStr string) TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues { 6303 fpaov, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues(pathStr, valuesStr) 6304 if err != nil { 6305 panic(err) 6306 } 6307 return fpaov 6308 } 6309 6310 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues struct { 6311 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath 6312 values interface{} 6313 } 6314 6315 var _ TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues = (*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues)(nil) 6316 6317 func (fpaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 6318 switch fpaov.selector { 6319 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 6320 for _, v := range fpaov.values.([]bool) { 6321 values = append(values, v) 6322 } 6323 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 6324 for _, v := range fpaov.values.([]bool) { 6325 values = append(values, v) 6326 } 6327 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 6328 for _, v := range fpaov.values.([]*AlertingThreshold) { 6329 values = append(values, v) 6330 } 6331 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 6332 for _, v := range fpaov.values.([]*AlertingThreshold) { 6333 values = append(values, v) 6334 } 6335 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 6336 for _, v := range fpaov.values.([]*AlertingThreshold) { 6337 values = append(values, v) 6338 } 6339 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 6340 for _, v := range fpaov.values.([]*AlertingThreshold) { 6341 values = append(values, v) 6342 } 6343 } 6344 return 6345 } 6346 func (fpaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues) AsAutoAdaptUpperArrayOfValues() ([]bool, bool) { 6347 res, ok := fpaov.values.([]bool) 6348 return res, ok 6349 } 6350 func (fpaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues) AsAutoAdaptLowerArrayOfValues() ([]bool, bool) { 6351 res, ok := fpaov.values.([]bool) 6352 return res, ok 6353 } 6354 func (fpaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues) AsMaxUpperArrayOfValues() ([]*AlertingThreshold, bool) { 6355 res, ok := fpaov.values.([]*AlertingThreshold) 6356 return res, ok 6357 } 6358 func (fpaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues) AsMaxLowerArrayOfValues() ([]*AlertingThreshold, bool) { 6359 res, ok := fpaov.values.([]*AlertingThreshold) 6360 return res, ok 6361 } 6362 func (fpaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues) AsMinUpperArrayOfValues() ([]*AlertingThreshold, bool) { 6363 res, ok := fpaov.values.([]*AlertingThreshold) 6364 return res, ok 6365 } 6366 func (fpaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPathArrayOfValues) AsMinLowerArrayOfValues() ([]*AlertingThreshold, bool) { 6367 res, ok := fpaov.values.([]*AlertingThreshold) 6368 return res, ok 6369 } 6370 6371 type TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues struct { 6372 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath 6373 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 6374 } 6375 6376 var _ TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathArrayOfValues = (*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues)(nil) 6377 6378 func (fpsaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 6379 return fpsaov.subPathArrayOfValues.GetRawValues() 6380 } 6381 func (fpsaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues) AsMaxUpperPathArrayOfValues() (AlertingThreshold_FieldPathArrayOfValues, bool) { 6382 res, ok := fpsaov.subPathArrayOfValues.(AlertingThreshold_FieldPathArrayOfValues) 6383 return res, ok 6384 } 6385 func (fpsaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues) AsMaxLowerPathArrayOfValues() (AlertingThreshold_FieldPathArrayOfValues, bool) { 6386 res, ok := fpsaov.subPathArrayOfValues.(AlertingThreshold_FieldPathArrayOfValues) 6387 return res, ok 6388 } 6389 func (fpsaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues) AsMinUpperPathArrayOfValues() (AlertingThreshold_FieldPathArrayOfValues, bool) { 6390 res, ok := fpsaov.subPathArrayOfValues.(AlertingThreshold_FieldPathArrayOfValues) 6391 return res, ok 6392 } 6393 func (fpsaov *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPathArrayOfValues) AsMinLowerPathArrayOfValues() (AlertingThreshold_FieldPathArrayOfValues, bool) { 6394 res, ok := fpsaov.subPathArrayOfValues.(AlertingThreshold_FieldPathArrayOfValues) 6395 return res, ok 6396 } 6397 6398 // FieldPath provides implementation to handle 6399 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 6400 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath interface { 6401 gotenobject.FieldPath 6402 Selector() TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector 6403 Get(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) []interface{} 6404 GetSingle(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) (interface{}, bool) 6405 ClearValue(item *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) 6406 6407 // Those methods build corresponding TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue 6408 // (or array of values) and holds passed value. Panics if injected type is incorrect. 6409 WithIValue(value interface{}) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue 6410 WithIArrayOfValues(values interface{}) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues 6411 WithIArrayItemValue(value interface{}) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue 6412 } 6413 6414 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector int32 6415 6416 const ( 6417 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 0 6418 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 1 6419 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 2 6420 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 3 6421 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 4 6422 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 5 6423 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 6 6424 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector = 7 6425 ) 6426 6427 func (s TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector) String() string { 6428 switch s { 6429 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6430 return "hidden_size" 6431 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6432 return "learn_rate" 6433 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6434 return "max_training_epochs" 6435 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6436 return "min_training_epochs" 6437 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6438 return "acceptable_training_error" 6439 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6440 return "training_period" 6441 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6442 return "check_period_fraction" 6443 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6444 return "teacher_force_at_inference" 6445 default: 6446 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", s)) 6447 } 6448 } 6449 6450 func BuildTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(fp gotenobject.RawFieldPath) (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath, error) { 6451 if len(fp) == 0 { 6452 return nil, status.Error(codes.InvalidArgument, "empty field path for object TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder") 6453 } 6454 if len(fp) == 1 { 6455 switch fp[0] { 6456 case "hidden_size", "hiddenSize", "hidden-size": 6457 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize}, nil 6458 case "learn_rate", "learnRate", "learn-rate": 6459 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate}, nil 6460 case "max_training_epochs", "maxTrainingEpochs", "max-training-epochs": 6461 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs}, nil 6462 case "min_training_epochs", "minTrainingEpochs", "min-training-epochs": 6463 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs}, nil 6464 case "acceptable_training_error", "acceptableTrainingError", "acceptable-training-error": 6465 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError}, nil 6466 case "training_period", "trainingPeriod", "training-period": 6467 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod}, nil 6468 case "check_period_fraction", "checkPeriodFraction", "check-period-fraction": 6469 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction}, nil 6470 case "teacher_force_at_inference", "teacherForceAtInference", "teacher-force-at-inference": 6471 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference}, nil 6472 } 6473 } 6474 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder", fp) 6475 } 6476 6477 func ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(rawField string) (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath, error) { 6478 fp, err := gotenobject.ParseRawFieldPath(rawField) 6479 if err != nil { 6480 return nil, err 6481 } 6482 return BuildTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(fp) 6483 } 6484 6485 func MustParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(rawField string) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath { 6486 fp, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(rawField) 6487 if err != nil { 6488 panic(err) 6489 } 6490 return fp 6491 } 6492 6493 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath struct { 6494 selector TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector 6495 } 6496 6497 var _ TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath = (*TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath)(nil) 6498 6499 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) Selector() TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelector { 6500 return fp.selector 6501 } 6502 6503 // String returns path representation in proto convention 6504 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) String() string { 6505 return fp.selector.String() 6506 } 6507 6508 // JSONString returns path representation is JSON convention 6509 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) JSONString() string { 6510 return strcase.ToLowerCamel(fp.String()) 6511 } 6512 6513 // Get returns all values pointed by specific field from source TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder 6514 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) Get(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) (values []interface{}) { 6515 if source != nil { 6516 switch fp.selector { 6517 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6518 values = append(values, source.HiddenSize) 6519 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6520 values = append(values, source.LearnRate) 6521 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6522 values = append(values, source.MaxTrainingEpochs) 6523 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6524 values = append(values, source.MinTrainingEpochs) 6525 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6526 values = append(values, source.AcceptableTrainingError) 6527 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6528 if source.TrainingPeriod != nil { 6529 values = append(values, source.TrainingPeriod) 6530 } 6531 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6532 values = append(values, source.CheckPeriodFraction) 6533 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6534 values = append(values, source.TeacherForceAtInference) 6535 default: 6536 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fp.selector)) 6537 } 6538 } 6539 return 6540 } 6541 6542 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 6543 return fp.Get(source.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)) 6544 } 6545 6546 // GetSingle returns value pointed by specific field of from source TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder 6547 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) GetSingle(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) (interface{}, bool) { 6548 switch fp.selector { 6549 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6550 return source.GetHiddenSize(), source != nil 6551 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6552 return source.GetLearnRate(), source != nil 6553 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6554 return source.GetMaxTrainingEpochs(), source != nil 6555 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6556 return source.GetMinTrainingEpochs(), source != nil 6557 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6558 return source.GetAcceptableTrainingError(), source != nil 6559 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6560 res := source.GetTrainingPeriod() 6561 return res, res != nil 6562 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6563 return source.GetCheckPeriodFraction(), source != nil 6564 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6565 return source.GetTeacherForceAtInference(), source != nil 6566 default: 6567 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fp.selector)) 6568 } 6569 } 6570 6571 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 6572 return fp.GetSingle(source.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)) 6573 } 6574 6575 // GetDefault returns a default value of the field type 6576 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) GetDefault() interface{} { 6577 switch fp.selector { 6578 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6579 return int32(0) 6580 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6581 return float64(0) 6582 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6583 return int32(0) 6584 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6585 return int32(0) 6586 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6587 return float64(0) 6588 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6589 return (*durationpb.Duration)(nil) 6590 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6591 return float64(0) 6592 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6593 return false 6594 default: 6595 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fp.selector)) 6596 } 6597 } 6598 6599 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) ClearValue(item *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) { 6600 if item != nil { 6601 switch fp.selector { 6602 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6603 item.HiddenSize = int32(0) 6604 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6605 item.LearnRate = float64(0) 6606 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6607 item.MaxTrainingEpochs = int32(0) 6608 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6609 item.MinTrainingEpochs = int32(0) 6610 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6611 item.AcceptableTrainingError = float64(0) 6612 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6613 item.TrainingPeriod = nil 6614 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6615 item.CheckPeriodFraction = float64(0) 6616 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6617 item.TeacherForceAtInference = false 6618 default: 6619 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fp.selector)) 6620 } 6621 } 6622 } 6623 6624 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) ClearValueRaw(item proto.Message) { 6625 fp.ClearValue(item.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)) 6626 } 6627 6628 // IsLeaf - whether field path is holds simple value 6629 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) IsLeaf() bool { 6630 return fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize || 6631 fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate || 6632 fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs || 6633 fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs || 6634 fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError || 6635 fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod || 6636 fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction || 6637 fp.selector == TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference 6638 } 6639 6640 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 6641 return []gotenobject.FieldPath{fp} 6642 } 6643 6644 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) WithIValue(value interface{}) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue { 6645 switch fp.selector { 6646 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6647 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(int32)} 6648 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6649 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(float64)} 6650 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6651 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(int32)} 6652 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6653 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(int32)} 6654 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6655 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(float64)} 6656 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6657 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(*durationpb.Duration)} 6658 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6659 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(float64)} 6660 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6661 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, value: value.(bool)} 6662 default: 6663 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fp.selector)) 6664 } 6665 } 6666 6667 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 6668 return fp.WithIValue(value) 6669 } 6670 6671 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) WithIArrayOfValues(values interface{}) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues { 6672 fpaov := &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp} 6673 switch fp.selector { 6674 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6675 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]int32)} 6676 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6677 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]float64)} 6678 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6679 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]int32)} 6680 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6681 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]int32)} 6682 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6683 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]float64)} 6684 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6685 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]*durationpb.Duration)} 6686 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6687 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]float64)} 6688 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6689 return &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues{TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: *fp, values: values.([]bool)} 6690 default: 6691 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fp.selector)) 6692 } 6693 return fpaov 6694 } 6695 6696 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 6697 return fp.WithIArrayOfValues(values) 6698 } 6699 6700 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) WithIArrayItemValue(value interface{}) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue { 6701 switch fp.selector { 6702 default: 6703 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fp.selector)) 6704 } 6705 } 6706 6707 func (fp *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 6708 return fp.WithIArrayItemValue(value) 6709 } 6710 6711 // TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue allows storing values for LstmAutoEncoder fields according to their type 6712 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue interface { 6713 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath 6714 gotenobject.FieldPathValue 6715 SetTo(target **TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) 6716 CompareWith(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) (cmp int, comparable bool) 6717 } 6718 6719 func ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue(pathStr, valueStr string) (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue, error) { 6720 fp, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(pathStr) 6721 if err != nil { 6722 return nil, err 6723 } 6724 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 6725 if err != nil { 6726 return nil, status.Errorf(codes.InvalidArgument, "error parsing LstmAutoEncoder field path value from %s: %v", valueStr, err) 6727 } 6728 return fpv.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue), nil 6729 } 6730 6731 func MustParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue(pathStr, valueStr string) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue { 6732 fpv, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue(pathStr, valueStr) 6733 if err != nil { 6734 panic(err) 6735 } 6736 return fpv 6737 } 6738 6739 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue struct { 6740 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath 6741 value interface{} 6742 } 6743 6744 var _ TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathValue = (*TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue)(nil) 6745 6746 // GetRawValue returns raw value stored under selected path for 'LstmAutoEncoder' as interface{} 6747 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) GetRawValue() interface{} { 6748 return fpv.value 6749 } 6750 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsHiddenSizeValue() (int32, bool) { 6751 res, ok := fpv.value.(int32) 6752 return res, ok 6753 } 6754 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsLearnRateValue() (float64, bool) { 6755 res, ok := fpv.value.(float64) 6756 return res, ok 6757 } 6758 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsMaxTrainingEpochsValue() (int32, bool) { 6759 res, ok := fpv.value.(int32) 6760 return res, ok 6761 } 6762 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsMinTrainingEpochsValue() (int32, bool) { 6763 res, ok := fpv.value.(int32) 6764 return res, ok 6765 } 6766 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsAcceptableTrainingErrorValue() (float64, bool) { 6767 res, ok := fpv.value.(float64) 6768 return res, ok 6769 } 6770 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsTrainingPeriodValue() (*durationpb.Duration, bool) { 6771 res, ok := fpv.value.(*durationpb.Duration) 6772 return res, ok 6773 } 6774 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsCheckPeriodFractionValue() (float64, bool) { 6775 res, ok := fpv.value.(float64) 6776 return res, ok 6777 } 6778 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) AsTeacherForceAtInferenceValue() (bool, bool) { 6779 res, ok := fpv.value.(bool) 6780 return res, ok 6781 } 6782 6783 // SetTo stores value for selected field for object LstmAutoEncoder 6784 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) SetTo(target **TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) { 6785 if *target == nil { 6786 *target = new(TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) 6787 } 6788 switch fpv.selector { 6789 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6790 (*target).HiddenSize = fpv.value.(int32) 6791 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6792 (*target).LearnRate = fpv.value.(float64) 6793 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6794 (*target).MaxTrainingEpochs = fpv.value.(int32) 6795 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6796 (*target).MinTrainingEpochs = fpv.value.(int32) 6797 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6798 (*target).AcceptableTrainingError = fpv.value.(float64) 6799 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6800 (*target).TrainingPeriod = fpv.value.(*durationpb.Duration) 6801 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6802 (*target).CheckPeriodFraction = fpv.value.(float64) 6803 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6804 (*target).TeacherForceAtInference = fpv.value.(bool) 6805 default: 6806 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fpv.selector)) 6807 } 6808 } 6809 6810 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) SetToRaw(target proto.Message) { 6811 typedObject := target.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) 6812 fpv.SetTo(&typedObject) 6813 } 6814 6815 // CompareWith compares value in the 'TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue' with the value under path in 'TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder'. 6816 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) CompareWith(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) (int, bool) { 6817 switch fpv.selector { 6818 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 6819 leftValue := fpv.value.(int32) 6820 rightValue := source.GetHiddenSize() 6821 if (leftValue) == (rightValue) { 6822 return 0, true 6823 } else if (leftValue) < (rightValue) { 6824 return -1, true 6825 } else { 6826 return 1, true 6827 } 6828 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 6829 leftValue := fpv.value.(float64) 6830 rightValue := source.GetLearnRate() 6831 if (leftValue) == (rightValue) { 6832 return 0, true 6833 } else if (leftValue) < (rightValue) { 6834 return -1, true 6835 } else { 6836 return 1, true 6837 } 6838 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 6839 leftValue := fpv.value.(int32) 6840 rightValue := source.GetMaxTrainingEpochs() 6841 if (leftValue) == (rightValue) { 6842 return 0, true 6843 } else if (leftValue) < (rightValue) { 6844 return -1, true 6845 } else { 6846 return 1, true 6847 } 6848 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 6849 leftValue := fpv.value.(int32) 6850 rightValue := source.GetMinTrainingEpochs() 6851 if (leftValue) == (rightValue) { 6852 return 0, true 6853 } else if (leftValue) < (rightValue) { 6854 return -1, true 6855 } else { 6856 return 1, true 6857 } 6858 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 6859 leftValue := fpv.value.(float64) 6860 rightValue := source.GetAcceptableTrainingError() 6861 if (leftValue) == (rightValue) { 6862 return 0, true 6863 } else if (leftValue) < (rightValue) { 6864 return -1, true 6865 } else { 6866 return 1, true 6867 } 6868 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 6869 leftValue := fpv.value.(*durationpb.Duration) 6870 rightValue := source.GetTrainingPeriod() 6871 if leftValue == nil { 6872 if rightValue != nil { 6873 return -1, true 6874 } 6875 return 0, true 6876 } 6877 if rightValue == nil { 6878 return 1, true 6879 } 6880 if leftValue.AsDuration() == rightValue.AsDuration() { 6881 return 0, true 6882 } else if leftValue.AsDuration() < rightValue.AsDuration() { 6883 return -1, true 6884 } else { 6885 return 1, true 6886 } 6887 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 6888 leftValue := fpv.value.(float64) 6889 rightValue := source.GetCheckPeriodFraction() 6890 if (leftValue) == (rightValue) { 6891 return 0, true 6892 } else if (leftValue) < (rightValue) { 6893 return -1, true 6894 } else { 6895 return 1, true 6896 } 6897 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 6898 leftValue := fpv.value.(bool) 6899 rightValue := source.GetTeacherForceAtInference() 6900 if (leftValue) == (rightValue) { 6901 return 0, true 6902 } else if !(leftValue) && (rightValue) { 6903 return -1, true 6904 } else { 6905 return 1, true 6906 } 6907 default: 6908 panic(fmt.Sprintf("Invalid selector for TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder: %d", fpv.selector)) 6909 } 6910 } 6911 6912 func (fpv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6913 return fpv.CompareWith(source.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)) 6914 } 6915 6916 // TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue allows storing single item in Path-specific values for LstmAutoEncoder according to their type 6917 // Present only for array (repeated) types. 6918 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue interface { 6919 gotenobject.FieldPathArrayItemValue 6920 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath 6921 ContainsValue(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) bool 6922 } 6923 6924 // ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 6925 func ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue(pathStr, valueStr string) (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue, error) { 6926 fp, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(pathStr) 6927 if err != nil { 6928 return nil, err 6929 } 6930 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 6931 if err != nil { 6932 return nil, status.Errorf(codes.InvalidArgument, "error parsing LstmAutoEncoder field path array item value from %s: %v", valueStr, err) 6933 } 6934 return fpaiv.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue), nil 6935 } 6936 6937 func MustParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue(pathStr, valueStr string) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue { 6938 fpaiv, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue(pathStr, valueStr) 6939 if err != nil { 6940 panic(err) 6941 } 6942 return fpaiv 6943 } 6944 6945 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayItemValue struct { 6946 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath 6947 value interface{} 6948 } 6949 6950 var _ TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayItemValue = (*TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayItemValue)(nil) 6951 6952 // GetRawValue returns stored element value for array in object TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder as interface{} 6953 func (fpaiv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 6954 return fpaiv.value 6955 } 6956 6957 func (fpaiv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayItemValue) GetSingle(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) (interface{}, bool) { 6958 return nil, false 6959 } 6960 6961 func (fpaiv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 6962 return fpaiv.GetSingle(source.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)) 6963 } 6964 6965 // Contains returns a boolean indicating if value that is being held is present in given 'LstmAutoEncoder' 6966 func (fpaiv *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayItemValue) ContainsValue(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) bool { 6967 slice := fpaiv.TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath.Get(source) 6968 for _, v := range slice { 6969 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 6970 if proto.Equal(asProtoMsg, v.(proto.Message)) { 6971 return true 6972 } 6973 } else if reflect.DeepEqual(v, fpaiv.value) { 6974 return true 6975 } 6976 } 6977 return false 6978 } 6979 6980 // TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues allows storing slice of values for LstmAutoEncoder fields according to their type 6981 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues interface { 6982 gotenobject.FieldPathArrayOfValues 6983 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath 6984 } 6985 6986 func ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues(pathStr, valuesStr string) (TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues, error) { 6987 fp, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(pathStr) 6988 if err != nil { 6989 return nil, err 6990 } 6991 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 6992 if err != nil { 6993 return nil, status.Errorf(codes.InvalidArgument, "error parsing LstmAutoEncoder field path array of values from %s: %v", valuesStr, err) 6994 } 6995 return fpaov.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues), nil 6996 } 6997 6998 func MustParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues(pathStr, valuesStr string) TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues { 6999 fpaov, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues(pathStr, valuesStr) 7000 if err != nil { 7001 panic(err) 7002 } 7003 return fpaov 7004 } 7005 7006 type TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues struct { 7007 TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath 7008 values interface{} 7009 } 7010 7011 var _ TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathArrayOfValues = (*TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues)(nil) 7012 7013 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 7014 switch fpaov.selector { 7015 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 7016 for _, v := range fpaov.values.([]int32) { 7017 values = append(values, v) 7018 } 7019 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 7020 for _, v := range fpaov.values.([]float64) { 7021 values = append(values, v) 7022 } 7023 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 7024 for _, v := range fpaov.values.([]int32) { 7025 values = append(values, v) 7026 } 7027 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 7028 for _, v := range fpaov.values.([]int32) { 7029 values = append(values, v) 7030 } 7031 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 7032 for _, v := range fpaov.values.([]float64) { 7033 values = append(values, v) 7034 } 7035 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 7036 for _, v := range fpaov.values.([]*durationpb.Duration) { 7037 values = append(values, v) 7038 } 7039 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 7040 for _, v := range fpaov.values.([]float64) { 7041 values = append(values, v) 7042 } 7043 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 7044 for _, v := range fpaov.values.([]bool) { 7045 values = append(values, v) 7046 } 7047 } 7048 return 7049 } 7050 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsHiddenSizeArrayOfValues() ([]int32, bool) { 7051 res, ok := fpaov.values.([]int32) 7052 return res, ok 7053 } 7054 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsLearnRateArrayOfValues() ([]float64, bool) { 7055 res, ok := fpaov.values.([]float64) 7056 return res, ok 7057 } 7058 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsMaxTrainingEpochsArrayOfValues() ([]int32, bool) { 7059 res, ok := fpaov.values.([]int32) 7060 return res, ok 7061 } 7062 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsMinTrainingEpochsArrayOfValues() ([]int32, bool) { 7063 res, ok := fpaov.values.([]int32) 7064 return res, ok 7065 } 7066 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsAcceptableTrainingErrorArrayOfValues() ([]float64, bool) { 7067 res, ok := fpaov.values.([]float64) 7068 return res, ok 7069 } 7070 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsTrainingPeriodArrayOfValues() ([]*durationpb.Duration, bool) { 7071 res, ok := fpaov.values.([]*durationpb.Duration) 7072 return res, ok 7073 } 7074 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsCheckPeriodFractionArrayOfValues() ([]float64, bool) { 7075 res, ok := fpaov.values.([]float64) 7076 return res, ok 7077 } 7078 func (fpaov *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPathArrayOfValues) AsTeacherForceAtInferenceArrayOfValues() ([]bool, bool) { 7079 res, ok := fpaov.values.([]bool) 7080 return res, ok 7081 } 7082 7083 // FieldPath provides implementation to handle 7084 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 7085 type PolicySpec_FieldPath interface { 7086 gotenobject.FieldPath 7087 Selector() PolicySpec_FieldPathSelector 7088 Get(source *PolicySpec) []interface{} 7089 GetSingle(source *PolicySpec) (interface{}, bool) 7090 ClearValue(item *PolicySpec) 7091 7092 // Those methods build corresponding PolicySpec_FieldPathValue 7093 // (or array of values) and holds passed value. Panics if injected type is incorrect. 7094 WithIValue(value interface{}) PolicySpec_FieldPathValue 7095 WithIArrayOfValues(values interface{}) PolicySpec_FieldPathArrayOfValues 7096 WithIArrayItemValue(value interface{}) PolicySpec_FieldPathArrayItemValue 7097 } 7098 7099 type PolicySpec_FieldPathSelector int32 7100 7101 const ( 7102 PolicySpec_FieldPathSelectorEnabled PolicySpec_FieldPathSelector = 0 7103 PolicySpec_FieldPathSelectorProcessingLocation PolicySpec_FieldPathSelector = 1 7104 PolicySpec_FieldPathSelectorResourceIdentity PolicySpec_FieldPathSelector = 2 7105 PolicySpec_FieldPathSelectorSupportingQueries PolicySpec_FieldPathSelector = 3 7106 PolicySpec_FieldPathSelectorAiAgent PolicySpec_FieldPathSelector = 4 7107 ) 7108 7109 func (s PolicySpec_FieldPathSelector) String() string { 7110 switch s { 7111 case PolicySpec_FieldPathSelectorEnabled: 7112 return "enabled" 7113 case PolicySpec_FieldPathSelectorProcessingLocation: 7114 return "processing_location" 7115 case PolicySpec_FieldPathSelectorResourceIdentity: 7116 return "resource_identity" 7117 case PolicySpec_FieldPathSelectorSupportingQueries: 7118 return "supporting_queries" 7119 case PolicySpec_FieldPathSelectorAiAgent: 7120 return "ai_agent" 7121 default: 7122 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", s)) 7123 } 7124 } 7125 7126 func BuildPolicySpec_FieldPath(fp gotenobject.RawFieldPath) (PolicySpec_FieldPath, error) { 7127 if len(fp) == 0 { 7128 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec") 7129 } 7130 if len(fp) == 1 { 7131 switch fp[0] { 7132 case "enabled": 7133 return &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorEnabled}, nil 7134 case "processing_location", "processingLocation", "processing-location": 7135 return &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorProcessingLocation}, nil 7136 case "resource_identity", "resourceIdentity", "resource-identity": 7137 return &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorResourceIdentity}, nil 7138 case "supporting_queries", "supportingQueries", "supporting-queries": 7139 return &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorSupportingQueries}, nil 7140 case "ai_agent", "aiAgent", "ai-agent": 7141 return &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorAiAgent}, nil 7142 } 7143 } else { 7144 switch fp[0] { 7145 case "resource_identity", "resourceIdentity", "resource-identity": 7146 if subpath, err := BuildPolicySpecResourceIdentity_FieldPath(fp[1:]); err != nil { 7147 return nil, err 7148 } else { 7149 return &PolicySpec_FieldSubPath{selector: PolicySpec_FieldPathSelectorResourceIdentity, subPath: subpath}, nil 7150 } 7151 case "supporting_queries", "supportingQueries", "supporting-queries": 7152 if subpath, err := BuildPolicySpecSupportingAlertQuery_FieldPath(fp[1:]); err != nil { 7153 return nil, err 7154 } else { 7155 return &PolicySpec_FieldSubPath{selector: PolicySpec_FieldPathSelectorSupportingQueries, subPath: subpath}, nil 7156 } 7157 case "ai_agent", "aiAgent", "ai-agent": 7158 if subpath, err := BuildPolicySpecAIAgentHandling_FieldPath(fp[1:]); err != nil { 7159 return nil, err 7160 } else { 7161 return &PolicySpec_FieldSubPath{selector: PolicySpec_FieldPathSelectorAiAgent, subPath: subpath}, nil 7162 } 7163 } 7164 } 7165 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec", fp) 7166 } 7167 7168 func ParsePolicySpec_FieldPath(rawField string) (PolicySpec_FieldPath, error) { 7169 fp, err := gotenobject.ParseRawFieldPath(rawField) 7170 if err != nil { 7171 return nil, err 7172 } 7173 return BuildPolicySpec_FieldPath(fp) 7174 } 7175 7176 func MustParsePolicySpec_FieldPath(rawField string) PolicySpec_FieldPath { 7177 fp, err := ParsePolicySpec_FieldPath(rawField) 7178 if err != nil { 7179 panic(err) 7180 } 7181 return fp 7182 } 7183 7184 type PolicySpec_FieldTerminalPath struct { 7185 selector PolicySpec_FieldPathSelector 7186 } 7187 7188 var _ PolicySpec_FieldPath = (*PolicySpec_FieldTerminalPath)(nil) 7189 7190 func (fp *PolicySpec_FieldTerminalPath) Selector() PolicySpec_FieldPathSelector { 7191 return fp.selector 7192 } 7193 7194 // String returns path representation in proto convention 7195 func (fp *PolicySpec_FieldTerminalPath) String() string { 7196 return fp.selector.String() 7197 } 7198 7199 // JSONString returns path representation is JSON convention 7200 func (fp *PolicySpec_FieldTerminalPath) JSONString() string { 7201 return strcase.ToLowerCamel(fp.String()) 7202 } 7203 7204 // Get returns all values pointed by specific field from source PolicySpec 7205 func (fp *PolicySpec_FieldTerminalPath) Get(source *PolicySpec) (values []interface{}) { 7206 if source != nil { 7207 switch fp.selector { 7208 case PolicySpec_FieldPathSelectorEnabled: 7209 values = append(values, source.Enabled) 7210 case PolicySpec_FieldPathSelectorProcessingLocation: 7211 values = append(values, source.ProcessingLocation) 7212 case PolicySpec_FieldPathSelectorResourceIdentity: 7213 if source.ResourceIdentity != nil { 7214 values = append(values, source.ResourceIdentity) 7215 } 7216 case PolicySpec_FieldPathSelectorSupportingQueries: 7217 for _, value := range source.GetSupportingQueries() { 7218 values = append(values, value) 7219 } 7220 case PolicySpec_FieldPathSelectorAiAgent: 7221 if source.AiAgent != nil { 7222 values = append(values, source.AiAgent) 7223 } 7224 default: 7225 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fp.selector)) 7226 } 7227 } 7228 return 7229 } 7230 7231 func (fp *PolicySpec_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 7232 return fp.Get(source.(*PolicySpec)) 7233 } 7234 7235 // GetSingle returns value pointed by specific field of from source PolicySpec 7236 func (fp *PolicySpec_FieldTerminalPath) GetSingle(source *PolicySpec) (interface{}, bool) { 7237 switch fp.selector { 7238 case PolicySpec_FieldPathSelectorEnabled: 7239 return source.GetEnabled(), source != nil 7240 case PolicySpec_FieldPathSelectorProcessingLocation: 7241 return source.GetProcessingLocation(), source != nil 7242 case PolicySpec_FieldPathSelectorResourceIdentity: 7243 res := source.GetResourceIdentity() 7244 return res, res != nil 7245 case PolicySpec_FieldPathSelectorSupportingQueries: 7246 res := source.GetSupportingQueries() 7247 return res, res != nil 7248 case PolicySpec_FieldPathSelectorAiAgent: 7249 res := source.GetAiAgent() 7250 return res, res != nil 7251 default: 7252 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fp.selector)) 7253 } 7254 } 7255 7256 func (fp *PolicySpec_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 7257 return fp.GetSingle(source.(*PolicySpec)) 7258 } 7259 7260 // GetDefault returns a default value of the field type 7261 func (fp *PolicySpec_FieldTerminalPath) GetDefault() interface{} { 7262 switch fp.selector { 7263 case PolicySpec_FieldPathSelectorEnabled: 7264 return false 7265 case PolicySpec_FieldPathSelectorProcessingLocation: 7266 return PolicySpec_UNDEFINED 7267 case PolicySpec_FieldPathSelectorResourceIdentity: 7268 return (*PolicySpec_ResourceIdentity)(nil) 7269 case PolicySpec_FieldPathSelectorSupportingQueries: 7270 return ([]*PolicySpec_SupportingAlertQuery)(nil) 7271 case PolicySpec_FieldPathSelectorAiAgent: 7272 return (*PolicySpec_AIAgentHandling)(nil) 7273 default: 7274 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fp.selector)) 7275 } 7276 } 7277 7278 func (fp *PolicySpec_FieldTerminalPath) ClearValue(item *PolicySpec) { 7279 if item != nil { 7280 switch fp.selector { 7281 case PolicySpec_FieldPathSelectorEnabled: 7282 item.Enabled = false 7283 case PolicySpec_FieldPathSelectorProcessingLocation: 7284 item.ProcessingLocation = PolicySpec_UNDEFINED 7285 case PolicySpec_FieldPathSelectorResourceIdentity: 7286 item.ResourceIdentity = nil 7287 case PolicySpec_FieldPathSelectorSupportingQueries: 7288 item.SupportingQueries = nil 7289 case PolicySpec_FieldPathSelectorAiAgent: 7290 item.AiAgent = nil 7291 default: 7292 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fp.selector)) 7293 } 7294 } 7295 } 7296 7297 func (fp *PolicySpec_FieldTerminalPath) ClearValueRaw(item proto.Message) { 7298 fp.ClearValue(item.(*PolicySpec)) 7299 } 7300 7301 // IsLeaf - whether field path is holds simple value 7302 func (fp *PolicySpec_FieldTerminalPath) IsLeaf() bool { 7303 return fp.selector == PolicySpec_FieldPathSelectorEnabled || 7304 fp.selector == PolicySpec_FieldPathSelectorProcessingLocation 7305 } 7306 7307 func (fp *PolicySpec_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 7308 return []gotenobject.FieldPath{fp} 7309 } 7310 7311 func (fp *PolicySpec_FieldTerminalPath) WithIValue(value interface{}) PolicySpec_FieldPathValue { 7312 switch fp.selector { 7313 case PolicySpec_FieldPathSelectorEnabled: 7314 return &PolicySpec_FieldTerminalPathValue{PolicySpec_FieldTerminalPath: *fp, value: value.(bool)} 7315 case PolicySpec_FieldPathSelectorProcessingLocation: 7316 return &PolicySpec_FieldTerminalPathValue{PolicySpec_FieldTerminalPath: *fp, value: value.(PolicySpec_ProcessingLocation)} 7317 case PolicySpec_FieldPathSelectorResourceIdentity: 7318 return &PolicySpec_FieldTerminalPathValue{PolicySpec_FieldTerminalPath: *fp, value: value.(*PolicySpec_ResourceIdentity)} 7319 case PolicySpec_FieldPathSelectorSupportingQueries: 7320 return &PolicySpec_FieldTerminalPathValue{PolicySpec_FieldTerminalPath: *fp, value: value.([]*PolicySpec_SupportingAlertQuery)} 7321 case PolicySpec_FieldPathSelectorAiAgent: 7322 return &PolicySpec_FieldTerminalPathValue{PolicySpec_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling)} 7323 default: 7324 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fp.selector)) 7325 } 7326 } 7327 7328 func (fp *PolicySpec_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 7329 return fp.WithIValue(value) 7330 } 7331 7332 func (fp *PolicySpec_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpec_FieldPathArrayOfValues { 7333 fpaov := &PolicySpec_FieldTerminalPathArrayOfValues{PolicySpec_FieldTerminalPath: *fp} 7334 switch fp.selector { 7335 case PolicySpec_FieldPathSelectorEnabled: 7336 return &PolicySpec_FieldTerminalPathArrayOfValues{PolicySpec_FieldTerminalPath: *fp, values: values.([]bool)} 7337 case PolicySpec_FieldPathSelectorProcessingLocation: 7338 return &PolicySpec_FieldTerminalPathArrayOfValues{PolicySpec_FieldTerminalPath: *fp, values: values.([]PolicySpec_ProcessingLocation)} 7339 case PolicySpec_FieldPathSelectorResourceIdentity: 7340 return &PolicySpec_FieldTerminalPathArrayOfValues{PolicySpec_FieldTerminalPath: *fp, values: values.([]*PolicySpec_ResourceIdentity)} 7341 case PolicySpec_FieldPathSelectorSupportingQueries: 7342 return &PolicySpec_FieldTerminalPathArrayOfValues{PolicySpec_FieldTerminalPath: *fp, values: values.([][]*PolicySpec_SupportingAlertQuery)} 7343 case PolicySpec_FieldPathSelectorAiAgent: 7344 return &PolicySpec_FieldTerminalPathArrayOfValues{PolicySpec_FieldTerminalPath: *fp, values: values.([]*PolicySpec_AIAgentHandling)} 7345 default: 7346 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fp.selector)) 7347 } 7348 return fpaov 7349 } 7350 7351 func (fp *PolicySpec_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 7352 return fp.WithIArrayOfValues(values) 7353 } 7354 7355 func (fp *PolicySpec_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpec_FieldPathArrayItemValue { 7356 switch fp.selector { 7357 case PolicySpec_FieldPathSelectorSupportingQueries: 7358 return &PolicySpec_FieldTerminalPathArrayItemValue{PolicySpec_FieldTerminalPath: *fp, value: value.(*PolicySpec_SupportingAlertQuery)} 7359 default: 7360 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fp.selector)) 7361 } 7362 } 7363 7364 func (fp *PolicySpec_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 7365 return fp.WithIArrayItemValue(value) 7366 } 7367 7368 type PolicySpec_FieldSubPath struct { 7369 selector PolicySpec_FieldPathSelector 7370 subPath gotenobject.FieldPath 7371 } 7372 7373 var _ PolicySpec_FieldPath = (*PolicySpec_FieldSubPath)(nil) 7374 7375 func (fps *PolicySpec_FieldSubPath) Selector() PolicySpec_FieldPathSelector { 7376 return fps.selector 7377 } 7378 func (fps *PolicySpec_FieldSubPath) AsResourceIdentitySubPath() (PolicySpecResourceIdentity_FieldPath, bool) { 7379 res, ok := fps.subPath.(PolicySpecResourceIdentity_FieldPath) 7380 return res, ok 7381 } 7382 func (fps *PolicySpec_FieldSubPath) AsSupportingQueriesSubPath() (PolicySpecSupportingAlertQuery_FieldPath, bool) { 7383 res, ok := fps.subPath.(PolicySpecSupportingAlertQuery_FieldPath) 7384 return res, ok 7385 } 7386 func (fps *PolicySpec_FieldSubPath) AsAiAgentSubPath() (PolicySpecAIAgentHandling_FieldPath, bool) { 7387 res, ok := fps.subPath.(PolicySpecAIAgentHandling_FieldPath) 7388 return res, ok 7389 } 7390 7391 // String returns path representation in proto convention 7392 func (fps *PolicySpec_FieldSubPath) String() string { 7393 return fps.selector.String() + "." + fps.subPath.String() 7394 } 7395 7396 // JSONString returns path representation is JSON convention 7397 func (fps *PolicySpec_FieldSubPath) JSONString() string { 7398 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 7399 } 7400 7401 // Get returns all values pointed by selected field from source PolicySpec 7402 func (fps *PolicySpec_FieldSubPath) Get(source *PolicySpec) (values []interface{}) { 7403 switch fps.selector { 7404 case PolicySpec_FieldPathSelectorResourceIdentity: 7405 values = append(values, fps.subPath.GetRaw(source.GetResourceIdentity())...) 7406 case PolicySpec_FieldPathSelectorSupportingQueries: 7407 for _, item := range source.GetSupportingQueries() { 7408 values = append(values, fps.subPath.GetRaw(item)...) 7409 } 7410 case PolicySpec_FieldPathSelectorAiAgent: 7411 values = append(values, fps.subPath.GetRaw(source.GetAiAgent())...) 7412 default: 7413 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fps.selector)) 7414 } 7415 return 7416 } 7417 7418 func (fps *PolicySpec_FieldSubPath) GetRaw(source proto.Message) []interface{} { 7419 return fps.Get(source.(*PolicySpec)) 7420 } 7421 7422 // GetSingle returns value of selected field from source PolicySpec 7423 func (fps *PolicySpec_FieldSubPath) GetSingle(source *PolicySpec) (interface{}, bool) { 7424 switch fps.selector { 7425 case PolicySpec_FieldPathSelectorResourceIdentity: 7426 if source.GetResourceIdentity() == nil { 7427 return nil, false 7428 } 7429 return fps.subPath.GetSingleRaw(source.GetResourceIdentity()) 7430 case PolicySpec_FieldPathSelectorSupportingQueries: 7431 if len(source.GetSupportingQueries()) == 0 { 7432 return nil, false 7433 } 7434 return fps.subPath.GetSingleRaw(source.GetSupportingQueries()[0]) 7435 case PolicySpec_FieldPathSelectorAiAgent: 7436 if source.GetAiAgent() == nil { 7437 return nil, false 7438 } 7439 return fps.subPath.GetSingleRaw(source.GetAiAgent()) 7440 default: 7441 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fps.selector)) 7442 } 7443 } 7444 7445 func (fps *PolicySpec_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 7446 return fps.GetSingle(source.(*PolicySpec)) 7447 } 7448 7449 // GetDefault returns a default value of the field type 7450 func (fps *PolicySpec_FieldSubPath) GetDefault() interface{} { 7451 return fps.subPath.GetDefault() 7452 } 7453 7454 func (fps *PolicySpec_FieldSubPath) ClearValue(item *PolicySpec) { 7455 if item != nil { 7456 switch fps.selector { 7457 case PolicySpec_FieldPathSelectorResourceIdentity: 7458 fps.subPath.ClearValueRaw(item.ResourceIdentity) 7459 case PolicySpec_FieldPathSelectorSupportingQueries: 7460 for _, subItem := range item.SupportingQueries { 7461 fps.subPath.ClearValueRaw(subItem) 7462 } 7463 case PolicySpec_FieldPathSelectorAiAgent: 7464 fps.subPath.ClearValueRaw(item.AiAgent) 7465 default: 7466 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fps.selector)) 7467 } 7468 } 7469 } 7470 7471 func (fps *PolicySpec_FieldSubPath) ClearValueRaw(item proto.Message) { 7472 fps.ClearValue(item.(*PolicySpec)) 7473 } 7474 7475 // IsLeaf - whether field path is holds simple value 7476 func (fps *PolicySpec_FieldSubPath) IsLeaf() bool { 7477 return fps.subPath.IsLeaf() 7478 } 7479 7480 func (fps *PolicySpec_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 7481 iPaths := []gotenobject.FieldPath{&PolicySpec_FieldTerminalPath{selector: fps.selector}} 7482 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 7483 return iPaths 7484 } 7485 7486 func (fps *PolicySpec_FieldSubPath) WithIValue(value interface{}) PolicySpec_FieldPathValue { 7487 return &PolicySpec_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 7488 } 7489 7490 func (fps *PolicySpec_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 7491 return fps.WithIValue(value) 7492 } 7493 7494 func (fps *PolicySpec_FieldSubPath) WithIArrayOfValues(values interface{}) PolicySpec_FieldPathArrayOfValues { 7495 return &PolicySpec_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 7496 } 7497 7498 func (fps *PolicySpec_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 7499 return fps.WithIArrayOfValues(values) 7500 } 7501 7502 func (fps *PolicySpec_FieldSubPath) WithIArrayItemValue(value interface{}) PolicySpec_FieldPathArrayItemValue { 7503 return &PolicySpec_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 7504 } 7505 7506 func (fps *PolicySpec_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 7507 return fps.WithIArrayItemValue(value) 7508 } 7509 7510 // PolicySpec_FieldPathValue allows storing values for PolicySpec fields according to their type 7511 type PolicySpec_FieldPathValue interface { 7512 PolicySpec_FieldPath 7513 gotenobject.FieldPathValue 7514 SetTo(target **PolicySpec) 7515 CompareWith(*PolicySpec) (cmp int, comparable bool) 7516 } 7517 7518 func ParsePolicySpec_FieldPathValue(pathStr, valueStr string) (PolicySpec_FieldPathValue, error) { 7519 fp, err := ParsePolicySpec_FieldPath(pathStr) 7520 if err != nil { 7521 return nil, err 7522 } 7523 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 7524 if err != nil { 7525 return nil, status.Errorf(codes.InvalidArgument, "error parsing PolicySpec field path value from %s: %v", valueStr, err) 7526 } 7527 return fpv.(PolicySpec_FieldPathValue), nil 7528 } 7529 7530 func MustParsePolicySpec_FieldPathValue(pathStr, valueStr string) PolicySpec_FieldPathValue { 7531 fpv, err := ParsePolicySpec_FieldPathValue(pathStr, valueStr) 7532 if err != nil { 7533 panic(err) 7534 } 7535 return fpv 7536 } 7537 7538 type PolicySpec_FieldTerminalPathValue struct { 7539 PolicySpec_FieldTerminalPath 7540 value interface{} 7541 } 7542 7543 var _ PolicySpec_FieldPathValue = (*PolicySpec_FieldTerminalPathValue)(nil) 7544 7545 // GetRawValue returns raw value stored under selected path for 'PolicySpec' as interface{} 7546 func (fpv *PolicySpec_FieldTerminalPathValue) GetRawValue() interface{} { 7547 return fpv.value 7548 } 7549 func (fpv *PolicySpec_FieldTerminalPathValue) AsEnabledValue() (bool, bool) { 7550 res, ok := fpv.value.(bool) 7551 return res, ok 7552 } 7553 func (fpv *PolicySpec_FieldTerminalPathValue) AsProcessingLocationValue() (PolicySpec_ProcessingLocation, bool) { 7554 res, ok := fpv.value.(PolicySpec_ProcessingLocation) 7555 return res, ok 7556 } 7557 func (fpv *PolicySpec_FieldTerminalPathValue) AsResourceIdentityValue() (*PolicySpec_ResourceIdentity, bool) { 7558 res, ok := fpv.value.(*PolicySpec_ResourceIdentity) 7559 return res, ok 7560 } 7561 func (fpv *PolicySpec_FieldTerminalPathValue) AsSupportingQueriesValue() ([]*PolicySpec_SupportingAlertQuery, bool) { 7562 res, ok := fpv.value.([]*PolicySpec_SupportingAlertQuery) 7563 return res, ok 7564 } 7565 func (fpv *PolicySpec_FieldTerminalPathValue) AsAiAgentValue() (*PolicySpec_AIAgentHandling, bool) { 7566 res, ok := fpv.value.(*PolicySpec_AIAgentHandling) 7567 return res, ok 7568 } 7569 7570 // SetTo stores value for selected field for object PolicySpec 7571 func (fpv *PolicySpec_FieldTerminalPathValue) SetTo(target **PolicySpec) { 7572 if *target == nil { 7573 *target = new(PolicySpec) 7574 } 7575 switch fpv.selector { 7576 case PolicySpec_FieldPathSelectorEnabled: 7577 (*target).Enabled = fpv.value.(bool) 7578 case PolicySpec_FieldPathSelectorProcessingLocation: 7579 (*target).ProcessingLocation = fpv.value.(PolicySpec_ProcessingLocation) 7580 case PolicySpec_FieldPathSelectorResourceIdentity: 7581 (*target).ResourceIdentity = fpv.value.(*PolicySpec_ResourceIdentity) 7582 case PolicySpec_FieldPathSelectorSupportingQueries: 7583 (*target).SupportingQueries = fpv.value.([]*PolicySpec_SupportingAlertQuery) 7584 case PolicySpec_FieldPathSelectorAiAgent: 7585 (*target).AiAgent = fpv.value.(*PolicySpec_AIAgentHandling) 7586 default: 7587 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fpv.selector)) 7588 } 7589 } 7590 7591 func (fpv *PolicySpec_FieldTerminalPathValue) SetToRaw(target proto.Message) { 7592 typedObject := target.(*PolicySpec) 7593 fpv.SetTo(&typedObject) 7594 } 7595 7596 // CompareWith compares value in the 'PolicySpec_FieldTerminalPathValue' with the value under path in 'PolicySpec'. 7597 func (fpv *PolicySpec_FieldTerminalPathValue) CompareWith(source *PolicySpec) (int, bool) { 7598 switch fpv.selector { 7599 case PolicySpec_FieldPathSelectorEnabled: 7600 leftValue := fpv.value.(bool) 7601 rightValue := source.GetEnabled() 7602 if (leftValue) == (rightValue) { 7603 return 0, true 7604 } else if !(leftValue) && (rightValue) { 7605 return -1, true 7606 } else { 7607 return 1, true 7608 } 7609 case PolicySpec_FieldPathSelectorProcessingLocation: 7610 leftValue := fpv.value.(PolicySpec_ProcessingLocation) 7611 rightValue := source.GetProcessingLocation() 7612 if (leftValue) == (rightValue) { 7613 return 0, true 7614 } else if (leftValue) < (rightValue) { 7615 return -1, true 7616 } else { 7617 return 1, true 7618 } 7619 case PolicySpec_FieldPathSelectorResourceIdentity: 7620 return 0, false 7621 case PolicySpec_FieldPathSelectorSupportingQueries: 7622 return 0, false 7623 case PolicySpec_FieldPathSelectorAiAgent: 7624 return 0, false 7625 default: 7626 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fpv.selector)) 7627 } 7628 } 7629 7630 func (fpv *PolicySpec_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 7631 return fpv.CompareWith(source.(*PolicySpec)) 7632 } 7633 7634 type PolicySpec_FieldSubPathValue struct { 7635 PolicySpec_FieldPath 7636 subPathValue gotenobject.FieldPathValue 7637 } 7638 7639 var _ PolicySpec_FieldPathValue = (*PolicySpec_FieldSubPathValue)(nil) 7640 7641 func (fpvs *PolicySpec_FieldSubPathValue) AsResourceIdentityPathValue() (PolicySpecResourceIdentity_FieldPathValue, bool) { 7642 res, ok := fpvs.subPathValue.(PolicySpecResourceIdentity_FieldPathValue) 7643 return res, ok 7644 } 7645 func (fpvs *PolicySpec_FieldSubPathValue) AsSupportingQueriesPathValue() (PolicySpecSupportingAlertQuery_FieldPathValue, bool) { 7646 res, ok := fpvs.subPathValue.(PolicySpecSupportingAlertQuery_FieldPathValue) 7647 return res, ok 7648 } 7649 func (fpvs *PolicySpec_FieldSubPathValue) AsAiAgentPathValue() (PolicySpecAIAgentHandling_FieldPathValue, bool) { 7650 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandling_FieldPathValue) 7651 return res, ok 7652 } 7653 7654 func (fpvs *PolicySpec_FieldSubPathValue) SetTo(target **PolicySpec) { 7655 if *target == nil { 7656 *target = new(PolicySpec) 7657 } 7658 switch fpvs.Selector() { 7659 case PolicySpec_FieldPathSelectorResourceIdentity: 7660 fpvs.subPathValue.(PolicySpecResourceIdentity_FieldPathValue).SetTo(&(*target).ResourceIdentity) 7661 case PolicySpec_FieldPathSelectorSupportingQueries: 7662 panic("FieldPath setter is unsupported for array subpaths") 7663 case PolicySpec_FieldPathSelectorAiAgent: 7664 fpvs.subPathValue.(PolicySpecAIAgentHandling_FieldPathValue).SetTo(&(*target).AiAgent) 7665 default: 7666 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fpvs.Selector())) 7667 } 7668 } 7669 7670 func (fpvs *PolicySpec_FieldSubPathValue) SetToRaw(target proto.Message) { 7671 typedObject := target.(*PolicySpec) 7672 fpvs.SetTo(&typedObject) 7673 } 7674 7675 func (fpvs *PolicySpec_FieldSubPathValue) GetRawValue() interface{} { 7676 return fpvs.subPathValue.GetRawValue() 7677 } 7678 7679 func (fpvs *PolicySpec_FieldSubPathValue) CompareWith(source *PolicySpec) (int, bool) { 7680 switch fpvs.Selector() { 7681 case PolicySpec_FieldPathSelectorResourceIdentity: 7682 return fpvs.subPathValue.(PolicySpecResourceIdentity_FieldPathValue).CompareWith(source.GetResourceIdentity()) 7683 case PolicySpec_FieldPathSelectorSupportingQueries: 7684 return 0, false // repeated field 7685 case PolicySpec_FieldPathSelectorAiAgent: 7686 return fpvs.subPathValue.(PolicySpecAIAgentHandling_FieldPathValue).CompareWith(source.GetAiAgent()) 7687 default: 7688 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fpvs.Selector())) 7689 } 7690 } 7691 7692 func (fpvs *PolicySpec_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 7693 return fpvs.CompareWith(source.(*PolicySpec)) 7694 } 7695 7696 // PolicySpec_FieldPathArrayItemValue allows storing single item in Path-specific values for PolicySpec according to their type 7697 // Present only for array (repeated) types. 7698 type PolicySpec_FieldPathArrayItemValue interface { 7699 gotenobject.FieldPathArrayItemValue 7700 PolicySpec_FieldPath 7701 ContainsValue(*PolicySpec) bool 7702 } 7703 7704 // ParsePolicySpec_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 7705 func ParsePolicySpec_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpec_FieldPathArrayItemValue, error) { 7706 fp, err := ParsePolicySpec_FieldPath(pathStr) 7707 if err != nil { 7708 return nil, err 7709 } 7710 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 7711 if err != nil { 7712 return nil, status.Errorf(codes.InvalidArgument, "error parsing PolicySpec field path array item value from %s: %v", valueStr, err) 7713 } 7714 return fpaiv.(PolicySpec_FieldPathArrayItemValue), nil 7715 } 7716 7717 func MustParsePolicySpec_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpec_FieldPathArrayItemValue { 7718 fpaiv, err := ParsePolicySpec_FieldPathArrayItemValue(pathStr, valueStr) 7719 if err != nil { 7720 panic(err) 7721 } 7722 return fpaiv 7723 } 7724 7725 type PolicySpec_FieldTerminalPathArrayItemValue struct { 7726 PolicySpec_FieldTerminalPath 7727 value interface{} 7728 } 7729 7730 var _ PolicySpec_FieldPathArrayItemValue = (*PolicySpec_FieldTerminalPathArrayItemValue)(nil) 7731 7732 // GetRawValue returns stored element value for array in object PolicySpec as interface{} 7733 func (fpaiv *PolicySpec_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 7734 return fpaiv.value 7735 } 7736 func (fpaiv *PolicySpec_FieldTerminalPathArrayItemValue) AsSupportingQueriesItemValue() (*PolicySpec_SupportingAlertQuery, bool) { 7737 res, ok := fpaiv.value.(*PolicySpec_SupportingAlertQuery) 7738 return res, ok 7739 } 7740 7741 func (fpaiv *PolicySpec_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec) (interface{}, bool) { 7742 return nil, false 7743 } 7744 7745 func (fpaiv *PolicySpec_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 7746 return fpaiv.GetSingle(source.(*PolicySpec)) 7747 } 7748 7749 // Contains returns a boolean indicating if value that is being held is present in given 'PolicySpec' 7750 func (fpaiv *PolicySpec_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec) bool { 7751 slice := fpaiv.PolicySpec_FieldTerminalPath.Get(source) 7752 for _, v := range slice { 7753 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 7754 if proto.Equal(asProtoMsg, v.(proto.Message)) { 7755 return true 7756 } 7757 } else if reflect.DeepEqual(v, fpaiv.value) { 7758 return true 7759 } 7760 } 7761 return false 7762 } 7763 7764 type PolicySpec_FieldSubPathArrayItemValue struct { 7765 PolicySpec_FieldPath 7766 subPathItemValue gotenobject.FieldPathArrayItemValue 7767 } 7768 7769 // GetRawValue returns stored array item value 7770 func (fpaivs *PolicySpec_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 7771 return fpaivs.subPathItemValue.GetRawItemValue() 7772 } 7773 func (fpaivs *PolicySpec_FieldSubPathArrayItemValue) AsResourceIdentityPathItemValue() (PolicySpecResourceIdentity_FieldPathArrayItemValue, bool) { 7774 res, ok := fpaivs.subPathItemValue.(PolicySpecResourceIdentity_FieldPathArrayItemValue) 7775 return res, ok 7776 } 7777 func (fpaivs *PolicySpec_FieldSubPathArrayItemValue) AsSupportingQueriesPathItemValue() (PolicySpecSupportingAlertQuery_FieldPathArrayItemValue, bool) { 7778 res, ok := fpaivs.subPathItemValue.(PolicySpecSupportingAlertQuery_FieldPathArrayItemValue) 7779 return res, ok 7780 } 7781 func (fpaivs *PolicySpec_FieldSubPathArrayItemValue) AsAiAgentPathItemValue() (PolicySpecAIAgentHandling_FieldPathArrayItemValue, bool) { 7782 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandling_FieldPathArrayItemValue) 7783 return res, ok 7784 } 7785 7786 // Contains returns a boolean indicating if value that is being held is present in given 'PolicySpec' 7787 func (fpaivs *PolicySpec_FieldSubPathArrayItemValue) ContainsValue(source *PolicySpec) bool { 7788 switch fpaivs.Selector() { 7789 case PolicySpec_FieldPathSelectorResourceIdentity: 7790 return fpaivs.subPathItemValue.(PolicySpecResourceIdentity_FieldPathArrayItemValue).ContainsValue(source.GetResourceIdentity()) 7791 case PolicySpec_FieldPathSelectorSupportingQueries: 7792 return false // repeated/map field 7793 case PolicySpec_FieldPathSelectorAiAgent: 7794 return fpaivs.subPathItemValue.(PolicySpecAIAgentHandling_FieldPathArrayItemValue).ContainsValue(source.GetAiAgent()) 7795 default: 7796 panic(fmt.Sprintf("Invalid selector for PolicySpec: %d", fpaivs.Selector())) 7797 } 7798 } 7799 7800 // PolicySpec_FieldPathArrayOfValues allows storing slice of values for PolicySpec fields according to their type 7801 type PolicySpec_FieldPathArrayOfValues interface { 7802 gotenobject.FieldPathArrayOfValues 7803 PolicySpec_FieldPath 7804 } 7805 7806 func ParsePolicySpec_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpec_FieldPathArrayOfValues, error) { 7807 fp, err := ParsePolicySpec_FieldPath(pathStr) 7808 if err != nil { 7809 return nil, err 7810 } 7811 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 7812 if err != nil { 7813 return nil, status.Errorf(codes.InvalidArgument, "error parsing PolicySpec field path array of values from %s: %v", valuesStr, err) 7814 } 7815 return fpaov.(PolicySpec_FieldPathArrayOfValues), nil 7816 } 7817 7818 func MustParsePolicySpec_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpec_FieldPathArrayOfValues { 7819 fpaov, err := ParsePolicySpec_FieldPathArrayOfValues(pathStr, valuesStr) 7820 if err != nil { 7821 panic(err) 7822 } 7823 return fpaov 7824 } 7825 7826 type PolicySpec_FieldTerminalPathArrayOfValues struct { 7827 PolicySpec_FieldTerminalPath 7828 values interface{} 7829 } 7830 7831 var _ PolicySpec_FieldPathArrayOfValues = (*PolicySpec_FieldTerminalPathArrayOfValues)(nil) 7832 7833 func (fpaov *PolicySpec_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 7834 switch fpaov.selector { 7835 case PolicySpec_FieldPathSelectorEnabled: 7836 for _, v := range fpaov.values.([]bool) { 7837 values = append(values, v) 7838 } 7839 case PolicySpec_FieldPathSelectorProcessingLocation: 7840 for _, v := range fpaov.values.([]PolicySpec_ProcessingLocation) { 7841 values = append(values, v) 7842 } 7843 case PolicySpec_FieldPathSelectorResourceIdentity: 7844 for _, v := range fpaov.values.([]*PolicySpec_ResourceIdentity) { 7845 values = append(values, v) 7846 } 7847 case PolicySpec_FieldPathSelectorSupportingQueries: 7848 for _, v := range fpaov.values.([][]*PolicySpec_SupportingAlertQuery) { 7849 values = append(values, v) 7850 } 7851 case PolicySpec_FieldPathSelectorAiAgent: 7852 for _, v := range fpaov.values.([]*PolicySpec_AIAgentHandling) { 7853 values = append(values, v) 7854 } 7855 } 7856 return 7857 } 7858 func (fpaov *PolicySpec_FieldTerminalPathArrayOfValues) AsEnabledArrayOfValues() ([]bool, bool) { 7859 res, ok := fpaov.values.([]bool) 7860 return res, ok 7861 } 7862 func (fpaov *PolicySpec_FieldTerminalPathArrayOfValues) AsProcessingLocationArrayOfValues() ([]PolicySpec_ProcessingLocation, bool) { 7863 res, ok := fpaov.values.([]PolicySpec_ProcessingLocation) 7864 return res, ok 7865 } 7866 func (fpaov *PolicySpec_FieldTerminalPathArrayOfValues) AsResourceIdentityArrayOfValues() ([]*PolicySpec_ResourceIdentity, bool) { 7867 res, ok := fpaov.values.([]*PolicySpec_ResourceIdentity) 7868 return res, ok 7869 } 7870 func (fpaov *PolicySpec_FieldTerminalPathArrayOfValues) AsSupportingQueriesArrayOfValues() ([][]*PolicySpec_SupportingAlertQuery, bool) { 7871 res, ok := fpaov.values.([][]*PolicySpec_SupportingAlertQuery) 7872 return res, ok 7873 } 7874 func (fpaov *PolicySpec_FieldTerminalPathArrayOfValues) AsAiAgentArrayOfValues() ([]*PolicySpec_AIAgentHandling, bool) { 7875 res, ok := fpaov.values.([]*PolicySpec_AIAgentHandling) 7876 return res, ok 7877 } 7878 7879 type PolicySpec_FieldSubPathArrayOfValues struct { 7880 PolicySpec_FieldPath 7881 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 7882 } 7883 7884 var _ PolicySpec_FieldPathArrayOfValues = (*PolicySpec_FieldSubPathArrayOfValues)(nil) 7885 7886 func (fpsaov *PolicySpec_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 7887 return fpsaov.subPathArrayOfValues.GetRawValues() 7888 } 7889 func (fpsaov *PolicySpec_FieldSubPathArrayOfValues) AsResourceIdentityPathArrayOfValues() (PolicySpecResourceIdentity_FieldPathArrayOfValues, bool) { 7890 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecResourceIdentity_FieldPathArrayOfValues) 7891 return res, ok 7892 } 7893 func (fpsaov *PolicySpec_FieldSubPathArrayOfValues) AsSupportingQueriesPathArrayOfValues() (PolicySpecSupportingAlertQuery_FieldPathArrayOfValues, bool) { 7894 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecSupportingAlertQuery_FieldPathArrayOfValues) 7895 return res, ok 7896 } 7897 func (fpsaov *PolicySpec_FieldSubPathArrayOfValues) AsAiAgentPathArrayOfValues() (PolicySpecAIAgentHandling_FieldPathArrayOfValues, bool) { 7898 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandling_FieldPathArrayOfValues) 7899 return res, ok 7900 } 7901 7902 // FieldPath provides implementation to handle 7903 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 7904 type PolicySpecResourceIdentity_FieldPath interface { 7905 gotenobject.FieldPath 7906 Selector() PolicySpecResourceIdentity_FieldPathSelector 7907 Get(source *PolicySpec_ResourceIdentity) []interface{} 7908 GetSingle(source *PolicySpec_ResourceIdentity) (interface{}, bool) 7909 ClearValue(item *PolicySpec_ResourceIdentity) 7910 7911 // Those methods build corresponding PolicySpecResourceIdentity_FieldPathValue 7912 // (or array of values) and holds passed value. Panics if injected type is incorrect. 7913 WithIValue(value interface{}) PolicySpecResourceIdentity_FieldPathValue 7914 WithIArrayOfValues(values interface{}) PolicySpecResourceIdentity_FieldPathArrayOfValues 7915 WithIArrayItemValue(value interface{}) PolicySpecResourceIdentity_FieldPathArrayItemValue 7916 } 7917 7918 type PolicySpecResourceIdentity_FieldPathSelector int32 7919 7920 const ( 7921 PolicySpecResourceIdentity_FieldPathSelectorAlertingResource PolicySpecResourceIdentity_FieldPathSelector = 0 7922 PolicySpecResourceIdentity_FieldPathSelectorLabels PolicySpecResourceIdentity_FieldPathSelector = 1 7923 PolicySpecResourceIdentity_FieldPathSelectorNamePatterns PolicySpecResourceIdentity_FieldPathSelector = 2 7924 ) 7925 7926 func (s PolicySpecResourceIdentity_FieldPathSelector) String() string { 7927 switch s { 7928 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 7929 return "alerting_resource" 7930 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 7931 return "labels" 7932 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 7933 return "name_patterns" 7934 default: 7935 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", s)) 7936 } 7937 } 7938 7939 func BuildPolicySpecResourceIdentity_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecResourceIdentity_FieldPath, error) { 7940 if len(fp) == 0 { 7941 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_ResourceIdentity") 7942 } 7943 if len(fp) == 1 { 7944 switch fp[0] { 7945 case "alerting_resource", "alertingResource", "alerting-resource": 7946 return &PolicySpecResourceIdentity_FieldTerminalPath{selector: PolicySpecResourceIdentity_FieldPathSelectorAlertingResource}, nil 7947 case "labels": 7948 return &PolicySpecResourceIdentity_FieldTerminalPath{selector: PolicySpecResourceIdentity_FieldPathSelectorLabels}, nil 7949 case "name_patterns", "namePatterns", "name-patterns": 7950 return &PolicySpecResourceIdentity_FieldTerminalPath{selector: PolicySpecResourceIdentity_FieldPathSelectorNamePatterns}, nil 7951 } 7952 } else { 7953 switch fp[0] { 7954 case "labels": 7955 if subpath, err := BuildPolicySpecResourceIdentityLabelInfo_FieldPath(fp[1:]); err != nil { 7956 return nil, err 7957 } else { 7958 return &PolicySpecResourceIdentity_FieldSubPath{selector: PolicySpecResourceIdentity_FieldPathSelectorLabels, subPath: subpath}, nil 7959 } 7960 } 7961 } 7962 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_ResourceIdentity", fp) 7963 } 7964 7965 func ParsePolicySpecResourceIdentity_FieldPath(rawField string) (PolicySpecResourceIdentity_FieldPath, error) { 7966 fp, err := gotenobject.ParseRawFieldPath(rawField) 7967 if err != nil { 7968 return nil, err 7969 } 7970 return BuildPolicySpecResourceIdentity_FieldPath(fp) 7971 } 7972 7973 func MustParsePolicySpecResourceIdentity_FieldPath(rawField string) PolicySpecResourceIdentity_FieldPath { 7974 fp, err := ParsePolicySpecResourceIdentity_FieldPath(rawField) 7975 if err != nil { 7976 panic(err) 7977 } 7978 return fp 7979 } 7980 7981 type PolicySpecResourceIdentity_FieldTerminalPath struct { 7982 selector PolicySpecResourceIdentity_FieldPathSelector 7983 } 7984 7985 var _ PolicySpecResourceIdentity_FieldPath = (*PolicySpecResourceIdentity_FieldTerminalPath)(nil) 7986 7987 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) Selector() PolicySpecResourceIdentity_FieldPathSelector { 7988 return fp.selector 7989 } 7990 7991 // String returns path representation in proto convention 7992 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) String() string { 7993 return fp.selector.String() 7994 } 7995 7996 // JSONString returns path representation is JSON convention 7997 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) JSONString() string { 7998 return strcase.ToLowerCamel(fp.String()) 7999 } 8000 8001 // Get returns all values pointed by specific field from source PolicySpec_ResourceIdentity 8002 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) Get(source *PolicySpec_ResourceIdentity) (values []interface{}) { 8003 if source != nil { 8004 switch fp.selector { 8005 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8006 if source.AlertingResource != nil { 8007 values = append(values, source.AlertingResource) 8008 } 8009 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8010 for _, value := range source.GetLabels() { 8011 values = append(values, value) 8012 } 8013 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8014 for _, value := range source.GetNamePatterns() { 8015 values = append(values, value) 8016 } 8017 default: 8018 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fp.selector)) 8019 } 8020 } 8021 return 8022 } 8023 8024 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 8025 return fp.Get(source.(*PolicySpec_ResourceIdentity)) 8026 } 8027 8028 // GetSingle returns value pointed by specific field of from source PolicySpec_ResourceIdentity 8029 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) GetSingle(source *PolicySpec_ResourceIdentity) (interface{}, bool) { 8030 switch fp.selector { 8031 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8032 res := source.GetAlertingResource() 8033 return res, res != nil 8034 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8035 res := source.GetLabels() 8036 return res, res != nil 8037 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8038 res := source.GetNamePatterns() 8039 return res, res != nil 8040 default: 8041 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fp.selector)) 8042 } 8043 } 8044 8045 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 8046 return fp.GetSingle(source.(*PolicySpec_ResourceIdentity)) 8047 } 8048 8049 // GetDefault returns a default value of the field type 8050 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) GetDefault() interface{} { 8051 switch fp.selector { 8052 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8053 return (*meta_resource.Reference)(nil) 8054 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8055 return ([]*PolicySpec_ResourceIdentity_LabelInfo)(nil) 8056 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8057 return ([]string)(nil) 8058 default: 8059 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fp.selector)) 8060 } 8061 } 8062 8063 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) ClearValue(item *PolicySpec_ResourceIdentity) { 8064 if item != nil { 8065 switch fp.selector { 8066 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8067 item.AlertingResource = nil 8068 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8069 item.Labels = nil 8070 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8071 item.NamePatterns = nil 8072 default: 8073 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fp.selector)) 8074 } 8075 } 8076 } 8077 8078 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) ClearValueRaw(item proto.Message) { 8079 fp.ClearValue(item.(*PolicySpec_ResourceIdentity)) 8080 } 8081 8082 // IsLeaf - whether field path is holds simple value 8083 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) IsLeaf() bool { 8084 return fp.selector == PolicySpecResourceIdentity_FieldPathSelectorAlertingResource || 8085 fp.selector == PolicySpecResourceIdentity_FieldPathSelectorNamePatterns 8086 } 8087 8088 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 8089 return []gotenobject.FieldPath{fp} 8090 } 8091 8092 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) WithIValue(value interface{}) PolicySpecResourceIdentity_FieldPathValue { 8093 switch fp.selector { 8094 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8095 return &PolicySpecResourceIdentity_FieldTerminalPathValue{PolicySpecResourceIdentity_FieldTerminalPath: *fp, value: value.(*meta_resource.Reference)} 8096 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8097 return &PolicySpecResourceIdentity_FieldTerminalPathValue{PolicySpecResourceIdentity_FieldTerminalPath: *fp, value: value.([]*PolicySpec_ResourceIdentity_LabelInfo)} 8098 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8099 return &PolicySpecResourceIdentity_FieldTerminalPathValue{PolicySpecResourceIdentity_FieldTerminalPath: *fp, value: value.([]string)} 8100 default: 8101 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fp.selector)) 8102 } 8103 } 8104 8105 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 8106 return fp.WithIValue(value) 8107 } 8108 8109 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecResourceIdentity_FieldPathArrayOfValues { 8110 fpaov := &PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentity_FieldTerminalPath: *fp} 8111 switch fp.selector { 8112 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8113 return &PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentity_FieldTerminalPath: *fp, values: values.([]*meta_resource.Reference)} 8114 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8115 return &PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentity_FieldTerminalPath: *fp, values: values.([][]*PolicySpec_ResourceIdentity_LabelInfo)} 8116 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8117 return &PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentity_FieldTerminalPath: *fp, values: values.([][]string)} 8118 default: 8119 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fp.selector)) 8120 } 8121 return fpaov 8122 } 8123 8124 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 8125 return fp.WithIArrayOfValues(values) 8126 } 8127 8128 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecResourceIdentity_FieldPathArrayItemValue { 8129 switch fp.selector { 8130 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8131 return &PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue{PolicySpecResourceIdentity_FieldTerminalPath: *fp, value: value.(*PolicySpec_ResourceIdentity_LabelInfo)} 8132 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8133 return &PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue{PolicySpecResourceIdentity_FieldTerminalPath: *fp, value: value.(string)} 8134 default: 8135 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fp.selector)) 8136 } 8137 } 8138 8139 func (fp *PolicySpecResourceIdentity_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 8140 return fp.WithIArrayItemValue(value) 8141 } 8142 8143 type PolicySpecResourceIdentity_FieldSubPath struct { 8144 selector PolicySpecResourceIdentity_FieldPathSelector 8145 subPath gotenobject.FieldPath 8146 } 8147 8148 var _ PolicySpecResourceIdentity_FieldPath = (*PolicySpecResourceIdentity_FieldSubPath)(nil) 8149 8150 func (fps *PolicySpecResourceIdentity_FieldSubPath) Selector() PolicySpecResourceIdentity_FieldPathSelector { 8151 return fps.selector 8152 } 8153 func (fps *PolicySpecResourceIdentity_FieldSubPath) AsLabelsSubPath() (PolicySpecResourceIdentityLabelInfo_FieldPath, bool) { 8154 res, ok := fps.subPath.(PolicySpecResourceIdentityLabelInfo_FieldPath) 8155 return res, ok 8156 } 8157 8158 // String returns path representation in proto convention 8159 func (fps *PolicySpecResourceIdentity_FieldSubPath) String() string { 8160 return fps.selector.String() + "." + fps.subPath.String() 8161 } 8162 8163 // JSONString returns path representation is JSON convention 8164 func (fps *PolicySpecResourceIdentity_FieldSubPath) JSONString() string { 8165 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 8166 } 8167 8168 // Get returns all values pointed by selected field from source PolicySpec_ResourceIdentity 8169 func (fps *PolicySpecResourceIdentity_FieldSubPath) Get(source *PolicySpec_ResourceIdentity) (values []interface{}) { 8170 switch fps.selector { 8171 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8172 for _, item := range source.GetLabels() { 8173 values = append(values, fps.subPath.GetRaw(item)...) 8174 } 8175 default: 8176 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fps.selector)) 8177 } 8178 return 8179 } 8180 8181 func (fps *PolicySpecResourceIdentity_FieldSubPath) GetRaw(source proto.Message) []interface{} { 8182 return fps.Get(source.(*PolicySpec_ResourceIdentity)) 8183 } 8184 8185 // GetSingle returns value of selected field from source PolicySpec_ResourceIdentity 8186 func (fps *PolicySpecResourceIdentity_FieldSubPath) GetSingle(source *PolicySpec_ResourceIdentity) (interface{}, bool) { 8187 switch fps.selector { 8188 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8189 if len(source.GetLabels()) == 0 { 8190 return nil, false 8191 } 8192 return fps.subPath.GetSingleRaw(source.GetLabels()[0]) 8193 default: 8194 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fps.selector)) 8195 } 8196 } 8197 8198 func (fps *PolicySpecResourceIdentity_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 8199 return fps.GetSingle(source.(*PolicySpec_ResourceIdentity)) 8200 } 8201 8202 // GetDefault returns a default value of the field type 8203 func (fps *PolicySpecResourceIdentity_FieldSubPath) GetDefault() interface{} { 8204 return fps.subPath.GetDefault() 8205 } 8206 8207 func (fps *PolicySpecResourceIdentity_FieldSubPath) ClearValue(item *PolicySpec_ResourceIdentity) { 8208 if item != nil { 8209 switch fps.selector { 8210 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8211 for _, subItem := range item.Labels { 8212 fps.subPath.ClearValueRaw(subItem) 8213 } 8214 default: 8215 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fps.selector)) 8216 } 8217 } 8218 } 8219 8220 func (fps *PolicySpecResourceIdentity_FieldSubPath) ClearValueRaw(item proto.Message) { 8221 fps.ClearValue(item.(*PolicySpec_ResourceIdentity)) 8222 } 8223 8224 // IsLeaf - whether field path is holds simple value 8225 func (fps *PolicySpecResourceIdentity_FieldSubPath) IsLeaf() bool { 8226 return fps.subPath.IsLeaf() 8227 } 8228 8229 func (fps *PolicySpecResourceIdentity_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 8230 iPaths := []gotenobject.FieldPath{&PolicySpecResourceIdentity_FieldTerminalPath{selector: fps.selector}} 8231 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 8232 return iPaths 8233 } 8234 8235 func (fps *PolicySpecResourceIdentity_FieldSubPath) WithIValue(value interface{}) PolicySpecResourceIdentity_FieldPathValue { 8236 return &PolicySpecResourceIdentity_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 8237 } 8238 8239 func (fps *PolicySpecResourceIdentity_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 8240 return fps.WithIValue(value) 8241 } 8242 8243 func (fps *PolicySpecResourceIdentity_FieldSubPath) WithIArrayOfValues(values interface{}) PolicySpecResourceIdentity_FieldPathArrayOfValues { 8244 return &PolicySpecResourceIdentity_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 8245 } 8246 8247 func (fps *PolicySpecResourceIdentity_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 8248 return fps.WithIArrayOfValues(values) 8249 } 8250 8251 func (fps *PolicySpecResourceIdentity_FieldSubPath) WithIArrayItemValue(value interface{}) PolicySpecResourceIdentity_FieldPathArrayItemValue { 8252 return &PolicySpecResourceIdentity_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 8253 } 8254 8255 func (fps *PolicySpecResourceIdentity_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 8256 return fps.WithIArrayItemValue(value) 8257 } 8258 8259 // PolicySpecResourceIdentity_FieldPathValue allows storing values for ResourceIdentity fields according to their type 8260 type PolicySpecResourceIdentity_FieldPathValue interface { 8261 PolicySpecResourceIdentity_FieldPath 8262 gotenobject.FieldPathValue 8263 SetTo(target **PolicySpec_ResourceIdentity) 8264 CompareWith(*PolicySpec_ResourceIdentity) (cmp int, comparable bool) 8265 } 8266 8267 func ParsePolicySpecResourceIdentity_FieldPathValue(pathStr, valueStr string) (PolicySpecResourceIdentity_FieldPathValue, error) { 8268 fp, err := ParsePolicySpecResourceIdentity_FieldPath(pathStr) 8269 if err != nil { 8270 return nil, err 8271 } 8272 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 8273 if err != nil { 8274 return nil, status.Errorf(codes.InvalidArgument, "error parsing ResourceIdentity field path value from %s: %v", valueStr, err) 8275 } 8276 return fpv.(PolicySpecResourceIdentity_FieldPathValue), nil 8277 } 8278 8279 func MustParsePolicySpecResourceIdentity_FieldPathValue(pathStr, valueStr string) PolicySpecResourceIdentity_FieldPathValue { 8280 fpv, err := ParsePolicySpecResourceIdentity_FieldPathValue(pathStr, valueStr) 8281 if err != nil { 8282 panic(err) 8283 } 8284 return fpv 8285 } 8286 8287 type PolicySpecResourceIdentity_FieldTerminalPathValue struct { 8288 PolicySpecResourceIdentity_FieldTerminalPath 8289 value interface{} 8290 } 8291 8292 var _ PolicySpecResourceIdentity_FieldPathValue = (*PolicySpecResourceIdentity_FieldTerminalPathValue)(nil) 8293 8294 // GetRawValue returns raw value stored under selected path for 'ResourceIdentity' as interface{} 8295 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) GetRawValue() interface{} { 8296 return fpv.value 8297 } 8298 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) AsAlertingResourceValue() (*meta_resource.Reference, bool) { 8299 res, ok := fpv.value.(*meta_resource.Reference) 8300 return res, ok 8301 } 8302 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) AsLabelsValue() ([]*PolicySpec_ResourceIdentity_LabelInfo, bool) { 8303 res, ok := fpv.value.([]*PolicySpec_ResourceIdentity_LabelInfo) 8304 return res, ok 8305 } 8306 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) AsNamePatternsValue() ([]string, bool) { 8307 res, ok := fpv.value.([]string) 8308 return res, ok 8309 } 8310 8311 // SetTo stores value for selected field for object ResourceIdentity 8312 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) SetTo(target **PolicySpec_ResourceIdentity) { 8313 if *target == nil { 8314 *target = new(PolicySpec_ResourceIdentity) 8315 } 8316 switch fpv.selector { 8317 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8318 (*target).AlertingResource = fpv.value.(*meta_resource.Reference) 8319 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8320 (*target).Labels = fpv.value.([]*PolicySpec_ResourceIdentity_LabelInfo) 8321 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8322 (*target).NamePatterns = fpv.value.([]string) 8323 default: 8324 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fpv.selector)) 8325 } 8326 } 8327 8328 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) SetToRaw(target proto.Message) { 8329 typedObject := target.(*PolicySpec_ResourceIdentity) 8330 fpv.SetTo(&typedObject) 8331 } 8332 8333 // CompareWith compares value in the 'PolicySpecResourceIdentity_FieldTerminalPathValue' with the value under path in 'PolicySpec_ResourceIdentity'. 8334 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) CompareWith(source *PolicySpec_ResourceIdentity) (int, bool) { 8335 switch fpv.selector { 8336 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8337 leftValue := fpv.value.(*meta_resource.Reference) 8338 rightValue := source.GetAlertingResource() 8339 if leftValue == nil { 8340 if rightValue != nil { 8341 return -1, true 8342 } 8343 return 0, true 8344 } 8345 if rightValue == nil { 8346 return 1, true 8347 } 8348 if leftValue.String() == rightValue.String() { 8349 return 0, true 8350 } else if leftValue.String() < rightValue.String() { 8351 return -1, true 8352 } else { 8353 return 1, true 8354 } 8355 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8356 return 0, false 8357 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8358 return 0, false 8359 default: 8360 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fpv.selector)) 8361 } 8362 } 8363 8364 func (fpv *PolicySpecResourceIdentity_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 8365 return fpv.CompareWith(source.(*PolicySpec_ResourceIdentity)) 8366 } 8367 8368 type PolicySpecResourceIdentity_FieldSubPathValue struct { 8369 PolicySpecResourceIdentity_FieldPath 8370 subPathValue gotenobject.FieldPathValue 8371 } 8372 8373 var _ PolicySpecResourceIdentity_FieldPathValue = (*PolicySpecResourceIdentity_FieldSubPathValue)(nil) 8374 8375 func (fpvs *PolicySpecResourceIdentity_FieldSubPathValue) AsLabelsPathValue() (PolicySpecResourceIdentityLabelInfo_FieldPathValue, bool) { 8376 res, ok := fpvs.subPathValue.(PolicySpecResourceIdentityLabelInfo_FieldPathValue) 8377 return res, ok 8378 } 8379 8380 func (fpvs *PolicySpecResourceIdentity_FieldSubPathValue) SetTo(target **PolicySpec_ResourceIdentity) { 8381 if *target == nil { 8382 *target = new(PolicySpec_ResourceIdentity) 8383 } 8384 switch fpvs.Selector() { 8385 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8386 panic("FieldPath setter is unsupported for array subpaths") 8387 default: 8388 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fpvs.Selector())) 8389 } 8390 } 8391 8392 func (fpvs *PolicySpecResourceIdentity_FieldSubPathValue) SetToRaw(target proto.Message) { 8393 typedObject := target.(*PolicySpec_ResourceIdentity) 8394 fpvs.SetTo(&typedObject) 8395 } 8396 8397 func (fpvs *PolicySpecResourceIdentity_FieldSubPathValue) GetRawValue() interface{} { 8398 return fpvs.subPathValue.GetRawValue() 8399 } 8400 8401 func (fpvs *PolicySpecResourceIdentity_FieldSubPathValue) CompareWith(source *PolicySpec_ResourceIdentity) (int, bool) { 8402 switch fpvs.Selector() { 8403 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8404 return 0, false // repeated field 8405 default: 8406 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fpvs.Selector())) 8407 } 8408 } 8409 8410 func (fpvs *PolicySpecResourceIdentity_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 8411 return fpvs.CompareWith(source.(*PolicySpec_ResourceIdentity)) 8412 } 8413 8414 // PolicySpecResourceIdentity_FieldPathArrayItemValue allows storing single item in Path-specific values for ResourceIdentity according to their type 8415 // Present only for array (repeated) types. 8416 type PolicySpecResourceIdentity_FieldPathArrayItemValue interface { 8417 gotenobject.FieldPathArrayItemValue 8418 PolicySpecResourceIdentity_FieldPath 8419 ContainsValue(*PolicySpec_ResourceIdentity) bool 8420 } 8421 8422 // ParsePolicySpecResourceIdentity_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 8423 func ParsePolicySpecResourceIdentity_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecResourceIdentity_FieldPathArrayItemValue, error) { 8424 fp, err := ParsePolicySpecResourceIdentity_FieldPath(pathStr) 8425 if err != nil { 8426 return nil, err 8427 } 8428 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 8429 if err != nil { 8430 return nil, status.Errorf(codes.InvalidArgument, "error parsing ResourceIdentity field path array item value from %s: %v", valueStr, err) 8431 } 8432 return fpaiv.(PolicySpecResourceIdentity_FieldPathArrayItemValue), nil 8433 } 8434 8435 func MustParsePolicySpecResourceIdentity_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecResourceIdentity_FieldPathArrayItemValue { 8436 fpaiv, err := ParsePolicySpecResourceIdentity_FieldPathArrayItemValue(pathStr, valueStr) 8437 if err != nil { 8438 panic(err) 8439 } 8440 return fpaiv 8441 } 8442 8443 type PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue struct { 8444 PolicySpecResourceIdentity_FieldTerminalPath 8445 value interface{} 8446 } 8447 8448 var _ PolicySpecResourceIdentity_FieldPathArrayItemValue = (*PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue)(nil) 8449 8450 // GetRawValue returns stored element value for array in object PolicySpec_ResourceIdentity as interface{} 8451 func (fpaiv *PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 8452 return fpaiv.value 8453 } 8454 func (fpaiv *PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue) AsLabelsItemValue() (*PolicySpec_ResourceIdentity_LabelInfo, bool) { 8455 res, ok := fpaiv.value.(*PolicySpec_ResourceIdentity_LabelInfo) 8456 return res, ok 8457 } 8458 func (fpaiv *PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue) AsNamePatternsItemValue() (string, bool) { 8459 res, ok := fpaiv.value.(string) 8460 return res, ok 8461 } 8462 8463 func (fpaiv *PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_ResourceIdentity) (interface{}, bool) { 8464 return nil, false 8465 } 8466 8467 func (fpaiv *PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 8468 return fpaiv.GetSingle(source.(*PolicySpec_ResourceIdentity)) 8469 } 8470 8471 // Contains returns a boolean indicating if value that is being held is present in given 'ResourceIdentity' 8472 func (fpaiv *PolicySpecResourceIdentity_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_ResourceIdentity) bool { 8473 slice := fpaiv.PolicySpecResourceIdentity_FieldTerminalPath.Get(source) 8474 for _, v := range slice { 8475 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 8476 if proto.Equal(asProtoMsg, v.(proto.Message)) { 8477 return true 8478 } 8479 } else if reflect.DeepEqual(v, fpaiv.value) { 8480 return true 8481 } 8482 } 8483 return false 8484 } 8485 8486 type PolicySpecResourceIdentity_FieldSubPathArrayItemValue struct { 8487 PolicySpecResourceIdentity_FieldPath 8488 subPathItemValue gotenobject.FieldPathArrayItemValue 8489 } 8490 8491 // GetRawValue returns stored array item value 8492 func (fpaivs *PolicySpecResourceIdentity_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 8493 return fpaivs.subPathItemValue.GetRawItemValue() 8494 } 8495 func (fpaivs *PolicySpecResourceIdentity_FieldSubPathArrayItemValue) AsLabelsPathItemValue() (PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue, bool) { 8496 res, ok := fpaivs.subPathItemValue.(PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue) 8497 return res, ok 8498 } 8499 8500 // Contains returns a boolean indicating if value that is being held is present in given 'ResourceIdentity' 8501 func (fpaivs *PolicySpecResourceIdentity_FieldSubPathArrayItemValue) ContainsValue(source *PolicySpec_ResourceIdentity) bool { 8502 switch fpaivs.Selector() { 8503 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8504 return false // repeated/map field 8505 default: 8506 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity: %d", fpaivs.Selector())) 8507 } 8508 } 8509 8510 // PolicySpecResourceIdentity_FieldPathArrayOfValues allows storing slice of values for ResourceIdentity fields according to their type 8511 type PolicySpecResourceIdentity_FieldPathArrayOfValues interface { 8512 gotenobject.FieldPathArrayOfValues 8513 PolicySpecResourceIdentity_FieldPath 8514 } 8515 8516 func ParsePolicySpecResourceIdentity_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecResourceIdentity_FieldPathArrayOfValues, error) { 8517 fp, err := ParsePolicySpecResourceIdentity_FieldPath(pathStr) 8518 if err != nil { 8519 return nil, err 8520 } 8521 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 8522 if err != nil { 8523 return nil, status.Errorf(codes.InvalidArgument, "error parsing ResourceIdentity field path array of values from %s: %v", valuesStr, err) 8524 } 8525 return fpaov.(PolicySpecResourceIdentity_FieldPathArrayOfValues), nil 8526 } 8527 8528 func MustParsePolicySpecResourceIdentity_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecResourceIdentity_FieldPathArrayOfValues { 8529 fpaov, err := ParsePolicySpecResourceIdentity_FieldPathArrayOfValues(pathStr, valuesStr) 8530 if err != nil { 8531 panic(err) 8532 } 8533 return fpaov 8534 } 8535 8536 type PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues struct { 8537 PolicySpecResourceIdentity_FieldTerminalPath 8538 values interface{} 8539 } 8540 8541 var _ PolicySpecResourceIdentity_FieldPathArrayOfValues = (*PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues)(nil) 8542 8543 func (fpaov *PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 8544 switch fpaov.selector { 8545 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 8546 for _, v := range fpaov.values.([]*meta_resource.Reference) { 8547 values = append(values, v) 8548 } 8549 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 8550 for _, v := range fpaov.values.([][]*PolicySpec_ResourceIdentity_LabelInfo) { 8551 values = append(values, v) 8552 } 8553 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 8554 for _, v := range fpaov.values.([][]string) { 8555 values = append(values, v) 8556 } 8557 } 8558 return 8559 } 8560 func (fpaov *PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues) AsAlertingResourceArrayOfValues() ([]*meta_resource.Reference, bool) { 8561 res, ok := fpaov.values.([]*meta_resource.Reference) 8562 return res, ok 8563 } 8564 func (fpaov *PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues) AsLabelsArrayOfValues() ([][]*PolicySpec_ResourceIdentity_LabelInfo, bool) { 8565 res, ok := fpaov.values.([][]*PolicySpec_ResourceIdentity_LabelInfo) 8566 return res, ok 8567 } 8568 func (fpaov *PolicySpecResourceIdentity_FieldTerminalPathArrayOfValues) AsNamePatternsArrayOfValues() ([][]string, bool) { 8569 res, ok := fpaov.values.([][]string) 8570 return res, ok 8571 } 8572 8573 type PolicySpecResourceIdentity_FieldSubPathArrayOfValues struct { 8574 PolicySpecResourceIdentity_FieldPath 8575 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 8576 } 8577 8578 var _ PolicySpecResourceIdentity_FieldPathArrayOfValues = (*PolicySpecResourceIdentity_FieldSubPathArrayOfValues)(nil) 8579 8580 func (fpsaov *PolicySpecResourceIdentity_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 8581 return fpsaov.subPathArrayOfValues.GetRawValues() 8582 } 8583 func (fpsaov *PolicySpecResourceIdentity_FieldSubPathArrayOfValues) AsLabelsPathArrayOfValues() (PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues, bool) { 8584 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues) 8585 return res, ok 8586 } 8587 8588 // FieldPath provides implementation to handle 8589 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 8590 type PolicySpecSupportingAlertQuery_FieldPath interface { 8591 gotenobject.FieldPath 8592 Selector() PolicySpecSupportingAlertQuery_FieldPathSelector 8593 Get(source *PolicySpec_SupportingAlertQuery) []interface{} 8594 GetSingle(source *PolicySpec_SupportingAlertQuery) (interface{}, bool) 8595 ClearValue(item *PolicySpec_SupportingAlertQuery) 8596 8597 // Those methods build corresponding PolicySpecSupportingAlertQuery_FieldPathValue 8598 // (or array of values) and holds passed value. Panics if injected type is incorrect. 8599 WithIValue(value interface{}) PolicySpecSupportingAlertQuery_FieldPathValue 8600 WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQuery_FieldPathArrayOfValues 8601 WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQuery_FieldPathArrayItemValue 8602 } 8603 8604 type PolicySpecSupportingAlertQuery_FieldPathSelector int32 8605 8606 const ( 8607 PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery PolicySpecSupportingAlertQuery_FieldPathSelector = 0 8608 PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery PolicySpecSupportingAlertQuery_FieldPathSelector = 1 8609 PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery PolicySpecSupportingAlertQuery_FieldPathSelector = 2 8610 PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery PolicySpecSupportingAlertQuery_FieldPathSelector = 3 8611 ) 8612 8613 func (s PolicySpecSupportingAlertQuery_FieldPathSelector) String() string { 8614 switch s { 8615 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8616 return "ts_query" 8617 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8618 return "log_query" 8619 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8620 return "rest_get_query" 8621 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8622 return "rest_list_query" 8623 default: 8624 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", s)) 8625 } 8626 } 8627 8628 func BuildPolicySpecSupportingAlertQuery_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecSupportingAlertQuery_FieldPath, error) { 8629 if len(fp) == 0 { 8630 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_SupportingAlertQuery") 8631 } 8632 if len(fp) == 1 { 8633 switch fp[0] { 8634 case "ts_query", "tsQuery", "ts-query": 8635 return &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery}, nil 8636 case "log_query", "logQuery", "log-query": 8637 return &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery}, nil 8638 case "rest_get_query", "restGetQuery", "rest-get-query": 8639 return &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery}, nil 8640 case "rest_list_query", "restListQuery", "rest-list-query": 8641 return &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery}, nil 8642 } 8643 } else { 8644 switch fp[0] { 8645 case "ts_query", "tsQuery", "ts-query": 8646 if subpath, err := BuildPolicySpecSupportingAlertQueryTsQuery_FieldPath(fp[1:]); err != nil { 8647 return nil, err 8648 } else { 8649 return &PolicySpecSupportingAlertQuery_FieldSubPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery, subPath: subpath}, nil 8650 } 8651 case "log_query", "logQuery", "log-query": 8652 if subpath, err := BuildPolicySpecSupportingAlertQueryLogQuery_FieldPath(fp[1:]); err != nil { 8653 return nil, err 8654 } else { 8655 return &PolicySpecSupportingAlertQuery_FieldSubPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery, subPath: subpath}, nil 8656 } 8657 case "rest_get_query", "restGetQuery", "rest-get-query": 8658 if subpath, err := BuildPolicySpecSupportingAlertQueryRestGetQuery_FieldPath(fp[1:]); err != nil { 8659 return nil, err 8660 } else { 8661 return &PolicySpecSupportingAlertQuery_FieldSubPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery, subPath: subpath}, nil 8662 } 8663 case "rest_list_query", "restListQuery", "rest-list-query": 8664 if subpath, err := BuildPolicySpecSupportingAlertQueryRestListQuery_FieldPath(fp[1:]); err != nil { 8665 return nil, err 8666 } else { 8667 return &PolicySpecSupportingAlertQuery_FieldSubPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery, subPath: subpath}, nil 8668 } 8669 } 8670 } 8671 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_SupportingAlertQuery", fp) 8672 } 8673 8674 func ParsePolicySpecSupportingAlertQuery_FieldPath(rawField string) (PolicySpecSupportingAlertQuery_FieldPath, error) { 8675 fp, err := gotenobject.ParseRawFieldPath(rawField) 8676 if err != nil { 8677 return nil, err 8678 } 8679 return BuildPolicySpecSupportingAlertQuery_FieldPath(fp) 8680 } 8681 8682 func MustParsePolicySpecSupportingAlertQuery_FieldPath(rawField string) PolicySpecSupportingAlertQuery_FieldPath { 8683 fp, err := ParsePolicySpecSupportingAlertQuery_FieldPath(rawField) 8684 if err != nil { 8685 panic(err) 8686 } 8687 return fp 8688 } 8689 8690 type PolicySpecSupportingAlertQuery_FieldTerminalPath struct { 8691 selector PolicySpecSupportingAlertQuery_FieldPathSelector 8692 } 8693 8694 var _ PolicySpecSupportingAlertQuery_FieldPath = (*PolicySpecSupportingAlertQuery_FieldTerminalPath)(nil) 8695 8696 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) Selector() PolicySpecSupportingAlertQuery_FieldPathSelector { 8697 return fp.selector 8698 } 8699 8700 // String returns path representation in proto convention 8701 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) String() string { 8702 return fp.selector.String() 8703 } 8704 8705 // JSONString returns path representation is JSON convention 8706 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) JSONString() string { 8707 return strcase.ToLowerCamel(fp.String()) 8708 } 8709 8710 // Get returns all values pointed by specific field from source PolicySpec_SupportingAlertQuery 8711 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) Get(source *PolicySpec_SupportingAlertQuery) (values []interface{}) { 8712 if source != nil { 8713 switch fp.selector { 8714 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8715 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_TsQuery_); ok && source != nil { 8716 if source.TsQuery != nil { 8717 values = append(values, source.TsQuery) 8718 } 8719 } 8720 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8721 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_LogQuery_); ok && source != nil { 8722 if source.LogQuery != nil { 8723 values = append(values, source.LogQuery) 8724 } 8725 } 8726 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8727 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_); ok && source != nil { 8728 if source.RestGetQuery != nil { 8729 values = append(values, source.RestGetQuery) 8730 } 8731 } 8732 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8733 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_); ok && source != nil { 8734 if source.RestListQuery != nil { 8735 values = append(values, source.RestListQuery) 8736 } 8737 } 8738 default: 8739 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fp.selector)) 8740 } 8741 } 8742 return 8743 } 8744 8745 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 8746 return fp.Get(source.(*PolicySpec_SupportingAlertQuery)) 8747 } 8748 8749 // GetSingle returns value pointed by specific field of from source PolicySpec_SupportingAlertQuery 8750 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) GetSingle(source *PolicySpec_SupportingAlertQuery) (interface{}, bool) { 8751 switch fp.selector { 8752 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8753 // if object nil or oneof not active, return "default" type with false flag. 8754 if source == nil { 8755 return source.GetTsQuery(), false 8756 } 8757 _, oneOfSelected := source.Query.(*PolicySpec_SupportingAlertQuery_TsQuery_) 8758 if !oneOfSelected { 8759 return source.GetTsQuery(), false // to return "type" information 8760 } 8761 res := source.GetTsQuery() 8762 return res, res != nil 8763 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8764 // if object nil or oneof not active, return "default" type with false flag. 8765 if source == nil { 8766 return source.GetLogQuery(), false 8767 } 8768 _, oneOfSelected := source.Query.(*PolicySpec_SupportingAlertQuery_LogQuery_) 8769 if !oneOfSelected { 8770 return source.GetLogQuery(), false // to return "type" information 8771 } 8772 res := source.GetLogQuery() 8773 return res, res != nil 8774 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8775 // if object nil or oneof not active, return "default" type with false flag. 8776 if source == nil { 8777 return source.GetRestGetQuery(), false 8778 } 8779 _, oneOfSelected := source.Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_) 8780 if !oneOfSelected { 8781 return source.GetRestGetQuery(), false // to return "type" information 8782 } 8783 res := source.GetRestGetQuery() 8784 return res, res != nil 8785 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8786 // if object nil or oneof not active, return "default" type with false flag. 8787 if source == nil { 8788 return source.GetRestListQuery(), false 8789 } 8790 _, oneOfSelected := source.Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_) 8791 if !oneOfSelected { 8792 return source.GetRestListQuery(), false // to return "type" information 8793 } 8794 res := source.GetRestListQuery() 8795 return res, res != nil 8796 default: 8797 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fp.selector)) 8798 } 8799 } 8800 8801 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 8802 return fp.GetSingle(source.(*PolicySpec_SupportingAlertQuery)) 8803 } 8804 8805 // GetDefault returns a default value of the field type 8806 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) GetDefault() interface{} { 8807 switch fp.selector { 8808 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8809 return (*PolicySpec_SupportingAlertQuery_TsQuery)(nil) 8810 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8811 return (*PolicySpec_SupportingAlertQuery_LogQuery)(nil) 8812 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8813 return (*PolicySpec_SupportingAlertQuery_RestGetQuery)(nil) 8814 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8815 return (*PolicySpec_SupportingAlertQuery_RestListQuery)(nil) 8816 default: 8817 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fp.selector)) 8818 } 8819 } 8820 8821 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) ClearValue(item *PolicySpec_SupportingAlertQuery) { 8822 if item != nil { 8823 switch fp.selector { 8824 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8825 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_TsQuery_); ok { 8826 item.TsQuery = nil 8827 } 8828 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8829 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_LogQuery_); ok { 8830 item.LogQuery = nil 8831 } 8832 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8833 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_); ok { 8834 item.RestGetQuery = nil 8835 } 8836 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8837 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_); ok { 8838 item.RestListQuery = nil 8839 } 8840 default: 8841 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fp.selector)) 8842 } 8843 } 8844 } 8845 8846 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 8847 fp.ClearValue(item.(*PolicySpec_SupportingAlertQuery)) 8848 } 8849 8850 // IsLeaf - whether field path is holds simple value 8851 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) IsLeaf() bool { 8852 return false 8853 } 8854 8855 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 8856 return []gotenobject.FieldPath{fp} 8857 } 8858 8859 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) WithIValue(value interface{}) PolicySpecSupportingAlertQuery_FieldPathValue { 8860 switch fp.selector { 8861 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8862 return &PolicySpecSupportingAlertQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, value: value.(*PolicySpec_SupportingAlertQuery_TsQuery)} 8863 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8864 return &PolicySpecSupportingAlertQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, value: value.(*PolicySpec_SupportingAlertQuery_LogQuery)} 8865 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8866 return &PolicySpecSupportingAlertQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, value: value.(*PolicySpec_SupportingAlertQuery_RestGetQuery)} 8867 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8868 return &PolicySpecSupportingAlertQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, value: value.(*PolicySpec_SupportingAlertQuery_RestListQuery)} 8869 default: 8870 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fp.selector)) 8871 } 8872 } 8873 8874 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 8875 return fp.WithIValue(value) 8876 } 8877 8878 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQuery_FieldPathArrayOfValues { 8879 fpaov := &PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp} 8880 switch fp.selector { 8881 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8882 return &PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, values: values.([]*PolicySpec_SupportingAlertQuery_TsQuery)} 8883 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8884 return &PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, values: values.([]*PolicySpec_SupportingAlertQuery_LogQuery)} 8885 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8886 return &PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, values: values.([]*PolicySpec_SupportingAlertQuery_RestGetQuery)} 8887 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8888 return &PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQuery_FieldTerminalPath: *fp, values: values.([]*PolicySpec_SupportingAlertQuery_RestListQuery)} 8889 default: 8890 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fp.selector)) 8891 } 8892 return fpaov 8893 } 8894 8895 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 8896 return fp.WithIArrayOfValues(values) 8897 } 8898 8899 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQuery_FieldPathArrayItemValue { 8900 switch fp.selector { 8901 default: 8902 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fp.selector)) 8903 } 8904 } 8905 8906 func (fp *PolicySpecSupportingAlertQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 8907 return fp.WithIArrayItemValue(value) 8908 } 8909 8910 type PolicySpecSupportingAlertQuery_FieldSubPath struct { 8911 selector PolicySpecSupportingAlertQuery_FieldPathSelector 8912 subPath gotenobject.FieldPath 8913 } 8914 8915 var _ PolicySpecSupportingAlertQuery_FieldPath = (*PolicySpecSupportingAlertQuery_FieldSubPath)(nil) 8916 8917 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) Selector() PolicySpecSupportingAlertQuery_FieldPathSelector { 8918 return fps.selector 8919 } 8920 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) AsTsQuerySubPath() (PolicySpecSupportingAlertQueryTsQuery_FieldPath, bool) { 8921 res, ok := fps.subPath.(PolicySpecSupportingAlertQueryTsQuery_FieldPath) 8922 return res, ok 8923 } 8924 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) AsLogQuerySubPath() (PolicySpecSupportingAlertQueryLogQuery_FieldPath, bool) { 8925 res, ok := fps.subPath.(PolicySpecSupportingAlertQueryLogQuery_FieldPath) 8926 return res, ok 8927 } 8928 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) AsRestGetQuerySubPath() (PolicySpecSupportingAlertQueryRestGetQuery_FieldPath, bool) { 8929 res, ok := fps.subPath.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPath) 8930 return res, ok 8931 } 8932 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) AsRestListQuerySubPath() (PolicySpecSupportingAlertQueryRestListQuery_FieldPath, bool) { 8933 res, ok := fps.subPath.(PolicySpecSupportingAlertQueryRestListQuery_FieldPath) 8934 return res, ok 8935 } 8936 8937 // String returns path representation in proto convention 8938 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) String() string { 8939 return fps.selector.String() + "." + fps.subPath.String() 8940 } 8941 8942 // JSONString returns path representation is JSON convention 8943 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) JSONString() string { 8944 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 8945 } 8946 8947 // Get returns all values pointed by selected field from source PolicySpec_SupportingAlertQuery 8948 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) Get(source *PolicySpec_SupportingAlertQuery) (values []interface{}) { 8949 switch fps.selector { 8950 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8951 values = append(values, fps.subPath.GetRaw(source.GetTsQuery())...) 8952 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8953 values = append(values, fps.subPath.GetRaw(source.GetLogQuery())...) 8954 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8955 values = append(values, fps.subPath.GetRaw(source.GetRestGetQuery())...) 8956 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8957 values = append(values, fps.subPath.GetRaw(source.GetRestListQuery())...) 8958 default: 8959 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fps.selector)) 8960 } 8961 return 8962 } 8963 8964 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) GetRaw(source proto.Message) []interface{} { 8965 return fps.Get(source.(*PolicySpec_SupportingAlertQuery)) 8966 } 8967 8968 // GetSingle returns value of selected field from source PolicySpec_SupportingAlertQuery 8969 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) GetSingle(source *PolicySpec_SupportingAlertQuery) (interface{}, bool) { 8970 switch fps.selector { 8971 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 8972 if source.GetTsQuery() == nil { 8973 return nil, false 8974 } 8975 return fps.subPath.GetSingleRaw(source.GetTsQuery()) 8976 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 8977 if source.GetLogQuery() == nil { 8978 return nil, false 8979 } 8980 return fps.subPath.GetSingleRaw(source.GetLogQuery()) 8981 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 8982 if source.GetRestGetQuery() == nil { 8983 return nil, false 8984 } 8985 return fps.subPath.GetSingleRaw(source.GetRestGetQuery()) 8986 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 8987 if source.GetRestListQuery() == nil { 8988 return nil, false 8989 } 8990 return fps.subPath.GetSingleRaw(source.GetRestListQuery()) 8991 default: 8992 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fps.selector)) 8993 } 8994 } 8995 8996 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 8997 return fps.GetSingle(source.(*PolicySpec_SupportingAlertQuery)) 8998 } 8999 9000 // GetDefault returns a default value of the field type 9001 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) GetDefault() interface{} { 9002 return fps.subPath.GetDefault() 9003 } 9004 9005 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) ClearValue(item *PolicySpec_SupportingAlertQuery) { 9006 if item != nil { 9007 switch fps.selector { 9008 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 9009 if item.Query != nil { 9010 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_TsQuery_); ok { 9011 fps.subPath.ClearValueRaw(item.TsQuery) 9012 } 9013 } 9014 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 9015 if item.Query != nil { 9016 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_LogQuery_); ok { 9017 fps.subPath.ClearValueRaw(item.LogQuery) 9018 } 9019 } 9020 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 9021 if item.Query != nil { 9022 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_); ok { 9023 fps.subPath.ClearValueRaw(item.RestGetQuery) 9024 } 9025 } 9026 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 9027 if item.Query != nil { 9028 if item, ok := item.Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_); ok { 9029 fps.subPath.ClearValueRaw(item.RestListQuery) 9030 } 9031 } 9032 default: 9033 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fps.selector)) 9034 } 9035 } 9036 } 9037 9038 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) ClearValueRaw(item proto.Message) { 9039 fps.ClearValue(item.(*PolicySpec_SupportingAlertQuery)) 9040 } 9041 9042 // IsLeaf - whether field path is holds simple value 9043 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) IsLeaf() bool { 9044 return fps.subPath.IsLeaf() 9045 } 9046 9047 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 9048 iPaths := []gotenobject.FieldPath{&PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: fps.selector}} 9049 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 9050 return iPaths 9051 } 9052 9053 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) WithIValue(value interface{}) PolicySpecSupportingAlertQuery_FieldPathValue { 9054 return &PolicySpecSupportingAlertQuery_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 9055 } 9056 9057 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 9058 return fps.WithIValue(value) 9059 } 9060 9061 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQuery_FieldPathArrayOfValues { 9062 return &PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 9063 } 9064 9065 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 9066 return fps.WithIArrayOfValues(values) 9067 } 9068 9069 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQuery_FieldPathArrayItemValue { 9070 return &PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 9071 } 9072 9073 func (fps *PolicySpecSupportingAlertQuery_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 9074 return fps.WithIArrayItemValue(value) 9075 } 9076 9077 // PolicySpecSupportingAlertQuery_FieldPathValue allows storing values for SupportingAlertQuery fields according to their type 9078 type PolicySpecSupportingAlertQuery_FieldPathValue interface { 9079 PolicySpecSupportingAlertQuery_FieldPath 9080 gotenobject.FieldPathValue 9081 SetTo(target **PolicySpec_SupportingAlertQuery) 9082 CompareWith(*PolicySpec_SupportingAlertQuery) (cmp int, comparable bool) 9083 } 9084 9085 func ParsePolicySpecSupportingAlertQuery_FieldPathValue(pathStr, valueStr string) (PolicySpecSupportingAlertQuery_FieldPathValue, error) { 9086 fp, err := ParsePolicySpecSupportingAlertQuery_FieldPath(pathStr) 9087 if err != nil { 9088 return nil, err 9089 } 9090 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 9091 if err != nil { 9092 return nil, status.Errorf(codes.InvalidArgument, "error parsing SupportingAlertQuery field path value from %s: %v", valueStr, err) 9093 } 9094 return fpv.(PolicySpecSupportingAlertQuery_FieldPathValue), nil 9095 } 9096 9097 func MustParsePolicySpecSupportingAlertQuery_FieldPathValue(pathStr, valueStr string) PolicySpecSupportingAlertQuery_FieldPathValue { 9098 fpv, err := ParsePolicySpecSupportingAlertQuery_FieldPathValue(pathStr, valueStr) 9099 if err != nil { 9100 panic(err) 9101 } 9102 return fpv 9103 } 9104 9105 type PolicySpecSupportingAlertQuery_FieldTerminalPathValue struct { 9106 PolicySpecSupportingAlertQuery_FieldTerminalPath 9107 value interface{} 9108 } 9109 9110 var _ PolicySpecSupportingAlertQuery_FieldPathValue = (*PolicySpecSupportingAlertQuery_FieldTerminalPathValue)(nil) 9111 9112 // GetRawValue returns raw value stored under selected path for 'SupportingAlertQuery' as interface{} 9113 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) GetRawValue() interface{} { 9114 return fpv.value 9115 } 9116 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) AsTsQueryValue() (*PolicySpec_SupportingAlertQuery_TsQuery, bool) { 9117 res, ok := fpv.value.(*PolicySpec_SupportingAlertQuery_TsQuery) 9118 return res, ok 9119 } 9120 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) AsLogQueryValue() (*PolicySpec_SupportingAlertQuery_LogQuery, bool) { 9121 res, ok := fpv.value.(*PolicySpec_SupportingAlertQuery_LogQuery) 9122 return res, ok 9123 } 9124 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) AsRestGetQueryValue() (*PolicySpec_SupportingAlertQuery_RestGetQuery, bool) { 9125 res, ok := fpv.value.(*PolicySpec_SupportingAlertQuery_RestGetQuery) 9126 return res, ok 9127 } 9128 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) AsRestListQueryValue() (*PolicySpec_SupportingAlertQuery_RestListQuery, bool) { 9129 res, ok := fpv.value.(*PolicySpec_SupportingAlertQuery_RestListQuery) 9130 return res, ok 9131 } 9132 9133 // SetTo stores value for selected field for object SupportingAlertQuery 9134 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) SetTo(target **PolicySpec_SupportingAlertQuery) { 9135 if *target == nil { 9136 *target = new(PolicySpec_SupportingAlertQuery) 9137 } 9138 switch fpv.selector { 9139 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 9140 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_TsQuery_); !ok { 9141 (*target).Query = &PolicySpec_SupportingAlertQuery_TsQuery_{} 9142 } 9143 (*target).Query.(*PolicySpec_SupportingAlertQuery_TsQuery_).TsQuery = fpv.value.(*PolicySpec_SupportingAlertQuery_TsQuery) 9144 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 9145 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_LogQuery_); !ok { 9146 (*target).Query = &PolicySpec_SupportingAlertQuery_LogQuery_{} 9147 } 9148 (*target).Query.(*PolicySpec_SupportingAlertQuery_LogQuery_).LogQuery = fpv.value.(*PolicySpec_SupportingAlertQuery_LogQuery) 9149 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 9150 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_); !ok { 9151 (*target).Query = &PolicySpec_SupportingAlertQuery_RestGetQuery_{} 9152 } 9153 (*target).Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_).RestGetQuery = fpv.value.(*PolicySpec_SupportingAlertQuery_RestGetQuery) 9154 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 9155 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_); !ok { 9156 (*target).Query = &PolicySpec_SupportingAlertQuery_RestListQuery_{} 9157 } 9158 (*target).Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_).RestListQuery = fpv.value.(*PolicySpec_SupportingAlertQuery_RestListQuery) 9159 default: 9160 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fpv.selector)) 9161 } 9162 } 9163 9164 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 9165 typedObject := target.(*PolicySpec_SupportingAlertQuery) 9166 fpv.SetTo(&typedObject) 9167 } 9168 9169 // CompareWith compares value in the 'PolicySpecSupportingAlertQuery_FieldTerminalPathValue' with the value under path in 'PolicySpec_SupportingAlertQuery'. 9170 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) CompareWith(source *PolicySpec_SupportingAlertQuery) (int, bool) { 9171 switch fpv.selector { 9172 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 9173 return 0, false 9174 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 9175 return 0, false 9176 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 9177 return 0, false 9178 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 9179 return 0, false 9180 default: 9181 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fpv.selector)) 9182 } 9183 } 9184 9185 func (fpv *PolicySpecSupportingAlertQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 9186 return fpv.CompareWith(source.(*PolicySpec_SupportingAlertQuery)) 9187 } 9188 9189 type PolicySpecSupportingAlertQuery_FieldSubPathValue struct { 9190 PolicySpecSupportingAlertQuery_FieldPath 9191 subPathValue gotenobject.FieldPathValue 9192 } 9193 9194 var _ PolicySpecSupportingAlertQuery_FieldPathValue = (*PolicySpecSupportingAlertQuery_FieldSubPathValue)(nil) 9195 9196 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) AsTsQueryPathValue() (PolicySpecSupportingAlertQueryTsQuery_FieldPathValue, bool) { 9197 res, ok := fpvs.subPathValue.(PolicySpecSupportingAlertQueryTsQuery_FieldPathValue) 9198 return res, ok 9199 } 9200 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) AsLogQueryPathValue() (PolicySpecSupportingAlertQueryLogQuery_FieldPathValue, bool) { 9201 res, ok := fpvs.subPathValue.(PolicySpecSupportingAlertQueryLogQuery_FieldPathValue) 9202 return res, ok 9203 } 9204 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) AsRestGetQueryPathValue() (PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue, bool) { 9205 res, ok := fpvs.subPathValue.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue) 9206 return res, ok 9207 } 9208 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) AsRestListQueryPathValue() (PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue, bool) { 9209 res, ok := fpvs.subPathValue.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue) 9210 return res, ok 9211 } 9212 9213 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) SetTo(target **PolicySpec_SupportingAlertQuery) { 9214 if *target == nil { 9215 *target = new(PolicySpec_SupportingAlertQuery) 9216 } 9217 switch fpvs.Selector() { 9218 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 9219 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_TsQuery_); !ok { 9220 (*target).Query = &PolicySpec_SupportingAlertQuery_TsQuery_{} 9221 } 9222 fpvs.subPathValue.(PolicySpecSupportingAlertQueryTsQuery_FieldPathValue).SetTo(&(*target).Query.(*PolicySpec_SupportingAlertQuery_TsQuery_).TsQuery) 9223 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 9224 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_LogQuery_); !ok { 9225 (*target).Query = &PolicySpec_SupportingAlertQuery_LogQuery_{} 9226 } 9227 fpvs.subPathValue.(PolicySpecSupportingAlertQueryLogQuery_FieldPathValue).SetTo(&(*target).Query.(*PolicySpec_SupportingAlertQuery_LogQuery_).LogQuery) 9228 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 9229 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_); !ok { 9230 (*target).Query = &PolicySpec_SupportingAlertQuery_RestGetQuery_{} 9231 } 9232 fpvs.subPathValue.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue).SetTo(&(*target).Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_).RestGetQuery) 9233 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 9234 if _, ok := (*target).Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_); !ok { 9235 (*target).Query = &PolicySpec_SupportingAlertQuery_RestListQuery_{} 9236 } 9237 fpvs.subPathValue.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue).SetTo(&(*target).Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_).RestListQuery) 9238 default: 9239 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fpvs.Selector())) 9240 } 9241 } 9242 9243 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) SetToRaw(target proto.Message) { 9244 typedObject := target.(*PolicySpec_SupportingAlertQuery) 9245 fpvs.SetTo(&typedObject) 9246 } 9247 9248 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) GetRawValue() interface{} { 9249 return fpvs.subPathValue.GetRawValue() 9250 } 9251 9252 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) CompareWith(source *PolicySpec_SupportingAlertQuery) (int, bool) { 9253 switch fpvs.Selector() { 9254 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 9255 return fpvs.subPathValue.(PolicySpecSupportingAlertQueryTsQuery_FieldPathValue).CompareWith(source.GetTsQuery()) 9256 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 9257 return fpvs.subPathValue.(PolicySpecSupportingAlertQueryLogQuery_FieldPathValue).CompareWith(source.GetLogQuery()) 9258 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 9259 return fpvs.subPathValue.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue).CompareWith(source.GetRestGetQuery()) 9260 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 9261 return fpvs.subPathValue.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue).CompareWith(source.GetRestListQuery()) 9262 default: 9263 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fpvs.Selector())) 9264 } 9265 } 9266 9267 func (fpvs *PolicySpecSupportingAlertQuery_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 9268 return fpvs.CompareWith(source.(*PolicySpec_SupportingAlertQuery)) 9269 } 9270 9271 // PolicySpecSupportingAlertQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for SupportingAlertQuery according to their type 9272 // Present only for array (repeated) types. 9273 type PolicySpecSupportingAlertQuery_FieldPathArrayItemValue interface { 9274 gotenobject.FieldPathArrayItemValue 9275 PolicySpecSupportingAlertQuery_FieldPath 9276 ContainsValue(*PolicySpec_SupportingAlertQuery) bool 9277 } 9278 9279 // ParsePolicySpecSupportingAlertQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 9280 func ParsePolicySpecSupportingAlertQuery_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecSupportingAlertQuery_FieldPathArrayItemValue, error) { 9281 fp, err := ParsePolicySpecSupportingAlertQuery_FieldPath(pathStr) 9282 if err != nil { 9283 return nil, err 9284 } 9285 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 9286 if err != nil { 9287 return nil, status.Errorf(codes.InvalidArgument, "error parsing SupportingAlertQuery field path array item value from %s: %v", valueStr, err) 9288 } 9289 return fpaiv.(PolicySpecSupportingAlertQuery_FieldPathArrayItemValue), nil 9290 } 9291 9292 func MustParsePolicySpecSupportingAlertQuery_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecSupportingAlertQuery_FieldPathArrayItemValue { 9293 fpaiv, err := ParsePolicySpecSupportingAlertQuery_FieldPathArrayItemValue(pathStr, valueStr) 9294 if err != nil { 9295 panic(err) 9296 } 9297 return fpaiv 9298 } 9299 9300 type PolicySpecSupportingAlertQuery_FieldTerminalPathArrayItemValue struct { 9301 PolicySpecSupportingAlertQuery_FieldTerminalPath 9302 value interface{} 9303 } 9304 9305 var _ PolicySpecSupportingAlertQuery_FieldPathArrayItemValue = (*PolicySpecSupportingAlertQuery_FieldTerminalPathArrayItemValue)(nil) 9306 9307 // GetRawValue returns stored element value for array in object PolicySpec_SupportingAlertQuery as interface{} 9308 func (fpaiv *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 9309 return fpaiv.value 9310 } 9311 9312 func (fpaiv *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_SupportingAlertQuery) (interface{}, bool) { 9313 return nil, false 9314 } 9315 9316 func (fpaiv *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 9317 return fpaiv.GetSingle(source.(*PolicySpec_SupportingAlertQuery)) 9318 } 9319 9320 // Contains returns a boolean indicating if value that is being held is present in given 'SupportingAlertQuery' 9321 func (fpaiv *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_SupportingAlertQuery) bool { 9322 slice := fpaiv.PolicySpecSupportingAlertQuery_FieldTerminalPath.Get(source) 9323 for _, v := range slice { 9324 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 9325 if proto.Equal(asProtoMsg, v.(proto.Message)) { 9326 return true 9327 } 9328 } else if reflect.DeepEqual(v, fpaiv.value) { 9329 return true 9330 } 9331 } 9332 return false 9333 } 9334 9335 type PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue struct { 9336 PolicySpecSupportingAlertQuery_FieldPath 9337 subPathItemValue gotenobject.FieldPathArrayItemValue 9338 } 9339 9340 // GetRawValue returns stored array item value 9341 func (fpaivs *PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 9342 return fpaivs.subPathItemValue.GetRawItemValue() 9343 } 9344 func (fpaivs *PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue) AsTsQueryPathItemValue() (PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue, bool) { 9345 res, ok := fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue) 9346 return res, ok 9347 } 9348 func (fpaivs *PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue) AsLogQueryPathItemValue() (PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue, bool) { 9349 res, ok := fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue) 9350 return res, ok 9351 } 9352 func (fpaivs *PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue) AsRestGetQueryPathItemValue() (PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue, bool) { 9353 res, ok := fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue) 9354 return res, ok 9355 } 9356 func (fpaivs *PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue) AsRestListQueryPathItemValue() (PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue, bool) { 9357 res, ok := fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue) 9358 return res, ok 9359 } 9360 9361 // Contains returns a boolean indicating if value that is being held is present in given 'SupportingAlertQuery' 9362 func (fpaivs *PolicySpecSupportingAlertQuery_FieldSubPathArrayItemValue) ContainsValue(source *PolicySpec_SupportingAlertQuery) bool { 9363 switch fpaivs.Selector() { 9364 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 9365 return fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue).ContainsValue(source.GetTsQuery()) 9366 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 9367 return fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue).ContainsValue(source.GetLogQuery()) 9368 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 9369 return fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue).ContainsValue(source.GetRestGetQuery()) 9370 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 9371 return fpaivs.subPathItemValue.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue).ContainsValue(source.GetRestListQuery()) 9372 default: 9373 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery: %d", fpaivs.Selector())) 9374 } 9375 } 9376 9377 // PolicySpecSupportingAlertQuery_FieldPathArrayOfValues allows storing slice of values for SupportingAlertQuery fields according to their type 9378 type PolicySpecSupportingAlertQuery_FieldPathArrayOfValues interface { 9379 gotenobject.FieldPathArrayOfValues 9380 PolicySpecSupportingAlertQuery_FieldPath 9381 } 9382 9383 func ParsePolicySpecSupportingAlertQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecSupportingAlertQuery_FieldPathArrayOfValues, error) { 9384 fp, err := ParsePolicySpecSupportingAlertQuery_FieldPath(pathStr) 9385 if err != nil { 9386 return nil, err 9387 } 9388 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 9389 if err != nil { 9390 return nil, status.Errorf(codes.InvalidArgument, "error parsing SupportingAlertQuery field path array of values from %s: %v", valuesStr, err) 9391 } 9392 return fpaov.(PolicySpecSupportingAlertQuery_FieldPathArrayOfValues), nil 9393 } 9394 9395 func MustParsePolicySpecSupportingAlertQuery_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecSupportingAlertQuery_FieldPathArrayOfValues { 9396 fpaov, err := ParsePolicySpecSupportingAlertQuery_FieldPathArrayOfValues(pathStr, valuesStr) 9397 if err != nil { 9398 panic(err) 9399 } 9400 return fpaov 9401 } 9402 9403 type PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues struct { 9404 PolicySpecSupportingAlertQuery_FieldTerminalPath 9405 values interface{} 9406 } 9407 9408 var _ PolicySpecSupportingAlertQuery_FieldPathArrayOfValues = (*PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues)(nil) 9409 9410 func (fpaov *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 9411 switch fpaov.selector { 9412 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 9413 for _, v := range fpaov.values.([]*PolicySpec_SupportingAlertQuery_TsQuery) { 9414 values = append(values, v) 9415 } 9416 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 9417 for _, v := range fpaov.values.([]*PolicySpec_SupportingAlertQuery_LogQuery) { 9418 values = append(values, v) 9419 } 9420 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 9421 for _, v := range fpaov.values.([]*PolicySpec_SupportingAlertQuery_RestGetQuery) { 9422 values = append(values, v) 9423 } 9424 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 9425 for _, v := range fpaov.values.([]*PolicySpec_SupportingAlertQuery_RestListQuery) { 9426 values = append(values, v) 9427 } 9428 } 9429 return 9430 } 9431 func (fpaov *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues) AsTsQueryArrayOfValues() ([]*PolicySpec_SupportingAlertQuery_TsQuery, bool) { 9432 res, ok := fpaov.values.([]*PolicySpec_SupportingAlertQuery_TsQuery) 9433 return res, ok 9434 } 9435 func (fpaov *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues) AsLogQueryArrayOfValues() ([]*PolicySpec_SupportingAlertQuery_LogQuery, bool) { 9436 res, ok := fpaov.values.([]*PolicySpec_SupportingAlertQuery_LogQuery) 9437 return res, ok 9438 } 9439 func (fpaov *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues) AsRestGetQueryArrayOfValues() ([]*PolicySpec_SupportingAlertQuery_RestGetQuery, bool) { 9440 res, ok := fpaov.values.([]*PolicySpec_SupportingAlertQuery_RestGetQuery) 9441 return res, ok 9442 } 9443 func (fpaov *PolicySpecSupportingAlertQuery_FieldTerminalPathArrayOfValues) AsRestListQueryArrayOfValues() ([]*PolicySpec_SupportingAlertQuery_RestListQuery, bool) { 9444 res, ok := fpaov.values.([]*PolicySpec_SupportingAlertQuery_RestListQuery) 9445 return res, ok 9446 } 9447 9448 type PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues struct { 9449 PolicySpecSupportingAlertQuery_FieldPath 9450 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 9451 } 9452 9453 var _ PolicySpecSupportingAlertQuery_FieldPathArrayOfValues = (*PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues)(nil) 9454 9455 func (fpsaov *PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 9456 return fpsaov.subPathArrayOfValues.GetRawValues() 9457 } 9458 func (fpsaov *PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues) AsTsQueryPathArrayOfValues() (PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues, bool) { 9459 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues) 9460 return res, ok 9461 } 9462 func (fpsaov *PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues) AsLogQueryPathArrayOfValues() (PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues, bool) { 9463 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues) 9464 return res, ok 9465 } 9466 func (fpsaov *PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues) AsRestGetQueryPathArrayOfValues() (PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues, bool) { 9467 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues) 9468 return res, ok 9469 } 9470 func (fpsaov *PolicySpecSupportingAlertQuery_FieldSubPathArrayOfValues) AsRestListQueryPathArrayOfValues() (PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues, bool) { 9471 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues) 9472 return res, ok 9473 } 9474 9475 // FieldPath provides implementation to handle 9476 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 9477 type PolicySpecAIAgentHandling_FieldPath interface { 9478 gotenobject.FieldPath 9479 Selector() PolicySpecAIAgentHandling_FieldPathSelector 9480 Get(source *PolicySpec_AIAgentHandling) []interface{} 9481 GetSingle(source *PolicySpec_AIAgentHandling) (interface{}, bool) 9482 ClearValue(item *PolicySpec_AIAgentHandling) 9483 9484 // Those methods build corresponding PolicySpecAIAgentHandling_FieldPathValue 9485 // (or array of values) and holds passed value. Panics if injected type is incorrect. 9486 WithIValue(value interface{}) PolicySpecAIAgentHandling_FieldPathValue 9487 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandling_FieldPathArrayOfValues 9488 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandling_FieldPathArrayItemValue 9489 } 9490 9491 type PolicySpecAIAgentHandling_FieldPathSelector int32 9492 9493 const ( 9494 PolicySpecAIAgentHandling_FieldPathSelectorEnabled PolicySpecAIAgentHandling_FieldPathSelector = 0 9495 PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity PolicySpecAIAgentHandling_FieldPathSelector = 1 9496 PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation PolicySpecAIAgentHandling_FieldPathSelector = 2 9497 PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity PolicySpecAIAgentHandling_FieldPathSelector = 3 9498 PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions PolicySpecAIAgentHandling_FieldPathSelector = 4 9499 ) 9500 9501 func (s PolicySpecAIAgentHandling_FieldPathSelector) String() string { 9502 switch s { 9503 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9504 return "enabled" 9505 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9506 return "enabled_connectivity" 9507 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9508 return "auto_accept_remediation" 9509 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9510 return "edge_connectivity" 9511 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9512 return "remediation_options" 9513 default: 9514 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", s)) 9515 } 9516 } 9517 9518 func BuildPolicySpecAIAgentHandling_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandling_FieldPath, error) { 9519 if len(fp) == 0 { 9520 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling") 9521 } 9522 if len(fp) == 1 { 9523 switch fp[0] { 9524 case "enabled": 9525 return &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorEnabled}, nil 9526 case "enabled_connectivity", "enabledConnectivity", "enabled-connectivity": 9527 return &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity}, nil 9528 case "auto_accept_remediation", "autoAcceptRemediation", "auto-accept-remediation": 9529 return &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation}, nil 9530 case "edge_connectivity", "edgeConnectivity", "edge-connectivity": 9531 return &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity}, nil 9532 case "remediation_options", "remediationOptions", "remediation-options": 9533 return &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions}, nil 9534 } 9535 } else { 9536 switch fp[0] { 9537 case "edge_connectivity", "edgeConnectivity", "edge-connectivity": 9538 if subpath, err := BuildPolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(fp[1:]); err != nil { 9539 return nil, err 9540 } else { 9541 return &PolicySpecAIAgentHandling_FieldSubPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity, subPath: subpath}, nil 9542 } 9543 case "remediation_options", "remediationOptions", "remediation-options": 9544 if subpath, err := BuildPolicySpecAIAgentHandlingRemediation_FieldPath(fp[1:]); err != nil { 9545 return nil, err 9546 } else { 9547 return &PolicySpecAIAgentHandling_FieldSubPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions, subPath: subpath}, nil 9548 } 9549 } 9550 } 9551 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling", fp) 9552 } 9553 9554 func ParsePolicySpecAIAgentHandling_FieldPath(rawField string) (PolicySpecAIAgentHandling_FieldPath, error) { 9555 fp, err := gotenobject.ParseRawFieldPath(rawField) 9556 if err != nil { 9557 return nil, err 9558 } 9559 return BuildPolicySpecAIAgentHandling_FieldPath(fp) 9560 } 9561 9562 func MustParsePolicySpecAIAgentHandling_FieldPath(rawField string) PolicySpecAIAgentHandling_FieldPath { 9563 fp, err := ParsePolicySpecAIAgentHandling_FieldPath(rawField) 9564 if err != nil { 9565 panic(err) 9566 } 9567 return fp 9568 } 9569 9570 type PolicySpecAIAgentHandling_FieldTerminalPath struct { 9571 selector PolicySpecAIAgentHandling_FieldPathSelector 9572 } 9573 9574 var _ PolicySpecAIAgentHandling_FieldPath = (*PolicySpecAIAgentHandling_FieldTerminalPath)(nil) 9575 9576 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) Selector() PolicySpecAIAgentHandling_FieldPathSelector { 9577 return fp.selector 9578 } 9579 9580 // String returns path representation in proto convention 9581 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) String() string { 9582 return fp.selector.String() 9583 } 9584 9585 // JSONString returns path representation is JSON convention 9586 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) JSONString() string { 9587 return strcase.ToLowerCamel(fp.String()) 9588 } 9589 9590 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling 9591 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling) (values []interface{}) { 9592 if source != nil { 9593 switch fp.selector { 9594 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9595 values = append(values, source.Enabled) 9596 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9597 values = append(values, source.EnabledConnectivity) 9598 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9599 values = append(values, source.AutoAcceptRemediation) 9600 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9601 if source.EdgeConnectivity != nil { 9602 values = append(values, source.EdgeConnectivity) 9603 } 9604 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9605 for _, value := range source.GetRemediationOptions() { 9606 values = append(values, value) 9607 } 9608 default: 9609 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fp.selector)) 9610 } 9611 } 9612 return 9613 } 9614 9615 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 9616 return fp.Get(source.(*PolicySpec_AIAgentHandling)) 9617 } 9618 9619 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling 9620 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling) (interface{}, bool) { 9621 switch fp.selector { 9622 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9623 return source.GetEnabled(), source != nil 9624 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9625 return source.GetEnabledConnectivity(), source != nil 9626 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9627 return source.GetAutoAcceptRemediation(), source != nil 9628 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9629 res := source.GetEdgeConnectivity() 9630 return res, res != nil 9631 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9632 res := source.GetRemediationOptions() 9633 return res, res != nil 9634 default: 9635 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fp.selector)) 9636 } 9637 } 9638 9639 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 9640 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling)) 9641 } 9642 9643 // GetDefault returns a default value of the field type 9644 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) GetDefault() interface{} { 9645 switch fp.selector { 9646 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9647 return false 9648 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9649 return false 9650 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9651 return false 9652 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9653 return (*PolicySpec_AIAgentHandling_EdgeConnectivity)(nil) 9654 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9655 return ([]*PolicySpec_AIAgentHandling_Remediation)(nil) 9656 default: 9657 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fp.selector)) 9658 } 9659 } 9660 9661 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling) { 9662 if item != nil { 9663 switch fp.selector { 9664 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9665 item.Enabled = false 9666 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9667 item.EnabledConnectivity = false 9668 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9669 item.AutoAcceptRemediation = false 9670 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9671 item.EdgeConnectivity = nil 9672 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9673 item.RemediationOptions = nil 9674 default: 9675 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fp.selector)) 9676 } 9677 } 9678 } 9679 9680 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) ClearValueRaw(item proto.Message) { 9681 fp.ClearValue(item.(*PolicySpec_AIAgentHandling)) 9682 } 9683 9684 // IsLeaf - whether field path is holds simple value 9685 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) IsLeaf() bool { 9686 return fp.selector == PolicySpecAIAgentHandling_FieldPathSelectorEnabled || 9687 fp.selector == PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity || 9688 fp.selector == PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation 9689 } 9690 9691 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 9692 return []gotenobject.FieldPath{fp} 9693 } 9694 9695 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandling_FieldPathValue { 9696 switch fp.selector { 9697 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9698 return &PolicySpecAIAgentHandling_FieldTerminalPathValue{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, value: value.(bool)} 9699 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9700 return &PolicySpecAIAgentHandling_FieldTerminalPathValue{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, value: value.(bool)} 9701 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9702 return &PolicySpecAIAgentHandling_FieldTerminalPathValue{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, value: value.(bool)} 9703 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9704 return &PolicySpecAIAgentHandling_FieldTerminalPathValue{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling_EdgeConnectivity)} 9705 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9706 return &PolicySpecAIAgentHandling_FieldTerminalPathValue{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, value: value.([]*PolicySpec_AIAgentHandling_Remediation)} 9707 default: 9708 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fp.selector)) 9709 } 9710 } 9711 9712 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 9713 return fp.WithIValue(value) 9714 } 9715 9716 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandling_FieldPathArrayOfValues { 9717 fpaov := &PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandling_FieldTerminalPath: *fp} 9718 switch fp.selector { 9719 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9720 return &PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, values: values.([]bool)} 9721 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9722 return &PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, values: values.([]bool)} 9723 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9724 return &PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, values: values.([]bool)} 9725 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9726 return &PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, values: values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity)} 9727 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9728 return &PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, values: values.([][]*PolicySpec_AIAgentHandling_Remediation)} 9729 default: 9730 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fp.selector)) 9731 } 9732 return fpaov 9733 } 9734 9735 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 9736 return fp.WithIArrayOfValues(values) 9737 } 9738 9739 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandling_FieldPathArrayItemValue { 9740 switch fp.selector { 9741 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9742 return &PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue{PolicySpecAIAgentHandling_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling_Remediation)} 9743 default: 9744 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fp.selector)) 9745 } 9746 } 9747 9748 func (fp *PolicySpecAIAgentHandling_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 9749 return fp.WithIArrayItemValue(value) 9750 } 9751 9752 type PolicySpecAIAgentHandling_FieldSubPath struct { 9753 selector PolicySpecAIAgentHandling_FieldPathSelector 9754 subPath gotenobject.FieldPath 9755 } 9756 9757 var _ PolicySpecAIAgentHandling_FieldPath = (*PolicySpecAIAgentHandling_FieldSubPath)(nil) 9758 9759 func (fps *PolicySpecAIAgentHandling_FieldSubPath) Selector() PolicySpecAIAgentHandling_FieldPathSelector { 9760 return fps.selector 9761 } 9762 func (fps *PolicySpecAIAgentHandling_FieldSubPath) AsEdgeConnectivitySubPath() (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath, bool) { 9763 res, ok := fps.subPath.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath) 9764 return res, ok 9765 } 9766 func (fps *PolicySpecAIAgentHandling_FieldSubPath) AsRemediationOptionsSubPath() (PolicySpecAIAgentHandlingRemediation_FieldPath, bool) { 9767 res, ok := fps.subPath.(PolicySpecAIAgentHandlingRemediation_FieldPath) 9768 return res, ok 9769 } 9770 9771 // String returns path representation in proto convention 9772 func (fps *PolicySpecAIAgentHandling_FieldSubPath) String() string { 9773 return fps.selector.String() + "." + fps.subPath.String() 9774 } 9775 9776 // JSONString returns path representation is JSON convention 9777 func (fps *PolicySpecAIAgentHandling_FieldSubPath) JSONString() string { 9778 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 9779 } 9780 9781 // Get returns all values pointed by selected field from source PolicySpec_AIAgentHandling 9782 func (fps *PolicySpecAIAgentHandling_FieldSubPath) Get(source *PolicySpec_AIAgentHandling) (values []interface{}) { 9783 switch fps.selector { 9784 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9785 values = append(values, fps.subPath.GetRaw(source.GetEdgeConnectivity())...) 9786 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9787 for _, item := range source.GetRemediationOptions() { 9788 values = append(values, fps.subPath.GetRaw(item)...) 9789 } 9790 default: 9791 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fps.selector)) 9792 } 9793 return 9794 } 9795 9796 func (fps *PolicySpecAIAgentHandling_FieldSubPath) GetRaw(source proto.Message) []interface{} { 9797 return fps.Get(source.(*PolicySpec_AIAgentHandling)) 9798 } 9799 9800 // GetSingle returns value of selected field from source PolicySpec_AIAgentHandling 9801 func (fps *PolicySpecAIAgentHandling_FieldSubPath) GetSingle(source *PolicySpec_AIAgentHandling) (interface{}, bool) { 9802 switch fps.selector { 9803 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9804 if source.GetEdgeConnectivity() == nil { 9805 return nil, false 9806 } 9807 return fps.subPath.GetSingleRaw(source.GetEdgeConnectivity()) 9808 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9809 if len(source.GetRemediationOptions()) == 0 { 9810 return nil, false 9811 } 9812 return fps.subPath.GetSingleRaw(source.GetRemediationOptions()[0]) 9813 default: 9814 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fps.selector)) 9815 } 9816 } 9817 9818 func (fps *PolicySpecAIAgentHandling_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 9819 return fps.GetSingle(source.(*PolicySpec_AIAgentHandling)) 9820 } 9821 9822 // GetDefault returns a default value of the field type 9823 func (fps *PolicySpecAIAgentHandling_FieldSubPath) GetDefault() interface{} { 9824 return fps.subPath.GetDefault() 9825 } 9826 9827 func (fps *PolicySpecAIAgentHandling_FieldSubPath) ClearValue(item *PolicySpec_AIAgentHandling) { 9828 if item != nil { 9829 switch fps.selector { 9830 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9831 fps.subPath.ClearValueRaw(item.EdgeConnectivity) 9832 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9833 for _, subItem := range item.RemediationOptions { 9834 fps.subPath.ClearValueRaw(subItem) 9835 } 9836 default: 9837 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fps.selector)) 9838 } 9839 } 9840 } 9841 9842 func (fps *PolicySpecAIAgentHandling_FieldSubPath) ClearValueRaw(item proto.Message) { 9843 fps.ClearValue(item.(*PolicySpec_AIAgentHandling)) 9844 } 9845 9846 // IsLeaf - whether field path is holds simple value 9847 func (fps *PolicySpecAIAgentHandling_FieldSubPath) IsLeaf() bool { 9848 return fps.subPath.IsLeaf() 9849 } 9850 9851 func (fps *PolicySpecAIAgentHandling_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 9852 iPaths := []gotenobject.FieldPath{&PolicySpecAIAgentHandling_FieldTerminalPath{selector: fps.selector}} 9853 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 9854 return iPaths 9855 } 9856 9857 func (fps *PolicySpecAIAgentHandling_FieldSubPath) WithIValue(value interface{}) PolicySpecAIAgentHandling_FieldPathValue { 9858 return &PolicySpecAIAgentHandling_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 9859 } 9860 9861 func (fps *PolicySpecAIAgentHandling_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 9862 return fps.WithIValue(value) 9863 } 9864 9865 func (fps *PolicySpecAIAgentHandling_FieldSubPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandling_FieldPathArrayOfValues { 9866 return &PolicySpecAIAgentHandling_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 9867 } 9868 9869 func (fps *PolicySpecAIAgentHandling_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 9870 return fps.WithIArrayOfValues(values) 9871 } 9872 9873 func (fps *PolicySpecAIAgentHandling_FieldSubPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandling_FieldPathArrayItemValue { 9874 return &PolicySpecAIAgentHandling_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 9875 } 9876 9877 func (fps *PolicySpecAIAgentHandling_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 9878 return fps.WithIArrayItemValue(value) 9879 } 9880 9881 // PolicySpecAIAgentHandling_FieldPathValue allows storing values for AIAgentHandling fields according to their type 9882 type PolicySpecAIAgentHandling_FieldPathValue interface { 9883 PolicySpecAIAgentHandling_FieldPath 9884 gotenobject.FieldPathValue 9885 SetTo(target **PolicySpec_AIAgentHandling) 9886 CompareWith(*PolicySpec_AIAgentHandling) (cmp int, comparable bool) 9887 } 9888 9889 func ParsePolicySpecAIAgentHandling_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandling_FieldPathValue, error) { 9890 fp, err := ParsePolicySpecAIAgentHandling_FieldPath(pathStr) 9891 if err != nil { 9892 return nil, err 9893 } 9894 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 9895 if err != nil { 9896 return nil, status.Errorf(codes.InvalidArgument, "error parsing AIAgentHandling field path value from %s: %v", valueStr, err) 9897 } 9898 return fpv.(PolicySpecAIAgentHandling_FieldPathValue), nil 9899 } 9900 9901 func MustParsePolicySpecAIAgentHandling_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandling_FieldPathValue { 9902 fpv, err := ParsePolicySpecAIAgentHandling_FieldPathValue(pathStr, valueStr) 9903 if err != nil { 9904 panic(err) 9905 } 9906 return fpv 9907 } 9908 9909 type PolicySpecAIAgentHandling_FieldTerminalPathValue struct { 9910 PolicySpecAIAgentHandling_FieldTerminalPath 9911 value interface{} 9912 } 9913 9914 var _ PolicySpecAIAgentHandling_FieldPathValue = (*PolicySpecAIAgentHandling_FieldTerminalPathValue)(nil) 9915 9916 // GetRawValue returns raw value stored under selected path for 'AIAgentHandling' as interface{} 9917 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) GetRawValue() interface{} { 9918 return fpv.value 9919 } 9920 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) AsEnabledValue() (bool, bool) { 9921 res, ok := fpv.value.(bool) 9922 return res, ok 9923 } 9924 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) AsEnabledConnectivityValue() (bool, bool) { 9925 res, ok := fpv.value.(bool) 9926 return res, ok 9927 } 9928 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) AsAutoAcceptRemediationValue() (bool, bool) { 9929 res, ok := fpv.value.(bool) 9930 return res, ok 9931 } 9932 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) AsEdgeConnectivityValue() (*PolicySpec_AIAgentHandling_EdgeConnectivity, bool) { 9933 res, ok := fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity) 9934 return res, ok 9935 } 9936 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) AsRemediationOptionsValue() ([]*PolicySpec_AIAgentHandling_Remediation, bool) { 9937 res, ok := fpv.value.([]*PolicySpec_AIAgentHandling_Remediation) 9938 return res, ok 9939 } 9940 9941 // SetTo stores value for selected field for object AIAgentHandling 9942 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling) { 9943 if *target == nil { 9944 *target = new(PolicySpec_AIAgentHandling) 9945 } 9946 switch fpv.selector { 9947 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9948 (*target).Enabled = fpv.value.(bool) 9949 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9950 (*target).EnabledConnectivity = fpv.value.(bool) 9951 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9952 (*target).AutoAcceptRemediation = fpv.value.(bool) 9953 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 9954 (*target).EdgeConnectivity = fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity) 9955 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 9956 (*target).RemediationOptions = fpv.value.([]*PolicySpec_AIAgentHandling_Remediation) 9957 default: 9958 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fpv.selector)) 9959 } 9960 } 9961 9962 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) SetToRaw(target proto.Message) { 9963 typedObject := target.(*PolicySpec_AIAgentHandling) 9964 fpv.SetTo(&typedObject) 9965 } 9966 9967 // CompareWith compares value in the 'PolicySpecAIAgentHandling_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling'. 9968 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling) (int, bool) { 9969 switch fpv.selector { 9970 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 9971 leftValue := fpv.value.(bool) 9972 rightValue := source.GetEnabled() 9973 if (leftValue) == (rightValue) { 9974 return 0, true 9975 } else if !(leftValue) && (rightValue) { 9976 return -1, true 9977 } else { 9978 return 1, true 9979 } 9980 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 9981 leftValue := fpv.value.(bool) 9982 rightValue := source.GetEnabledConnectivity() 9983 if (leftValue) == (rightValue) { 9984 return 0, true 9985 } else if !(leftValue) && (rightValue) { 9986 return -1, true 9987 } else { 9988 return 1, true 9989 } 9990 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 9991 leftValue := fpv.value.(bool) 9992 rightValue := source.GetAutoAcceptRemediation() 9993 if (leftValue) == (rightValue) { 9994 return 0, true 9995 } else if !(leftValue) && (rightValue) { 9996 return -1, true 9997 } else { 9998 return 1, true 9999 } 10000 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 10001 return 0, false 10002 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 10003 return 0, false 10004 default: 10005 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fpv.selector)) 10006 } 10007 } 10008 10009 func (fpv *PolicySpecAIAgentHandling_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 10010 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling)) 10011 } 10012 10013 type PolicySpecAIAgentHandling_FieldSubPathValue struct { 10014 PolicySpecAIAgentHandling_FieldPath 10015 subPathValue gotenobject.FieldPathValue 10016 } 10017 10018 var _ PolicySpecAIAgentHandling_FieldPathValue = (*PolicySpecAIAgentHandling_FieldSubPathValue)(nil) 10019 10020 func (fpvs *PolicySpecAIAgentHandling_FieldSubPathValue) AsEdgeConnectivityPathValue() (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue, bool) { 10021 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue) 10022 return res, ok 10023 } 10024 func (fpvs *PolicySpecAIAgentHandling_FieldSubPathValue) AsRemediationOptionsPathValue() (PolicySpecAIAgentHandlingRemediation_FieldPathValue, bool) { 10025 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandlingRemediation_FieldPathValue) 10026 return res, ok 10027 } 10028 10029 func (fpvs *PolicySpecAIAgentHandling_FieldSubPathValue) SetTo(target **PolicySpec_AIAgentHandling) { 10030 if *target == nil { 10031 *target = new(PolicySpec_AIAgentHandling) 10032 } 10033 switch fpvs.Selector() { 10034 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 10035 fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue).SetTo(&(*target).EdgeConnectivity) 10036 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 10037 panic("FieldPath setter is unsupported for array subpaths") 10038 default: 10039 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fpvs.Selector())) 10040 } 10041 } 10042 10043 func (fpvs *PolicySpecAIAgentHandling_FieldSubPathValue) SetToRaw(target proto.Message) { 10044 typedObject := target.(*PolicySpec_AIAgentHandling) 10045 fpvs.SetTo(&typedObject) 10046 } 10047 10048 func (fpvs *PolicySpecAIAgentHandling_FieldSubPathValue) GetRawValue() interface{} { 10049 return fpvs.subPathValue.GetRawValue() 10050 } 10051 10052 func (fpvs *PolicySpecAIAgentHandling_FieldSubPathValue) CompareWith(source *PolicySpec_AIAgentHandling) (int, bool) { 10053 switch fpvs.Selector() { 10054 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 10055 return fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue).CompareWith(source.GetEdgeConnectivity()) 10056 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 10057 return 0, false // repeated field 10058 default: 10059 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fpvs.Selector())) 10060 } 10061 } 10062 10063 func (fpvs *PolicySpecAIAgentHandling_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 10064 return fpvs.CompareWith(source.(*PolicySpec_AIAgentHandling)) 10065 } 10066 10067 // PolicySpecAIAgentHandling_FieldPathArrayItemValue allows storing single item in Path-specific values for AIAgentHandling according to their type 10068 // Present only for array (repeated) types. 10069 type PolicySpecAIAgentHandling_FieldPathArrayItemValue interface { 10070 gotenobject.FieldPathArrayItemValue 10071 PolicySpecAIAgentHandling_FieldPath 10072 ContainsValue(*PolicySpec_AIAgentHandling) bool 10073 } 10074 10075 // ParsePolicySpecAIAgentHandling_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 10076 func ParsePolicySpecAIAgentHandling_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandling_FieldPathArrayItemValue, error) { 10077 fp, err := ParsePolicySpecAIAgentHandling_FieldPath(pathStr) 10078 if err != nil { 10079 return nil, err 10080 } 10081 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 10082 if err != nil { 10083 return nil, status.Errorf(codes.InvalidArgument, "error parsing AIAgentHandling field path array item value from %s: %v", valueStr, err) 10084 } 10085 return fpaiv.(PolicySpecAIAgentHandling_FieldPathArrayItemValue), nil 10086 } 10087 10088 func MustParsePolicySpecAIAgentHandling_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandling_FieldPathArrayItemValue { 10089 fpaiv, err := ParsePolicySpecAIAgentHandling_FieldPathArrayItemValue(pathStr, valueStr) 10090 if err != nil { 10091 panic(err) 10092 } 10093 return fpaiv 10094 } 10095 10096 type PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue struct { 10097 PolicySpecAIAgentHandling_FieldTerminalPath 10098 value interface{} 10099 } 10100 10101 var _ PolicySpecAIAgentHandling_FieldPathArrayItemValue = (*PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue)(nil) 10102 10103 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling as interface{} 10104 func (fpaiv *PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 10105 return fpaiv.value 10106 } 10107 func (fpaiv *PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue) AsRemediationOptionsItemValue() (*PolicySpec_AIAgentHandling_Remediation, bool) { 10108 res, ok := fpaiv.value.(*PolicySpec_AIAgentHandling_Remediation) 10109 return res, ok 10110 } 10111 10112 func (fpaiv *PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling) (interface{}, bool) { 10113 return nil, false 10114 } 10115 10116 func (fpaiv *PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 10117 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling)) 10118 } 10119 10120 // Contains returns a boolean indicating if value that is being held is present in given 'AIAgentHandling' 10121 func (fpaiv *PolicySpecAIAgentHandling_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling) bool { 10122 slice := fpaiv.PolicySpecAIAgentHandling_FieldTerminalPath.Get(source) 10123 for _, v := range slice { 10124 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 10125 if proto.Equal(asProtoMsg, v.(proto.Message)) { 10126 return true 10127 } 10128 } else if reflect.DeepEqual(v, fpaiv.value) { 10129 return true 10130 } 10131 } 10132 return false 10133 } 10134 10135 type PolicySpecAIAgentHandling_FieldSubPathArrayItemValue struct { 10136 PolicySpecAIAgentHandling_FieldPath 10137 subPathItemValue gotenobject.FieldPathArrayItemValue 10138 } 10139 10140 // GetRawValue returns stored array item value 10141 func (fpaivs *PolicySpecAIAgentHandling_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 10142 return fpaivs.subPathItemValue.GetRawItemValue() 10143 } 10144 func (fpaivs *PolicySpecAIAgentHandling_FieldSubPathArrayItemValue) AsEdgeConnectivityPathItemValue() (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue, bool) { 10145 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue) 10146 return res, ok 10147 } 10148 func (fpaivs *PolicySpecAIAgentHandling_FieldSubPathArrayItemValue) AsRemediationOptionsPathItemValue() (PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue, bool) { 10149 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue) 10150 return res, ok 10151 } 10152 10153 // Contains returns a boolean indicating if value that is being held is present in given 'AIAgentHandling' 10154 func (fpaivs *PolicySpecAIAgentHandling_FieldSubPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling) bool { 10155 switch fpaivs.Selector() { 10156 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 10157 return fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue).ContainsValue(source.GetEdgeConnectivity()) 10158 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 10159 return false // repeated/map field 10160 default: 10161 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling: %d", fpaivs.Selector())) 10162 } 10163 } 10164 10165 // PolicySpecAIAgentHandling_FieldPathArrayOfValues allows storing slice of values for AIAgentHandling fields according to their type 10166 type PolicySpecAIAgentHandling_FieldPathArrayOfValues interface { 10167 gotenobject.FieldPathArrayOfValues 10168 PolicySpecAIAgentHandling_FieldPath 10169 } 10170 10171 func ParsePolicySpecAIAgentHandling_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandling_FieldPathArrayOfValues, error) { 10172 fp, err := ParsePolicySpecAIAgentHandling_FieldPath(pathStr) 10173 if err != nil { 10174 return nil, err 10175 } 10176 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 10177 if err != nil { 10178 return nil, status.Errorf(codes.InvalidArgument, "error parsing AIAgentHandling field path array of values from %s: %v", valuesStr, err) 10179 } 10180 return fpaov.(PolicySpecAIAgentHandling_FieldPathArrayOfValues), nil 10181 } 10182 10183 func MustParsePolicySpecAIAgentHandling_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandling_FieldPathArrayOfValues { 10184 fpaov, err := ParsePolicySpecAIAgentHandling_FieldPathArrayOfValues(pathStr, valuesStr) 10185 if err != nil { 10186 panic(err) 10187 } 10188 return fpaov 10189 } 10190 10191 type PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues struct { 10192 PolicySpecAIAgentHandling_FieldTerminalPath 10193 values interface{} 10194 } 10195 10196 var _ PolicySpecAIAgentHandling_FieldPathArrayOfValues = (*PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues)(nil) 10197 10198 func (fpaov *PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 10199 switch fpaov.selector { 10200 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 10201 for _, v := range fpaov.values.([]bool) { 10202 values = append(values, v) 10203 } 10204 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 10205 for _, v := range fpaov.values.([]bool) { 10206 values = append(values, v) 10207 } 10208 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 10209 for _, v := range fpaov.values.([]bool) { 10210 values = append(values, v) 10211 } 10212 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 10213 for _, v := range fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity) { 10214 values = append(values, v) 10215 } 10216 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 10217 for _, v := range fpaov.values.([][]*PolicySpec_AIAgentHandling_Remediation) { 10218 values = append(values, v) 10219 } 10220 } 10221 return 10222 } 10223 func (fpaov *PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues) AsEnabledArrayOfValues() ([]bool, bool) { 10224 res, ok := fpaov.values.([]bool) 10225 return res, ok 10226 } 10227 func (fpaov *PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues) AsEnabledConnectivityArrayOfValues() ([]bool, bool) { 10228 res, ok := fpaov.values.([]bool) 10229 return res, ok 10230 } 10231 func (fpaov *PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues) AsAutoAcceptRemediationArrayOfValues() ([]bool, bool) { 10232 res, ok := fpaov.values.([]bool) 10233 return res, ok 10234 } 10235 func (fpaov *PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues) AsEdgeConnectivityArrayOfValues() ([]*PolicySpec_AIAgentHandling_EdgeConnectivity, bool) { 10236 res, ok := fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity) 10237 return res, ok 10238 } 10239 func (fpaov *PolicySpecAIAgentHandling_FieldTerminalPathArrayOfValues) AsRemediationOptionsArrayOfValues() ([][]*PolicySpec_AIAgentHandling_Remediation, bool) { 10240 res, ok := fpaov.values.([][]*PolicySpec_AIAgentHandling_Remediation) 10241 return res, ok 10242 } 10243 10244 type PolicySpecAIAgentHandling_FieldSubPathArrayOfValues struct { 10245 PolicySpecAIAgentHandling_FieldPath 10246 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 10247 } 10248 10249 var _ PolicySpecAIAgentHandling_FieldPathArrayOfValues = (*PolicySpecAIAgentHandling_FieldSubPathArrayOfValues)(nil) 10250 10251 func (fpsaov *PolicySpecAIAgentHandling_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 10252 return fpsaov.subPathArrayOfValues.GetRawValues() 10253 } 10254 func (fpsaov *PolicySpecAIAgentHandling_FieldSubPathArrayOfValues) AsEdgeConnectivityPathArrayOfValues() (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues, bool) { 10255 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues) 10256 return res, ok 10257 } 10258 func (fpsaov *PolicySpecAIAgentHandling_FieldSubPathArrayOfValues) AsRemediationOptionsPathArrayOfValues() (PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues, bool) { 10259 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues) 10260 return res, ok 10261 } 10262 10263 // FieldPath provides implementation to handle 10264 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 10265 type PolicySpecResourceIdentityLabelInfo_FieldPath interface { 10266 gotenobject.FieldPath 10267 Selector() PolicySpecResourceIdentityLabelInfo_FieldPathSelector 10268 Get(source *PolicySpec_ResourceIdentity_LabelInfo) []interface{} 10269 GetSingle(source *PolicySpec_ResourceIdentity_LabelInfo) (interface{}, bool) 10270 ClearValue(item *PolicySpec_ResourceIdentity_LabelInfo) 10271 10272 // Those methods build corresponding PolicySpecResourceIdentityLabelInfo_FieldPathValue 10273 // (or array of values) and holds passed value. Panics if injected type is incorrect. 10274 WithIValue(value interface{}) PolicySpecResourceIdentityLabelInfo_FieldPathValue 10275 WithIArrayOfValues(values interface{}) PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues 10276 WithIArrayItemValue(value interface{}) PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue 10277 } 10278 10279 type PolicySpecResourceIdentityLabelInfo_FieldPathSelector int32 10280 10281 const ( 10282 PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey PolicySpecResourceIdentityLabelInfo_FieldPathSelector = 0 10283 PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts PolicySpecResourceIdentityLabelInfo_FieldPathSelector = 1 10284 PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment PolicySpecResourceIdentityLabelInfo_FieldPathSelector = 2 10285 ) 10286 10287 func (s PolicySpecResourceIdentityLabelInfo_FieldPathSelector) String() string { 10288 switch s { 10289 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10290 return "key" 10291 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10292 return "contexts" 10293 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10294 return "mapped_name_segment" 10295 default: 10296 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", s)) 10297 } 10298 } 10299 10300 func BuildPolicySpecResourceIdentityLabelInfo_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecResourceIdentityLabelInfo_FieldPath, error) { 10301 if len(fp) == 0 { 10302 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_ResourceIdentity_LabelInfo") 10303 } 10304 if len(fp) == 1 { 10305 switch fp[0] { 10306 case "key": 10307 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPath{selector: PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey}, nil 10308 case "contexts": 10309 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPath{selector: PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts}, nil 10310 case "mapped_name_segment", "mappedNameSegment", "mapped-name-segment": 10311 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPath{selector: PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment}, nil 10312 } 10313 } 10314 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_ResourceIdentity_LabelInfo", fp) 10315 } 10316 10317 func ParsePolicySpecResourceIdentityLabelInfo_FieldPath(rawField string) (PolicySpecResourceIdentityLabelInfo_FieldPath, error) { 10318 fp, err := gotenobject.ParseRawFieldPath(rawField) 10319 if err != nil { 10320 return nil, err 10321 } 10322 return BuildPolicySpecResourceIdentityLabelInfo_FieldPath(fp) 10323 } 10324 10325 func MustParsePolicySpecResourceIdentityLabelInfo_FieldPath(rawField string) PolicySpecResourceIdentityLabelInfo_FieldPath { 10326 fp, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPath(rawField) 10327 if err != nil { 10328 panic(err) 10329 } 10330 return fp 10331 } 10332 10333 type PolicySpecResourceIdentityLabelInfo_FieldTerminalPath struct { 10334 selector PolicySpecResourceIdentityLabelInfo_FieldPathSelector 10335 } 10336 10337 var _ PolicySpecResourceIdentityLabelInfo_FieldPath = (*PolicySpecResourceIdentityLabelInfo_FieldTerminalPath)(nil) 10338 10339 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) Selector() PolicySpecResourceIdentityLabelInfo_FieldPathSelector { 10340 return fp.selector 10341 } 10342 10343 // String returns path representation in proto convention 10344 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) String() string { 10345 return fp.selector.String() 10346 } 10347 10348 // JSONString returns path representation is JSON convention 10349 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) JSONString() string { 10350 return strcase.ToLowerCamel(fp.String()) 10351 } 10352 10353 // Get returns all values pointed by specific field from source PolicySpec_ResourceIdentity_LabelInfo 10354 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) Get(source *PolicySpec_ResourceIdentity_LabelInfo) (values []interface{}) { 10355 if source != nil { 10356 switch fp.selector { 10357 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10358 values = append(values, source.Key) 10359 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10360 for _, value := range source.GetContexts() { 10361 values = append(values, value) 10362 } 10363 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10364 values = append(values, source.MappedNameSegment) 10365 default: 10366 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fp.selector)) 10367 } 10368 } 10369 return 10370 } 10371 10372 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 10373 return fp.Get(source.(*PolicySpec_ResourceIdentity_LabelInfo)) 10374 } 10375 10376 // GetSingle returns value pointed by specific field of from source PolicySpec_ResourceIdentity_LabelInfo 10377 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) GetSingle(source *PolicySpec_ResourceIdentity_LabelInfo) (interface{}, bool) { 10378 switch fp.selector { 10379 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10380 return source.GetKey(), source != nil 10381 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10382 res := source.GetContexts() 10383 return res, res != nil 10384 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10385 return source.GetMappedNameSegment(), source != nil 10386 default: 10387 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fp.selector)) 10388 } 10389 } 10390 10391 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 10392 return fp.GetSingle(source.(*PolicySpec_ResourceIdentity_LabelInfo)) 10393 } 10394 10395 // GetDefault returns a default value of the field type 10396 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) GetDefault() interface{} { 10397 switch fp.selector { 10398 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10399 return "" 10400 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10401 return ([]PolicySpec_ResourceIdentity_LabelInfo_UsageContext)(nil) 10402 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10403 return "" 10404 default: 10405 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fp.selector)) 10406 } 10407 } 10408 10409 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) ClearValue(item *PolicySpec_ResourceIdentity_LabelInfo) { 10410 if item != nil { 10411 switch fp.selector { 10412 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10413 item.Key = "" 10414 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10415 item.Contexts = nil 10416 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10417 item.MappedNameSegment = "" 10418 default: 10419 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fp.selector)) 10420 } 10421 } 10422 } 10423 10424 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) ClearValueRaw(item proto.Message) { 10425 fp.ClearValue(item.(*PolicySpec_ResourceIdentity_LabelInfo)) 10426 } 10427 10428 // IsLeaf - whether field path is holds simple value 10429 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) IsLeaf() bool { 10430 return fp.selector == PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey || 10431 fp.selector == PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts || 10432 fp.selector == PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment 10433 } 10434 10435 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 10436 return []gotenobject.FieldPath{fp} 10437 } 10438 10439 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) WithIValue(value interface{}) PolicySpecResourceIdentityLabelInfo_FieldPathValue { 10440 switch fp.selector { 10441 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10442 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp, value: value.(string)} 10443 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10444 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp, value: value.([]PolicySpec_ResourceIdentity_LabelInfo_UsageContext)} 10445 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10446 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp, value: value.(string)} 10447 default: 10448 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fp.selector)) 10449 } 10450 } 10451 10452 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 10453 return fp.WithIValue(value) 10454 } 10455 10456 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues { 10457 fpaov := &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp} 10458 switch fp.selector { 10459 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10460 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp, values: values.([]string)} 10461 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10462 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp, values: values.([][]PolicySpec_ResourceIdentity_LabelInfo_UsageContext)} 10463 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10464 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp, values: values.([]string)} 10465 default: 10466 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fp.selector)) 10467 } 10468 return fpaov 10469 } 10470 10471 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 10472 return fp.WithIArrayOfValues(values) 10473 } 10474 10475 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue { 10476 switch fp.selector { 10477 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10478 return &PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue{PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: *fp, value: value.(PolicySpec_ResourceIdentity_LabelInfo_UsageContext)} 10479 default: 10480 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fp.selector)) 10481 } 10482 } 10483 10484 func (fp *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 10485 return fp.WithIArrayItemValue(value) 10486 } 10487 10488 // PolicySpecResourceIdentityLabelInfo_FieldPathValue allows storing values for LabelInfo fields according to their type 10489 type PolicySpecResourceIdentityLabelInfo_FieldPathValue interface { 10490 PolicySpecResourceIdentityLabelInfo_FieldPath 10491 gotenobject.FieldPathValue 10492 SetTo(target **PolicySpec_ResourceIdentity_LabelInfo) 10493 CompareWith(*PolicySpec_ResourceIdentity_LabelInfo) (cmp int, comparable bool) 10494 } 10495 10496 func ParsePolicySpecResourceIdentityLabelInfo_FieldPathValue(pathStr, valueStr string) (PolicySpecResourceIdentityLabelInfo_FieldPathValue, error) { 10497 fp, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPath(pathStr) 10498 if err != nil { 10499 return nil, err 10500 } 10501 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 10502 if err != nil { 10503 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelInfo field path value from %s: %v", valueStr, err) 10504 } 10505 return fpv.(PolicySpecResourceIdentityLabelInfo_FieldPathValue), nil 10506 } 10507 10508 func MustParsePolicySpecResourceIdentityLabelInfo_FieldPathValue(pathStr, valueStr string) PolicySpecResourceIdentityLabelInfo_FieldPathValue { 10509 fpv, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPathValue(pathStr, valueStr) 10510 if err != nil { 10511 panic(err) 10512 } 10513 return fpv 10514 } 10515 10516 type PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue struct { 10517 PolicySpecResourceIdentityLabelInfo_FieldTerminalPath 10518 value interface{} 10519 } 10520 10521 var _ PolicySpecResourceIdentityLabelInfo_FieldPathValue = (*PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue)(nil) 10522 10523 // GetRawValue returns raw value stored under selected path for 'LabelInfo' as interface{} 10524 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) GetRawValue() interface{} { 10525 return fpv.value 10526 } 10527 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) AsKeyValue() (string, bool) { 10528 res, ok := fpv.value.(string) 10529 return res, ok 10530 } 10531 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) AsContextsValue() ([]PolicySpec_ResourceIdentity_LabelInfo_UsageContext, bool) { 10532 res, ok := fpv.value.([]PolicySpec_ResourceIdentity_LabelInfo_UsageContext) 10533 return res, ok 10534 } 10535 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) AsMappedNameSegmentValue() (string, bool) { 10536 res, ok := fpv.value.(string) 10537 return res, ok 10538 } 10539 10540 // SetTo stores value for selected field for object LabelInfo 10541 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) SetTo(target **PolicySpec_ResourceIdentity_LabelInfo) { 10542 if *target == nil { 10543 *target = new(PolicySpec_ResourceIdentity_LabelInfo) 10544 } 10545 switch fpv.selector { 10546 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10547 (*target).Key = fpv.value.(string) 10548 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10549 (*target).Contexts = fpv.value.([]PolicySpec_ResourceIdentity_LabelInfo_UsageContext) 10550 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10551 (*target).MappedNameSegment = fpv.value.(string) 10552 default: 10553 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fpv.selector)) 10554 } 10555 } 10556 10557 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) SetToRaw(target proto.Message) { 10558 typedObject := target.(*PolicySpec_ResourceIdentity_LabelInfo) 10559 fpv.SetTo(&typedObject) 10560 } 10561 10562 // CompareWith compares value in the 'PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue' with the value under path in 'PolicySpec_ResourceIdentity_LabelInfo'. 10563 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) CompareWith(source *PolicySpec_ResourceIdentity_LabelInfo) (int, bool) { 10564 switch fpv.selector { 10565 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10566 leftValue := fpv.value.(string) 10567 rightValue := source.GetKey() 10568 if (leftValue) == (rightValue) { 10569 return 0, true 10570 } else if (leftValue) < (rightValue) { 10571 return -1, true 10572 } else { 10573 return 1, true 10574 } 10575 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10576 return 0, false 10577 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10578 leftValue := fpv.value.(string) 10579 rightValue := source.GetMappedNameSegment() 10580 if (leftValue) == (rightValue) { 10581 return 0, true 10582 } else if (leftValue) < (rightValue) { 10583 return -1, true 10584 } else { 10585 return 1, true 10586 } 10587 default: 10588 panic(fmt.Sprintf("Invalid selector for PolicySpec_ResourceIdentity_LabelInfo: %d", fpv.selector)) 10589 } 10590 } 10591 10592 func (fpv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 10593 return fpv.CompareWith(source.(*PolicySpec_ResourceIdentity_LabelInfo)) 10594 } 10595 10596 // PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue allows storing single item in Path-specific values for LabelInfo according to their type 10597 // Present only for array (repeated) types. 10598 type PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue interface { 10599 gotenobject.FieldPathArrayItemValue 10600 PolicySpecResourceIdentityLabelInfo_FieldPath 10601 ContainsValue(*PolicySpec_ResourceIdentity_LabelInfo) bool 10602 } 10603 10604 // ParsePolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 10605 func ParsePolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue, error) { 10606 fp, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPath(pathStr) 10607 if err != nil { 10608 return nil, err 10609 } 10610 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 10611 if err != nil { 10612 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelInfo field path array item value from %s: %v", valueStr, err) 10613 } 10614 return fpaiv.(PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue), nil 10615 } 10616 10617 func MustParsePolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue { 10618 fpaiv, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue(pathStr, valueStr) 10619 if err != nil { 10620 panic(err) 10621 } 10622 return fpaiv 10623 } 10624 10625 type PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue struct { 10626 PolicySpecResourceIdentityLabelInfo_FieldTerminalPath 10627 value interface{} 10628 } 10629 10630 var _ PolicySpecResourceIdentityLabelInfo_FieldPathArrayItemValue = (*PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue)(nil) 10631 10632 // GetRawValue returns stored element value for array in object PolicySpec_ResourceIdentity_LabelInfo as interface{} 10633 func (fpaiv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 10634 return fpaiv.value 10635 } 10636 func (fpaiv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue) AsContextsItemValue() (PolicySpec_ResourceIdentity_LabelInfo_UsageContext, bool) { 10637 res, ok := fpaiv.value.(PolicySpec_ResourceIdentity_LabelInfo_UsageContext) 10638 return res, ok 10639 } 10640 10641 func (fpaiv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_ResourceIdentity_LabelInfo) (interface{}, bool) { 10642 return nil, false 10643 } 10644 10645 func (fpaiv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 10646 return fpaiv.GetSingle(source.(*PolicySpec_ResourceIdentity_LabelInfo)) 10647 } 10648 10649 // Contains returns a boolean indicating if value that is being held is present in given 'LabelInfo' 10650 func (fpaiv *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_ResourceIdentity_LabelInfo) bool { 10651 slice := fpaiv.PolicySpecResourceIdentityLabelInfo_FieldTerminalPath.Get(source) 10652 for _, v := range slice { 10653 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 10654 if proto.Equal(asProtoMsg, v.(proto.Message)) { 10655 return true 10656 } 10657 } else if reflect.DeepEqual(v, fpaiv.value) { 10658 return true 10659 } 10660 } 10661 return false 10662 } 10663 10664 // PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues allows storing slice of values for LabelInfo fields according to their type 10665 type PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues interface { 10666 gotenobject.FieldPathArrayOfValues 10667 PolicySpecResourceIdentityLabelInfo_FieldPath 10668 } 10669 10670 func ParsePolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues, error) { 10671 fp, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPath(pathStr) 10672 if err != nil { 10673 return nil, err 10674 } 10675 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 10676 if err != nil { 10677 return nil, status.Errorf(codes.InvalidArgument, "error parsing LabelInfo field path array of values from %s: %v", valuesStr, err) 10678 } 10679 return fpaov.(PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues), nil 10680 } 10681 10682 func MustParsePolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues { 10683 fpaov, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues(pathStr, valuesStr) 10684 if err != nil { 10685 panic(err) 10686 } 10687 return fpaov 10688 } 10689 10690 type PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues struct { 10691 PolicySpecResourceIdentityLabelInfo_FieldTerminalPath 10692 values interface{} 10693 } 10694 10695 var _ PolicySpecResourceIdentityLabelInfo_FieldPathArrayOfValues = (*PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues)(nil) 10696 10697 func (fpaov *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 10698 switch fpaov.selector { 10699 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 10700 for _, v := range fpaov.values.([]string) { 10701 values = append(values, v) 10702 } 10703 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 10704 for _, v := range fpaov.values.([][]PolicySpec_ResourceIdentity_LabelInfo_UsageContext) { 10705 values = append(values, v) 10706 } 10707 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 10708 for _, v := range fpaov.values.([]string) { 10709 values = append(values, v) 10710 } 10711 } 10712 return 10713 } 10714 func (fpaov *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues) AsKeyArrayOfValues() ([]string, bool) { 10715 res, ok := fpaov.values.([]string) 10716 return res, ok 10717 } 10718 func (fpaov *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues) AsContextsArrayOfValues() ([][]PolicySpec_ResourceIdentity_LabelInfo_UsageContext, bool) { 10719 res, ok := fpaov.values.([][]PolicySpec_ResourceIdentity_LabelInfo_UsageContext) 10720 return res, ok 10721 } 10722 func (fpaov *PolicySpecResourceIdentityLabelInfo_FieldTerminalPathArrayOfValues) AsMappedNameSegmentArrayOfValues() ([]string, bool) { 10723 res, ok := fpaov.values.([]string) 10724 return res, ok 10725 } 10726 10727 // FieldPath provides implementation to handle 10728 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 10729 type PolicySpecSupportingAlertQueryTsQuery_FieldPath interface { 10730 gotenobject.FieldPath 10731 Selector() PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector 10732 Get(source *PolicySpec_SupportingAlertQuery_TsQuery) []interface{} 10733 GetSingle(source *PolicySpec_SupportingAlertQuery_TsQuery) (interface{}, bool) 10734 ClearValue(item *PolicySpec_SupportingAlertQuery_TsQuery) 10735 10736 // Those methods build corresponding PolicySpecSupportingAlertQueryTsQuery_FieldPathValue 10737 // (or array of values) and holds passed value. Panics if injected type is incorrect. 10738 WithIValue(value interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathValue 10739 WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues 10740 WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue 10741 } 10742 10743 type PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector int32 10744 10745 const ( 10746 PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector = 0 10747 PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector = 1 10748 PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector = 2 10749 ) 10750 10751 func (s PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector) String() string { 10752 switch s { 10753 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 10754 return "description" 10755 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 10756 return "filter_template" 10757 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10758 return "aggregation" 10759 default: 10760 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", s)) 10761 } 10762 } 10763 10764 func BuildPolicySpecSupportingAlertQueryTsQuery_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecSupportingAlertQueryTsQuery_FieldPath, error) { 10765 if len(fp) == 0 { 10766 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_SupportingAlertQuery_TsQuery") 10767 } 10768 if len(fp) == 1 { 10769 switch fp[0] { 10770 case "description": 10771 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription}, nil 10772 case "filter_template", "filterTemplate", "filter-template": 10773 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate}, nil 10774 case "aggregation": 10775 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation}, nil 10776 } 10777 } else { 10778 switch fp[0] { 10779 case "aggregation": 10780 if subpath, err := monitoring_common.BuildAggregation_FieldPath(fp[1:]); err != nil { 10781 return nil, err 10782 } else { 10783 return &PolicySpecSupportingAlertQueryTsQuery_FieldSubPath{selector: PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation, subPath: subpath}, nil 10784 } 10785 } 10786 } 10787 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_SupportingAlertQuery_TsQuery", fp) 10788 } 10789 10790 func ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(rawField string) (PolicySpecSupportingAlertQueryTsQuery_FieldPath, error) { 10791 fp, err := gotenobject.ParseRawFieldPath(rawField) 10792 if err != nil { 10793 return nil, err 10794 } 10795 return BuildPolicySpecSupportingAlertQueryTsQuery_FieldPath(fp) 10796 } 10797 10798 func MustParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(rawField string) PolicySpecSupportingAlertQueryTsQuery_FieldPath { 10799 fp, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(rawField) 10800 if err != nil { 10801 panic(err) 10802 } 10803 return fp 10804 } 10805 10806 type PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath struct { 10807 selector PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector 10808 } 10809 10810 var _ PolicySpecSupportingAlertQueryTsQuery_FieldPath = (*PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath)(nil) 10811 10812 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) Selector() PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector { 10813 return fp.selector 10814 } 10815 10816 // String returns path representation in proto convention 10817 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) String() string { 10818 return fp.selector.String() 10819 } 10820 10821 // JSONString returns path representation is JSON convention 10822 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) JSONString() string { 10823 return strcase.ToLowerCamel(fp.String()) 10824 } 10825 10826 // Get returns all values pointed by specific field from source PolicySpec_SupportingAlertQuery_TsQuery 10827 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) Get(source *PolicySpec_SupportingAlertQuery_TsQuery) (values []interface{}) { 10828 if source != nil { 10829 switch fp.selector { 10830 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 10831 values = append(values, source.Description) 10832 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 10833 values = append(values, source.FilterTemplate) 10834 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10835 if source.Aggregation != nil { 10836 values = append(values, source.Aggregation) 10837 } 10838 default: 10839 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fp.selector)) 10840 } 10841 } 10842 return 10843 } 10844 10845 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 10846 return fp.Get(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 10847 } 10848 10849 // GetSingle returns value pointed by specific field of from source PolicySpec_SupportingAlertQuery_TsQuery 10850 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) GetSingle(source *PolicySpec_SupportingAlertQuery_TsQuery) (interface{}, bool) { 10851 switch fp.selector { 10852 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 10853 return source.GetDescription(), source != nil 10854 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 10855 return source.GetFilterTemplate(), source != nil 10856 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10857 res := source.GetAggregation() 10858 return res, res != nil 10859 default: 10860 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fp.selector)) 10861 } 10862 } 10863 10864 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 10865 return fp.GetSingle(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 10866 } 10867 10868 // GetDefault returns a default value of the field type 10869 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) GetDefault() interface{} { 10870 switch fp.selector { 10871 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 10872 return "" 10873 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 10874 return "" 10875 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10876 return (*monitoring_common.Aggregation)(nil) 10877 default: 10878 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fp.selector)) 10879 } 10880 } 10881 10882 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) ClearValue(item *PolicySpec_SupportingAlertQuery_TsQuery) { 10883 if item != nil { 10884 switch fp.selector { 10885 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 10886 item.Description = "" 10887 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 10888 item.FilterTemplate = "" 10889 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10890 item.Aggregation = nil 10891 default: 10892 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fp.selector)) 10893 } 10894 } 10895 } 10896 10897 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 10898 fp.ClearValue(item.(*PolicySpec_SupportingAlertQuery_TsQuery)) 10899 } 10900 10901 // IsLeaf - whether field path is holds simple value 10902 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) IsLeaf() bool { 10903 return fp.selector == PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription || 10904 fp.selector == PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate 10905 } 10906 10907 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 10908 return []gotenobject.FieldPath{fp} 10909 } 10910 10911 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) WithIValue(value interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathValue { 10912 switch fp.selector { 10913 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 10914 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: *fp, value: value.(string)} 10915 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 10916 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: *fp, value: value.(string)} 10917 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10918 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: *fp, value: value.(*monitoring_common.Aggregation)} 10919 default: 10920 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fp.selector)) 10921 } 10922 } 10923 10924 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 10925 return fp.WithIValue(value) 10926 } 10927 10928 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues { 10929 fpaov := &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: *fp} 10930 switch fp.selector { 10931 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 10932 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: *fp, values: values.([]string)} 10933 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 10934 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: *fp, values: values.([]string)} 10935 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10936 return &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: *fp, values: values.([]*monitoring_common.Aggregation)} 10937 default: 10938 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fp.selector)) 10939 } 10940 return fpaov 10941 } 10942 10943 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 10944 return fp.WithIArrayOfValues(values) 10945 } 10946 10947 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue { 10948 switch fp.selector { 10949 default: 10950 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fp.selector)) 10951 } 10952 } 10953 10954 func (fp *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 10955 return fp.WithIArrayItemValue(value) 10956 } 10957 10958 type PolicySpecSupportingAlertQueryTsQuery_FieldSubPath struct { 10959 selector PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector 10960 subPath gotenobject.FieldPath 10961 } 10962 10963 var _ PolicySpecSupportingAlertQueryTsQuery_FieldPath = (*PolicySpecSupportingAlertQueryTsQuery_FieldSubPath)(nil) 10964 10965 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) Selector() PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector { 10966 return fps.selector 10967 } 10968 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) AsAggregationSubPath() (monitoring_common.Aggregation_FieldPath, bool) { 10969 res, ok := fps.subPath.(monitoring_common.Aggregation_FieldPath) 10970 return res, ok 10971 } 10972 10973 // String returns path representation in proto convention 10974 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) String() string { 10975 return fps.selector.String() + "." + fps.subPath.String() 10976 } 10977 10978 // JSONString returns path representation is JSON convention 10979 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) JSONString() string { 10980 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 10981 } 10982 10983 // Get returns all values pointed by selected field from source PolicySpec_SupportingAlertQuery_TsQuery 10984 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) Get(source *PolicySpec_SupportingAlertQuery_TsQuery) (values []interface{}) { 10985 switch fps.selector { 10986 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 10987 values = append(values, fps.subPath.GetRaw(source.GetAggregation())...) 10988 default: 10989 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fps.selector)) 10990 } 10991 return 10992 } 10993 10994 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) GetRaw(source proto.Message) []interface{} { 10995 return fps.Get(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 10996 } 10997 10998 // GetSingle returns value of selected field from source PolicySpec_SupportingAlertQuery_TsQuery 10999 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) GetSingle(source *PolicySpec_SupportingAlertQuery_TsQuery) (interface{}, bool) { 11000 switch fps.selector { 11001 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11002 if source.GetAggregation() == nil { 11003 return nil, false 11004 } 11005 return fps.subPath.GetSingleRaw(source.GetAggregation()) 11006 default: 11007 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fps.selector)) 11008 } 11009 } 11010 11011 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 11012 return fps.GetSingle(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 11013 } 11014 11015 // GetDefault returns a default value of the field type 11016 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) GetDefault() interface{} { 11017 return fps.subPath.GetDefault() 11018 } 11019 11020 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) ClearValue(item *PolicySpec_SupportingAlertQuery_TsQuery) { 11021 if item != nil { 11022 switch fps.selector { 11023 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11024 fps.subPath.ClearValueRaw(item.Aggregation) 11025 default: 11026 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fps.selector)) 11027 } 11028 } 11029 } 11030 11031 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) ClearValueRaw(item proto.Message) { 11032 fps.ClearValue(item.(*PolicySpec_SupportingAlertQuery_TsQuery)) 11033 } 11034 11035 // IsLeaf - whether field path is holds simple value 11036 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) IsLeaf() bool { 11037 return fps.subPath.IsLeaf() 11038 } 11039 11040 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 11041 iPaths := []gotenobject.FieldPath{&PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath{selector: fps.selector}} 11042 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 11043 return iPaths 11044 } 11045 11046 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) WithIValue(value interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathValue { 11047 return &PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 11048 } 11049 11050 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 11051 return fps.WithIValue(value) 11052 } 11053 11054 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues { 11055 return &PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 11056 } 11057 11058 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 11059 return fps.WithIArrayOfValues(values) 11060 } 11061 11062 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue { 11063 return &PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 11064 } 11065 11066 func (fps *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 11067 return fps.WithIArrayItemValue(value) 11068 } 11069 11070 // PolicySpecSupportingAlertQueryTsQuery_FieldPathValue allows storing values for TsQuery fields according to their type 11071 type PolicySpecSupportingAlertQueryTsQuery_FieldPathValue interface { 11072 PolicySpecSupportingAlertQueryTsQuery_FieldPath 11073 gotenobject.FieldPathValue 11074 SetTo(target **PolicySpec_SupportingAlertQuery_TsQuery) 11075 CompareWith(*PolicySpec_SupportingAlertQuery_TsQuery) (cmp int, comparable bool) 11076 } 11077 11078 func ParsePolicySpecSupportingAlertQueryTsQuery_FieldPathValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryTsQuery_FieldPathValue, error) { 11079 fp, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(pathStr) 11080 if err != nil { 11081 return nil, err 11082 } 11083 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 11084 if err != nil { 11085 return nil, status.Errorf(codes.InvalidArgument, "error parsing TsQuery field path value from %s: %v", valueStr, err) 11086 } 11087 return fpv.(PolicySpecSupportingAlertQueryTsQuery_FieldPathValue), nil 11088 } 11089 11090 func MustParsePolicySpecSupportingAlertQueryTsQuery_FieldPathValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryTsQuery_FieldPathValue { 11091 fpv, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPathValue(pathStr, valueStr) 11092 if err != nil { 11093 panic(err) 11094 } 11095 return fpv 11096 } 11097 11098 type PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue struct { 11099 PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath 11100 value interface{} 11101 } 11102 11103 var _ PolicySpecSupportingAlertQueryTsQuery_FieldPathValue = (*PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue)(nil) 11104 11105 // GetRawValue returns raw value stored under selected path for 'TsQuery' as interface{} 11106 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) GetRawValue() interface{} { 11107 return fpv.value 11108 } 11109 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) AsDescriptionValue() (string, bool) { 11110 res, ok := fpv.value.(string) 11111 return res, ok 11112 } 11113 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) AsFilterTemplateValue() (string, bool) { 11114 res, ok := fpv.value.(string) 11115 return res, ok 11116 } 11117 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) AsAggregationValue() (*monitoring_common.Aggregation, bool) { 11118 res, ok := fpv.value.(*monitoring_common.Aggregation) 11119 return res, ok 11120 } 11121 11122 // SetTo stores value for selected field for object TsQuery 11123 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) SetTo(target **PolicySpec_SupportingAlertQuery_TsQuery) { 11124 if *target == nil { 11125 *target = new(PolicySpec_SupportingAlertQuery_TsQuery) 11126 } 11127 switch fpv.selector { 11128 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 11129 (*target).Description = fpv.value.(string) 11130 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 11131 (*target).FilterTemplate = fpv.value.(string) 11132 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11133 (*target).Aggregation = fpv.value.(*monitoring_common.Aggregation) 11134 default: 11135 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fpv.selector)) 11136 } 11137 } 11138 11139 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 11140 typedObject := target.(*PolicySpec_SupportingAlertQuery_TsQuery) 11141 fpv.SetTo(&typedObject) 11142 } 11143 11144 // CompareWith compares value in the 'PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue' with the value under path in 'PolicySpec_SupportingAlertQuery_TsQuery'. 11145 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) CompareWith(source *PolicySpec_SupportingAlertQuery_TsQuery) (int, bool) { 11146 switch fpv.selector { 11147 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 11148 leftValue := fpv.value.(string) 11149 rightValue := source.GetDescription() 11150 if (leftValue) == (rightValue) { 11151 return 0, true 11152 } else if (leftValue) < (rightValue) { 11153 return -1, true 11154 } else { 11155 return 1, true 11156 } 11157 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 11158 leftValue := fpv.value.(string) 11159 rightValue := source.GetFilterTemplate() 11160 if (leftValue) == (rightValue) { 11161 return 0, true 11162 } else if (leftValue) < (rightValue) { 11163 return -1, true 11164 } else { 11165 return 1, true 11166 } 11167 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11168 return 0, false 11169 default: 11170 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fpv.selector)) 11171 } 11172 } 11173 11174 func (fpv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 11175 return fpv.CompareWith(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 11176 } 11177 11178 type PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue struct { 11179 PolicySpecSupportingAlertQueryTsQuery_FieldPath 11180 subPathValue gotenobject.FieldPathValue 11181 } 11182 11183 var _ PolicySpecSupportingAlertQueryTsQuery_FieldPathValue = (*PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue)(nil) 11184 11185 func (fpvs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue) AsAggregationPathValue() (monitoring_common.Aggregation_FieldPathValue, bool) { 11186 res, ok := fpvs.subPathValue.(monitoring_common.Aggregation_FieldPathValue) 11187 return res, ok 11188 } 11189 11190 func (fpvs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue) SetTo(target **PolicySpec_SupportingAlertQuery_TsQuery) { 11191 if *target == nil { 11192 *target = new(PolicySpec_SupportingAlertQuery_TsQuery) 11193 } 11194 switch fpvs.Selector() { 11195 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11196 fpvs.subPathValue.(monitoring_common.Aggregation_FieldPathValue).SetTo(&(*target).Aggregation) 11197 default: 11198 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fpvs.Selector())) 11199 } 11200 } 11201 11202 func (fpvs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue) SetToRaw(target proto.Message) { 11203 typedObject := target.(*PolicySpec_SupportingAlertQuery_TsQuery) 11204 fpvs.SetTo(&typedObject) 11205 } 11206 11207 func (fpvs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue) GetRawValue() interface{} { 11208 return fpvs.subPathValue.GetRawValue() 11209 } 11210 11211 func (fpvs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue) CompareWith(source *PolicySpec_SupportingAlertQuery_TsQuery) (int, bool) { 11212 switch fpvs.Selector() { 11213 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11214 return fpvs.subPathValue.(monitoring_common.Aggregation_FieldPathValue).CompareWith(source.GetAggregation()) 11215 default: 11216 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fpvs.Selector())) 11217 } 11218 } 11219 11220 func (fpvs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 11221 return fpvs.CompareWith(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 11222 } 11223 11224 // PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for TsQuery according to their type 11225 // Present only for array (repeated) types. 11226 type PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue interface { 11227 gotenobject.FieldPathArrayItemValue 11228 PolicySpecSupportingAlertQueryTsQuery_FieldPath 11229 ContainsValue(*PolicySpec_SupportingAlertQuery_TsQuery) bool 11230 } 11231 11232 // ParsePolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 11233 func ParsePolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue, error) { 11234 fp, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(pathStr) 11235 if err != nil { 11236 return nil, err 11237 } 11238 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 11239 if err != nil { 11240 return nil, status.Errorf(codes.InvalidArgument, "error parsing TsQuery field path array item value from %s: %v", valueStr, err) 11241 } 11242 return fpaiv.(PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue), nil 11243 } 11244 11245 func MustParsePolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue { 11246 fpaiv, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue(pathStr, valueStr) 11247 if err != nil { 11248 panic(err) 11249 } 11250 return fpaiv 11251 } 11252 11253 type PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayItemValue struct { 11254 PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath 11255 value interface{} 11256 } 11257 11258 var _ PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayItemValue = (*PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayItemValue)(nil) 11259 11260 // GetRawValue returns stored element value for array in object PolicySpec_SupportingAlertQuery_TsQuery as interface{} 11261 func (fpaiv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 11262 return fpaiv.value 11263 } 11264 11265 func (fpaiv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_SupportingAlertQuery_TsQuery) (interface{}, bool) { 11266 return nil, false 11267 } 11268 11269 func (fpaiv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 11270 return fpaiv.GetSingle(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 11271 } 11272 11273 // Contains returns a boolean indicating if value that is being held is present in given 'TsQuery' 11274 func (fpaiv *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_SupportingAlertQuery_TsQuery) bool { 11275 slice := fpaiv.PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath.Get(source) 11276 for _, v := range slice { 11277 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 11278 if proto.Equal(asProtoMsg, v.(proto.Message)) { 11279 return true 11280 } 11281 } else if reflect.DeepEqual(v, fpaiv.value) { 11282 return true 11283 } 11284 } 11285 return false 11286 } 11287 11288 type PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayItemValue struct { 11289 PolicySpecSupportingAlertQueryTsQuery_FieldPath 11290 subPathItemValue gotenobject.FieldPathArrayItemValue 11291 } 11292 11293 // GetRawValue returns stored array item value 11294 func (fpaivs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 11295 return fpaivs.subPathItemValue.GetRawItemValue() 11296 } 11297 func (fpaivs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayItemValue) AsAggregationPathItemValue() (monitoring_common.Aggregation_FieldPathArrayItemValue, bool) { 11298 res, ok := fpaivs.subPathItemValue.(monitoring_common.Aggregation_FieldPathArrayItemValue) 11299 return res, ok 11300 } 11301 11302 // Contains returns a boolean indicating if value that is being held is present in given 'TsQuery' 11303 func (fpaivs *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayItemValue) ContainsValue(source *PolicySpec_SupportingAlertQuery_TsQuery) bool { 11304 switch fpaivs.Selector() { 11305 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11306 return fpaivs.subPathItemValue.(monitoring_common.Aggregation_FieldPathArrayItemValue).ContainsValue(source.GetAggregation()) 11307 default: 11308 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_TsQuery: %d", fpaivs.Selector())) 11309 } 11310 } 11311 11312 // PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues allows storing slice of values for TsQuery fields according to their type 11313 type PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues interface { 11314 gotenobject.FieldPathArrayOfValues 11315 PolicySpecSupportingAlertQueryTsQuery_FieldPath 11316 } 11317 11318 func ParsePolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues, error) { 11319 fp, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(pathStr) 11320 if err != nil { 11321 return nil, err 11322 } 11323 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 11324 if err != nil { 11325 return nil, status.Errorf(codes.InvalidArgument, "error parsing TsQuery field path array of values from %s: %v", valuesStr, err) 11326 } 11327 return fpaov.(PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues), nil 11328 } 11329 11330 func MustParsePolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues { 11331 fpaov, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues(pathStr, valuesStr) 11332 if err != nil { 11333 panic(err) 11334 } 11335 return fpaov 11336 } 11337 11338 type PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues struct { 11339 PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath 11340 values interface{} 11341 } 11342 11343 var _ PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues = (*PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues)(nil) 11344 11345 func (fpaov *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 11346 switch fpaov.selector { 11347 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 11348 for _, v := range fpaov.values.([]string) { 11349 values = append(values, v) 11350 } 11351 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 11352 for _, v := range fpaov.values.([]string) { 11353 values = append(values, v) 11354 } 11355 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 11356 for _, v := range fpaov.values.([]*monitoring_common.Aggregation) { 11357 values = append(values, v) 11358 } 11359 } 11360 return 11361 } 11362 func (fpaov *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues) AsDescriptionArrayOfValues() ([]string, bool) { 11363 res, ok := fpaov.values.([]string) 11364 return res, ok 11365 } 11366 func (fpaov *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues) AsFilterTemplateArrayOfValues() ([]string, bool) { 11367 res, ok := fpaov.values.([]string) 11368 return res, ok 11369 } 11370 func (fpaov *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPathArrayOfValues) AsAggregationArrayOfValues() ([]*monitoring_common.Aggregation, bool) { 11371 res, ok := fpaov.values.([]*monitoring_common.Aggregation) 11372 return res, ok 11373 } 11374 11375 type PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayOfValues struct { 11376 PolicySpecSupportingAlertQueryTsQuery_FieldPath 11377 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 11378 } 11379 11380 var _ PolicySpecSupportingAlertQueryTsQuery_FieldPathArrayOfValues = (*PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayOfValues)(nil) 11381 11382 func (fpsaov *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 11383 return fpsaov.subPathArrayOfValues.GetRawValues() 11384 } 11385 func (fpsaov *PolicySpecSupportingAlertQueryTsQuery_FieldSubPathArrayOfValues) AsAggregationPathArrayOfValues() (monitoring_common.Aggregation_FieldPathArrayOfValues, bool) { 11386 res, ok := fpsaov.subPathArrayOfValues.(monitoring_common.Aggregation_FieldPathArrayOfValues) 11387 return res, ok 11388 } 11389 11390 // FieldPath provides implementation to handle 11391 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 11392 type PolicySpecSupportingAlertQueryLogQuery_FieldPath interface { 11393 gotenobject.FieldPath 11394 Selector() PolicySpecSupportingAlertQueryLogQuery_FieldPathSelector 11395 Get(source *PolicySpec_SupportingAlertQuery_LogQuery) []interface{} 11396 GetSingle(source *PolicySpec_SupportingAlertQuery_LogQuery) (interface{}, bool) 11397 ClearValue(item *PolicySpec_SupportingAlertQuery_LogQuery) 11398 11399 // Those methods build corresponding PolicySpecSupportingAlertQueryLogQuery_FieldPathValue 11400 // (or array of values) and holds passed value. Panics if injected type is incorrect. 11401 WithIValue(value interface{}) PolicySpecSupportingAlertQueryLogQuery_FieldPathValue 11402 WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues 11403 WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue 11404 } 11405 11406 type PolicySpecSupportingAlertQueryLogQuery_FieldPathSelector int32 11407 11408 const ( 11409 PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription PolicySpecSupportingAlertQueryLogQuery_FieldPathSelector = 0 11410 PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate PolicySpecSupportingAlertQueryLogQuery_FieldPathSelector = 1 11411 ) 11412 11413 func (s PolicySpecSupportingAlertQueryLogQuery_FieldPathSelector) String() string { 11414 switch s { 11415 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11416 return "description" 11417 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11418 return "filter_template" 11419 default: 11420 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", s)) 11421 } 11422 } 11423 11424 func BuildPolicySpecSupportingAlertQueryLogQuery_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecSupportingAlertQueryLogQuery_FieldPath, error) { 11425 if len(fp) == 0 { 11426 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_SupportingAlertQuery_LogQuery") 11427 } 11428 if len(fp) == 1 { 11429 switch fp[0] { 11430 case "description": 11431 return &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription}, nil 11432 case "filter_template", "filterTemplate", "filter-template": 11433 return &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate}, nil 11434 } 11435 } 11436 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_SupportingAlertQuery_LogQuery", fp) 11437 } 11438 11439 func ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(rawField string) (PolicySpecSupportingAlertQueryLogQuery_FieldPath, error) { 11440 fp, err := gotenobject.ParseRawFieldPath(rawField) 11441 if err != nil { 11442 return nil, err 11443 } 11444 return BuildPolicySpecSupportingAlertQueryLogQuery_FieldPath(fp) 11445 } 11446 11447 func MustParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(rawField string) PolicySpecSupportingAlertQueryLogQuery_FieldPath { 11448 fp, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(rawField) 11449 if err != nil { 11450 panic(err) 11451 } 11452 return fp 11453 } 11454 11455 type PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath struct { 11456 selector PolicySpecSupportingAlertQueryLogQuery_FieldPathSelector 11457 } 11458 11459 var _ PolicySpecSupportingAlertQueryLogQuery_FieldPath = (*PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath)(nil) 11460 11461 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) Selector() PolicySpecSupportingAlertQueryLogQuery_FieldPathSelector { 11462 return fp.selector 11463 } 11464 11465 // String returns path representation in proto convention 11466 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) String() string { 11467 return fp.selector.String() 11468 } 11469 11470 // JSONString returns path representation is JSON convention 11471 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) JSONString() string { 11472 return strcase.ToLowerCamel(fp.String()) 11473 } 11474 11475 // Get returns all values pointed by specific field from source PolicySpec_SupportingAlertQuery_LogQuery 11476 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) Get(source *PolicySpec_SupportingAlertQuery_LogQuery) (values []interface{}) { 11477 if source != nil { 11478 switch fp.selector { 11479 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11480 values = append(values, source.Description) 11481 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11482 values = append(values, source.FilterTemplate) 11483 default: 11484 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fp.selector)) 11485 } 11486 } 11487 return 11488 } 11489 11490 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 11491 return fp.Get(source.(*PolicySpec_SupportingAlertQuery_LogQuery)) 11492 } 11493 11494 // GetSingle returns value pointed by specific field of from source PolicySpec_SupportingAlertQuery_LogQuery 11495 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) GetSingle(source *PolicySpec_SupportingAlertQuery_LogQuery) (interface{}, bool) { 11496 switch fp.selector { 11497 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11498 return source.GetDescription(), source != nil 11499 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11500 return source.GetFilterTemplate(), source != nil 11501 default: 11502 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fp.selector)) 11503 } 11504 } 11505 11506 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 11507 return fp.GetSingle(source.(*PolicySpec_SupportingAlertQuery_LogQuery)) 11508 } 11509 11510 // GetDefault returns a default value of the field type 11511 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) GetDefault() interface{} { 11512 switch fp.selector { 11513 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11514 return "" 11515 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11516 return "" 11517 default: 11518 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fp.selector)) 11519 } 11520 } 11521 11522 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) ClearValue(item *PolicySpec_SupportingAlertQuery_LogQuery) { 11523 if item != nil { 11524 switch fp.selector { 11525 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11526 item.Description = "" 11527 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11528 item.FilterTemplate = "" 11529 default: 11530 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fp.selector)) 11531 } 11532 } 11533 } 11534 11535 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 11536 fp.ClearValue(item.(*PolicySpec_SupportingAlertQuery_LogQuery)) 11537 } 11538 11539 // IsLeaf - whether field path is holds simple value 11540 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) IsLeaf() bool { 11541 return fp.selector == PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription || 11542 fp.selector == PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate 11543 } 11544 11545 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 11546 return []gotenobject.FieldPath{fp} 11547 } 11548 11549 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) WithIValue(value interface{}) PolicySpecSupportingAlertQueryLogQuery_FieldPathValue { 11550 switch fp.selector { 11551 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11552 return &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath: *fp, value: value.(string)} 11553 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11554 return &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath: *fp, value: value.(string)} 11555 default: 11556 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fp.selector)) 11557 } 11558 } 11559 11560 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 11561 return fp.WithIValue(value) 11562 } 11563 11564 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues { 11565 fpaov := &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath: *fp} 11566 switch fp.selector { 11567 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11568 return &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath: *fp, values: values.([]string)} 11569 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11570 return &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath: *fp, values: values.([]string)} 11571 default: 11572 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fp.selector)) 11573 } 11574 return fpaov 11575 } 11576 11577 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 11578 return fp.WithIArrayOfValues(values) 11579 } 11580 11581 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue { 11582 switch fp.selector { 11583 default: 11584 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fp.selector)) 11585 } 11586 } 11587 11588 func (fp *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 11589 return fp.WithIArrayItemValue(value) 11590 } 11591 11592 // PolicySpecSupportingAlertQueryLogQuery_FieldPathValue allows storing values for LogQuery fields according to their type 11593 type PolicySpecSupportingAlertQueryLogQuery_FieldPathValue interface { 11594 PolicySpecSupportingAlertQueryLogQuery_FieldPath 11595 gotenobject.FieldPathValue 11596 SetTo(target **PolicySpec_SupportingAlertQuery_LogQuery) 11597 CompareWith(*PolicySpec_SupportingAlertQuery_LogQuery) (cmp int, comparable bool) 11598 } 11599 11600 func ParsePolicySpecSupportingAlertQueryLogQuery_FieldPathValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryLogQuery_FieldPathValue, error) { 11601 fp, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(pathStr) 11602 if err != nil { 11603 return nil, err 11604 } 11605 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 11606 if err != nil { 11607 return nil, status.Errorf(codes.InvalidArgument, "error parsing LogQuery field path value from %s: %v", valueStr, err) 11608 } 11609 return fpv.(PolicySpecSupportingAlertQueryLogQuery_FieldPathValue), nil 11610 } 11611 11612 func MustParsePolicySpecSupportingAlertQueryLogQuery_FieldPathValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryLogQuery_FieldPathValue { 11613 fpv, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPathValue(pathStr, valueStr) 11614 if err != nil { 11615 panic(err) 11616 } 11617 return fpv 11618 } 11619 11620 type PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue struct { 11621 PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath 11622 value interface{} 11623 } 11624 11625 var _ PolicySpecSupportingAlertQueryLogQuery_FieldPathValue = (*PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue)(nil) 11626 11627 // GetRawValue returns raw value stored under selected path for 'LogQuery' as interface{} 11628 func (fpv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue) GetRawValue() interface{} { 11629 return fpv.value 11630 } 11631 func (fpv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue) AsDescriptionValue() (string, bool) { 11632 res, ok := fpv.value.(string) 11633 return res, ok 11634 } 11635 func (fpv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue) AsFilterTemplateValue() (string, bool) { 11636 res, ok := fpv.value.(string) 11637 return res, ok 11638 } 11639 11640 // SetTo stores value for selected field for object LogQuery 11641 func (fpv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue) SetTo(target **PolicySpec_SupportingAlertQuery_LogQuery) { 11642 if *target == nil { 11643 *target = new(PolicySpec_SupportingAlertQuery_LogQuery) 11644 } 11645 switch fpv.selector { 11646 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11647 (*target).Description = fpv.value.(string) 11648 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11649 (*target).FilterTemplate = fpv.value.(string) 11650 default: 11651 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fpv.selector)) 11652 } 11653 } 11654 11655 func (fpv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 11656 typedObject := target.(*PolicySpec_SupportingAlertQuery_LogQuery) 11657 fpv.SetTo(&typedObject) 11658 } 11659 11660 // CompareWith compares value in the 'PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue' with the value under path in 'PolicySpec_SupportingAlertQuery_LogQuery'. 11661 func (fpv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue) CompareWith(source *PolicySpec_SupportingAlertQuery_LogQuery) (int, bool) { 11662 switch fpv.selector { 11663 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11664 leftValue := fpv.value.(string) 11665 rightValue := source.GetDescription() 11666 if (leftValue) == (rightValue) { 11667 return 0, true 11668 } else if (leftValue) < (rightValue) { 11669 return -1, true 11670 } else { 11671 return 1, true 11672 } 11673 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11674 leftValue := fpv.value.(string) 11675 rightValue := source.GetFilterTemplate() 11676 if (leftValue) == (rightValue) { 11677 return 0, true 11678 } else if (leftValue) < (rightValue) { 11679 return -1, true 11680 } else { 11681 return 1, true 11682 } 11683 default: 11684 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_LogQuery: %d", fpv.selector)) 11685 } 11686 } 11687 11688 func (fpv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 11689 return fpv.CompareWith(source.(*PolicySpec_SupportingAlertQuery_LogQuery)) 11690 } 11691 11692 // PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for LogQuery according to their type 11693 // Present only for array (repeated) types. 11694 type PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue interface { 11695 gotenobject.FieldPathArrayItemValue 11696 PolicySpecSupportingAlertQueryLogQuery_FieldPath 11697 ContainsValue(*PolicySpec_SupportingAlertQuery_LogQuery) bool 11698 } 11699 11700 // ParsePolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 11701 func ParsePolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue, error) { 11702 fp, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(pathStr) 11703 if err != nil { 11704 return nil, err 11705 } 11706 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 11707 if err != nil { 11708 return nil, status.Errorf(codes.InvalidArgument, "error parsing LogQuery field path array item value from %s: %v", valueStr, err) 11709 } 11710 return fpaiv.(PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue), nil 11711 } 11712 11713 func MustParsePolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue { 11714 fpaiv, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue(pathStr, valueStr) 11715 if err != nil { 11716 panic(err) 11717 } 11718 return fpaiv 11719 } 11720 11721 type PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayItemValue struct { 11722 PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath 11723 value interface{} 11724 } 11725 11726 var _ PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayItemValue = (*PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayItemValue)(nil) 11727 11728 // GetRawValue returns stored element value for array in object PolicySpec_SupportingAlertQuery_LogQuery as interface{} 11729 func (fpaiv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 11730 return fpaiv.value 11731 } 11732 11733 func (fpaiv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_SupportingAlertQuery_LogQuery) (interface{}, bool) { 11734 return nil, false 11735 } 11736 11737 func (fpaiv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 11738 return fpaiv.GetSingle(source.(*PolicySpec_SupportingAlertQuery_LogQuery)) 11739 } 11740 11741 // Contains returns a boolean indicating if value that is being held is present in given 'LogQuery' 11742 func (fpaiv *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_SupportingAlertQuery_LogQuery) bool { 11743 slice := fpaiv.PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath.Get(source) 11744 for _, v := range slice { 11745 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 11746 if proto.Equal(asProtoMsg, v.(proto.Message)) { 11747 return true 11748 } 11749 } else if reflect.DeepEqual(v, fpaiv.value) { 11750 return true 11751 } 11752 } 11753 return false 11754 } 11755 11756 // PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues allows storing slice of values for LogQuery fields according to their type 11757 type PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues interface { 11758 gotenobject.FieldPathArrayOfValues 11759 PolicySpecSupportingAlertQueryLogQuery_FieldPath 11760 } 11761 11762 func ParsePolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues, error) { 11763 fp, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(pathStr) 11764 if err != nil { 11765 return nil, err 11766 } 11767 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 11768 if err != nil { 11769 return nil, status.Errorf(codes.InvalidArgument, "error parsing LogQuery field path array of values from %s: %v", valuesStr, err) 11770 } 11771 return fpaov.(PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues), nil 11772 } 11773 11774 func MustParsePolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues { 11775 fpaov, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues(pathStr, valuesStr) 11776 if err != nil { 11777 panic(err) 11778 } 11779 return fpaov 11780 } 11781 11782 type PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues struct { 11783 PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath 11784 values interface{} 11785 } 11786 11787 var _ PolicySpecSupportingAlertQueryLogQuery_FieldPathArrayOfValues = (*PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues)(nil) 11788 11789 func (fpaov *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 11790 switch fpaov.selector { 11791 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 11792 for _, v := range fpaov.values.([]string) { 11793 values = append(values, v) 11794 } 11795 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 11796 for _, v := range fpaov.values.([]string) { 11797 values = append(values, v) 11798 } 11799 } 11800 return 11801 } 11802 func (fpaov *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues) AsDescriptionArrayOfValues() ([]string, bool) { 11803 res, ok := fpaov.values.([]string) 11804 return res, ok 11805 } 11806 func (fpaov *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPathArrayOfValues) AsFilterTemplateArrayOfValues() ([]string, bool) { 11807 res, ok := fpaov.values.([]string) 11808 return res, ok 11809 } 11810 11811 // FieldPath provides implementation to handle 11812 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 11813 type PolicySpecSupportingAlertQueryRestGetQuery_FieldPath interface { 11814 gotenobject.FieldPath 11815 Selector() PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector 11816 Get(source *PolicySpec_SupportingAlertQuery_RestGetQuery) []interface{} 11817 GetSingle(source *PolicySpec_SupportingAlertQuery_RestGetQuery) (interface{}, bool) 11818 ClearValue(item *PolicySpec_SupportingAlertQuery_RestGetQuery) 11819 11820 // Those methods build corresponding PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue 11821 // (or array of values) and holds passed value. Panics if injected type is incorrect. 11822 WithIValue(value interface{}) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue 11823 WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues 11824 WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue 11825 } 11826 11827 type PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector int32 11828 11829 const ( 11830 PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector = 0 11831 PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector = 1 11832 PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector = 2 11833 PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector = 3 11834 PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector = 4 11835 ) 11836 11837 func (s PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector) String() string { 11838 switch s { 11839 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 11840 return "description" 11841 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 11842 return "endpoint" 11843 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 11844 return "path_template" 11845 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 11846 return "view" 11847 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 11848 return "field_mask" 11849 default: 11850 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", s)) 11851 } 11852 } 11853 11854 func BuildPolicySpecSupportingAlertQueryRestGetQuery_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecSupportingAlertQueryRestGetQuery_FieldPath, error) { 11855 if len(fp) == 0 { 11856 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_SupportingAlertQuery_RestGetQuery") 11857 } 11858 if len(fp) == 1 { 11859 switch fp[0] { 11860 case "description": 11861 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription}, nil 11862 case "endpoint": 11863 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint}, nil 11864 case "path_template", "pathTemplate", "path-template": 11865 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate}, nil 11866 case "view": 11867 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView}, nil 11868 case "field_mask", "fieldMask", "field-mask": 11869 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask}, nil 11870 } 11871 } 11872 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_SupportingAlertQuery_RestGetQuery", fp) 11873 } 11874 11875 func ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(rawField string) (PolicySpecSupportingAlertQueryRestGetQuery_FieldPath, error) { 11876 fp, err := gotenobject.ParseRawFieldPath(rawField) 11877 if err != nil { 11878 return nil, err 11879 } 11880 return BuildPolicySpecSupportingAlertQueryRestGetQuery_FieldPath(fp) 11881 } 11882 11883 func MustParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(rawField string) PolicySpecSupportingAlertQueryRestGetQuery_FieldPath { 11884 fp, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(rawField) 11885 if err != nil { 11886 panic(err) 11887 } 11888 return fp 11889 } 11890 11891 type PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath struct { 11892 selector PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector 11893 } 11894 11895 var _ PolicySpecSupportingAlertQueryRestGetQuery_FieldPath = (*PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath)(nil) 11896 11897 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) Selector() PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelector { 11898 return fp.selector 11899 } 11900 11901 // String returns path representation in proto convention 11902 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) String() string { 11903 return fp.selector.String() 11904 } 11905 11906 // JSONString returns path representation is JSON convention 11907 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) JSONString() string { 11908 return strcase.ToLowerCamel(fp.String()) 11909 } 11910 11911 // Get returns all values pointed by specific field from source PolicySpec_SupportingAlertQuery_RestGetQuery 11912 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) Get(source *PolicySpec_SupportingAlertQuery_RestGetQuery) (values []interface{}) { 11913 if source != nil { 11914 switch fp.selector { 11915 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 11916 values = append(values, source.Description) 11917 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 11918 values = append(values, source.Endpoint) 11919 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 11920 values = append(values, source.PathTemplate) 11921 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 11922 values = append(values, source.View) 11923 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 11924 values = append(values, source.FieldMask) 11925 default: 11926 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fp.selector)) 11927 } 11928 } 11929 return 11930 } 11931 11932 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 11933 return fp.Get(source.(*PolicySpec_SupportingAlertQuery_RestGetQuery)) 11934 } 11935 11936 // GetSingle returns value pointed by specific field of from source PolicySpec_SupportingAlertQuery_RestGetQuery 11937 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) GetSingle(source *PolicySpec_SupportingAlertQuery_RestGetQuery) (interface{}, bool) { 11938 switch fp.selector { 11939 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 11940 return source.GetDescription(), source != nil 11941 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 11942 return source.GetEndpoint(), source != nil 11943 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 11944 return source.GetPathTemplate(), source != nil 11945 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 11946 return source.GetView(), source != nil 11947 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 11948 return source.GetFieldMask(), source != nil 11949 default: 11950 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fp.selector)) 11951 } 11952 } 11953 11954 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 11955 return fp.GetSingle(source.(*PolicySpec_SupportingAlertQuery_RestGetQuery)) 11956 } 11957 11958 // GetDefault returns a default value of the field type 11959 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) GetDefault() interface{} { 11960 switch fp.selector { 11961 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 11962 return "" 11963 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 11964 return "" 11965 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 11966 return "" 11967 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 11968 return "" 11969 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 11970 return "" 11971 default: 11972 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fp.selector)) 11973 } 11974 } 11975 11976 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) ClearValue(item *PolicySpec_SupportingAlertQuery_RestGetQuery) { 11977 if item != nil { 11978 switch fp.selector { 11979 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 11980 item.Description = "" 11981 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 11982 item.Endpoint = "" 11983 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 11984 item.PathTemplate = "" 11985 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 11986 item.View = "" 11987 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 11988 item.FieldMask = "" 11989 default: 11990 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fp.selector)) 11991 } 11992 } 11993 } 11994 11995 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 11996 fp.ClearValue(item.(*PolicySpec_SupportingAlertQuery_RestGetQuery)) 11997 } 11998 11999 // IsLeaf - whether field path is holds simple value 12000 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) IsLeaf() bool { 12001 return fp.selector == PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription || 12002 fp.selector == PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint || 12003 fp.selector == PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate || 12004 fp.selector == PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView || 12005 fp.selector == PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask 12006 } 12007 12008 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 12009 return []gotenobject.FieldPath{fp} 12010 } 12011 12012 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) WithIValue(value interface{}) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue { 12013 switch fp.selector { 12014 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 12015 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, value: value.(string)} 12016 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 12017 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, value: value.(string)} 12018 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 12019 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, value: value.(string)} 12020 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 12021 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, value: value.(string)} 12022 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 12023 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, value: value.(string)} 12024 default: 12025 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fp.selector)) 12026 } 12027 } 12028 12029 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 12030 return fp.WithIValue(value) 12031 } 12032 12033 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues { 12034 fpaov := &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp} 12035 switch fp.selector { 12036 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 12037 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, values: values.([]string)} 12038 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 12039 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, values: values.([]string)} 12040 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 12041 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, values: values.([]string)} 12042 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 12043 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, values: values.([]string)} 12044 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 12045 return &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: *fp, values: values.([]string)} 12046 default: 12047 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fp.selector)) 12048 } 12049 return fpaov 12050 } 12051 12052 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 12053 return fp.WithIArrayOfValues(values) 12054 } 12055 12056 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue { 12057 switch fp.selector { 12058 default: 12059 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fp.selector)) 12060 } 12061 } 12062 12063 func (fp *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 12064 return fp.WithIArrayItemValue(value) 12065 } 12066 12067 // PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue allows storing values for RestGetQuery fields according to their type 12068 type PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue interface { 12069 PolicySpecSupportingAlertQueryRestGetQuery_FieldPath 12070 gotenobject.FieldPathValue 12071 SetTo(target **PolicySpec_SupportingAlertQuery_RestGetQuery) 12072 CompareWith(*PolicySpec_SupportingAlertQuery_RestGetQuery) (cmp int, comparable bool) 12073 } 12074 12075 func ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue, error) { 12076 fp, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(pathStr) 12077 if err != nil { 12078 return nil, err 12079 } 12080 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 12081 if err != nil { 12082 return nil, status.Errorf(codes.InvalidArgument, "error parsing RestGetQuery field path value from %s: %v", valueStr, err) 12083 } 12084 return fpv.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue), nil 12085 } 12086 12087 func MustParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue { 12088 fpv, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue(pathStr, valueStr) 12089 if err != nil { 12090 panic(err) 12091 } 12092 return fpv 12093 } 12094 12095 type PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue struct { 12096 PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath 12097 value interface{} 12098 } 12099 12100 var _ PolicySpecSupportingAlertQueryRestGetQuery_FieldPathValue = (*PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue)(nil) 12101 12102 // GetRawValue returns raw value stored under selected path for 'RestGetQuery' as interface{} 12103 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) GetRawValue() interface{} { 12104 return fpv.value 12105 } 12106 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) AsDescriptionValue() (string, bool) { 12107 res, ok := fpv.value.(string) 12108 return res, ok 12109 } 12110 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) AsEndpointValue() (string, bool) { 12111 res, ok := fpv.value.(string) 12112 return res, ok 12113 } 12114 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) AsPathTemplateValue() (string, bool) { 12115 res, ok := fpv.value.(string) 12116 return res, ok 12117 } 12118 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) AsViewValue() (string, bool) { 12119 res, ok := fpv.value.(string) 12120 return res, ok 12121 } 12122 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) AsFieldMaskValue() (string, bool) { 12123 res, ok := fpv.value.(string) 12124 return res, ok 12125 } 12126 12127 // SetTo stores value for selected field for object RestGetQuery 12128 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) SetTo(target **PolicySpec_SupportingAlertQuery_RestGetQuery) { 12129 if *target == nil { 12130 *target = new(PolicySpec_SupportingAlertQuery_RestGetQuery) 12131 } 12132 switch fpv.selector { 12133 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 12134 (*target).Description = fpv.value.(string) 12135 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 12136 (*target).Endpoint = fpv.value.(string) 12137 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 12138 (*target).PathTemplate = fpv.value.(string) 12139 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 12140 (*target).View = fpv.value.(string) 12141 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 12142 (*target).FieldMask = fpv.value.(string) 12143 default: 12144 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fpv.selector)) 12145 } 12146 } 12147 12148 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 12149 typedObject := target.(*PolicySpec_SupportingAlertQuery_RestGetQuery) 12150 fpv.SetTo(&typedObject) 12151 } 12152 12153 // CompareWith compares value in the 'PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue' with the value under path in 'PolicySpec_SupportingAlertQuery_RestGetQuery'. 12154 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) CompareWith(source *PolicySpec_SupportingAlertQuery_RestGetQuery) (int, bool) { 12155 switch fpv.selector { 12156 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 12157 leftValue := fpv.value.(string) 12158 rightValue := source.GetDescription() 12159 if (leftValue) == (rightValue) { 12160 return 0, true 12161 } else if (leftValue) < (rightValue) { 12162 return -1, true 12163 } else { 12164 return 1, true 12165 } 12166 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 12167 leftValue := fpv.value.(string) 12168 rightValue := source.GetEndpoint() 12169 if (leftValue) == (rightValue) { 12170 return 0, true 12171 } else if (leftValue) < (rightValue) { 12172 return -1, true 12173 } else { 12174 return 1, true 12175 } 12176 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 12177 leftValue := fpv.value.(string) 12178 rightValue := source.GetPathTemplate() 12179 if (leftValue) == (rightValue) { 12180 return 0, true 12181 } else if (leftValue) < (rightValue) { 12182 return -1, true 12183 } else { 12184 return 1, true 12185 } 12186 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 12187 leftValue := fpv.value.(string) 12188 rightValue := source.GetView() 12189 if (leftValue) == (rightValue) { 12190 return 0, true 12191 } else if (leftValue) < (rightValue) { 12192 return -1, true 12193 } else { 12194 return 1, true 12195 } 12196 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 12197 leftValue := fpv.value.(string) 12198 rightValue := source.GetFieldMask() 12199 if (leftValue) == (rightValue) { 12200 return 0, true 12201 } else if (leftValue) < (rightValue) { 12202 return -1, true 12203 } else { 12204 return 1, true 12205 } 12206 default: 12207 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestGetQuery: %d", fpv.selector)) 12208 } 12209 } 12210 12211 func (fpv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 12212 return fpv.CompareWith(source.(*PolicySpec_SupportingAlertQuery_RestGetQuery)) 12213 } 12214 12215 // PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for RestGetQuery according to their type 12216 // Present only for array (repeated) types. 12217 type PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue interface { 12218 gotenobject.FieldPathArrayItemValue 12219 PolicySpecSupportingAlertQueryRestGetQuery_FieldPath 12220 ContainsValue(*PolicySpec_SupportingAlertQuery_RestGetQuery) bool 12221 } 12222 12223 // ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 12224 func ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue, error) { 12225 fp, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(pathStr) 12226 if err != nil { 12227 return nil, err 12228 } 12229 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 12230 if err != nil { 12231 return nil, status.Errorf(codes.InvalidArgument, "error parsing RestGetQuery field path array item value from %s: %v", valueStr, err) 12232 } 12233 return fpaiv.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue), nil 12234 } 12235 12236 func MustParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue { 12237 fpaiv, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue(pathStr, valueStr) 12238 if err != nil { 12239 panic(err) 12240 } 12241 return fpaiv 12242 } 12243 12244 type PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayItemValue struct { 12245 PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath 12246 value interface{} 12247 } 12248 12249 var _ PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayItemValue = (*PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayItemValue)(nil) 12250 12251 // GetRawValue returns stored element value for array in object PolicySpec_SupportingAlertQuery_RestGetQuery as interface{} 12252 func (fpaiv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 12253 return fpaiv.value 12254 } 12255 12256 func (fpaiv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_SupportingAlertQuery_RestGetQuery) (interface{}, bool) { 12257 return nil, false 12258 } 12259 12260 func (fpaiv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 12261 return fpaiv.GetSingle(source.(*PolicySpec_SupportingAlertQuery_RestGetQuery)) 12262 } 12263 12264 // Contains returns a boolean indicating if value that is being held is present in given 'RestGetQuery' 12265 func (fpaiv *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_SupportingAlertQuery_RestGetQuery) bool { 12266 slice := fpaiv.PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath.Get(source) 12267 for _, v := range slice { 12268 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 12269 if proto.Equal(asProtoMsg, v.(proto.Message)) { 12270 return true 12271 } 12272 } else if reflect.DeepEqual(v, fpaiv.value) { 12273 return true 12274 } 12275 } 12276 return false 12277 } 12278 12279 // PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues allows storing slice of values for RestGetQuery fields according to their type 12280 type PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues interface { 12281 gotenobject.FieldPathArrayOfValues 12282 PolicySpecSupportingAlertQueryRestGetQuery_FieldPath 12283 } 12284 12285 func ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues, error) { 12286 fp, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(pathStr) 12287 if err != nil { 12288 return nil, err 12289 } 12290 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 12291 if err != nil { 12292 return nil, status.Errorf(codes.InvalidArgument, "error parsing RestGetQuery field path array of values from %s: %v", valuesStr, err) 12293 } 12294 return fpaov.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues), nil 12295 } 12296 12297 func MustParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues { 12298 fpaov, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues(pathStr, valuesStr) 12299 if err != nil { 12300 panic(err) 12301 } 12302 return fpaov 12303 } 12304 12305 type PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues struct { 12306 PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath 12307 values interface{} 12308 } 12309 12310 var _ PolicySpecSupportingAlertQueryRestGetQuery_FieldPathArrayOfValues = (*PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues)(nil) 12311 12312 func (fpaov *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 12313 switch fpaov.selector { 12314 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 12315 for _, v := range fpaov.values.([]string) { 12316 values = append(values, v) 12317 } 12318 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 12319 for _, v := range fpaov.values.([]string) { 12320 values = append(values, v) 12321 } 12322 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 12323 for _, v := range fpaov.values.([]string) { 12324 values = append(values, v) 12325 } 12326 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 12327 for _, v := range fpaov.values.([]string) { 12328 values = append(values, v) 12329 } 12330 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 12331 for _, v := range fpaov.values.([]string) { 12332 values = append(values, v) 12333 } 12334 } 12335 return 12336 } 12337 func (fpaov *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues) AsDescriptionArrayOfValues() ([]string, bool) { 12338 res, ok := fpaov.values.([]string) 12339 return res, ok 12340 } 12341 func (fpaov *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues) AsEndpointArrayOfValues() ([]string, bool) { 12342 res, ok := fpaov.values.([]string) 12343 return res, ok 12344 } 12345 func (fpaov *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues) AsPathTemplateArrayOfValues() ([]string, bool) { 12346 res, ok := fpaov.values.([]string) 12347 return res, ok 12348 } 12349 func (fpaov *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues) AsViewArrayOfValues() ([]string, bool) { 12350 res, ok := fpaov.values.([]string) 12351 return res, ok 12352 } 12353 func (fpaov *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPathArrayOfValues) AsFieldMaskArrayOfValues() ([]string, bool) { 12354 res, ok := fpaov.values.([]string) 12355 return res, ok 12356 } 12357 12358 // FieldPath provides implementation to handle 12359 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 12360 type PolicySpecSupportingAlertQueryRestListQuery_FieldPath interface { 12361 gotenobject.FieldPath 12362 Selector() PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector 12363 Get(source *PolicySpec_SupportingAlertQuery_RestListQuery) []interface{} 12364 GetSingle(source *PolicySpec_SupportingAlertQuery_RestListQuery) (interface{}, bool) 12365 ClearValue(item *PolicySpec_SupportingAlertQuery_RestListQuery) 12366 12367 // Those methods build corresponding PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue 12368 // (or array of values) and holds passed value. Panics if injected type is incorrect. 12369 WithIValue(value interface{}) PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue 12370 WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues 12371 WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue 12372 } 12373 12374 type PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector int32 12375 12376 const ( 12377 PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector = 0 12378 PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector = 1 12379 PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector = 2 12380 PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector = 3 12381 PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector = 4 12382 PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector = 5 12383 ) 12384 12385 func (s PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector) String() string { 12386 switch s { 12387 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12388 return "description" 12389 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12390 return "endpoint" 12391 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12392 return "path_template" 12393 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12394 return "view" 12395 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12396 return "field_mask" 12397 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12398 return "filter_template" 12399 default: 12400 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", s)) 12401 } 12402 } 12403 12404 func BuildPolicySpecSupportingAlertQueryRestListQuery_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecSupportingAlertQueryRestListQuery_FieldPath, error) { 12405 if len(fp) == 0 { 12406 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_SupportingAlertQuery_RestListQuery") 12407 } 12408 if len(fp) == 1 { 12409 switch fp[0] { 12410 case "description": 12411 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription}, nil 12412 case "endpoint": 12413 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint}, nil 12414 case "path_template", "pathTemplate", "path-template": 12415 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate}, nil 12416 case "view": 12417 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView}, nil 12418 case "field_mask", "fieldMask", "field-mask": 12419 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask}, nil 12420 case "filter_template", "filterTemplate", "filter-template": 12421 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate}, nil 12422 } 12423 } 12424 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_SupportingAlertQuery_RestListQuery", fp) 12425 } 12426 12427 func ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(rawField string) (PolicySpecSupportingAlertQueryRestListQuery_FieldPath, error) { 12428 fp, err := gotenobject.ParseRawFieldPath(rawField) 12429 if err != nil { 12430 return nil, err 12431 } 12432 return BuildPolicySpecSupportingAlertQueryRestListQuery_FieldPath(fp) 12433 } 12434 12435 func MustParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(rawField string) PolicySpecSupportingAlertQueryRestListQuery_FieldPath { 12436 fp, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(rawField) 12437 if err != nil { 12438 panic(err) 12439 } 12440 return fp 12441 } 12442 12443 type PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath struct { 12444 selector PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector 12445 } 12446 12447 var _ PolicySpecSupportingAlertQueryRestListQuery_FieldPath = (*PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath)(nil) 12448 12449 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) Selector() PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelector { 12450 return fp.selector 12451 } 12452 12453 // String returns path representation in proto convention 12454 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) String() string { 12455 return fp.selector.String() 12456 } 12457 12458 // JSONString returns path representation is JSON convention 12459 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) JSONString() string { 12460 return strcase.ToLowerCamel(fp.String()) 12461 } 12462 12463 // Get returns all values pointed by specific field from source PolicySpec_SupportingAlertQuery_RestListQuery 12464 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) Get(source *PolicySpec_SupportingAlertQuery_RestListQuery) (values []interface{}) { 12465 if source != nil { 12466 switch fp.selector { 12467 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12468 values = append(values, source.Description) 12469 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12470 values = append(values, source.Endpoint) 12471 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12472 values = append(values, source.PathTemplate) 12473 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12474 values = append(values, source.View) 12475 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12476 values = append(values, source.FieldMask) 12477 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12478 values = append(values, source.FilterTemplate) 12479 default: 12480 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fp.selector)) 12481 } 12482 } 12483 return 12484 } 12485 12486 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 12487 return fp.Get(source.(*PolicySpec_SupportingAlertQuery_RestListQuery)) 12488 } 12489 12490 // GetSingle returns value pointed by specific field of from source PolicySpec_SupportingAlertQuery_RestListQuery 12491 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) GetSingle(source *PolicySpec_SupportingAlertQuery_RestListQuery) (interface{}, bool) { 12492 switch fp.selector { 12493 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12494 return source.GetDescription(), source != nil 12495 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12496 return source.GetEndpoint(), source != nil 12497 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12498 return source.GetPathTemplate(), source != nil 12499 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12500 return source.GetView(), source != nil 12501 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12502 return source.GetFieldMask(), source != nil 12503 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12504 return source.GetFilterTemplate(), source != nil 12505 default: 12506 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fp.selector)) 12507 } 12508 } 12509 12510 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 12511 return fp.GetSingle(source.(*PolicySpec_SupportingAlertQuery_RestListQuery)) 12512 } 12513 12514 // GetDefault returns a default value of the field type 12515 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) GetDefault() interface{} { 12516 switch fp.selector { 12517 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12518 return "" 12519 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12520 return "" 12521 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12522 return "" 12523 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12524 return "" 12525 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12526 return "" 12527 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12528 return "" 12529 default: 12530 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fp.selector)) 12531 } 12532 } 12533 12534 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) ClearValue(item *PolicySpec_SupportingAlertQuery_RestListQuery) { 12535 if item != nil { 12536 switch fp.selector { 12537 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12538 item.Description = "" 12539 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12540 item.Endpoint = "" 12541 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12542 item.PathTemplate = "" 12543 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12544 item.View = "" 12545 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12546 item.FieldMask = "" 12547 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12548 item.FilterTemplate = "" 12549 default: 12550 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fp.selector)) 12551 } 12552 } 12553 } 12554 12555 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) ClearValueRaw(item proto.Message) { 12556 fp.ClearValue(item.(*PolicySpec_SupportingAlertQuery_RestListQuery)) 12557 } 12558 12559 // IsLeaf - whether field path is holds simple value 12560 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) IsLeaf() bool { 12561 return fp.selector == PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription || 12562 fp.selector == PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint || 12563 fp.selector == PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate || 12564 fp.selector == PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView || 12565 fp.selector == PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask || 12566 fp.selector == PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate 12567 } 12568 12569 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 12570 return []gotenobject.FieldPath{fp} 12571 } 12572 12573 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) WithIValue(value interface{}) PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue { 12574 switch fp.selector { 12575 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12576 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, value: value.(string)} 12577 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12578 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, value: value.(string)} 12579 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12580 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, value: value.(string)} 12581 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12582 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, value: value.(string)} 12583 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12584 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, value: value.(string)} 12585 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12586 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, value: value.(string)} 12587 default: 12588 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fp.selector)) 12589 } 12590 } 12591 12592 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 12593 return fp.WithIValue(value) 12594 } 12595 12596 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues { 12597 fpaov := &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp} 12598 switch fp.selector { 12599 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12600 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, values: values.([]string)} 12601 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12602 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, values: values.([]string)} 12603 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12604 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, values: values.([]string)} 12605 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12606 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, values: values.([]string)} 12607 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12608 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, values: values.([]string)} 12609 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12610 return &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues{PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: *fp, values: values.([]string)} 12611 default: 12612 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fp.selector)) 12613 } 12614 return fpaov 12615 } 12616 12617 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 12618 return fp.WithIArrayOfValues(values) 12619 } 12620 12621 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue { 12622 switch fp.selector { 12623 default: 12624 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fp.selector)) 12625 } 12626 } 12627 12628 func (fp *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 12629 return fp.WithIArrayItemValue(value) 12630 } 12631 12632 // PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue allows storing values for RestListQuery fields according to their type 12633 type PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue interface { 12634 PolicySpecSupportingAlertQueryRestListQuery_FieldPath 12635 gotenobject.FieldPathValue 12636 SetTo(target **PolicySpec_SupportingAlertQuery_RestListQuery) 12637 CompareWith(*PolicySpec_SupportingAlertQuery_RestListQuery) (cmp int, comparable bool) 12638 } 12639 12640 func ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue, error) { 12641 fp, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(pathStr) 12642 if err != nil { 12643 return nil, err 12644 } 12645 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 12646 if err != nil { 12647 return nil, status.Errorf(codes.InvalidArgument, "error parsing RestListQuery field path value from %s: %v", valueStr, err) 12648 } 12649 return fpv.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue), nil 12650 } 12651 12652 func MustParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue { 12653 fpv, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathValue(pathStr, valueStr) 12654 if err != nil { 12655 panic(err) 12656 } 12657 return fpv 12658 } 12659 12660 type PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue struct { 12661 PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath 12662 value interface{} 12663 } 12664 12665 var _ PolicySpecSupportingAlertQueryRestListQuery_FieldPathValue = (*PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue)(nil) 12666 12667 // GetRawValue returns raw value stored under selected path for 'RestListQuery' as interface{} 12668 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) GetRawValue() interface{} { 12669 return fpv.value 12670 } 12671 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) AsDescriptionValue() (string, bool) { 12672 res, ok := fpv.value.(string) 12673 return res, ok 12674 } 12675 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) AsEndpointValue() (string, bool) { 12676 res, ok := fpv.value.(string) 12677 return res, ok 12678 } 12679 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) AsPathTemplateValue() (string, bool) { 12680 res, ok := fpv.value.(string) 12681 return res, ok 12682 } 12683 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) AsViewValue() (string, bool) { 12684 res, ok := fpv.value.(string) 12685 return res, ok 12686 } 12687 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) AsFieldMaskValue() (string, bool) { 12688 res, ok := fpv.value.(string) 12689 return res, ok 12690 } 12691 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) AsFilterTemplateValue() (string, bool) { 12692 res, ok := fpv.value.(string) 12693 return res, ok 12694 } 12695 12696 // SetTo stores value for selected field for object RestListQuery 12697 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) SetTo(target **PolicySpec_SupportingAlertQuery_RestListQuery) { 12698 if *target == nil { 12699 *target = new(PolicySpec_SupportingAlertQuery_RestListQuery) 12700 } 12701 switch fpv.selector { 12702 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12703 (*target).Description = fpv.value.(string) 12704 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12705 (*target).Endpoint = fpv.value.(string) 12706 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12707 (*target).PathTemplate = fpv.value.(string) 12708 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12709 (*target).View = fpv.value.(string) 12710 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12711 (*target).FieldMask = fpv.value.(string) 12712 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12713 (*target).FilterTemplate = fpv.value.(string) 12714 default: 12715 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fpv.selector)) 12716 } 12717 } 12718 12719 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) SetToRaw(target proto.Message) { 12720 typedObject := target.(*PolicySpec_SupportingAlertQuery_RestListQuery) 12721 fpv.SetTo(&typedObject) 12722 } 12723 12724 // CompareWith compares value in the 'PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue' with the value under path in 'PolicySpec_SupportingAlertQuery_RestListQuery'. 12725 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) CompareWith(source *PolicySpec_SupportingAlertQuery_RestListQuery) (int, bool) { 12726 switch fpv.selector { 12727 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12728 leftValue := fpv.value.(string) 12729 rightValue := source.GetDescription() 12730 if (leftValue) == (rightValue) { 12731 return 0, true 12732 } else if (leftValue) < (rightValue) { 12733 return -1, true 12734 } else { 12735 return 1, true 12736 } 12737 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12738 leftValue := fpv.value.(string) 12739 rightValue := source.GetEndpoint() 12740 if (leftValue) == (rightValue) { 12741 return 0, true 12742 } else if (leftValue) < (rightValue) { 12743 return -1, true 12744 } else { 12745 return 1, true 12746 } 12747 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12748 leftValue := fpv.value.(string) 12749 rightValue := source.GetPathTemplate() 12750 if (leftValue) == (rightValue) { 12751 return 0, true 12752 } else if (leftValue) < (rightValue) { 12753 return -1, true 12754 } else { 12755 return 1, true 12756 } 12757 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12758 leftValue := fpv.value.(string) 12759 rightValue := source.GetView() 12760 if (leftValue) == (rightValue) { 12761 return 0, true 12762 } else if (leftValue) < (rightValue) { 12763 return -1, true 12764 } else { 12765 return 1, true 12766 } 12767 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12768 leftValue := fpv.value.(string) 12769 rightValue := source.GetFieldMask() 12770 if (leftValue) == (rightValue) { 12771 return 0, true 12772 } else if (leftValue) < (rightValue) { 12773 return -1, true 12774 } else { 12775 return 1, true 12776 } 12777 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12778 leftValue := fpv.value.(string) 12779 rightValue := source.GetFilterTemplate() 12780 if (leftValue) == (rightValue) { 12781 return 0, true 12782 } else if (leftValue) < (rightValue) { 12783 return -1, true 12784 } else { 12785 return 1, true 12786 } 12787 default: 12788 panic(fmt.Sprintf("Invalid selector for PolicySpec_SupportingAlertQuery_RestListQuery: %d", fpv.selector)) 12789 } 12790 } 12791 12792 func (fpv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 12793 return fpv.CompareWith(source.(*PolicySpec_SupportingAlertQuery_RestListQuery)) 12794 } 12795 12796 // PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue allows storing single item in Path-specific values for RestListQuery according to their type 12797 // Present only for array (repeated) types. 12798 type PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue interface { 12799 gotenobject.FieldPathArrayItemValue 12800 PolicySpecSupportingAlertQueryRestListQuery_FieldPath 12801 ContainsValue(*PolicySpec_SupportingAlertQuery_RestListQuery) bool 12802 } 12803 12804 // ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 12805 func ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue, error) { 12806 fp, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(pathStr) 12807 if err != nil { 12808 return nil, err 12809 } 12810 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 12811 if err != nil { 12812 return nil, status.Errorf(codes.InvalidArgument, "error parsing RestListQuery field path array item value from %s: %v", valueStr, err) 12813 } 12814 return fpaiv.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue), nil 12815 } 12816 12817 func MustParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue { 12818 fpaiv, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue(pathStr, valueStr) 12819 if err != nil { 12820 panic(err) 12821 } 12822 return fpaiv 12823 } 12824 12825 type PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayItemValue struct { 12826 PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath 12827 value interface{} 12828 } 12829 12830 var _ PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayItemValue = (*PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayItemValue)(nil) 12831 12832 // GetRawValue returns stored element value for array in object PolicySpec_SupportingAlertQuery_RestListQuery as interface{} 12833 func (fpaiv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 12834 return fpaiv.value 12835 } 12836 12837 func (fpaiv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_SupportingAlertQuery_RestListQuery) (interface{}, bool) { 12838 return nil, false 12839 } 12840 12841 func (fpaiv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 12842 return fpaiv.GetSingle(source.(*PolicySpec_SupportingAlertQuery_RestListQuery)) 12843 } 12844 12845 // Contains returns a boolean indicating if value that is being held is present in given 'RestListQuery' 12846 func (fpaiv *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_SupportingAlertQuery_RestListQuery) bool { 12847 slice := fpaiv.PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath.Get(source) 12848 for _, v := range slice { 12849 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 12850 if proto.Equal(asProtoMsg, v.(proto.Message)) { 12851 return true 12852 } 12853 } else if reflect.DeepEqual(v, fpaiv.value) { 12854 return true 12855 } 12856 } 12857 return false 12858 } 12859 12860 // PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues allows storing slice of values for RestListQuery fields according to their type 12861 type PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues interface { 12862 gotenobject.FieldPathArrayOfValues 12863 PolicySpecSupportingAlertQueryRestListQuery_FieldPath 12864 } 12865 12866 func ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues, error) { 12867 fp, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(pathStr) 12868 if err != nil { 12869 return nil, err 12870 } 12871 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 12872 if err != nil { 12873 return nil, status.Errorf(codes.InvalidArgument, "error parsing RestListQuery field path array of values from %s: %v", valuesStr, err) 12874 } 12875 return fpaov.(PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues), nil 12876 } 12877 12878 func MustParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues { 12879 fpaov, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues(pathStr, valuesStr) 12880 if err != nil { 12881 panic(err) 12882 } 12883 return fpaov 12884 } 12885 12886 type PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues struct { 12887 PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath 12888 values interface{} 12889 } 12890 12891 var _ PolicySpecSupportingAlertQueryRestListQuery_FieldPathArrayOfValues = (*PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues)(nil) 12892 12893 func (fpaov *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 12894 switch fpaov.selector { 12895 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 12896 for _, v := range fpaov.values.([]string) { 12897 values = append(values, v) 12898 } 12899 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 12900 for _, v := range fpaov.values.([]string) { 12901 values = append(values, v) 12902 } 12903 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 12904 for _, v := range fpaov.values.([]string) { 12905 values = append(values, v) 12906 } 12907 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 12908 for _, v := range fpaov.values.([]string) { 12909 values = append(values, v) 12910 } 12911 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 12912 for _, v := range fpaov.values.([]string) { 12913 values = append(values, v) 12914 } 12915 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 12916 for _, v := range fpaov.values.([]string) { 12917 values = append(values, v) 12918 } 12919 } 12920 return 12921 } 12922 func (fpaov *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues) AsDescriptionArrayOfValues() ([]string, bool) { 12923 res, ok := fpaov.values.([]string) 12924 return res, ok 12925 } 12926 func (fpaov *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues) AsEndpointArrayOfValues() ([]string, bool) { 12927 res, ok := fpaov.values.([]string) 12928 return res, ok 12929 } 12930 func (fpaov *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues) AsPathTemplateArrayOfValues() ([]string, bool) { 12931 res, ok := fpaov.values.([]string) 12932 return res, ok 12933 } 12934 func (fpaov *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues) AsViewArrayOfValues() ([]string, bool) { 12935 res, ok := fpaov.values.([]string) 12936 return res, ok 12937 } 12938 func (fpaov *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues) AsFieldMaskArrayOfValues() ([]string, bool) { 12939 res, ok := fpaov.values.([]string) 12940 return res, ok 12941 } 12942 func (fpaov *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPathArrayOfValues) AsFilterTemplateArrayOfValues() ([]string, bool) { 12943 res, ok := fpaov.values.([]string) 12944 return res, ok 12945 } 12946 12947 // FieldPath provides implementation to handle 12948 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 12949 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath interface { 12950 gotenobject.FieldPath 12951 Selector() PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector 12952 Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity) []interface{} 12953 GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (interface{}, bool) 12954 ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity) 12955 12956 // Those methods build corresponding PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue 12957 // (or array of values) and holds passed value. Panics if injected type is incorrect. 12958 WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue 12959 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues 12960 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue 12961 } 12962 12963 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector int32 12964 12965 const ( 12966 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector = 0 12967 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector = 1 12968 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector = 2 12969 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector = 3 12970 ) 12971 12972 func (s PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector) String() string { 12973 switch s { 12974 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 12975 return "device_ssh" 12976 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 12977 return "proxies_ssh" 12978 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 12979 return "pod_ssh" 12980 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 12981 return "allowed_bins" 12982 default: 12983 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", s)) 12984 } 12985 } 12986 12987 func BuildPolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath, error) { 12988 if len(fp) == 0 { 12989 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling_EdgeConnectivity") 12990 } 12991 if len(fp) == 1 { 12992 switch fp[0] { 12993 case "device_ssh", "deviceSsh", "device-ssh": 12994 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh}, nil 12995 case "proxies_ssh", "proxiesSsh", "proxies-ssh": 12996 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh}, nil 12997 case "pod_ssh", "podSsh", "pod-ssh": 12998 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh}, nil 12999 case "allowed_bins", "allowedBins", "allowed-bins": 13000 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins}, nil 13001 } 13002 } else { 13003 switch fp[0] { 13004 case "device_ssh", "deviceSsh", "device-ssh": 13005 if subpath, err := BuildPolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(fp[1:]); err != nil { 13006 return nil, err 13007 } else { 13008 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh, subPath: subpath}, nil 13009 } 13010 case "proxies_ssh", "proxiesSsh", "proxies-ssh": 13011 if subpath, err := BuildPolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(fp[1:]); err != nil { 13012 return nil, err 13013 } else { 13014 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh, subPath: subpath}, nil 13015 } 13016 case "pod_ssh", "podSsh", "pod-ssh": 13017 if subpath, err := BuildPolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(fp[1:]); err != nil { 13018 return nil, err 13019 } else { 13020 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh, subPath: subpath}, nil 13021 } 13022 } 13023 } 13024 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling_EdgeConnectivity", fp) 13025 } 13026 13027 func ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(rawField string) (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath, error) { 13028 fp, err := gotenobject.ParseRawFieldPath(rawField) 13029 if err != nil { 13030 return nil, err 13031 } 13032 return BuildPolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(fp) 13033 } 13034 13035 func MustParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(rawField string) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath { 13036 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(rawField) 13037 if err != nil { 13038 panic(err) 13039 } 13040 return fp 13041 } 13042 13043 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath struct { 13044 selector PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector 13045 } 13046 13047 var _ PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath = (*PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath)(nil) 13048 13049 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) Selector() PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector { 13050 return fp.selector 13051 } 13052 13053 // String returns path representation in proto convention 13054 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) String() string { 13055 return fp.selector.String() 13056 } 13057 13058 // JSONString returns path representation is JSON convention 13059 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) JSONString() string { 13060 return strcase.ToLowerCamel(fp.String()) 13061 } 13062 13063 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling_EdgeConnectivity 13064 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (values []interface{}) { 13065 if source != nil { 13066 switch fp.selector { 13067 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13068 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh); ok && source != nil { 13069 if source.DeviceSsh != nil { 13070 values = append(values, source.DeviceSsh) 13071 } 13072 } 13073 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13074 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh); ok && source != nil { 13075 if source.ProxiesSsh != nil { 13076 values = append(values, source.ProxiesSsh) 13077 } 13078 } 13079 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13080 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh); ok && source != nil { 13081 if source.PodSsh != nil { 13082 values = append(values, source.PodSsh) 13083 } 13084 } 13085 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13086 for _, value := range source.GetAllowedBins() { 13087 values = append(values, value) 13088 } 13089 default: 13090 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fp.selector)) 13091 } 13092 } 13093 return 13094 } 13095 13096 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 13097 return fp.Get(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13098 } 13099 13100 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling_EdgeConnectivity 13101 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (interface{}, bool) { 13102 switch fp.selector { 13103 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13104 // if object nil or oneof not active, return "default" type with false flag. 13105 if source == nil { 13106 return source.GetDeviceSsh(), false 13107 } 13108 _, oneOfSelected := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh) 13109 if !oneOfSelected { 13110 return source.GetDeviceSsh(), false // to return "type" information 13111 } 13112 res := source.GetDeviceSsh() 13113 return res, res != nil 13114 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13115 // if object nil or oneof not active, return "default" type with false flag. 13116 if source == nil { 13117 return source.GetProxiesSsh(), false 13118 } 13119 _, oneOfSelected := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh) 13120 if !oneOfSelected { 13121 return source.GetProxiesSsh(), false // to return "type" information 13122 } 13123 res := source.GetProxiesSsh() 13124 return res, res != nil 13125 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13126 // if object nil or oneof not active, return "default" type with false flag. 13127 if source == nil { 13128 return source.GetPodSsh(), false 13129 } 13130 _, oneOfSelected := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh) 13131 if !oneOfSelected { 13132 return source.GetPodSsh(), false // to return "type" information 13133 } 13134 res := source.GetPodSsh() 13135 return res, res != nil 13136 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13137 res := source.GetAllowedBins() 13138 return res, res != nil 13139 default: 13140 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fp.selector)) 13141 } 13142 } 13143 13144 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 13145 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13146 } 13147 13148 // GetDefault returns a default value of the field type 13149 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) GetDefault() interface{} { 13150 switch fp.selector { 13151 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13152 return (*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)(nil) 13153 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13154 return (*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)(nil) 13155 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13156 return (*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)(nil) 13157 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13158 return ([]string)(nil) 13159 default: 13160 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fp.selector)) 13161 } 13162 } 13163 13164 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity) { 13165 if item != nil { 13166 switch fp.selector { 13167 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13168 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh); ok { 13169 item.DeviceSsh = nil 13170 } 13171 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13172 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh); ok { 13173 item.ProxiesSsh = nil 13174 } 13175 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13176 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh); ok { 13177 item.PodSsh = nil 13178 } 13179 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13180 item.AllowedBins = nil 13181 default: 13182 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fp.selector)) 13183 } 13184 } 13185 } 13186 13187 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) ClearValueRaw(item proto.Message) { 13188 fp.ClearValue(item.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13189 } 13190 13191 // IsLeaf - whether field path is holds simple value 13192 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) IsLeaf() bool { 13193 return fp.selector == PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins 13194 } 13195 13196 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 13197 return []gotenobject.FieldPath{fp} 13198 } 13199 13200 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue { 13201 switch fp.selector { 13202 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13203 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)} 13204 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13205 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)} 13206 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13207 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)} 13208 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13209 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, value: value.([]string)} 13210 default: 13211 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fp.selector)) 13212 } 13213 } 13214 13215 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 13216 return fp.WithIValue(value) 13217 } 13218 13219 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues { 13220 fpaov := &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp} 13221 switch fp.selector { 13222 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13223 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, values: values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)} 13224 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13225 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, values: values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)} 13226 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13227 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, values: values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)} 13228 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13229 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, values: values.([][]string)} 13230 default: 13231 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fp.selector)) 13232 } 13233 return fpaov 13234 } 13235 13236 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 13237 return fp.WithIArrayOfValues(values) 13238 } 13239 13240 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue { 13241 switch fp.selector { 13242 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13243 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue{PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: *fp, value: value.(string)} 13244 default: 13245 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fp.selector)) 13246 } 13247 } 13248 13249 func (fp *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 13250 return fp.WithIArrayItemValue(value) 13251 } 13252 13253 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath struct { 13254 selector PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector 13255 subPath gotenobject.FieldPath 13256 } 13257 13258 var _ PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath = (*PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath)(nil) 13259 13260 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) Selector() PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector { 13261 return fps.selector 13262 } 13263 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) AsDeviceSshSubPath() (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath, bool) { 13264 res, ok := fps.subPath.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath) 13265 return res, ok 13266 } 13267 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) AsProxiesSshSubPath() (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath, bool) { 13268 res, ok := fps.subPath.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath) 13269 return res, ok 13270 } 13271 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) AsPodSshSubPath() (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath, bool) { 13272 res, ok := fps.subPath.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath) 13273 return res, ok 13274 } 13275 13276 // String returns path representation in proto convention 13277 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) String() string { 13278 return fps.selector.String() + "." + fps.subPath.String() 13279 } 13280 13281 // JSONString returns path representation is JSON convention 13282 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) JSONString() string { 13283 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 13284 } 13285 13286 // Get returns all values pointed by selected field from source PolicySpec_AIAgentHandling_EdgeConnectivity 13287 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (values []interface{}) { 13288 switch fps.selector { 13289 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13290 values = append(values, fps.subPath.GetRaw(source.GetDeviceSsh())...) 13291 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13292 values = append(values, fps.subPath.GetRaw(source.GetProxiesSsh())...) 13293 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13294 values = append(values, fps.subPath.GetRaw(source.GetPodSsh())...) 13295 default: 13296 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fps.selector)) 13297 } 13298 return 13299 } 13300 13301 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) GetRaw(source proto.Message) []interface{} { 13302 return fps.Get(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13303 } 13304 13305 // GetSingle returns value of selected field from source PolicySpec_AIAgentHandling_EdgeConnectivity 13306 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (interface{}, bool) { 13307 switch fps.selector { 13308 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13309 if source.GetDeviceSsh() == nil { 13310 return nil, false 13311 } 13312 return fps.subPath.GetSingleRaw(source.GetDeviceSsh()) 13313 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13314 if source.GetProxiesSsh() == nil { 13315 return nil, false 13316 } 13317 return fps.subPath.GetSingleRaw(source.GetProxiesSsh()) 13318 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13319 if source.GetPodSsh() == nil { 13320 return nil, false 13321 } 13322 return fps.subPath.GetSingleRaw(source.GetPodSsh()) 13323 default: 13324 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fps.selector)) 13325 } 13326 } 13327 13328 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 13329 return fps.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13330 } 13331 13332 // GetDefault returns a default value of the field type 13333 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) GetDefault() interface{} { 13334 return fps.subPath.GetDefault() 13335 } 13336 13337 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity) { 13338 if item != nil { 13339 switch fps.selector { 13340 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13341 if item.Type != nil { 13342 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh); ok { 13343 fps.subPath.ClearValueRaw(item.DeviceSsh) 13344 } 13345 } 13346 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13347 if item.Type != nil { 13348 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh); ok { 13349 fps.subPath.ClearValueRaw(item.ProxiesSsh) 13350 } 13351 } 13352 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13353 if item.Type != nil { 13354 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh); ok { 13355 fps.subPath.ClearValueRaw(item.PodSsh) 13356 } 13357 } 13358 default: 13359 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fps.selector)) 13360 } 13361 } 13362 } 13363 13364 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) ClearValueRaw(item proto.Message) { 13365 fps.ClearValue(item.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13366 } 13367 13368 // IsLeaf - whether field path is holds simple value 13369 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) IsLeaf() bool { 13370 return fps.subPath.IsLeaf() 13371 } 13372 13373 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 13374 iPaths := []gotenobject.FieldPath{&PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: fps.selector}} 13375 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 13376 return iPaths 13377 } 13378 13379 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue { 13380 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 13381 } 13382 13383 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 13384 return fps.WithIValue(value) 13385 } 13386 13387 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues { 13388 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 13389 } 13390 13391 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 13392 return fps.WithIArrayOfValues(values) 13393 } 13394 13395 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue { 13396 return &PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 13397 } 13398 13399 func (fps *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 13400 return fps.WithIArrayItemValue(value) 13401 } 13402 13403 // PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue allows storing values for EdgeConnectivity fields according to their type 13404 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue interface { 13405 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath 13406 gotenobject.FieldPathValue 13407 SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity) 13408 CompareWith(*PolicySpec_AIAgentHandling_EdgeConnectivity) (cmp int, comparable bool) 13409 } 13410 13411 func ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue, error) { 13412 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(pathStr) 13413 if err != nil { 13414 return nil, err 13415 } 13416 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 13417 if err != nil { 13418 return nil, status.Errorf(codes.InvalidArgument, "error parsing EdgeConnectivity field path value from %s: %v", valueStr, err) 13419 } 13420 return fpv.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue), nil 13421 } 13422 13423 func MustParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue { 13424 fpv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue(pathStr, valueStr) 13425 if err != nil { 13426 panic(err) 13427 } 13428 return fpv 13429 } 13430 13431 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue struct { 13432 PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath 13433 value interface{} 13434 } 13435 13436 var _ PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue = (*PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue)(nil) 13437 13438 // GetRawValue returns raw value stored under selected path for 'EdgeConnectivity' as interface{} 13439 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) GetRawValue() interface{} { 13440 return fpv.value 13441 } 13442 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) AsDeviceSshValue() (*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH, bool) { 13443 res, ok := fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) 13444 return res, ok 13445 } 13446 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) AsProxiesSshValue() (*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH, bool) { 13447 res, ok := fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) 13448 return res, ok 13449 } 13450 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) AsPodSshValue() (*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH, bool) { 13451 res, ok := fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) 13452 return res, ok 13453 } 13454 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) AsAllowedBinsValue() ([]string, bool) { 13455 res, ok := fpv.value.([]string) 13456 return res, ok 13457 } 13458 13459 // SetTo stores value for selected field for object EdgeConnectivity 13460 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity) { 13461 if *target == nil { 13462 *target = new(PolicySpec_AIAgentHandling_EdgeConnectivity) 13463 } 13464 switch fpv.selector { 13465 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13466 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh); !ok { 13467 (*target).Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh{} 13468 } 13469 (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh).DeviceSsh = fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) 13470 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13471 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh); !ok { 13472 (*target).Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh{} 13473 } 13474 (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh).ProxiesSsh = fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) 13475 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13476 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh); !ok { 13477 (*target).Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh{} 13478 } 13479 (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh).PodSsh = fpv.value.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) 13480 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13481 (*target).AllowedBins = fpv.value.([]string) 13482 default: 13483 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fpv.selector)) 13484 } 13485 } 13486 13487 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) SetToRaw(target proto.Message) { 13488 typedObject := target.(*PolicySpec_AIAgentHandling_EdgeConnectivity) 13489 fpv.SetTo(&typedObject) 13490 } 13491 13492 // CompareWith compares value in the 'PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling_EdgeConnectivity'. 13493 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (int, bool) { 13494 switch fpv.selector { 13495 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13496 return 0, false 13497 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13498 return 0, false 13499 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13500 return 0, false 13501 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13502 return 0, false 13503 default: 13504 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fpv.selector)) 13505 } 13506 } 13507 13508 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 13509 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13510 } 13511 13512 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue struct { 13513 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath 13514 subPathValue gotenobject.FieldPathValue 13515 } 13516 13517 var _ PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathValue = (*PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue)(nil) 13518 13519 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) AsDeviceSshPathValue() (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue, bool) { 13520 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue) 13521 return res, ok 13522 } 13523 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) AsProxiesSshPathValue() (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue, bool) { 13524 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue) 13525 return res, ok 13526 } 13527 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) AsPodSshPathValue() (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue, bool) { 13528 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue) 13529 return res, ok 13530 } 13531 13532 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity) { 13533 if *target == nil { 13534 *target = new(PolicySpec_AIAgentHandling_EdgeConnectivity) 13535 } 13536 switch fpvs.Selector() { 13537 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13538 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh); !ok { 13539 (*target).Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh{} 13540 } 13541 fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue).SetTo(&(*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh).DeviceSsh) 13542 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13543 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh); !ok { 13544 (*target).Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh{} 13545 } 13546 fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue).SetTo(&(*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh).ProxiesSsh) 13547 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13548 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh); !ok { 13549 (*target).Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh{} 13550 } 13551 fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue).SetTo(&(*target).Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh).PodSsh) 13552 default: 13553 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fpvs.Selector())) 13554 } 13555 } 13556 13557 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) SetToRaw(target proto.Message) { 13558 typedObject := target.(*PolicySpec_AIAgentHandling_EdgeConnectivity) 13559 fpvs.SetTo(&typedObject) 13560 } 13561 13562 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) GetRawValue() interface{} { 13563 return fpvs.subPathValue.GetRawValue() 13564 } 13565 13566 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) CompareWith(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (int, bool) { 13567 switch fpvs.Selector() { 13568 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13569 return fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue).CompareWith(source.GetDeviceSsh()) 13570 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13571 return fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue).CompareWith(source.GetProxiesSsh()) 13572 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13573 return fpvs.subPathValue.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue).CompareWith(source.GetPodSsh()) 13574 default: 13575 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fpvs.Selector())) 13576 } 13577 } 13578 13579 func (fpvs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 13580 return fpvs.CompareWith(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13581 } 13582 13583 // PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue allows storing single item in Path-specific values for EdgeConnectivity according to their type 13584 // Present only for array (repeated) types. 13585 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue interface { 13586 gotenobject.FieldPathArrayItemValue 13587 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath 13588 ContainsValue(*PolicySpec_AIAgentHandling_EdgeConnectivity) bool 13589 } 13590 13591 // ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 13592 func ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue, error) { 13593 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(pathStr) 13594 if err != nil { 13595 return nil, err 13596 } 13597 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 13598 if err != nil { 13599 return nil, status.Errorf(codes.InvalidArgument, "error parsing EdgeConnectivity field path array item value from %s: %v", valueStr, err) 13600 } 13601 return fpaiv.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue), nil 13602 } 13603 13604 func MustParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue { 13605 fpaiv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue(pathStr, valueStr) 13606 if err != nil { 13607 panic(err) 13608 } 13609 return fpaiv 13610 } 13611 13612 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue struct { 13613 PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath 13614 value interface{} 13615 } 13616 13617 var _ PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayItemValue = (*PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue)(nil) 13618 13619 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling_EdgeConnectivity as interface{} 13620 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 13621 return fpaiv.value 13622 } 13623 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue) AsAllowedBinsItemValue() (string, bool) { 13624 res, ok := fpaiv.value.(string) 13625 return res, ok 13626 } 13627 13628 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity) (interface{}, bool) { 13629 return nil, false 13630 } 13631 13632 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 13633 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 13634 } 13635 13636 // Contains returns a boolean indicating if value that is being held is present in given 'EdgeConnectivity' 13637 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_EdgeConnectivity) bool { 13638 slice := fpaiv.PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath.Get(source) 13639 for _, v := range slice { 13640 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 13641 if proto.Equal(asProtoMsg, v.(proto.Message)) { 13642 return true 13643 } 13644 } else if reflect.DeepEqual(v, fpaiv.value) { 13645 return true 13646 } 13647 } 13648 return false 13649 } 13650 13651 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayItemValue struct { 13652 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath 13653 subPathItemValue gotenobject.FieldPathArrayItemValue 13654 } 13655 13656 // GetRawValue returns stored array item value 13657 func (fpaivs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 13658 return fpaivs.subPathItemValue.GetRawItemValue() 13659 } 13660 func (fpaivs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayItemValue) AsDeviceSshPathItemValue() (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue, bool) { 13661 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue) 13662 return res, ok 13663 } 13664 func (fpaivs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayItemValue) AsProxiesSshPathItemValue() (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue, bool) { 13665 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue) 13666 return res, ok 13667 } 13668 func (fpaivs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayItemValue) AsPodSshPathItemValue() (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue, bool) { 13669 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue) 13670 return res, ok 13671 } 13672 13673 // Contains returns a boolean indicating if value that is being held is present in given 'EdgeConnectivity' 13674 func (fpaivs *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_EdgeConnectivity) bool { 13675 switch fpaivs.Selector() { 13676 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13677 return fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue).ContainsValue(source.GetDeviceSsh()) 13678 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13679 return fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue).ContainsValue(source.GetProxiesSsh()) 13680 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13681 return fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue).ContainsValue(source.GetPodSsh()) 13682 default: 13683 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity: %d", fpaivs.Selector())) 13684 } 13685 } 13686 13687 // PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues allows storing slice of values for EdgeConnectivity fields according to their type 13688 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues interface { 13689 gotenobject.FieldPathArrayOfValues 13690 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath 13691 } 13692 13693 func ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues, error) { 13694 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(pathStr) 13695 if err != nil { 13696 return nil, err 13697 } 13698 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 13699 if err != nil { 13700 return nil, status.Errorf(codes.InvalidArgument, "error parsing EdgeConnectivity field path array of values from %s: %v", valuesStr, err) 13701 } 13702 return fpaov.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues), nil 13703 } 13704 13705 func MustParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues { 13706 fpaov, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues(pathStr, valuesStr) 13707 if err != nil { 13708 panic(err) 13709 } 13710 return fpaov 13711 } 13712 13713 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues struct { 13714 PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath 13715 values interface{} 13716 } 13717 13718 var _ PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues)(nil) 13719 13720 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 13721 switch fpaov.selector { 13722 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 13723 for _, v := range fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) { 13724 values = append(values, v) 13725 } 13726 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 13727 for _, v := range fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) { 13728 values = append(values, v) 13729 } 13730 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 13731 for _, v := range fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) { 13732 values = append(values, v) 13733 } 13734 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 13735 for _, v := range fpaov.values.([][]string) { 13736 values = append(values, v) 13737 } 13738 } 13739 return 13740 } 13741 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues) AsDeviceSshArrayOfValues() ([]*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH, bool) { 13742 res, ok := fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) 13743 return res, ok 13744 } 13745 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues) AsProxiesSshArrayOfValues() ([]*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH, bool) { 13746 res, ok := fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) 13747 return res, ok 13748 } 13749 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues) AsPodSshArrayOfValues() ([]*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH, bool) { 13750 res, ok := fpaov.values.([]*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) 13751 return res, ok 13752 } 13753 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPathArrayOfValues) AsAllowedBinsArrayOfValues() ([][]string, bool) { 13754 res, ok := fpaov.values.([][]string) 13755 return res, ok 13756 } 13757 13758 type PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayOfValues struct { 13759 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath 13760 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 13761 } 13762 13763 var _ PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayOfValues)(nil) 13764 13765 func (fpsaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 13766 return fpsaov.subPathArrayOfValues.GetRawValues() 13767 } 13768 func (fpsaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayOfValues) AsDeviceSshPathArrayOfValues() (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues, bool) { 13769 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues) 13770 return res, ok 13771 } 13772 func (fpsaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayOfValues) AsProxiesSshPathArrayOfValues() (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues, bool) { 13773 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues) 13774 return res, ok 13775 } 13776 func (fpsaov *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPathArrayOfValues) AsPodSshPathArrayOfValues() (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues, bool) { 13777 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues) 13778 return res, ok 13779 } 13780 13781 // FieldPath provides implementation to handle 13782 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 13783 type PolicySpecAIAgentHandlingRemediation_FieldPath interface { 13784 gotenobject.FieldPath 13785 Selector() PolicySpecAIAgentHandlingRemediation_FieldPathSelector 13786 Get(source *PolicySpec_AIAgentHandling_Remediation) []interface{} 13787 GetSingle(source *PolicySpec_AIAgentHandling_Remediation) (interface{}, bool) 13788 ClearValue(item *PolicySpec_AIAgentHandling_Remediation) 13789 13790 // Those methods build corresponding PolicySpecAIAgentHandlingRemediation_FieldPathValue 13791 // (or array of values) and holds passed value. Panics if injected type is incorrect. 13792 WithIValue(value interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathValue 13793 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues 13794 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue 13795 } 13796 13797 type PolicySpecAIAgentHandlingRemediation_FieldPathSelector int32 13798 13799 const ( 13800 PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh PolicySpecAIAgentHandlingRemediation_FieldPathSelector = 0 13801 PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot PolicySpecAIAgentHandlingRemediation_FieldPathSelector = 1 13802 ) 13803 13804 func (s PolicySpecAIAgentHandlingRemediation_FieldPathSelector) String() string { 13805 switch s { 13806 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 13807 return "fix_in_ssh" 13808 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 13809 return "reboot" 13810 default: 13811 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", s)) 13812 } 13813 } 13814 13815 func BuildPolicySpecAIAgentHandlingRemediation_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandlingRemediation_FieldPath, error) { 13816 if len(fp) == 0 { 13817 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling_Remediation") 13818 } 13819 if len(fp) == 1 { 13820 switch fp[0] { 13821 case "fix_in_ssh", "fixInSsh", "fix-in-ssh": 13822 return &PolicySpecAIAgentHandlingRemediation_FieldTerminalPath{selector: PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh}, nil 13823 case "reboot": 13824 return &PolicySpecAIAgentHandlingRemediation_FieldTerminalPath{selector: PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot}, nil 13825 } 13826 } else { 13827 switch fp[0] { 13828 case "fix_in_ssh", "fixInSsh", "fix-in-ssh": 13829 if subpath, err := BuildPolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(fp[1:]); err != nil { 13830 return nil, err 13831 } else { 13832 return &PolicySpecAIAgentHandlingRemediation_FieldSubPath{selector: PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh, subPath: subpath}, nil 13833 } 13834 case "reboot": 13835 if subpath, err := BuildPolicySpecAIAgentHandlingRemediationReboot_FieldPath(fp[1:]); err != nil { 13836 return nil, err 13837 } else { 13838 return &PolicySpecAIAgentHandlingRemediation_FieldSubPath{selector: PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot, subPath: subpath}, nil 13839 } 13840 } 13841 } 13842 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling_Remediation", fp) 13843 } 13844 13845 func ParsePolicySpecAIAgentHandlingRemediation_FieldPath(rawField string) (PolicySpecAIAgentHandlingRemediation_FieldPath, error) { 13846 fp, err := gotenobject.ParseRawFieldPath(rawField) 13847 if err != nil { 13848 return nil, err 13849 } 13850 return BuildPolicySpecAIAgentHandlingRemediation_FieldPath(fp) 13851 } 13852 13853 func MustParsePolicySpecAIAgentHandlingRemediation_FieldPath(rawField string) PolicySpecAIAgentHandlingRemediation_FieldPath { 13854 fp, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPath(rawField) 13855 if err != nil { 13856 panic(err) 13857 } 13858 return fp 13859 } 13860 13861 type PolicySpecAIAgentHandlingRemediation_FieldTerminalPath struct { 13862 selector PolicySpecAIAgentHandlingRemediation_FieldPathSelector 13863 } 13864 13865 var _ PolicySpecAIAgentHandlingRemediation_FieldPath = (*PolicySpecAIAgentHandlingRemediation_FieldTerminalPath)(nil) 13866 13867 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) Selector() PolicySpecAIAgentHandlingRemediation_FieldPathSelector { 13868 return fp.selector 13869 } 13870 13871 // String returns path representation in proto convention 13872 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) String() string { 13873 return fp.selector.String() 13874 } 13875 13876 // JSONString returns path representation is JSON convention 13877 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) JSONString() string { 13878 return strcase.ToLowerCamel(fp.String()) 13879 } 13880 13881 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling_Remediation 13882 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling_Remediation) (values []interface{}) { 13883 if source != nil { 13884 switch fp.selector { 13885 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 13886 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh); ok && source != nil { 13887 if source.FixInSsh != nil { 13888 values = append(values, source.FixInSsh) 13889 } 13890 } 13891 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 13892 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_); ok && source != nil { 13893 if source.Reboot != nil { 13894 values = append(values, source.Reboot) 13895 } 13896 } 13897 default: 13898 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fp.selector)) 13899 } 13900 } 13901 return 13902 } 13903 13904 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 13905 return fp.Get(source.(*PolicySpec_AIAgentHandling_Remediation)) 13906 } 13907 13908 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling_Remediation 13909 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling_Remediation) (interface{}, bool) { 13910 switch fp.selector { 13911 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 13912 // if object nil or oneof not active, return "default" type with false flag. 13913 if source == nil { 13914 return source.GetFixInSsh(), false 13915 } 13916 _, oneOfSelected := source.Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh) 13917 if !oneOfSelected { 13918 return source.GetFixInSsh(), false // to return "type" information 13919 } 13920 res := source.GetFixInSsh() 13921 return res, res != nil 13922 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 13923 // if object nil or oneof not active, return "default" type with false flag. 13924 if source == nil { 13925 return source.GetReboot(), false 13926 } 13927 _, oneOfSelected := source.Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_) 13928 if !oneOfSelected { 13929 return source.GetReboot(), false // to return "type" information 13930 } 13931 res := source.GetReboot() 13932 return res, res != nil 13933 default: 13934 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fp.selector)) 13935 } 13936 } 13937 13938 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 13939 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling_Remediation)) 13940 } 13941 13942 // GetDefault returns a default value of the field type 13943 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) GetDefault() interface{} { 13944 switch fp.selector { 13945 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 13946 return (*PolicySpec_AIAgentHandling_Remediation_FixInSSH)(nil) 13947 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 13948 return (*PolicySpec_AIAgentHandling_Remediation_Reboot)(nil) 13949 default: 13950 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fp.selector)) 13951 } 13952 } 13953 13954 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling_Remediation) { 13955 if item != nil { 13956 switch fp.selector { 13957 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 13958 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh); ok { 13959 item.FixInSsh = nil 13960 } 13961 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 13962 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_); ok { 13963 item.Reboot = nil 13964 } 13965 default: 13966 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fp.selector)) 13967 } 13968 } 13969 } 13970 13971 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) ClearValueRaw(item proto.Message) { 13972 fp.ClearValue(item.(*PolicySpec_AIAgentHandling_Remediation)) 13973 } 13974 13975 // IsLeaf - whether field path is holds simple value 13976 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) IsLeaf() bool { 13977 return false 13978 } 13979 13980 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 13981 return []gotenobject.FieldPath{fp} 13982 } 13983 13984 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathValue { 13985 switch fp.selector { 13986 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 13987 return &PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue{PolicySpecAIAgentHandlingRemediation_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)} 13988 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 13989 return &PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue{PolicySpecAIAgentHandlingRemediation_FieldTerminalPath: *fp, value: value.(*PolicySpec_AIAgentHandling_Remediation_Reboot)} 13990 default: 13991 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fp.selector)) 13992 } 13993 } 13994 13995 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 13996 return fp.WithIValue(value) 13997 } 13998 13999 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues { 14000 fpaov := &PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingRemediation_FieldTerminalPath: *fp} 14001 switch fp.selector { 14002 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14003 return &PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingRemediation_FieldTerminalPath: *fp, values: values.([]*PolicySpec_AIAgentHandling_Remediation_FixInSSH)} 14004 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14005 return &PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingRemediation_FieldTerminalPath: *fp, values: values.([]*PolicySpec_AIAgentHandling_Remediation_Reboot)} 14006 default: 14007 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fp.selector)) 14008 } 14009 return fpaov 14010 } 14011 14012 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 14013 return fp.WithIArrayOfValues(values) 14014 } 14015 14016 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue { 14017 switch fp.selector { 14018 default: 14019 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fp.selector)) 14020 } 14021 } 14022 14023 func (fp *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 14024 return fp.WithIArrayItemValue(value) 14025 } 14026 14027 type PolicySpecAIAgentHandlingRemediation_FieldSubPath struct { 14028 selector PolicySpecAIAgentHandlingRemediation_FieldPathSelector 14029 subPath gotenobject.FieldPath 14030 } 14031 14032 var _ PolicySpecAIAgentHandlingRemediation_FieldPath = (*PolicySpecAIAgentHandlingRemediation_FieldSubPath)(nil) 14033 14034 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) Selector() PolicySpecAIAgentHandlingRemediation_FieldPathSelector { 14035 return fps.selector 14036 } 14037 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) AsFixInSshSubPath() (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath, bool) { 14038 res, ok := fps.subPath.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath) 14039 return res, ok 14040 } 14041 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) AsRebootSubPath() (PolicySpecAIAgentHandlingRemediationReboot_FieldPath, bool) { 14042 res, ok := fps.subPath.(PolicySpecAIAgentHandlingRemediationReboot_FieldPath) 14043 return res, ok 14044 } 14045 14046 // String returns path representation in proto convention 14047 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) String() string { 14048 return fps.selector.String() + "." + fps.subPath.String() 14049 } 14050 14051 // JSONString returns path representation is JSON convention 14052 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) JSONString() string { 14053 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 14054 } 14055 14056 // Get returns all values pointed by selected field from source PolicySpec_AIAgentHandling_Remediation 14057 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) Get(source *PolicySpec_AIAgentHandling_Remediation) (values []interface{}) { 14058 switch fps.selector { 14059 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14060 values = append(values, fps.subPath.GetRaw(source.GetFixInSsh())...) 14061 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14062 values = append(values, fps.subPath.GetRaw(source.GetReboot())...) 14063 default: 14064 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fps.selector)) 14065 } 14066 return 14067 } 14068 14069 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) GetRaw(source proto.Message) []interface{} { 14070 return fps.Get(source.(*PolicySpec_AIAgentHandling_Remediation)) 14071 } 14072 14073 // GetSingle returns value of selected field from source PolicySpec_AIAgentHandling_Remediation 14074 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) GetSingle(source *PolicySpec_AIAgentHandling_Remediation) (interface{}, bool) { 14075 switch fps.selector { 14076 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14077 if source.GetFixInSsh() == nil { 14078 return nil, false 14079 } 14080 return fps.subPath.GetSingleRaw(source.GetFixInSsh()) 14081 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14082 if source.GetReboot() == nil { 14083 return nil, false 14084 } 14085 return fps.subPath.GetSingleRaw(source.GetReboot()) 14086 default: 14087 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fps.selector)) 14088 } 14089 } 14090 14091 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 14092 return fps.GetSingle(source.(*PolicySpec_AIAgentHandling_Remediation)) 14093 } 14094 14095 // GetDefault returns a default value of the field type 14096 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) GetDefault() interface{} { 14097 return fps.subPath.GetDefault() 14098 } 14099 14100 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) ClearValue(item *PolicySpec_AIAgentHandling_Remediation) { 14101 if item != nil { 14102 switch fps.selector { 14103 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14104 if item.Type != nil { 14105 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh); ok { 14106 fps.subPath.ClearValueRaw(item.FixInSsh) 14107 } 14108 } 14109 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14110 if item.Type != nil { 14111 if item, ok := item.Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_); ok { 14112 fps.subPath.ClearValueRaw(item.Reboot) 14113 } 14114 } 14115 default: 14116 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fps.selector)) 14117 } 14118 } 14119 } 14120 14121 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) ClearValueRaw(item proto.Message) { 14122 fps.ClearValue(item.(*PolicySpec_AIAgentHandling_Remediation)) 14123 } 14124 14125 // IsLeaf - whether field path is holds simple value 14126 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) IsLeaf() bool { 14127 return fps.subPath.IsLeaf() 14128 } 14129 14130 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 14131 iPaths := []gotenobject.FieldPath{&PolicySpecAIAgentHandlingRemediation_FieldTerminalPath{selector: fps.selector}} 14132 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 14133 return iPaths 14134 } 14135 14136 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathValue { 14137 return &PolicySpecAIAgentHandlingRemediation_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 14138 } 14139 14140 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 14141 return fps.WithIValue(value) 14142 } 14143 14144 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues { 14145 return &PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 14146 } 14147 14148 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 14149 return fps.WithIArrayOfValues(values) 14150 } 14151 14152 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue { 14153 return &PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 14154 } 14155 14156 func (fps *PolicySpecAIAgentHandlingRemediation_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 14157 return fps.WithIArrayItemValue(value) 14158 } 14159 14160 // PolicySpecAIAgentHandlingRemediation_FieldPathValue allows storing values for Remediation fields according to their type 14161 type PolicySpecAIAgentHandlingRemediation_FieldPathValue interface { 14162 PolicySpecAIAgentHandlingRemediation_FieldPath 14163 gotenobject.FieldPathValue 14164 SetTo(target **PolicySpec_AIAgentHandling_Remediation) 14165 CompareWith(*PolicySpec_AIAgentHandling_Remediation) (cmp int, comparable bool) 14166 } 14167 14168 func ParsePolicySpecAIAgentHandlingRemediation_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingRemediation_FieldPathValue, error) { 14169 fp, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPath(pathStr) 14170 if err != nil { 14171 return nil, err 14172 } 14173 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 14174 if err != nil { 14175 return nil, status.Errorf(codes.InvalidArgument, "error parsing Remediation field path value from %s: %v", valueStr, err) 14176 } 14177 return fpv.(PolicySpecAIAgentHandlingRemediation_FieldPathValue), nil 14178 } 14179 14180 func MustParsePolicySpecAIAgentHandlingRemediation_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandlingRemediation_FieldPathValue { 14181 fpv, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPathValue(pathStr, valueStr) 14182 if err != nil { 14183 panic(err) 14184 } 14185 return fpv 14186 } 14187 14188 type PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue struct { 14189 PolicySpecAIAgentHandlingRemediation_FieldTerminalPath 14190 value interface{} 14191 } 14192 14193 var _ PolicySpecAIAgentHandlingRemediation_FieldPathValue = (*PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue)(nil) 14194 14195 // GetRawValue returns raw value stored under selected path for 'Remediation' as interface{} 14196 func (fpv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue) GetRawValue() interface{} { 14197 return fpv.value 14198 } 14199 func (fpv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue) AsFixInSshValue() (*PolicySpec_AIAgentHandling_Remediation_FixInSSH, bool) { 14200 res, ok := fpv.value.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH) 14201 return res, ok 14202 } 14203 func (fpv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue) AsRebootValue() (*PolicySpec_AIAgentHandling_Remediation_Reboot, bool) { 14204 res, ok := fpv.value.(*PolicySpec_AIAgentHandling_Remediation_Reboot) 14205 return res, ok 14206 } 14207 14208 // SetTo stores value for selected field for object Remediation 14209 func (fpv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling_Remediation) { 14210 if *target == nil { 14211 *target = new(PolicySpec_AIAgentHandling_Remediation) 14212 } 14213 switch fpv.selector { 14214 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14215 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh); !ok { 14216 (*target).Type = &PolicySpec_AIAgentHandling_Remediation_FixInSsh{} 14217 } 14218 (*target).Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh).FixInSsh = fpv.value.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH) 14219 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14220 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_); !ok { 14221 (*target).Type = &PolicySpec_AIAgentHandling_Remediation_Reboot_{} 14222 } 14223 (*target).Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_).Reboot = fpv.value.(*PolicySpec_AIAgentHandling_Remediation_Reboot) 14224 default: 14225 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fpv.selector)) 14226 } 14227 } 14228 14229 func (fpv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue) SetToRaw(target proto.Message) { 14230 typedObject := target.(*PolicySpec_AIAgentHandling_Remediation) 14231 fpv.SetTo(&typedObject) 14232 } 14233 14234 // CompareWith compares value in the 'PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling_Remediation'. 14235 func (fpv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling_Remediation) (int, bool) { 14236 switch fpv.selector { 14237 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14238 return 0, false 14239 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14240 return 0, false 14241 default: 14242 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fpv.selector)) 14243 } 14244 } 14245 14246 func (fpv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 14247 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling_Remediation)) 14248 } 14249 14250 type PolicySpecAIAgentHandlingRemediation_FieldSubPathValue struct { 14251 PolicySpecAIAgentHandlingRemediation_FieldPath 14252 subPathValue gotenobject.FieldPathValue 14253 } 14254 14255 var _ PolicySpecAIAgentHandlingRemediation_FieldPathValue = (*PolicySpecAIAgentHandlingRemediation_FieldSubPathValue)(nil) 14256 14257 func (fpvs *PolicySpecAIAgentHandlingRemediation_FieldSubPathValue) AsFixInSshPathValue() (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue, bool) { 14258 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue) 14259 return res, ok 14260 } 14261 func (fpvs *PolicySpecAIAgentHandlingRemediation_FieldSubPathValue) AsRebootPathValue() (PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue, bool) { 14262 res, ok := fpvs.subPathValue.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue) 14263 return res, ok 14264 } 14265 14266 func (fpvs *PolicySpecAIAgentHandlingRemediation_FieldSubPathValue) SetTo(target **PolicySpec_AIAgentHandling_Remediation) { 14267 if *target == nil { 14268 *target = new(PolicySpec_AIAgentHandling_Remediation) 14269 } 14270 switch fpvs.Selector() { 14271 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14272 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh); !ok { 14273 (*target).Type = &PolicySpec_AIAgentHandling_Remediation_FixInSsh{} 14274 } 14275 fpvs.subPathValue.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue).SetTo(&(*target).Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh).FixInSsh) 14276 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14277 if _, ok := (*target).Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_); !ok { 14278 (*target).Type = &PolicySpec_AIAgentHandling_Remediation_Reboot_{} 14279 } 14280 fpvs.subPathValue.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue).SetTo(&(*target).Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_).Reboot) 14281 default: 14282 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fpvs.Selector())) 14283 } 14284 } 14285 14286 func (fpvs *PolicySpecAIAgentHandlingRemediation_FieldSubPathValue) SetToRaw(target proto.Message) { 14287 typedObject := target.(*PolicySpec_AIAgentHandling_Remediation) 14288 fpvs.SetTo(&typedObject) 14289 } 14290 14291 func (fpvs *PolicySpecAIAgentHandlingRemediation_FieldSubPathValue) GetRawValue() interface{} { 14292 return fpvs.subPathValue.GetRawValue() 14293 } 14294 14295 func (fpvs *PolicySpecAIAgentHandlingRemediation_FieldSubPathValue) CompareWith(source *PolicySpec_AIAgentHandling_Remediation) (int, bool) { 14296 switch fpvs.Selector() { 14297 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14298 return fpvs.subPathValue.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue).CompareWith(source.GetFixInSsh()) 14299 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14300 return fpvs.subPathValue.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue).CompareWith(source.GetReboot()) 14301 default: 14302 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fpvs.Selector())) 14303 } 14304 } 14305 14306 func (fpvs *PolicySpecAIAgentHandlingRemediation_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 14307 return fpvs.CompareWith(source.(*PolicySpec_AIAgentHandling_Remediation)) 14308 } 14309 14310 // PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue allows storing single item in Path-specific values for Remediation according to their type 14311 // Present only for array (repeated) types. 14312 type PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue interface { 14313 gotenobject.FieldPathArrayItemValue 14314 PolicySpecAIAgentHandlingRemediation_FieldPath 14315 ContainsValue(*PolicySpec_AIAgentHandling_Remediation) bool 14316 } 14317 14318 // ParsePolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 14319 func ParsePolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue, error) { 14320 fp, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPath(pathStr) 14321 if err != nil { 14322 return nil, err 14323 } 14324 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 14325 if err != nil { 14326 return nil, status.Errorf(codes.InvalidArgument, "error parsing Remediation field path array item value from %s: %v", valueStr, err) 14327 } 14328 return fpaiv.(PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue), nil 14329 } 14330 14331 func MustParsePolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue { 14332 fpaiv, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue(pathStr, valueStr) 14333 if err != nil { 14334 panic(err) 14335 } 14336 return fpaiv 14337 } 14338 14339 type PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayItemValue struct { 14340 PolicySpecAIAgentHandlingRemediation_FieldTerminalPath 14341 value interface{} 14342 } 14343 14344 var _ PolicySpecAIAgentHandlingRemediation_FieldPathArrayItemValue = (*PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayItemValue)(nil) 14345 14346 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling_Remediation as interface{} 14347 func (fpaiv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 14348 return fpaiv.value 14349 } 14350 14351 func (fpaiv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling_Remediation) (interface{}, bool) { 14352 return nil, false 14353 } 14354 14355 func (fpaiv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 14356 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling_Remediation)) 14357 } 14358 14359 // Contains returns a boolean indicating if value that is being held is present in given 'Remediation' 14360 func (fpaiv *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_Remediation) bool { 14361 slice := fpaiv.PolicySpecAIAgentHandlingRemediation_FieldTerminalPath.Get(source) 14362 for _, v := range slice { 14363 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 14364 if proto.Equal(asProtoMsg, v.(proto.Message)) { 14365 return true 14366 } 14367 } else if reflect.DeepEqual(v, fpaiv.value) { 14368 return true 14369 } 14370 } 14371 return false 14372 } 14373 14374 type PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayItemValue struct { 14375 PolicySpecAIAgentHandlingRemediation_FieldPath 14376 subPathItemValue gotenobject.FieldPathArrayItemValue 14377 } 14378 14379 // GetRawValue returns stored array item value 14380 func (fpaivs *PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 14381 return fpaivs.subPathItemValue.GetRawItemValue() 14382 } 14383 func (fpaivs *PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayItemValue) AsFixInSshPathItemValue() (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue, bool) { 14384 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue) 14385 return res, ok 14386 } 14387 func (fpaivs *PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayItemValue) AsRebootPathItemValue() (PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue, bool) { 14388 res, ok := fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue) 14389 return res, ok 14390 } 14391 14392 // Contains returns a boolean indicating if value that is being held is present in given 'Remediation' 14393 func (fpaivs *PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_Remediation) bool { 14394 switch fpaivs.Selector() { 14395 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14396 return fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue).ContainsValue(source.GetFixInSsh()) 14397 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14398 return fpaivs.subPathItemValue.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue).ContainsValue(source.GetReboot()) 14399 default: 14400 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation: %d", fpaivs.Selector())) 14401 } 14402 } 14403 14404 // PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues allows storing slice of values for Remediation fields according to their type 14405 type PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues interface { 14406 gotenobject.FieldPathArrayOfValues 14407 PolicySpecAIAgentHandlingRemediation_FieldPath 14408 } 14409 14410 func ParsePolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues, error) { 14411 fp, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPath(pathStr) 14412 if err != nil { 14413 return nil, err 14414 } 14415 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 14416 if err != nil { 14417 return nil, status.Errorf(codes.InvalidArgument, "error parsing Remediation field path array of values from %s: %v", valuesStr, err) 14418 } 14419 return fpaov.(PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues), nil 14420 } 14421 14422 func MustParsePolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues { 14423 fpaov, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues(pathStr, valuesStr) 14424 if err != nil { 14425 panic(err) 14426 } 14427 return fpaov 14428 } 14429 14430 type PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues struct { 14431 PolicySpecAIAgentHandlingRemediation_FieldTerminalPath 14432 values interface{} 14433 } 14434 14435 var _ PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues)(nil) 14436 14437 func (fpaov *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 14438 switch fpaov.selector { 14439 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 14440 for _, v := range fpaov.values.([]*PolicySpec_AIAgentHandling_Remediation_FixInSSH) { 14441 values = append(values, v) 14442 } 14443 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 14444 for _, v := range fpaov.values.([]*PolicySpec_AIAgentHandling_Remediation_Reboot) { 14445 values = append(values, v) 14446 } 14447 } 14448 return 14449 } 14450 func (fpaov *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues) AsFixInSshArrayOfValues() ([]*PolicySpec_AIAgentHandling_Remediation_FixInSSH, bool) { 14451 res, ok := fpaov.values.([]*PolicySpec_AIAgentHandling_Remediation_FixInSSH) 14452 return res, ok 14453 } 14454 func (fpaov *PolicySpecAIAgentHandlingRemediation_FieldTerminalPathArrayOfValues) AsRebootArrayOfValues() ([]*PolicySpec_AIAgentHandling_Remediation_Reboot, bool) { 14455 res, ok := fpaov.values.([]*PolicySpec_AIAgentHandling_Remediation_Reboot) 14456 return res, ok 14457 } 14458 14459 type PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayOfValues struct { 14460 PolicySpecAIAgentHandlingRemediation_FieldPath 14461 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 14462 } 14463 14464 var _ PolicySpecAIAgentHandlingRemediation_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayOfValues)(nil) 14465 14466 func (fpsaov *PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 14467 return fpsaov.subPathArrayOfValues.GetRawValues() 14468 } 14469 func (fpsaov *PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayOfValues) AsFixInSshPathArrayOfValues() (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues, bool) { 14470 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues) 14471 return res, ok 14472 } 14473 func (fpsaov *PolicySpecAIAgentHandlingRemediation_FieldSubPathArrayOfValues) AsRebootPathArrayOfValues() (PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues, bool) { 14474 res, ok := fpsaov.subPathArrayOfValues.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues) 14475 return res, ok 14476 } 14477 14478 // FieldPath provides implementation to handle 14479 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 14480 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath interface { 14481 gotenobject.FieldPath 14482 Selector() PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelector 14483 Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) []interface{} 14484 GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) (interface{}, bool) 14485 ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) 14486 14487 // Those methods build corresponding PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue 14488 // (or array of values) and holds passed value. Panics if injected type is incorrect. 14489 WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue 14490 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues 14491 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue 14492 } 14493 14494 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelector int32 14495 14496 const ( 14497 PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelector = 0 14498 ) 14499 14500 func (s PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelector) String() string { 14501 switch s { 14502 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14503 return "client_name" 14504 default: 14505 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", s)) 14506 } 14507 } 14508 14509 func BuildPolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath, error) { 14510 if len(fp) == 0 { 14511 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH") 14512 } 14513 if len(fp) == 1 { 14514 switch fp[0] { 14515 case "client_name", "clientName", "client-name": 14516 return &PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName}, nil 14517 } 14518 } 14519 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH", fp) 14520 } 14521 14522 func ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(rawField string) (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath, error) { 14523 fp, err := gotenobject.ParseRawFieldPath(rawField) 14524 if err != nil { 14525 return nil, err 14526 } 14527 return BuildPolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(fp) 14528 } 14529 14530 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(rawField string) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath { 14531 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(rawField) 14532 if err != nil { 14533 panic(err) 14534 } 14535 return fp 14536 } 14537 14538 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath struct { 14539 selector PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelector 14540 } 14541 14542 var _ PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath = (*PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath)(nil) 14543 14544 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) Selector() PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelector { 14545 return fp.selector 14546 } 14547 14548 // String returns path representation in proto convention 14549 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) String() string { 14550 return fp.selector.String() 14551 } 14552 14553 // JSONString returns path representation is JSON convention 14554 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) JSONString() string { 14555 return strcase.ToLowerCamel(fp.String()) 14556 } 14557 14558 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH 14559 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) (values []interface{}) { 14560 if source != nil { 14561 switch fp.selector { 14562 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14563 values = append(values, source.ClientName) 14564 default: 14565 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fp.selector)) 14566 } 14567 } 14568 return 14569 } 14570 14571 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 14572 return fp.Get(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)) 14573 } 14574 14575 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH 14576 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) (interface{}, bool) { 14577 switch fp.selector { 14578 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14579 return source.GetClientName(), source != nil 14580 default: 14581 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fp.selector)) 14582 } 14583 } 14584 14585 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 14586 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)) 14587 } 14588 14589 // GetDefault returns a default value of the field type 14590 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) GetDefault() interface{} { 14591 switch fp.selector { 14592 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14593 return "" 14594 default: 14595 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fp.selector)) 14596 } 14597 } 14598 14599 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) { 14600 if item != nil { 14601 switch fp.selector { 14602 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14603 item.ClientName = "" 14604 default: 14605 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fp.selector)) 14606 } 14607 } 14608 } 14609 14610 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) ClearValueRaw(item proto.Message) { 14611 fp.ClearValue(item.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)) 14612 } 14613 14614 // IsLeaf - whether field path is holds simple value 14615 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) IsLeaf() bool { 14616 return fp.selector == PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName 14617 } 14618 14619 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 14620 return []gotenobject.FieldPath{fp} 14621 } 14622 14623 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue { 14624 switch fp.selector { 14625 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14626 return &PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath: *fp, value: value.(string)} 14627 default: 14628 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fp.selector)) 14629 } 14630 } 14631 14632 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 14633 return fp.WithIValue(value) 14634 } 14635 14636 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues { 14637 fpaov := &PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath: *fp} 14638 switch fp.selector { 14639 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14640 return &PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath: *fp, values: values.([]string)} 14641 default: 14642 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fp.selector)) 14643 } 14644 return fpaov 14645 } 14646 14647 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 14648 return fp.WithIArrayOfValues(values) 14649 } 14650 14651 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue { 14652 switch fp.selector { 14653 default: 14654 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fp.selector)) 14655 } 14656 } 14657 14658 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 14659 return fp.WithIArrayItemValue(value) 14660 } 14661 14662 // PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue allows storing values for DeviceSSH fields according to their type 14663 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue interface { 14664 PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath 14665 gotenobject.FieldPathValue 14666 SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) 14667 CompareWith(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) (cmp int, comparable bool) 14668 } 14669 14670 func ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue, error) { 14671 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(pathStr) 14672 if err != nil { 14673 return nil, err 14674 } 14675 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 14676 if err != nil { 14677 return nil, status.Errorf(codes.InvalidArgument, "error parsing DeviceSSH field path value from %s: %v", valueStr, err) 14678 } 14679 return fpv.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue), nil 14680 } 14681 14682 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue { 14683 fpv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue(pathStr, valueStr) 14684 if err != nil { 14685 panic(err) 14686 } 14687 return fpv 14688 } 14689 14690 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue struct { 14691 PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath 14692 value interface{} 14693 } 14694 14695 var _ PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathValue = (*PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue)(nil) 14696 14697 // GetRawValue returns raw value stored under selected path for 'DeviceSSH' as interface{} 14698 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue) GetRawValue() interface{} { 14699 return fpv.value 14700 } 14701 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue) AsClientNameValue() (string, bool) { 14702 res, ok := fpv.value.(string) 14703 return res, ok 14704 } 14705 14706 // SetTo stores value for selected field for object DeviceSSH 14707 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) { 14708 if *target == nil { 14709 *target = new(PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) 14710 } 14711 switch fpv.selector { 14712 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14713 (*target).ClientName = fpv.value.(string) 14714 default: 14715 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fpv.selector)) 14716 } 14717 } 14718 14719 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue) SetToRaw(target proto.Message) { 14720 typedObject := target.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) 14721 fpv.SetTo(&typedObject) 14722 } 14723 14724 // CompareWith compares value in the 'PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH'. 14725 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) (int, bool) { 14726 switch fpv.selector { 14727 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14728 leftValue := fpv.value.(string) 14729 rightValue := source.GetClientName() 14730 if (leftValue) == (rightValue) { 14731 return 0, true 14732 } else if (leftValue) < (rightValue) { 14733 return -1, true 14734 } else { 14735 return 1, true 14736 } 14737 default: 14738 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH: %d", fpv.selector)) 14739 } 14740 } 14741 14742 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 14743 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)) 14744 } 14745 14746 // PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue allows storing single item in Path-specific values for DeviceSSH according to their type 14747 // Present only for array (repeated) types. 14748 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue interface { 14749 gotenobject.FieldPathArrayItemValue 14750 PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath 14751 ContainsValue(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) bool 14752 } 14753 14754 // ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 14755 func ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue, error) { 14756 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(pathStr) 14757 if err != nil { 14758 return nil, err 14759 } 14760 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 14761 if err != nil { 14762 return nil, status.Errorf(codes.InvalidArgument, "error parsing DeviceSSH field path array item value from %s: %v", valueStr, err) 14763 } 14764 return fpaiv.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue), nil 14765 } 14766 14767 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue { 14768 fpaiv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue(pathStr, valueStr) 14769 if err != nil { 14770 panic(err) 14771 } 14772 return fpaiv 14773 } 14774 14775 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayItemValue struct { 14776 PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath 14777 value interface{} 14778 } 14779 14780 var _ PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayItemValue = (*PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayItemValue)(nil) 14781 14782 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH as interface{} 14783 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 14784 return fpaiv.value 14785 } 14786 14787 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) (interface{}, bool) { 14788 return nil, false 14789 } 14790 14791 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 14792 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)) 14793 } 14794 14795 // Contains returns a boolean indicating if value that is being held is present in given 'DeviceSSH' 14796 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) bool { 14797 slice := fpaiv.PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath.Get(source) 14798 for _, v := range slice { 14799 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 14800 if proto.Equal(asProtoMsg, v.(proto.Message)) { 14801 return true 14802 } 14803 } else if reflect.DeepEqual(v, fpaiv.value) { 14804 return true 14805 } 14806 } 14807 return false 14808 } 14809 14810 // PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues allows storing slice of values for DeviceSSH fields according to their type 14811 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues interface { 14812 gotenobject.FieldPathArrayOfValues 14813 PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath 14814 } 14815 14816 func ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues, error) { 14817 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(pathStr) 14818 if err != nil { 14819 return nil, err 14820 } 14821 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 14822 if err != nil { 14823 return nil, status.Errorf(codes.InvalidArgument, "error parsing DeviceSSH field path array of values from %s: %v", valuesStr, err) 14824 } 14825 return fpaov.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues), nil 14826 } 14827 14828 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues { 14829 fpaov, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues(pathStr, valuesStr) 14830 if err != nil { 14831 panic(err) 14832 } 14833 return fpaov 14834 } 14835 14836 type PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayOfValues struct { 14837 PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath 14838 values interface{} 14839 } 14840 14841 var _ PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayOfValues)(nil) 14842 14843 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 14844 switch fpaov.selector { 14845 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 14846 for _, v := range fpaov.values.([]string) { 14847 values = append(values, v) 14848 } 14849 } 14850 return 14851 } 14852 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPathArrayOfValues) AsClientNameArrayOfValues() ([]string, bool) { 14853 res, ok := fpaov.values.([]string) 14854 return res, ok 14855 } 14856 14857 // FieldPath provides implementation to handle 14858 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 14859 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath interface { 14860 gotenobject.FieldPath 14861 Selector() PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector 14862 Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) []interface{} 14863 GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) (interface{}, bool) 14864 ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) 14865 14866 // Those methods build corresponding PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue 14867 // (or array of values) and holds passed value. Panics if injected type is incorrect. 14868 WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue 14869 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues 14870 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue 14871 } 14872 14873 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector int32 14874 14875 const ( 14876 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector = 0 14877 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector = 1 14878 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector = 2 14879 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector = 3 14880 ) 14881 14882 func (s PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector) String() string { 14883 switch s { 14884 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 14885 return "service_domain" 14886 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 14887 return "provider_name_tmpl" 14888 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 14889 return "client_name" 14890 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 14891 return "service_name" 14892 default: 14893 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", s)) 14894 } 14895 } 14896 14897 func BuildPolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath, error) { 14898 if len(fp) == 0 { 14899 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH") 14900 } 14901 if len(fp) == 1 { 14902 switch fp[0] { 14903 case "service_domain", "serviceDomain", "service-domain": 14904 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain}, nil 14905 case "provider_name_tmpl", "providerNameTmpl", "provider-name-tmpl": 14906 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl}, nil 14907 case "client_name", "clientName", "client-name": 14908 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName}, nil 14909 case "service_name", "serviceName", "service-name": 14910 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName}, nil 14911 } 14912 } 14913 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH", fp) 14914 } 14915 14916 func ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(rawField string) (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath, error) { 14917 fp, err := gotenobject.ParseRawFieldPath(rawField) 14918 if err != nil { 14919 return nil, err 14920 } 14921 return BuildPolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(fp) 14922 } 14923 14924 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(rawField string) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath { 14925 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(rawField) 14926 if err != nil { 14927 panic(err) 14928 } 14929 return fp 14930 } 14931 14932 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath struct { 14933 selector PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector 14934 } 14935 14936 var _ PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath = (*PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath)(nil) 14937 14938 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) Selector() PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelector { 14939 return fp.selector 14940 } 14941 14942 // String returns path representation in proto convention 14943 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) String() string { 14944 return fp.selector.String() 14945 } 14946 14947 // JSONString returns path representation is JSON convention 14948 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) JSONString() string { 14949 return strcase.ToLowerCamel(fp.String()) 14950 } 14951 14952 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH 14953 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) (values []interface{}) { 14954 if source != nil { 14955 switch fp.selector { 14956 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 14957 values = append(values, source.ServiceDomain) 14958 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 14959 values = append(values, source.ProviderNameTmpl) 14960 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 14961 values = append(values, source.ClientName) 14962 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 14963 values = append(values, source.ServiceName) 14964 default: 14965 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fp.selector)) 14966 } 14967 } 14968 return 14969 } 14970 14971 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 14972 return fp.Get(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)) 14973 } 14974 14975 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH 14976 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) (interface{}, bool) { 14977 switch fp.selector { 14978 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 14979 return source.GetServiceDomain(), source != nil 14980 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 14981 return source.GetProviderNameTmpl(), source != nil 14982 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 14983 return source.GetClientName(), source != nil 14984 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 14985 return source.GetServiceName(), source != nil 14986 default: 14987 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fp.selector)) 14988 } 14989 } 14990 14991 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 14992 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)) 14993 } 14994 14995 // GetDefault returns a default value of the field type 14996 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) GetDefault() interface{} { 14997 switch fp.selector { 14998 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 14999 return "" 15000 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 15001 return "" 15002 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 15003 return "" 15004 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 15005 return "" 15006 default: 15007 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fp.selector)) 15008 } 15009 } 15010 15011 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) { 15012 if item != nil { 15013 switch fp.selector { 15014 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 15015 item.ServiceDomain = "" 15016 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 15017 item.ProviderNameTmpl = "" 15018 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 15019 item.ClientName = "" 15020 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 15021 item.ServiceName = "" 15022 default: 15023 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fp.selector)) 15024 } 15025 } 15026 } 15027 15028 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) ClearValueRaw(item proto.Message) { 15029 fp.ClearValue(item.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)) 15030 } 15031 15032 // IsLeaf - whether field path is holds simple value 15033 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) IsLeaf() bool { 15034 return fp.selector == PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain || 15035 fp.selector == PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl || 15036 fp.selector == PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName || 15037 fp.selector == PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName 15038 } 15039 15040 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 15041 return []gotenobject.FieldPath{fp} 15042 } 15043 15044 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue { 15045 switch fp.selector { 15046 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 15047 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, value: value.(string)} 15048 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 15049 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, value: value.(string)} 15050 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 15051 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, value: value.(string)} 15052 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 15053 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, value: value.(string)} 15054 default: 15055 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fp.selector)) 15056 } 15057 } 15058 15059 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 15060 return fp.WithIValue(value) 15061 } 15062 15063 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues { 15064 fpaov := &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp} 15065 switch fp.selector { 15066 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 15067 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, values: values.([]string)} 15068 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 15069 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, values: values.([]string)} 15070 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 15071 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, values: values.([]string)} 15072 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 15073 return &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: *fp, values: values.([]string)} 15074 default: 15075 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fp.selector)) 15076 } 15077 return fpaov 15078 } 15079 15080 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 15081 return fp.WithIArrayOfValues(values) 15082 } 15083 15084 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue { 15085 switch fp.selector { 15086 default: 15087 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fp.selector)) 15088 } 15089 } 15090 15091 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 15092 return fp.WithIArrayItemValue(value) 15093 } 15094 15095 // PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue allows storing values for ProxiesSSH fields according to their type 15096 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue interface { 15097 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath 15098 gotenobject.FieldPathValue 15099 SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) 15100 CompareWith(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) (cmp int, comparable bool) 15101 } 15102 15103 func ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue, error) { 15104 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(pathStr) 15105 if err != nil { 15106 return nil, err 15107 } 15108 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 15109 if err != nil { 15110 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProxiesSSH field path value from %s: %v", valueStr, err) 15111 } 15112 return fpv.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue), nil 15113 } 15114 15115 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue { 15116 fpv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue(pathStr, valueStr) 15117 if err != nil { 15118 panic(err) 15119 } 15120 return fpv 15121 } 15122 15123 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue struct { 15124 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath 15125 value interface{} 15126 } 15127 15128 var _ PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathValue = (*PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue)(nil) 15129 15130 // GetRawValue returns raw value stored under selected path for 'ProxiesSSH' as interface{} 15131 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) GetRawValue() interface{} { 15132 return fpv.value 15133 } 15134 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) AsServiceDomainValue() (string, bool) { 15135 res, ok := fpv.value.(string) 15136 return res, ok 15137 } 15138 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) AsProviderNameTmplValue() (string, bool) { 15139 res, ok := fpv.value.(string) 15140 return res, ok 15141 } 15142 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) AsClientNameValue() (string, bool) { 15143 res, ok := fpv.value.(string) 15144 return res, ok 15145 } 15146 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) AsServiceNameValue() (string, bool) { 15147 res, ok := fpv.value.(string) 15148 return res, ok 15149 } 15150 15151 // SetTo stores value for selected field for object ProxiesSSH 15152 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) { 15153 if *target == nil { 15154 *target = new(PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) 15155 } 15156 switch fpv.selector { 15157 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 15158 (*target).ServiceDomain = fpv.value.(string) 15159 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 15160 (*target).ProviderNameTmpl = fpv.value.(string) 15161 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 15162 (*target).ClientName = fpv.value.(string) 15163 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 15164 (*target).ServiceName = fpv.value.(string) 15165 default: 15166 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fpv.selector)) 15167 } 15168 } 15169 15170 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) SetToRaw(target proto.Message) { 15171 typedObject := target.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) 15172 fpv.SetTo(&typedObject) 15173 } 15174 15175 // CompareWith compares value in the 'PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH'. 15176 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) (int, bool) { 15177 switch fpv.selector { 15178 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 15179 leftValue := fpv.value.(string) 15180 rightValue := source.GetServiceDomain() 15181 if (leftValue) == (rightValue) { 15182 return 0, true 15183 } else if (leftValue) < (rightValue) { 15184 return -1, true 15185 } else { 15186 return 1, true 15187 } 15188 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 15189 leftValue := fpv.value.(string) 15190 rightValue := source.GetProviderNameTmpl() 15191 if (leftValue) == (rightValue) { 15192 return 0, true 15193 } else if (leftValue) < (rightValue) { 15194 return -1, true 15195 } else { 15196 return 1, true 15197 } 15198 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 15199 leftValue := fpv.value.(string) 15200 rightValue := source.GetClientName() 15201 if (leftValue) == (rightValue) { 15202 return 0, true 15203 } else if (leftValue) < (rightValue) { 15204 return -1, true 15205 } else { 15206 return 1, true 15207 } 15208 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 15209 leftValue := fpv.value.(string) 15210 rightValue := source.GetServiceName() 15211 if (leftValue) == (rightValue) { 15212 return 0, true 15213 } else if (leftValue) < (rightValue) { 15214 return -1, true 15215 } else { 15216 return 1, true 15217 } 15218 default: 15219 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH: %d", fpv.selector)) 15220 } 15221 } 15222 15223 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 15224 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)) 15225 } 15226 15227 // PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue allows storing single item in Path-specific values for ProxiesSSH according to their type 15228 // Present only for array (repeated) types. 15229 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue interface { 15230 gotenobject.FieldPathArrayItemValue 15231 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath 15232 ContainsValue(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) bool 15233 } 15234 15235 // ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 15236 func ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue, error) { 15237 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(pathStr) 15238 if err != nil { 15239 return nil, err 15240 } 15241 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 15242 if err != nil { 15243 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProxiesSSH field path array item value from %s: %v", valueStr, err) 15244 } 15245 return fpaiv.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue), nil 15246 } 15247 15248 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue { 15249 fpaiv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue(pathStr, valueStr) 15250 if err != nil { 15251 panic(err) 15252 } 15253 return fpaiv 15254 } 15255 15256 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayItemValue struct { 15257 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath 15258 value interface{} 15259 } 15260 15261 var _ PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayItemValue = (*PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayItemValue)(nil) 15262 15263 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH as interface{} 15264 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 15265 return fpaiv.value 15266 } 15267 15268 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) (interface{}, bool) { 15269 return nil, false 15270 } 15271 15272 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 15273 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)) 15274 } 15275 15276 // Contains returns a boolean indicating if value that is being held is present in given 'ProxiesSSH' 15277 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) bool { 15278 slice := fpaiv.PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath.Get(source) 15279 for _, v := range slice { 15280 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 15281 if proto.Equal(asProtoMsg, v.(proto.Message)) { 15282 return true 15283 } 15284 } else if reflect.DeepEqual(v, fpaiv.value) { 15285 return true 15286 } 15287 } 15288 return false 15289 } 15290 15291 // PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues allows storing slice of values for ProxiesSSH fields according to their type 15292 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues interface { 15293 gotenobject.FieldPathArrayOfValues 15294 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath 15295 } 15296 15297 func ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues, error) { 15298 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(pathStr) 15299 if err != nil { 15300 return nil, err 15301 } 15302 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 15303 if err != nil { 15304 return nil, status.Errorf(codes.InvalidArgument, "error parsing ProxiesSSH field path array of values from %s: %v", valuesStr, err) 15305 } 15306 return fpaov.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues), nil 15307 } 15308 15309 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues { 15310 fpaov, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues(pathStr, valuesStr) 15311 if err != nil { 15312 panic(err) 15313 } 15314 return fpaov 15315 } 15316 15317 type PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues struct { 15318 PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath 15319 values interface{} 15320 } 15321 15322 var _ PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues)(nil) 15323 15324 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 15325 switch fpaov.selector { 15326 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 15327 for _, v := range fpaov.values.([]string) { 15328 values = append(values, v) 15329 } 15330 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 15331 for _, v := range fpaov.values.([]string) { 15332 values = append(values, v) 15333 } 15334 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 15335 for _, v := range fpaov.values.([]string) { 15336 values = append(values, v) 15337 } 15338 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 15339 for _, v := range fpaov.values.([]string) { 15340 values = append(values, v) 15341 } 15342 } 15343 return 15344 } 15345 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues) AsServiceDomainArrayOfValues() ([]string, bool) { 15346 res, ok := fpaov.values.([]string) 15347 return res, ok 15348 } 15349 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues) AsProviderNameTmplArrayOfValues() ([]string, bool) { 15350 res, ok := fpaov.values.([]string) 15351 return res, ok 15352 } 15353 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues) AsClientNameArrayOfValues() ([]string, bool) { 15354 res, ok := fpaov.values.([]string) 15355 return res, ok 15356 } 15357 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPathArrayOfValues) AsServiceNameArrayOfValues() ([]string, bool) { 15358 res, ok := fpaov.values.([]string) 15359 return res, ok 15360 } 15361 15362 // FieldPath provides implementation to handle 15363 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 15364 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath interface { 15365 gotenobject.FieldPath 15366 Selector() PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelector 15367 Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) []interface{} 15368 GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) (interface{}, bool) 15369 ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) 15370 15371 // Those methods build corresponding PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue 15372 // (or array of values) and holds passed value. Panics if injected type is incorrect. 15373 WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue 15374 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues 15375 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue 15376 } 15377 15378 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelector int32 15379 15380 const ( 15381 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelector = 0 15382 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelector = 1 15383 ) 15384 15385 func (s PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelector) String() string { 15386 switch s { 15387 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15388 return "client_name" 15389 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15390 return "username" 15391 default: 15392 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", s)) 15393 } 15394 } 15395 15396 func BuildPolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath, error) { 15397 if len(fp) == 0 { 15398 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH") 15399 } 15400 if len(fp) == 1 { 15401 switch fp[0] { 15402 case "client_name", "clientName", "client-name": 15403 return &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName}, nil 15404 case "username": 15405 return &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername}, nil 15406 } 15407 } 15408 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH", fp) 15409 } 15410 15411 func ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(rawField string) (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath, error) { 15412 fp, err := gotenobject.ParseRawFieldPath(rawField) 15413 if err != nil { 15414 return nil, err 15415 } 15416 return BuildPolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(fp) 15417 } 15418 15419 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(rawField string) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath { 15420 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(rawField) 15421 if err != nil { 15422 panic(err) 15423 } 15424 return fp 15425 } 15426 15427 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath struct { 15428 selector PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelector 15429 } 15430 15431 var _ PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath = (*PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath)(nil) 15432 15433 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) Selector() PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelector { 15434 return fp.selector 15435 } 15436 15437 // String returns path representation in proto convention 15438 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) String() string { 15439 return fp.selector.String() 15440 } 15441 15442 // JSONString returns path representation is JSON convention 15443 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) JSONString() string { 15444 return strcase.ToLowerCamel(fp.String()) 15445 } 15446 15447 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH 15448 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) (values []interface{}) { 15449 if source != nil { 15450 switch fp.selector { 15451 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15452 values = append(values, source.ClientName) 15453 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15454 values = append(values, source.Username) 15455 default: 15456 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fp.selector)) 15457 } 15458 } 15459 return 15460 } 15461 15462 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 15463 return fp.Get(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)) 15464 } 15465 15466 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH 15467 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) (interface{}, bool) { 15468 switch fp.selector { 15469 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15470 return source.GetClientName(), source != nil 15471 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15472 return source.GetUsername(), source != nil 15473 default: 15474 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fp.selector)) 15475 } 15476 } 15477 15478 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 15479 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)) 15480 } 15481 15482 // GetDefault returns a default value of the field type 15483 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) GetDefault() interface{} { 15484 switch fp.selector { 15485 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15486 return "" 15487 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15488 return "" 15489 default: 15490 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fp.selector)) 15491 } 15492 } 15493 15494 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) { 15495 if item != nil { 15496 switch fp.selector { 15497 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15498 item.ClientName = "" 15499 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15500 item.Username = "" 15501 default: 15502 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fp.selector)) 15503 } 15504 } 15505 } 15506 15507 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) ClearValueRaw(item proto.Message) { 15508 fp.ClearValue(item.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)) 15509 } 15510 15511 // IsLeaf - whether field path is holds simple value 15512 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) IsLeaf() bool { 15513 return fp.selector == PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName || 15514 fp.selector == PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername 15515 } 15516 15517 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 15518 return []gotenobject.FieldPath{fp} 15519 } 15520 15521 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue { 15522 switch fp.selector { 15523 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15524 return &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath: *fp, value: value.(string)} 15525 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15526 return &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue{PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath: *fp, value: value.(string)} 15527 default: 15528 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fp.selector)) 15529 } 15530 } 15531 15532 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 15533 return fp.WithIValue(value) 15534 } 15535 15536 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues { 15537 fpaov := &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath: *fp} 15538 switch fp.selector { 15539 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15540 return &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath: *fp, values: values.([]string)} 15541 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15542 return &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath: *fp, values: values.([]string)} 15543 default: 15544 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fp.selector)) 15545 } 15546 return fpaov 15547 } 15548 15549 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 15550 return fp.WithIArrayOfValues(values) 15551 } 15552 15553 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue { 15554 switch fp.selector { 15555 default: 15556 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fp.selector)) 15557 } 15558 } 15559 15560 func (fp *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 15561 return fp.WithIArrayItemValue(value) 15562 } 15563 15564 // PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue allows storing values for PodSSH fields according to their type 15565 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue interface { 15566 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath 15567 gotenobject.FieldPathValue 15568 SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) 15569 CompareWith(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) (cmp int, comparable bool) 15570 } 15571 15572 func ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue, error) { 15573 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(pathStr) 15574 if err != nil { 15575 return nil, err 15576 } 15577 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 15578 if err != nil { 15579 return nil, status.Errorf(codes.InvalidArgument, "error parsing PodSSH field path value from %s: %v", valueStr, err) 15580 } 15581 return fpv.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue), nil 15582 } 15583 15584 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue { 15585 fpv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue(pathStr, valueStr) 15586 if err != nil { 15587 panic(err) 15588 } 15589 return fpv 15590 } 15591 15592 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue struct { 15593 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath 15594 value interface{} 15595 } 15596 15597 var _ PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathValue = (*PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue)(nil) 15598 15599 // GetRawValue returns raw value stored under selected path for 'PodSSH' as interface{} 15600 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue) GetRawValue() interface{} { 15601 return fpv.value 15602 } 15603 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue) AsClientNameValue() (string, bool) { 15604 res, ok := fpv.value.(string) 15605 return res, ok 15606 } 15607 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue) AsUsernameValue() (string, bool) { 15608 res, ok := fpv.value.(string) 15609 return res, ok 15610 } 15611 15612 // SetTo stores value for selected field for object PodSSH 15613 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) { 15614 if *target == nil { 15615 *target = new(PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) 15616 } 15617 switch fpv.selector { 15618 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15619 (*target).ClientName = fpv.value.(string) 15620 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15621 (*target).Username = fpv.value.(string) 15622 default: 15623 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fpv.selector)) 15624 } 15625 } 15626 15627 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue) SetToRaw(target proto.Message) { 15628 typedObject := target.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) 15629 fpv.SetTo(&typedObject) 15630 } 15631 15632 // CompareWith compares value in the 'PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH'. 15633 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) (int, bool) { 15634 switch fpv.selector { 15635 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15636 leftValue := fpv.value.(string) 15637 rightValue := source.GetClientName() 15638 if (leftValue) == (rightValue) { 15639 return 0, true 15640 } else if (leftValue) < (rightValue) { 15641 return -1, true 15642 } else { 15643 return 1, true 15644 } 15645 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15646 leftValue := fpv.value.(string) 15647 rightValue := source.GetUsername() 15648 if (leftValue) == (rightValue) { 15649 return 0, true 15650 } else if (leftValue) < (rightValue) { 15651 return -1, true 15652 } else { 15653 return 1, true 15654 } 15655 default: 15656 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH: %d", fpv.selector)) 15657 } 15658 } 15659 15660 func (fpv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 15661 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)) 15662 } 15663 15664 // PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue allows storing single item in Path-specific values for PodSSH according to their type 15665 // Present only for array (repeated) types. 15666 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue interface { 15667 gotenobject.FieldPathArrayItemValue 15668 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath 15669 ContainsValue(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) bool 15670 } 15671 15672 // ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 15673 func ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue, error) { 15674 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(pathStr) 15675 if err != nil { 15676 return nil, err 15677 } 15678 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 15679 if err != nil { 15680 return nil, status.Errorf(codes.InvalidArgument, "error parsing PodSSH field path array item value from %s: %v", valueStr, err) 15681 } 15682 return fpaiv.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue), nil 15683 } 15684 15685 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue { 15686 fpaiv, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue(pathStr, valueStr) 15687 if err != nil { 15688 panic(err) 15689 } 15690 return fpaiv 15691 } 15692 15693 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayItemValue struct { 15694 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath 15695 value interface{} 15696 } 15697 15698 var _ PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayItemValue = (*PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayItemValue)(nil) 15699 15700 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH as interface{} 15701 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 15702 return fpaiv.value 15703 } 15704 15705 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) (interface{}, bool) { 15706 return nil, false 15707 } 15708 15709 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 15710 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)) 15711 } 15712 15713 // Contains returns a boolean indicating if value that is being held is present in given 'PodSSH' 15714 func (fpaiv *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) bool { 15715 slice := fpaiv.PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath.Get(source) 15716 for _, v := range slice { 15717 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 15718 if proto.Equal(asProtoMsg, v.(proto.Message)) { 15719 return true 15720 } 15721 } else if reflect.DeepEqual(v, fpaiv.value) { 15722 return true 15723 } 15724 } 15725 return false 15726 } 15727 15728 // PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues allows storing slice of values for PodSSH fields according to their type 15729 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues interface { 15730 gotenobject.FieldPathArrayOfValues 15731 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath 15732 } 15733 15734 func ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues, error) { 15735 fp, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(pathStr) 15736 if err != nil { 15737 return nil, err 15738 } 15739 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 15740 if err != nil { 15741 return nil, status.Errorf(codes.InvalidArgument, "error parsing PodSSH field path array of values from %s: %v", valuesStr, err) 15742 } 15743 return fpaov.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues), nil 15744 } 15745 15746 func MustParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues { 15747 fpaov, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues(pathStr, valuesStr) 15748 if err != nil { 15749 panic(err) 15750 } 15751 return fpaov 15752 } 15753 15754 type PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues struct { 15755 PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath 15756 values interface{} 15757 } 15758 15759 var _ PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues)(nil) 15760 15761 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 15762 switch fpaov.selector { 15763 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 15764 for _, v := range fpaov.values.([]string) { 15765 values = append(values, v) 15766 } 15767 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 15768 for _, v := range fpaov.values.([]string) { 15769 values = append(values, v) 15770 } 15771 } 15772 return 15773 } 15774 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues) AsClientNameArrayOfValues() ([]string, bool) { 15775 res, ok := fpaov.values.([]string) 15776 return res, ok 15777 } 15778 func (fpaov *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPathArrayOfValues) AsUsernameArrayOfValues() ([]string, bool) { 15779 res, ok := fpaov.values.([]string) 15780 return res, ok 15781 } 15782 15783 // FieldPath provides implementation to handle 15784 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 15785 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath interface { 15786 gotenobject.FieldPath 15787 Selector() PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathSelector 15788 Get(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) []interface{} 15789 GetSingle(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) (interface{}, bool) 15790 ClearValue(item *PolicySpec_AIAgentHandling_Remediation_FixInSSH) 15791 15792 // Those methods build corresponding PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue 15793 // (or array of values) and holds passed value. Panics if injected type is incorrect. 15794 WithIValue(value interface{}) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue 15795 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues 15796 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue 15797 } 15798 15799 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathSelector int32 15800 15801 func (s PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathSelector) String() string { 15802 switch s { 15803 default: 15804 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", s)) 15805 } 15806 } 15807 15808 func BuildPolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath, error) { 15809 if len(fp) == 0 { 15810 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling_Remediation_FixInSSH") 15811 } 15812 if len(fp) == 1 { 15813 switch fp[0] { 15814 } 15815 } 15816 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling_Remediation_FixInSSH", fp) 15817 } 15818 15819 func ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(rawField string) (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath, error) { 15820 fp, err := gotenobject.ParseRawFieldPath(rawField) 15821 if err != nil { 15822 return nil, err 15823 } 15824 return BuildPolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(fp) 15825 } 15826 15827 func MustParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(rawField string) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath { 15828 fp, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(rawField) 15829 if err != nil { 15830 panic(err) 15831 } 15832 return fp 15833 } 15834 15835 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath struct { 15836 selector PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathSelector 15837 } 15838 15839 var _ PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath = (*PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath)(nil) 15840 15841 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) Selector() PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathSelector { 15842 return fp.selector 15843 } 15844 15845 // String returns path representation in proto convention 15846 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) String() string { 15847 return fp.selector.String() 15848 } 15849 15850 // JSONString returns path representation is JSON convention 15851 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) JSONString() string { 15852 return strcase.ToLowerCamel(fp.String()) 15853 } 15854 15855 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling_Remediation_FixInSSH 15856 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) (values []interface{}) { 15857 if source != nil { 15858 switch fp.selector { 15859 default: 15860 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fp.selector)) 15861 } 15862 } 15863 return 15864 } 15865 15866 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 15867 return fp.Get(source.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)) 15868 } 15869 15870 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling_Remediation_FixInSSH 15871 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) (interface{}, bool) { 15872 switch fp.selector { 15873 default: 15874 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fp.selector)) 15875 } 15876 } 15877 15878 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 15879 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)) 15880 } 15881 15882 // GetDefault returns a default value of the field type 15883 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) GetDefault() interface{} { 15884 switch fp.selector { 15885 default: 15886 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fp.selector)) 15887 } 15888 } 15889 15890 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling_Remediation_FixInSSH) { 15891 if item != nil { 15892 switch fp.selector { 15893 default: 15894 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fp.selector)) 15895 } 15896 } 15897 } 15898 15899 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) ClearValueRaw(item proto.Message) { 15900 fp.ClearValue(item.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)) 15901 } 15902 15903 // IsLeaf - whether field path is holds simple value 15904 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) IsLeaf() bool { 15905 return false 15906 } 15907 15908 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 15909 return []gotenobject.FieldPath{fp} 15910 } 15911 15912 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue { 15913 switch fp.selector { 15914 default: 15915 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fp.selector)) 15916 } 15917 } 15918 15919 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 15920 return fp.WithIValue(value) 15921 } 15922 15923 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues { 15924 fpaov := &PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath: *fp} 15925 switch fp.selector { 15926 default: 15927 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fp.selector)) 15928 } 15929 return fpaov 15930 } 15931 15932 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 15933 return fp.WithIArrayOfValues(values) 15934 } 15935 15936 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue { 15937 switch fp.selector { 15938 default: 15939 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fp.selector)) 15940 } 15941 } 15942 15943 func (fp *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 15944 return fp.WithIArrayItemValue(value) 15945 } 15946 15947 // PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue allows storing values for FixInSSH fields according to their type 15948 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue interface { 15949 PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath 15950 gotenobject.FieldPathValue 15951 SetTo(target **PolicySpec_AIAgentHandling_Remediation_FixInSSH) 15952 CompareWith(*PolicySpec_AIAgentHandling_Remediation_FixInSSH) (cmp int, comparable bool) 15953 } 15954 15955 func ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue, error) { 15956 fp, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(pathStr) 15957 if err != nil { 15958 return nil, err 15959 } 15960 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 15961 if err != nil { 15962 return nil, status.Errorf(codes.InvalidArgument, "error parsing FixInSSH field path value from %s: %v", valueStr, err) 15963 } 15964 return fpv.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue), nil 15965 } 15966 15967 func MustParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue { 15968 fpv, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue(pathStr, valueStr) 15969 if err != nil { 15970 panic(err) 15971 } 15972 return fpv 15973 } 15974 15975 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue struct { 15976 PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath 15977 value interface{} 15978 } 15979 15980 var _ PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathValue = (*PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue)(nil) 15981 15982 // GetRawValue returns raw value stored under selected path for 'FixInSSH' as interface{} 15983 func (fpv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue) GetRawValue() interface{} { 15984 return fpv.value 15985 } 15986 15987 // SetTo stores value for selected field for object FixInSSH 15988 func (fpv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling_Remediation_FixInSSH) { 15989 if *target == nil { 15990 *target = new(PolicySpec_AIAgentHandling_Remediation_FixInSSH) 15991 } 15992 switch fpv.selector { 15993 default: 15994 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fpv.selector)) 15995 } 15996 } 15997 15998 func (fpv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue) SetToRaw(target proto.Message) { 15999 typedObject := target.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH) 16000 fpv.SetTo(&typedObject) 16001 } 16002 16003 // CompareWith compares value in the 'PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling_Remediation_FixInSSH'. 16004 func (fpv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) (int, bool) { 16005 switch fpv.selector { 16006 default: 16007 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_FixInSSH: %d", fpv.selector)) 16008 } 16009 } 16010 16011 func (fpv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 16012 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)) 16013 } 16014 16015 // PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue allows storing single item in Path-specific values for FixInSSH according to their type 16016 // Present only for array (repeated) types. 16017 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue interface { 16018 gotenobject.FieldPathArrayItemValue 16019 PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath 16020 ContainsValue(*PolicySpec_AIAgentHandling_Remediation_FixInSSH) bool 16021 } 16022 16023 // ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 16024 func ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue, error) { 16025 fp, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(pathStr) 16026 if err != nil { 16027 return nil, err 16028 } 16029 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 16030 if err != nil { 16031 return nil, status.Errorf(codes.InvalidArgument, "error parsing FixInSSH field path array item value from %s: %v", valueStr, err) 16032 } 16033 return fpaiv.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue), nil 16034 } 16035 16036 func MustParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue { 16037 fpaiv, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue(pathStr, valueStr) 16038 if err != nil { 16039 panic(err) 16040 } 16041 return fpaiv 16042 } 16043 16044 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayItemValue struct { 16045 PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath 16046 value interface{} 16047 } 16048 16049 var _ PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayItemValue = (*PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayItemValue)(nil) 16050 16051 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling_Remediation_FixInSSH as interface{} 16052 func (fpaiv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 16053 return fpaiv.value 16054 } 16055 16056 func (fpaiv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) (interface{}, bool) { 16057 return nil, false 16058 } 16059 16060 func (fpaiv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 16061 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)) 16062 } 16063 16064 // Contains returns a boolean indicating if value that is being held is present in given 'FixInSSH' 16065 func (fpaiv *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) bool { 16066 slice := fpaiv.PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath.Get(source) 16067 for _, v := range slice { 16068 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 16069 if proto.Equal(asProtoMsg, v.(proto.Message)) { 16070 return true 16071 } 16072 } else if reflect.DeepEqual(v, fpaiv.value) { 16073 return true 16074 } 16075 } 16076 return false 16077 } 16078 16079 // PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues allows storing slice of values for FixInSSH fields according to their type 16080 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues interface { 16081 gotenobject.FieldPathArrayOfValues 16082 PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath 16083 } 16084 16085 func ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues, error) { 16086 fp, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(pathStr) 16087 if err != nil { 16088 return nil, err 16089 } 16090 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 16091 if err != nil { 16092 return nil, status.Errorf(codes.InvalidArgument, "error parsing FixInSSH field path array of values from %s: %v", valuesStr, err) 16093 } 16094 return fpaov.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues), nil 16095 } 16096 16097 func MustParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues { 16098 fpaov, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues(pathStr, valuesStr) 16099 if err != nil { 16100 panic(err) 16101 } 16102 return fpaov 16103 } 16104 16105 type PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayOfValues struct { 16106 PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath 16107 values interface{} 16108 } 16109 16110 var _ PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayOfValues)(nil) 16111 16112 func (fpaov *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 16113 switch fpaov.selector { 16114 } 16115 return 16116 } 16117 16118 // FieldPath provides implementation to handle 16119 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 16120 type PolicySpecAIAgentHandlingRemediationReboot_FieldPath interface { 16121 gotenobject.FieldPath 16122 Selector() PolicySpecAIAgentHandlingRemediationReboot_FieldPathSelector 16123 Get(source *PolicySpec_AIAgentHandling_Remediation_Reboot) []interface{} 16124 GetSingle(source *PolicySpec_AIAgentHandling_Remediation_Reboot) (interface{}, bool) 16125 ClearValue(item *PolicySpec_AIAgentHandling_Remediation_Reboot) 16126 16127 // Those methods build corresponding PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue 16128 // (or array of values) and holds passed value. Panics if injected type is incorrect. 16129 WithIValue(value interface{}) PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue 16130 WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues 16131 WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue 16132 } 16133 16134 type PolicySpecAIAgentHandlingRemediationReboot_FieldPathSelector int32 16135 16136 func (s PolicySpecAIAgentHandlingRemediationReboot_FieldPathSelector) String() string { 16137 switch s { 16138 default: 16139 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", s)) 16140 } 16141 } 16142 16143 func BuildPolicySpecAIAgentHandlingRemediationReboot_FieldPath(fp gotenobject.RawFieldPath) (PolicySpecAIAgentHandlingRemediationReboot_FieldPath, error) { 16144 if len(fp) == 0 { 16145 return nil, status.Error(codes.InvalidArgument, "empty field path for object PolicySpec_AIAgentHandling_Remediation_Reboot") 16146 } 16147 if len(fp) == 1 { 16148 switch fp[0] { 16149 } 16150 } 16151 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PolicySpec_AIAgentHandling_Remediation_Reboot", fp) 16152 } 16153 16154 func ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(rawField string) (PolicySpecAIAgentHandlingRemediationReboot_FieldPath, error) { 16155 fp, err := gotenobject.ParseRawFieldPath(rawField) 16156 if err != nil { 16157 return nil, err 16158 } 16159 return BuildPolicySpecAIAgentHandlingRemediationReboot_FieldPath(fp) 16160 } 16161 16162 func MustParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(rawField string) PolicySpecAIAgentHandlingRemediationReboot_FieldPath { 16163 fp, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(rawField) 16164 if err != nil { 16165 panic(err) 16166 } 16167 return fp 16168 } 16169 16170 type PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath struct { 16171 selector PolicySpecAIAgentHandlingRemediationReboot_FieldPathSelector 16172 } 16173 16174 var _ PolicySpecAIAgentHandlingRemediationReboot_FieldPath = (*PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath)(nil) 16175 16176 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) Selector() PolicySpecAIAgentHandlingRemediationReboot_FieldPathSelector { 16177 return fp.selector 16178 } 16179 16180 // String returns path representation in proto convention 16181 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) String() string { 16182 return fp.selector.String() 16183 } 16184 16185 // JSONString returns path representation is JSON convention 16186 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) JSONString() string { 16187 return strcase.ToLowerCamel(fp.String()) 16188 } 16189 16190 // Get returns all values pointed by specific field from source PolicySpec_AIAgentHandling_Remediation_Reboot 16191 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) Get(source *PolicySpec_AIAgentHandling_Remediation_Reboot) (values []interface{}) { 16192 if source != nil { 16193 switch fp.selector { 16194 default: 16195 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fp.selector)) 16196 } 16197 } 16198 return 16199 } 16200 16201 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 16202 return fp.Get(source.(*PolicySpec_AIAgentHandling_Remediation_Reboot)) 16203 } 16204 16205 // GetSingle returns value pointed by specific field of from source PolicySpec_AIAgentHandling_Remediation_Reboot 16206 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) GetSingle(source *PolicySpec_AIAgentHandling_Remediation_Reboot) (interface{}, bool) { 16207 switch fp.selector { 16208 default: 16209 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fp.selector)) 16210 } 16211 } 16212 16213 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 16214 return fp.GetSingle(source.(*PolicySpec_AIAgentHandling_Remediation_Reboot)) 16215 } 16216 16217 // GetDefault returns a default value of the field type 16218 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) GetDefault() interface{} { 16219 switch fp.selector { 16220 default: 16221 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fp.selector)) 16222 } 16223 } 16224 16225 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) ClearValue(item *PolicySpec_AIAgentHandling_Remediation_Reboot) { 16226 if item != nil { 16227 switch fp.selector { 16228 default: 16229 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fp.selector)) 16230 } 16231 } 16232 } 16233 16234 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) ClearValueRaw(item proto.Message) { 16235 fp.ClearValue(item.(*PolicySpec_AIAgentHandling_Remediation_Reboot)) 16236 } 16237 16238 // IsLeaf - whether field path is holds simple value 16239 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) IsLeaf() bool { 16240 return false 16241 } 16242 16243 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 16244 return []gotenobject.FieldPath{fp} 16245 } 16246 16247 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) WithIValue(value interface{}) PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue { 16248 switch fp.selector { 16249 default: 16250 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fp.selector)) 16251 } 16252 } 16253 16254 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 16255 return fp.WithIValue(value) 16256 } 16257 16258 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) WithIArrayOfValues(values interface{}) PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues { 16259 fpaov := &PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayOfValues{PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath: *fp} 16260 switch fp.selector { 16261 default: 16262 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fp.selector)) 16263 } 16264 return fpaov 16265 } 16266 16267 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 16268 return fp.WithIArrayOfValues(values) 16269 } 16270 16271 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) WithIArrayItemValue(value interface{}) PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue { 16272 switch fp.selector { 16273 default: 16274 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fp.selector)) 16275 } 16276 } 16277 16278 func (fp *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 16279 return fp.WithIArrayItemValue(value) 16280 } 16281 16282 // PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue allows storing values for Reboot fields according to their type 16283 type PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue interface { 16284 PolicySpecAIAgentHandlingRemediationReboot_FieldPath 16285 gotenobject.FieldPathValue 16286 SetTo(target **PolicySpec_AIAgentHandling_Remediation_Reboot) 16287 CompareWith(*PolicySpec_AIAgentHandling_Remediation_Reboot) (cmp int, comparable bool) 16288 } 16289 16290 func ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue, error) { 16291 fp, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(pathStr) 16292 if err != nil { 16293 return nil, err 16294 } 16295 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 16296 if err != nil { 16297 return nil, status.Errorf(codes.InvalidArgument, "error parsing Reboot field path value from %s: %v", valueStr, err) 16298 } 16299 return fpv.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue), nil 16300 } 16301 16302 func MustParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathValue(pathStr, valueStr string) PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue { 16303 fpv, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathValue(pathStr, valueStr) 16304 if err != nil { 16305 panic(err) 16306 } 16307 return fpv 16308 } 16309 16310 type PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue struct { 16311 PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath 16312 value interface{} 16313 } 16314 16315 var _ PolicySpecAIAgentHandlingRemediationReboot_FieldPathValue = (*PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue)(nil) 16316 16317 // GetRawValue returns raw value stored under selected path for 'Reboot' as interface{} 16318 func (fpv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue) GetRawValue() interface{} { 16319 return fpv.value 16320 } 16321 16322 // SetTo stores value for selected field for object Reboot 16323 func (fpv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue) SetTo(target **PolicySpec_AIAgentHandling_Remediation_Reboot) { 16324 if *target == nil { 16325 *target = new(PolicySpec_AIAgentHandling_Remediation_Reboot) 16326 } 16327 switch fpv.selector { 16328 default: 16329 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fpv.selector)) 16330 } 16331 } 16332 16333 func (fpv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue) SetToRaw(target proto.Message) { 16334 typedObject := target.(*PolicySpec_AIAgentHandling_Remediation_Reboot) 16335 fpv.SetTo(&typedObject) 16336 } 16337 16338 // CompareWith compares value in the 'PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue' with the value under path in 'PolicySpec_AIAgentHandling_Remediation_Reboot'. 16339 func (fpv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue) CompareWith(source *PolicySpec_AIAgentHandling_Remediation_Reboot) (int, bool) { 16340 switch fpv.selector { 16341 default: 16342 panic(fmt.Sprintf("Invalid selector for PolicySpec_AIAgentHandling_Remediation_Reboot: %d", fpv.selector)) 16343 } 16344 } 16345 16346 func (fpv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 16347 return fpv.CompareWith(source.(*PolicySpec_AIAgentHandling_Remediation_Reboot)) 16348 } 16349 16350 // PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue allows storing single item in Path-specific values for Reboot according to their type 16351 // Present only for array (repeated) types. 16352 type PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue interface { 16353 gotenobject.FieldPathArrayItemValue 16354 PolicySpecAIAgentHandlingRemediationReboot_FieldPath 16355 ContainsValue(*PolicySpec_AIAgentHandling_Remediation_Reboot) bool 16356 } 16357 16358 // ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 16359 func ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue(pathStr, valueStr string) (PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue, error) { 16360 fp, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(pathStr) 16361 if err != nil { 16362 return nil, err 16363 } 16364 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 16365 if err != nil { 16366 return nil, status.Errorf(codes.InvalidArgument, "error parsing Reboot field path array item value from %s: %v", valueStr, err) 16367 } 16368 return fpaiv.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue), nil 16369 } 16370 16371 func MustParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue(pathStr, valueStr string) PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue { 16372 fpaiv, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue(pathStr, valueStr) 16373 if err != nil { 16374 panic(err) 16375 } 16376 return fpaiv 16377 } 16378 16379 type PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayItemValue struct { 16380 PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath 16381 value interface{} 16382 } 16383 16384 var _ PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayItemValue = (*PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayItemValue)(nil) 16385 16386 // GetRawValue returns stored element value for array in object PolicySpec_AIAgentHandling_Remediation_Reboot as interface{} 16387 func (fpaiv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 16388 return fpaiv.value 16389 } 16390 16391 func (fpaiv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayItemValue) GetSingle(source *PolicySpec_AIAgentHandling_Remediation_Reboot) (interface{}, bool) { 16392 return nil, false 16393 } 16394 16395 func (fpaiv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 16396 return fpaiv.GetSingle(source.(*PolicySpec_AIAgentHandling_Remediation_Reboot)) 16397 } 16398 16399 // Contains returns a boolean indicating if value that is being held is present in given 'Reboot' 16400 func (fpaiv *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayItemValue) ContainsValue(source *PolicySpec_AIAgentHandling_Remediation_Reboot) bool { 16401 slice := fpaiv.PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath.Get(source) 16402 for _, v := range slice { 16403 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 16404 if proto.Equal(asProtoMsg, v.(proto.Message)) { 16405 return true 16406 } 16407 } else if reflect.DeepEqual(v, fpaiv.value) { 16408 return true 16409 } 16410 } 16411 return false 16412 } 16413 16414 // PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues allows storing slice of values for Reboot fields according to their type 16415 type PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues interface { 16416 gotenobject.FieldPathArrayOfValues 16417 PolicySpecAIAgentHandlingRemediationReboot_FieldPath 16418 } 16419 16420 func ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues(pathStr, valuesStr string) (PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues, error) { 16421 fp, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(pathStr) 16422 if err != nil { 16423 return nil, err 16424 } 16425 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 16426 if err != nil { 16427 return nil, status.Errorf(codes.InvalidArgument, "error parsing Reboot field path array of values from %s: %v", valuesStr, err) 16428 } 16429 return fpaov.(PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues), nil 16430 } 16431 16432 func MustParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues(pathStr, valuesStr string) PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues { 16433 fpaov, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues(pathStr, valuesStr) 16434 if err != nil { 16435 panic(err) 16436 } 16437 return fpaov 16438 } 16439 16440 type PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayOfValues struct { 16441 PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath 16442 values interface{} 16443 } 16444 16445 var _ PolicySpecAIAgentHandlingRemediationReboot_FieldPathArrayOfValues = (*PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayOfValues)(nil) 16446 16447 func (fpaov *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 16448 switch fpaov.selector { 16449 } 16450 return 16451 } 16452 16453 // FieldPath provides implementation to handle 16454 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 16455 type NotificationChannelSpec_FieldPath interface { 16456 gotenobject.FieldPath 16457 Selector() NotificationChannelSpec_FieldPathSelector 16458 Get(source *NotificationChannelSpec) []interface{} 16459 GetSingle(source *NotificationChannelSpec) (interface{}, bool) 16460 ClearValue(item *NotificationChannelSpec) 16461 16462 // Those methods build corresponding NotificationChannelSpec_FieldPathValue 16463 // (or array of values) and holds passed value. Panics if injected type is incorrect. 16464 WithIValue(value interface{}) NotificationChannelSpec_FieldPathValue 16465 WithIArrayOfValues(values interface{}) NotificationChannelSpec_FieldPathArrayOfValues 16466 WithIArrayItemValue(value interface{}) NotificationChannelSpec_FieldPathArrayItemValue 16467 } 16468 16469 type NotificationChannelSpec_FieldPathSelector int32 16470 16471 const ( 16472 NotificationChannelSpec_FieldPathSelectorEnabled NotificationChannelSpec_FieldPathSelector = 0 16473 NotificationChannelSpec_FieldPathSelectorType NotificationChannelSpec_FieldPathSelector = 1 16474 NotificationChannelSpec_FieldPathSelectorEnabledKinds NotificationChannelSpec_FieldPathSelector = 2 16475 NotificationChannelSpec_FieldPathSelectorEmail NotificationChannelSpec_FieldPathSelector = 3 16476 NotificationChannelSpec_FieldPathSelectorSlack NotificationChannelSpec_FieldPathSelector = 4 16477 NotificationChannelSpec_FieldPathSelectorWebhook NotificationChannelSpec_FieldPathSelector = 5 16478 NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode NotificationChannelSpec_FieldPathSelector = 6 16479 NotificationChannelSpec_FieldPathSelectorNotificationMask NotificationChannelSpec_FieldPathSelector = 7 16480 NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg NotificationChannelSpec_FieldPathSelector = 8 16481 NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing NotificationChannelSpec_FieldPathSelector = 9 16482 ) 16483 16484 func (s NotificationChannelSpec_FieldPathSelector) String() string { 16485 switch s { 16486 case NotificationChannelSpec_FieldPathSelectorEnabled: 16487 return "enabled" 16488 case NotificationChannelSpec_FieldPathSelectorType: 16489 return "type" 16490 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16491 return "enabled_kinds" 16492 case NotificationChannelSpec_FieldPathSelectorEmail: 16493 return "email" 16494 case NotificationChannelSpec_FieldPathSelectorSlack: 16495 return "slack" 16496 case NotificationChannelSpec_FieldPathSelectorWebhook: 16497 return "webhook" 16498 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 16499 return "notification_language_code" 16500 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 16501 return "notification_mask" 16502 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 16503 return "max_alert_bodies_in_msg" 16504 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 16505 return "put_only_alerts_counter_when_overflowing" 16506 default: 16507 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", s)) 16508 } 16509 } 16510 16511 func BuildNotificationChannelSpec_FieldPath(fp gotenobject.RawFieldPath) (NotificationChannelSpec_FieldPath, error) { 16512 if len(fp) == 0 { 16513 return nil, status.Error(codes.InvalidArgument, "empty field path for object NotificationChannelSpec") 16514 } 16515 if len(fp) == 1 { 16516 switch fp[0] { 16517 case "enabled": 16518 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorEnabled}, nil 16519 case "type": 16520 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorType}, nil 16521 case "enabled_kinds", "enabledKinds", "enabled-kinds": 16522 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorEnabledKinds}, nil 16523 case "email": 16524 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorEmail}, nil 16525 case "slack": 16526 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorSlack}, nil 16527 case "webhook": 16528 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorWebhook}, nil 16529 case "notification_language_code", "notificationLanguageCode", "notification-language-code": 16530 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode}, nil 16531 case "notification_mask", "notificationMask", "notification-mask": 16532 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorNotificationMask}, nil 16533 case "max_alert_bodies_in_msg", "maxAlertBodiesInMsg", "max-alert-bodies-in-msg": 16534 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg}, nil 16535 case "put_only_alerts_counter_when_overflowing", "putOnlyAlertsCounterWhenOverflowing", "put-only-alerts-counter-when-overflowing": 16536 return &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing}, nil 16537 } 16538 } else { 16539 switch fp[0] { 16540 case "email": 16541 if subpath, err := BuildNotificationChannelSpecEmail_FieldPath(fp[1:]); err != nil { 16542 return nil, err 16543 } else { 16544 return &NotificationChannelSpec_FieldSubPath{selector: NotificationChannelSpec_FieldPathSelectorEmail, subPath: subpath}, nil 16545 } 16546 case "slack": 16547 if subpath, err := BuildNotificationChannelSpecSlack_FieldPath(fp[1:]); err != nil { 16548 return nil, err 16549 } else { 16550 return &NotificationChannelSpec_FieldSubPath{selector: NotificationChannelSpec_FieldPathSelectorSlack, subPath: subpath}, nil 16551 } 16552 case "webhook": 16553 if subpath, err := BuildNotificationChannelSpecWebhook_FieldPath(fp[1:]); err != nil { 16554 return nil, err 16555 } else { 16556 return &NotificationChannelSpec_FieldSubPath{selector: NotificationChannelSpec_FieldPathSelectorWebhook, subPath: subpath}, nil 16557 } 16558 } 16559 } 16560 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object NotificationChannelSpec", fp) 16561 } 16562 16563 func ParseNotificationChannelSpec_FieldPath(rawField string) (NotificationChannelSpec_FieldPath, error) { 16564 fp, err := gotenobject.ParseRawFieldPath(rawField) 16565 if err != nil { 16566 return nil, err 16567 } 16568 return BuildNotificationChannelSpec_FieldPath(fp) 16569 } 16570 16571 func MustParseNotificationChannelSpec_FieldPath(rawField string) NotificationChannelSpec_FieldPath { 16572 fp, err := ParseNotificationChannelSpec_FieldPath(rawField) 16573 if err != nil { 16574 panic(err) 16575 } 16576 return fp 16577 } 16578 16579 type NotificationChannelSpec_FieldTerminalPath struct { 16580 selector NotificationChannelSpec_FieldPathSelector 16581 } 16582 16583 var _ NotificationChannelSpec_FieldPath = (*NotificationChannelSpec_FieldTerminalPath)(nil) 16584 16585 func (fp *NotificationChannelSpec_FieldTerminalPath) Selector() NotificationChannelSpec_FieldPathSelector { 16586 return fp.selector 16587 } 16588 16589 // String returns path representation in proto convention 16590 func (fp *NotificationChannelSpec_FieldTerminalPath) String() string { 16591 return fp.selector.String() 16592 } 16593 16594 // JSONString returns path representation is JSON convention 16595 func (fp *NotificationChannelSpec_FieldTerminalPath) JSONString() string { 16596 return strcase.ToLowerCamel(fp.String()) 16597 } 16598 16599 // Get returns all values pointed by specific field from source NotificationChannelSpec 16600 func (fp *NotificationChannelSpec_FieldTerminalPath) Get(source *NotificationChannelSpec) (values []interface{}) { 16601 if source != nil { 16602 switch fp.selector { 16603 case NotificationChannelSpec_FieldPathSelectorEnabled: 16604 values = append(values, source.Enabled) 16605 case NotificationChannelSpec_FieldPathSelectorType: 16606 values = append(values, source.Type) 16607 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16608 for _, value := range source.GetEnabledKinds() { 16609 values = append(values, value) 16610 } 16611 case NotificationChannelSpec_FieldPathSelectorEmail: 16612 if source.Email != nil { 16613 values = append(values, source.Email) 16614 } 16615 case NotificationChannelSpec_FieldPathSelectorSlack: 16616 if source.Slack != nil { 16617 values = append(values, source.Slack) 16618 } 16619 case NotificationChannelSpec_FieldPathSelectorWebhook: 16620 if source.Webhook != nil { 16621 values = append(values, source.Webhook) 16622 } 16623 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 16624 values = append(values, source.NotificationLanguageCode) 16625 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 16626 if source.NotificationMask != nil { 16627 values = append(values, source.NotificationMask) 16628 } 16629 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 16630 values = append(values, source.MaxAlertBodiesInMsg) 16631 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 16632 values = append(values, source.PutOnlyAlertsCounterWhenOverflowing) 16633 default: 16634 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fp.selector)) 16635 } 16636 } 16637 return 16638 } 16639 16640 func (fp *NotificationChannelSpec_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 16641 return fp.Get(source.(*NotificationChannelSpec)) 16642 } 16643 16644 // GetSingle returns value pointed by specific field of from source NotificationChannelSpec 16645 func (fp *NotificationChannelSpec_FieldTerminalPath) GetSingle(source *NotificationChannelSpec) (interface{}, bool) { 16646 switch fp.selector { 16647 case NotificationChannelSpec_FieldPathSelectorEnabled: 16648 return source.GetEnabled(), source != nil 16649 case NotificationChannelSpec_FieldPathSelectorType: 16650 return source.GetType(), source != nil 16651 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16652 res := source.GetEnabledKinds() 16653 return res, res != nil 16654 case NotificationChannelSpec_FieldPathSelectorEmail: 16655 res := source.GetEmail() 16656 return res, res != nil 16657 case NotificationChannelSpec_FieldPathSelectorSlack: 16658 res := source.GetSlack() 16659 return res, res != nil 16660 case NotificationChannelSpec_FieldPathSelectorWebhook: 16661 res := source.GetWebhook() 16662 return res, res != nil 16663 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 16664 return source.GetNotificationLanguageCode(), source != nil 16665 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 16666 res := source.GetNotificationMask() 16667 return res, res != nil 16668 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 16669 return source.GetMaxAlertBodiesInMsg(), source != nil 16670 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 16671 return source.GetPutOnlyAlertsCounterWhenOverflowing(), source != nil 16672 default: 16673 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fp.selector)) 16674 } 16675 } 16676 16677 func (fp *NotificationChannelSpec_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 16678 return fp.GetSingle(source.(*NotificationChannelSpec)) 16679 } 16680 16681 // GetDefault returns a default value of the field type 16682 func (fp *NotificationChannelSpec_FieldTerminalPath) GetDefault() interface{} { 16683 switch fp.selector { 16684 case NotificationChannelSpec_FieldPathSelectorEnabled: 16685 return false 16686 case NotificationChannelSpec_FieldPathSelectorType: 16687 return NotificationChannelSpec_TYPE_UNSPECIFIED 16688 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16689 return ([]NotificationChannelSpec_EventKind)(nil) 16690 case NotificationChannelSpec_FieldPathSelectorEmail: 16691 return (*NotificationChannelSpec_Email)(nil) 16692 case NotificationChannelSpec_FieldPathSelectorSlack: 16693 return (*NotificationChannelSpec_Slack)(nil) 16694 case NotificationChannelSpec_FieldPathSelectorWebhook: 16695 return (*NotificationChannelSpec_Webhook)(nil) 16696 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 16697 return "" 16698 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 16699 return (*fieldmaskpb.FieldMask)(nil) 16700 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 16701 return int32(0) 16702 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 16703 return false 16704 default: 16705 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fp.selector)) 16706 } 16707 } 16708 16709 func (fp *NotificationChannelSpec_FieldTerminalPath) ClearValue(item *NotificationChannelSpec) { 16710 if item != nil { 16711 switch fp.selector { 16712 case NotificationChannelSpec_FieldPathSelectorEnabled: 16713 item.Enabled = false 16714 case NotificationChannelSpec_FieldPathSelectorType: 16715 item.Type = NotificationChannelSpec_TYPE_UNSPECIFIED 16716 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16717 item.EnabledKinds = nil 16718 case NotificationChannelSpec_FieldPathSelectorEmail: 16719 item.Email = nil 16720 case NotificationChannelSpec_FieldPathSelectorSlack: 16721 item.Slack = nil 16722 case NotificationChannelSpec_FieldPathSelectorWebhook: 16723 item.Webhook = nil 16724 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 16725 item.NotificationLanguageCode = "" 16726 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 16727 item.NotificationMask = nil 16728 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 16729 item.MaxAlertBodiesInMsg = int32(0) 16730 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 16731 item.PutOnlyAlertsCounterWhenOverflowing = false 16732 default: 16733 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fp.selector)) 16734 } 16735 } 16736 } 16737 16738 func (fp *NotificationChannelSpec_FieldTerminalPath) ClearValueRaw(item proto.Message) { 16739 fp.ClearValue(item.(*NotificationChannelSpec)) 16740 } 16741 16742 // IsLeaf - whether field path is holds simple value 16743 func (fp *NotificationChannelSpec_FieldTerminalPath) IsLeaf() bool { 16744 return fp.selector == NotificationChannelSpec_FieldPathSelectorEnabled || 16745 fp.selector == NotificationChannelSpec_FieldPathSelectorType || 16746 fp.selector == NotificationChannelSpec_FieldPathSelectorEnabledKinds || 16747 fp.selector == NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode || 16748 fp.selector == NotificationChannelSpec_FieldPathSelectorNotificationMask || 16749 fp.selector == NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg || 16750 fp.selector == NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing 16751 } 16752 16753 func (fp *NotificationChannelSpec_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 16754 return []gotenobject.FieldPath{fp} 16755 } 16756 16757 func (fp *NotificationChannelSpec_FieldTerminalPath) WithIValue(value interface{}) NotificationChannelSpec_FieldPathValue { 16758 switch fp.selector { 16759 case NotificationChannelSpec_FieldPathSelectorEnabled: 16760 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(bool)} 16761 case NotificationChannelSpec_FieldPathSelectorType: 16762 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(NotificationChannelSpec_Type)} 16763 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16764 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.([]NotificationChannelSpec_EventKind)} 16765 case NotificationChannelSpec_FieldPathSelectorEmail: 16766 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(*NotificationChannelSpec_Email)} 16767 case NotificationChannelSpec_FieldPathSelectorSlack: 16768 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(*NotificationChannelSpec_Slack)} 16769 case NotificationChannelSpec_FieldPathSelectorWebhook: 16770 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(*NotificationChannelSpec_Webhook)} 16771 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 16772 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(string)} 16773 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 16774 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(*fieldmaskpb.FieldMask)} 16775 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 16776 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(int32)} 16777 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 16778 return &NotificationChannelSpec_FieldTerminalPathValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(bool)} 16779 default: 16780 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fp.selector)) 16781 } 16782 } 16783 16784 func (fp *NotificationChannelSpec_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 16785 return fp.WithIValue(value) 16786 } 16787 16788 func (fp *NotificationChannelSpec_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationChannelSpec_FieldPathArrayOfValues { 16789 fpaov := &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp} 16790 switch fp.selector { 16791 case NotificationChannelSpec_FieldPathSelectorEnabled: 16792 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]bool)} 16793 case NotificationChannelSpec_FieldPathSelectorType: 16794 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]NotificationChannelSpec_Type)} 16795 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16796 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([][]NotificationChannelSpec_EventKind)} 16797 case NotificationChannelSpec_FieldPathSelectorEmail: 16798 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]*NotificationChannelSpec_Email)} 16799 case NotificationChannelSpec_FieldPathSelectorSlack: 16800 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]*NotificationChannelSpec_Slack)} 16801 case NotificationChannelSpec_FieldPathSelectorWebhook: 16802 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]*NotificationChannelSpec_Webhook)} 16803 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 16804 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]string)} 16805 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 16806 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]*fieldmaskpb.FieldMask)} 16807 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 16808 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]int32)} 16809 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 16810 return &NotificationChannelSpec_FieldTerminalPathArrayOfValues{NotificationChannelSpec_FieldTerminalPath: *fp, values: values.([]bool)} 16811 default: 16812 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fp.selector)) 16813 } 16814 return fpaov 16815 } 16816 16817 func (fp *NotificationChannelSpec_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 16818 return fp.WithIArrayOfValues(values) 16819 } 16820 16821 func (fp *NotificationChannelSpec_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationChannelSpec_FieldPathArrayItemValue { 16822 switch fp.selector { 16823 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 16824 return &NotificationChannelSpec_FieldTerminalPathArrayItemValue{NotificationChannelSpec_FieldTerminalPath: *fp, value: value.(NotificationChannelSpec_EventKind)} 16825 default: 16826 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fp.selector)) 16827 } 16828 } 16829 16830 func (fp *NotificationChannelSpec_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 16831 return fp.WithIArrayItemValue(value) 16832 } 16833 16834 type NotificationChannelSpec_FieldSubPath struct { 16835 selector NotificationChannelSpec_FieldPathSelector 16836 subPath gotenobject.FieldPath 16837 } 16838 16839 var _ NotificationChannelSpec_FieldPath = (*NotificationChannelSpec_FieldSubPath)(nil) 16840 16841 func (fps *NotificationChannelSpec_FieldSubPath) Selector() NotificationChannelSpec_FieldPathSelector { 16842 return fps.selector 16843 } 16844 func (fps *NotificationChannelSpec_FieldSubPath) AsEmailSubPath() (NotificationChannelSpecEmail_FieldPath, bool) { 16845 res, ok := fps.subPath.(NotificationChannelSpecEmail_FieldPath) 16846 return res, ok 16847 } 16848 func (fps *NotificationChannelSpec_FieldSubPath) AsSlackSubPath() (NotificationChannelSpecSlack_FieldPath, bool) { 16849 res, ok := fps.subPath.(NotificationChannelSpecSlack_FieldPath) 16850 return res, ok 16851 } 16852 func (fps *NotificationChannelSpec_FieldSubPath) AsWebhookSubPath() (NotificationChannelSpecWebhook_FieldPath, bool) { 16853 res, ok := fps.subPath.(NotificationChannelSpecWebhook_FieldPath) 16854 return res, ok 16855 } 16856 16857 // String returns path representation in proto convention 16858 func (fps *NotificationChannelSpec_FieldSubPath) String() string { 16859 return fps.selector.String() + "." + fps.subPath.String() 16860 } 16861 16862 // JSONString returns path representation is JSON convention 16863 func (fps *NotificationChannelSpec_FieldSubPath) JSONString() string { 16864 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 16865 } 16866 16867 // Get returns all values pointed by selected field from source NotificationChannelSpec 16868 func (fps *NotificationChannelSpec_FieldSubPath) Get(source *NotificationChannelSpec) (values []interface{}) { 16869 switch fps.selector { 16870 case NotificationChannelSpec_FieldPathSelectorEmail: 16871 values = append(values, fps.subPath.GetRaw(source.GetEmail())...) 16872 case NotificationChannelSpec_FieldPathSelectorSlack: 16873 values = append(values, fps.subPath.GetRaw(source.GetSlack())...) 16874 case NotificationChannelSpec_FieldPathSelectorWebhook: 16875 values = append(values, fps.subPath.GetRaw(source.GetWebhook())...) 16876 default: 16877 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fps.selector)) 16878 } 16879 return 16880 } 16881 16882 func (fps *NotificationChannelSpec_FieldSubPath) GetRaw(source proto.Message) []interface{} { 16883 return fps.Get(source.(*NotificationChannelSpec)) 16884 } 16885 16886 // GetSingle returns value of selected field from source NotificationChannelSpec 16887 func (fps *NotificationChannelSpec_FieldSubPath) GetSingle(source *NotificationChannelSpec) (interface{}, bool) { 16888 switch fps.selector { 16889 case NotificationChannelSpec_FieldPathSelectorEmail: 16890 if source.GetEmail() == nil { 16891 return nil, false 16892 } 16893 return fps.subPath.GetSingleRaw(source.GetEmail()) 16894 case NotificationChannelSpec_FieldPathSelectorSlack: 16895 if source.GetSlack() == nil { 16896 return nil, false 16897 } 16898 return fps.subPath.GetSingleRaw(source.GetSlack()) 16899 case NotificationChannelSpec_FieldPathSelectorWebhook: 16900 if source.GetWebhook() == nil { 16901 return nil, false 16902 } 16903 return fps.subPath.GetSingleRaw(source.GetWebhook()) 16904 default: 16905 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fps.selector)) 16906 } 16907 } 16908 16909 func (fps *NotificationChannelSpec_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 16910 return fps.GetSingle(source.(*NotificationChannelSpec)) 16911 } 16912 16913 // GetDefault returns a default value of the field type 16914 func (fps *NotificationChannelSpec_FieldSubPath) GetDefault() interface{} { 16915 return fps.subPath.GetDefault() 16916 } 16917 16918 func (fps *NotificationChannelSpec_FieldSubPath) ClearValue(item *NotificationChannelSpec) { 16919 if item != nil { 16920 switch fps.selector { 16921 case NotificationChannelSpec_FieldPathSelectorEmail: 16922 fps.subPath.ClearValueRaw(item.Email) 16923 case NotificationChannelSpec_FieldPathSelectorSlack: 16924 fps.subPath.ClearValueRaw(item.Slack) 16925 case NotificationChannelSpec_FieldPathSelectorWebhook: 16926 fps.subPath.ClearValueRaw(item.Webhook) 16927 default: 16928 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fps.selector)) 16929 } 16930 } 16931 } 16932 16933 func (fps *NotificationChannelSpec_FieldSubPath) ClearValueRaw(item proto.Message) { 16934 fps.ClearValue(item.(*NotificationChannelSpec)) 16935 } 16936 16937 // IsLeaf - whether field path is holds simple value 16938 func (fps *NotificationChannelSpec_FieldSubPath) IsLeaf() bool { 16939 return fps.subPath.IsLeaf() 16940 } 16941 16942 func (fps *NotificationChannelSpec_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 16943 iPaths := []gotenobject.FieldPath{&NotificationChannelSpec_FieldTerminalPath{selector: fps.selector}} 16944 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 16945 return iPaths 16946 } 16947 16948 func (fps *NotificationChannelSpec_FieldSubPath) WithIValue(value interface{}) NotificationChannelSpec_FieldPathValue { 16949 return &NotificationChannelSpec_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 16950 } 16951 16952 func (fps *NotificationChannelSpec_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 16953 return fps.WithIValue(value) 16954 } 16955 16956 func (fps *NotificationChannelSpec_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationChannelSpec_FieldPathArrayOfValues { 16957 return &NotificationChannelSpec_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 16958 } 16959 16960 func (fps *NotificationChannelSpec_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 16961 return fps.WithIArrayOfValues(values) 16962 } 16963 16964 func (fps *NotificationChannelSpec_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationChannelSpec_FieldPathArrayItemValue { 16965 return &NotificationChannelSpec_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 16966 } 16967 16968 func (fps *NotificationChannelSpec_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 16969 return fps.WithIArrayItemValue(value) 16970 } 16971 16972 // NotificationChannelSpec_FieldPathValue allows storing values for NotificationChannelSpec fields according to their type 16973 type NotificationChannelSpec_FieldPathValue interface { 16974 NotificationChannelSpec_FieldPath 16975 gotenobject.FieldPathValue 16976 SetTo(target **NotificationChannelSpec) 16977 CompareWith(*NotificationChannelSpec) (cmp int, comparable bool) 16978 } 16979 16980 func ParseNotificationChannelSpec_FieldPathValue(pathStr, valueStr string) (NotificationChannelSpec_FieldPathValue, error) { 16981 fp, err := ParseNotificationChannelSpec_FieldPath(pathStr) 16982 if err != nil { 16983 return nil, err 16984 } 16985 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 16986 if err != nil { 16987 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationChannelSpec field path value from %s: %v", valueStr, err) 16988 } 16989 return fpv.(NotificationChannelSpec_FieldPathValue), nil 16990 } 16991 16992 func MustParseNotificationChannelSpec_FieldPathValue(pathStr, valueStr string) NotificationChannelSpec_FieldPathValue { 16993 fpv, err := ParseNotificationChannelSpec_FieldPathValue(pathStr, valueStr) 16994 if err != nil { 16995 panic(err) 16996 } 16997 return fpv 16998 } 16999 17000 type NotificationChannelSpec_FieldTerminalPathValue struct { 17001 NotificationChannelSpec_FieldTerminalPath 17002 value interface{} 17003 } 17004 17005 var _ NotificationChannelSpec_FieldPathValue = (*NotificationChannelSpec_FieldTerminalPathValue)(nil) 17006 17007 // GetRawValue returns raw value stored under selected path for 'NotificationChannelSpec' as interface{} 17008 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) GetRawValue() interface{} { 17009 return fpv.value 17010 } 17011 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsEnabledValue() (bool, bool) { 17012 res, ok := fpv.value.(bool) 17013 return res, ok 17014 } 17015 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsTypeValue() (NotificationChannelSpec_Type, bool) { 17016 res, ok := fpv.value.(NotificationChannelSpec_Type) 17017 return res, ok 17018 } 17019 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsEnabledKindsValue() ([]NotificationChannelSpec_EventKind, bool) { 17020 res, ok := fpv.value.([]NotificationChannelSpec_EventKind) 17021 return res, ok 17022 } 17023 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsEmailValue() (*NotificationChannelSpec_Email, bool) { 17024 res, ok := fpv.value.(*NotificationChannelSpec_Email) 17025 return res, ok 17026 } 17027 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsSlackValue() (*NotificationChannelSpec_Slack, bool) { 17028 res, ok := fpv.value.(*NotificationChannelSpec_Slack) 17029 return res, ok 17030 } 17031 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsWebhookValue() (*NotificationChannelSpec_Webhook, bool) { 17032 res, ok := fpv.value.(*NotificationChannelSpec_Webhook) 17033 return res, ok 17034 } 17035 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsNotificationLanguageCodeValue() (string, bool) { 17036 res, ok := fpv.value.(string) 17037 return res, ok 17038 } 17039 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsNotificationMaskValue() (*fieldmaskpb.FieldMask, bool) { 17040 res, ok := fpv.value.(*fieldmaskpb.FieldMask) 17041 return res, ok 17042 } 17043 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsMaxAlertBodiesInMsgValue() (int32, bool) { 17044 res, ok := fpv.value.(int32) 17045 return res, ok 17046 } 17047 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) AsPutOnlyAlertsCounterWhenOverflowingValue() (bool, bool) { 17048 res, ok := fpv.value.(bool) 17049 return res, ok 17050 } 17051 17052 // SetTo stores value for selected field for object NotificationChannelSpec 17053 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) SetTo(target **NotificationChannelSpec) { 17054 if *target == nil { 17055 *target = new(NotificationChannelSpec) 17056 } 17057 switch fpv.selector { 17058 case NotificationChannelSpec_FieldPathSelectorEnabled: 17059 (*target).Enabled = fpv.value.(bool) 17060 case NotificationChannelSpec_FieldPathSelectorType: 17061 (*target).Type = fpv.value.(NotificationChannelSpec_Type) 17062 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 17063 (*target).EnabledKinds = fpv.value.([]NotificationChannelSpec_EventKind) 17064 case NotificationChannelSpec_FieldPathSelectorEmail: 17065 (*target).Email = fpv.value.(*NotificationChannelSpec_Email) 17066 case NotificationChannelSpec_FieldPathSelectorSlack: 17067 (*target).Slack = fpv.value.(*NotificationChannelSpec_Slack) 17068 case NotificationChannelSpec_FieldPathSelectorWebhook: 17069 (*target).Webhook = fpv.value.(*NotificationChannelSpec_Webhook) 17070 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 17071 (*target).NotificationLanguageCode = fpv.value.(string) 17072 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 17073 (*target).NotificationMask = fpv.value.(*fieldmaskpb.FieldMask) 17074 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 17075 (*target).MaxAlertBodiesInMsg = fpv.value.(int32) 17076 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 17077 (*target).PutOnlyAlertsCounterWhenOverflowing = fpv.value.(bool) 17078 default: 17079 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fpv.selector)) 17080 } 17081 } 17082 17083 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) SetToRaw(target proto.Message) { 17084 typedObject := target.(*NotificationChannelSpec) 17085 fpv.SetTo(&typedObject) 17086 } 17087 17088 // CompareWith compares value in the 'NotificationChannelSpec_FieldTerminalPathValue' with the value under path in 'NotificationChannelSpec'. 17089 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) CompareWith(source *NotificationChannelSpec) (int, bool) { 17090 switch fpv.selector { 17091 case NotificationChannelSpec_FieldPathSelectorEnabled: 17092 leftValue := fpv.value.(bool) 17093 rightValue := source.GetEnabled() 17094 if (leftValue) == (rightValue) { 17095 return 0, true 17096 } else if !(leftValue) && (rightValue) { 17097 return -1, true 17098 } else { 17099 return 1, true 17100 } 17101 case NotificationChannelSpec_FieldPathSelectorType: 17102 leftValue := fpv.value.(NotificationChannelSpec_Type) 17103 rightValue := source.GetType() 17104 if (leftValue) == (rightValue) { 17105 return 0, true 17106 } else if (leftValue) < (rightValue) { 17107 return -1, true 17108 } else { 17109 return 1, true 17110 } 17111 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 17112 return 0, false 17113 case NotificationChannelSpec_FieldPathSelectorEmail: 17114 return 0, false 17115 case NotificationChannelSpec_FieldPathSelectorSlack: 17116 return 0, false 17117 case NotificationChannelSpec_FieldPathSelectorWebhook: 17118 return 0, false 17119 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 17120 leftValue := fpv.value.(string) 17121 rightValue := source.GetNotificationLanguageCode() 17122 if (leftValue) == (rightValue) { 17123 return 0, true 17124 } else if (leftValue) < (rightValue) { 17125 return -1, true 17126 } else { 17127 return 1, true 17128 } 17129 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 17130 return 0, false 17131 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 17132 leftValue := fpv.value.(int32) 17133 rightValue := source.GetMaxAlertBodiesInMsg() 17134 if (leftValue) == (rightValue) { 17135 return 0, true 17136 } else if (leftValue) < (rightValue) { 17137 return -1, true 17138 } else { 17139 return 1, true 17140 } 17141 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 17142 leftValue := fpv.value.(bool) 17143 rightValue := source.GetPutOnlyAlertsCounterWhenOverflowing() 17144 if (leftValue) == (rightValue) { 17145 return 0, true 17146 } else if !(leftValue) && (rightValue) { 17147 return -1, true 17148 } else { 17149 return 1, true 17150 } 17151 default: 17152 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fpv.selector)) 17153 } 17154 } 17155 17156 func (fpv *NotificationChannelSpec_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 17157 return fpv.CompareWith(source.(*NotificationChannelSpec)) 17158 } 17159 17160 type NotificationChannelSpec_FieldSubPathValue struct { 17161 NotificationChannelSpec_FieldPath 17162 subPathValue gotenobject.FieldPathValue 17163 } 17164 17165 var _ NotificationChannelSpec_FieldPathValue = (*NotificationChannelSpec_FieldSubPathValue)(nil) 17166 17167 func (fpvs *NotificationChannelSpec_FieldSubPathValue) AsEmailPathValue() (NotificationChannelSpecEmail_FieldPathValue, bool) { 17168 res, ok := fpvs.subPathValue.(NotificationChannelSpecEmail_FieldPathValue) 17169 return res, ok 17170 } 17171 func (fpvs *NotificationChannelSpec_FieldSubPathValue) AsSlackPathValue() (NotificationChannelSpecSlack_FieldPathValue, bool) { 17172 res, ok := fpvs.subPathValue.(NotificationChannelSpecSlack_FieldPathValue) 17173 return res, ok 17174 } 17175 func (fpvs *NotificationChannelSpec_FieldSubPathValue) AsWebhookPathValue() (NotificationChannelSpecWebhook_FieldPathValue, bool) { 17176 res, ok := fpvs.subPathValue.(NotificationChannelSpecWebhook_FieldPathValue) 17177 return res, ok 17178 } 17179 17180 func (fpvs *NotificationChannelSpec_FieldSubPathValue) SetTo(target **NotificationChannelSpec) { 17181 if *target == nil { 17182 *target = new(NotificationChannelSpec) 17183 } 17184 switch fpvs.Selector() { 17185 case NotificationChannelSpec_FieldPathSelectorEmail: 17186 fpvs.subPathValue.(NotificationChannelSpecEmail_FieldPathValue).SetTo(&(*target).Email) 17187 case NotificationChannelSpec_FieldPathSelectorSlack: 17188 fpvs.subPathValue.(NotificationChannelSpecSlack_FieldPathValue).SetTo(&(*target).Slack) 17189 case NotificationChannelSpec_FieldPathSelectorWebhook: 17190 fpvs.subPathValue.(NotificationChannelSpecWebhook_FieldPathValue).SetTo(&(*target).Webhook) 17191 default: 17192 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fpvs.Selector())) 17193 } 17194 } 17195 17196 func (fpvs *NotificationChannelSpec_FieldSubPathValue) SetToRaw(target proto.Message) { 17197 typedObject := target.(*NotificationChannelSpec) 17198 fpvs.SetTo(&typedObject) 17199 } 17200 17201 func (fpvs *NotificationChannelSpec_FieldSubPathValue) GetRawValue() interface{} { 17202 return fpvs.subPathValue.GetRawValue() 17203 } 17204 17205 func (fpvs *NotificationChannelSpec_FieldSubPathValue) CompareWith(source *NotificationChannelSpec) (int, bool) { 17206 switch fpvs.Selector() { 17207 case NotificationChannelSpec_FieldPathSelectorEmail: 17208 return fpvs.subPathValue.(NotificationChannelSpecEmail_FieldPathValue).CompareWith(source.GetEmail()) 17209 case NotificationChannelSpec_FieldPathSelectorSlack: 17210 return fpvs.subPathValue.(NotificationChannelSpecSlack_FieldPathValue).CompareWith(source.GetSlack()) 17211 case NotificationChannelSpec_FieldPathSelectorWebhook: 17212 return fpvs.subPathValue.(NotificationChannelSpecWebhook_FieldPathValue).CompareWith(source.GetWebhook()) 17213 default: 17214 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fpvs.Selector())) 17215 } 17216 } 17217 17218 func (fpvs *NotificationChannelSpec_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 17219 return fpvs.CompareWith(source.(*NotificationChannelSpec)) 17220 } 17221 17222 // NotificationChannelSpec_FieldPathArrayItemValue allows storing single item in Path-specific values for NotificationChannelSpec according to their type 17223 // Present only for array (repeated) types. 17224 type NotificationChannelSpec_FieldPathArrayItemValue interface { 17225 gotenobject.FieldPathArrayItemValue 17226 NotificationChannelSpec_FieldPath 17227 ContainsValue(*NotificationChannelSpec) bool 17228 } 17229 17230 // ParseNotificationChannelSpec_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 17231 func ParseNotificationChannelSpec_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationChannelSpec_FieldPathArrayItemValue, error) { 17232 fp, err := ParseNotificationChannelSpec_FieldPath(pathStr) 17233 if err != nil { 17234 return nil, err 17235 } 17236 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 17237 if err != nil { 17238 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationChannelSpec field path array item value from %s: %v", valueStr, err) 17239 } 17240 return fpaiv.(NotificationChannelSpec_FieldPathArrayItemValue), nil 17241 } 17242 17243 func MustParseNotificationChannelSpec_FieldPathArrayItemValue(pathStr, valueStr string) NotificationChannelSpec_FieldPathArrayItemValue { 17244 fpaiv, err := ParseNotificationChannelSpec_FieldPathArrayItemValue(pathStr, valueStr) 17245 if err != nil { 17246 panic(err) 17247 } 17248 return fpaiv 17249 } 17250 17251 type NotificationChannelSpec_FieldTerminalPathArrayItemValue struct { 17252 NotificationChannelSpec_FieldTerminalPath 17253 value interface{} 17254 } 17255 17256 var _ NotificationChannelSpec_FieldPathArrayItemValue = (*NotificationChannelSpec_FieldTerminalPathArrayItemValue)(nil) 17257 17258 // GetRawValue returns stored element value for array in object NotificationChannelSpec as interface{} 17259 func (fpaiv *NotificationChannelSpec_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 17260 return fpaiv.value 17261 } 17262 func (fpaiv *NotificationChannelSpec_FieldTerminalPathArrayItemValue) AsEnabledKindsItemValue() (NotificationChannelSpec_EventKind, bool) { 17263 res, ok := fpaiv.value.(NotificationChannelSpec_EventKind) 17264 return res, ok 17265 } 17266 17267 func (fpaiv *NotificationChannelSpec_FieldTerminalPathArrayItemValue) GetSingle(source *NotificationChannelSpec) (interface{}, bool) { 17268 return nil, false 17269 } 17270 17271 func (fpaiv *NotificationChannelSpec_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 17272 return fpaiv.GetSingle(source.(*NotificationChannelSpec)) 17273 } 17274 17275 // Contains returns a boolean indicating if value that is being held is present in given 'NotificationChannelSpec' 17276 func (fpaiv *NotificationChannelSpec_FieldTerminalPathArrayItemValue) ContainsValue(source *NotificationChannelSpec) bool { 17277 slice := fpaiv.NotificationChannelSpec_FieldTerminalPath.Get(source) 17278 for _, v := range slice { 17279 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 17280 if proto.Equal(asProtoMsg, v.(proto.Message)) { 17281 return true 17282 } 17283 } else if reflect.DeepEqual(v, fpaiv.value) { 17284 return true 17285 } 17286 } 17287 return false 17288 } 17289 17290 type NotificationChannelSpec_FieldSubPathArrayItemValue struct { 17291 NotificationChannelSpec_FieldPath 17292 subPathItemValue gotenobject.FieldPathArrayItemValue 17293 } 17294 17295 // GetRawValue returns stored array item value 17296 func (fpaivs *NotificationChannelSpec_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 17297 return fpaivs.subPathItemValue.GetRawItemValue() 17298 } 17299 func (fpaivs *NotificationChannelSpec_FieldSubPathArrayItemValue) AsEmailPathItemValue() (NotificationChannelSpecEmail_FieldPathArrayItemValue, bool) { 17300 res, ok := fpaivs.subPathItemValue.(NotificationChannelSpecEmail_FieldPathArrayItemValue) 17301 return res, ok 17302 } 17303 func (fpaivs *NotificationChannelSpec_FieldSubPathArrayItemValue) AsSlackPathItemValue() (NotificationChannelSpecSlack_FieldPathArrayItemValue, bool) { 17304 res, ok := fpaivs.subPathItemValue.(NotificationChannelSpecSlack_FieldPathArrayItemValue) 17305 return res, ok 17306 } 17307 func (fpaivs *NotificationChannelSpec_FieldSubPathArrayItemValue) AsWebhookPathItemValue() (NotificationChannelSpecWebhook_FieldPathArrayItemValue, bool) { 17308 res, ok := fpaivs.subPathItemValue.(NotificationChannelSpecWebhook_FieldPathArrayItemValue) 17309 return res, ok 17310 } 17311 17312 // Contains returns a boolean indicating if value that is being held is present in given 'NotificationChannelSpec' 17313 func (fpaivs *NotificationChannelSpec_FieldSubPathArrayItemValue) ContainsValue(source *NotificationChannelSpec) bool { 17314 switch fpaivs.Selector() { 17315 case NotificationChannelSpec_FieldPathSelectorEmail: 17316 return fpaivs.subPathItemValue.(NotificationChannelSpecEmail_FieldPathArrayItemValue).ContainsValue(source.GetEmail()) 17317 case NotificationChannelSpec_FieldPathSelectorSlack: 17318 return fpaivs.subPathItemValue.(NotificationChannelSpecSlack_FieldPathArrayItemValue).ContainsValue(source.GetSlack()) 17319 case NotificationChannelSpec_FieldPathSelectorWebhook: 17320 return fpaivs.subPathItemValue.(NotificationChannelSpecWebhook_FieldPathArrayItemValue).ContainsValue(source.GetWebhook()) 17321 default: 17322 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec: %d", fpaivs.Selector())) 17323 } 17324 } 17325 17326 // NotificationChannelSpec_FieldPathArrayOfValues allows storing slice of values for NotificationChannelSpec fields according to their type 17327 type NotificationChannelSpec_FieldPathArrayOfValues interface { 17328 gotenobject.FieldPathArrayOfValues 17329 NotificationChannelSpec_FieldPath 17330 } 17331 17332 func ParseNotificationChannelSpec_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationChannelSpec_FieldPathArrayOfValues, error) { 17333 fp, err := ParseNotificationChannelSpec_FieldPath(pathStr) 17334 if err != nil { 17335 return nil, err 17336 } 17337 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 17338 if err != nil { 17339 return nil, status.Errorf(codes.InvalidArgument, "error parsing NotificationChannelSpec field path array of values from %s: %v", valuesStr, err) 17340 } 17341 return fpaov.(NotificationChannelSpec_FieldPathArrayOfValues), nil 17342 } 17343 17344 func MustParseNotificationChannelSpec_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationChannelSpec_FieldPathArrayOfValues { 17345 fpaov, err := ParseNotificationChannelSpec_FieldPathArrayOfValues(pathStr, valuesStr) 17346 if err != nil { 17347 panic(err) 17348 } 17349 return fpaov 17350 } 17351 17352 type NotificationChannelSpec_FieldTerminalPathArrayOfValues struct { 17353 NotificationChannelSpec_FieldTerminalPath 17354 values interface{} 17355 } 17356 17357 var _ NotificationChannelSpec_FieldPathArrayOfValues = (*NotificationChannelSpec_FieldTerminalPathArrayOfValues)(nil) 17358 17359 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 17360 switch fpaov.selector { 17361 case NotificationChannelSpec_FieldPathSelectorEnabled: 17362 for _, v := range fpaov.values.([]bool) { 17363 values = append(values, v) 17364 } 17365 case NotificationChannelSpec_FieldPathSelectorType: 17366 for _, v := range fpaov.values.([]NotificationChannelSpec_Type) { 17367 values = append(values, v) 17368 } 17369 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 17370 for _, v := range fpaov.values.([][]NotificationChannelSpec_EventKind) { 17371 values = append(values, v) 17372 } 17373 case NotificationChannelSpec_FieldPathSelectorEmail: 17374 for _, v := range fpaov.values.([]*NotificationChannelSpec_Email) { 17375 values = append(values, v) 17376 } 17377 case NotificationChannelSpec_FieldPathSelectorSlack: 17378 for _, v := range fpaov.values.([]*NotificationChannelSpec_Slack) { 17379 values = append(values, v) 17380 } 17381 case NotificationChannelSpec_FieldPathSelectorWebhook: 17382 for _, v := range fpaov.values.([]*NotificationChannelSpec_Webhook) { 17383 values = append(values, v) 17384 } 17385 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 17386 for _, v := range fpaov.values.([]string) { 17387 values = append(values, v) 17388 } 17389 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 17390 for _, v := range fpaov.values.([]*fieldmaskpb.FieldMask) { 17391 values = append(values, v) 17392 } 17393 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 17394 for _, v := range fpaov.values.([]int32) { 17395 values = append(values, v) 17396 } 17397 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 17398 for _, v := range fpaov.values.([]bool) { 17399 values = append(values, v) 17400 } 17401 } 17402 return 17403 } 17404 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsEnabledArrayOfValues() ([]bool, bool) { 17405 res, ok := fpaov.values.([]bool) 17406 return res, ok 17407 } 17408 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsTypeArrayOfValues() ([]NotificationChannelSpec_Type, bool) { 17409 res, ok := fpaov.values.([]NotificationChannelSpec_Type) 17410 return res, ok 17411 } 17412 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsEnabledKindsArrayOfValues() ([][]NotificationChannelSpec_EventKind, bool) { 17413 res, ok := fpaov.values.([][]NotificationChannelSpec_EventKind) 17414 return res, ok 17415 } 17416 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsEmailArrayOfValues() ([]*NotificationChannelSpec_Email, bool) { 17417 res, ok := fpaov.values.([]*NotificationChannelSpec_Email) 17418 return res, ok 17419 } 17420 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsSlackArrayOfValues() ([]*NotificationChannelSpec_Slack, bool) { 17421 res, ok := fpaov.values.([]*NotificationChannelSpec_Slack) 17422 return res, ok 17423 } 17424 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsWebhookArrayOfValues() ([]*NotificationChannelSpec_Webhook, bool) { 17425 res, ok := fpaov.values.([]*NotificationChannelSpec_Webhook) 17426 return res, ok 17427 } 17428 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsNotificationLanguageCodeArrayOfValues() ([]string, bool) { 17429 res, ok := fpaov.values.([]string) 17430 return res, ok 17431 } 17432 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsNotificationMaskArrayOfValues() ([]*fieldmaskpb.FieldMask, bool) { 17433 res, ok := fpaov.values.([]*fieldmaskpb.FieldMask) 17434 return res, ok 17435 } 17436 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsMaxAlertBodiesInMsgArrayOfValues() ([]int32, bool) { 17437 res, ok := fpaov.values.([]int32) 17438 return res, ok 17439 } 17440 func (fpaov *NotificationChannelSpec_FieldTerminalPathArrayOfValues) AsPutOnlyAlertsCounterWhenOverflowingArrayOfValues() ([]bool, bool) { 17441 res, ok := fpaov.values.([]bool) 17442 return res, ok 17443 } 17444 17445 type NotificationChannelSpec_FieldSubPathArrayOfValues struct { 17446 NotificationChannelSpec_FieldPath 17447 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 17448 } 17449 17450 var _ NotificationChannelSpec_FieldPathArrayOfValues = (*NotificationChannelSpec_FieldSubPathArrayOfValues)(nil) 17451 17452 func (fpsaov *NotificationChannelSpec_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 17453 return fpsaov.subPathArrayOfValues.GetRawValues() 17454 } 17455 func (fpsaov *NotificationChannelSpec_FieldSubPathArrayOfValues) AsEmailPathArrayOfValues() (NotificationChannelSpecEmail_FieldPathArrayOfValues, bool) { 17456 res, ok := fpsaov.subPathArrayOfValues.(NotificationChannelSpecEmail_FieldPathArrayOfValues) 17457 return res, ok 17458 } 17459 func (fpsaov *NotificationChannelSpec_FieldSubPathArrayOfValues) AsSlackPathArrayOfValues() (NotificationChannelSpecSlack_FieldPathArrayOfValues, bool) { 17460 res, ok := fpsaov.subPathArrayOfValues.(NotificationChannelSpecSlack_FieldPathArrayOfValues) 17461 return res, ok 17462 } 17463 func (fpsaov *NotificationChannelSpec_FieldSubPathArrayOfValues) AsWebhookPathArrayOfValues() (NotificationChannelSpecWebhook_FieldPathArrayOfValues, bool) { 17464 res, ok := fpsaov.subPathArrayOfValues.(NotificationChannelSpecWebhook_FieldPathArrayOfValues) 17465 return res, ok 17466 } 17467 17468 // FieldPath provides implementation to handle 17469 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 17470 type NotificationChannelSpecEmail_FieldPath interface { 17471 gotenobject.FieldPath 17472 Selector() NotificationChannelSpecEmail_FieldPathSelector 17473 Get(source *NotificationChannelSpec_Email) []interface{} 17474 GetSingle(source *NotificationChannelSpec_Email) (interface{}, bool) 17475 ClearValue(item *NotificationChannelSpec_Email) 17476 17477 // Those methods build corresponding NotificationChannelSpecEmail_FieldPathValue 17478 // (or array of values) and holds passed value. Panics if injected type is incorrect. 17479 WithIValue(value interface{}) NotificationChannelSpecEmail_FieldPathValue 17480 WithIArrayOfValues(values interface{}) NotificationChannelSpecEmail_FieldPathArrayOfValues 17481 WithIArrayItemValue(value interface{}) NotificationChannelSpecEmail_FieldPathArrayItemValue 17482 } 17483 17484 type NotificationChannelSpecEmail_FieldPathSelector int32 17485 17486 const ( 17487 NotificationChannelSpecEmail_FieldPathSelectorAddresses NotificationChannelSpecEmail_FieldPathSelector = 0 17488 ) 17489 17490 func (s NotificationChannelSpecEmail_FieldPathSelector) String() string { 17491 switch s { 17492 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17493 return "addresses" 17494 default: 17495 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", s)) 17496 } 17497 } 17498 17499 func BuildNotificationChannelSpecEmail_FieldPath(fp gotenobject.RawFieldPath) (NotificationChannelSpecEmail_FieldPath, error) { 17500 if len(fp) == 0 { 17501 return nil, status.Error(codes.InvalidArgument, "empty field path for object NotificationChannelSpec_Email") 17502 } 17503 if len(fp) == 1 { 17504 switch fp[0] { 17505 case "addresses": 17506 return &NotificationChannelSpecEmail_FieldTerminalPath{selector: NotificationChannelSpecEmail_FieldPathSelectorAddresses}, nil 17507 } 17508 } 17509 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object NotificationChannelSpec_Email", fp) 17510 } 17511 17512 func ParseNotificationChannelSpecEmail_FieldPath(rawField string) (NotificationChannelSpecEmail_FieldPath, error) { 17513 fp, err := gotenobject.ParseRawFieldPath(rawField) 17514 if err != nil { 17515 return nil, err 17516 } 17517 return BuildNotificationChannelSpecEmail_FieldPath(fp) 17518 } 17519 17520 func MustParseNotificationChannelSpecEmail_FieldPath(rawField string) NotificationChannelSpecEmail_FieldPath { 17521 fp, err := ParseNotificationChannelSpecEmail_FieldPath(rawField) 17522 if err != nil { 17523 panic(err) 17524 } 17525 return fp 17526 } 17527 17528 type NotificationChannelSpecEmail_FieldTerminalPath struct { 17529 selector NotificationChannelSpecEmail_FieldPathSelector 17530 } 17531 17532 var _ NotificationChannelSpecEmail_FieldPath = (*NotificationChannelSpecEmail_FieldTerminalPath)(nil) 17533 17534 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) Selector() NotificationChannelSpecEmail_FieldPathSelector { 17535 return fp.selector 17536 } 17537 17538 // String returns path representation in proto convention 17539 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) String() string { 17540 return fp.selector.String() 17541 } 17542 17543 // JSONString returns path representation is JSON convention 17544 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) JSONString() string { 17545 return strcase.ToLowerCamel(fp.String()) 17546 } 17547 17548 // Get returns all values pointed by specific field from source NotificationChannelSpec_Email 17549 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) Get(source *NotificationChannelSpec_Email) (values []interface{}) { 17550 if source != nil { 17551 switch fp.selector { 17552 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17553 for _, value := range source.GetAddresses() { 17554 values = append(values, value) 17555 } 17556 default: 17557 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fp.selector)) 17558 } 17559 } 17560 return 17561 } 17562 17563 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 17564 return fp.Get(source.(*NotificationChannelSpec_Email)) 17565 } 17566 17567 // GetSingle returns value pointed by specific field of from source NotificationChannelSpec_Email 17568 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) GetSingle(source *NotificationChannelSpec_Email) (interface{}, bool) { 17569 switch fp.selector { 17570 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17571 res := source.GetAddresses() 17572 return res, res != nil 17573 default: 17574 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fp.selector)) 17575 } 17576 } 17577 17578 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 17579 return fp.GetSingle(source.(*NotificationChannelSpec_Email)) 17580 } 17581 17582 // GetDefault returns a default value of the field type 17583 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) GetDefault() interface{} { 17584 switch fp.selector { 17585 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17586 return ([]string)(nil) 17587 default: 17588 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fp.selector)) 17589 } 17590 } 17591 17592 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) ClearValue(item *NotificationChannelSpec_Email) { 17593 if item != nil { 17594 switch fp.selector { 17595 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17596 item.Addresses = nil 17597 default: 17598 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fp.selector)) 17599 } 17600 } 17601 } 17602 17603 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) ClearValueRaw(item proto.Message) { 17604 fp.ClearValue(item.(*NotificationChannelSpec_Email)) 17605 } 17606 17607 // IsLeaf - whether field path is holds simple value 17608 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) IsLeaf() bool { 17609 return fp.selector == NotificationChannelSpecEmail_FieldPathSelectorAddresses 17610 } 17611 17612 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 17613 return []gotenobject.FieldPath{fp} 17614 } 17615 17616 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) WithIValue(value interface{}) NotificationChannelSpecEmail_FieldPathValue { 17617 switch fp.selector { 17618 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17619 return &NotificationChannelSpecEmail_FieldTerminalPathValue{NotificationChannelSpecEmail_FieldTerminalPath: *fp, value: value.([]string)} 17620 default: 17621 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fp.selector)) 17622 } 17623 } 17624 17625 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 17626 return fp.WithIValue(value) 17627 } 17628 17629 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationChannelSpecEmail_FieldPathArrayOfValues { 17630 fpaov := &NotificationChannelSpecEmail_FieldTerminalPathArrayOfValues{NotificationChannelSpecEmail_FieldTerminalPath: *fp} 17631 switch fp.selector { 17632 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17633 return &NotificationChannelSpecEmail_FieldTerminalPathArrayOfValues{NotificationChannelSpecEmail_FieldTerminalPath: *fp, values: values.([][]string)} 17634 default: 17635 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fp.selector)) 17636 } 17637 return fpaov 17638 } 17639 17640 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 17641 return fp.WithIArrayOfValues(values) 17642 } 17643 17644 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationChannelSpecEmail_FieldPathArrayItemValue { 17645 switch fp.selector { 17646 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17647 return &NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue{NotificationChannelSpecEmail_FieldTerminalPath: *fp, value: value.(string)} 17648 default: 17649 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fp.selector)) 17650 } 17651 } 17652 17653 func (fp *NotificationChannelSpecEmail_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 17654 return fp.WithIArrayItemValue(value) 17655 } 17656 17657 // NotificationChannelSpecEmail_FieldPathValue allows storing values for Email fields according to their type 17658 type NotificationChannelSpecEmail_FieldPathValue interface { 17659 NotificationChannelSpecEmail_FieldPath 17660 gotenobject.FieldPathValue 17661 SetTo(target **NotificationChannelSpec_Email) 17662 CompareWith(*NotificationChannelSpec_Email) (cmp int, comparable bool) 17663 } 17664 17665 func ParseNotificationChannelSpecEmail_FieldPathValue(pathStr, valueStr string) (NotificationChannelSpecEmail_FieldPathValue, error) { 17666 fp, err := ParseNotificationChannelSpecEmail_FieldPath(pathStr) 17667 if err != nil { 17668 return nil, err 17669 } 17670 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 17671 if err != nil { 17672 return nil, status.Errorf(codes.InvalidArgument, "error parsing Email field path value from %s: %v", valueStr, err) 17673 } 17674 return fpv.(NotificationChannelSpecEmail_FieldPathValue), nil 17675 } 17676 17677 func MustParseNotificationChannelSpecEmail_FieldPathValue(pathStr, valueStr string) NotificationChannelSpecEmail_FieldPathValue { 17678 fpv, err := ParseNotificationChannelSpecEmail_FieldPathValue(pathStr, valueStr) 17679 if err != nil { 17680 panic(err) 17681 } 17682 return fpv 17683 } 17684 17685 type NotificationChannelSpecEmail_FieldTerminalPathValue struct { 17686 NotificationChannelSpecEmail_FieldTerminalPath 17687 value interface{} 17688 } 17689 17690 var _ NotificationChannelSpecEmail_FieldPathValue = (*NotificationChannelSpecEmail_FieldTerminalPathValue)(nil) 17691 17692 // GetRawValue returns raw value stored under selected path for 'Email' as interface{} 17693 func (fpv *NotificationChannelSpecEmail_FieldTerminalPathValue) GetRawValue() interface{} { 17694 return fpv.value 17695 } 17696 func (fpv *NotificationChannelSpecEmail_FieldTerminalPathValue) AsAddressesValue() ([]string, bool) { 17697 res, ok := fpv.value.([]string) 17698 return res, ok 17699 } 17700 17701 // SetTo stores value for selected field for object Email 17702 func (fpv *NotificationChannelSpecEmail_FieldTerminalPathValue) SetTo(target **NotificationChannelSpec_Email) { 17703 if *target == nil { 17704 *target = new(NotificationChannelSpec_Email) 17705 } 17706 switch fpv.selector { 17707 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17708 (*target).Addresses = fpv.value.([]string) 17709 default: 17710 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fpv.selector)) 17711 } 17712 } 17713 17714 func (fpv *NotificationChannelSpecEmail_FieldTerminalPathValue) SetToRaw(target proto.Message) { 17715 typedObject := target.(*NotificationChannelSpec_Email) 17716 fpv.SetTo(&typedObject) 17717 } 17718 17719 // CompareWith compares value in the 'NotificationChannelSpecEmail_FieldTerminalPathValue' with the value under path in 'NotificationChannelSpec_Email'. 17720 func (fpv *NotificationChannelSpecEmail_FieldTerminalPathValue) CompareWith(source *NotificationChannelSpec_Email) (int, bool) { 17721 switch fpv.selector { 17722 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17723 return 0, false 17724 default: 17725 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Email: %d", fpv.selector)) 17726 } 17727 } 17728 17729 func (fpv *NotificationChannelSpecEmail_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 17730 return fpv.CompareWith(source.(*NotificationChannelSpec_Email)) 17731 } 17732 17733 // NotificationChannelSpecEmail_FieldPathArrayItemValue allows storing single item in Path-specific values for Email according to their type 17734 // Present only for array (repeated) types. 17735 type NotificationChannelSpecEmail_FieldPathArrayItemValue interface { 17736 gotenobject.FieldPathArrayItemValue 17737 NotificationChannelSpecEmail_FieldPath 17738 ContainsValue(*NotificationChannelSpec_Email) bool 17739 } 17740 17741 // ParseNotificationChannelSpecEmail_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 17742 func ParseNotificationChannelSpecEmail_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationChannelSpecEmail_FieldPathArrayItemValue, error) { 17743 fp, err := ParseNotificationChannelSpecEmail_FieldPath(pathStr) 17744 if err != nil { 17745 return nil, err 17746 } 17747 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 17748 if err != nil { 17749 return nil, status.Errorf(codes.InvalidArgument, "error parsing Email field path array item value from %s: %v", valueStr, err) 17750 } 17751 return fpaiv.(NotificationChannelSpecEmail_FieldPathArrayItemValue), nil 17752 } 17753 17754 func MustParseNotificationChannelSpecEmail_FieldPathArrayItemValue(pathStr, valueStr string) NotificationChannelSpecEmail_FieldPathArrayItemValue { 17755 fpaiv, err := ParseNotificationChannelSpecEmail_FieldPathArrayItemValue(pathStr, valueStr) 17756 if err != nil { 17757 panic(err) 17758 } 17759 return fpaiv 17760 } 17761 17762 type NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue struct { 17763 NotificationChannelSpecEmail_FieldTerminalPath 17764 value interface{} 17765 } 17766 17767 var _ NotificationChannelSpecEmail_FieldPathArrayItemValue = (*NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue)(nil) 17768 17769 // GetRawValue returns stored element value for array in object NotificationChannelSpec_Email as interface{} 17770 func (fpaiv *NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 17771 return fpaiv.value 17772 } 17773 func (fpaiv *NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue) AsAddressesItemValue() (string, bool) { 17774 res, ok := fpaiv.value.(string) 17775 return res, ok 17776 } 17777 17778 func (fpaiv *NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue) GetSingle(source *NotificationChannelSpec_Email) (interface{}, bool) { 17779 return nil, false 17780 } 17781 17782 func (fpaiv *NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 17783 return fpaiv.GetSingle(source.(*NotificationChannelSpec_Email)) 17784 } 17785 17786 // Contains returns a boolean indicating if value that is being held is present in given 'Email' 17787 func (fpaiv *NotificationChannelSpecEmail_FieldTerminalPathArrayItemValue) ContainsValue(source *NotificationChannelSpec_Email) bool { 17788 slice := fpaiv.NotificationChannelSpecEmail_FieldTerminalPath.Get(source) 17789 for _, v := range slice { 17790 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 17791 if proto.Equal(asProtoMsg, v.(proto.Message)) { 17792 return true 17793 } 17794 } else if reflect.DeepEqual(v, fpaiv.value) { 17795 return true 17796 } 17797 } 17798 return false 17799 } 17800 17801 // NotificationChannelSpecEmail_FieldPathArrayOfValues allows storing slice of values for Email fields according to their type 17802 type NotificationChannelSpecEmail_FieldPathArrayOfValues interface { 17803 gotenobject.FieldPathArrayOfValues 17804 NotificationChannelSpecEmail_FieldPath 17805 } 17806 17807 func ParseNotificationChannelSpecEmail_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationChannelSpecEmail_FieldPathArrayOfValues, error) { 17808 fp, err := ParseNotificationChannelSpecEmail_FieldPath(pathStr) 17809 if err != nil { 17810 return nil, err 17811 } 17812 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 17813 if err != nil { 17814 return nil, status.Errorf(codes.InvalidArgument, "error parsing Email field path array of values from %s: %v", valuesStr, err) 17815 } 17816 return fpaov.(NotificationChannelSpecEmail_FieldPathArrayOfValues), nil 17817 } 17818 17819 func MustParseNotificationChannelSpecEmail_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationChannelSpecEmail_FieldPathArrayOfValues { 17820 fpaov, err := ParseNotificationChannelSpecEmail_FieldPathArrayOfValues(pathStr, valuesStr) 17821 if err != nil { 17822 panic(err) 17823 } 17824 return fpaov 17825 } 17826 17827 type NotificationChannelSpecEmail_FieldTerminalPathArrayOfValues struct { 17828 NotificationChannelSpecEmail_FieldTerminalPath 17829 values interface{} 17830 } 17831 17832 var _ NotificationChannelSpecEmail_FieldPathArrayOfValues = (*NotificationChannelSpecEmail_FieldTerminalPathArrayOfValues)(nil) 17833 17834 func (fpaov *NotificationChannelSpecEmail_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 17835 switch fpaov.selector { 17836 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 17837 for _, v := range fpaov.values.([][]string) { 17838 values = append(values, v) 17839 } 17840 } 17841 return 17842 } 17843 func (fpaov *NotificationChannelSpecEmail_FieldTerminalPathArrayOfValues) AsAddressesArrayOfValues() ([][]string, bool) { 17844 res, ok := fpaov.values.([][]string) 17845 return res, ok 17846 } 17847 17848 // FieldPath provides implementation to handle 17849 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 17850 type NotificationChannelSpecSlack_FieldPath interface { 17851 gotenobject.FieldPath 17852 Selector() NotificationChannelSpecSlack_FieldPathSelector 17853 Get(source *NotificationChannelSpec_Slack) []interface{} 17854 GetSingle(source *NotificationChannelSpec_Slack) (interface{}, bool) 17855 ClearValue(item *NotificationChannelSpec_Slack) 17856 17857 // Those methods build corresponding NotificationChannelSpecSlack_FieldPathValue 17858 // (or array of values) and holds passed value. Panics if injected type is incorrect. 17859 WithIValue(value interface{}) NotificationChannelSpecSlack_FieldPathValue 17860 WithIArrayOfValues(values interface{}) NotificationChannelSpecSlack_FieldPathArrayOfValues 17861 WithIArrayItemValue(value interface{}) NotificationChannelSpecSlack_FieldPathArrayItemValue 17862 } 17863 17864 type NotificationChannelSpecSlack_FieldPathSelector int32 17865 17866 const ( 17867 NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook NotificationChannelSpecSlack_FieldPathSelector = 0 17868 ) 17869 17870 func (s NotificationChannelSpecSlack_FieldPathSelector) String() string { 17871 switch s { 17872 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 17873 return "incoming_webhook" 17874 default: 17875 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", s)) 17876 } 17877 } 17878 17879 func BuildNotificationChannelSpecSlack_FieldPath(fp gotenobject.RawFieldPath) (NotificationChannelSpecSlack_FieldPath, error) { 17880 if len(fp) == 0 { 17881 return nil, status.Error(codes.InvalidArgument, "empty field path for object NotificationChannelSpec_Slack") 17882 } 17883 if len(fp) == 1 { 17884 switch fp[0] { 17885 case "incoming_webhook", "incomingWebhook", "incoming-webhook": 17886 return &NotificationChannelSpecSlack_FieldTerminalPath{selector: NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook}, nil 17887 } 17888 } 17889 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object NotificationChannelSpec_Slack", fp) 17890 } 17891 17892 func ParseNotificationChannelSpecSlack_FieldPath(rawField string) (NotificationChannelSpecSlack_FieldPath, error) { 17893 fp, err := gotenobject.ParseRawFieldPath(rawField) 17894 if err != nil { 17895 return nil, err 17896 } 17897 return BuildNotificationChannelSpecSlack_FieldPath(fp) 17898 } 17899 17900 func MustParseNotificationChannelSpecSlack_FieldPath(rawField string) NotificationChannelSpecSlack_FieldPath { 17901 fp, err := ParseNotificationChannelSpecSlack_FieldPath(rawField) 17902 if err != nil { 17903 panic(err) 17904 } 17905 return fp 17906 } 17907 17908 type NotificationChannelSpecSlack_FieldTerminalPath struct { 17909 selector NotificationChannelSpecSlack_FieldPathSelector 17910 } 17911 17912 var _ NotificationChannelSpecSlack_FieldPath = (*NotificationChannelSpecSlack_FieldTerminalPath)(nil) 17913 17914 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) Selector() NotificationChannelSpecSlack_FieldPathSelector { 17915 return fp.selector 17916 } 17917 17918 // String returns path representation in proto convention 17919 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) String() string { 17920 return fp.selector.String() 17921 } 17922 17923 // JSONString returns path representation is JSON convention 17924 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) JSONString() string { 17925 return strcase.ToLowerCamel(fp.String()) 17926 } 17927 17928 // Get returns all values pointed by specific field from source NotificationChannelSpec_Slack 17929 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) Get(source *NotificationChannelSpec_Slack) (values []interface{}) { 17930 if source != nil { 17931 switch fp.selector { 17932 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 17933 values = append(values, source.IncomingWebhook) 17934 default: 17935 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fp.selector)) 17936 } 17937 } 17938 return 17939 } 17940 17941 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 17942 return fp.Get(source.(*NotificationChannelSpec_Slack)) 17943 } 17944 17945 // GetSingle returns value pointed by specific field of from source NotificationChannelSpec_Slack 17946 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) GetSingle(source *NotificationChannelSpec_Slack) (interface{}, bool) { 17947 switch fp.selector { 17948 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 17949 return source.GetIncomingWebhook(), source != nil 17950 default: 17951 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fp.selector)) 17952 } 17953 } 17954 17955 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 17956 return fp.GetSingle(source.(*NotificationChannelSpec_Slack)) 17957 } 17958 17959 // GetDefault returns a default value of the field type 17960 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) GetDefault() interface{} { 17961 switch fp.selector { 17962 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 17963 return "" 17964 default: 17965 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fp.selector)) 17966 } 17967 } 17968 17969 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) ClearValue(item *NotificationChannelSpec_Slack) { 17970 if item != nil { 17971 switch fp.selector { 17972 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 17973 item.IncomingWebhook = "" 17974 default: 17975 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fp.selector)) 17976 } 17977 } 17978 } 17979 17980 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) ClearValueRaw(item proto.Message) { 17981 fp.ClearValue(item.(*NotificationChannelSpec_Slack)) 17982 } 17983 17984 // IsLeaf - whether field path is holds simple value 17985 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) IsLeaf() bool { 17986 return fp.selector == NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook 17987 } 17988 17989 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 17990 return []gotenobject.FieldPath{fp} 17991 } 17992 17993 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) WithIValue(value interface{}) NotificationChannelSpecSlack_FieldPathValue { 17994 switch fp.selector { 17995 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 17996 return &NotificationChannelSpecSlack_FieldTerminalPathValue{NotificationChannelSpecSlack_FieldTerminalPath: *fp, value: value.(string)} 17997 default: 17998 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fp.selector)) 17999 } 18000 } 18001 18002 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 18003 return fp.WithIValue(value) 18004 } 18005 18006 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationChannelSpecSlack_FieldPathArrayOfValues { 18007 fpaov := &NotificationChannelSpecSlack_FieldTerminalPathArrayOfValues{NotificationChannelSpecSlack_FieldTerminalPath: *fp} 18008 switch fp.selector { 18009 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 18010 return &NotificationChannelSpecSlack_FieldTerminalPathArrayOfValues{NotificationChannelSpecSlack_FieldTerminalPath: *fp, values: values.([]string)} 18011 default: 18012 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fp.selector)) 18013 } 18014 return fpaov 18015 } 18016 18017 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 18018 return fp.WithIArrayOfValues(values) 18019 } 18020 18021 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationChannelSpecSlack_FieldPathArrayItemValue { 18022 switch fp.selector { 18023 default: 18024 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fp.selector)) 18025 } 18026 } 18027 18028 func (fp *NotificationChannelSpecSlack_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 18029 return fp.WithIArrayItemValue(value) 18030 } 18031 18032 // NotificationChannelSpecSlack_FieldPathValue allows storing values for Slack fields according to their type 18033 type NotificationChannelSpecSlack_FieldPathValue interface { 18034 NotificationChannelSpecSlack_FieldPath 18035 gotenobject.FieldPathValue 18036 SetTo(target **NotificationChannelSpec_Slack) 18037 CompareWith(*NotificationChannelSpec_Slack) (cmp int, comparable bool) 18038 } 18039 18040 func ParseNotificationChannelSpecSlack_FieldPathValue(pathStr, valueStr string) (NotificationChannelSpecSlack_FieldPathValue, error) { 18041 fp, err := ParseNotificationChannelSpecSlack_FieldPath(pathStr) 18042 if err != nil { 18043 return nil, err 18044 } 18045 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 18046 if err != nil { 18047 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path value from %s: %v", valueStr, err) 18048 } 18049 return fpv.(NotificationChannelSpecSlack_FieldPathValue), nil 18050 } 18051 18052 func MustParseNotificationChannelSpecSlack_FieldPathValue(pathStr, valueStr string) NotificationChannelSpecSlack_FieldPathValue { 18053 fpv, err := ParseNotificationChannelSpecSlack_FieldPathValue(pathStr, valueStr) 18054 if err != nil { 18055 panic(err) 18056 } 18057 return fpv 18058 } 18059 18060 type NotificationChannelSpecSlack_FieldTerminalPathValue struct { 18061 NotificationChannelSpecSlack_FieldTerminalPath 18062 value interface{} 18063 } 18064 18065 var _ NotificationChannelSpecSlack_FieldPathValue = (*NotificationChannelSpecSlack_FieldTerminalPathValue)(nil) 18066 18067 // GetRawValue returns raw value stored under selected path for 'Slack' as interface{} 18068 func (fpv *NotificationChannelSpecSlack_FieldTerminalPathValue) GetRawValue() interface{} { 18069 return fpv.value 18070 } 18071 func (fpv *NotificationChannelSpecSlack_FieldTerminalPathValue) AsIncomingWebhookValue() (string, bool) { 18072 res, ok := fpv.value.(string) 18073 return res, ok 18074 } 18075 18076 // SetTo stores value for selected field for object Slack 18077 func (fpv *NotificationChannelSpecSlack_FieldTerminalPathValue) SetTo(target **NotificationChannelSpec_Slack) { 18078 if *target == nil { 18079 *target = new(NotificationChannelSpec_Slack) 18080 } 18081 switch fpv.selector { 18082 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 18083 (*target).IncomingWebhook = fpv.value.(string) 18084 default: 18085 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fpv.selector)) 18086 } 18087 } 18088 18089 func (fpv *NotificationChannelSpecSlack_FieldTerminalPathValue) SetToRaw(target proto.Message) { 18090 typedObject := target.(*NotificationChannelSpec_Slack) 18091 fpv.SetTo(&typedObject) 18092 } 18093 18094 // CompareWith compares value in the 'NotificationChannelSpecSlack_FieldTerminalPathValue' with the value under path in 'NotificationChannelSpec_Slack'. 18095 func (fpv *NotificationChannelSpecSlack_FieldTerminalPathValue) CompareWith(source *NotificationChannelSpec_Slack) (int, bool) { 18096 switch fpv.selector { 18097 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 18098 leftValue := fpv.value.(string) 18099 rightValue := source.GetIncomingWebhook() 18100 if (leftValue) == (rightValue) { 18101 return 0, true 18102 } else if (leftValue) < (rightValue) { 18103 return -1, true 18104 } else { 18105 return 1, true 18106 } 18107 default: 18108 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Slack: %d", fpv.selector)) 18109 } 18110 } 18111 18112 func (fpv *NotificationChannelSpecSlack_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 18113 return fpv.CompareWith(source.(*NotificationChannelSpec_Slack)) 18114 } 18115 18116 // NotificationChannelSpecSlack_FieldPathArrayItemValue allows storing single item in Path-specific values for Slack according to their type 18117 // Present only for array (repeated) types. 18118 type NotificationChannelSpecSlack_FieldPathArrayItemValue interface { 18119 gotenobject.FieldPathArrayItemValue 18120 NotificationChannelSpecSlack_FieldPath 18121 ContainsValue(*NotificationChannelSpec_Slack) bool 18122 } 18123 18124 // ParseNotificationChannelSpecSlack_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 18125 func ParseNotificationChannelSpecSlack_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationChannelSpecSlack_FieldPathArrayItemValue, error) { 18126 fp, err := ParseNotificationChannelSpecSlack_FieldPath(pathStr) 18127 if err != nil { 18128 return nil, err 18129 } 18130 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 18131 if err != nil { 18132 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path array item value from %s: %v", valueStr, err) 18133 } 18134 return fpaiv.(NotificationChannelSpecSlack_FieldPathArrayItemValue), nil 18135 } 18136 18137 func MustParseNotificationChannelSpecSlack_FieldPathArrayItemValue(pathStr, valueStr string) NotificationChannelSpecSlack_FieldPathArrayItemValue { 18138 fpaiv, err := ParseNotificationChannelSpecSlack_FieldPathArrayItemValue(pathStr, valueStr) 18139 if err != nil { 18140 panic(err) 18141 } 18142 return fpaiv 18143 } 18144 18145 type NotificationChannelSpecSlack_FieldTerminalPathArrayItemValue struct { 18146 NotificationChannelSpecSlack_FieldTerminalPath 18147 value interface{} 18148 } 18149 18150 var _ NotificationChannelSpecSlack_FieldPathArrayItemValue = (*NotificationChannelSpecSlack_FieldTerminalPathArrayItemValue)(nil) 18151 18152 // GetRawValue returns stored element value for array in object NotificationChannelSpec_Slack as interface{} 18153 func (fpaiv *NotificationChannelSpecSlack_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 18154 return fpaiv.value 18155 } 18156 18157 func (fpaiv *NotificationChannelSpecSlack_FieldTerminalPathArrayItemValue) GetSingle(source *NotificationChannelSpec_Slack) (interface{}, bool) { 18158 return nil, false 18159 } 18160 18161 func (fpaiv *NotificationChannelSpecSlack_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 18162 return fpaiv.GetSingle(source.(*NotificationChannelSpec_Slack)) 18163 } 18164 18165 // Contains returns a boolean indicating if value that is being held is present in given 'Slack' 18166 func (fpaiv *NotificationChannelSpecSlack_FieldTerminalPathArrayItemValue) ContainsValue(source *NotificationChannelSpec_Slack) bool { 18167 slice := fpaiv.NotificationChannelSpecSlack_FieldTerminalPath.Get(source) 18168 for _, v := range slice { 18169 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 18170 if proto.Equal(asProtoMsg, v.(proto.Message)) { 18171 return true 18172 } 18173 } else if reflect.DeepEqual(v, fpaiv.value) { 18174 return true 18175 } 18176 } 18177 return false 18178 } 18179 18180 // NotificationChannelSpecSlack_FieldPathArrayOfValues allows storing slice of values for Slack fields according to their type 18181 type NotificationChannelSpecSlack_FieldPathArrayOfValues interface { 18182 gotenobject.FieldPathArrayOfValues 18183 NotificationChannelSpecSlack_FieldPath 18184 } 18185 18186 func ParseNotificationChannelSpecSlack_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationChannelSpecSlack_FieldPathArrayOfValues, error) { 18187 fp, err := ParseNotificationChannelSpecSlack_FieldPath(pathStr) 18188 if err != nil { 18189 return nil, err 18190 } 18191 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 18192 if err != nil { 18193 return nil, status.Errorf(codes.InvalidArgument, "error parsing Slack field path array of values from %s: %v", valuesStr, err) 18194 } 18195 return fpaov.(NotificationChannelSpecSlack_FieldPathArrayOfValues), nil 18196 } 18197 18198 func MustParseNotificationChannelSpecSlack_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationChannelSpecSlack_FieldPathArrayOfValues { 18199 fpaov, err := ParseNotificationChannelSpecSlack_FieldPathArrayOfValues(pathStr, valuesStr) 18200 if err != nil { 18201 panic(err) 18202 } 18203 return fpaov 18204 } 18205 18206 type NotificationChannelSpecSlack_FieldTerminalPathArrayOfValues struct { 18207 NotificationChannelSpecSlack_FieldTerminalPath 18208 values interface{} 18209 } 18210 18211 var _ NotificationChannelSpecSlack_FieldPathArrayOfValues = (*NotificationChannelSpecSlack_FieldTerminalPathArrayOfValues)(nil) 18212 18213 func (fpaov *NotificationChannelSpecSlack_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 18214 switch fpaov.selector { 18215 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 18216 for _, v := range fpaov.values.([]string) { 18217 values = append(values, v) 18218 } 18219 } 18220 return 18221 } 18222 func (fpaov *NotificationChannelSpecSlack_FieldTerminalPathArrayOfValues) AsIncomingWebhookArrayOfValues() ([]string, bool) { 18223 res, ok := fpaov.values.([]string) 18224 return res, ok 18225 } 18226 18227 // FieldPath provides implementation to handle 18228 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 18229 type NotificationChannelSpecPagerDuty_FieldPath interface { 18230 gotenobject.FieldPath 18231 Selector() NotificationChannelSpecPagerDuty_FieldPathSelector 18232 Get(source *NotificationChannelSpec_PagerDuty) []interface{} 18233 GetSingle(source *NotificationChannelSpec_PagerDuty) (interface{}, bool) 18234 ClearValue(item *NotificationChannelSpec_PagerDuty) 18235 18236 // Those methods build corresponding NotificationChannelSpecPagerDuty_FieldPathValue 18237 // (or array of values) and holds passed value. Panics if injected type is incorrect. 18238 WithIValue(value interface{}) NotificationChannelSpecPagerDuty_FieldPathValue 18239 WithIArrayOfValues(values interface{}) NotificationChannelSpecPagerDuty_FieldPathArrayOfValues 18240 WithIArrayItemValue(value interface{}) NotificationChannelSpecPagerDuty_FieldPathArrayItemValue 18241 } 18242 18243 type NotificationChannelSpecPagerDuty_FieldPathSelector int32 18244 18245 const ( 18246 NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey NotificationChannelSpecPagerDuty_FieldPathSelector = 0 18247 ) 18248 18249 func (s NotificationChannelSpecPagerDuty_FieldPathSelector) String() string { 18250 switch s { 18251 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18252 return "service_key" 18253 default: 18254 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", s)) 18255 } 18256 } 18257 18258 func BuildNotificationChannelSpecPagerDuty_FieldPath(fp gotenobject.RawFieldPath) (NotificationChannelSpecPagerDuty_FieldPath, error) { 18259 if len(fp) == 0 { 18260 return nil, status.Error(codes.InvalidArgument, "empty field path for object NotificationChannelSpec_PagerDuty") 18261 } 18262 if len(fp) == 1 { 18263 switch fp[0] { 18264 case "service_key", "serviceKey", "service-key": 18265 return &NotificationChannelSpecPagerDuty_FieldTerminalPath{selector: NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey}, nil 18266 } 18267 } 18268 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object NotificationChannelSpec_PagerDuty", fp) 18269 } 18270 18271 func ParseNotificationChannelSpecPagerDuty_FieldPath(rawField string) (NotificationChannelSpecPagerDuty_FieldPath, error) { 18272 fp, err := gotenobject.ParseRawFieldPath(rawField) 18273 if err != nil { 18274 return nil, err 18275 } 18276 return BuildNotificationChannelSpecPagerDuty_FieldPath(fp) 18277 } 18278 18279 func MustParseNotificationChannelSpecPagerDuty_FieldPath(rawField string) NotificationChannelSpecPagerDuty_FieldPath { 18280 fp, err := ParseNotificationChannelSpecPagerDuty_FieldPath(rawField) 18281 if err != nil { 18282 panic(err) 18283 } 18284 return fp 18285 } 18286 18287 type NotificationChannelSpecPagerDuty_FieldTerminalPath struct { 18288 selector NotificationChannelSpecPagerDuty_FieldPathSelector 18289 } 18290 18291 var _ NotificationChannelSpecPagerDuty_FieldPath = (*NotificationChannelSpecPagerDuty_FieldTerminalPath)(nil) 18292 18293 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) Selector() NotificationChannelSpecPagerDuty_FieldPathSelector { 18294 return fp.selector 18295 } 18296 18297 // String returns path representation in proto convention 18298 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) String() string { 18299 return fp.selector.String() 18300 } 18301 18302 // JSONString returns path representation is JSON convention 18303 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) JSONString() string { 18304 return strcase.ToLowerCamel(fp.String()) 18305 } 18306 18307 // Get returns all values pointed by specific field from source NotificationChannelSpec_PagerDuty 18308 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) Get(source *NotificationChannelSpec_PagerDuty) (values []interface{}) { 18309 if source != nil { 18310 switch fp.selector { 18311 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18312 values = append(values, source.ServiceKey) 18313 default: 18314 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fp.selector)) 18315 } 18316 } 18317 return 18318 } 18319 18320 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 18321 return fp.Get(source.(*NotificationChannelSpec_PagerDuty)) 18322 } 18323 18324 // GetSingle returns value pointed by specific field of from source NotificationChannelSpec_PagerDuty 18325 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) GetSingle(source *NotificationChannelSpec_PagerDuty) (interface{}, bool) { 18326 switch fp.selector { 18327 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18328 return source.GetServiceKey(), source != nil 18329 default: 18330 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fp.selector)) 18331 } 18332 } 18333 18334 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 18335 return fp.GetSingle(source.(*NotificationChannelSpec_PagerDuty)) 18336 } 18337 18338 // GetDefault returns a default value of the field type 18339 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) GetDefault() interface{} { 18340 switch fp.selector { 18341 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18342 return "" 18343 default: 18344 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fp.selector)) 18345 } 18346 } 18347 18348 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) ClearValue(item *NotificationChannelSpec_PagerDuty) { 18349 if item != nil { 18350 switch fp.selector { 18351 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18352 item.ServiceKey = "" 18353 default: 18354 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fp.selector)) 18355 } 18356 } 18357 } 18358 18359 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) ClearValueRaw(item proto.Message) { 18360 fp.ClearValue(item.(*NotificationChannelSpec_PagerDuty)) 18361 } 18362 18363 // IsLeaf - whether field path is holds simple value 18364 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) IsLeaf() bool { 18365 return fp.selector == NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey 18366 } 18367 18368 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 18369 return []gotenobject.FieldPath{fp} 18370 } 18371 18372 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) WithIValue(value interface{}) NotificationChannelSpecPagerDuty_FieldPathValue { 18373 switch fp.selector { 18374 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18375 return &NotificationChannelSpecPagerDuty_FieldTerminalPathValue{NotificationChannelSpecPagerDuty_FieldTerminalPath: *fp, value: value.(string)} 18376 default: 18377 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fp.selector)) 18378 } 18379 } 18380 18381 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 18382 return fp.WithIValue(value) 18383 } 18384 18385 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationChannelSpecPagerDuty_FieldPathArrayOfValues { 18386 fpaov := &NotificationChannelSpecPagerDuty_FieldTerminalPathArrayOfValues{NotificationChannelSpecPagerDuty_FieldTerminalPath: *fp} 18387 switch fp.selector { 18388 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18389 return &NotificationChannelSpecPagerDuty_FieldTerminalPathArrayOfValues{NotificationChannelSpecPagerDuty_FieldTerminalPath: *fp, values: values.([]string)} 18390 default: 18391 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fp.selector)) 18392 } 18393 return fpaov 18394 } 18395 18396 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 18397 return fp.WithIArrayOfValues(values) 18398 } 18399 18400 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationChannelSpecPagerDuty_FieldPathArrayItemValue { 18401 switch fp.selector { 18402 default: 18403 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fp.selector)) 18404 } 18405 } 18406 18407 func (fp *NotificationChannelSpecPagerDuty_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 18408 return fp.WithIArrayItemValue(value) 18409 } 18410 18411 // NotificationChannelSpecPagerDuty_FieldPathValue allows storing values for PagerDuty fields according to their type 18412 type NotificationChannelSpecPagerDuty_FieldPathValue interface { 18413 NotificationChannelSpecPagerDuty_FieldPath 18414 gotenobject.FieldPathValue 18415 SetTo(target **NotificationChannelSpec_PagerDuty) 18416 CompareWith(*NotificationChannelSpec_PagerDuty) (cmp int, comparable bool) 18417 } 18418 18419 func ParseNotificationChannelSpecPagerDuty_FieldPathValue(pathStr, valueStr string) (NotificationChannelSpecPagerDuty_FieldPathValue, error) { 18420 fp, err := ParseNotificationChannelSpecPagerDuty_FieldPath(pathStr) 18421 if err != nil { 18422 return nil, err 18423 } 18424 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 18425 if err != nil { 18426 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path value from %s: %v", valueStr, err) 18427 } 18428 return fpv.(NotificationChannelSpecPagerDuty_FieldPathValue), nil 18429 } 18430 18431 func MustParseNotificationChannelSpecPagerDuty_FieldPathValue(pathStr, valueStr string) NotificationChannelSpecPagerDuty_FieldPathValue { 18432 fpv, err := ParseNotificationChannelSpecPagerDuty_FieldPathValue(pathStr, valueStr) 18433 if err != nil { 18434 panic(err) 18435 } 18436 return fpv 18437 } 18438 18439 type NotificationChannelSpecPagerDuty_FieldTerminalPathValue struct { 18440 NotificationChannelSpecPagerDuty_FieldTerminalPath 18441 value interface{} 18442 } 18443 18444 var _ NotificationChannelSpecPagerDuty_FieldPathValue = (*NotificationChannelSpecPagerDuty_FieldTerminalPathValue)(nil) 18445 18446 // GetRawValue returns raw value stored under selected path for 'PagerDuty' as interface{} 18447 func (fpv *NotificationChannelSpecPagerDuty_FieldTerminalPathValue) GetRawValue() interface{} { 18448 return fpv.value 18449 } 18450 func (fpv *NotificationChannelSpecPagerDuty_FieldTerminalPathValue) AsServiceKeyValue() (string, bool) { 18451 res, ok := fpv.value.(string) 18452 return res, ok 18453 } 18454 18455 // SetTo stores value for selected field for object PagerDuty 18456 func (fpv *NotificationChannelSpecPagerDuty_FieldTerminalPathValue) SetTo(target **NotificationChannelSpec_PagerDuty) { 18457 if *target == nil { 18458 *target = new(NotificationChannelSpec_PagerDuty) 18459 } 18460 switch fpv.selector { 18461 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18462 (*target).ServiceKey = fpv.value.(string) 18463 default: 18464 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fpv.selector)) 18465 } 18466 } 18467 18468 func (fpv *NotificationChannelSpecPagerDuty_FieldTerminalPathValue) SetToRaw(target proto.Message) { 18469 typedObject := target.(*NotificationChannelSpec_PagerDuty) 18470 fpv.SetTo(&typedObject) 18471 } 18472 18473 // CompareWith compares value in the 'NotificationChannelSpecPagerDuty_FieldTerminalPathValue' with the value under path in 'NotificationChannelSpec_PagerDuty'. 18474 func (fpv *NotificationChannelSpecPagerDuty_FieldTerminalPathValue) CompareWith(source *NotificationChannelSpec_PagerDuty) (int, bool) { 18475 switch fpv.selector { 18476 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18477 leftValue := fpv.value.(string) 18478 rightValue := source.GetServiceKey() 18479 if (leftValue) == (rightValue) { 18480 return 0, true 18481 } else if (leftValue) < (rightValue) { 18482 return -1, true 18483 } else { 18484 return 1, true 18485 } 18486 default: 18487 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_PagerDuty: %d", fpv.selector)) 18488 } 18489 } 18490 18491 func (fpv *NotificationChannelSpecPagerDuty_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 18492 return fpv.CompareWith(source.(*NotificationChannelSpec_PagerDuty)) 18493 } 18494 18495 // NotificationChannelSpecPagerDuty_FieldPathArrayItemValue allows storing single item in Path-specific values for PagerDuty according to their type 18496 // Present only for array (repeated) types. 18497 type NotificationChannelSpecPagerDuty_FieldPathArrayItemValue interface { 18498 gotenobject.FieldPathArrayItemValue 18499 NotificationChannelSpecPagerDuty_FieldPath 18500 ContainsValue(*NotificationChannelSpec_PagerDuty) bool 18501 } 18502 18503 // ParseNotificationChannelSpecPagerDuty_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 18504 func ParseNotificationChannelSpecPagerDuty_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationChannelSpecPagerDuty_FieldPathArrayItemValue, error) { 18505 fp, err := ParseNotificationChannelSpecPagerDuty_FieldPath(pathStr) 18506 if err != nil { 18507 return nil, err 18508 } 18509 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 18510 if err != nil { 18511 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path array item value from %s: %v", valueStr, err) 18512 } 18513 return fpaiv.(NotificationChannelSpecPagerDuty_FieldPathArrayItemValue), nil 18514 } 18515 18516 func MustParseNotificationChannelSpecPagerDuty_FieldPathArrayItemValue(pathStr, valueStr string) NotificationChannelSpecPagerDuty_FieldPathArrayItemValue { 18517 fpaiv, err := ParseNotificationChannelSpecPagerDuty_FieldPathArrayItemValue(pathStr, valueStr) 18518 if err != nil { 18519 panic(err) 18520 } 18521 return fpaiv 18522 } 18523 18524 type NotificationChannelSpecPagerDuty_FieldTerminalPathArrayItemValue struct { 18525 NotificationChannelSpecPagerDuty_FieldTerminalPath 18526 value interface{} 18527 } 18528 18529 var _ NotificationChannelSpecPagerDuty_FieldPathArrayItemValue = (*NotificationChannelSpecPagerDuty_FieldTerminalPathArrayItemValue)(nil) 18530 18531 // GetRawValue returns stored element value for array in object NotificationChannelSpec_PagerDuty as interface{} 18532 func (fpaiv *NotificationChannelSpecPagerDuty_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 18533 return fpaiv.value 18534 } 18535 18536 func (fpaiv *NotificationChannelSpecPagerDuty_FieldTerminalPathArrayItemValue) GetSingle(source *NotificationChannelSpec_PagerDuty) (interface{}, bool) { 18537 return nil, false 18538 } 18539 18540 func (fpaiv *NotificationChannelSpecPagerDuty_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 18541 return fpaiv.GetSingle(source.(*NotificationChannelSpec_PagerDuty)) 18542 } 18543 18544 // Contains returns a boolean indicating if value that is being held is present in given 'PagerDuty' 18545 func (fpaiv *NotificationChannelSpecPagerDuty_FieldTerminalPathArrayItemValue) ContainsValue(source *NotificationChannelSpec_PagerDuty) bool { 18546 slice := fpaiv.NotificationChannelSpecPagerDuty_FieldTerminalPath.Get(source) 18547 for _, v := range slice { 18548 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 18549 if proto.Equal(asProtoMsg, v.(proto.Message)) { 18550 return true 18551 } 18552 } else if reflect.DeepEqual(v, fpaiv.value) { 18553 return true 18554 } 18555 } 18556 return false 18557 } 18558 18559 // NotificationChannelSpecPagerDuty_FieldPathArrayOfValues allows storing slice of values for PagerDuty fields according to their type 18560 type NotificationChannelSpecPagerDuty_FieldPathArrayOfValues interface { 18561 gotenobject.FieldPathArrayOfValues 18562 NotificationChannelSpecPagerDuty_FieldPath 18563 } 18564 18565 func ParseNotificationChannelSpecPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationChannelSpecPagerDuty_FieldPathArrayOfValues, error) { 18566 fp, err := ParseNotificationChannelSpecPagerDuty_FieldPath(pathStr) 18567 if err != nil { 18568 return nil, err 18569 } 18570 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 18571 if err != nil { 18572 return nil, status.Errorf(codes.InvalidArgument, "error parsing PagerDuty field path array of values from %s: %v", valuesStr, err) 18573 } 18574 return fpaov.(NotificationChannelSpecPagerDuty_FieldPathArrayOfValues), nil 18575 } 18576 18577 func MustParseNotificationChannelSpecPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationChannelSpecPagerDuty_FieldPathArrayOfValues { 18578 fpaov, err := ParseNotificationChannelSpecPagerDuty_FieldPathArrayOfValues(pathStr, valuesStr) 18579 if err != nil { 18580 panic(err) 18581 } 18582 return fpaov 18583 } 18584 18585 type NotificationChannelSpecPagerDuty_FieldTerminalPathArrayOfValues struct { 18586 NotificationChannelSpecPagerDuty_FieldTerminalPath 18587 values interface{} 18588 } 18589 18590 var _ NotificationChannelSpecPagerDuty_FieldPathArrayOfValues = (*NotificationChannelSpecPagerDuty_FieldTerminalPathArrayOfValues)(nil) 18591 18592 func (fpaov *NotificationChannelSpecPagerDuty_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 18593 switch fpaov.selector { 18594 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 18595 for _, v := range fpaov.values.([]string) { 18596 values = append(values, v) 18597 } 18598 } 18599 return 18600 } 18601 func (fpaov *NotificationChannelSpecPagerDuty_FieldTerminalPathArrayOfValues) AsServiceKeyArrayOfValues() ([]string, bool) { 18602 res, ok := fpaov.values.([]string) 18603 return res, ok 18604 } 18605 18606 // FieldPath provides implementation to handle 18607 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 18608 type NotificationChannelSpecWebhook_FieldPath interface { 18609 gotenobject.FieldPath 18610 Selector() NotificationChannelSpecWebhook_FieldPathSelector 18611 Get(source *NotificationChannelSpec_Webhook) []interface{} 18612 GetSingle(source *NotificationChannelSpec_Webhook) (interface{}, bool) 18613 ClearValue(item *NotificationChannelSpec_Webhook) 18614 18615 // Those methods build corresponding NotificationChannelSpecWebhook_FieldPathValue 18616 // (or array of values) and holds passed value. Panics if injected type is incorrect. 18617 WithIValue(value interface{}) NotificationChannelSpecWebhook_FieldPathValue 18618 WithIArrayOfValues(values interface{}) NotificationChannelSpecWebhook_FieldPathArrayOfValues 18619 WithIArrayItemValue(value interface{}) NotificationChannelSpecWebhook_FieldPathArrayItemValue 18620 } 18621 18622 type NotificationChannelSpecWebhook_FieldPathSelector int32 18623 18624 const ( 18625 NotificationChannelSpecWebhook_FieldPathSelectorUrl NotificationChannelSpecWebhook_FieldPathSelector = 0 18626 NotificationChannelSpecWebhook_FieldPathSelectorHeaders NotificationChannelSpecWebhook_FieldPathSelector = 1 18627 NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb NotificationChannelSpecWebhook_FieldPathSelector = 2 18628 ) 18629 18630 func (s NotificationChannelSpecWebhook_FieldPathSelector) String() string { 18631 switch s { 18632 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 18633 return "url" 18634 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18635 return "headers" 18636 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 18637 return "max_message_size_mb" 18638 default: 18639 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", s)) 18640 } 18641 } 18642 18643 func BuildNotificationChannelSpecWebhook_FieldPath(fp gotenobject.RawFieldPath) (NotificationChannelSpecWebhook_FieldPath, error) { 18644 if len(fp) == 0 { 18645 return nil, status.Error(codes.InvalidArgument, "empty field path for object NotificationChannelSpec_Webhook") 18646 } 18647 if len(fp) == 1 { 18648 switch fp[0] { 18649 case "url": 18650 return &NotificationChannelSpecWebhook_FieldTerminalPath{selector: NotificationChannelSpecWebhook_FieldPathSelectorUrl}, nil 18651 case "headers": 18652 return &NotificationChannelSpecWebhook_FieldTerminalPath{selector: NotificationChannelSpecWebhook_FieldPathSelectorHeaders}, nil 18653 case "max_message_size_mb", "maxMessageSizeMb", "max-message-size-mb": 18654 return &NotificationChannelSpecWebhook_FieldTerminalPath{selector: NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb}, nil 18655 } 18656 } else { 18657 switch fp[0] { 18658 case "headers": 18659 if subpath, err := BuildNotificationChannelSpecWebhookHeader_FieldPath(fp[1:]); err != nil { 18660 return nil, err 18661 } else { 18662 return &NotificationChannelSpecWebhook_FieldSubPath{selector: NotificationChannelSpecWebhook_FieldPathSelectorHeaders, subPath: subpath}, nil 18663 } 18664 } 18665 } 18666 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object NotificationChannelSpec_Webhook", fp) 18667 } 18668 18669 func ParseNotificationChannelSpecWebhook_FieldPath(rawField string) (NotificationChannelSpecWebhook_FieldPath, error) { 18670 fp, err := gotenobject.ParseRawFieldPath(rawField) 18671 if err != nil { 18672 return nil, err 18673 } 18674 return BuildNotificationChannelSpecWebhook_FieldPath(fp) 18675 } 18676 18677 func MustParseNotificationChannelSpecWebhook_FieldPath(rawField string) NotificationChannelSpecWebhook_FieldPath { 18678 fp, err := ParseNotificationChannelSpecWebhook_FieldPath(rawField) 18679 if err != nil { 18680 panic(err) 18681 } 18682 return fp 18683 } 18684 18685 type NotificationChannelSpecWebhook_FieldTerminalPath struct { 18686 selector NotificationChannelSpecWebhook_FieldPathSelector 18687 } 18688 18689 var _ NotificationChannelSpecWebhook_FieldPath = (*NotificationChannelSpecWebhook_FieldTerminalPath)(nil) 18690 18691 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) Selector() NotificationChannelSpecWebhook_FieldPathSelector { 18692 return fp.selector 18693 } 18694 18695 // String returns path representation in proto convention 18696 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) String() string { 18697 return fp.selector.String() 18698 } 18699 18700 // JSONString returns path representation is JSON convention 18701 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) JSONString() string { 18702 return strcase.ToLowerCamel(fp.String()) 18703 } 18704 18705 // Get returns all values pointed by specific field from source NotificationChannelSpec_Webhook 18706 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) Get(source *NotificationChannelSpec_Webhook) (values []interface{}) { 18707 if source != nil { 18708 switch fp.selector { 18709 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 18710 values = append(values, source.Url) 18711 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18712 for _, value := range source.GetHeaders() { 18713 values = append(values, value) 18714 } 18715 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 18716 values = append(values, source.MaxMessageSizeMb) 18717 default: 18718 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fp.selector)) 18719 } 18720 } 18721 return 18722 } 18723 18724 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 18725 return fp.Get(source.(*NotificationChannelSpec_Webhook)) 18726 } 18727 18728 // GetSingle returns value pointed by specific field of from source NotificationChannelSpec_Webhook 18729 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) GetSingle(source *NotificationChannelSpec_Webhook) (interface{}, bool) { 18730 switch fp.selector { 18731 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 18732 return source.GetUrl(), source != nil 18733 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18734 res := source.GetHeaders() 18735 return res, res != nil 18736 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 18737 return source.GetMaxMessageSizeMb(), source != nil 18738 default: 18739 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fp.selector)) 18740 } 18741 } 18742 18743 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 18744 return fp.GetSingle(source.(*NotificationChannelSpec_Webhook)) 18745 } 18746 18747 // GetDefault returns a default value of the field type 18748 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) GetDefault() interface{} { 18749 switch fp.selector { 18750 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 18751 return "" 18752 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18753 return ([]*NotificationChannelSpec_Webhook_Header)(nil) 18754 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 18755 return float64(0) 18756 default: 18757 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fp.selector)) 18758 } 18759 } 18760 18761 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) ClearValue(item *NotificationChannelSpec_Webhook) { 18762 if item != nil { 18763 switch fp.selector { 18764 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 18765 item.Url = "" 18766 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18767 item.Headers = nil 18768 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 18769 item.MaxMessageSizeMb = float64(0) 18770 default: 18771 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fp.selector)) 18772 } 18773 } 18774 } 18775 18776 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) ClearValueRaw(item proto.Message) { 18777 fp.ClearValue(item.(*NotificationChannelSpec_Webhook)) 18778 } 18779 18780 // IsLeaf - whether field path is holds simple value 18781 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) IsLeaf() bool { 18782 return fp.selector == NotificationChannelSpecWebhook_FieldPathSelectorUrl || 18783 fp.selector == NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb 18784 } 18785 18786 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 18787 return []gotenobject.FieldPath{fp} 18788 } 18789 18790 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) WithIValue(value interface{}) NotificationChannelSpecWebhook_FieldPathValue { 18791 switch fp.selector { 18792 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 18793 return &NotificationChannelSpecWebhook_FieldTerminalPathValue{NotificationChannelSpecWebhook_FieldTerminalPath: *fp, value: value.(string)} 18794 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18795 return &NotificationChannelSpecWebhook_FieldTerminalPathValue{NotificationChannelSpecWebhook_FieldTerminalPath: *fp, value: value.([]*NotificationChannelSpec_Webhook_Header)} 18796 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 18797 return &NotificationChannelSpecWebhook_FieldTerminalPathValue{NotificationChannelSpecWebhook_FieldTerminalPath: *fp, value: value.(float64)} 18798 default: 18799 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fp.selector)) 18800 } 18801 } 18802 18803 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 18804 return fp.WithIValue(value) 18805 } 18806 18807 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationChannelSpecWebhook_FieldPathArrayOfValues { 18808 fpaov := &NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues{NotificationChannelSpecWebhook_FieldTerminalPath: *fp} 18809 switch fp.selector { 18810 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 18811 return &NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues{NotificationChannelSpecWebhook_FieldTerminalPath: *fp, values: values.([]string)} 18812 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18813 return &NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues{NotificationChannelSpecWebhook_FieldTerminalPath: *fp, values: values.([][]*NotificationChannelSpec_Webhook_Header)} 18814 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 18815 return &NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues{NotificationChannelSpecWebhook_FieldTerminalPath: *fp, values: values.([]float64)} 18816 default: 18817 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fp.selector)) 18818 } 18819 return fpaov 18820 } 18821 18822 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 18823 return fp.WithIArrayOfValues(values) 18824 } 18825 18826 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationChannelSpecWebhook_FieldPathArrayItemValue { 18827 switch fp.selector { 18828 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18829 return &NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue{NotificationChannelSpecWebhook_FieldTerminalPath: *fp, value: value.(*NotificationChannelSpec_Webhook_Header)} 18830 default: 18831 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fp.selector)) 18832 } 18833 } 18834 18835 func (fp *NotificationChannelSpecWebhook_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 18836 return fp.WithIArrayItemValue(value) 18837 } 18838 18839 type NotificationChannelSpecWebhook_FieldSubPath struct { 18840 selector NotificationChannelSpecWebhook_FieldPathSelector 18841 subPath gotenobject.FieldPath 18842 } 18843 18844 var _ NotificationChannelSpecWebhook_FieldPath = (*NotificationChannelSpecWebhook_FieldSubPath)(nil) 18845 18846 func (fps *NotificationChannelSpecWebhook_FieldSubPath) Selector() NotificationChannelSpecWebhook_FieldPathSelector { 18847 return fps.selector 18848 } 18849 func (fps *NotificationChannelSpecWebhook_FieldSubPath) AsHeadersSubPath() (NotificationChannelSpecWebhookHeader_FieldPath, bool) { 18850 res, ok := fps.subPath.(NotificationChannelSpecWebhookHeader_FieldPath) 18851 return res, ok 18852 } 18853 18854 // String returns path representation in proto convention 18855 func (fps *NotificationChannelSpecWebhook_FieldSubPath) String() string { 18856 return fps.selector.String() + "." + fps.subPath.String() 18857 } 18858 18859 // JSONString returns path representation is JSON convention 18860 func (fps *NotificationChannelSpecWebhook_FieldSubPath) JSONString() string { 18861 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 18862 } 18863 18864 // Get returns all values pointed by selected field from source NotificationChannelSpec_Webhook 18865 func (fps *NotificationChannelSpecWebhook_FieldSubPath) Get(source *NotificationChannelSpec_Webhook) (values []interface{}) { 18866 switch fps.selector { 18867 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18868 for _, item := range source.GetHeaders() { 18869 values = append(values, fps.subPath.GetRaw(item)...) 18870 } 18871 default: 18872 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fps.selector)) 18873 } 18874 return 18875 } 18876 18877 func (fps *NotificationChannelSpecWebhook_FieldSubPath) GetRaw(source proto.Message) []interface{} { 18878 return fps.Get(source.(*NotificationChannelSpec_Webhook)) 18879 } 18880 18881 // GetSingle returns value of selected field from source NotificationChannelSpec_Webhook 18882 func (fps *NotificationChannelSpecWebhook_FieldSubPath) GetSingle(source *NotificationChannelSpec_Webhook) (interface{}, bool) { 18883 switch fps.selector { 18884 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18885 if len(source.GetHeaders()) == 0 { 18886 return nil, false 18887 } 18888 return fps.subPath.GetSingleRaw(source.GetHeaders()[0]) 18889 default: 18890 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fps.selector)) 18891 } 18892 } 18893 18894 func (fps *NotificationChannelSpecWebhook_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 18895 return fps.GetSingle(source.(*NotificationChannelSpec_Webhook)) 18896 } 18897 18898 // GetDefault returns a default value of the field type 18899 func (fps *NotificationChannelSpecWebhook_FieldSubPath) GetDefault() interface{} { 18900 return fps.subPath.GetDefault() 18901 } 18902 18903 func (fps *NotificationChannelSpecWebhook_FieldSubPath) ClearValue(item *NotificationChannelSpec_Webhook) { 18904 if item != nil { 18905 switch fps.selector { 18906 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 18907 for _, subItem := range item.Headers { 18908 fps.subPath.ClearValueRaw(subItem) 18909 } 18910 default: 18911 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fps.selector)) 18912 } 18913 } 18914 } 18915 18916 func (fps *NotificationChannelSpecWebhook_FieldSubPath) ClearValueRaw(item proto.Message) { 18917 fps.ClearValue(item.(*NotificationChannelSpec_Webhook)) 18918 } 18919 18920 // IsLeaf - whether field path is holds simple value 18921 func (fps *NotificationChannelSpecWebhook_FieldSubPath) IsLeaf() bool { 18922 return fps.subPath.IsLeaf() 18923 } 18924 18925 func (fps *NotificationChannelSpecWebhook_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 18926 iPaths := []gotenobject.FieldPath{&NotificationChannelSpecWebhook_FieldTerminalPath{selector: fps.selector}} 18927 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 18928 return iPaths 18929 } 18930 18931 func (fps *NotificationChannelSpecWebhook_FieldSubPath) WithIValue(value interface{}) NotificationChannelSpecWebhook_FieldPathValue { 18932 return &NotificationChannelSpecWebhook_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 18933 } 18934 18935 func (fps *NotificationChannelSpecWebhook_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 18936 return fps.WithIValue(value) 18937 } 18938 18939 func (fps *NotificationChannelSpecWebhook_FieldSubPath) WithIArrayOfValues(values interface{}) NotificationChannelSpecWebhook_FieldPathArrayOfValues { 18940 return &NotificationChannelSpecWebhook_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 18941 } 18942 18943 func (fps *NotificationChannelSpecWebhook_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 18944 return fps.WithIArrayOfValues(values) 18945 } 18946 18947 func (fps *NotificationChannelSpecWebhook_FieldSubPath) WithIArrayItemValue(value interface{}) NotificationChannelSpecWebhook_FieldPathArrayItemValue { 18948 return &NotificationChannelSpecWebhook_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 18949 } 18950 18951 func (fps *NotificationChannelSpecWebhook_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 18952 return fps.WithIArrayItemValue(value) 18953 } 18954 18955 // NotificationChannelSpecWebhook_FieldPathValue allows storing values for Webhook fields according to their type 18956 type NotificationChannelSpecWebhook_FieldPathValue interface { 18957 NotificationChannelSpecWebhook_FieldPath 18958 gotenobject.FieldPathValue 18959 SetTo(target **NotificationChannelSpec_Webhook) 18960 CompareWith(*NotificationChannelSpec_Webhook) (cmp int, comparable bool) 18961 } 18962 18963 func ParseNotificationChannelSpecWebhook_FieldPathValue(pathStr, valueStr string) (NotificationChannelSpecWebhook_FieldPathValue, error) { 18964 fp, err := ParseNotificationChannelSpecWebhook_FieldPath(pathStr) 18965 if err != nil { 18966 return nil, err 18967 } 18968 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 18969 if err != nil { 18970 return nil, status.Errorf(codes.InvalidArgument, "error parsing Webhook field path value from %s: %v", valueStr, err) 18971 } 18972 return fpv.(NotificationChannelSpecWebhook_FieldPathValue), nil 18973 } 18974 18975 func MustParseNotificationChannelSpecWebhook_FieldPathValue(pathStr, valueStr string) NotificationChannelSpecWebhook_FieldPathValue { 18976 fpv, err := ParseNotificationChannelSpecWebhook_FieldPathValue(pathStr, valueStr) 18977 if err != nil { 18978 panic(err) 18979 } 18980 return fpv 18981 } 18982 18983 type NotificationChannelSpecWebhook_FieldTerminalPathValue struct { 18984 NotificationChannelSpecWebhook_FieldTerminalPath 18985 value interface{} 18986 } 18987 18988 var _ NotificationChannelSpecWebhook_FieldPathValue = (*NotificationChannelSpecWebhook_FieldTerminalPathValue)(nil) 18989 18990 // GetRawValue returns raw value stored under selected path for 'Webhook' as interface{} 18991 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) GetRawValue() interface{} { 18992 return fpv.value 18993 } 18994 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) AsUrlValue() (string, bool) { 18995 res, ok := fpv.value.(string) 18996 return res, ok 18997 } 18998 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) AsHeadersValue() ([]*NotificationChannelSpec_Webhook_Header, bool) { 18999 res, ok := fpv.value.([]*NotificationChannelSpec_Webhook_Header) 19000 return res, ok 19001 } 19002 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) AsMaxMessageSizeMbValue() (float64, bool) { 19003 res, ok := fpv.value.(float64) 19004 return res, ok 19005 } 19006 19007 // SetTo stores value for selected field for object Webhook 19008 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) SetTo(target **NotificationChannelSpec_Webhook) { 19009 if *target == nil { 19010 *target = new(NotificationChannelSpec_Webhook) 19011 } 19012 switch fpv.selector { 19013 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 19014 (*target).Url = fpv.value.(string) 19015 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 19016 (*target).Headers = fpv.value.([]*NotificationChannelSpec_Webhook_Header) 19017 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 19018 (*target).MaxMessageSizeMb = fpv.value.(float64) 19019 default: 19020 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fpv.selector)) 19021 } 19022 } 19023 19024 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) SetToRaw(target proto.Message) { 19025 typedObject := target.(*NotificationChannelSpec_Webhook) 19026 fpv.SetTo(&typedObject) 19027 } 19028 19029 // CompareWith compares value in the 'NotificationChannelSpecWebhook_FieldTerminalPathValue' with the value under path in 'NotificationChannelSpec_Webhook'. 19030 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) CompareWith(source *NotificationChannelSpec_Webhook) (int, bool) { 19031 switch fpv.selector { 19032 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 19033 leftValue := fpv.value.(string) 19034 rightValue := source.GetUrl() 19035 if (leftValue) == (rightValue) { 19036 return 0, true 19037 } else if (leftValue) < (rightValue) { 19038 return -1, true 19039 } else { 19040 return 1, true 19041 } 19042 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 19043 return 0, false 19044 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 19045 leftValue := fpv.value.(float64) 19046 rightValue := source.GetMaxMessageSizeMb() 19047 if (leftValue) == (rightValue) { 19048 return 0, true 19049 } else if (leftValue) < (rightValue) { 19050 return -1, true 19051 } else { 19052 return 1, true 19053 } 19054 default: 19055 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fpv.selector)) 19056 } 19057 } 19058 19059 func (fpv *NotificationChannelSpecWebhook_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 19060 return fpv.CompareWith(source.(*NotificationChannelSpec_Webhook)) 19061 } 19062 19063 type NotificationChannelSpecWebhook_FieldSubPathValue struct { 19064 NotificationChannelSpecWebhook_FieldPath 19065 subPathValue gotenobject.FieldPathValue 19066 } 19067 19068 var _ NotificationChannelSpecWebhook_FieldPathValue = (*NotificationChannelSpecWebhook_FieldSubPathValue)(nil) 19069 19070 func (fpvs *NotificationChannelSpecWebhook_FieldSubPathValue) AsHeadersPathValue() (NotificationChannelSpecWebhookHeader_FieldPathValue, bool) { 19071 res, ok := fpvs.subPathValue.(NotificationChannelSpecWebhookHeader_FieldPathValue) 19072 return res, ok 19073 } 19074 19075 func (fpvs *NotificationChannelSpecWebhook_FieldSubPathValue) SetTo(target **NotificationChannelSpec_Webhook) { 19076 if *target == nil { 19077 *target = new(NotificationChannelSpec_Webhook) 19078 } 19079 switch fpvs.Selector() { 19080 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 19081 panic("FieldPath setter is unsupported for array subpaths") 19082 default: 19083 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fpvs.Selector())) 19084 } 19085 } 19086 19087 func (fpvs *NotificationChannelSpecWebhook_FieldSubPathValue) SetToRaw(target proto.Message) { 19088 typedObject := target.(*NotificationChannelSpec_Webhook) 19089 fpvs.SetTo(&typedObject) 19090 } 19091 19092 func (fpvs *NotificationChannelSpecWebhook_FieldSubPathValue) GetRawValue() interface{} { 19093 return fpvs.subPathValue.GetRawValue() 19094 } 19095 19096 func (fpvs *NotificationChannelSpecWebhook_FieldSubPathValue) CompareWith(source *NotificationChannelSpec_Webhook) (int, bool) { 19097 switch fpvs.Selector() { 19098 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 19099 return 0, false // repeated field 19100 default: 19101 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fpvs.Selector())) 19102 } 19103 } 19104 19105 func (fpvs *NotificationChannelSpecWebhook_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 19106 return fpvs.CompareWith(source.(*NotificationChannelSpec_Webhook)) 19107 } 19108 19109 // NotificationChannelSpecWebhook_FieldPathArrayItemValue allows storing single item in Path-specific values for Webhook according to their type 19110 // Present only for array (repeated) types. 19111 type NotificationChannelSpecWebhook_FieldPathArrayItemValue interface { 19112 gotenobject.FieldPathArrayItemValue 19113 NotificationChannelSpecWebhook_FieldPath 19114 ContainsValue(*NotificationChannelSpec_Webhook) bool 19115 } 19116 19117 // ParseNotificationChannelSpecWebhook_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 19118 func ParseNotificationChannelSpecWebhook_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationChannelSpecWebhook_FieldPathArrayItemValue, error) { 19119 fp, err := ParseNotificationChannelSpecWebhook_FieldPath(pathStr) 19120 if err != nil { 19121 return nil, err 19122 } 19123 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 19124 if err != nil { 19125 return nil, status.Errorf(codes.InvalidArgument, "error parsing Webhook field path array item value from %s: %v", valueStr, err) 19126 } 19127 return fpaiv.(NotificationChannelSpecWebhook_FieldPathArrayItemValue), nil 19128 } 19129 19130 func MustParseNotificationChannelSpecWebhook_FieldPathArrayItemValue(pathStr, valueStr string) NotificationChannelSpecWebhook_FieldPathArrayItemValue { 19131 fpaiv, err := ParseNotificationChannelSpecWebhook_FieldPathArrayItemValue(pathStr, valueStr) 19132 if err != nil { 19133 panic(err) 19134 } 19135 return fpaiv 19136 } 19137 19138 type NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue struct { 19139 NotificationChannelSpecWebhook_FieldTerminalPath 19140 value interface{} 19141 } 19142 19143 var _ NotificationChannelSpecWebhook_FieldPathArrayItemValue = (*NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue)(nil) 19144 19145 // GetRawValue returns stored element value for array in object NotificationChannelSpec_Webhook as interface{} 19146 func (fpaiv *NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 19147 return fpaiv.value 19148 } 19149 func (fpaiv *NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue) AsHeadersItemValue() (*NotificationChannelSpec_Webhook_Header, bool) { 19150 res, ok := fpaiv.value.(*NotificationChannelSpec_Webhook_Header) 19151 return res, ok 19152 } 19153 19154 func (fpaiv *NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue) GetSingle(source *NotificationChannelSpec_Webhook) (interface{}, bool) { 19155 return nil, false 19156 } 19157 19158 func (fpaiv *NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 19159 return fpaiv.GetSingle(source.(*NotificationChannelSpec_Webhook)) 19160 } 19161 19162 // Contains returns a boolean indicating if value that is being held is present in given 'Webhook' 19163 func (fpaiv *NotificationChannelSpecWebhook_FieldTerminalPathArrayItemValue) ContainsValue(source *NotificationChannelSpec_Webhook) bool { 19164 slice := fpaiv.NotificationChannelSpecWebhook_FieldTerminalPath.Get(source) 19165 for _, v := range slice { 19166 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 19167 if proto.Equal(asProtoMsg, v.(proto.Message)) { 19168 return true 19169 } 19170 } else if reflect.DeepEqual(v, fpaiv.value) { 19171 return true 19172 } 19173 } 19174 return false 19175 } 19176 19177 type NotificationChannelSpecWebhook_FieldSubPathArrayItemValue struct { 19178 NotificationChannelSpecWebhook_FieldPath 19179 subPathItemValue gotenobject.FieldPathArrayItemValue 19180 } 19181 19182 // GetRawValue returns stored array item value 19183 func (fpaivs *NotificationChannelSpecWebhook_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 19184 return fpaivs.subPathItemValue.GetRawItemValue() 19185 } 19186 func (fpaivs *NotificationChannelSpecWebhook_FieldSubPathArrayItemValue) AsHeadersPathItemValue() (NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue, bool) { 19187 res, ok := fpaivs.subPathItemValue.(NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue) 19188 return res, ok 19189 } 19190 19191 // Contains returns a boolean indicating if value that is being held is present in given 'Webhook' 19192 func (fpaivs *NotificationChannelSpecWebhook_FieldSubPathArrayItemValue) ContainsValue(source *NotificationChannelSpec_Webhook) bool { 19193 switch fpaivs.Selector() { 19194 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 19195 return false // repeated/map field 19196 default: 19197 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook: %d", fpaivs.Selector())) 19198 } 19199 } 19200 19201 // NotificationChannelSpecWebhook_FieldPathArrayOfValues allows storing slice of values for Webhook fields according to their type 19202 type NotificationChannelSpecWebhook_FieldPathArrayOfValues interface { 19203 gotenobject.FieldPathArrayOfValues 19204 NotificationChannelSpecWebhook_FieldPath 19205 } 19206 19207 func ParseNotificationChannelSpecWebhook_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationChannelSpecWebhook_FieldPathArrayOfValues, error) { 19208 fp, err := ParseNotificationChannelSpecWebhook_FieldPath(pathStr) 19209 if err != nil { 19210 return nil, err 19211 } 19212 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 19213 if err != nil { 19214 return nil, status.Errorf(codes.InvalidArgument, "error parsing Webhook field path array of values from %s: %v", valuesStr, err) 19215 } 19216 return fpaov.(NotificationChannelSpecWebhook_FieldPathArrayOfValues), nil 19217 } 19218 19219 func MustParseNotificationChannelSpecWebhook_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationChannelSpecWebhook_FieldPathArrayOfValues { 19220 fpaov, err := ParseNotificationChannelSpecWebhook_FieldPathArrayOfValues(pathStr, valuesStr) 19221 if err != nil { 19222 panic(err) 19223 } 19224 return fpaov 19225 } 19226 19227 type NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues struct { 19228 NotificationChannelSpecWebhook_FieldTerminalPath 19229 values interface{} 19230 } 19231 19232 var _ NotificationChannelSpecWebhook_FieldPathArrayOfValues = (*NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues)(nil) 19233 19234 func (fpaov *NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 19235 switch fpaov.selector { 19236 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 19237 for _, v := range fpaov.values.([]string) { 19238 values = append(values, v) 19239 } 19240 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 19241 for _, v := range fpaov.values.([][]*NotificationChannelSpec_Webhook_Header) { 19242 values = append(values, v) 19243 } 19244 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 19245 for _, v := range fpaov.values.([]float64) { 19246 values = append(values, v) 19247 } 19248 } 19249 return 19250 } 19251 func (fpaov *NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues) AsUrlArrayOfValues() ([]string, bool) { 19252 res, ok := fpaov.values.([]string) 19253 return res, ok 19254 } 19255 func (fpaov *NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues) AsHeadersArrayOfValues() ([][]*NotificationChannelSpec_Webhook_Header, bool) { 19256 res, ok := fpaov.values.([][]*NotificationChannelSpec_Webhook_Header) 19257 return res, ok 19258 } 19259 func (fpaov *NotificationChannelSpecWebhook_FieldTerminalPathArrayOfValues) AsMaxMessageSizeMbArrayOfValues() ([]float64, bool) { 19260 res, ok := fpaov.values.([]float64) 19261 return res, ok 19262 } 19263 19264 type NotificationChannelSpecWebhook_FieldSubPathArrayOfValues struct { 19265 NotificationChannelSpecWebhook_FieldPath 19266 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 19267 } 19268 19269 var _ NotificationChannelSpecWebhook_FieldPathArrayOfValues = (*NotificationChannelSpecWebhook_FieldSubPathArrayOfValues)(nil) 19270 19271 func (fpsaov *NotificationChannelSpecWebhook_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 19272 return fpsaov.subPathArrayOfValues.GetRawValues() 19273 } 19274 func (fpsaov *NotificationChannelSpecWebhook_FieldSubPathArrayOfValues) AsHeadersPathArrayOfValues() (NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues, bool) { 19275 res, ok := fpsaov.subPathArrayOfValues.(NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues) 19276 return res, ok 19277 } 19278 19279 // FieldPath provides implementation to handle 19280 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 19281 type NotificationChannelSpecWebhookHeader_FieldPath interface { 19282 gotenobject.FieldPath 19283 Selector() NotificationChannelSpecWebhookHeader_FieldPathSelector 19284 Get(source *NotificationChannelSpec_Webhook_Header) []interface{} 19285 GetSingle(source *NotificationChannelSpec_Webhook_Header) (interface{}, bool) 19286 ClearValue(item *NotificationChannelSpec_Webhook_Header) 19287 19288 // Those methods build corresponding NotificationChannelSpecWebhookHeader_FieldPathValue 19289 // (or array of values) and holds passed value. Panics if injected type is incorrect. 19290 WithIValue(value interface{}) NotificationChannelSpecWebhookHeader_FieldPathValue 19291 WithIArrayOfValues(values interface{}) NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues 19292 WithIArrayItemValue(value interface{}) NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue 19293 } 19294 19295 type NotificationChannelSpecWebhookHeader_FieldPathSelector int32 19296 19297 const ( 19298 NotificationChannelSpecWebhookHeader_FieldPathSelectorKey NotificationChannelSpecWebhookHeader_FieldPathSelector = 0 19299 NotificationChannelSpecWebhookHeader_FieldPathSelectorValue NotificationChannelSpecWebhookHeader_FieldPathSelector = 1 19300 ) 19301 19302 func (s NotificationChannelSpecWebhookHeader_FieldPathSelector) String() string { 19303 switch s { 19304 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19305 return "key" 19306 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19307 return "value" 19308 default: 19309 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", s)) 19310 } 19311 } 19312 19313 func BuildNotificationChannelSpecWebhookHeader_FieldPath(fp gotenobject.RawFieldPath) (NotificationChannelSpecWebhookHeader_FieldPath, error) { 19314 if len(fp) == 0 { 19315 return nil, status.Error(codes.InvalidArgument, "empty field path for object NotificationChannelSpec_Webhook_Header") 19316 } 19317 if len(fp) == 1 { 19318 switch fp[0] { 19319 case "key": 19320 return &NotificationChannelSpecWebhookHeader_FieldTerminalPath{selector: NotificationChannelSpecWebhookHeader_FieldPathSelectorKey}, nil 19321 case "value": 19322 return &NotificationChannelSpecWebhookHeader_FieldTerminalPath{selector: NotificationChannelSpecWebhookHeader_FieldPathSelectorValue}, nil 19323 } 19324 } 19325 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object NotificationChannelSpec_Webhook_Header", fp) 19326 } 19327 19328 func ParseNotificationChannelSpecWebhookHeader_FieldPath(rawField string) (NotificationChannelSpecWebhookHeader_FieldPath, error) { 19329 fp, err := gotenobject.ParseRawFieldPath(rawField) 19330 if err != nil { 19331 return nil, err 19332 } 19333 return BuildNotificationChannelSpecWebhookHeader_FieldPath(fp) 19334 } 19335 19336 func MustParseNotificationChannelSpecWebhookHeader_FieldPath(rawField string) NotificationChannelSpecWebhookHeader_FieldPath { 19337 fp, err := ParseNotificationChannelSpecWebhookHeader_FieldPath(rawField) 19338 if err != nil { 19339 panic(err) 19340 } 19341 return fp 19342 } 19343 19344 type NotificationChannelSpecWebhookHeader_FieldTerminalPath struct { 19345 selector NotificationChannelSpecWebhookHeader_FieldPathSelector 19346 } 19347 19348 var _ NotificationChannelSpecWebhookHeader_FieldPath = (*NotificationChannelSpecWebhookHeader_FieldTerminalPath)(nil) 19349 19350 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) Selector() NotificationChannelSpecWebhookHeader_FieldPathSelector { 19351 return fp.selector 19352 } 19353 19354 // String returns path representation in proto convention 19355 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) String() string { 19356 return fp.selector.String() 19357 } 19358 19359 // JSONString returns path representation is JSON convention 19360 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) JSONString() string { 19361 return strcase.ToLowerCamel(fp.String()) 19362 } 19363 19364 // Get returns all values pointed by specific field from source NotificationChannelSpec_Webhook_Header 19365 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) Get(source *NotificationChannelSpec_Webhook_Header) (values []interface{}) { 19366 if source != nil { 19367 switch fp.selector { 19368 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19369 values = append(values, source.Key) 19370 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19371 values = append(values, source.Value) 19372 default: 19373 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fp.selector)) 19374 } 19375 } 19376 return 19377 } 19378 19379 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 19380 return fp.Get(source.(*NotificationChannelSpec_Webhook_Header)) 19381 } 19382 19383 // GetSingle returns value pointed by specific field of from source NotificationChannelSpec_Webhook_Header 19384 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) GetSingle(source *NotificationChannelSpec_Webhook_Header) (interface{}, bool) { 19385 switch fp.selector { 19386 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19387 return source.GetKey(), source != nil 19388 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19389 return source.GetValue(), source != nil 19390 default: 19391 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fp.selector)) 19392 } 19393 } 19394 19395 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 19396 return fp.GetSingle(source.(*NotificationChannelSpec_Webhook_Header)) 19397 } 19398 19399 // GetDefault returns a default value of the field type 19400 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) GetDefault() interface{} { 19401 switch fp.selector { 19402 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19403 return "" 19404 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19405 return "" 19406 default: 19407 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fp.selector)) 19408 } 19409 } 19410 19411 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) ClearValue(item *NotificationChannelSpec_Webhook_Header) { 19412 if item != nil { 19413 switch fp.selector { 19414 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19415 item.Key = "" 19416 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19417 item.Value = "" 19418 default: 19419 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fp.selector)) 19420 } 19421 } 19422 } 19423 19424 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) ClearValueRaw(item proto.Message) { 19425 fp.ClearValue(item.(*NotificationChannelSpec_Webhook_Header)) 19426 } 19427 19428 // IsLeaf - whether field path is holds simple value 19429 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) IsLeaf() bool { 19430 return fp.selector == NotificationChannelSpecWebhookHeader_FieldPathSelectorKey || 19431 fp.selector == NotificationChannelSpecWebhookHeader_FieldPathSelectorValue 19432 } 19433 19434 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 19435 return []gotenobject.FieldPath{fp} 19436 } 19437 19438 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) WithIValue(value interface{}) NotificationChannelSpecWebhookHeader_FieldPathValue { 19439 switch fp.selector { 19440 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19441 return &NotificationChannelSpecWebhookHeader_FieldTerminalPathValue{NotificationChannelSpecWebhookHeader_FieldTerminalPath: *fp, value: value.(string)} 19442 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19443 return &NotificationChannelSpecWebhookHeader_FieldTerminalPathValue{NotificationChannelSpecWebhookHeader_FieldTerminalPath: *fp, value: value.(string)} 19444 default: 19445 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fp.selector)) 19446 } 19447 } 19448 19449 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 19450 return fp.WithIValue(value) 19451 } 19452 19453 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) WithIArrayOfValues(values interface{}) NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues { 19454 fpaov := &NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues{NotificationChannelSpecWebhookHeader_FieldTerminalPath: *fp} 19455 switch fp.selector { 19456 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19457 return &NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues{NotificationChannelSpecWebhookHeader_FieldTerminalPath: *fp, values: values.([]string)} 19458 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19459 return &NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues{NotificationChannelSpecWebhookHeader_FieldTerminalPath: *fp, values: values.([]string)} 19460 default: 19461 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fp.selector)) 19462 } 19463 return fpaov 19464 } 19465 19466 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 19467 return fp.WithIArrayOfValues(values) 19468 } 19469 19470 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) WithIArrayItemValue(value interface{}) NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue { 19471 switch fp.selector { 19472 default: 19473 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fp.selector)) 19474 } 19475 } 19476 19477 func (fp *NotificationChannelSpecWebhookHeader_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 19478 return fp.WithIArrayItemValue(value) 19479 } 19480 19481 // NotificationChannelSpecWebhookHeader_FieldPathValue allows storing values for Header fields according to their type 19482 type NotificationChannelSpecWebhookHeader_FieldPathValue interface { 19483 NotificationChannelSpecWebhookHeader_FieldPath 19484 gotenobject.FieldPathValue 19485 SetTo(target **NotificationChannelSpec_Webhook_Header) 19486 CompareWith(*NotificationChannelSpec_Webhook_Header) (cmp int, comparable bool) 19487 } 19488 19489 func ParseNotificationChannelSpecWebhookHeader_FieldPathValue(pathStr, valueStr string) (NotificationChannelSpecWebhookHeader_FieldPathValue, error) { 19490 fp, err := ParseNotificationChannelSpecWebhookHeader_FieldPath(pathStr) 19491 if err != nil { 19492 return nil, err 19493 } 19494 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 19495 if err != nil { 19496 return nil, status.Errorf(codes.InvalidArgument, "error parsing Header field path value from %s: %v", valueStr, err) 19497 } 19498 return fpv.(NotificationChannelSpecWebhookHeader_FieldPathValue), nil 19499 } 19500 19501 func MustParseNotificationChannelSpecWebhookHeader_FieldPathValue(pathStr, valueStr string) NotificationChannelSpecWebhookHeader_FieldPathValue { 19502 fpv, err := ParseNotificationChannelSpecWebhookHeader_FieldPathValue(pathStr, valueStr) 19503 if err != nil { 19504 panic(err) 19505 } 19506 return fpv 19507 } 19508 19509 type NotificationChannelSpecWebhookHeader_FieldTerminalPathValue struct { 19510 NotificationChannelSpecWebhookHeader_FieldTerminalPath 19511 value interface{} 19512 } 19513 19514 var _ NotificationChannelSpecWebhookHeader_FieldPathValue = (*NotificationChannelSpecWebhookHeader_FieldTerminalPathValue)(nil) 19515 19516 // GetRawValue returns raw value stored under selected path for 'Header' as interface{} 19517 func (fpv *NotificationChannelSpecWebhookHeader_FieldTerminalPathValue) GetRawValue() interface{} { 19518 return fpv.value 19519 } 19520 func (fpv *NotificationChannelSpecWebhookHeader_FieldTerminalPathValue) AsKeyValue() (string, bool) { 19521 res, ok := fpv.value.(string) 19522 return res, ok 19523 } 19524 func (fpv *NotificationChannelSpecWebhookHeader_FieldTerminalPathValue) AsValueValue() (string, bool) { 19525 res, ok := fpv.value.(string) 19526 return res, ok 19527 } 19528 19529 // SetTo stores value for selected field for object Header 19530 func (fpv *NotificationChannelSpecWebhookHeader_FieldTerminalPathValue) SetTo(target **NotificationChannelSpec_Webhook_Header) { 19531 if *target == nil { 19532 *target = new(NotificationChannelSpec_Webhook_Header) 19533 } 19534 switch fpv.selector { 19535 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19536 (*target).Key = fpv.value.(string) 19537 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19538 (*target).Value = fpv.value.(string) 19539 default: 19540 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fpv.selector)) 19541 } 19542 } 19543 19544 func (fpv *NotificationChannelSpecWebhookHeader_FieldTerminalPathValue) SetToRaw(target proto.Message) { 19545 typedObject := target.(*NotificationChannelSpec_Webhook_Header) 19546 fpv.SetTo(&typedObject) 19547 } 19548 19549 // CompareWith compares value in the 'NotificationChannelSpecWebhookHeader_FieldTerminalPathValue' with the value under path in 'NotificationChannelSpec_Webhook_Header'. 19550 func (fpv *NotificationChannelSpecWebhookHeader_FieldTerminalPathValue) CompareWith(source *NotificationChannelSpec_Webhook_Header) (int, bool) { 19551 switch fpv.selector { 19552 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19553 leftValue := fpv.value.(string) 19554 rightValue := source.GetKey() 19555 if (leftValue) == (rightValue) { 19556 return 0, true 19557 } else if (leftValue) < (rightValue) { 19558 return -1, true 19559 } else { 19560 return 1, true 19561 } 19562 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19563 leftValue := fpv.value.(string) 19564 rightValue := source.GetValue() 19565 if (leftValue) == (rightValue) { 19566 return 0, true 19567 } else if (leftValue) < (rightValue) { 19568 return -1, true 19569 } else { 19570 return 1, true 19571 } 19572 default: 19573 panic(fmt.Sprintf("Invalid selector for NotificationChannelSpec_Webhook_Header: %d", fpv.selector)) 19574 } 19575 } 19576 19577 func (fpv *NotificationChannelSpecWebhookHeader_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 19578 return fpv.CompareWith(source.(*NotificationChannelSpec_Webhook_Header)) 19579 } 19580 19581 // NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue allows storing single item in Path-specific values for Header according to their type 19582 // Present only for array (repeated) types. 19583 type NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue interface { 19584 gotenobject.FieldPathArrayItemValue 19585 NotificationChannelSpecWebhookHeader_FieldPath 19586 ContainsValue(*NotificationChannelSpec_Webhook_Header) bool 19587 } 19588 19589 // ParseNotificationChannelSpecWebhookHeader_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 19590 func ParseNotificationChannelSpecWebhookHeader_FieldPathArrayItemValue(pathStr, valueStr string) (NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue, error) { 19591 fp, err := ParseNotificationChannelSpecWebhookHeader_FieldPath(pathStr) 19592 if err != nil { 19593 return nil, err 19594 } 19595 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 19596 if err != nil { 19597 return nil, status.Errorf(codes.InvalidArgument, "error parsing Header field path array item value from %s: %v", valueStr, err) 19598 } 19599 return fpaiv.(NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue), nil 19600 } 19601 19602 func MustParseNotificationChannelSpecWebhookHeader_FieldPathArrayItemValue(pathStr, valueStr string) NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue { 19603 fpaiv, err := ParseNotificationChannelSpecWebhookHeader_FieldPathArrayItemValue(pathStr, valueStr) 19604 if err != nil { 19605 panic(err) 19606 } 19607 return fpaiv 19608 } 19609 19610 type NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayItemValue struct { 19611 NotificationChannelSpecWebhookHeader_FieldTerminalPath 19612 value interface{} 19613 } 19614 19615 var _ NotificationChannelSpecWebhookHeader_FieldPathArrayItemValue = (*NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayItemValue)(nil) 19616 19617 // GetRawValue returns stored element value for array in object NotificationChannelSpec_Webhook_Header as interface{} 19618 func (fpaiv *NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 19619 return fpaiv.value 19620 } 19621 19622 func (fpaiv *NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayItemValue) GetSingle(source *NotificationChannelSpec_Webhook_Header) (interface{}, bool) { 19623 return nil, false 19624 } 19625 19626 func (fpaiv *NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 19627 return fpaiv.GetSingle(source.(*NotificationChannelSpec_Webhook_Header)) 19628 } 19629 19630 // Contains returns a boolean indicating if value that is being held is present in given 'Header' 19631 func (fpaiv *NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayItemValue) ContainsValue(source *NotificationChannelSpec_Webhook_Header) bool { 19632 slice := fpaiv.NotificationChannelSpecWebhookHeader_FieldTerminalPath.Get(source) 19633 for _, v := range slice { 19634 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 19635 if proto.Equal(asProtoMsg, v.(proto.Message)) { 19636 return true 19637 } 19638 } else if reflect.DeepEqual(v, fpaiv.value) { 19639 return true 19640 } 19641 } 19642 return false 19643 } 19644 19645 // NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues allows storing slice of values for Header fields according to their type 19646 type NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues interface { 19647 gotenobject.FieldPathArrayOfValues 19648 NotificationChannelSpecWebhookHeader_FieldPath 19649 } 19650 19651 func ParseNotificationChannelSpecWebhookHeader_FieldPathArrayOfValues(pathStr, valuesStr string) (NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues, error) { 19652 fp, err := ParseNotificationChannelSpecWebhookHeader_FieldPath(pathStr) 19653 if err != nil { 19654 return nil, err 19655 } 19656 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 19657 if err != nil { 19658 return nil, status.Errorf(codes.InvalidArgument, "error parsing Header field path array of values from %s: %v", valuesStr, err) 19659 } 19660 return fpaov.(NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues), nil 19661 } 19662 19663 func MustParseNotificationChannelSpecWebhookHeader_FieldPathArrayOfValues(pathStr, valuesStr string) NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues { 19664 fpaov, err := ParseNotificationChannelSpecWebhookHeader_FieldPathArrayOfValues(pathStr, valuesStr) 19665 if err != nil { 19666 panic(err) 19667 } 19668 return fpaov 19669 } 19670 19671 type NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues struct { 19672 NotificationChannelSpecWebhookHeader_FieldTerminalPath 19673 values interface{} 19674 } 19675 19676 var _ NotificationChannelSpecWebhookHeader_FieldPathArrayOfValues = (*NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues)(nil) 19677 19678 func (fpaov *NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 19679 switch fpaov.selector { 19680 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 19681 for _, v := range fpaov.values.([]string) { 19682 values = append(values, v) 19683 } 19684 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 19685 for _, v := range fpaov.values.([]string) { 19686 values = append(values, v) 19687 } 19688 } 19689 return 19690 } 19691 func (fpaov *NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues) AsKeyArrayOfValues() ([]string, bool) { 19692 res, ok := fpaov.values.([]string) 19693 return res, ok 19694 } 19695 func (fpaov *NotificationChannelSpecWebhookHeader_FieldTerminalPathArrayOfValues) AsValueArrayOfValues() ([]string, bool) { 19696 res, ok := fpaov.values.([]string) 19697 return res, ok 19698 } 19699 19700 // FieldPath provides implementation to handle 19701 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 19702 type AlertingThreshold_FieldPath interface { 19703 gotenobject.FieldPath 19704 Selector() AlertingThreshold_FieldPathSelector 19705 Get(source *AlertingThreshold) []interface{} 19706 GetSingle(source *AlertingThreshold) (interface{}, bool) 19707 ClearValue(item *AlertingThreshold) 19708 19709 // Those methods build corresponding AlertingThreshold_FieldPathValue 19710 // (or array of values) and holds passed value. Panics if injected type is incorrect. 19711 WithIValue(value interface{}) AlertingThreshold_FieldPathValue 19712 WithIArrayOfValues(values interface{}) AlertingThreshold_FieldPathArrayOfValues 19713 WithIArrayItemValue(value interface{}) AlertingThreshold_FieldPathArrayItemValue 19714 } 19715 19716 type AlertingThreshold_FieldPathSelector int32 19717 19718 const ( 19719 AlertingThreshold_FieldPathSelectorValue AlertingThreshold_FieldPathSelector = 0 19720 AlertingThreshold_FieldPathSelectorIsInclusive AlertingThreshold_FieldPathSelector = 1 19721 ) 19722 19723 func (s AlertingThreshold_FieldPathSelector) String() string { 19724 switch s { 19725 case AlertingThreshold_FieldPathSelectorValue: 19726 return "value" 19727 case AlertingThreshold_FieldPathSelectorIsInclusive: 19728 return "is_inclusive" 19729 default: 19730 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", s)) 19731 } 19732 } 19733 19734 func BuildAlertingThreshold_FieldPath(fp gotenobject.RawFieldPath) (AlertingThreshold_FieldPath, error) { 19735 if len(fp) == 0 { 19736 return nil, status.Error(codes.InvalidArgument, "empty field path for object AlertingThreshold") 19737 } 19738 if len(fp) == 1 { 19739 switch fp[0] { 19740 case "value": 19741 return &AlertingThreshold_FieldTerminalPath{selector: AlertingThreshold_FieldPathSelectorValue}, nil 19742 case "is_inclusive", "isInclusive", "is-inclusive": 19743 return &AlertingThreshold_FieldTerminalPath{selector: AlertingThreshold_FieldPathSelectorIsInclusive}, nil 19744 } 19745 } 19746 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object AlertingThreshold", fp) 19747 } 19748 19749 func ParseAlertingThreshold_FieldPath(rawField string) (AlertingThreshold_FieldPath, error) { 19750 fp, err := gotenobject.ParseRawFieldPath(rawField) 19751 if err != nil { 19752 return nil, err 19753 } 19754 return BuildAlertingThreshold_FieldPath(fp) 19755 } 19756 19757 func MustParseAlertingThreshold_FieldPath(rawField string) AlertingThreshold_FieldPath { 19758 fp, err := ParseAlertingThreshold_FieldPath(rawField) 19759 if err != nil { 19760 panic(err) 19761 } 19762 return fp 19763 } 19764 19765 type AlertingThreshold_FieldTerminalPath struct { 19766 selector AlertingThreshold_FieldPathSelector 19767 } 19768 19769 var _ AlertingThreshold_FieldPath = (*AlertingThreshold_FieldTerminalPath)(nil) 19770 19771 func (fp *AlertingThreshold_FieldTerminalPath) Selector() AlertingThreshold_FieldPathSelector { 19772 return fp.selector 19773 } 19774 19775 // String returns path representation in proto convention 19776 func (fp *AlertingThreshold_FieldTerminalPath) String() string { 19777 return fp.selector.String() 19778 } 19779 19780 // JSONString returns path representation is JSON convention 19781 func (fp *AlertingThreshold_FieldTerminalPath) JSONString() string { 19782 return strcase.ToLowerCamel(fp.String()) 19783 } 19784 19785 // Get returns all values pointed by specific field from source AlertingThreshold 19786 func (fp *AlertingThreshold_FieldTerminalPath) Get(source *AlertingThreshold) (values []interface{}) { 19787 if source != nil { 19788 switch fp.selector { 19789 case AlertingThreshold_FieldPathSelectorValue: 19790 values = append(values, source.Value) 19791 case AlertingThreshold_FieldPathSelectorIsInclusive: 19792 values = append(values, source.IsInclusive) 19793 default: 19794 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fp.selector)) 19795 } 19796 } 19797 return 19798 } 19799 19800 func (fp *AlertingThreshold_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 19801 return fp.Get(source.(*AlertingThreshold)) 19802 } 19803 19804 // GetSingle returns value pointed by specific field of from source AlertingThreshold 19805 func (fp *AlertingThreshold_FieldTerminalPath) GetSingle(source *AlertingThreshold) (interface{}, bool) { 19806 switch fp.selector { 19807 case AlertingThreshold_FieldPathSelectorValue: 19808 return source.GetValue(), source != nil 19809 case AlertingThreshold_FieldPathSelectorIsInclusive: 19810 return source.GetIsInclusive(), source != nil 19811 default: 19812 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fp.selector)) 19813 } 19814 } 19815 19816 func (fp *AlertingThreshold_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 19817 return fp.GetSingle(source.(*AlertingThreshold)) 19818 } 19819 19820 // GetDefault returns a default value of the field type 19821 func (fp *AlertingThreshold_FieldTerminalPath) GetDefault() interface{} { 19822 switch fp.selector { 19823 case AlertingThreshold_FieldPathSelectorValue: 19824 return float64(0) 19825 case AlertingThreshold_FieldPathSelectorIsInclusive: 19826 return false 19827 default: 19828 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fp.selector)) 19829 } 19830 } 19831 19832 func (fp *AlertingThreshold_FieldTerminalPath) ClearValue(item *AlertingThreshold) { 19833 if item != nil { 19834 switch fp.selector { 19835 case AlertingThreshold_FieldPathSelectorValue: 19836 item.Value = float64(0) 19837 case AlertingThreshold_FieldPathSelectorIsInclusive: 19838 item.IsInclusive = false 19839 default: 19840 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fp.selector)) 19841 } 19842 } 19843 } 19844 19845 func (fp *AlertingThreshold_FieldTerminalPath) ClearValueRaw(item proto.Message) { 19846 fp.ClearValue(item.(*AlertingThreshold)) 19847 } 19848 19849 // IsLeaf - whether field path is holds simple value 19850 func (fp *AlertingThreshold_FieldTerminalPath) IsLeaf() bool { 19851 return fp.selector == AlertingThreshold_FieldPathSelectorValue || 19852 fp.selector == AlertingThreshold_FieldPathSelectorIsInclusive 19853 } 19854 19855 func (fp *AlertingThreshold_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 19856 return []gotenobject.FieldPath{fp} 19857 } 19858 19859 func (fp *AlertingThreshold_FieldTerminalPath) WithIValue(value interface{}) AlertingThreshold_FieldPathValue { 19860 switch fp.selector { 19861 case AlertingThreshold_FieldPathSelectorValue: 19862 return &AlertingThreshold_FieldTerminalPathValue{AlertingThreshold_FieldTerminalPath: *fp, value: value.(float64)} 19863 case AlertingThreshold_FieldPathSelectorIsInclusive: 19864 return &AlertingThreshold_FieldTerminalPathValue{AlertingThreshold_FieldTerminalPath: *fp, value: value.(bool)} 19865 default: 19866 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fp.selector)) 19867 } 19868 } 19869 19870 func (fp *AlertingThreshold_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 19871 return fp.WithIValue(value) 19872 } 19873 19874 func (fp *AlertingThreshold_FieldTerminalPath) WithIArrayOfValues(values interface{}) AlertingThreshold_FieldPathArrayOfValues { 19875 fpaov := &AlertingThreshold_FieldTerminalPathArrayOfValues{AlertingThreshold_FieldTerminalPath: *fp} 19876 switch fp.selector { 19877 case AlertingThreshold_FieldPathSelectorValue: 19878 return &AlertingThreshold_FieldTerminalPathArrayOfValues{AlertingThreshold_FieldTerminalPath: *fp, values: values.([]float64)} 19879 case AlertingThreshold_FieldPathSelectorIsInclusive: 19880 return &AlertingThreshold_FieldTerminalPathArrayOfValues{AlertingThreshold_FieldTerminalPath: *fp, values: values.([]bool)} 19881 default: 19882 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fp.selector)) 19883 } 19884 return fpaov 19885 } 19886 19887 func (fp *AlertingThreshold_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 19888 return fp.WithIArrayOfValues(values) 19889 } 19890 19891 func (fp *AlertingThreshold_FieldTerminalPath) WithIArrayItemValue(value interface{}) AlertingThreshold_FieldPathArrayItemValue { 19892 switch fp.selector { 19893 default: 19894 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fp.selector)) 19895 } 19896 } 19897 19898 func (fp *AlertingThreshold_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 19899 return fp.WithIArrayItemValue(value) 19900 } 19901 19902 // AlertingThreshold_FieldPathValue allows storing values for AlertingThreshold fields according to their type 19903 type AlertingThreshold_FieldPathValue interface { 19904 AlertingThreshold_FieldPath 19905 gotenobject.FieldPathValue 19906 SetTo(target **AlertingThreshold) 19907 CompareWith(*AlertingThreshold) (cmp int, comparable bool) 19908 } 19909 19910 func ParseAlertingThreshold_FieldPathValue(pathStr, valueStr string) (AlertingThreshold_FieldPathValue, error) { 19911 fp, err := ParseAlertingThreshold_FieldPath(pathStr) 19912 if err != nil { 19913 return nil, err 19914 } 19915 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 19916 if err != nil { 19917 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingThreshold field path value from %s: %v", valueStr, err) 19918 } 19919 return fpv.(AlertingThreshold_FieldPathValue), nil 19920 } 19921 19922 func MustParseAlertingThreshold_FieldPathValue(pathStr, valueStr string) AlertingThreshold_FieldPathValue { 19923 fpv, err := ParseAlertingThreshold_FieldPathValue(pathStr, valueStr) 19924 if err != nil { 19925 panic(err) 19926 } 19927 return fpv 19928 } 19929 19930 type AlertingThreshold_FieldTerminalPathValue struct { 19931 AlertingThreshold_FieldTerminalPath 19932 value interface{} 19933 } 19934 19935 var _ AlertingThreshold_FieldPathValue = (*AlertingThreshold_FieldTerminalPathValue)(nil) 19936 19937 // GetRawValue returns raw value stored under selected path for 'AlertingThreshold' as interface{} 19938 func (fpv *AlertingThreshold_FieldTerminalPathValue) GetRawValue() interface{} { 19939 return fpv.value 19940 } 19941 func (fpv *AlertingThreshold_FieldTerminalPathValue) AsValueValue() (float64, bool) { 19942 res, ok := fpv.value.(float64) 19943 return res, ok 19944 } 19945 func (fpv *AlertingThreshold_FieldTerminalPathValue) AsIsInclusiveValue() (bool, bool) { 19946 res, ok := fpv.value.(bool) 19947 return res, ok 19948 } 19949 19950 // SetTo stores value for selected field for object AlertingThreshold 19951 func (fpv *AlertingThreshold_FieldTerminalPathValue) SetTo(target **AlertingThreshold) { 19952 if *target == nil { 19953 *target = new(AlertingThreshold) 19954 } 19955 switch fpv.selector { 19956 case AlertingThreshold_FieldPathSelectorValue: 19957 (*target).Value = fpv.value.(float64) 19958 case AlertingThreshold_FieldPathSelectorIsInclusive: 19959 (*target).IsInclusive = fpv.value.(bool) 19960 default: 19961 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fpv.selector)) 19962 } 19963 } 19964 19965 func (fpv *AlertingThreshold_FieldTerminalPathValue) SetToRaw(target proto.Message) { 19966 typedObject := target.(*AlertingThreshold) 19967 fpv.SetTo(&typedObject) 19968 } 19969 19970 // CompareWith compares value in the 'AlertingThreshold_FieldTerminalPathValue' with the value under path in 'AlertingThreshold'. 19971 func (fpv *AlertingThreshold_FieldTerminalPathValue) CompareWith(source *AlertingThreshold) (int, bool) { 19972 switch fpv.selector { 19973 case AlertingThreshold_FieldPathSelectorValue: 19974 leftValue := fpv.value.(float64) 19975 rightValue := source.GetValue() 19976 if (leftValue) == (rightValue) { 19977 return 0, true 19978 } else if (leftValue) < (rightValue) { 19979 return -1, true 19980 } else { 19981 return 1, true 19982 } 19983 case AlertingThreshold_FieldPathSelectorIsInclusive: 19984 leftValue := fpv.value.(bool) 19985 rightValue := source.GetIsInclusive() 19986 if (leftValue) == (rightValue) { 19987 return 0, true 19988 } else if !(leftValue) && (rightValue) { 19989 return -1, true 19990 } else { 19991 return 1, true 19992 } 19993 default: 19994 panic(fmt.Sprintf("Invalid selector for AlertingThreshold: %d", fpv.selector)) 19995 } 19996 } 19997 19998 func (fpv *AlertingThreshold_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 19999 return fpv.CompareWith(source.(*AlertingThreshold)) 20000 } 20001 20002 // AlertingThreshold_FieldPathArrayItemValue allows storing single item in Path-specific values for AlertingThreshold according to their type 20003 // Present only for array (repeated) types. 20004 type AlertingThreshold_FieldPathArrayItemValue interface { 20005 gotenobject.FieldPathArrayItemValue 20006 AlertingThreshold_FieldPath 20007 ContainsValue(*AlertingThreshold) bool 20008 } 20009 20010 // ParseAlertingThreshold_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 20011 func ParseAlertingThreshold_FieldPathArrayItemValue(pathStr, valueStr string) (AlertingThreshold_FieldPathArrayItemValue, error) { 20012 fp, err := ParseAlertingThreshold_FieldPath(pathStr) 20013 if err != nil { 20014 return nil, err 20015 } 20016 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 20017 if err != nil { 20018 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingThreshold field path array item value from %s: %v", valueStr, err) 20019 } 20020 return fpaiv.(AlertingThreshold_FieldPathArrayItemValue), nil 20021 } 20022 20023 func MustParseAlertingThreshold_FieldPathArrayItemValue(pathStr, valueStr string) AlertingThreshold_FieldPathArrayItemValue { 20024 fpaiv, err := ParseAlertingThreshold_FieldPathArrayItemValue(pathStr, valueStr) 20025 if err != nil { 20026 panic(err) 20027 } 20028 return fpaiv 20029 } 20030 20031 type AlertingThreshold_FieldTerminalPathArrayItemValue struct { 20032 AlertingThreshold_FieldTerminalPath 20033 value interface{} 20034 } 20035 20036 var _ AlertingThreshold_FieldPathArrayItemValue = (*AlertingThreshold_FieldTerminalPathArrayItemValue)(nil) 20037 20038 // GetRawValue returns stored element value for array in object AlertingThreshold as interface{} 20039 func (fpaiv *AlertingThreshold_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 20040 return fpaiv.value 20041 } 20042 20043 func (fpaiv *AlertingThreshold_FieldTerminalPathArrayItemValue) GetSingle(source *AlertingThreshold) (interface{}, bool) { 20044 return nil, false 20045 } 20046 20047 func (fpaiv *AlertingThreshold_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 20048 return fpaiv.GetSingle(source.(*AlertingThreshold)) 20049 } 20050 20051 // Contains returns a boolean indicating if value that is being held is present in given 'AlertingThreshold' 20052 func (fpaiv *AlertingThreshold_FieldTerminalPathArrayItemValue) ContainsValue(source *AlertingThreshold) bool { 20053 slice := fpaiv.AlertingThreshold_FieldTerminalPath.Get(source) 20054 for _, v := range slice { 20055 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 20056 if proto.Equal(asProtoMsg, v.(proto.Message)) { 20057 return true 20058 } 20059 } else if reflect.DeepEqual(v, fpaiv.value) { 20060 return true 20061 } 20062 } 20063 return false 20064 } 20065 20066 // AlertingThreshold_FieldPathArrayOfValues allows storing slice of values for AlertingThreshold fields according to their type 20067 type AlertingThreshold_FieldPathArrayOfValues interface { 20068 gotenobject.FieldPathArrayOfValues 20069 AlertingThreshold_FieldPath 20070 } 20071 20072 func ParseAlertingThreshold_FieldPathArrayOfValues(pathStr, valuesStr string) (AlertingThreshold_FieldPathArrayOfValues, error) { 20073 fp, err := ParseAlertingThreshold_FieldPath(pathStr) 20074 if err != nil { 20075 return nil, err 20076 } 20077 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 20078 if err != nil { 20079 return nil, status.Errorf(codes.InvalidArgument, "error parsing AlertingThreshold field path array of values from %s: %v", valuesStr, err) 20080 } 20081 return fpaov.(AlertingThreshold_FieldPathArrayOfValues), nil 20082 } 20083 20084 func MustParseAlertingThreshold_FieldPathArrayOfValues(pathStr, valuesStr string) AlertingThreshold_FieldPathArrayOfValues { 20085 fpaov, err := ParseAlertingThreshold_FieldPathArrayOfValues(pathStr, valuesStr) 20086 if err != nil { 20087 panic(err) 20088 } 20089 return fpaov 20090 } 20091 20092 type AlertingThreshold_FieldTerminalPathArrayOfValues struct { 20093 AlertingThreshold_FieldTerminalPath 20094 values interface{} 20095 } 20096 20097 var _ AlertingThreshold_FieldPathArrayOfValues = (*AlertingThreshold_FieldTerminalPathArrayOfValues)(nil) 20098 20099 func (fpaov *AlertingThreshold_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 20100 switch fpaov.selector { 20101 case AlertingThreshold_FieldPathSelectorValue: 20102 for _, v := range fpaov.values.([]float64) { 20103 values = append(values, v) 20104 } 20105 case AlertingThreshold_FieldPathSelectorIsInclusive: 20106 for _, v := range fpaov.values.([]bool) { 20107 values = append(values, v) 20108 } 20109 } 20110 return 20111 } 20112 func (fpaov *AlertingThreshold_FieldTerminalPathArrayOfValues) AsValueArrayOfValues() ([]float64, bool) { 20113 res, ok := fpaov.values.([]float64) 20114 return res, ok 20115 } 20116 func (fpaov *AlertingThreshold_FieldTerminalPathArrayOfValues) AsIsInclusiveArrayOfValues() ([]bool, bool) { 20117 res, ok := fpaov.values.([]bool) 20118 return res, ok 20119 }