github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/common/specs.pb.fieldmask.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 "strings" 10 11 "google.golang.org/grpc/codes" 12 "google.golang.org/grpc/status" 13 "google.golang.org/protobuf/proto" 14 preflect "google.golang.org/protobuf/reflect/protoreflect" 15 googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 16 17 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 18 ) 19 20 // proto imports 21 import ( 22 logging_log "github.com/cloudwan/edgelq-sdk/logging/resources/v1/log" 23 monitoring_common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 24 monitoring_time_serie "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/time_serie" 25 meta_resource "github.com/cloudwan/goten-sdk/meta-service/resources/v1/resource" 26 durationpb "google.golang.org/protobuf/types/known/durationpb" 27 fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 28 ) 29 30 // ensure the imports are used 31 var ( 32 _ = new(json.Marshaler) 33 _ = strings.Builder{} 34 35 _ = codes.NotFound 36 _ = status.Status{} 37 _ = new(proto.Message) 38 _ = new(preflect.Message) 39 _ = googlefieldmaskpb.FieldMask{} 40 41 _ = new(gotenobject.FieldMask) 42 ) 43 44 // make sure we're using proto imports 45 var ( 46 _ = &logging_log.Log{} 47 _ = &monitoring_common.LabelDescriptor{} 48 _ = &monitoring_time_serie.Point{} 49 _ = &durationpb.Duration{} 50 _ = &fieldmaskpb.FieldMask{} 51 _ = &meta_resource.Resource{} 52 ) 53 54 type LogCndSpec_FieldMask struct { 55 Paths []LogCndSpec_FieldPath 56 } 57 58 func FullLogCndSpec_FieldMask() *LogCndSpec_FieldMask { 59 res := &LogCndSpec_FieldMask{} 60 res.Paths = append(res.Paths, &LogCndSpec_FieldTerminalPath{selector: LogCndSpec_FieldPathSelectorQuery}) 61 res.Paths = append(res.Paths, &LogCndSpec_FieldTerminalPath{selector: LogCndSpec_FieldPathSelectorGroupByLabels}) 62 return res 63 } 64 65 func (fieldMask *LogCndSpec_FieldMask) String() string { 66 if fieldMask == nil { 67 return "<nil>" 68 } 69 pathsStr := make([]string, 0, len(fieldMask.Paths)) 70 for _, path := range fieldMask.Paths { 71 pathsStr = append(pathsStr, path.String()) 72 } 73 return strings.Join(pathsStr, ", ") 74 } 75 76 func (fieldMask *LogCndSpec_FieldMask) IsFull() bool { 77 if fieldMask == nil { 78 return false 79 } 80 presentSelectors := make([]bool, 2) 81 for _, path := range fieldMask.Paths { 82 if asFinal, ok := path.(*LogCndSpec_FieldTerminalPath); ok { 83 presentSelectors[int(asFinal.selector)] = true 84 } 85 } 86 for _, flag := range presentSelectors { 87 if !flag { 88 return false 89 } 90 } 91 return true 92 } 93 94 func (fieldMask *LogCndSpec_FieldMask) ProtoReflect() preflect.Message { 95 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 96 return ParseLogCndSpec_FieldPath(raw) 97 }) 98 } 99 100 func (fieldMask *LogCndSpec_FieldMask) ProtoMessage() {} 101 102 func (fieldMask *LogCndSpec_FieldMask) Reset() { 103 if fieldMask != nil { 104 fieldMask.Paths = nil 105 } 106 } 107 108 func (fieldMask *LogCndSpec_FieldMask) Subtract(other *LogCndSpec_FieldMask) *LogCndSpec_FieldMask { 109 result := &LogCndSpec_FieldMask{} 110 removedSelectors := make([]bool, 2) 111 otherSubMasks := map[LogCndSpec_FieldPathSelector]gotenobject.FieldMask{ 112 LogCndSpec_FieldPathSelectorQuery: &LogCndSpec_Query_FieldMask{}, 113 } 114 mySubMasks := map[LogCndSpec_FieldPathSelector]gotenobject.FieldMask{ 115 LogCndSpec_FieldPathSelectorQuery: &LogCndSpec_Query_FieldMask{}, 116 } 117 118 for _, path := range other.GetPaths() { 119 switch tp := path.(type) { 120 case *LogCndSpec_FieldTerminalPath: 121 removedSelectors[int(tp.selector)] = true 122 case *LogCndSpec_FieldSubPath: 123 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 124 } 125 } 126 for _, path := range fieldMask.GetPaths() { 127 if !removedSelectors[int(path.Selector())] { 128 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 129 if tp, ok := path.(*LogCndSpec_FieldTerminalPath); ok { 130 switch tp.selector { 131 case LogCndSpec_FieldPathSelectorQuery: 132 mySubMasks[LogCndSpec_FieldPathSelectorQuery] = FullLogCndSpec_Query_FieldMask() 133 } 134 } else if tp, ok := path.(*LogCndSpec_FieldSubPath); ok { 135 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 136 } 137 } else { 138 result.Paths = append(result.Paths, path) 139 } 140 } 141 } 142 for selector, mySubMask := range mySubMasks { 143 if mySubMask.PathsCount() > 0 { 144 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 145 result.Paths = append(result.Paths, &LogCndSpec_FieldSubPath{selector: selector, subPath: allowedPath}) 146 } 147 } 148 } 149 150 if len(result.Paths) == 0 { 151 return nil 152 } 153 return result 154 } 155 156 func (fieldMask *LogCndSpec_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 157 return fieldMask.Subtract(other.(*LogCndSpec_FieldMask)) 158 } 159 160 // FilterInputFields generates copy of field paths with output_only field paths removed 161 func (fieldMask *LogCndSpec_FieldMask) FilterInputFields() *LogCndSpec_FieldMask { 162 result := &LogCndSpec_FieldMask{} 163 result.Paths = append(result.Paths, fieldMask.Paths...) 164 return result 165 } 166 167 // ToFieldMask is used for proto conversions 168 func (fieldMask *LogCndSpec_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 169 protoFieldMask := &googlefieldmaskpb.FieldMask{} 170 for _, path := range fieldMask.Paths { 171 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 172 } 173 return protoFieldMask 174 } 175 176 func (fieldMask *LogCndSpec_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 177 if fieldMask == nil { 178 return status.Error(codes.Internal, "target field mask is nil") 179 } 180 fieldMask.Paths = make([]LogCndSpec_FieldPath, 0, len(protoFieldMask.Paths)) 181 for _, strPath := range protoFieldMask.Paths { 182 path, err := ParseLogCndSpec_FieldPath(strPath) 183 if err != nil { 184 return err 185 } 186 fieldMask.Paths = append(fieldMask.Paths, path) 187 } 188 return nil 189 } 190 191 // implement methods required by customType 192 func (fieldMask LogCndSpec_FieldMask) Marshal() ([]byte, error) { 193 protoFieldMask := fieldMask.ToProtoFieldMask() 194 return proto.Marshal(protoFieldMask) 195 } 196 197 func (fieldMask *LogCndSpec_FieldMask) Unmarshal(data []byte) error { 198 protoFieldMask := &googlefieldmaskpb.FieldMask{} 199 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 200 return err 201 } 202 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 203 return err 204 } 205 return nil 206 } 207 208 func (fieldMask *LogCndSpec_FieldMask) Size() int { 209 return proto.Size(fieldMask.ToProtoFieldMask()) 210 } 211 212 func (fieldMask LogCndSpec_FieldMask) MarshalJSON() ([]byte, error) { 213 return json.Marshal(fieldMask.ToProtoFieldMask()) 214 } 215 216 func (fieldMask *LogCndSpec_FieldMask) UnmarshalJSON(data []byte) error { 217 protoFieldMask := &googlefieldmaskpb.FieldMask{} 218 if err := json.Unmarshal(data, protoFieldMask); err != nil { 219 return err 220 } 221 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 222 return err 223 } 224 return nil 225 } 226 227 func (fieldMask *LogCndSpec_FieldMask) AppendPath(path LogCndSpec_FieldPath) { 228 fieldMask.Paths = append(fieldMask.Paths, path) 229 } 230 231 func (fieldMask *LogCndSpec_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 232 fieldMask.Paths = append(fieldMask.Paths, path.(LogCndSpec_FieldPath)) 233 } 234 235 func (fieldMask *LogCndSpec_FieldMask) GetPaths() []LogCndSpec_FieldPath { 236 if fieldMask == nil { 237 return nil 238 } 239 return fieldMask.Paths 240 } 241 242 func (fieldMask *LogCndSpec_FieldMask) GetRawPaths() []gotenobject.FieldPath { 243 if fieldMask == nil { 244 return nil 245 } 246 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 247 for _, path := range fieldMask.Paths { 248 rawPaths = append(rawPaths, path) 249 } 250 return rawPaths 251 } 252 253 func (fieldMask *LogCndSpec_FieldMask) SetFromCliFlag(raw string) error { 254 path, err := ParseLogCndSpec_FieldPath(raw) 255 if err != nil { 256 return err 257 } 258 fieldMask.Paths = append(fieldMask.Paths, path) 259 return nil 260 } 261 262 func (fieldMask *LogCndSpec_FieldMask) Set(target, source *LogCndSpec) { 263 for _, path := range fieldMask.Paths { 264 val, _ := path.GetSingle(source) 265 // if val is nil, then field does not exist in source, skip 266 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 267 if val != nil { 268 path.WithIValue(val).SetTo(&target) 269 } 270 } 271 } 272 273 func (fieldMask *LogCndSpec_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 274 fieldMask.Set(target.(*LogCndSpec), source.(*LogCndSpec)) 275 } 276 277 func (fieldMask *LogCndSpec_FieldMask) Project(source *LogCndSpec) *LogCndSpec { 278 if source == nil { 279 return nil 280 } 281 if fieldMask == nil { 282 return source 283 } 284 result := &LogCndSpec{} 285 queryMask := &LogCndSpec_Query_FieldMask{} 286 wholeQueryAccepted := false 287 288 for _, p := range fieldMask.Paths { 289 switch tp := p.(type) { 290 case *LogCndSpec_FieldTerminalPath: 291 switch tp.selector { 292 case LogCndSpec_FieldPathSelectorQuery: 293 result.Query = source.Query 294 wholeQueryAccepted = true 295 case LogCndSpec_FieldPathSelectorGroupByLabels: 296 result.GroupByLabels = source.GroupByLabels 297 } 298 case *LogCndSpec_FieldSubPath: 299 switch tp.selector { 300 case LogCndSpec_FieldPathSelectorQuery: 301 queryMask.AppendPath(tp.subPath.(LogCndSpecQuery_FieldPath)) 302 } 303 } 304 } 305 if wholeQueryAccepted == false && len(queryMask.Paths) > 0 { 306 result.Query = queryMask.Project(source.GetQuery()) 307 } 308 return result 309 } 310 311 func (fieldMask *LogCndSpec_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 312 return fieldMask.Project(source.(*LogCndSpec)) 313 } 314 315 func (fieldMask *LogCndSpec_FieldMask) PathsCount() int { 316 if fieldMask == nil { 317 return 0 318 } 319 return len(fieldMask.Paths) 320 } 321 322 type LogCndSpec_Query_FieldMask struct { 323 Paths []LogCndSpecQuery_FieldPath 324 } 325 326 func FullLogCndSpec_Query_FieldMask() *LogCndSpec_Query_FieldMask { 327 res := &LogCndSpec_Query_FieldMask{} 328 res.Paths = append(res.Paths, &LogCndSpecQuery_FieldTerminalPath{selector: LogCndSpecQuery_FieldPathSelectorFilter}) 329 res.Paths = append(res.Paths, &LogCndSpecQuery_FieldTerminalPath{selector: LogCndSpecQuery_FieldPathSelectorTrigger}) 330 res.Paths = append(res.Paths, &LogCndSpecQuery_FieldTerminalPath{selector: LogCndSpecQuery_FieldPathSelectorMinDuration}) 331 return res 332 } 333 334 func (fieldMask *LogCndSpec_Query_FieldMask) String() string { 335 if fieldMask == nil { 336 return "<nil>" 337 } 338 pathsStr := make([]string, 0, len(fieldMask.Paths)) 339 for _, path := range fieldMask.Paths { 340 pathsStr = append(pathsStr, path.String()) 341 } 342 return strings.Join(pathsStr, ", ") 343 } 344 345 func (fieldMask *LogCndSpec_Query_FieldMask) IsFull() bool { 346 if fieldMask == nil { 347 return false 348 } 349 presentSelectors := make([]bool, 3) 350 for _, path := range fieldMask.Paths { 351 if asFinal, ok := path.(*LogCndSpecQuery_FieldTerminalPath); ok { 352 presentSelectors[int(asFinal.selector)] = true 353 } 354 } 355 for _, flag := range presentSelectors { 356 if !flag { 357 return false 358 } 359 } 360 return true 361 } 362 363 func (fieldMask *LogCndSpec_Query_FieldMask) ProtoReflect() preflect.Message { 364 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 365 return ParseLogCndSpecQuery_FieldPath(raw) 366 }) 367 } 368 369 func (fieldMask *LogCndSpec_Query_FieldMask) ProtoMessage() {} 370 371 func (fieldMask *LogCndSpec_Query_FieldMask) Reset() { 372 if fieldMask != nil { 373 fieldMask.Paths = nil 374 } 375 } 376 377 func (fieldMask *LogCndSpec_Query_FieldMask) Subtract(other *LogCndSpec_Query_FieldMask) *LogCndSpec_Query_FieldMask { 378 result := &LogCndSpec_Query_FieldMask{} 379 removedSelectors := make([]bool, 3) 380 381 for _, path := range other.GetPaths() { 382 switch tp := path.(type) { 383 case *LogCndSpecQuery_FieldTerminalPath: 384 removedSelectors[int(tp.selector)] = true 385 } 386 } 387 for _, path := range fieldMask.GetPaths() { 388 if !removedSelectors[int(path.Selector())] { 389 result.Paths = append(result.Paths, path) 390 } 391 } 392 393 if len(result.Paths) == 0 { 394 return nil 395 } 396 return result 397 } 398 399 func (fieldMask *LogCndSpec_Query_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 400 return fieldMask.Subtract(other.(*LogCndSpec_Query_FieldMask)) 401 } 402 403 // FilterInputFields generates copy of field paths with output_only field paths removed 404 func (fieldMask *LogCndSpec_Query_FieldMask) FilterInputFields() *LogCndSpec_Query_FieldMask { 405 result := &LogCndSpec_Query_FieldMask{} 406 result.Paths = append(result.Paths, fieldMask.Paths...) 407 return result 408 } 409 410 // ToFieldMask is used for proto conversions 411 func (fieldMask *LogCndSpec_Query_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 412 protoFieldMask := &googlefieldmaskpb.FieldMask{} 413 for _, path := range fieldMask.Paths { 414 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 415 } 416 return protoFieldMask 417 } 418 419 func (fieldMask *LogCndSpec_Query_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 420 if fieldMask == nil { 421 return status.Error(codes.Internal, "target field mask is nil") 422 } 423 fieldMask.Paths = make([]LogCndSpecQuery_FieldPath, 0, len(protoFieldMask.Paths)) 424 for _, strPath := range protoFieldMask.Paths { 425 path, err := ParseLogCndSpecQuery_FieldPath(strPath) 426 if err != nil { 427 return err 428 } 429 fieldMask.Paths = append(fieldMask.Paths, path) 430 } 431 return nil 432 } 433 434 // implement methods required by customType 435 func (fieldMask LogCndSpec_Query_FieldMask) Marshal() ([]byte, error) { 436 protoFieldMask := fieldMask.ToProtoFieldMask() 437 return proto.Marshal(protoFieldMask) 438 } 439 440 func (fieldMask *LogCndSpec_Query_FieldMask) Unmarshal(data []byte) error { 441 protoFieldMask := &googlefieldmaskpb.FieldMask{} 442 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 443 return err 444 } 445 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 446 return err 447 } 448 return nil 449 } 450 451 func (fieldMask *LogCndSpec_Query_FieldMask) Size() int { 452 return proto.Size(fieldMask.ToProtoFieldMask()) 453 } 454 455 func (fieldMask LogCndSpec_Query_FieldMask) MarshalJSON() ([]byte, error) { 456 return json.Marshal(fieldMask.ToProtoFieldMask()) 457 } 458 459 func (fieldMask *LogCndSpec_Query_FieldMask) UnmarshalJSON(data []byte) error { 460 protoFieldMask := &googlefieldmaskpb.FieldMask{} 461 if err := json.Unmarshal(data, protoFieldMask); err != nil { 462 return err 463 } 464 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 465 return err 466 } 467 return nil 468 } 469 470 func (fieldMask *LogCndSpec_Query_FieldMask) AppendPath(path LogCndSpecQuery_FieldPath) { 471 fieldMask.Paths = append(fieldMask.Paths, path) 472 } 473 474 func (fieldMask *LogCndSpec_Query_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 475 fieldMask.Paths = append(fieldMask.Paths, path.(LogCndSpecQuery_FieldPath)) 476 } 477 478 func (fieldMask *LogCndSpec_Query_FieldMask) GetPaths() []LogCndSpecQuery_FieldPath { 479 if fieldMask == nil { 480 return nil 481 } 482 return fieldMask.Paths 483 } 484 485 func (fieldMask *LogCndSpec_Query_FieldMask) GetRawPaths() []gotenobject.FieldPath { 486 if fieldMask == nil { 487 return nil 488 } 489 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 490 for _, path := range fieldMask.Paths { 491 rawPaths = append(rawPaths, path) 492 } 493 return rawPaths 494 } 495 496 func (fieldMask *LogCndSpec_Query_FieldMask) SetFromCliFlag(raw string) error { 497 path, err := ParseLogCndSpecQuery_FieldPath(raw) 498 if err != nil { 499 return err 500 } 501 fieldMask.Paths = append(fieldMask.Paths, path) 502 return nil 503 } 504 505 func (fieldMask *LogCndSpec_Query_FieldMask) Set(target, source *LogCndSpec_Query) { 506 for _, path := range fieldMask.Paths { 507 val, _ := path.GetSingle(source) 508 // if val is nil, then field does not exist in source, skip 509 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 510 if val != nil { 511 path.WithIValue(val).SetTo(&target) 512 } 513 } 514 } 515 516 func (fieldMask *LogCndSpec_Query_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 517 fieldMask.Set(target.(*LogCndSpec_Query), source.(*LogCndSpec_Query)) 518 } 519 520 func (fieldMask *LogCndSpec_Query_FieldMask) Project(source *LogCndSpec_Query) *LogCndSpec_Query { 521 if source == nil { 522 return nil 523 } 524 if fieldMask == nil { 525 return source 526 } 527 result := &LogCndSpec_Query{} 528 529 for _, p := range fieldMask.Paths { 530 switch tp := p.(type) { 531 case *LogCndSpecQuery_FieldTerminalPath: 532 switch tp.selector { 533 case LogCndSpecQuery_FieldPathSelectorFilter: 534 result.Filter = source.Filter 535 case LogCndSpecQuery_FieldPathSelectorTrigger: 536 result.Trigger = source.Trigger 537 case LogCndSpecQuery_FieldPathSelectorMinDuration: 538 result.MinDuration = source.MinDuration 539 } 540 } 541 } 542 return result 543 } 544 545 func (fieldMask *LogCndSpec_Query_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 546 return fieldMask.Project(source.(*LogCndSpec_Query)) 547 } 548 549 func (fieldMask *LogCndSpec_Query_FieldMask) PathsCount() int { 550 if fieldMask == nil { 551 return 0 552 } 553 return len(fieldMask.Paths) 554 } 555 556 type LogCndSpec_Query_LabelTrigger_FieldMask struct { 557 Paths []LogCndSpecQueryLabelTrigger_FieldPath 558 } 559 560 func FullLogCndSpec_Query_LabelTrigger_FieldMask() *LogCndSpec_Query_LabelTrigger_FieldMask { 561 res := &LogCndSpec_Query_LabelTrigger_FieldMask{} 562 res.Paths = append(res.Paths, &LogCndSpecQueryLabelTrigger_FieldTerminalPath{selector: LogCndSpecQueryLabelTrigger_FieldPathSelectorKey}) 563 res.Paths = append(res.Paths, &LogCndSpecQueryLabelTrigger_FieldTerminalPath{selector: LogCndSpecQueryLabelTrigger_FieldPathSelectorValues}) 564 return res 565 } 566 567 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) String() string { 568 if fieldMask == nil { 569 return "<nil>" 570 } 571 pathsStr := make([]string, 0, len(fieldMask.Paths)) 572 for _, path := range fieldMask.Paths { 573 pathsStr = append(pathsStr, path.String()) 574 } 575 return strings.Join(pathsStr, ", ") 576 } 577 578 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) IsFull() bool { 579 if fieldMask == nil { 580 return false 581 } 582 presentSelectors := make([]bool, 2) 583 for _, path := range fieldMask.Paths { 584 if asFinal, ok := path.(*LogCndSpecQueryLabelTrigger_FieldTerminalPath); ok { 585 presentSelectors[int(asFinal.selector)] = true 586 } 587 } 588 for _, flag := range presentSelectors { 589 if !flag { 590 return false 591 } 592 } 593 return true 594 } 595 596 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) ProtoReflect() preflect.Message { 597 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 598 return ParseLogCndSpecQueryLabelTrigger_FieldPath(raw) 599 }) 600 } 601 602 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) ProtoMessage() {} 603 604 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) Reset() { 605 if fieldMask != nil { 606 fieldMask.Paths = nil 607 } 608 } 609 610 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) Subtract(other *LogCndSpec_Query_LabelTrigger_FieldMask) *LogCndSpec_Query_LabelTrigger_FieldMask { 611 result := &LogCndSpec_Query_LabelTrigger_FieldMask{} 612 removedSelectors := make([]bool, 2) 613 614 for _, path := range other.GetPaths() { 615 switch tp := path.(type) { 616 case *LogCndSpecQueryLabelTrigger_FieldTerminalPath: 617 removedSelectors[int(tp.selector)] = true 618 } 619 } 620 for _, path := range fieldMask.GetPaths() { 621 if !removedSelectors[int(path.Selector())] { 622 result.Paths = append(result.Paths, path) 623 } 624 } 625 626 if len(result.Paths) == 0 { 627 return nil 628 } 629 return result 630 } 631 632 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 633 return fieldMask.Subtract(other.(*LogCndSpec_Query_LabelTrigger_FieldMask)) 634 } 635 636 // FilterInputFields generates copy of field paths with output_only field paths removed 637 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) FilterInputFields() *LogCndSpec_Query_LabelTrigger_FieldMask { 638 result := &LogCndSpec_Query_LabelTrigger_FieldMask{} 639 result.Paths = append(result.Paths, fieldMask.Paths...) 640 return result 641 } 642 643 // ToFieldMask is used for proto conversions 644 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 645 protoFieldMask := &googlefieldmaskpb.FieldMask{} 646 for _, path := range fieldMask.Paths { 647 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 648 } 649 return protoFieldMask 650 } 651 652 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 653 if fieldMask == nil { 654 return status.Error(codes.Internal, "target field mask is nil") 655 } 656 fieldMask.Paths = make([]LogCndSpecQueryLabelTrigger_FieldPath, 0, len(protoFieldMask.Paths)) 657 for _, strPath := range protoFieldMask.Paths { 658 path, err := ParseLogCndSpecQueryLabelTrigger_FieldPath(strPath) 659 if err != nil { 660 return err 661 } 662 fieldMask.Paths = append(fieldMask.Paths, path) 663 } 664 return nil 665 } 666 667 // implement methods required by customType 668 func (fieldMask LogCndSpec_Query_LabelTrigger_FieldMask) Marshal() ([]byte, error) { 669 protoFieldMask := fieldMask.ToProtoFieldMask() 670 return proto.Marshal(protoFieldMask) 671 } 672 673 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) Unmarshal(data []byte) error { 674 protoFieldMask := &googlefieldmaskpb.FieldMask{} 675 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 676 return err 677 } 678 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 679 return err 680 } 681 return nil 682 } 683 684 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) Size() int { 685 return proto.Size(fieldMask.ToProtoFieldMask()) 686 } 687 688 func (fieldMask LogCndSpec_Query_LabelTrigger_FieldMask) MarshalJSON() ([]byte, error) { 689 return json.Marshal(fieldMask.ToProtoFieldMask()) 690 } 691 692 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) UnmarshalJSON(data []byte) error { 693 protoFieldMask := &googlefieldmaskpb.FieldMask{} 694 if err := json.Unmarshal(data, protoFieldMask); err != nil { 695 return err 696 } 697 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 698 return err 699 } 700 return nil 701 } 702 703 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) AppendPath(path LogCndSpecQueryLabelTrigger_FieldPath) { 704 fieldMask.Paths = append(fieldMask.Paths, path) 705 } 706 707 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 708 fieldMask.Paths = append(fieldMask.Paths, path.(LogCndSpecQueryLabelTrigger_FieldPath)) 709 } 710 711 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) GetPaths() []LogCndSpecQueryLabelTrigger_FieldPath { 712 if fieldMask == nil { 713 return nil 714 } 715 return fieldMask.Paths 716 } 717 718 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) GetRawPaths() []gotenobject.FieldPath { 719 if fieldMask == nil { 720 return nil 721 } 722 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 723 for _, path := range fieldMask.Paths { 724 rawPaths = append(rawPaths, path) 725 } 726 return rawPaths 727 } 728 729 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) SetFromCliFlag(raw string) error { 730 path, err := ParseLogCndSpecQueryLabelTrigger_FieldPath(raw) 731 if err != nil { 732 return err 733 } 734 fieldMask.Paths = append(fieldMask.Paths, path) 735 return nil 736 } 737 738 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) Set(target, source *LogCndSpec_Query_LabelTrigger) { 739 for _, path := range fieldMask.Paths { 740 val, _ := path.GetSingle(source) 741 // if val is nil, then field does not exist in source, skip 742 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 743 if val != nil { 744 path.WithIValue(val).SetTo(&target) 745 } 746 } 747 } 748 749 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 750 fieldMask.Set(target.(*LogCndSpec_Query_LabelTrigger), source.(*LogCndSpec_Query_LabelTrigger)) 751 } 752 753 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) Project(source *LogCndSpec_Query_LabelTrigger) *LogCndSpec_Query_LabelTrigger { 754 if source == nil { 755 return nil 756 } 757 if fieldMask == nil { 758 return source 759 } 760 result := &LogCndSpec_Query_LabelTrigger{} 761 762 for _, p := range fieldMask.Paths { 763 switch tp := p.(type) { 764 case *LogCndSpecQueryLabelTrigger_FieldTerminalPath: 765 switch tp.selector { 766 case LogCndSpecQueryLabelTrigger_FieldPathSelectorKey: 767 result.Key = source.Key 768 case LogCndSpecQueryLabelTrigger_FieldPathSelectorValues: 769 result.Values = source.Values 770 } 771 } 772 } 773 return result 774 } 775 776 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 777 return fieldMask.Project(source.(*LogCndSpec_Query_LabelTrigger)) 778 } 779 780 func (fieldMask *LogCndSpec_Query_LabelTrigger_FieldMask) PathsCount() int { 781 if fieldMask == nil { 782 return 0 783 } 784 return len(fieldMask.Paths) 785 } 786 787 type LogCndSpec_Query_StringPayloadTrigger_FieldMask struct { 788 Paths []LogCndSpecQueryStringPayloadTrigger_FieldPath 789 } 790 791 func FullLogCndSpec_Query_StringPayloadTrigger_FieldMask() *LogCndSpec_Query_StringPayloadTrigger_FieldMask { 792 res := &LogCndSpec_Query_StringPayloadTrigger_FieldMask{} 793 res.Paths = append(res.Paths, &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath{selector: LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector}) 794 res.Paths = append(res.Paths, &LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath{selector: LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex}) 795 return res 796 } 797 798 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) String() string { 799 if fieldMask == nil { 800 return "<nil>" 801 } 802 pathsStr := make([]string, 0, len(fieldMask.Paths)) 803 for _, path := range fieldMask.Paths { 804 pathsStr = append(pathsStr, path.String()) 805 } 806 return strings.Join(pathsStr, ", ") 807 } 808 809 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) IsFull() bool { 810 if fieldMask == nil { 811 return false 812 } 813 presentSelectors := make([]bool, 2) 814 for _, path := range fieldMask.Paths { 815 if asFinal, ok := path.(*LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath); ok { 816 presentSelectors[int(asFinal.selector)] = true 817 } 818 } 819 for _, flag := range presentSelectors { 820 if !flag { 821 return false 822 } 823 } 824 return true 825 } 826 827 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) ProtoReflect() preflect.Message { 828 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 829 return ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(raw) 830 }) 831 } 832 833 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) ProtoMessage() {} 834 835 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) Reset() { 836 if fieldMask != nil { 837 fieldMask.Paths = nil 838 } 839 } 840 841 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) Subtract(other *LogCndSpec_Query_StringPayloadTrigger_FieldMask) *LogCndSpec_Query_StringPayloadTrigger_FieldMask { 842 result := &LogCndSpec_Query_StringPayloadTrigger_FieldMask{} 843 removedSelectors := make([]bool, 2) 844 845 for _, path := range other.GetPaths() { 846 switch tp := path.(type) { 847 case *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath: 848 removedSelectors[int(tp.selector)] = true 849 } 850 } 851 for _, path := range fieldMask.GetPaths() { 852 if !removedSelectors[int(path.Selector())] { 853 result.Paths = append(result.Paths, path) 854 } 855 } 856 857 if len(result.Paths) == 0 { 858 return nil 859 } 860 return result 861 } 862 863 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 864 return fieldMask.Subtract(other.(*LogCndSpec_Query_StringPayloadTrigger_FieldMask)) 865 } 866 867 // FilterInputFields generates copy of field paths with output_only field paths removed 868 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) FilterInputFields() *LogCndSpec_Query_StringPayloadTrigger_FieldMask { 869 result := &LogCndSpec_Query_StringPayloadTrigger_FieldMask{} 870 result.Paths = append(result.Paths, fieldMask.Paths...) 871 return result 872 } 873 874 // ToFieldMask is used for proto conversions 875 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 876 protoFieldMask := &googlefieldmaskpb.FieldMask{} 877 for _, path := range fieldMask.Paths { 878 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 879 } 880 return protoFieldMask 881 } 882 883 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 884 if fieldMask == nil { 885 return status.Error(codes.Internal, "target field mask is nil") 886 } 887 fieldMask.Paths = make([]LogCndSpecQueryStringPayloadTrigger_FieldPath, 0, len(protoFieldMask.Paths)) 888 for _, strPath := range protoFieldMask.Paths { 889 path, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(strPath) 890 if err != nil { 891 return err 892 } 893 fieldMask.Paths = append(fieldMask.Paths, path) 894 } 895 return nil 896 } 897 898 // implement methods required by customType 899 func (fieldMask LogCndSpec_Query_StringPayloadTrigger_FieldMask) Marshal() ([]byte, error) { 900 protoFieldMask := fieldMask.ToProtoFieldMask() 901 return proto.Marshal(protoFieldMask) 902 } 903 904 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) Unmarshal(data []byte) error { 905 protoFieldMask := &googlefieldmaskpb.FieldMask{} 906 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 907 return err 908 } 909 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 910 return err 911 } 912 return nil 913 } 914 915 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) Size() int { 916 return proto.Size(fieldMask.ToProtoFieldMask()) 917 } 918 919 func (fieldMask LogCndSpec_Query_StringPayloadTrigger_FieldMask) MarshalJSON() ([]byte, error) { 920 return json.Marshal(fieldMask.ToProtoFieldMask()) 921 } 922 923 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) UnmarshalJSON(data []byte) error { 924 protoFieldMask := &googlefieldmaskpb.FieldMask{} 925 if err := json.Unmarshal(data, protoFieldMask); err != nil { 926 return err 927 } 928 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 929 return err 930 } 931 return nil 932 } 933 934 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) AppendPath(path LogCndSpecQueryStringPayloadTrigger_FieldPath) { 935 fieldMask.Paths = append(fieldMask.Paths, path) 936 } 937 938 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 939 fieldMask.Paths = append(fieldMask.Paths, path.(LogCndSpecQueryStringPayloadTrigger_FieldPath)) 940 } 941 942 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) GetPaths() []LogCndSpecQueryStringPayloadTrigger_FieldPath { 943 if fieldMask == nil { 944 return nil 945 } 946 return fieldMask.Paths 947 } 948 949 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) GetRawPaths() []gotenobject.FieldPath { 950 if fieldMask == nil { 951 return nil 952 } 953 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 954 for _, path := range fieldMask.Paths { 955 rawPaths = append(rawPaths, path) 956 } 957 return rawPaths 958 } 959 960 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) SetFromCliFlag(raw string) error { 961 path, err := ParseLogCndSpecQueryStringPayloadTrigger_FieldPath(raw) 962 if err != nil { 963 return err 964 } 965 fieldMask.Paths = append(fieldMask.Paths, path) 966 return nil 967 } 968 969 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) Set(target, source *LogCndSpec_Query_StringPayloadTrigger) { 970 for _, path := range fieldMask.Paths { 971 val, _ := path.GetSingle(source) 972 // if val is nil, then field does not exist in source, skip 973 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 974 if val != nil { 975 path.WithIValue(val).SetTo(&target) 976 } 977 } 978 } 979 980 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 981 fieldMask.Set(target.(*LogCndSpec_Query_StringPayloadTrigger), source.(*LogCndSpec_Query_StringPayloadTrigger)) 982 } 983 984 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) Project(source *LogCndSpec_Query_StringPayloadTrigger) *LogCndSpec_Query_StringPayloadTrigger { 985 if source == nil { 986 return nil 987 } 988 if fieldMask == nil { 989 return source 990 } 991 result := &LogCndSpec_Query_StringPayloadTrigger{} 992 993 for _, p := range fieldMask.Paths { 994 switch tp := p.(type) { 995 case *LogCndSpecQueryStringPayloadTrigger_FieldTerminalPath: 996 switch tp.selector { 997 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorObjectSelector: 998 result.ObjectSelector = source.ObjectSelector 999 case LogCndSpecQueryStringPayloadTrigger_FieldPathSelectorRegex: 1000 result.Regex = source.Regex 1001 } 1002 } 1003 } 1004 return result 1005 } 1006 1007 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1008 return fieldMask.Project(source.(*LogCndSpec_Query_StringPayloadTrigger)) 1009 } 1010 1011 func (fieldMask *LogCndSpec_Query_StringPayloadTrigger_FieldMask) PathsCount() int { 1012 if fieldMask == nil { 1013 return 0 1014 } 1015 return len(fieldMask.Paths) 1016 } 1017 1018 type LogCndSpec_Query_CompositeTrigger_FieldMask struct { 1019 Paths []LogCndSpecQueryCompositeTrigger_FieldPath 1020 } 1021 1022 func FullLogCndSpec_Query_CompositeTrigger_FieldMask() *LogCndSpec_Query_CompositeTrigger_FieldMask { 1023 res := &LogCndSpec_Query_CompositeTrigger_FieldMask{} 1024 res.Paths = append(res.Paths, &LogCndSpecQueryCompositeTrigger_FieldTerminalPath{selector: LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers}) 1025 res.Paths = append(res.Paths, &LogCndSpecQueryCompositeTrigger_FieldTerminalPath{selector: LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator}) 1026 return res 1027 } 1028 1029 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) String() string { 1030 if fieldMask == nil { 1031 return "<nil>" 1032 } 1033 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1034 for _, path := range fieldMask.Paths { 1035 pathsStr = append(pathsStr, path.String()) 1036 } 1037 return strings.Join(pathsStr, ", ") 1038 } 1039 1040 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) IsFull() bool { 1041 if fieldMask == nil { 1042 return false 1043 } 1044 presentSelectors := make([]bool, 2) 1045 for _, path := range fieldMask.Paths { 1046 if asFinal, ok := path.(*LogCndSpecQueryCompositeTrigger_FieldTerminalPath); ok { 1047 presentSelectors[int(asFinal.selector)] = true 1048 } 1049 } 1050 for _, flag := range presentSelectors { 1051 if !flag { 1052 return false 1053 } 1054 } 1055 return true 1056 } 1057 1058 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) ProtoReflect() preflect.Message { 1059 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1060 return ParseLogCndSpecQueryCompositeTrigger_FieldPath(raw) 1061 }) 1062 } 1063 1064 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) ProtoMessage() {} 1065 1066 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) Reset() { 1067 if fieldMask != nil { 1068 fieldMask.Paths = nil 1069 } 1070 } 1071 1072 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) Subtract(other *LogCndSpec_Query_CompositeTrigger_FieldMask) *LogCndSpec_Query_CompositeTrigger_FieldMask { 1073 result := &LogCndSpec_Query_CompositeTrigger_FieldMask{} 1074 removedSelectors := make([]bool, 2) 1075 1076 for _, path := range other.GetPaths() { 1077 switch tp := path.(type) { 1078 case *LogCndSpecQueryCompositeTrigger_FieldTerminalPath: 1079 removedSelectors[int(tp.selector)] = true 1080 } 1081 } 1082 for _, path := range fieldMask.GetPaths() { 1083 if !removedSelectors[int(path.Selector())] { 1084 result.Paths = append(result.Paths, path) 1085 } 1086 } 1087 1088 if len(result.Paths) == 0 { 1089 return nil 1090 } 1091 return result 1092 } 1093 1094 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1095 return fieldMask.Subtract(other.(*LogCndSpec_Query_CompositeTrigger_FieldMask)) 1096 } 1097 1098 // FilterInputFields generates copy of field paths with output_only field paths removed 1099 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) FilterInputFields() *LogCndSpec_Query_CompositeTrigger_FieldMask { 1100 result := &LogCndSpec_Query_CompositeTrigger_FieldMask{} 1101 result.Paths = append(result.Paths, fieldMask.Paths...) 1102 return result 1103 } 1104 1105 // ToFieldMask is used for proto conversions 1106 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1107 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1108 for _, path := range fieldMask.Paths { 1109 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1110 } 1111 return protoFieldMask 1112 } 1113 1114 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1115 if fieldMask == nil { 1116 return status.Error(codes.Internal, "target field mask is nil") 1117 } 1118 fieldMask.Paths = make([]LogCndSpecQueryCompositeTrigger_FieldPath, 0, len(protoFieldMask.Paths)) 1119 for _, strPath := range protoFieldMask.Paths { 1120 path, err := ParseLogCndSpecQueryCompositeTrigger_FieldPath(strPath) 1121 if err != nil { 1122 return err 1123 } 1124 fieldMask.Paths = append(fieldMask.Paths, path) 1125 } 1126 return nil 1127 } 1128 1129 // implement methods required by customType 1130 func (fieldMask LogCndSpec_Query_CompositeTrigger_FieldMask) Marshal() ([]byte, error) { 1131 protoFieldMask := fieldMask.ToProtoFieldMask() 1132 return proto.Marshal(protoFieldMask) 1133 } 1134 1135 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) Unmarshal(data []byte) error { 1136 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1137 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1138 return err 1139 } 1140 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1141 return err 1142 } 1143 return nil 1144 } 1145 1146 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) Size() int { 1147 return proto.Size(fieldMask.ToProtoFieldMask()) 1148 } 1149 1150 func (fieldMask LogCndSpec_Query_CompositeTrigger_FieldMask) MarshalJSON() ([]byte, error) { 1151 return json.Marshal(fieldMask.ToProtoFieldMask()) 1152 } 1153 1154 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) UnmarshalJSON(data []byte) error { 1155 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1156 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1157 return err 1158 } 1159 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1160 return err 1161 } 1162 return nil 1163 } 1164 1165 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) AppendPath(path LogCndSpecQueryCompositeTrigger_FieldPath) { 1166 fieldMask.Paths = append(fieldMask.Paths, path) 1167 } 1168 1169 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1170 fieldMask.Paths = append(fieldMask.Paths, path.(LogCndSpecQueryCompositeTrigger_FieldPath)) 1171 } 1172 1173 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) GetPaths() []LogCndSpecQueryCompositeTrigger_FieldPath { 1174 if fieldMask == nil { 1175 return nil 1176 } 1177 return fieldMask.Paths 1178 } 1179 1180 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1181 if fieldMask == nil { 1182 return nil 1183 } 1184 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1185 for _, path := range fieldMask.Paths { 1186 rawPaths = append(rawPaths, path) 1187 } 1188 return rawPaths 1189 } 1190 1191 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) SetFromCliFlag(raw string) error { 1192 path, err := ParseLogCndSpecQueryCompositeTrigger_FieldPath(raw) 1193 if err != nil { 1194 return err 1195 } 1196 fieldMask.Paths = append(fieldMask.Paths, path) 1197 return nil 1198 } 1199 1200 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) Set(target, source *LogCndSpec_Query_CompositeTrigger) { 1201 for _, path := range fieldMask.Paths { 1202 val, _ := path.GetSingle(source) 1203 // if val is nil, then field does not exist in source, skip 1204 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1205 if val != nil { 1206 path.WithIValue(val).SetTo(&target) 1207 } 1208 } 1209 } 1210 1211 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1212 fieldMask.Set(target.(*LogCndSpec_Query_CompositeTrigger), source.(*LogCndSpec_Query_CompositeTrigger)) 1213 } 1214 1215 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) Project(source *LogCndSpec_Query_CompositeTrigger) *LogCndSpec_Query_CompositeTrigger { 1216 if source == nil { 1217 return nil 1218 } 1219 if fieldMask == nil { 1220 return source 1221 } 1222 result := &LogCndSpec_Query_CompositeTrigger{} 1223 1224 for _, p := range fieldMask.Paths { 1225 switch tp := p.(type) { 1226 case *LogCndSpecQueryCompositeTrigger_FieldTerminalPath: 1227 switch tp.selector { 1228 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorTriggers: 1229 result.Triggers = source.Triggers 1230 case LogCndSpecQueryCompositeTrigger_FieldPathSelectorOperator: 1231 result.Operator = source.Operator 1232 } 1233 } 1234 } 1235 return result 1236 } 1237 1238 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1239 return fieldMask.Project(source.(*LogCndSpec_Query_CompositeTrigger)) 1240 } 1241 1242 func (fieldMask *LogCndSpec_Query_CompositeTrigger_FieldMask) PathsCount() int { 1243 if fieldMask == nil { 1244 return 0 1245 } 1246 return len(fieldMask.Paths) 1247 } 1248 1249 type TsCndSpec_FieldMask struct { 1250 Paths []TsCndSpec_FieldPath 1251 } 1252 1253 func FullTsCndSpec_FieldMask() *TsCndSpec_FieldMask { 1254 res := &TsCndSpec_FieldMask{} 1255 res.Paths = append(res.Paths, &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorQueries}) 1256 res.Paths = append(res.Paths, &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorQueryGroupBy}) 1257 res.Paths = append(res.Paths, &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorThresholdAlerting}) 1258 res.Paths = append(res.Paths, &TsCndSpec_FieldTerminalPath{selector: TsCndSpec_FieldPathSelectorAnomalyAlerting}) 1259 return res 1260 } 1261 1262 func (fieldMask *TsCndSpec_FieldMask) String() string { 1263 if fieldMask == nil { 1264 return "<nil>" 1265 } 1266 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1267 for _, path := range fieldMask.Paths { 1268 pathsStr = append(pathsStr, path.String()) 1269 } 1270 return strings.Join(pathsStr, ", ") 1271 } 1272 1273 func (fieldMask *TsCndSpec_FieldMask) IsFull() bool { 1274 if fieldMask == nil { 1275 return false 1276 } 1277 presentSelectors := make([]bool, 4) 1278 for _, path := range fieldMask.Paths { 1279 if asFinal, ok := path.(*TsCndSpec_FieldTerminalPath); ok { 1280 presentSelectors[int(asFinal.selector)] = true 1281 } 1282 } 1283 for _, flag := range presentSelectors { 1284 if !flag { 1285 return false 1286 } 1287 } 1288 return true 1289 } 1290 1291 func (fieldMask *TsCndSpec_FieldMask) ProtoReflect() preflect.Message { 1292 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1293 return ParseTsCndSpec_FieldPath(raw) 1294 }) 1295 } 1296 1297 func (fieldMask *TsCndSpec_FieldMask) ProtoMessage() {} 1298 1299 func (fieldMask *TsCndSpec_FieldMask) Reset() { 1300 if fieldMask != nil { 1301 fieldMask.Paths = nil 1302 } 1303 } 1304 1305 func (fieldMask *TsCndSpec_FieldMask) Subtract(other *TsCndSpec_FieldMask) *TsCndSpec_FieldMask { 1306 result := &TsCndSpec_FieldMask{} 1307 removedSelectors := make([]bool, 4) 1308 otherSubMasks := map[TsCndSpec_FieldPathSelector]gotenobject.FieldMask{ 1309 TsCndSpec_FieldPathSelectorQueries: &TsCndSpec_Query_FieldMask{}, 1310 TsCndSpec_FieldPathSelectorThresholdAlerting: &TsCndSpec_ThresholdAlertingCfg_FieldMask{}, 1311 TsCndSpec_FieldPathSelectorAnomalyAlerting: &TsCndSpec_AnomalyAlertingCfg_FieldMask{}, 1312 } 1313 mySubMasks := map[TsCndSpec_FieldPathSelector]gotenobject.FieldMask{ 1314 TsCndSpec_FieldPathSelectorQueries: &TsCndSpec_Query_FieldMask{}, 1315 TsCndSpec_FieldPathSelectorThresholdAlerting: &TsCndSpec_ThresholdAlertingCfg_FieldMask{}, 1316 TsCndSpec_FieldPathSelectorAnomalyAlerting: &TsCndSpec_AnomalyAlertingCfg_FieldMask{}, 1317 } 1318 1319 for _, path := range other.GetPaths() { 1320 switch tp := path.(type) { 1321 case *TsCndSpec_FieldTerminalPath: 1322 removedSelectors[int(tp.selector)] = true 1323 case *TsCndSpec_FieldSubPath: 1324 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1325 } 1326 } 1327 for _, path := range fieldMask.GetPaths() { 1328 if !removedSelectors[int(path.Selector())] { 1329 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1330 if tp, ok := path.(*TsCndSpec_FieldTerminalPath); ok { 1331 switch tp.selector { 1332 case TsCndSpec_FieldPathSelectorQueries: 1333 mySubMasks[TsCndSpec_FieldPathSelectorQueries] = FullTsCndSpec_Query_FieldMask() 1334 case TsCndSpec_FieldPathSelectorThresholdAlerting: 1335 mySubMasks[TsCndSpec_FieldPathSelectorThresholdAlerting] = FullTsCndSpec_ThresholdAlertingCfg_FieldMask() 1336 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 1337 mySubMasks[TsCndSpec_FieldPathSelectorAnomalyAlerting] = FullTsCndSpec_AnomalyAlertingCfg_FieldMask() 1338 } 1339 } else if tp, ok := path.(*TsCndSpec_FieldSubPath); ok { 1340 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1341 } 1342 } else { 1343 result.Paths = append(result.Paths, path) 1344 } 1345 } 1346 } 1347 for selector, mySubMask := range mySubMasks { 1348 if mySubMask.PathsCount() > 0 { 1349 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1350 result.Paths = append(result.Paths, &TsCndSpec_FieldSubPath{selector: selector, subPath: allowedPath}) 1351 } 1352 } 1353 } 1354 1355 if len(result.Paths) == 0 { 1356 return nil 1357 } 1358 return result 1359 } 1360 1361 func (fieldMask *TsCndSpec_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1362 return fieldMask.Subtract(other.(*TsCndSpec_FieldMask)) 1363 } 1364 1365 // FilterInputFields generates copy of field paths with output_only field paths removed 1366 func (fieldMask *TsCndSpec_FieldMask) FilterInputFields() *TsCndSpec_FieldMask { 1367 result := &TsCndSpec_FieldMask{} 1368 result.Paths = append(result.Paths, fieldMask.Paths...) 1369 return result 1370 } 1371 1372 // ToFieldMask is used for proto conversions 1373 func (fieldMask *TsCndSpec_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1374 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1375 for _, path := range fieldMask.Paths { 1376 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1377 } 1378 return protoFieldMask 1379 } 1380 1381 func (fieldMask *TsCndSpec_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1382 if fieldMask == nil { 1383 return status.Error(codes.Internal, "target field mask is nil") 1384 } 1385 fieldMask.Paths = make([]TsCndSpec_FieldPath, 0, len(protoFieldMask.Paths)) 1386 for _, strPath := range protoFieldMask.Paths { 1387 path, err := ParseTsCndSpec_FieldPath(strPath) 1388 if err != nil { 1389 return err 1390 } 1391 fieldMask.Paths = append(fieldMask.Paths, path) 1392 } 1393 return nil 1394 } 1395 1396 // implement methods required by customType 1397 func (fieldMask TsCndSpec_FieldMask) Marshal() ([]byte, error) { 1398 protoFieldMask := fieldMask.ToProtoFieldMask() 1399 return proto.Marshal(protoFieldMask) 1400 } 1401 1402 func (fieldMask *TsCndSpec_FieldMask) Unmarshal(data []byte) error { 1403 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1404 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1405 return err 1406 } 1407 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1408 return err 1409 } 1410 return nil 1411 } 1412 1413 func (fieldMask *TsCndSpec_FieldMask) Size() int { 1414 return proto.Size(fieldMask.ToProtoFieldMask()) 1415 } 1416 1417 func (fieldMask TsCndSpec_FieldMask) MarshalJSON() ([]byte, error) { 1418 return json.Marshal(fieldMask.ToProtoFieldMask()) 1419 } 1420 1421 func (fieldMask *TsCndSpec_FieldMask) UnmarshalJSON(data []byte) error { 1422 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1423 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1424 return err 1425 } 1426 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1427 return err 1428 } 1429 return nil 1430 } 1431 1432 func (fieldMask *TsCndSpec_FieldMask) AppendPath(path TsCndSpec_FieldPath) { 1433 fieldMask.Paths = append(fieldMask.Paths, path) 1434 } 1435 1436 func (fieldMask *TsCndSpec_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1437 fieldMask.Paths = append(fieldMask.Paths, path.(TsCndSpec_FieldPath)) 1438 } 1439 1440 func (fieldMask *TsCndSpec_FieldMask) GetPaths() []TsCndSpec_FieldPath { 1441 if fieldMask == nil { 1442 return nil 1443 } 1444 return fieldMask.Paths 1445 } 1446 1447 func (fieldMask *TsCndSpec_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1448 if fieldMask == nil { 1449 return nil 1450 } 1451 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1452 for _, path := range fieldMask.Paths { 1453 rawPaths = append(rawPaths, path) 1454 } 1455 return rawPaths 1456 } 1457 1458 func (fieldMask *TsCndSpec_FieldMask) SetFromCliFlag(raw string) error { 1459 path, err := ParseTsCndSpec_FieldPath(raw) 1460 if err != nil { 1461 return err 1462 } 1463 fieldMask.Paths = append(fieldMask.Paths, path) 1464 return nil 1465 } 1466 1467 func (fieldMask *TsCndSpec_FieldMask) Set(target, source *TsCndSpec) { 1468 for _, path := range fieldMask.Paths { 1469 val, _ := path.GetSingle(source) 1470 // if val is nil, then field does not exist in source, skip 1471 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1472 if val != nil { 1473 path.WithIValue(val).SetTo(&target) 1474 } 1475 } 1476 } 1477 1478 func (fieldMask *TsCndSpec_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1479 fieldMask.Set(target.(*TsCndSpec), source.(*TsCndSpec)) 1480 } 1481 1482 func (fieldMask *TsCndSpec_FieldMask) Project(source *TsCndSpec) *TsCndSpec { 1483 if source == nil { 1484 return nil 1485 } 1486 if fieldMask == nil { 1487 return source 1488 } 1489 result := &TsCndSpec{} 1490 queriesMask := &TsCndSpec_Query_FieldMask{} 1491 wholeQueriesAccepted := false 1492 thresholdAlertingMask := &TsCndSpec_ThresholdAlertingCfg_FieldMask{} 1493 wholeThresholdAlertingAccepted := false 1494 anomalyAlertingMask := &TsCndSpec_AnomalyAlertingCfg_FieldMask{} 1495 wholeAnomalyAlertingAccepted := false 1496 1497 for _, p := range fieldMask.Paths { 1498 switch tp := p.(type) { 1499 case *TsCndSpec_FieldTerminalPath: 1500 switch tp.selector { 1501 case TsCndSpec_FieldPathSelectorQueries: 1502 result.Queries = source.Queries 1503 wholeQueriesAccepted = true 1504 case TsCndSpec_FieldPathSelectorQueryGroupBy: 1505 result.QueryGroupBy = source.QueryGroupBy 1506 case TsCndSpec_FieldPathSelectorThresholdAlerting: 1507 result.ThresholdAlerting = source.ThresholdAlerting 1508 wholeThresholdAlertingAccepted = true 1509 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 1510 result.AnomalyAlerting = source.AnomalyAlerting 1511 wholeAnomalyAlertingAccepted = true 1512 } 1513 case *TsCndSpec_FieldSubPath: 1514 switch tp.selector { 1515 case TsCndSpec_FieldPathSelectorQueries: 1516 queriesMask.AppendPath(tp.subPath.(TsCndSpecQuery_FieldPath)) 1517 case TsCndSpec_FieldPathSelectorThresholdAlerting: 1518 thresholdAlertingMask.AppendPath(tp.subPath.(TsCndSpecThresholdAlertingCfg_FieldPath)) 1519 case TsCndSpec_FieldPathSelectorAnomalyAlerting: 1520 anomalyAlertingMask.AppendPath(tp.subPath.(TsCndSpecAnomalyAlertingCfg_FieldPath)) 1521 } 1522 } 1523 } 1524 if wholeQueriesAccepted == false && len(queriesMask.Paths) > 0 { 1525 for _, sourceItem := range source.GetQueries() { 1526 result.Queries = append(result.Queries, queriesMask.Project(sourceItem)) 1527 } 1528 } 1529 if wholeThresholdAlertingAccepted == false && len(thresholdAlertingMask.Paths) > 0 { 1530 result.ThresholdAlerting = thresholdAlertingMask.Project(source.GetThresholdAlerting()) 1531 } 1532 if wholeAnomalyAlertingAccepted == false && len(anomalyAlertingMask.Paths) > 0 { 1533 for _, sourceItem := range source.GetAnomalyAlerting() { 1534 result.AnomalyAlerting = append(result.AnomalyAlerting, anomalyAlertingMask.Project(sourceItem)) 1535 } 1536 } 1537 return result 1538 } 1539 1540 func (fieldMask *TsCndSpec_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1541 return fieldMask.Project(source.(*TsCndSpec)) 1542 } 1543 1544 func (fieldMask *TsCndSpec_FieldMask) PathsCount() int { 1545 if fieldMask == nil { 1546 return 0 1547 } 1548 return len(fieldMask.Paths) 1549 } 1550 1551 type TsCndSpec_Query_FieldMask struct { 1552 Paths []TsCndSpecQuery_FieldPath 1553 } 1554 1555 func FullTsCndSpec_Query_FieldMask() *TsCndSpec_Query_FieldMask { 1556 res := &TsCndSpec_Query_FieldMask{} 1557 res.Paths = append(res.Paths, &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorName}) 1558 res.Paths = append(res.Paths, &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorFilter}) 1559 res.Paths = append(res.Paths, &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorAligner}) 1560 res.Paths = append(res.Paths, &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorReducer}) 1561 res.Paths = append(res.Paths, &TsCndSpecQuery_FieldTerminalPath{selector: TsCndSpecQuery_FieldPathSelectorMaxValue}) 1562 return res 1563 } 1564 1565 func (fieldMask *TsCndSpec_Query_FieldMask) String() string { 1566 if fieldMask == nil { 1567 return "<nil>" 1568 } 1569 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1570 for _, path := range fieldMask.Paths { 1571 pathsStr = append(pathsStr, path.String()) 1572 } 1573 return strings.Join(pathsStr, ", ") 1574 } 1575 1576 func (fieldMask *TsCndSpec_Query_FieldMask) IsFull() bool { 1577 if fieldMask == nil { 1578 return false 1579 } 1580 presentSelectors := make([]bool, 5) 1581 for _, path := range fieldMask.Paths { 1582 if asFinal, ok := path.(*TsCndSpecQuery_FieldTerminalPath); ok { 1583 presentSelectors[int(asFinal.selector)] = true 1584 } 1585 } 1586 for _, flag := range presentSelectors { 1587 if !flag { 1588 return false 1589 } 1590 } 1591 return true 1592 } 1593 1594 func (fieldMask *TsCndSpec_Query_FieldMask) ProtoReflect() preflect.Message { 1595 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1596 return ParseTsCndSpecQuery_FieldPath(raw) 1597 }) 1598 } 1599 1600 func (fieldMask *TsCndSpec_Query_FieldMask) ProtoMessage() {} 1601 1602 func (fieldMask *TsCndSpec_Query_FieldMask) Reset() { 1603 if fieldMask != nil { 1604 fieldMask.Paths = nil 1605 } 1606 } 1607 1608 func (fieldMask *TsCndSpec_Query_FieldMask) Subtract(other *TsCndSpec_Query_FieldMask) *TsCndSpec_Query_FieldMask { 1609 result := &TsCndSpec_Query_FieldMask{} 1610 removedSelectors := make([]bool, 5) 1611 1612 for _, path := range other.GetPaths() { 1613 switch tp := path.(type) { 1614 case *TsCndSpecQuery_FieldTerminalPath: 1615 removedSelectors[int(tp.selector)] = true 1616 } 1617 } 1618 for _, path := range fieldMask.GetPaths() { 1619 if !removedSelectors[int(path.Selector())] { 1620 result.Paths = append(result.Paths, path) 1621 } 1622 } 1623 1624 if len(result.Paths) == 0 { 1625 return nil 1626 } 1627 return result 1628 } 1629 1630 func (fieldMask *TsCndSpec_Query_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1631 return fieldMask.Subtract(other.(*TsCndSpec_Query_FieldMask)) 1632 } 1633 1634 // FilterInputFields generates copy of field paths with output_only field paths removed 1635 func (fieldMask *TsCndSpec_Query_FieldMask) FilterInputFields() *TsCndSpec_Query_FieldMask { 1636 result := &TsCndSpec_Query_FieldMask{} 1637 result.Paths = append(result.Paths, fieldMask.Paths...) 1638 return result 1639 } 1640 1641 // ToFieldMask is used for proto conversions 1642 func (fieldMask *TsCndSpec_Query_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1643 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1644 for _, path := range fieldMask.Paths { 1645 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1646 } 1647 return protoFieldMask 1648 } 1649 1650 func (fieldMask *TsCndSpec_Query_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1651 if fieldMask == nil { 1652 return status.Error(codes.Internal, "target field mask is nil") 1653 } 1654 fieldMask.Paths = make([]TsCndSpecQuery_FieldPath, 0, len(protoFieldMask.Paths)) 1655 for _, strPath := range protoFieldMask.Paths { 1656 path, err := ParseTsCndSpecQuery_FieldPath(strPath) 1657 if err != nil { 1658 return err 1659 } 1660 fieldMask.Paths = append(fieldMask.Paths, path) 1661 } 1662 return nil 1663 } 1664 1665 // implement methods required by customType 1666 func (fieldMask TsCndSpec_Query_FieldMask) Marshal() ([]byte, error) { 1667 protoFieldMask := fieldMask.ToProtoFieldMask() 1668 return proto.Marshal(protoFieldMask) 1669 } 1670 1671 func (fieldMask *TsCndSpec_Query_FieldMask) Unmarshal(data []byte) error { 1672 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1673 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1674 return err 1675 } 1676 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1677 return err 1678 } 1679 return nil 1680 } 1681 1682 func (fieldMask *TsCndSpec_Query_FieldMask) Size() int { 1683 return proto.Size(fieldMask.ToProtoFieldMask()) 1684 } 1685 1686 func (fieldMask TsCndSpec_Query_FieldMask) MarshalJSON() ([]byte, error) { 1687 return json.Marshal(fieldMask.ToProtoFieldMask()) 1688 } 1689 1690 func (fieldMask *TsCndSpec_Query_FieldMask) UnmarshalJSON(data []byte) error { 1691 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1692 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1693 return err 1694 } 1695 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1696 return err 1697 } 1698 return nil 1699 } 1700 1701 func (fieldMask *TsCndSpec_Query_FieldMask) AppendPath(path TsCndSpecQuery_FieldPath) { 1702 fieldMask.Paths = append(fieldMask.Paths, path) 1703 } 1704 1705 func (fieldMask *TsCndSpec_Query_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1706 fieldMask.Paths = append(fieldMask.Paths, path.(TsCndSpecQuery_FieldPath)) 1707 } 1708 1709 func (fieldMask *TsCndSpec_Query_FieldMask) GetPaths() []TsCndSpecQuery_FieldPath { 1710 if fieldMask == nil { 1711 return nil 1712 } 1713 return fieldMask.Paths 1714 } 1715 1716 func (fieldMask *TsCndSpec_Query_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1717 if fieldMask == nil { 1718 return nil 1719 } 1720 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1721 for _, path := range fieldMask.Paths { 1722 rawPaths = append(rawPaths, path) 1723 } 1724 return rawPaths 1725 } 1726 1727 func (fieldMask *TsCndSpec_Query_FieldMask) SetFromCliFlag(raw string) error { 1728 path, err := ParseTsCndSpecQuery_FieldPath(raw) 1729 if err != nil { 1730 return err 1731 } 1732 fieldMask.Paths = append(fieldMask.Paths, path) 1733 return nil 1734 } 1735 1736 func (fieldMask *TsCndSpec_Query_FieldMask) Set(target, source *TsCndSpec_Query) { 1737 for _, path := range fieldMask.Paths { 1738 val, _ := path.GetSingle(source) 1739 // if val is nil, then field does not exist in source, skip 1740 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1741 if val != nil { 1742 path.WithIValue(val).SetTo(&target) 1743 } 1744 } 1745 } 1746 1747 func (fieldMask *TsCndSpec_Query_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1748 fieldMask.Set(target.(*TsCndSpec_Query), source.(*TsCndSpec_Query)) 1749 } 1750 1751 func (fieldMask *TsCndSpec_Query_FieldMask) Project(source *TsCndSpec_Query) *TsCndSpec_Query { 1752 if source == nil { 1753 return nil 1754 } 1755 if fieldMask == nil { 1756 return source 1757 } 1758 result := &TsCndSpec_Query{} 1759 1760 for _, p := range fieldMask.Paths { 1761 switch tp := p.(type) { 1762 case *TsCndSpecQuery_FieldTerminalPath: 1763 switch tp.selector { 1764 case TsCndSpecQuery_FieldPathSelectorName: 1765 result.Name = source.Name 1766 case TsCndSpecQuery_FieldPathSelectorFilter: 1767 result.Filter = source.Filter 1768 case TsCndSpecQuery_FieldPathSelectorAligner: 1769 result.Aligner = source.Aligner 1770 case TsCndSpecQuery_FieldPathSelectorReducer: 1771 result.Reducer = source.Reducer 1772 case TsCndSpecQuery_FieldPathSelectorMaxValue: 1773 result.MaxValue = source.MaxValue 1774 } 1775 } 1776 } 1777 return result 1778 } 1779 1780 func (fieldMask *TsCndSpec_Query_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1781 return fieldMask.Project(source.(*TsCndSpec_Query)) 1782 } 1783 1784 func (fieldMask *TsCndSpec_Query_FieldMask) PathsCount() int { 1785 if fieldMask == nil { 1786 return 0 1787 } 1788 return len(fieldMask.Paths) 1789 } 1790 1791 type TsCndSpec_ThresholdAlertingCfg_FieldMask struct { 1792 Paths []TsCndSpecThresholdAlertingCfg_FieldPath 1793 } 1794 1795 func FullTsCndSpec_ThresholdAlertingCfg_FieldMask() *TsCndSpec_ThresholdAlertingCfg_FieldMask { 1796 res := &TsCndSpec_ThresholdAlertingCfg_FieldMask{} 1797 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator}) 1798 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod}) 1799 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter}) 1800 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter}) 1801 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds}) 1802 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfg_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod}) 1803 return res 1804 } 1805 1806 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) String() string { 1807 if fieldMask == nil { 1808 return "<nil>" 1809 } 1810 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1811 for _, path := range fieldMask.Paths { 1812 pathsStr = append(pathsStr, path.String()) 1813 } 1814 return strings.Join(pathsStr, ", ") 1815 } 1816 1817 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) IsFull() bool { 1818 if fieldMask == nil { 1819 return false 1820 } 1821 presentSelectors := make([]bool, 6) 1822 for _, path := range fieldMask.Paths { 1823 if asFinal, ok := path.(*TsCndSpecThresholdAlertingCfg_FieldTerminalPath); ok { 1824 presentSelectors[int(asFinal.selector)] = true 1825 } 1826 } 1827 for _, flag := range presentSelectors { 1828 if !flag { 1829 return false 1830 } 1831 } 1832 return true 1833 } 1834 1835 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) ProtoReflect() preflect.Message { 1836 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1837 return ParseTsCndSpecThresholdAlertingCfg_FieldPath(raw) 1838 }) 1839 } 1840 1841 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) ProtoMessage() {} 1842 1843 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) Reset() { 1844 if fieldMask != nil { 1845 fieldMask.Paths = nil 1846 } 1847 } 1848 1849 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) Subtract(other *TsCndSpec_ThresholdAlertingCfg_FieldMask) *TsCndSpec_ThresholdAlertingCfg_FieldMask { 1850 result := &TsCndSpec_ThresholdAlertingCfg_FieldMask{} 1851 removedSelectors := make([]bool, 6) 1852 otherSubMasks := map[TsCndSpecThresholdAlertingCfg_FieldPathSelector]gotenobject.FieldMask{ 1853 TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: &TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask{}, 1854 } 1855 mySubMasks := map[TsCndSpecThresholdAlertingCfg_FieldPathSelector]gotenobject.FieldMask{ 1856 TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: &TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask{}, 1857 } 1858 1859 for _, path := range other.GetPaths() { 1860 switch tp := path.(type) { 1861 case *TsCndSpecThresholdAlertingCfg_FieldTerminalPath: 1862 removedSelectors[int(tp.selector)] = true 1863 case *TsCndSpecThresholdAlertingCfg_FieldSubPath: 1864 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1865 } 1866 } 1867 for _, path := range fieldMask.GetPaths() { 1868 if !removedSelectors[int(path.Selector())] { 1869 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1870 if tp, ok := path.(*TsCndSpecThresholdAlertingCfg_FieldTerminalPath); ok { 1871 switch tp.selector { 1872 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 1873 mySubMasks[TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds] = FullTsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask() 1874 } 1875 } else if tp, ok := path.(*TsCndSpecThresholdAlertingCfg_FieldSubPath); ok { 1876 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1877 } 1878 } else { 1879 result.Paths = append(result.Paths, path) 1880 } 1881 } 1882 } 1883 for selector, mySubMask := range mySubMasks { 1884 if mySubMask.PathsCount() > 0 { 1885 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1886 result.Paths = append(result.Paths, &TsCndSpecThresholdAlertingCfg_FieldSubPath{selector: selector, subPath: allowedPath}) 1887 } 1888 } 1889 } 1890 1891 if len(result.Paths) == 0 { 1892 return nil 1893 } 1894 return result 1895 } 1896 1897 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1898 return fieldMask.Subtract(other.(*TsCndSpec_ThresholdAlertingCfg_FieldMask)) 1899 } 1900 1901 // FilterInputFields generates copy of field paths with output_only field paths removed 1902 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) FilterInputFields() *TsCndSpec_ThresholdAlertingCfg_FieldMask { 1903 result := &TsCndSpec_ThresholdAlertingCfg_FieldMask{} 1904 result.Paths = append(result.Paths, fieldMask.Paths...) 1905 return result 1906 } 1907 1908 // ToFieldMask is used for proto conversions 1909 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1910 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1911 for _, path := range fieldMask.Paths { 1912 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1913 } 1914 return protoFieldMask 1915 } 1916 1917 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1918 if fieldMask == nil { 1919 return status.Error(codes.Internal, "target field mask is nil") 1920 } 1921 fieldMask.Paths = make([]TsCndSpecThresholdAlertingCfg_FieldPath, 0, len(protoFieldMask.Paths)) 1922 for _, strPath := range protoFieldMask.Paths { 1923 path, err := ParseTsCndSpecThresholdAlertingCfg_FieldPath(strPath) 1924 if err != nil { 1925 return err 1926 } 1927 fieldMask.Paths = append(fieldMask.Paths, path) 1928 } 1929 return nil 1930 } 1931 1932 // implement methods required by customType 1933 func (fieldMask TsCndSpec_ThresholdAlertingCfg_FieldMask) Marshal() ([]byte, error) { 1934 protoFieldMask := fieldMask.ToProtoFieldMask() 1935 return proto.Marshal(protoFieldMask) 1936 } 1937 1938 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) Unmarshal(data []byte) error { 1939 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1940 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1941 return err 1942 } 1943 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1944 return err 1945 } 1946 return nil 1947 } 1948 1949 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) Size() int { 1950 return proto.Size(fieldMask.ToProtoFieldMask()) 1951 } 1952 1953 func (fieldMask TsCndSpec_ThresholdAlertingCfg_FieldMask) MarshalJSON() ([]byte, error) { 1954 return json.Marshal(fieldMask.ToProtoFieldMask()) 1955 } 1956 1957 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) UnmarshalJSON(data []byte) error { 1958 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1959 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1960 return err 1961 } 1962 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1963 return err 1964 } 1965 return nil 1966 } 1967 1968 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) AppendPath(path TsCndSpecThresholdAlertingCfg_FieldPath) { 1969 fieldMask.Paths = append(fieldMask.Paths, path) 1970 } 1971 1972 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1973 fieldMask.Paths = append(fieldMask.Paths, path.(TsCndSpecThresholdAlertingCfg_FieldPath)) 1974 } 1975 1976 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) GetPaths() []TsCndSpecThresholdAlertingCfg_FieldPath { 1977 if fieldMask == nil { 1978 return nil 1979 } 1980 return fieldMask.Paths 1981 } 1982 1983 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1984 if fieldMask == nil { 1985 return nil 1986 } 1987 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1988 for _, path := range fieldMask.Paths { 1989 rawPaths = append(rawPaths, path) 1990 } 1991 return rawPaths 1992 } 1993 1994 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) SetFromCliFlag(raw string) error { 1995 path, err := ParseTsCndSpecThresholdAlertingCfg_FieldPath(raw) 1996 if err != nil { 1997 return err 1998 } 1999 fieldMask.Paths = append(fieldMask.Paths, path) 2000 return nil 2001 } 2002 2003 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) Set(target, source *TsCndSpec_ThresholdAlertingCfg) { 2004 for _, path := range fieldMask.Paths { 2005 val, _ := path.GetSingle(source) 2006 // if val is nil, then field does not exist in source, skip 2007 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2008 if val != nil { 2009 path.WithIValue(val).SetTo(&target) 2010 } 2011 } 2012 } 2013 2014 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2015 fieldMask.Set(target.(*TsCndSpec_ThresholdAlertingCfg), source.(*TsCndSpec_ThresholdAlertingCfg)) 2016 } 2017 2018 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) Project(source *TsCndSpec_ThresholdAlertingCfg) *TsCndSpec_ThresholdAlertingCfg { 2019 if source == nil { 2020 return nil 2021 } 2022 if fieldMask == nil { 2023 return source 2024 } 2025 result := &TsCndSpec_ThresholdAlertingCfg{} 2026 perQueryThresholdsMask := &TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask{} 2027 wholePerQueryThresholdsAccepted := false 2028 2029 for _, p := range fieldMask.Paths { 2030 switch tp := p.(type) { 2031 case *TsCndSpecThresholdAlertingCfg_FieldTerminalPath: 2032 switch tp.selector { 2033 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorOperator: 2034 result.Operator = source.Operator 2035 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAlignmentPeriod: 2036 result.AlignmentPeriod = source.AlignmentPeriod 2037 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorRaiseAfter: 2038 result.RaiseAfter = source.RaiseAfter 2039 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorSilenceAfter: 2040 result.SilenceAfter = source.SilenceAfter 2041 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 2042 result.PerQueryThresholds = source.PerQueryThresholds 2043 wholePerQueryThresholdsAccepted = true 2044 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorAdaptiveThresholdsDetectionPeriod: 2045 result.AdaptiveThresholdsDetectionPeriod = source.AdaptiveThresholdsDetectionPeriod 2046 } 2047 case *TsCndSpecThresholdAlertingCfg_FieldSubPath: 2048 switch tp.selector { 2049 case TsCndSpecThresholdAlertingCfg_FieldPathSelectorPerQueryThresholds: 2050 perQueryThresholdsMask.AppendPath(tp.subPath.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath)) 2051 } 2052 } 2053 } 2054 if wholePerQueryThresholdsAccepted == false && len(perQueryThresholdsMask.Paths) > 0 { 2055 for _, sourceItem := range source.GetPerQueryThresholds() { 2056 result.PerQueryThresholds = append(result.PerQueryThresholds, perQueryThresholdsMask.Project(sourceItem)) 2057 } 2058 } 2059 return result 2060 } 2061 2062 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2063 return fieldMask.Project(source.(*TsCndSpec_ThresholdAlertingCfg)) 2064 } 2065 2066 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_FieldMask) PathsCount() int { 2067 if fieldMask == nil { 2068 return 0 2069 } 2070 return len(fieldMask.Paths) 2071 } 2072 2073 type TsCndSpec_AnomalyAlertingCfg_FieldMask struct { 2074 Paths []TsCndSpecAnomalyAlertingCfg_FieldPath 2075 } 2076 2077 func FullTsCndSpec_AnomalyAlertingCfg_FieldMask() *TsCndSpec_AnomalyAlertingCfg_FieldMask { 2078 res := &TsCndSpec_AnomalyAlertingCfg_FieldMask{} 2079 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow}) 2080 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval}) 2081 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval}) 2082 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod}) 2083 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder}) 2084 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter}) 2085 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfg_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter}) 2086 return res 2087 } 2088 2089 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) String() string { 2090 if fieldMask == nil { 2091 return "<nil>" 2092 } 2093 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2094 for _, path := range fieldMask.Paths { 2095 pathsStr = append(pathsStr, path.String()) 2096 } 2097 return strings.Join(pathsStr, ", ") 2098 } 2099 2100 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) IsFull() bool { 2101 if fieldMask == nil { 2102 return false 2103 } 2104 presentSelectors := make([]bool, 7) 2105 for _, path := range fieldMask.Paths { 2106 if asFinal, ok := path.(*TsCndSpecAnomalyAlertingCfg_FieldTerminalPath); ok { 2107 presentSelectors[int(asFinal.selector)] = true 2108 } 2109 } 2110 for _, flag := range presentSelectors { 2111 if !flag { 2112 return false 2113 } 2114 } 2115 return true 2116 } 2117 2118 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) ProtoReflect() preflect.Message { 2119 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2120 return ParseTsCndSpecAnomalyAlertingCfg_FieldPath(raw) 2121 }) 2122 } 2123 2124 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) ProtoMessage() {} 2125 2126 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) Reset() { 2127 if fieldMask != nil { 2128 fieldMask.Paths = nil 2129 } 2130 } 2131 2132 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) Subtract(other *TsCndSpec_AnomalyAlertingCfg_FieldMask) *TsCndSpec_AnomalyAlertingCfg_FieldMask { 2133 result := &TsCndSpec_AnomalyAlertingCfg_FieldMask{} 2134 removedSelectors := make([]bool, 7) 2135 otherSubMasks := map[TsCndSpecAnomalyAlertingCfg_FieldPathSelector]gotenobject.FieldMask{ 2136 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: &TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask{}, 2137 } 2138 mySubMasks := map[TsCndSpecAnomalyAlertingCfg_FieldPathSelector]gotenobject.FieldMask{ 2139 TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: &TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask{}, 2140 } 2141 2142 for _, path := range other.GetPaths() { 2143 switch tp := path.(type) { 2144 case *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: 2145 removedSelectors[int(tp.selector)] = true 2146 case *TsCndSpecAnomalyAlertingCfg_FieldSubPath: 2147 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 2148 } 2149 } 2150 for _, path := range fieldMask.GetPaths() { 2151 if !removedSelectors[int(path.Selector())] { 2152 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 2153 if tp, ok := path.(*TsCndSpecAnomalyAlertingCfg_FieldTerminalPath); ok { 2154 switch tp.selector { 2155 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 2156 mySubMasks[TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder] = FullTsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask() 2157 } 2158 } else if tp, ok := path.(*TsCndSpecAnomalyAlertingCfg_FieldSubPath); ok { 2159 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 2160 } 2161 } else { 2162 result.Paths = append(result.Paths, path) 2163 } 2164 } 2165 } 2166 for selector, mySubMask := range mySubMasks { 2167 if mySubMask.PathsCount() > 0 { 2168 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 2169 result.Paths = append(result.Paths, &TsCndSpecAnomalyAlertingCfg_FieldSubPath{selector: selector, subPath: allowedPath}) 2170 } 2171 } 2172 } 2173 2174 if len(result.Paths) == 0 { 2175 return nil 2176 } 2177 return result 2178 } 2179 2180 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2181 return fieldMask.Subtract(other.(*TsCndSpec_AnomalyAlertingCfg_FieldMask)) 2182 } 2183 2184 // FilterInputFields generates copy of field paths with output_only field paths removed 2185 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) FilterInputFields() *TsCndSpec_AnomalyAlertingCfg_FieldMask { 2186 result := &TsCndSpec_AnomalyAlertingCfg_FieldMask{} 2187 result.Paths = append(result.Paths, fieldMask.Paths...) 2188 return result 2189 } 2190 2191 // ToFieldMask is used for proto conversions 2192 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2193 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2194 for _, path := range fieldMask.Paths { 2195 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2196 } 2197 return protoFieldMask 2198 } 2199 2200 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2201 if fieldMask == nil { 2202 return status.Error(codes.Internal, "target field mask is nil") 2203 } 2204 fieldMask.Paths = make([]TsCndSpecAnomalyAlertingCfg_FieldPath, 0, len(protoFieldMask.Paths)) 2205 for _, strPath := range protoFieldMask.Paths { 2206 path, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPath(strPath) 2207 if err != nil { 2208 return err 2209 } 2210 fieldMask.Paths = append(fieldMask.Paths, path) 2211 } 2212 return nil 2213 } 2214 2215 // implement methods required by customType 2216 func (fieldMask TsCndSpec_AnomalyAlertingCfg_FieldMask) Marshal() ([]byte, error) { 2217 protoFieldMask := fieldMask.ToProtoFieldMask() 2218 return proto.Marshal(protoFieldMask) 2219 } 2220 2221 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) Unmarshal(data []byte) error { 2222 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2223 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2224 return err 2225 } 2226 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2227 return err 2228 } 2229 return nil 2230 } 2231 2232 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) Size() int { 2233 return proto.Size(fieldMask.ToProtoFieldMask()) 2234 } 2235 2236 func (fieldMask TsCndSpec_AnomalyAlertingCfg_FieldMask) MarshalJSON() ([]byte, error) { 2237 return json.Marshal(fieldMask.ToProtoFieldMask()) 2238 } 2239 2240 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) UnmarshalJSON(data []byte) error { 2241 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2242 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2243 return err 2244 } 2245 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2246 return err 2247 } 2248 return nil 2249 } 2250 2251 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) AppendPath(path TsCndSpecAnomalyAlertingCfg_FieldPath) { 2252 fieldMask.Paths = append(fieldMask.Paths, path) 2253 } 2254 2255 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2256 fieldMask.Paths = append(fieldMask.Paths, path.(TsCndSpecAnomalyAlertingCfg_FieldPath)) 2257 } 2258 2259 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) GetPaths() []TsCndSpecAnomalyAlertingCfg_FieldPath { 2260 if fieldMask == nil { 2261 return nil 2262 } 2263 return fieldMask.Paths 2264 } 2265 2266 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2267 if fieldMask == nil { 2268 return nil 2269 } 2270 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2271 for _, path := range fieldMask.Paths { 2272 rawPaths = append(rawPaths, path) 2273 } 2274 return rawPaths 2275 } 2276 2277 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) SetFromCliFlag(raw string) error { 2278 path, err := ParseTsCndSpecAnomalyAlertingCfg_FieldPath(raw) 2279 if err != nil { 2280 return err 2281 } 2282 fieldMask.Paths = append(fieldMask.Paths, path) 2283 return nil 2284 } 2285 2286 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) Set(target, source *TsCndSpec_AnomalyAlertingCfg) { 2287 for _, path := range fieldMask.Paths { 2288 val, _ := path.GetSingle(source) 2289 // if val is nil, then field does not exist in source, skip 2290 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2291 if val != nil { 2292 path.WithIValue(val).SetTo(&target) 2293 } 2294 } 2295 } 2296 2297 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2298 fieldMask.Set(target.(*TsCndSpec_AnomalyAlertingCfg), source.(*TsCndSpec_AnomalyAlertingCfg)) 2299 } 2300 2301 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) Project(source *TsCndSpec_AnomalyAlertingCfg) *TsCndSpec_AnomalyAlertingCfg { 2302 if source == nil { 2303 return nil 2304 } 2305 if fieldMask == nil { 2306 return source 2307 } 2308 result := &TsCndSpec_AnomalyAlertingCfg{} 2309 lstmAutoencoderMask := &TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask{} 2310 wholeLstmAutoencoderAccepted := false 2311 2312 for _, p := range fieldMask.Paths { 2313 switch tp := p.(type) { 2314 case *TsCndSpecAnomalyAlertingCfg_FieldTerminalPath: 2315 switch tp.selector { 2316 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAnalysisWindow: 2317 result.AnalysisWindow = source.AnalysisWindow 2318 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorStepInterval: 2319 result.StepInterval = source.StepInterval 2320 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorTrainStepInterval: 2321 result.TrainStepInterval = source.TrainStepInterval 2322 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorAlignmentPeriod: 2323 result.AlignmentPeriod = source.AlignmentPeriod 2324 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 2325 if source, ok := source.Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder); ok { 2326 result.Model = &TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder{ 2327 LstmAutoencoder: source.LstmAutoencoder, 2328 } 2329 } 2330 wholeLstmAutoencoderAccepted = true 2331 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorRaiseAfter: 2332 result.RaiseAfter = source.RaiseAfter 2333 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorSilenceAfter: 2334 result.SilenceAfter = source.SilenceAfter 2335 } 2336 case *TsCndSpecAnomalyAlertingCfg_FieldSubPath: 2337 switch tp.selector { 2338 case TsCndSpecAnomalyAlertingCfg_FieldPathSelectorLstmAutoencoder: 2339 lstmAutoencoderMask.AppendPath(tp.subPath.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath)) 2340 } 2341 } 2342 } 2343 if wholeLstmAutoencoderAccepted == false && len(lstmAutoencoderMask.Paths) > 0 { 2344 if asOneOf, ok := source.Model.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder); ok { 2345 result.Model = (*TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder)(nil) 2346 if asOneOf != nil { 2347 oneOfRes := &TsCndSpec_AnomalyAlertingCfg_LstmAutoencoder{} 2348 oneOfRes.LstmAutoencoder = lstmAutoencoderMask.Project(asOneOf.LstmAutoencoder) 2349 result.Model = oneOfRes 2350 } 2351 } 2352 } 2353 return result 2354 } 2355 2356 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2357 return fieldMask.Project(source.(*TsCndSpec_AnomalyAlertingCfg)) 2358 } 2359 2360 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_FieldMask) PathsCount() int { 2361 if fieldMask == nil { 2362 return 0 2363 } 2364 return len(fieldMask.Paths) 2365 } 2366 2367 type TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask struct { 2368 Paths []TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath 2369 } 2370 2371 func FullTsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask() *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask { 2372 res := &TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask{} 2373 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper}) 2374 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower}) 2375 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper}) 2376 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower}) 2377 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper}) 2378 res.Paths = append(res.Paths, &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath{selector: TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower}) 2379 return res 2380 } 2381 2382 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) String() string { 2383 if fieldMask == nil { 2384 return "<nil>" 2385 } 2386 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2387 for _, path := range fieldMask.Paths { 2388 pathsStr = append(pathsStr, path.String()) 2389 } 2390 return strings.Join(pathsStr, ", ") 2391 } 2392 2393 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) IsFull() bool { 2394 if fieldMask == nil { 2395 return false 2396 } 2397 presentSelectors := make([]bool, 6) 2398 for _, path := range fieldMask.Paths { 2399 if asFinal, ok := path.(*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath); ok { 2400 presentSelectors[int(asFinal.selector)] = true 2401 } 2402 } 2403 for _, flag := range presentSelectors { 2404 if !flag { 2405 return false 2406 } 2407 } 2408 return true 2409 } 2410 2411 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) ProtoReflect() preflect.Message { 2412 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2413 return ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(raw) 2414 }) 2415 } 2416 2417 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) ProtoMessage() {} 2418 2419 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) Reset() { 2420 if fieldMask != nil { 2421 fieldMask.Paths = nil 2422 } 2423 } 2424 2425 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) Subtract(other *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask { 2426 result := &TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask{} 2427 removedSelectors := make([]bool, 6) 2428 otherSubMasks := map[TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector]gotenobject.FieldMask{ 2429 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: &AlertingThreshold_FieldMask{}, 2430 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: &AlertingThreshold_FieldMask{}, 2431 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: &AlertingThreshold_FieldMask{}, 2432 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: &AlertingThreshold_FieldMask{}, 2433 } 2434 mySubMasks := map[TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelector]gotenobject.FieldMask{ 2435 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: &AlertingThreshold_FieldMask{}, 2436 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: &AlertingThreshold_FieldMask{}, 2437 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: &AlertingThreshold_FieldMask{}, 2438 TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: &AlertingThreshold_FieldMask{}, 2439 } 2440 2441 for _, path := range other.GetPaths() { 2442 switch tp := path.(type) { 2443 case *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: 2444 removedSelectors[int(tp.selector)] = true 2445 case *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath: 2446 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 2447 } 2448 } 2449 for _, path := range fieldMask.GetPaths() { 2450 if !removedSelectors[int(path.Selector())] { 2451 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 2452 if tp, ok := path.(*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath); ok { 2453 switch tp.selector { 2454 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 2455 mySubMasks[TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper] = FullAlertingThreshold_FieldMask() 2456 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 2457 mySubMasks[TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower] = FullAlertingThreshold_FieldMask() 2458 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 2459 mySubMasks[TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper] = FullAlertingThreshold_FieldMask() 2460 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 2461 mySubMasks[TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower] = FullAlertingThreshold_FieldMask() 2462 } 2463 } else if tp, ok := path.(*TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath); ok { 2464 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 2465 } 2466 } else { 2467 result.Paths = append(result.Paths, path) 2468 } 2469 } 2470 } 2471 for selector, mySubMask := range mySubMasks { 2472 if mySubMask.PathsCount() > 0 { 2473 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 2474 result.Paths = append(result.Paths, &TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath{selector: selector, subPath: allowedPath}) 2475 } 2476 } 2477 } 2478 2479 if len(result.Paths) == 0 { 2480 return nil 2481 } 2482 return result 2483 } 2484 2485 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2486 return fieldMask.Subtract(other.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask)) 2487 } 2488 2489 // FilterInputFields generates copy of field paths with output_only field paths removed 2490 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) FilterInputFields() *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask { 2491 result := &TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask{} 2492 result.Paths = append(result.Paths, fieldMask.Paths...) 2493 return result 2494 } 2495 2496 // ToFieldMask is used for proto conversions 2497 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2498 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2499 for _, path := range fieldMask.Paths { 2500 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2501 } 2502 return protoFieldMask 2503 } 2504 2505 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2506 if fieldMask == nil { 2507 return status.Error(codes.Internal, "target field mask is nil") 2508 } 2509 fieldMask.Paths = make([]TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath, 0, len(protoFieldMask.Paths)) 2510 for _, strPath := range protoFieldMask.Paths { 2511 path, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(strPath) 2512 if err != nil { 2513 return err 2514 } 2515 fieldMask.Paths = append(fieldMask.Paths, path) 2516 } 2517 return nil 2518 } 2519 2520 // implement methods required by customType 2521 func (fieldMask TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) Marshal() ([]byte, error) { 2522 protoFieldMask := fieldMask.ToProtoFieldMask() 2523 return proto.Marshal(protoFieldMask) 2524 } 2525 2526 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) Unmarshal(data []byte) error { 2527 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2528 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2529 return err 2530 } 2531 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2532 return err 2533 } 2534 return nil 2535 } 2536 2537 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) Size() int { 2538 return proto.Size(fieldMask.ToProtoFieldMask()) 2539 } 2540 2541 func (fieldMask TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) MarshalJSON() ([]byte, error) { 2542 return json.Marshal(fieldMask.ToProtoFieldMask()) 2543 } 2544 2545 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) UnmarshalJSON(data []byte) error { 2546 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2547 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2548 return err 2549 } 2550 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2551 return err 2552 } 2553 return nil 2554 } 2555 2556 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) AppendPath(path TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath) { 2557 fieldMask.Paths = append(fieldMask.Paths, path) 2558 } 2559 2560 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2561 fieldMask.Paths = append(fieldMask.Paths, path.(TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath)) 2562 } 2563 2564 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) GetPaths() []TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath { 2565 if fieldMask == nil { 2566 return nil 2567 } 2568 return fieldMask.Paths 2569 } 2570 2571 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2572 if fieldMask == nil { 2573 return nil 2574 } 2575 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2576 for _, path := range fieldMask.Paths { 2577 rawPaths = append(rawPaths, path) 2578 } 2579 return rawPaths 2580 } 2581 2582 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) SetFromCliFlag(raw string) error { 2583 path, err := ParseTsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPath(raw) 2584 if err != nil { 2585 return err 2586 } 2587 fieldMask.Paths = append(fieldMask.Paths, path) 2588 return nil 2589 } 2590 2591 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) Set(target, source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) { 2592 for _, path := range fieldMask.Paths { 2593 val, _ := path.GetSingle(source) 2594 // if val is nil, then field does not exist in source, skip 2595 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2596 if val != nil { 2597 path.WithIValue(val).SetTo(&target) 2598 } 2599 } 2600 } 2601 2602 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2603 fieldMask.Set(target.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds), source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 2604 } 2605 2606 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) Project(source *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds) *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds { 2607 if source == nil { 2608 return nil 2609 } 2610 if fieldMask == nil { 2611 return source 2612 } 2613 result := &TsCndSpec_ThresholdAlertingCfg_AlertingThresholds{} 2614 maxUpperMask := &AlertingThreshold_FieldMask{} 2615 wholeMaxUpperAccepted := false 2616 maxLowerMask := &AlertingThreshold_FieldMask{} 2617 wholeMaxLowerAccepted := false 2618 minUpperMask := &AlertingThreshold_FieldMask{} 2619 wholeMinUpperAccepted := false 2620 minLowerMask := &AlertingThreshold_FieldMask{} 2621 wholeMinLowerAccepted := false 2622 2623 for _, p := range fieldMask.Paths { 2624 switch tp := p.(type) { 2625 case *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldTerminalPath: 2626 switch tp.selector { 2627 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptUpper: 2628 result.AutoAdaptUpper = source.AutoAdaptUpper 2629 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorAutoAdaptLower: 2630 result.AutoAdaptLower = source.AutoAdaptLower 2631 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 2632 result.MaxUpper = source.MaxUpper 2633 wholeMaxUpperAccepted = true 2634 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 2635 result.MaxLower = source.MaxLower 2636 wholeMaxLowerAccepted = true 2637 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 2638 result.MinUpper = source.MinUpper 2639 wholeMinUpperAccepted = true 2640 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 2641 result.MinLower = source.MinLower 2642 wholeMinLowerAccepted = true 2643 } 2644 case *TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldSubPath: 2645 switch tp.selector { 2646 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxUpper: 2647 maxUpperMask.AppendPath(tp.subPath.(AlertingThreshold_FieldPath)) 2648 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMaxLower: 2649 maxLowerMask.AppendPath(tp.subPath.(AlertingThreshold_FieldPath)) 2650 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinUpper: 2651 minUpperMask.AppendPath(tp.subPath.(AlertingThreshold_FieldPath)) 2652 case TsCndSpecThresholdAlertingCfgAlertingThresholds_FieldPathSelectorMinLower: 2653 minLowerMask.AppendPath(tp.subPath.(AlertingThreshold_FieldPath)) 2654 } 2655 } 2656 } 2657 if wholeMaxUpperAccepted == false && len(maxUpperMask.Paths) > 0 { 2658 result.MaxUpper = maxUpperMask.Project(source.GetMaxUpper()) 2659 } 2660 if wholeMaxLowerAccepted == false && len(maxLowerMask.Paths) > 0 { 2661 result.MaxLower = maxLowerMask.Project(source.GetMaxLower()) 2662 } 2663 if wholeMinUpperAccepted == false && len(minUpperMask.Paths) > 0 { 2664 result.MinUpper = minUpperMask.Project(source.GetMinUpper()) 2665 } 2666 if wholeMinLowerAccepted == false && len(minLowerMask.Paths) > 0 { 2667 result.MinLower = minLowerMask.Project(source.GetMinLower()) 2668 } 2669 return result 2670 } 2671 2672 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2673 return fieldMask.Project(source.(*TsCndSpec_ThresholdAlertingCfg_AlertingThresholds)) 2674 } 2675 2676 func (fieldMask *TsCndSpec_ThresholdAlertingCfg_AlertingThresholds_FieldMask) PathsCount() int { 2677 if fieldMask == nil { 2678 return 0 2679 } 2680 return len(fieldMask.Paths) 2681 } 2682 2683 type TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask struct { 2684 Paths []TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath 2685 } 2686 2687 func FullTsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask() *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask { 2688 res := &TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask{} 2689 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize}) 2690 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate}) 2691 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs}) 2692 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs}) 2693 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError}) 2694 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod}) 2695 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction}) 2696 res.Paths = append(res.Paths, &TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath{selector: TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference}) 2697 return res 2698 } 2699 2700 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) String() string { 2701 if fieldMask == nil { 2702 return "<nil>" 2703 } 2704 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2705 for _, path := range fieldMask.Paths { 2706 pathsStr = append(pathsStr, path.String()) 2707 } 2708 return strings.Join(pathsStr, ", ") 2709 } 2710 2711 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) IsFull() bool { 2712 if fieldMask == nil { 2713 return false 2714 } 2715 presentSelectors := make([]bool, 8) 2716 for _, path := range fieldMask.Paths { 2717 if asFinal, ok := path.(*TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath); ok { 2718 presentSelectors[int(asFinal.selector)] = true 2719 } 2720 } 2721 for _, flag := range presentSelectors { 2722 if !flag { 2723 return false 2724 } 2725 } 2726 return true 2727 } 2728 2729 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) ProtoReflect() preflect.Message { 2730 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2731 return ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(raw) 2732 }) 2733 } 2734 2735 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) ProtoMessage() {} 2736 2737 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) Reset() { 2738 if fieldMask != nil { 2739 fieldMask.Paths = nil 2740 } 2741 } 2742 2743 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) Subtract(other *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask { 2744 result := &TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask{} 2745 removedSelectors := make([]bool, 8) 2746 2747 for _, path := range other.GetPaths() { 2748 switch tp := path.(type) { 2749 case *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: 2750 removedSelectors[int(tp.selector)] = true 2751 } 2752 } 2753 for _, path := range fieldMask.GetPaths() { 2754 if !removedSelectors[int(path.Selector())] { 2755 result.Paths = append(result.Paths, path) 2756 } 2757 } 2758 2759 if len(result.Paths) == 0 { 2760 return nil 2761 } 2762 return result 2763 } 2764 2765 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2766 return fieldMask.Subtract(other.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask)) 2767 } 2768 2769 // FilterInputFields generates copy of field paths with output_only field paths removed 2770 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) FilterInputFields() *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask { 2771 result := &TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask{} 2772 result.Paths = append(result.Paths, fieldMask.Paths...) 2773 return result 2774 } 2775 2776 // ToFieldMask is used for proto conversions 2777 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2778 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2779 for _, path := range fieldMask.Paths { 2780 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2781 } 2782 return protoFieldMask 2783 } 2784 2785 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2786 if fieldMask == nil { 2787 return status.Error(codes.Internal, "target field mask is nil") 2788 } 2789 fieldMask.Paths = make([]TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath, 0, len(protoFieldMask.Paths)) 2790 for _, strPath := range protoFieldMask.Paths { 2791 path, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(strPath) 2792 if err != nil { 2793 return err 2794 } 2795 fieldMask.Paths = append(fieldMask.Paths, path) 2796 } 2797 return nil 2798 } 2799 2800 // implement methods required by customType 2801 func (fieldMask TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) Marshal() ([]byte, error) { 2802 protoFieldMask := fieldMask.ToProtoFieldMask() 2803 return proto.Marshal(protoFieldMask) 2804 } 2805 2806 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) Unmarshal(data []byte) error { 2807 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2808 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2809 return err 2810 } 2811 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2812 return err 2813 } 2814 return nil 2815 } 2816 2817 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) Size() int { 2818 return proto.Size(fieldMask.ToProtoFieldMask()) 2819 } 2820 2821 func (fieldMask TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) MarshalJSON() ([]byte, error) { 2822 return json.Marshal(fieldMask.ToProtoFieldMask()) 2823 } 2824 2825 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) UnmarshalJSON(data []byte) error { 2826 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2827 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2828 return err 2829 } 2830 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2831 return err 2832 } 2833 return nil 2834 } 2835 2836 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) AppendPath(path TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath) { 2837 fieldMask.Paths = append(fieldMask.Paths, path) 2838 } 2839 2840 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2841 fieldMask.Paths = append(fieldMask.Paths, path.(TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath)) 2842 } 2843 2844 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) GetPaths() []TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath { 2845 if fieldMask == nil { 2846 return nil 2847 } 2848 return fieldMask.Paths 2849 } 2850 2851 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2852 if fieldMask == nil { 2853 return nil 2854 } 2855 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2856 for _, path := range fieldMask.Paths { 2857 rawPaths = append(rawPaths, path) 2858 } 2859 return rawPaths 2860 } 2861 2862 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) SetFromCliFlag(raw string) error { 2863 path, err := ParseTsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPath(raw) 2864 if err != nil { 2865 return err 2866 } 2867 fieldMask.Paths = append(fieldMask.Paths, path) 2868 return nil 2869 } 2870 2871 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) Set(target, source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) { 2872 for _, path := range fieldMask.Paths { 2873 val, _ := path.GetSingle(source) 2874 // if val is nil, then field does not exist in source, skip 2875 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2876 if val != nil { 2877 path.WithIValue(val).SetTo(&target) 2878 } 2879 } 2880 } 2881 2882 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2883 fieldMask.Set(target.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder), source.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)) 2884 } 2885 2886 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) Project(source *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder) *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder { 2887 if source == nil { 2888 return nil 2889 } 2890 if fieldMask == nil { 2891 return source 2892 } 2893 result := &TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder{} 2894 2895 for _, p := range fieldMask.Paths { 2896 switch tp := p.(type) { 2897 case *TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldTerminalPath: 2898 switch tp.selector { 2899 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorHiddenSize: 2900 result.HiddenSize = source.HiddenSize 2901 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorLearnRate: 2902 result.LearnRate = source.LearnRate 2903 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMaxTrainingEpochs: 2904 result.MaxTrainingEpochs = source.MaxTrainingEpochs 2905 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorMinTrainingEpochs: 2906 result.MinTrainingEpochs = source.MinTrainingEpochs 2907 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorAcceptableTrainingError: 2908 result.AcceptableTrainingError = source.AcceptableTrainingError 2909 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTrainingPeriod: 2910 result.TrainingPeriod = source.TrainingPeriod 2911 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorCheckPeriodFraction: 2912 result.CheckPeriodFraction = source.CheckPeriodFraction 2913 case TsCndSpecAnomalyAlertingCfgLstmAutoEncoder_FieldPathSelectorTeacherForceAtInference: 2914 result.TeacherForceAtInference = source.TeacherForceAtInference 2915 } 2916 } 2917 } 2918 return result 2919 } 2920 2921 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2922 return fieldMask.Project(source.(*TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder)) 2923 } 2924 2925 func (fieldMask *TsCndSpec_AnomalyAlertingCfg_LstmAutoEncoder_FieldMask) PathsCount() int { 2926 if fieldMask == nil { 2927 return 0 2928 } 2929 return len(fieldMask.Paths) 2930 } 2931 2932 type PolicySpec_FieldMask struct { 2933 Paths []PolicySpec_FieldPath 2934 } 2935 2936 func FullPolicySpec_FieldMask() *PolicySpec_FieldMask { 2937 res := &PolicySpec_FieldMask{} 2938 res.Paths = append(res.Paths, &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorEnabled}) 2939 res.Paths = append(res.Paths, &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorProcessingLocation}) 2940 res.Paths = append(res.Paths, &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorResourceIdentity}) 2941 res.Paths = append(res.Paths, &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorSupportingQueries}) 2942 res.Paths = append(res.Paths, &PolicySpec_FieldTerminalPath{selector: PolicySpec_FieldPathSelectorAiAgent}) 2943 return res 2944 } 2945 2946 func (fieldMask *PolicySpec_FieldMask) String() string { 2947 if fieldMask == nil { 2948 return "<nil>" 2949 } 2950 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2951 for _, path := range fieldMask.Paths { 2952 pathsStr = append(pathsStr, path.String()) 2953 } 2954 return strings.Join(pathsStr, ", ") 2955 } 2956 2957 func (fieldMask *PolicySpec_FieldMask) IsFull() bool { 2958 if fieldMask == nil { 2959 return false 2960 } 2961 presentSelectors := make([]bool, 5) 2962 for _, path := range fieldMask.Paths { 2963 if asFinal, ok := path.(*PolicySpec_FieldTerminalPath); ok { 2964 presentSelectors[int(asFinal.selector)] = true 2965 } 2966 } 2967 for _, flag := range presentSelectors { 2968 if !flag { 2969 return false 2970 } 2971 } 2972 return true 2973 } 2974 2975 func (fieldMask *PolicySpec_FieldMask) ProtoReflect() preflect.Message { 2976 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2977 return ParsePolicySpec_FieldPath(raw) 2978 }) 2979 } 2980 2981 func (fieldMask *PolicySpec_FieldMask) ProtoMessage() {} 2982 2983 func (fieldMask *PolicySpec_FieldMask) Reset() { 2984 if fieldMask != nil { 2985 fieldMask.Paths = nil 2986 } 2987 } 2988 2989 func (fieldMask *PolicySpec_FieldMask) Subtract(other *PolicySpec_FieldMask) *PolicySpec_FieldMask { 2990 result := &PolicySpec_FieldMask{} 2991 removedSelectors := make([]bool, 5) 2992 otherSubMasks := map[PolicySpec_FieldPathSelector]gotenobject.FieldMask{ 2993 PolicySpec_FieldPathSelectorResourceIdentity: &PolicySpec_ResourceIdentity_FieldMask{}, 2994 PolicySpec_FieldPathSelectorSupportingQueries: &PolicySpec_SupportingAlertQuery_FieldMask{}, 2995 PolicySpec_FieldPathSelectorAiAgent: &PolicySpec_AIAgentHandling_FieldMask{}, 2996 } 2997 mySubMasks := map[PolicySpec_FieldPathSelector]gotenobject.FieldMask{ 2998 PolicySpec_FieldPathSelectorResourceIdentity: &PolicySpec_ResourceIdentity_FieldMask{}, 2999 PolicySpec_FieldPathSelectorSupportingQueries: &PolicySpec_SupportingAlertQuery_FieldMask{}, 3000 PolicySpec_FieldPathSelectorAiAgent: &PolicySpec_AIAgentHandling_FieldMask{}, 3001 } 3002 3003 for _, path := range other.GetPaths() { 3004 switch tp := path.(type) { 3005 case *PolicySpec_FieldTerminalPath: 3006 removedSelectors[int(tp.selector)] = true 3007 case *PolicySpec_FieldSubPath: 3008 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3009 } 3010 } 3011 for _, path := range fieldMask.GetPaths() { 3012 if !removedSelectors[int(path.Selector())] { 3013 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3014 if tp, ok := path.(*PolicySpec_FieldTerminalPath); ok { 3015 switch tp.selector { 3016 case PolicySpec_FieldPathSelectorResourceIdentity: 3017 mySubMasks[PolicySpec_FieldPathSelectorResourceIdentity] = FullPolicySpec_ResourceIdentity_FieldMask() 3018 case PolicySpec_FieldPathSelectorSupportingQueries: 3019 mySubMasks[PolicySpec_FieldPathSelectorSupportingQueries] = FullPolicySpec_SupportingAlertQuery_FieldMask() 3020 case PolicySpec_FieldPathSelectorAiAgent: 3021 mySubMasks[PolicySpec_FieldPathSelectorAiAgent] = FullPolicySpec_AIAgentHandling_FieldMask() 3022 } 3023 } else if tp, ok := path.(*PolicySpec_FieldSubPath); ok { 3024 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3025 } 3026 } else { 3027 result.Paths = append(result.Paths, path) 3028 } 3029 } 3030 } 3031 for selector, mySubMask := range mySubMasks { 3032 if mySubMask.PathsCount() > 0 { 3033 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3034 result.Paths = append(result.Paths, &PolicySpec_FieldSubPath{selector: selector, subPath: allowedPath}) 3035 } 3036 } 3037 } 3038 3039 if len(result.Paths) == 0 { 3040 return nil 3041 } 3042 return result 3043 } 3044 3045 func (fieldMask *PolicySpec_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3046 return fieldMask.Subtract(other.(*PolicySpec_FieldMask)) 3047 } 3048 3049 // FilterInputFields generates copy of field paths with output_only field paths removed 3050 func (fieldMask *PolicySpec_FieldMask) FilterInputFields() *PolicySpec_FieldMask { 3051 result := &PolicySpec_FieldMask{} 3052 result.Paths = append(result.Paths, fieldMask.Paths...) 3053 return result 3054 } 3055 3056 // ToFieldMask is used for proto conversions 3057 func (fieldMask *PolicySpec_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3058 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3059 for _, path := range fieldMask.Paths { 3060 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3061 } 3062 return protoFieldMask 3063 } 3064 3065 func (fieldMask *PolicySpec_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3066 if fieldMask == nil { 3067 return status.Error(codes.Internal, "target field mask is nil") 3068 } 3069 fieldMask.Paths = make([]PolicySpec_FieldPath, 0, len(protoFieldMask.Paths)) 3070 for _, strPath := range protoFieldMask.Paths { 3071 path, err := ParsePolicySpec_FieldPath(strPath) 3072 if err != nil { 3073 return err 3074 } 3075 fieldMask.Paths = append(fieldMask.Paths, path) 3076 } 3077 return nil 3078 } 3079 3080 // implement methods required by customType 3081 func (fieldMask PolicySpec_FieldMask) Marshal() ([]byte, error) { 3082 protoFieldMask := fieldMask.ToProtoFieldMask() 3083 return proto.Marshal(protoFieldMask) 3084 } 3085 3086 func (fieldMask *PolicySpec_FieldMask) Unmarshal(data []byte) error { 3087 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3088 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3089 return err 3090 } 3091 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3092 return err 3093 } 3094 return nil 3095 } 3096 3097 func (fieldMask *PolicySpec_FieldMask) Size() int { 3098 return proto.Size(fieldMask.ToProtoFieldMask()) 3099 } 3100 3101 func (fieldMask PolicySpec_FieldMask) MarshalJSON() ([]byte, error) { 3102 return json.Marshal(fieldMask.ToProtoFieldMask()) 3103 } 3104 3105 func (fieldMask *PolicySpec_FieldMask) UnmarshalJSON(data []byte) error { 3106 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3107 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3108 return err 3109 } 3110 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3111 return err 3112 } 3113 return nil 3114 } 3115 3116 func (fieldMask *PolicySpec_FieldMask) AppendPath(path PolicySpec_FieldPath) { 3117 fieldMask.Paths = append(fieldMask.Paths, path) 3118 } 3119 3120 func (fieldMask *PolicySpec_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3121 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpec_FieldPath)) 3122 } 3123 3124 func (fieldMask *PolicySpec_FieldMask) GetPaths() []PolicySpec_FieldPath { 3125 if fieldMask == nil { 3126 return nil 3127 } 3128 return fieldMask.Paths 3129 } 3130 3131 func (fieldMask *PolicySpec_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3132 if fieldMask == nil { 3133 return nil 3134 } 3135 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3136 for _, path := range fieldMask.Paths { 3137 rawPaths = append(rawPaths, path) 3138 } 3139 return rawPaths 3140 } 3141 3142 func (fieldMask *PolicySpec_FieldMask) SetFromCliFlag(raw string) error { 3143 path, err := ParsePolicySpec_FieldPath(raw) 3144 if err != nil { 3145 return err 3146 } 3147 fieldMask.Paths = append(fieldMask.Paths, path) 3148 return nil 3149 } 3150 3151 func (fieldMask *PolicySpec_FieldMask) Set(target, source *PolicySpec) { 3152 for _, path := range fieldMask.Paths { 3153 val, _ := path.GetSingle(source) 3154 // if val is nil, then field does not exist in source, skip 3155 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3156 if val != nil { 3157 path.WithIValue(val).SetTo(&target) 3158 } 3159 } 3160 } 3161 3162 func (fieldMask *PolicySpec_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3163 fieldMask.Set(target.(*PolicySpec), source.(*PolicySpec)) 3164 } 3165 3166 func (fieldMask *PolicySpec_FieldMask) Project(source *PolicySpec) *PolicySpec { 3167 if source == nil { 3168 return nil 3169 } 3170 if fieldMask == nil { 3171 return source 3172 } 3173 result := &PolicySpec{} 3174 resourceIdentityMask := &PolicySpec_ResourceIdentity_FieldMask{} 3175 wholeResourceIdentityAccepted := false 3176 supportingQueriesMask := &PolicySpec_SupportingAlertQuery_FieldMask{} 3177 wholeSupportingQueriesAccepted := false 3178 aiAgentMask := &PolicySpec_AIAgentHandling_FieldMask{} 3179 wholeAiAgentAccepted := false 3180 3181 for _, p := range fieldMask.Paths { 3182 switch tp := p.(type) { 3183 case *PolicySpec_FieldTerminalPath: 3184 switch tp.selector { 3185 case PolicySpec_FieldPathSelectorEnabled: 3186 result.Enabled = source.Enabled 3187 case PolicySpec_FieldPathSelectorProcessingLocation: 3188 result.ProcessingLocation = source.ProcessingLocation 3189 case PolicySpec_FieldPathSelectorResourceIdentity: 3190 result.ResourceIdentity = source.ResourceIdentity 3191 wholeResourceIdentityAccepted = true 3192 case PolicySpec_FieldPathSelectorSupportingQueries: 3193 result.SupportingQueries = source.SupportingQueries 3194 wholeSupportingQueriesAccepted = true 3195 case PolicySpec_FieldPathSelectorAiAgent: 3196 result.AiAgent = source.AiAgent 3197 wholeAiAgentAccepted = true 3198 } 3199 case *PolicySpec_FieldSubPath: 3200 switch tp.selector { 3201 case PolicySpec_FieldPathSelectorResourceIdentity: 3202 resourceIdentityMask.AppendPath(tp.subPath.(PolicySpecResourceIdentity_FieldPath)) 3203 case PolicySpec_FieldPathSelectorSupportingQueries: 3204 supportingQueriesMask.AppendPath(tp.subPath.(PolicySpecSupportingAlertQuery_FieldPath)) 3205 case PolicySpec_FieldPathSelectorAiAgent: 3206 aiAgentMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandling_FieldPath)) 3207 } 3208 } 3209 } 3210 if wholeResourceIdentityAccepted == false && len(resourceIdentityMask.Paths) > 0 { 3211 result.ResourceIdentity = resourceIdentityMask.Project(source.GetResourceIdentity()) 3212 } 3213 if wholeSupportingQueriesAccepted == false && len(supportingQueriesMask.Paths) > 0 { 3214 for _, sourceItem := range source.GetSupportingQueries() { 3215 result.SupportingQueries = append(result.SupportingQueries, supportingQueriesMask.Project(sourceItem)) 3216 } 3217 } 3218 if wholeAiAgentAccepted == false && len(aiAgentMask.Paths) > 0 { 3219 result.AiAgent = aiAgentMask.Project(source.GetAiAgent()) 3220 } 3221 return result 3222 } 3223 3224 func (fieldMask *PolicySpec_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3225 return fieldMask.Project(source.(*PolicySpec)) 3226 } 3227 3228 func (fieldMask *PolicySpec_FieldMask) PathsCount() int { 3229 if fieldMask == nil { 3230 return 0 3231 } 3232 return len(fieldMask.Paths) 3233 } 3234 3235 type PolicySpec_ResourceIdentity_FieldMask struct { 3236 Paths []PolicySpecResourceIdentity_FieldPath 3237 } 3238 3239 func FullPolicySpec_ResourceIdentity_FieldMask() *PolicySpec_ResourceIdentity_FieldMask { 3240 res := &PolicySpec_ResourceIdentity_FieldMask{} 3241 res.Paths = append(res.Paths, &PolicySpecResourceIdentity_FieldTerminalPath{selector: PolicySpecResourceIdentity_FieldPathSelectorAlertingResource}) 3242 res.Paths = append(res.Paths, &PolicySpecResourceIdentity_FieldTerminalPath{selector: PolicySpecResourceIdentity_FieldPathSelectorLabels}) 3243 res.Paths = append(res.Paths, &PolicySpecResourceIdentity_FieldTerminalPath{selector: PolicySpecResourceIdentity_FieldPathSelectorNamePatterns}) 3244 return res 3245 } 3246 3247 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) String() string { 3248 if fieldMask == nil { 3249 return "<nil>" 3250 } 3251 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3252 for _, path := range fieldMask.Paths { 3253 pathsStr = append(pathsStr, path.String()) 3254 } 3255 return strings.Join(pathsStr, ", ") 3256 } 3257 3258 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) IsFull() bool { 3259 if fieldMask == nil { 3260 return false 3261 } 3262 presentSelectors := make([]bool, 3) 3263 for _, path := range fieldMask.Paths { 3264 if asFinal, ok := path.(*PolicySpecResourceIdentity_FieldTerminalPath); ok { 3265 presentSelectors[int(asFinal.selector)] = true 3266 } 3267 } 3268 for _, flag := range presentSelectors { 3269 if !flag { 3270 return false 3271 } 3272 } 3273 return true 3274 } 3275 3276 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) ProtoReflect() preflect.Message { 3277 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3278 return ParsePolicySpecResourceIdentity_FieldPath(raw) 3279 }) 3280 } 3281 3282 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) ProtoMessage() {} 3283 3284 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) Reset() { 3285 if fieldMask != nil { 3286 fieldMask.Paths = nil 3287 } 3288 } 3289 3290 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) Subtract(other *PolicySpec_ResourceIdentity_FieldMask) *PolicySpec_ResourceIdentity_FieldMask { 3291 result := &PolicySpec_ResourceIdentity_FieldMask{} 3292 removedSelectors := make([]bool, 3) 3293 otherSubMasks := map[PolicySpecResourceIdentity_FieldPathSelector]gotenobject.FieldMask{ 3294 PolicySpecResourceIdentity_FieldPathSelectorLabels: &PolicySpec_ResourceIdentity_LabelInfo_FieldMask{}, 3295 } 3296 mySubMasks := map[PolicySpecResourceIdentity_FieldPathSelector]gotenobject.FieldMask{ 3297 PolicySpecResourceIdentity_FieldPathSelectorLabels: &PolicySpec_ResourceIdentity_LabelInfo_FieldMask{}, 3298 } 3299 3300 for _, path := range other.GetPaths() { 3301 switch tp := path.(type) { 3302 case *PolicySpecResourceIdentity_FieldTerminalPath: 3303 removedSelectors[int(tp.selector)] = true 3304 case *PolicySpecResourceIdentity_FieldSubPath: 3305 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3306 } 3307 } 3308 for _, path := range fieldMask.GetPaths() { 3309 if !removedSelectors[int(path.Selector())] { 3310 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3311 if tp, ok := path.(*PolicySpecResourceIdentity_FieldTerminalPath); ok { 3312 switch tp.selector { 3313 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 3314 mySubMasks[PolicySpecResourceIdentity_FieldPathSelectorLabels] = FullPolicySpec_ResourceIdentity_LabelInfo_FieldMask() 3315 } 3316 } else if tp, ok := path.(*PolicySpecResourceIdentity_FieldSubPath); ok { 3317 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3318 } 3319 } else { 3320 result.Paths = append(result.Paths, path) 3321 } 3322 } 3323 } 3324 for selector, mySubMask := range mySubMasks { 3325 if mySubMask.PathsCount() > 0 { 3326 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3327 result.Paths = append(result.Paths, &PolicySpecResourceIdentity_FieldSubPath{selector: selector, subPath: allowedPath}) 3328 } 3329 } 3330 } 3331 3332 if len(result.Paths) == 0 { 3333 return nil 3334 } 3335 return result 3336 } 3337 3338 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3339 return fieldMask.Subtract(other.(*PolicySpec_ResourceIdentity_FieldMask)) 3340 } 3341 3342 // FilterInputFields generates copy of field paths with output_only field paths removed 3343 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) FilterInputFields() *PolicySpec_ResourceIdentity_FieldMask { 3344 result := &PolicySpec_ResourceIdentity_FieldMask{} 3345 result.Paths = append(result.Paths, fieldMask.Paths...) 3346 return result 3347 } 3348 3349 // ToFieldMask is used for proto conversions 3350 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3351 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3352 for _, path := range fieldMask.Paths { 3353 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3354 } 3355 return protoFieldMask 3356 } 3357 3358 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3359 if fieldMask == nil { 3360 return status.Error(codes.Internal, "target field mask is nil") 3361 } 3362 fieldMask.Paths = make([]PolicySpecResourceIdentity_FieldPath, 0, len(protoFieldMask.Paths)) 3363 for _, strPath := range protoFieldMask.Paths { 3364 path, err := ParsePolicySpecResourceIdentity_FieldPath(strPath) 3365 if err != nil { 3366 return err 3367 } 3368 fieldMask.Paths = append(fieldMask.Paths, path) 3369 } 3370 return nil 3371 } 3372 3373 // implement methods required by customType 3374 func (fieldMask PolicySpec_ResourceIdentity_FieldMask) Marshal() ([]byte, error) { 3375 protoFieldMask := fieldMask.ToProtoFieldMask() 3376 return proto.Marshal(protoFieldMask) 3377 } 3378 3379 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) Unmarshal(data []byte) error { 3380 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3381 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3382 return err 3383 } 3384 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3385 return err 3386 } 3387 return nil 3388 } 3389 3390 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) Size() int { 3391 return proto.Size(fieldMask.ToProtoFieldMask()) 3392 } 3393 3394 func (fieldMask PolicySpec_ResourceIdentity_FieldMask) MarshalJSON() ([]byte, error) { 3395 return json.Marshal(fieldMask.ToProtoFieldMask()) 3396 } 3397 3398 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) UnmarshalJSON(data []byte) error { 3399 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3400 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3401 return err 3402 } 3403 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3404 return err 3405 } 3406 return nil 3407 } 3408 3409 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) AppendPath(path PolicySpecResourceIdentity_FieldPath) { 3410 fieldMask.Paths = append(fieldMask.Paths, path) 3411 } 3412 3413 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3414 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecResourceIdentity_FieldPath)) 3415 } 3416 3417 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) GetPaths() []PolicySpecResourceIdentity_FieldPath { 3418 if fieldMask == nil { 3419 return nil 3420 } 3421 return fieldMask.Paths 3422 } 3423 3424 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3425 if fieldMask == nil { 3426 return nil 3427 } 3428 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3429 for _, path := range fieldMask.Paths { 3430 rawPaths = append(rawPaths, path) 3431 } 3432 return rawPaths 3433 } 3434 3435 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) SetFromCliFlag(raw string) error { 3436 path, err := ParsePolicySpecResourceIdentity_FieldPath(raw) 3437 if err != nil { 3438 return err 3439 } 3440 fieldMask.Paths = append(fieldMask.Paths, path) 3441 return nil 3442 } 3443 3444 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) Set(target, source *PolicySpec_ResourceIdentity) { 3445 for _, path := range fieldMask.Paths { 3446 val, _ := path.GetSingle(source) 3447 // if val is nil, then field does not exist in source, skip 3448 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3449 if val != nil { 3450 path.WithIValue(val).SetTo(&target) 3451 } 3452 } 3453 } 3454 3455 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3456 fieldMask.Set(target.(*PolicySpec_ResourceIdentity), source.(*PolicySpec_ResourceIdentity)) 3457 } 3458 3459 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) Project(source *PolicySpec_ResourceIdentity) *PolicySpec_ResourceIdentity { 3460 if source == nil { 3461 return nil 3462 } 3463 if fieldMask == nil { 3464 return source 3465 } 3466 result := &PolicySpec_ResourceIdentity{} 3467 labelsMask := &PolicySpec_ResourceIdentity_LabelInfo_FieldMask{} 3468 wholeLabelsAccepted := false 3469 3470 for _, p := range fieldMask.Paths { 3471 switch tp := p.(type) { 3472 case *PolicySpecResourceIdentity_FieldTerminalPath: 3473 switch tp.selector { 3474 case PolicySpecResourceIdentity_FieldPathSelectorAlertingResource: 3475 result.AlertingResource = source.AlertingResource 3476 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 3477 result.Labels = source.Labels 3478 wholeLabelsAccepted = true 3479 case PolicySpecResourceIdentity_FieldPathSelectorNamePatterns: 3480 result.NamePatterns = source.NamePatterns 3481 } 3482 case *PolicySpecResourceIdentity_FieldSubPath: 3483 switch tp.selector { 3484 case PolicySpecResourceIdentity_FieldPathSelectorLabels: 3485 labelsMask.AppendPath(tp.subPath.(PolicySpecResourceIdentityLabelInfo_FieldPath)) 3486 } 3487 } 3488 } 3489 if wholeLabelsAccepted == false && len(labelsMask.Paths) > 0 { 3490 for _, sourceItem := range source.GetLabels() { 3491 result.Labels = append(result.Labels, labelsMask.Project(sourceItem)) 3492 } 3493 } 3494 return result 3495 } 3496 3497 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3498 return fieldMask.Project(source.(*PolicySpec_ResourceIdentity)) 3499 } 3500 3501 func (fieldMask *PolicySpec_ResourceIdentity_FieldMask) PathsCount() int { 3502 if fieldMask == nil { 3503 return 0 3504 } 3505 return len(fieldMask.Paths) 3506 } 3507 3508 type PolicySpec_SupportingAlertQuery_FieldMask struct { 3509 Paths []PolicySpecSupportingAlertQuery_FieldPath 3510 } 3511 3512 func FullPolicySpec_SupportingAlertQuery_FieldMask() *PolicySpec_SupportingAlertQuery_FieldMask { 3513 res := &PolicySpec_SupportingAlertQuery_FieldMask{} 3514 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery}) 3515 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery}) 3516 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery}) 3517 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery}) 3518 return res 3519 } 3520 3521 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) String() string { 3522 if fieldMask == nil { 3523 return "<nil>" 3524 } 3525 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3526 for _, path := range fieldMask.Paths { 3527 pathsStr = append(pathsStr, path.String()) 3528 } 3529 return strings.Join(pathsStr, ", ") 3530 } 3531 3532 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) IsFull() bool { 3533 if fieldMask == nil { 3534 return false 3535 } 3536 presentSelectors := make([]bool, 4) 3537 for _, path := range fieldMask.Paths { 3538 if asFinal, ok := path.(*PolicySpecSupportingAlertQuery_FieldTerminalPath); ok { 3539 presentSelectors[int(asFinal.selector)] = true 3540 } 3541 } 3542 for _, flag := range presentSelectors { 3543 if !flag { 3544 return false 3545 } 3546 } 3547 return true 3548 } 3549 3550 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) ProtoReflect() preflect.Message { 3551 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3552 return ParsePolicySpecSupportingAlertQuery_FieldPath(raw) 3553 }) 3554 } 3555 3556 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) ProtoMessage() {} 3557 3558 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) Reset() { 3559 if fieldMask != nil { 3560 fieldMask.Paths = nil 3561 } 3562 } 3563 3564 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) Subtract(other *PolicySpec_SupportingAlertQuery_FieldMask) *PolicySpec_SupportingAlertQuery_FieldMask { 3565 result := &PolicySpec_SupportingAlertQuery_FieldMask{} 3566 removedSelectors := make([]bool, 4) 3567 otherSubMasks := map[PolicySpecSupportingAlertQuery_FieldPathSelector]gotenobject.FieldMask{ 3568 PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: &PolicySpec_SupportingAlertQuery_TsQuery_FieldMask{}, 3569 PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: &PolicySpec_SupportingAlertQuery_LogQuery_FieldMask{}, 3570 PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: &PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask{}, 3571 PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: &PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask{}, 3572 } 3573 mySubMasks := map[PolicySpecSupportingAlertQuery_FieldPathSelector]gotenobject.FieldMask{ 3574 PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: &PolicySpec_SupportingAlertQuery_TsQuery_FieldMask{}, 3575 PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: &PolicySpec_SupportingAlertQuery_LogQuery_FieldMask{}, 3576 PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: &PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask{}, 3577 PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: &PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask{}, 3578 } 3579 3580 for _, path := range other.GetPaths() { 3581 switch tp := path.(type) { 3582 case *PolicySpecSupportingAlertQuery_FieldTerminalPath: 3583 removedSelectors[int(tp.selector)] = true 3584 case *PolicySpecSupportingAlertQuery_FieldSubPath: 3585 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3586 } 3587 } 3588 for _, path := range fieldMask.GetPaths() { 3589 if !removedSelectors[int(path.Selector())] { 3590 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3591 if tp, ok := path.(*PolicySpecSupportingAlertQuery_FieldTerminalPath); ok { 3592 switch tp.selector { 3593 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 3594 mySubMasks[PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery] = FullPolicySpec_SupportingAlertQuery_TsQuery_FieldMask() 3595 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 3596 mySubMasks[PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery] = FullPolicySpec_SupportingAlertQuery_LogQuery_FieldMask() 3597 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 3598 mySubMasks[PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery] = FullPolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask() 3599 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 3600 mySubMasks[PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery] = FullPolicySpec_SupportingAlertQuery_RestListQuery_FieldMask() 3601 } 3602 } else if tp, ok := path.(*PolicySpecSupportingAlertQuery_FieldSubPath); ok { 3603 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3604 } 3605 } else { 3606 result.Paths = append(result.Paths, path) 3607 } 3608 } 3609 } 3610 for selector, mySubMask := range mySubMasks { 3611 if mySubMask.PathsCount() > 0 { 3612 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3613 result.Paths = append(result.Paths, &PolicySpecSupportingAlertQuery_FieldSubPath{selector: selector, subPath: allowedPath}) 3614 } 3615 } 3616 } 3617 3618 if len(result.Paths) == 0 { 3619 return nil 3620 } 3621 return result 3622 } 3623 3624 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3625 return fieldMask.Subtract(other.(*PolicySpec_SupportingAlertQuery_FieldMask)) 3626 } 3627 3628 // FilterInputFields generates copy of field paths with output_only field paths removed 3629 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) FilterInputFields() *PolicySpec_SupportingAlertQuery_FieldMask { 3630 result := &PolicySpec_SupportingAlertQuery_FieldMask{} 3631 result.Paths = append(result.Paths, fieldMask.Paths...) 3632 return result 3633 } 3634 3635 // ToFieldMask is used for proto conversions 3636 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3637 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3638 for _, path := range fieldMask.Paths { 3639 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3640 } 3641 return protoFieldMask 3642 } 3643 3644 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3645 if fieldMask == nil { 3646 return status.Error(codes.Internal, "target field mask is nil") 3647 } 3648 fieldMask.Paths = make([]PolicySpecSupportingAlertQuery_FieldPath, 0, len(protoFieldMask.Paths)) 3649 for _, strPath := range protoFieldMask.Paths { 3650 path, err := ParsePolicySpecSupportingAlertQuery_FieldPath(strPath) 3651 if err != nil { 3652 return err 3653 } 3654 fieldMask.Paths = append(fieldMask.Paths, path) 3655 } 3656 return nil 3657 } 3658 3659 // implement methods required by customType 3660 func (fieldMask PolicySpec_SupportingAlertQuery_FieldMask) Marshal() ([]byte, error) { 3661 protoFieldMask := fieldMask.ToProtoFieldMask() 3662 return proto.Marshal(protoFieldMask) 3663 } 3664 3665 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) Unmarshal(data []byte) error { 3666 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3667 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3668 return err 3669 } 3670 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3671 return err 3672 } 3673 return nil 3674 } 3675 3676 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) Size() int { 3677 return proto.Size(fieldMask.ToProtoFieldMask()) 3678 } 3679 3680 func (fieldMask PolicySpec_SupportingAlertQuery_FieldMask) MarshalJSON() ([]byte, error) { 3681 return json.Marshal(fieldMask.ToProtoFieldMask()) 3682 } 3683 3684 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) UnmarshalJSON(data []byte) error { 3685 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3686 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3687 return err 3688 } 3689 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3690 return err 3691 } 3692 return nil 3693 } 3694 3695 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) AppendPath(path PolicySpecSupportingAlertQuery_FieldPath) { 3696 fieldMask.Paths = append(fieldMask.Paths, path) 3697 } 3698 3699 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3700 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecSupportingAlertQuery_FieldPath)) 3701 } 3702 3703 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) GetPaths() []PolicySpecSupportingAlertQuery_FieldPath { 3704 if fieldMask == nil { 3705 return nil 3706 } 3707 return fieldMask.Paths 3708 } 3709 3710 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3711 if fieldMask == nil { 3712 return nil 3713 } 3714 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3715 for _, path := range fieldMask.Paths { 3716 rawPaths = append(rawPaths, path) 3717 } 3718 return rawPaths 3719 } 3720 3721 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) SetFromCliFlag(raw string) error { 3722 path, err := ParsePolicySpecSupportingAlertQuery_FieldPath(raw) 3723 if err != nil { 3724 return err 3725 } 3726 fieldMask.Paths = append(fieldMask.Paths, path) 3727 return nil 3728 } 3729 3730 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) Set(target, source *PolicySpec_SupportingAlertQuery) { 3731 for _, path := range fieldMask.Paths { 3732 val, _ := path.GetSingle(source) 3733 // if val is nil, then field does not exist in source, skip 3734 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3735 if val != nil { 3736 path.WithIValue(val).SetTo(&target) 3737 } 3738 } 3739 } 3740 3741 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3742 fieldMask.Set(target.(*PolicySpec_SupportingAlertQuery), source.(*PolicySpec_SupportingAlertQuery)) 3743 } 3744 3745 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) Project(source *PolicySpec_SupportingAlertQuery) *PolicySpec_SupportingAlertQuery { 3746 if source == nil { 3747 return nil 3748 } 3749 if fieldMask == nil { 3750 return source 3751 } 3752 result := &PolicySpec_SupportingAlertQuery{} 3753 tsQueryMask := &PolicySpec_SupportingAlertQuery_TsQuery_FieldMask{} 3754 wholeTsQueryAccepted := false 3755 logQueryMask := &PolicySpec_SupportingAlertQuery_LogQuery_FieldMask{} 3756 wholeLogQueryAccepted := false 3757 restGetQueryMask := &PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask{} 3758 wholeRestGetQueryAccepted := false 3759 restListQueryMask := &PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask{} 3760 wholeRestListQueryAccepted := false 3761 3762 for _, p := range fieldMask.Paths { 3763 switch tp := p.(type) { 3764 case *PolicySpecSupportingAlertQuery_FieldTerminalPath: 3765 switch tp.selector { 3766 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 3767 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_TsQuery_); ok { 3768 result.Query = &PolicySpec_SupportingAlertQuery_TsQuery_{ 3769 TsQuery: source.TsQuery, 3770 } 3771 } 3772 wholeTsQueryAccepted = true 3773 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 3774 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_LogQuery_); ok { 3775 result.Query = &PolicySpec_SupportingAlertQuery_LogQuery_{ 3776 LogQuery: source.LogQuery, 3777 } 3778 } 3779 wholeLogQueryAccepted = true 3780 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 3781 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_); ok { 3782 result.Query = &PolicySpec_SupportingAlertQuery_RestGetQuery_{ 3783 RestGetQuery: source.RestGetQuery, 3784 } 3785 } 3786 wholeRestGetQueryAccepted = true 3787 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 3788 if source, ok := source.Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_); ok { 3789 result.Query = &PolicySpec_SupportingAlertQuery_RestListQuery_{ 3790 RestListQuery: source.RestListQuery, 3791 } 3792 } 3793 wholeRestListQueryAccepted = true 3794 } 3795 case *PolicySpecSupportingAlertQuery_FieldSubPath: 3796 switch tp.selector { 3797 case PolicySpecSupportingAlertQuery_FieldPathSelectorTsQuery: 3798 tsQueryMask.AppendPath(tp.subPath.(PolicySpecSupportingAlertQueryTsQuery_FieldPath)) 3799 case PolicySpecSupportingAlertQuery_FieldPathSelectorLogQuery: 3800 logQueryMask.AppendPath(tp.subPath.(PolicySpecSupportingAlertQueryLogQuery_FieldPath)) 3801 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestGetQuery: 3802 restGetQueryMask.AppendPath(tp.subPath.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPath)) 3803 case PolicySpecSupportingAlertQuery_FieldPathSelectorRestListQuery: 3804 restListQueryMask.AppendPath(tp.subPath.(PolicySpecSupportingAlertQueryRestListQuery_FieldPath)) 3805 } 3806 } 3807 } 3808 if wholeTsQueryAccepted == false && len(tsQueryMask.Paths) > 0 { 3809 if asOneOf, ok := source.Query.(*PolicySpec_SupportingAlertQuery_TsQuery_); ok { 3810 result.Query = (*PolicySpec_SupportingAlertQuery_TsQuery_)(nil) 3811 if asOneOf != nil { 3812 oneOfRes := &PolicySpec_SupportingAlertQuery_TsQuery_{} 3813 oneOfRes.TsQuery = tsQueryMask.Project(asOneOf.TsQuery) 3814 result.Query = oneOfRes 3815 } 3816 } 3817 } 3818 if wholeLogQueryAccepted == false && len(logQueryMask.Paths) > 0 { 3819 if asOneOf, ok := source.Query.(*PolicySpec_SupportingAlertQuery_LogQuery_); ok { 3820 result.Query = (*PolicySpec_SupportingAlertQuery_LogQuery_)(nil) 3821 if asOneOf != nil { 3822 oneOfRes := &PolicySpec_SupportingAlertQuery_LogQuery_{} 3823 oneOfRes.LogQuery = logQueryMask.Project(asOneOf.LogQuery) 3824 result.Query = oneOfRes 3825 } 3826 } 3827 } 3828 if wholeRestGetQueryAccepted == false && len(restGetQueryMask.Paths) > 0 { 3829 if asOneOf, ok := source.Query.(*PolicySpec_SupportingAlertQuery_RestGetQuery_); ok { 3830 result.Query = (*PolicySpec_SupportingAlertQuery_RestGetQuery_)(nil) 3831 if asOneOf != nil { 3832 oneOfRes := &PolicySpec_SupportingAlertQuery_RestGetQuery_{} 3833 oneOfRes.RestGetQuery = restGetQueryMask.Project(asOneOf.RestGetQuery) 3834 result.Query = oneOfRes 3835 } 3836 } 3837 } 3838 if wholeRestListQueryAccepted == false && len(restListQueryMask.Paths) > 0 { 3839 if asOneOf, ok := source.Query.(*PolicySpec_SupportingAlertQuery_RestListQuery_); ok { 3840 result.Query = (*PolicySpec_SupportingAlertQuery_RestListQuery_)(nil) 3841 if asOneOf != nil { 3842 oneOfRes := &PolicySpec_SupportingAlertQuery_RestListQuery_{} 3843 oneOfRes.RestListQuery = restListQueryMask.Project(asOneOf.RestListQuery) 3844 result.Query = oneOfRes 3845 } 3846 } 3847 } 3848 return result 3849 } 3850 3851 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3852 return fieldMask.Project(source.(*PolicySpec_SupportingAlertQuery)) 3853 } 3854 3855 func (fieldMask *PolicySpec_SupportingAlertQuery_FieldMask) PathsCount() int { 3856 if fieldMask == nil { 3857 return 0 3858 } 3859 return len(fieldMask.Paths) 3860 } 3861 3862 type PolicySpec_AIAgentHandling_FieldMask struct { 3863 Paths []PolicySpecAIAgentHandling_FieldPath 3864 } 3865 3866 func FullPolicySpec_AIAgentHandling_FieldMask() *PolicySpec_AIAgentHandling_FieldMask { 3867 res := &PolicySpec_AIAgentHandling_FieldMask{} 3868 res.Paths = append(res.Paths, &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorEnabled}) 3869 res.Paths = append(res.Paths, &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity}) 3870 res.Paths = append(res.Paths, &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation}) 3871 res.Paths = append(res.Paths, &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity}) 3872 res.Paths = append(res.Paths, &PolicySpecAIAgentHandling_FieldTerminalPath{selector: PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions}) 3873 return res 3874 } 3875 3876 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) String() string { 3877 if fieldMask == nil { 3878 return "<nil>" 3879 } 3880 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3881 for _, path := range fieldMask.Paths { 3882 pathsStr = append(pathsStr, path.String()) 3883 } 3884 return strings.Join(pathsStr, ", ") 3885 } 3886 3887 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) IsFull() bool { 3888 if fieldMask == nil { 3889 return false 3890 } 3891 presentSelectors := make([]bool, 5) 3892 for _, path := range fieldMask.Paths { 3893 if asFinal, ok := path.(*PolicySpecAIAgentHandling_FieldTerminalPath); ok { 3894 presentSelectors[int(asFinal.selector)] = true 3895 } 3896 } 3897 for _, flag := range presentSelectors { 3898 if !flag { 3899 return false 3900 } 3901 } 3902 return true 3903 } 3904 3905 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) ProtoReflect() preflect.Message { 3906 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3907 return ParsePolicySpecAIAgentHandling_FieldPath(raw) 3908 }) 3909 } 3910 3911 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) ProtoMessage() {} 3912 3913 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) Reset() { 3914 if fieldMask != nil { 3915 fieldMask.Paths = nil 3916 } 3917 } 3918 3919 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_FieldMask) *PolicySpec_AIAgentHandling_FieldMask { 3920 result := &PolicySpec_AIAgentHandling_FieldMask{} 3921 removedSelectors := make([]bool, 5) 3922 otherSubMasks := map[PolicySpecAIAgentHandling_FieldPathSelector]gotenobject.FieldMask{ 3923 PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: &PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask{}, 3924 PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: &PolicySpec_AIAgentHandling_Remediation_FieldMask{}, 3925 } 3926 mySubMasks := map[PolicySpecAIAgentHandling_FieldPathSelector]gotenobject.FieldMask{ 3927 PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: &PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask{}, 3928 PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: &PolicySpec_AIAgentHandling_Remediation_FieldMask{}, 3929 } 3930 3931 for _, path := range other.GetPaths() { 3932 switch tp := path.(type) { 3933 case *PolicySpecAIAgentHandling_FieldTerminalPath: 3934 removedSelectors[int(tp.selector)] = true 3935 case *PolicySpecAIAgentHandling_FieldSubPath: 3936 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3937 } 3938 } 3939 for _, path := range fieldMask.GetPaths() { 3940 if !removedSelectors[int(path.Selector())] { 3941 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3942 if tp, ok := path.(*PolicySpecAIAgentHandling_FieldTerminalPath); ok { 3943 switch tp.selector { 3944 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 3945 mySubMasks[PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity] = FullPolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask() 3946 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 3947 mySubMasks[PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions] = FullPolicySpec_AIAgentHandling_Remediation_FieldMask() 3948 } 3949 } else if tp, ok := path.(*PolicySpecAIAgentHandling_FieldSubPath); ok { 3950 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3951 } 3952 } else { 3953 result.Paths = append(result.Paths, path) 3954 } 3955 } 3956 } 3957 for selector, mySubMask := range mySubMasks { 3958 if mySubMask.PathsCount() > 0 { 3959 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3960 result.Paths = append(result.Paths, &PolicySpecAIAgentHandling_FieldSubPath{selector: selector, subPath: allowedPath}) 3961 } 3962 } 3963 } 3964 3965 if len(result.Paths) == 0 { 3966 return nil 3967 } 3968 return result 3969 } 3970 3971 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3972 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_FieldMask)) 3973 } 3974 3975 // FilterInputFields generates copy of field paths with output_only field paths removed 3976 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_FieldMask { 3977 result := &PolicySpec_AIAgentHandling_FieldMask{} 3978 result.Paths = append(result.Paths, fieldMask.Paths...) 3979 return result 3980 } 3981 3982 // ToFieldMask is used for proto conversions 3983 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3984 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3985 for _, path := range fieldMask.Paths { 3986 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3987 } 3988 return protoFieldMask 3989 } 3990 3991 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3992 if fieldMask == nil { 3993 return status.Error(codes.Internal, "target field mask is nil") 3994 } 3995 fieldMask.Paths = make([]PolicySpecAIAgentHandling_FieldPath, 0, len(protoFieldMask.Paths)) 3996 for _, strPath := range protoFieldMask.Paths { 3997 path, err := ParsePolicySpecAIAgentHandling_FieldPath(strPath) 3998 if err != nil { 3999 return err 4000 } 4001 fieldMask.Paths = append(fieldMask.Paths, path) 4002 } 4003 return nil 4004 } 4005 4006 // implement methods required by customType 4007 func (fieldMask PolicySpec_AIAgentHandling_FieldMask) Marshal() ([]byte, error) { 4008 protoFieldMask := fieldMask.ToProtoFieldMask() 4009 return proto.Marshal(protoFieldMask) 4010 } 4011 4012 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) Unmarshal(data []byte) error { 4013 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4014 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 4015 return err 4016 } 4017 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4018 return err 4019 } 4020 return nil 4021 } 4022 4023 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) Size() int { 4024 return proto.Size(fieldMask.ToProtoFieldMask()) 4025 } 4026 4027 func (fieldMask PolicySpec_AIAgentHandling_FieldMask) MarshalJSON() ([]byte, error) { 4028 return json.Marshal(fieldMask.ToProtoFieldMask()) 4029 } 4030 4031 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) UnmarshalJSON(data []byte) error { 4032 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4033 if err := json.Unmarshal(data, protoFieldMask); err != nil { 4034 return err 4035 } 4036 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4037 return err 4038 } 4039 return nil 4040 } 4041 4042 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) AppendPath(path PolicySpecAIAgentHandling_FieldPath) { 4043 fieldMask.Paths = append(fieldMask.Paths, path) 4044 } 4045 4046 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4047 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandling_FieldPath)) 4048 } 4049 4050 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) GetPaths() []PolicySpecAIAgentHandling_FieldPath { 4051 if fieldMask == nil { 4052 return nil 4053 } 4054 return fieldMask.Paths 4055 } 4056 4057 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4058 if fieldMask == nil { 4059 return nil 4060 } 4061 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4062 for _, path := range fieldMask.Paths { 4063 rawPaths = append(rawPaths, path) 4064 } 4065 return rawPaths 4066 } 4067 4068 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) SetFromCliFlag(raw string) error { 4069 path, err := ParsePolicySpecAIAgentHandling_FieldPath(raw) 4070 if err != nil { 4071 return err 4072 } 4073 fieldMask.Paths = append(fieldMask.Paths, path) 4074 return nil 4075 } 4076 4077 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) Set(target, source *PolicySpec_AIAgentHandling) { 4078 for _, path := range fieldMask.Paths { 4079 val, _ := path.GetSingle(source) 4080 // if val is nil, then field does not exist in source, skip 4081 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4082 if val != nil { 4083 path.WithIValue(val).SetTo(&target) 4084 } 4085 } 4086 } 4087 4088 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4089 fieldMask.Set(target.(*PolicySpec_AIAgentHandling), source.(*PolicySpec_AIAgentHandling)) 4090 } 4091 4092 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) Project(source *PolicySpec_AIAgentHandling) *PolicySpec_AIAgentHandling { 4093 if source == nil { 4094 return nil 4095 } 4096 if fieldMask == nil { 4097 return source 4098 } 4099 result := &PolicySpec_AIAgentHandling{} 4100 edgeConnectivityMask := &PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask{} 4101 wholeEdgeConnectivityAccepted := false 4102 remediationOptionsMask := &PolicySpec_AIAgentHandling_Remediation_FieldMask{} 4103 wholeRemediationOptionsAccepted := false 4104 4105 for _, p := range fieldMask.Paths { 4106 switch tp := p.(type) { 4107 case *PolicySpecAIAgentHandling_FieldTerminalPath: 4108 switch tp.selector { 4109 case PolicySpecAIAgentHandling_FieldPathSelectorEnabled: 4110 result.Enabled = source.Enabled 4111 case PolicySpecAIAgentHandling_FieldPathSelectorEnabledConnectivity: 4112 result.EnabledConnectivity = source.EnabledConnectivity 4113 case PolicySpecAIAgentHandling_FieldPathSelectorAutoAcceptRemediation: 4114 result.AutoAcceptRemediation = source.AutoAcceptRemediation 4115 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 4116 result.EdgeConnectivity = source.EdgeConnectivity 4117 wholeEdgeConnectivityAccepted = true 4118 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 4119 result.RemediationOptions = source.RemediationOptions 4120 wholeRemediationOptionsAccepted = true 4121 } 4122 case *PolicySpecAIAgentHandling_FieldSubPath: 4123 switch tp.selector { 4124 case PolicySpecAIAgentHandling_FieldPathSelectorEdgeConnectivity: 4125 edgeConnectivityMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath)) 4126 case PolicySpecAIAgentHandling_FieldPathSelectorRemediationOptions: 4127 remediationOptionsMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandlingRemediation_FieldPath)) 4128 } 4129 } 4130 } 4131 if wholeEdgeConnectivityAccepted == false && len(edgeConnectivityMask.Paths) > 0 { 4132 result.EdgeConnectivity = edgeConnectivityMask.Project(source.GetEdgeConnectivity()) 4133 } 4134 if wholeRemediationOptionsAccepted == false && len(remediationOptionsMask.Paths) > 0 { 4135 for _, sourceItem := range source.GetRemediationOptions() { 4136 result.RemediationOptions = append(result.RemediationOptions, remediationOptionsMask.Project(sourceItem)) 4137 } 4138 } 4139 return result 4140 } 4141 4142 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4143 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling)) 4144 } 4145 4146 func (fieldMask *PolicySpec_AIAgentHandling_FieldMask) PathsCount() int { 4147 if fieldMask == nil { 4148 return 0 4149 } 4150 return len(fieldMask.Paths) 4151 } 4152 4153 type PolicySpec_ResourceIdentity_LabelInfo_FieldMask struct { 4154 Paths []PolicySpecResourceIdentityLabelInfo_FieldPath 4155 } 4156 4157 func FullPolicySpec_ResourceIdentity_LabelInfo_FieldMask() *PolicySpec_ResourceIdentity_LabelInfo_FieldMask { 4158 res := &PolicySpec_ResourceIdentity_LabelInfo_FieldMask{} 4159 res.Paths = append(res.Paths, &PolicySpecResourceIdentityLabelInfo_FieldTerminalPath{selector: PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey}) 4160 res.Paths = append(res.Paths, &PolicySpecResourceIdentityLabelInfo_FieldTerminalPath{selector: PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts}) 4161 res.Paths = append(res.Paths, &PolicySpecResourceIdentityLabelInfo_FieldTerminalPath{selector: PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment}) 4162 return res 4163 } 4164 4165 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) String() string { 4166 if fieldMask == nil { 4167 return "<nil>" 4168 } 4169 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4170 for _, path := range fieldMask.Paths { 4171 pathsStr = append(pathsStr, path.String()) 4172 } 4173 return strings.Join(pathsStr, ", ") 4174 } 4175 4176 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) IsFull() bool { 4177 if fieldMask == nil { 4178 return false 4179 } 4180 presentSelectors := make([]bool, 3) 4181 for _, path := range fieldMask.Paths { 4182 if asFinal, ok := path.(*PolicySpecResourceIdentityLabelInfo_FieldTerminalPath); ok { 4183 presentSelectors[int(asFinal.selector)] = true 4184 } 4185 } 4186 for _, flag := range presentSelectors { 4187 if !flag { 4188 return false 4189 } 4190 } 4191 return true 4192 } 4193 4194 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) ProtoReflect() preflect.Message { 4195 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4196 return ParsePolicySpecResourceIdentityLabelInfo_FieldPath(raw) 4197 }) 4198 } 4199 4200 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) ProtoMessage() {} 4201 4202 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) Reset() { 4203 if fieldMask != nil { 4204 fieldMask.Paths = nil 4205 } 4206 } 4207 4208 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) Subtract(other *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) *PolicySpec_ResourceIdentity_LabelInfo_FieldMask { 4209 result := &PolicySpec_ResourceIdentity_LabelInfo_FieldMask{} 4210 removedSelectors := make([]bool, 3) 4211 4212 for _, path := range other.GetPaths() { 4213 switch tp := path.(type) { 4214 case *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: 4215 removedSelectors[int(tp.selector)] = true 4216 } 4217 } 4218 for _, path := range fieldMask.GetPaths() { 4219 if !removedSelectors[int(path.Selector())] { 4220 result.Paths = append(result.Paths, path) 4221 } 4222 } 4223 4224 if len(result.Paths) == 0 { 4225 return nil 4226 } 4227 return result 4228 } 4229 4230 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 4231 return fieldMask.Subtract(other.(*PolicySpec_ResourceIdentity_LabelInfo_FieldMask)) 4232 } 4233 4234 // FilterInputFields generates copy of field paths with output_only field paths removed 4235 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) FilterInputFields() *PolicySpec_ResourceIdentity_LabelInfo_FieldMask { 4236 result := &PolicySpec_ResourceIdentity_LabelInfo_FieldMask{} 4237 result.Paths = append(result.Paths, fieldMask.Paths...) 4238 return result 4239 } 4240 4241 // ToFieldMask is used for proto conversions 4242 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 4243 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4244 for _, path := range fieldMask.Paths { 4245 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 4246 } 4247 return protoFieldMask 4248 } 4249 4250 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 4251 if fieldMask == nil { 4252 return status.Error(codes.Internal, "target field mask is nil") 4253 } 4254 fieldMask.Paths = make([]PolicySpecResourceIdentityLabelInfo_FieldPath, 0, len(protoFieldMask.Paths)) 4255 for _, strPath := range protoFieldMask.Paths { 4256 path, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPath(strPath) 4257 if err != nil { 4258 return err 4259 } 4260 fieldMask.Paths = append(fieldMask.Paths, path) 4261 } 4262 return nil 4263 } 4264 4265 // implement methods required by customType 4266 func (fieldMask PolicySpec_ResourceIdentity_LabelInfo_FieldMask) Marshal() ([]byte, error) { 4267 protoFieldMask := fieldMask.ToProtoFieldMask() 4268 return proto.Marshal(protoFieldMask) 4269 } 4270 4271 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) Unmarshal(data []byte) error { 4272 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4273 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 4274 return err 4275 } 4276 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4277 return err 4278 } 4279 return nil 4280 } 4281 4282 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) Size() int { 4283 return proto.Size(fieldMask.ToProtoFieldMask()) 4284 } 4285 4286 func (fieldMask PolicySpec_ResourceIdentity_LabelInfo_FieldMask) MarshalJSON() ([]byte, error) { 4287 return json.Marshal(fieldMask.ToProtoFieldMask()) 4288 } 4289 4290 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) UnmarshalJSON(data []byte) error { 4291 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4292 if err := json.Unmarshal(data, protoFieldMask); err != nil { 4293 return err 4294 } 4295 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4296 return err 4297 } 4298 return nil 4299 } 4300 4301 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) AppendPath(path PolicySpecResourceIdentityLabelInfo_FieldPath) { 4302 fieldMask.Paths = append(fieldMask.Paths, path) 4303 } 4304 4305 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4306 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecResourceIdentityLabelInfo_FieldPath)) 4307 } 4308 4309 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) GetPaths() []PolicySpecResourceIdentityLabelInfo_FieldPath { 4310 if fieldMask == nil { 4311 return nil 4312 } 4313 return fieldMask.Paths 4314 } 4315 4316 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4317 if fieldMask == nil { 4318 return nil 4319 } 4320 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4321 for _, path := range fieldMask.Paths { 4322 rawPaths = append(rawPaths, path) 4323 } 4324 return rawPaths 4325 } 4326 4327 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) SetFromCliFlag(raw string) error { 4328 path, err := ParsePolicySpecResourceIdentityLabelInfo_FieldPath(raw) 4329 if err != nil { 4330 return err 4331 } 4332 fieldMask.Paths = append(fieldMask.Paths, path) 4333 return nil 4334 } 4335 4336 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) Set(target, source *PolicySpec_ResourceIdentity_LabelInfo) { 4337 for _, path := range fieldMask.Paths { 4338 val, _ := path.GetSingle(source) 4339 // if val is nil, then field does not exist in source, skip 4340 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4341 if val != nil { 4342 path.WithIValue(val).SetTo(&target) 4343 } 4344 } 4345 } 4346 4347 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4348 fieldMask.Set(target.(*PolicySpec_ResourceIdentity_LabelInfo), source.(*PolicySpec_ResourceIdentity_LabelInfo)) 4349 } 4350 4351 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) Project(source *PolicySpec_ResourceIdentity_LabelInfo) *PolicySpec_ResourceIdentity_LabelInfo { 4352 if source == nil { 4353 return nil 4354 } 4355 if fieldMask == nil { 4356 return source 4357 } 4358 result := &PolicySpec_ResourceIdentity_LabelInfo{} 4359 4360 for _, p := range fieldMask.Paths { 4361 switch tp := p.(type) { 4362 case *PolicySpecResourceIdentityLabelInfo_FieldTerminalPath: 4363 switch tp.selector { 4364 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorKey: 4365 result.Key = source.Key 4366 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorContexts: 4367 result.Contexts = source.Contexts 4368 case PolicySpecResourceIdentityLabelInfo_FieldPathSelectorMappedNameSegment: 4369 result.MappedNameSegment = source.MappedNameSegment 4370 } 4371 } 4372 } 4373 return result 4374 } 4375 4376 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4377 return fieldMask.Project(source.(*PolicySpec_ResourceIdentity_LabelInfo)) 4378 } 4379 4380 func (fieldMask *PolicySpec_ResourceIdentity_LabelInfo_FieldMask) PathsCount() int { 4381 if fieldMask == nil { 4382 return 0 4383 } 4384 return len(fieldMask.Paths) 4385 } 4386 4387 type PolicySpec_SupportingAlertQuery_TsQuery_FieldMask struct { 4388 Paths []PolicySpecSupportingAlertQueryTsQuery_FieldPath 4389 } 4390 4391 func FullPolicySpec_SupportingAlertQuery_TsQuery_FieldMask() *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask { 4392 res := &PolicySpec_SupportingAlertQuery_TsQuery_FieldMask{} 4393 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription}) 4394 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate}) 4395 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation}) 4396 return res 4397 } 4398 4399 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) String() string { 4400 if fieldMask == nil { 4401 return "<nil>" 4402 } 4403 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4404 for _, path := range fieldMask.Paths { 4405 pathsStr = append(pathsStr, path.String()) 4406 } 4407 return strings.Join(pathsStr, ", ") 4408 } 4409 4410 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) IsFull() bool { 4411 if fieldMask == nil { 4412 return false 4413 } 4414 presentSelectors := make([]bool, 3) 4415 for _, path := range fieldMask.Paths { 4416 if asFinal, ok := path.(*PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath); ok { 4417 presentSelectors[int(asFinal.selector)] = true 4418 } 4419 } 4420 for _, flag := range presentSelectors { 4421 if !flag { 4422 return false 4423 } 4424 } 4425 return true 4426 } 4427 4428 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) ProtoReflect() preflect.Message { 4429 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4430 return ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(raw) 4431 }) 4432 } 4433 4434 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) ProtoMessage() {} 4435 4436 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) Reset() { 4437 if fieldMask != nil { 4438 fieldMask.Paths = nil 4439 } 4440 } 4441 4442 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) Subtract(other *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask { 4443 result := &PolicySpec_SupportingAlertQuery_TsQuery_FieldMask{} 4444 removedSelectors := make([]bool, 3) 4445 otherSubMasks := map[PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector]gotenobject.FieldMask{ 4446 PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: &monitoring_common.Aggregation_FieldMask{}, 4447 } 4448 mySubMasks := map[PolicySpecSupportingAlertQueryTsQuery_FieldPathSelector]gotenobject.FieldMask{ 4449 PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: &monitoring_common.Aggregation_FieldMask{}, 4450 } 4451 4452 for _, path := range other.GetPaths() { 4453 switch tp := path.(type) { 4454 case *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: 4455 removedSelectors[int(tp.selector)] = true 4456 case *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath: 4457 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 4458 } 4459 } 4460 for _, path := range fieldMask.GetPaths() { 4461 if !removedSelectors[int(path.Selector())] { 4462 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 4463 if tp, ok := path.(*PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath); ok { 4464 switch tp.selector { 4465 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 4466 mySubMasks[PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation] = monitoring_common.FullAggregation_FieldMask() 4467 } 4468 } else if tp, ok := path.(*PolicySpecSupportingAlertQueryTsQuery_FieldSubPath); ok { 4469 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 4470 } 4471 } else { 4472 result.Paths = append(result.Paths, path) 4473 } 4474 } 4475 } 4476 for selector, mySubMask := range mySubMasks { 4477 if mySubMask.PathsCount() > 0 { 4478 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 4479 result.Paths = append(result.Paths, &PolicySpecSupportingAlertQueryTsQuery_FieldSubPath{selector: selector, subPath: allowedPath}) 4480 } 4481 } 4482 } 4483 4484 if len(result.Paths) == 0 { 4485 return nil 4486 } 4487 return result 4488 } 4489 4490 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 4491 return fieldMask.Subtract(other.(*PolicySpec_SupportingAlertQuery_TsQuery_FieldMask)) 4492 } 4493 4494 // FilterInputFields generates copy of field paths with output_only field paths removed 4495 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) FilterInputFields() *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask { 4496 result := &PolicySpec_SupportingAlertQuery_TsQuery_FieldMask{} 4497 result.Paths = append(result.Paths, fieldMask.Paths...) 4498 return result 4499 } 4500 4501 // ToFieldMask is used for proto conversions 4502 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 4503 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4504 for _, path := range fieldMask.Paths { 4505 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 4506 } 4507 return protoFieldMask 4508 } 4509 4510 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 4511 if fieldMask == nil { 4512 return status.Error(codes.Internal, "target field mask is nil") 4513 } 4514 fieldMask.Paths = make([]PolicySpecSupportingAlertQueryTsQuery_FieldPath, 0, len(protoFieldMask.Paths)) 4515 for _, strPath := range protoFieldMask.Paths { 4516 path, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(strPath) 4517 if err != nil { 4518 return err 4519 } 4520 fieldMask.Paths = append(fieldMask.Paths, path) 4521 } 4522 return nil 4523 } 4524 4525 // implement methods required by customType 4526 func (fieldMask PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) Marshal() ([]byte, error) { 4527 protoFieldMask := fieldMask.ToProtoFieldMask() 4528 return proto.Marshal(protoFieldMask) 4529 } 4530 4531 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) Unmarshal(data []byte) error { 4532 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4533 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 4534 return err 4535 } 4536 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4537 return err 4538 } 4539 return nil 4540 } 4541 4542 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) Size() int { 4543 return proto.Size(fieldMask.ToProtoFieldMask()) 4544 } 4545 4546 func (fieldMask PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) MarshalJSON() ([]byte, error) { 4547 return json.Marshal(fieldMask.ToProtoFieldMask()) 4548 } 4549 4550 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) UnmarshalJSON(data []byte) error { 4551 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4552 if err := json.Unmarshal(data, protoFieldMask); err != nil { 4553 return err 4554 } 4555 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4556 return err 4557 } 4558 return nil 4559 } 4560 4561 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) AppendPath(path PolicySpecSupportingAlertQueryTsQuery_FieldPath) { 4562 fieldMask.Paths = append(fieldMask.Paths, path) 4563 } 4564 4565 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4566 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecSupportingAlertQueryTsQuery_FieldPath)) 4567 } 4568 4569 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) GetPaths() []PolicySpecSupportingAlertQueryTsQuery_FieldPath { 4570 if fieldMask == nil { 4571 return nil 4572 } 4573 return fieldMask.Paths 4574 } 4575 4576 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4577 if fieldMask == nil { 4578 return nil 4579 } 4580 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4581 for _, path := range fieldMask.Paths { 4582 rawPaths = append(rawPaths, path) 4583 } 4584 return rawPaths 4585 } 4586 4587 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) SetFromCliFlag(raw string) error { 4588 path, err := ParsePolicySpecSupportingAlertQueryTsQuery_FieldPath(raw) 4589 if err != nil { 4590 return err 4591 } 4592 fieldMask.Paths = append(fieldMask.Paths, path) 4593 return nil 4594 } 4595 4596 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) Set(target, source *PolicySpec_SupportingAlertQuery_TsQuery) { 4597 for _, path := range fieldMask.Paths { 4598 val, _ := path.GetSingle(source) 4599 // if val is nil, then field does not exist in source, skip 4600 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4601 if val != nil { 4602 path.WithIValue(val).SetTo(&target) 4603 } 4604 } 4605 } 4606 4607 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4608 fieldMask.Set(target.(*PolicySpec_SupportingAlertQuery_TsQuery), source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 4609 } 4610 4611 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) Project(source *PolicySpec_SupportingAlertQuery_TsQuery) *PolicySpec_SupportingAlertQuery_TsQuery { 4612 if source == nil { 4613 return nil 4614 } 4615 if fieldMask == nil { 4616 return source 4617 } 4618 result := &PolicySpec_SupportingAlertQuery_TsQuery{} 4619 aggregationMask := &monitoring_common.Aggregation_FieldMask{} 4620 wholeAggregationAccepted := false 4621 4622 for _, p := range fieldMask.Paths { 4623 switch tp := p.(type) { 4624 case *PolicySpecSupportingAlertQueryTsQuery_FieldTerminalPath: 4625 switch tp.selector { 4626 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorDescription: 4627 result.Description = source.Description 4628 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorFilterTemplate: 4629 result.FilterTemplate = source.FilterTemplate 4630 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 4631 result.Aggregation = source.Aggregation 4632 wholeAggregationAccepted = true 4633 } 4634 case *PolicySpecSupportingAlertQueryTsQuery_FieldSubPath: 4635 switch tp.selector { 4636 case PolicySpecSupportingAlertQueryTsQuery_FieldPathSelectorAggregation: 4637 aggregationMask.AppendPath(tp.subPath.(monitoring_common.Aggregation_FieldPath)) 4638 } 4639 } 4640 } 4641 if wholeAggregationAccepted == false && len(aggregationMask.Paths) > 0 { 4642 result.Aggregation = aggregationMask.Project(source.GetAggregation()) 4643 } 4644 return result 4645 } 4646 4647 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4648 return fieldMask.Project(source.(*PolicySpec_SupportingAlertQuery_TsQuery)) 4649 } 4650 4651 func (fieldMask *PolicySpec_SupportingAlertQuery_TsQuery_FieldMask) PathsCount() int { 4652 if fieldMask == nil { 4653 return 0 4654 } 4655 return len(fieldMask.Paths) 4656 } 4657 4658 type PolicySpec_SupportingAlertQuery_LogQuery_FieldMask struct { 4659 Paths []PolicySpecSupportingAlertQueryLogQuery_FieldPath 4660 } 4661 4662 func FullPolicySpec_SupportingAlertQuery_LogQuery_FieldMask() *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask { 4663 res := &PolicySpec_SupportingAlertQuery_LogQuery_FieldMask{} 4664 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription}) 4665 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate}) 4666 return res 4667 } 4668 4669 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) String() string { 4670 if fieldMask == nil { 4671 return "<nil>" 4672 } 4673 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4674 for _, path := range fieldMask.Paths { 4675 pathsStr = append(pathsStr, path.String()) 4676 } 4677 return strings.Join(pathsStr, ", ") 4678 } 4679 4680 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) IsFull() bool { 4681 if fieldMask == nil { 4682 return false 4683 } 4684 presentSelectors := make([]bool, 2) 4685 for _, path := range fieldMask.Paths { 4686 if asFinal, ok := path.(*PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath); ok { 4687 presentSelectors[int(asFinal.selector)] = true 4688 } 4689 } 4690 for _, flag := range presentSelectors { 4691 if !flag { 4692 return false 4693 } 4694 } 4695 return true 4696 } 4697 4698 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) ProtoReflect() preflect.Message { 4699 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4700 return ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(raw) 4701 }) 4702 } 4703 4704 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) ProtoMessage() {} 4705 4706 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) Reset() { 4707 if fieldMask != nil { 4708 fieldMask.Paths = nil 4709 } 4710 } 4711 4712 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) Subtract(other *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask { 4713 result := &PolicySpec_SupportingAlertQuery_LogQuery_FieldMask{} 4714 removedSelectors := make([]bool, 2) 4715 4716 for _, path := range other.GetPaths() { 4717 switch tp := path.(type) { 4718 case *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath: 4719 removedSelectors[int(tp.selector)] = true 4720 } 4721 } 4722 for _, path := range fieldMask.GetPaths() { 4723 if !removedSelectors[int(path.Selector())] { 4724 result.Paths = append(result.Paths, path) 4725 } 4726 } 4727 4728 if len(result.Paths) == 0 { 4729 return nil 4730 } 4731 return result 4732 } 4733 4734 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 4735 return fieldMask.Subtract(other.(*PolicySpec_SupportingAlertQuery_LogQuery_FieldMask)) 4736 } 4737 4738 // FilterInputFields generates copy of field paths with output_only field paths removed 4739 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) FilterInputFields() *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask { 4740 result := &PolicySpec_SupportingAlertQuery_LogQuery_FieldMask{} 4741 result.Paths = append(result.Paths, fieldMask.Paths...) 4742 return result 4743 } 4744 4745 // ToFieldMask is used for proto conversions 4746 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 4747 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4748 for _, path := range fieldMask.Paths { 4749 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 4750 } 4751 return protoFieldMask 4752 } 4753 4754 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 4755 if fieldMask == nil { 4756 return status.Error(codes.Internal, "target field mask is nil") 4757 } 4758 fieldMask.Paths = make([]PolicySpecSupportingAlertQueryLogQuery_FieldPath, 0, len(protoFieldMask.Paths)) 4759 for _, strPath := range protoFieldMask.Paths { 4760 path, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(strPath) 4761 if err != nil { 4762 return err 4763 } 4764 fieldMask.Paths = append(fieldMask.Paths, path) 4765 } 4766 return nil 4767 } 4768 4769 // implement methods required by customType 4770 func (fieldMask PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) Marshal() ([]byte, error) { 4771 protoFieldMask := fieldMask.ToProtoFieldMask() 4772 return proto.Marshal(protoFieldMask) 4773 } 4774 4775 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) Unmarshal(data []byte) error { 4776 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4777 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 4778 return err 4779 } 4780 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4781 return err 4782 } 4783 return nil 4784 } 4785 4786 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) Size() int { 4787 return proto.Size(fieldMask.ToProtoFieldMask()) 4788 } 4789 4790 func (fieldMask PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) MarshalJSON() ([]byte, error) { 4791 return json.Marshal(fieldMask.ToProtoFieldMask()) 4792 } 4793 4794 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) UnmarshalJSON(data []byte) error { 4795 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4796 if err := json.Unmarshal(data, protoFieldMask); err != nil { 4797 return err 4798 } 4799 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 4800 return err 4801 } 4802 return nil 4803 } 4804 4805 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) AppendPath(path PolicySpecSupportingAlertQueryLogQuery_FieldPath) { 4806 fieldMask.Paths = append(fieldMask.Paths, path) 4807 } 4808 4809 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 4810 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecSupportingAlertQueryLogQuery_FieldPath)) 4811 } 4812 4813 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) GetPaths() []PolicySpecSupportingAlertQueryLogQuery_FieldPath { 4814 if fieldMask == nil { 4815 return nil 4816 } 4817 return fieldMask.Paths 4818 } 4819 4820 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) GetRawPaths() []gotenobject.FieldPath { 4821 if fieldMask == nil { 4822 return nil 4823 } 4824 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 4825 for _, path := range fieldMask.Paths { 4826 rawPaths = append(rawPaths, path) 4827 } 4828 return rawPaths 4829 } 4830 4831 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) SetFromCliFlag(raw string) error { 4832 path, err := ParsePolicySpecSupportingAlertQueryLogQuery_FieldPath(raw) 4833 if err != nil { 4834 return err 4835 } 4836 fieldMask.Paths = append(fieldMask.Paths, path) 4837 return nil 4838 } 4839 4840 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) Set(target, source *PolicySpec_SupportingAlertQuery_LogQuery) { 4841 for _, path := range fieldMask.Paths { 4842 val, _ := path.GetSingle(source) 4843 // if val is nil, then field does not exist in source, skip 4844 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 4845 if val != nil { 4846 path.WithIValue(val).SetTo(&target) 4847 } 4848 } 4849 } 4850 4851 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 4852 fieldMask.Set(target.(*PolicySpec_SupportingAlertQuery_LogQuery), source.(*PolicySpec_SupportingAlertQuery_LogQuery)) 4853 } 4854 4855 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) Project(source *PolicySpec_SupportingAlertQuery_LogQuery) *PolicySpec_SupportingAlertQuery_LogQuery { 4856 if source == nil { 4857 return nil 4858 } 4859 if fieldMask == nil { 4860 return source 4861 } 4862 result := &PolicySpec_SupportingAlertQuery_LogQuery{} 4863 4864 for _, p := range fieldMask.Paths { 4865 switch tp := p.(type) { 4866 case *PolicySpecSupportingAlertQueryLogQuery_FieldTerminalPath: 4867 switch tp.selector { 4868 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorDescription: 4869 result.Description = source.Description 4870 case PolicySpecSupportingAlertQueryLogQuery_FieldPathSelectorFilterTemplate: 4871 result.FilterTemplate = source.FilterTemplate 4872 } 4873 } 4874 } 4875 return result 4876 } 4877 4878 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 4879 return fieldMask.Project(source.(*PolicySpec_SupportingAlertQuery_LogQuery)) 4880 } 4881 4882 func (fieldMask *PolicySpec_SupportingAlertQuery_LogQuery_FieldMask) PathsCount() int { 4883 if fieldMask == nil { 4884 return 0 4885 } 4886 return len(fieldMask.Paths) 4887 } 4888 4889 type PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask struct { 4890 Paths []PolicySpecSupportingAlertQueryRestGetQuery_FieldPath 4891 } 4892 4893 func FullPolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask() *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask { 4894 res := &PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask{} 4895 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription}) 4896 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint}) 4897 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate}) 4898 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView}) 4899 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask}) 4900 return res 4901 } 4902 4903 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) String() string { 4904 if fieldMask == nil { 4905 return "<nil>" 4906 } 4907 pathsStr := make([]string, 0, len(fieldMask.Paths)) 4908 for _, path := range fieldMask.Paths { 4909 pathsStr = append(pathsStr, path.String()) 4910 } 4911 return strings.Join(pathsStr, ", ") 4912 } 4913 4914 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) IsFull() bool { 4915 if fieldMask == nil { 4916 return false 4917 } 4918 presentSelectors := make([]bool, 5) 4919 for _, path := range fieldMask.Paths { 4920 if asFinal, ok := path.(*PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath); ok { 4921 presentSelectors[int(asFinal.selector)] = true 4922 } 4923 } 4924 for _, flag := range presentSelectors { 4925 if !flag { 4926 return false 4927 } 4928 } 4929 return true 4930 } 4931 4932 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) ProtoReflect() preflect.Message { 4933 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 4934 return ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(raw) 4935 }) 4936 } 4937 4938 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) ProtoMessage() {} 4939 4940 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) Reset() { 4941 if fieldMask != nil { 4942 fieldMask.Paths = nil 4943 } 4944 } 4945 4946 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) Subtract(other *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask { 4947 result := &PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask{} 4948 removedSelectors := make([]bool, 5) 4949 4950 for _, path := range other.GetPaths() { 4951 switch tp := path.(type) { 4952 case *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: 4953 removedSelectors[int(tp.selector)] = true 4954 } 4955 } 4956 for _, path := range fieldMask.GetPaths() { 4957 if !removedSelectors[int(path.Selector())] { 4958 result.Paths = append(result.Paths, path) 4959 } 4960 } 4961 4962 if len(result.Paths) == 0 { 4963 return nil 4964 } 4965 return result 4966 } 4967 4968 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 4969 return fieldMask.Subtract(other.(*PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask)) 4970 } 4971 4972 // FilterInputFields generates copy of field paths with output_only field paths removed 4973 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) FilterInputFields() *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask { 4974 result := &PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask{} 4975 result.Paths = append(result.Paths, fieldMask.Paths...) 4976 return result 4977 } 4978 4979 // ToFieldMask is used for proto conversions 4980 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 4981 protoFieldMask := &googlefieldmaskpb.FieldMask{} 4982 for _, path := range fieldMask.Paths { 4983 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 4984 } 4985 return protoFieldMask 4986 } 4987 4988 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 4989 if fieldMask == nil { 4990 return status.Error(codes.Internal, "target field mask is nil") 4991 } 4992 fieldMask.Paths = make([]PolicySpecSupportingAlertQueryRestGetQuery_FieldPath, 0, len(protoFieldMask.Paths)) 4993 for _, strPath := range protoFieldMask.Paths { 4994 path, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(strPath) 4995 if err != nil { 4996 return err 4997 } 4998 fieldMask.Paths = append(fieldMask.Paths, path) 4999 } 5000 return nil 5001 } 5002 5003 // implement methods required by customType 5004 func (fieldMask PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) Marshal() ([]byte, error) { 5005 protoFieldMask := fieldMask.ToProtoFieldMask() 5006 return proto.Marshal(protoFieldMask) 5007 } 5008 5009 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) Unmarshal(data []byte) error { 5010 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5011 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 5012 return err 5013 } 5014 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5015 return err 5016 } 5017 return nil 5018 } 5019 5020 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) Size() int { 5021 return proto.Size(fieldMask.ToProtoFieldMask()) 5022 } 5023 5024 func (fieldMask PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) MarshalJSON() ([]byte, error) { 5025 return json.Marshal(fieldMask.ToProtoFieldMask()) 5026 } 5027 5028 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) UnmarshalJSON(data []byte) error { 5029 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5030 if err := json.Unmarshal(data, protoFieldMask); err != nil { 5031 return err 5032 } 5033 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5034 return err 5035 } 5036 return nil 5037 } 5038 5039 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) AppendPath(path PolicySpecSupportingAlertQueryRestGetQuery_FieldPath) { 5040 fieldMask.Paths = append(fieldMask.Paths, path) 5041 } 5042 5043 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 5044 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecSupportingAlertQueryRestGetQuery_FieldPath)) 5045 } 5046 5047 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) GetPaths() []PolicySpecSupportingAlertQueryRestGetQuery_FieldPath { 5048 if fieldMask == nil { 5049 return nil 5050 } 5051 return fieldMask.Paths 5052 } 5053 5054 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) GetRawPaths() []gotenobject.FieldPath { 5055 if fieldMask == nil { 5056 return nil 5057 } 5058 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 5059 for _, path := range fieldMask.Paths { 5060 rawPaths = append(rawPaths, path) 5061 } 5062 return rawPaths 5063 } 5064 5065 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) SetFromCliFlag(raw string) error { 5066 path, err := ParsePolicySpecSupportingAlertQueryRestGetQuery_FieldPath(raw) 5067 if err != nil { 5068 return err 5069 } 5070 fieldMask.Paths = append(fieldMask.Paths, path) 5071 return nil 5072 } 5073 5074 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) Set(target, source *PolicySpec_SupportingAlertQuery_RestGetQuery) { 5075 for _, path := range fieldMask.Paths { 5076 val, _ := path.GetSingle(source) 5077 // if val is nil, then field does not exist in source, skip 5078 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 5079 if val != nil { 5080 path.WithIValue(val).SetTo(&target) 5081 } 5082 } 5083 } 5084 5085 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 5086 fieldMask.Set(target.(*PolicySpec_SupportingAlertQuery_RestGetQuery), source.(*PolicySpec_SupportingAlertQuery_RestGetQuery)) 5087 } 5088 5089 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) Project(source *PolicySpec_SupportingAlertQuery_RestGetQuery) *PolicySpec_SupportingAlertQuery_RestGetQuery { 5090 if source == nil { 5091 return nil 5092 } 5093 if fieldMask == nil { 5094 return source 5095 } 5096 result := &PolicySpec_SupportingAlertQuery_RestGetQuery{} 5097 5098 for _, p := range fieldMask.Paths { 5099 switch tp := p.(type) { 5100 case *PolicySpecSupportingAlertQueryRestGetQuery_FieldTerminalPath: 5101 switch tp.selector { 5102 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorDescription: 5103 result.Description = source.Description 5104 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorEndpoint: 5105 result.Endpoint = source.Endpoint 5106 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorPathTemplate: 5107 result.PathTemplate = source.PathTemplate 5108 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorView: 5109 result.View = source.View 5110 case PolicySpecSupportingAlertQueryRestGetQuery_FieldPathSelectorFieldMask: 5111 result.FieldMask = source.FieldMask 5112 } 5113 } 5114 } 5115 return result 5116 } 5117 5118 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 5119 return fieldMask.Project(source.(*PolicySpec_SupportingAlertQuery_RestGetQuery)) 5120 } 5121 5122 func (fieldMask *PolicySpec_SupportingAlertQuery_RestGetQuery_FieldMask) PathsCount() int { 5123 if fieldMask == nil { 5124 return 0 5125 } 5126 return len(fieldMask.Paths) 5127 } 5128 5129 type PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask struct { 5130 Paths []PolicySpecSupportingAlertQueryRestListQuery_FieldPath 5131 } 5132 5133 func FullPolicySpec_SupportingAlertQuery_RestListQuery_FieldMask() *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask { 5134 res := &PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask{} 5135 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription}) 5136 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint}) 5137 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate}) 5138 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView}) 5139 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask}) 5140 res.Paths = append(res.Paths, &PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath{selector: PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate}) 5141 return res 5142 } 5143 5144 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) String() string { 5145 if fieldMask == nil { 5146 return "<nil>" 5147 } 5148 pathsStr := make([]string, 0, len(fieldMask.Paths)) 5149 for _, path := range fieldMask.Paths { 5150 pathsStr = append(pathsStr, path.String()) 5151 } 5152 return strings.Join(pathsStr, ", ") 5153 } 5154 5155 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) IsFull() bool { 5156 if fieldMask == nil { 5157 return false 5158 } 5159 presentSelectors := make([]bool, 6) 5160 for _, path := range fieldMask.Paths { 5161 if asFinal, ok := path.(*PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath); ok { 5162 presentSelectors[int(asFinal.selector)] = true 5163 } 5164 } 5165 for _, flag := range presentSelectors { 5166 if !flag { 5167 return false 5168 } 5169 } 5170 return true 5171 } 5172 5173 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) ProtoReflect() preflect.Message { 5174 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 5175 return ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(raw) 5176 }) 5177 } 5178 5179 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) ProtoMessage() {} 5180 5181 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) Reset() { 5182 if fieldMask != nil { 5183 fieldMask.Paths = nil 5184 } 5185 } 5186 5187 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) Subtract(other *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask { 5188 result := &PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask{} 5189 removedSelectors := make([]bool, 6) 5190 5191 for _, path := range other.GetPaths() { 5192 switch tp := path.(type) { 5193 case *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: 5194 removedSelectors[int(tp.selector)] = true 5195 } 5196 } 5197 for _, path := range fieldMask.GetPaths() { 5198 if !removedSelectors[int(path.Selector())] { 5199 result.Paths = append(result.Paths, path) 5200 } 5201 } 5202 5203 if len(result.Paths) == 0 { 5204 return nil 5205 } 5206 return result 5207 } 5208 5209 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 5210 return fieldMask.Subtract(other.(*PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask)) 5211 } 5212 5213 // FilterInputFields generates copy of field paths with output_only field paths removed 5214 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) FilterInputFields() *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask { 5215 result := &PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask{} 5216 result.Paths = append(result.Paths, fieldMask.Paths...) 5217 return result 5218 } 5219 5220 // ToFieldMask is used for proto conversions 5221 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 5222 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5223 for _, path := range fieldMask.Paths { 5224 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 5225 } 5226 return protoFieldMask 5227 } 5228 5229 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 5230 if fieldMask == nil { 5231 return status.Error(codes.Internal, "target field mask is nil") 5232 } 5233 fieldMask.Paths = make([]PolicySpecSupportingAlertQueryRestListQuery_FieldPath, 0, len(protoFieldMask.Paths)) 5234 for _, strPath := range protoFieldMask.Paths { 5235 path, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(strPath) 5236 if err != nil { 5237 return err 5238 } 5239 fieldMask.Paths = append(fieldMask.Paths, path) 5240 } 5241 return nil 5242 } 5243 5244 // implement methods required by customType 5245 func (fieldMask PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) Marshal() ([]byte, error) { 5246 protoFieldMask := fieldMask.ToProtoFieldMask() 5247 return proto.Marshal(protoFieldMask) 5248 } 5249 5250 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) Unmarshal(data []byte) error { 5251 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5252 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 5253 return err 5254 } 5255 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5256 return err 5257 } 5258 return nil 5259 } 5260 5261 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) Size() int { 5262 return proto.Size(fieldMask.ToProtoFieldMask()) 5263 } 5264 5265 func (fieldMask PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) MarshalJSON() ([]byte, error) { 5266 return json.Marshal(fieldMask.ToProtoFieldMask()) 5267 } 5268 5269 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) UnmarshalJSON(data []byte) error { 5270 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5271 if err := json.Unmarshal(data, protoFieldMask); err != nil { 5272 return err 5273 } 5274 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5275 return err 5276 } 5277 return nil 5278 } 5279 5280 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) AppendPath(path PolicySpecSupportingAlertQueryRestListQuery_FieldPath) { 5281 fieldMask.Paths = append(fieldMask.Paths, path) 5282 } 5283 5284 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 5285 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecSupportingAlertQueryRestListQuery_FieldPath)) 5286 } 5287 5288 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) GetPaths() []PolicySpecSupportingAlertQueryRestListQuery_FieldPath { 5289 if fieldMask == nil { 5290 return nil 5291 } 5292 return fieldMask.Paths 5293 } 5294 5295 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) GetRawPaths() []gotenobject.FieldPath { 5296 if fieldMask == nil { 5297 return nil 5298 } 5299 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 5300 for _, path := range fieldMask.Paths { 5301 rawPaths = append(rawPaths, path) 5302 } 5303 return rawPaths 5304 } 5305 5306 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) SetFromCliFlag(raw string) error { 5307 path, err := ParsePolicySpecSupportingAlertQueryRestListQuery_FieldPath(raw) 5308 if err != nil { 5309 return err 5310 } 5311 fieldMask.Paths = append(fieldMask.Paths, path) 5312 return nil 5313 } 5314 5315 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) Set(target, source *PolicySpec_SupportingAlertQuery_RestListQuery) { 5316 for _, path := range fieldMask.Paths { 5317 val, _ := path.GetSingle(source) 5318 // if val is nil, then field does not exist in source, skip 5319 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 5320 if val != nil { 5321 path.WithIValue(val).SetTo(&target) 5322 } 5323 } 5324 } 5325 5326 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 5327 fieldMask.Set(target.(*PolicySpec_SupportingAlertQuery_RestListQuery), source.(*PolicySpec_SupportingAlertQuery_RestListQuery)) 5328 } 5329 5330 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) Project(source *PolicySpec_SupportingAlertQuery_RestListQuery) *PolicySpec_SupportingAlertQuery_RestListQuery { 5331 if source == nil { 5332 return nil 5333 } 5334 if fieldMask == nil { 5335 return source 5336 } 5337 result := &PolicySpec_SupportingAlertQuery_RestListQuery{} 5338 5339 for _, p := range fieldMask.Paths { 5340 switch tp := p.(type) { 5341 case *PolicySpecSupportingAlertQueryRestListQuery_FieldTerminalPath: 5342 switch tp.selector { 5343 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorDescription: 5344 result.Description = source.Description 5345 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorEndpoint: 5346 result.Endpoint = source.Endpoint 5347 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorPathTemplate: 5348 result.PathTemplate = source.PathTemplate 5349 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorView: 5350 result.View = source.View 5351 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFieldMask: 5352 result.FieldMask = source.FieldMask 5353 case PolicySpecSupportingAlertQueryRestListQuery_FieldPathSelectorFilterTemplate: 5354 result.FilterTemplate = source.FilterTemplate 5355 } 5356 } 5357 } 5358 return result 5359 } 5360 5361 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 5362 return fieldMask.Project(source.(*PolicySpec_SupportingAlertQuery_RestListQuery)) 5363 } 5364 5365 func (fieldMask *PolicySpec_SupportingAlertQuery_RestListQuery_FieldMask) PathsCount() int { 5366 if fieldMask == nil { 5367 return 0 5368 } 5369 return len(fieldMask.Paths) 5370 } 5371 5372 type PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask struct { 5373 Paths []PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath 5374 } 5375 5376 func FullPolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask() *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask { 5377 res := &PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask{} 5378 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh}) 5379 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh}) 5380 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh}) 5381 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins}) 5382 return res 5383 } 5384 5385 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) String() string { 5386 if fieldMask == nil { 5387 return "<nil>" 5388 } 5389 pathsStr := make([]string, 0, len(fieldMask.Paths)) 5390 for _, path := range fieldMask.Paths { 5391 pathsStr = append(pathsStr, path.String()) 5392 } 5393 return strings.Join(pathsStr, ", ") 5394 } 5395 5396 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) IsFull() bool { 5397 if fieldMask == nil { 5398 return false 5399 } 5400 presentSelectors := make([]bool, 4) 5401 for _, path := range fieldMask.Paths { 5402 if asFinal, ok := path.(*PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath); ok { 5403 presentSelectors[int(asFinal.selector)] = true 5404 } 5405 } 5406 for _, flag := range presentSelectors { 5407 if !flag { 5408 return false 5409 } 5410 } 5411 return true 5412 } 5413 5414 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) ProtoReflect() preflect.Message { 5415 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 5416 return ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(raw) 5417 }) 5418 } 5419 5420 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) ProtoMessage() {} 5421 5422 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) Reset() { 5423 if fieldMask != nil { 5424 fieldMask.Paths = nil 5425 } 5426 } 5427 5428 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask { 5429 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask{} 5430 removedSelectors := make([]bool, 4) 5431 otherSubMasks := map[PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector]gotenobject.FieldMask{ 5432 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask{}, 5433 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask{}, 5434 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask{}, 5435 } 5436 mySubMasks := map[PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelector]gotenobject.FieldMask{ 5437 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask{}, 5438 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask{}, 5439 PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask{}, 5440 } 5441 5442 for _, path := range other.GetPaths() { 5443 switch tp := path.(type) { 5444 case *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: 5445 removedSelectors[int(tp.selector)] = true 5446 case *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath: 5447 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 5448 } 5449 } 5450 for _, path := range fieldMask.GetPaths() { 5451 if !removedSelectors[int(path.Selector())] { 5452 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 5453 if tp, ok := path.(*PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath); ok { 5454 switch tp.selector { 5455 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 5456 mySubMasks[PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh] = FullPolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask() 5457 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 5458 mySubMasks[PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh] = FullPolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask() 5459 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 5460 mySubMasks[PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh] = FullPolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask() 5461 } 5462 } else if tp, ok := path.(*PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath); ok { 5463 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 5464 } 5465 } else { 5466 result.Paths = append(result.Paths, path) 5467 } 5468 } 5469 } 5470 for selector, mySubMask := range mySubMasks { 5471 if mySubMask.PathsCount() > 0 { 5472 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 5473 result.Paths = append(result.Paths, &PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath{selector: selector, subPath: allowedPath}) 5474 } 5475 } 5476 } 5477 5478 if len(result.Paths) == 0 { 5479 return nil 5480 } 5481 return result 5482 } 5483 5484 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 5485 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask)) 5486 } 5487 5488 // FilterInputFields generates copy of field paths with output_only field paths removed 5489 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask { 5490 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask{} 5491 result.Paths = append(result.Paths, fieldMask.Paths...) 5492 return result 5493 } 5494 5495 // ToFieldMask is used for proto conversions 5496 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 5497 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5498 for _, path := range fieldMask.Paths { 5499 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 5500 } 5501 return protoFieldMask 5502 } 5503 5504 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 5505 if fieldMask == nil { 5506 return status.Error(codes.Internal, "target field mask is nil") 5507 } 5508 fieldMask.Paths = make([]PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath, 0, len(protoFieldMask.Paths)) 5509 for _, strPath := range protoFieldMask.Paths { 5510 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(strPath) 5511 if err != nil { 5512 return err 5513 } 5514 fieldMask.Paths = append(fieldMask.Paths, path) 5515 } 5516 return nil 5517 } 5518 5519 // implement methods required by customType 5520 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) Marshal() ([]byte, error) { 5521 protoFieldMask := fieldMask.ToProtoFieldMask() 5522 return proto.Marshal(protoFieldMask) 5523 } 5524 5525 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) Unmarshal(data []byte) error { 5526 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5527 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 5528 return err 5529 } 5530 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5531 return err 5532 } 5533 return nil 5534 } 5535 5536 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) Size() int { 5537 return proto.Size(fieldMask.ToProtoFieldMask()) 5538 } 5539 5540 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) MarshalJSON() ([]byte, error) { 5541 return json.Marshal(fieldMask.ToProtoFieldMask()) 5542 } 5543 5544 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) UnmarshalJSON(data []byte) error { 5545 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5546 if err := json.Unmarshal(data, protoFieldMask); err != nil { 5547 return err 5548 } 5549 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5550 return err 5551 } 5552 return nil 5553 } 5554 5555 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) AppendPath(path PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath) { 5556 fieldMask.Paths = append(fieldMask.Paths, path) 5557 } 5558 5559 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 5560 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath)) 5561 } 5562 5563 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) GetPaths() []PolicySpecAIAgentHandlingEdgeConnectivity_FieldPath { 5564 if fieldMask == nil { 5565 return nil 5566 } 5567 return fieldMask.Paths 5568 } 5569 5570 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) GetRawPaths() []gotenobject.FieldPath { 5571 if fieldMask == nil { 5572 return nil 5573 } 5574 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 5575 for _, path := range fieldMask.Paths { 5576 rawPaths = append(rawPaths, path) 5577 } 5578 return rawPaths 5579 } 5580 5581 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) SetFromCliFlag(raw string) error { 5582 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivity_FieldPath(raw) 5583 if err != nil { 5584 return err 5585 } 5586 fieldMask.Paths = append(fieldMask.Paths, path) 5587 return nil 5588 } 5589 5590 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) Set(target, source *PolicySpec_AIAgentHandling_EdgeConnectivity) { 5591 for _, path := range fieldMask.Paths { 5592 val, _ := path.GetSingle(source) 5593 // if val is nil, then field does not exist in source, skip 5594 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 5595 if val != nil { 5596 path.WithIValue(val).SetTo(&target) 5597 } 5598 } 5599 } 5600 5601 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 5602 fieldMask.Set(target.(*PolicySpec_AIAgentHandling_EdgeConnectivity), source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 5603 } 5604 5605 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) Project(source *PolicySpec_AIAgentHandling_EdgeConnectivity) *PolicySpec_AIAgentHandling_EdgeConnectivity { 5606 if source == nil { 5607 return nil 5608 } 5609 if fieldMask == nil { 5610 return source 5611 } 5612 result := &PolicySpec_AIAgentHandling_EdgeConnectivity{} 5613 deviceSshMask := &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask{} 5614 wholeDeviceSshAccepted := false 5615 proxiesSshMask := &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask{} 5616 wholeProxiesSshAccepted := false 5617 podSshMask := &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask{} 5618 wholePodSshAccepted := false 5619 5620 for _, p := range fieldMask.Paths { 5621 switch tp := p.(type) { 5622 case *PolicySpecAIAgentHandlingEdgeConnectivity_FieldTerminalPath: 5623 switch tp.selector { 5624 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 5625 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh); ok { 5626 result.Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh{ 5627 DeviceSsh: source.DeviceSsh, 5628 } 5629 } 5630 wholeDeviceSshAccepted = true 5631 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 5632 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh); ok { 5633 result.Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh{ 5634 ProxiesSsh: source.ProxiesSsh, 5635 } 5636 } 5637 wholeProxiesSshAccepted = true 5638 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 5639 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh); ok { 5640 result.Type = &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh{ 5641 PodSsh: source.PodSsh, 5642 } 5643 } 5644 wholePodSshAccepted = true 5645 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorAllowedBins: 5646 result.AllowedBins = source.AllowedBins 5647 } 5648 case *PolicySpecAIAgentHandlingEdgeConnectivity_FieldSubPath: 5649 switch tp.selector { 5650 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorDeviceSsh: 5651 deviceSshMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath)) 5652 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorProxiesSsh: 5653 proxiesSshMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath)) 5654 case PolicySpecAIAgentHandlingEdgeConnectivity_FieldPathSelectorPodSsh: 5655 podSshMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath)) 5656 } 5657 } 5658 } 5659 if wholeDeviceSshAccepted == false && len(deviceSshMask.Paths) > 0 { 5660 if asOneOf, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh); ok { 5661 result.Type = (*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh)(nil) 5662 if asOneOf != nil { 5663 oneOfRes := &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSsh{} 5664 oneOfRes.DeviceSsh = deviceSshMask.Project(asOneOf.DeviceSsh) 5665 result.Type = oneOfRes 5666 } 5667 } 5668 } 5669 if wholeProxiesSshAccepted == false && len(proxiesSshMask.Paths) > 0 { 5670 if asOneOf, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh); ok { 5671 result.Type = (*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh)(nil) 5672 if asOneOf != nil { 5673 oneOfRes := &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSsh{} 5674 oneOfRes.ProxiesSsh = proxiesSshMask.Project(asOneOf.ProxiesSsh) 5675 result.Type = oneOfRes 5676 } 5677 } 5678 } 5679 if wholePodSshAccepted == false && len(podSshMask.Paths) > 0 { 5680 if asOneOf, ok := source.Type.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh); ok { 5681 result.Type = (*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh)(nil) 5682 if asOneOf != nil { 5683 oneOfRes := &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSsh{} 5684 oneOfRes.PodSsh = podSshMask.Project(asOneOf.PodSsh) 5685 result.Type = oneOfRes 5686 } 5687 } 5688 } 5689 return result 5690 } 5691 5692 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 5693 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity)) 5694 } 5695 5696 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_FieldMask) PathsCount() int { 5697 if fieldMask == nil { 5698 return 0 5699 } 5700 return len(fieldMask.Paths) 5701 } 5702 5703 type PolicySpec_AIAgentHandling_Remediation_FieldMask struct { 5704 Paths []PolicySpecAIAgentHandlingRemediation_FieldPath 5705 } 5706 5707 func FullPolicySpec_AIAgentHandling_Remediation_FieldMask() *PolicySpec_AIAgentHandling_Remediation_FieldMask { 5708 res := &PolicySpec_AIAgentHandling_Remediation_FieldMask{} 5709 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingRemediation_FieldTerminalPath{selector: PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh}) 5710 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingRemediation_FieldTerminalPath{selector: PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot}) 5711 return res 5712 } 5713 5714 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) String() string { 5715 if fieldMask == nil { 5716 return "<nil>" 5717 } 5718 pathsStr := make([]string, 0, len(fieldMask.Paths)) 5719 for _, path := range fieldMask.Paths { 5720 pathsStr = append(pathsStr, path.String()) 5721 } 5722 return strings.Join(pathsStr, ", ") 5723 } 5724 5725 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) IsFull() bool { 5726 if fieldMask == nil { 5727 return false 5728 } 5729 presentSelectors := make([]bool, 2) 5730 for _, path := range fieldMask.Paths { 5731 if asFinal, ok := path.(*PolicySpecAIAgentHandlingRemediation_FieldTerminalPath); ok { 5732 presentSelectors[int(asFinal.selector)] = true 5733 } 5734 } 5735 for _, flag := range presentSelectors { 5736 if !flag { 5737 return false 5738 } 5739 } 5740 return true 5741 } 5742 5743 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) ProtoReflect() preflect.Message { 5744 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 5745 return ParsePolicySpecAIAgentHandlingRemediation_FieldPath(raw) 5746 }) 5747 } 5748 5749 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) ProtoMessage() {} 5750 5751 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) Reset() { 5752 if fieldMask != nil { 5753 fieldMask.Paths = nil 5754 } 5755 } 5756 5757 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_Remediation_FieldMask) *PolicySpec_AIAgentHandling_Remediation_FieldMask { 5758 result := &PolicySpec_AIAgentHandling_Remediation_FieldMask{} 5759 removedSelectors := make([]bool, 2) 5760 otherSubMasks := map[PolicySpecAIAgentHandlingRemediation_FieldPathSelector]gotenobject.FieldMask{ 5761 PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: &PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask{}, 5762 PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: &PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask{}, 5763 } 5764 mySubMasks := map[PolicySpecAIAgentHandlingRemediation_FieldPathSelector]gotenobject.FieldMask{ 5765 PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: &PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask{}, 5766 PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: &PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask{}, 5767 } 5768 5769 for _, path := range other.GetPaths() { 5770 switch tp := path.(type) { 5771 case *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath: 5772 removedSelectors[int(tp.selector)] = true 5773 case *PolicySpecAIAgentHandlingRemediation_FieldSubPath: 5774 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 5775 } 5776 } 5777 for _, path := range fieldMask.GetPaths() { 5778 if !removedSelectors[int(path.Selector())] { 5779 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 5780 if tp, ok := path.(*PolicySpecAIAgentHandlingRemediation_FieldTerminalPath); ok { 5781 switch tp.selector { 5782 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 5783 mySubMasks[PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh] = FullPolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask() 5784 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 5785 mySubMasks[PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot] = FullPolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask() 5786 } 5787 } else if tp, ok := path.(*PolicySpecAIAgentHandlingRemediation_FieldSubPath); ok { 5788 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 5789 } 5790 } else { 5791 result.Paths = append(result.Paths, path) 5792 } 5793 } 5794 } 5795 for selector, mySubMask := range mySubMasks { 5796 if mySubMask.PathsCount() > 0 { 5797 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 5798 result.Paths = append(result.Paths, &PolicySpecAIAgentHandlingRemediation_FieldSubPath{selector: selector, subPath: allowedPath}) 5799 } 5800 } 5801 } 5802 5803 if len(result.Paths) == 0 { 5804 return nil 5805 } 5806 return result 5807 } 5808 5809 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 5810 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_Remediation_FieldMask)) 5811 } 5812 5813 // FilterInputFields generates copy of field paths with output_only field paths removed 5814 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_Remediation_FieldMask { 5815 result := &PolicySpec_AIAgentHandling_Remediation_FieldMask{} 5816 result.Paths = append(result.Paths, fieldMask.Paths...) 5817 return result 5818 } 5819 5820 // ToFieldMask is used for proto conversions 5821 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 5822 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5823 for _, path := range fieldMask.Paths { 5824 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 5825 } 5826 return protoFieldMask 5827 } 5828 5829 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 5830 if fieldMask == nil { 5831 return status.Error(codes.Internal, "target field mask is nil") 5832 } 5833 fieldMask.Paths = make([]PolicySpecAIAgentHandlingRemediation_FieldPath, 0, len(protoFieldMask.Paths)) 5834 for _, strPath := range protoFieldMask.Paths { 5835 path, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPath(strPath) 5836 if err != nil { 5837 return err 5838 } 5839 fieldMask.Paths = append(fieldMask.Paths, path) 5840 } 5841 return nil 5842 } 5843 5844 // implement methods required by customType 5845 func (fieldMask PolicySpec_AIAgentHandling_Remediation_FieldMask) Marshal() ([]byte, error) { 5846 protoFieldMask := fieldMask.ToProtoFieldMask() 5847 return proto.Marshal(protoFieldMask) 5848 } 5849 5850 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) Unmarshal(data []byte) error { 5851 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5852 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 5853 return err 5854 } 5855 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5856 return err 5857 } 5858 return nil 5859 } 5860 5861 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) Size() int { 5862 return proto.Size(fieldMask.ToProtoFieldMask()) 5863 } 5864 5865 func (fieldMask PolicySpec_AIAgentHandling_Remediation_FieldMask) MarshalJSON() ([]byte, error) { 5866 return json.Marshal(fieldMask.ToProtoFieldMask()) 5867 } 5868 5869 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) UnmarshalJSON(data []byte) error { 5870 protoFieldMask := &googlefieldmaskpb.FieldMask{} 5871 if err := json.Unmarshal(data, protoFieldMask); err != nil { 5872 return err 5873 } 5874 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 5875 return err 5876 } 5877 return nil 5878 } 5879 5880 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) AppendPath(path PolicySpecAIAgentHandlingRemediation_FieldPath) { 5881 fieldMask.Paths = append(fieldMask.Paths, path) 5882 } 5883 5884 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 5885 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandlingRemediation_FieldPath)) 5886 } 5887 5888 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) GetPaths() []PolicySpecAIAgentHandlingRemediation_FieldPath { 5889 if fieldMask == nil { 5890 return nil 5891 } 5892 return fieldMask.Paths 5893 } 5894 5895 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) GetRawPaths() []gotenobject.FieldPath { 5896 if fieldMask == nil { 5897 return nil 5898 } 5899 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 5900 for _, path := range fieldMask.Paths { 5901 rawPaths = append(rawPaths, path) 5902 } 5903 return rawPaths 5904 } 5905 5906 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) SetFromCliFlag(raw string) error { 5907 path, err := ParsePolicySpecAIAgentHandlingRemediation_FieldPath(raw) 5908 if err != nil { 5909 return err 5910 } 5911 fieldMask.Paths = append(fieldMask.Paths, path) 5912 return nil 5913 } 5914 5915 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) Set(target, source *PolicySpec_AIAgentHandling_Remediation) { 5916 for _, path := range fieldMask.Paths { 5917 val, _ := path.GetSingle(source) 5918 // if val is nil, then field does not exist in source, skip 5919 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 5920 if val != nil { 5921 path.WithIValue(val).SetTo(&target) 5922 } 5923 } 5924 } 5925 5926 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 5927 fieldMask.Set(target.(*PolicySpec_AIAgentHandling_Remediation), source.(*PolicySpec_AIAgentHandling_Remediation)) 5928 } 5929 5930 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) Project(source *PolicySpec_AIAgentHandling_Remediation) *PolicySpec_AIAgentHandling_Remediation { 5931 if source == nil { 5932 return nil 5933 } 5934 if fieldMask == nil { 5935 return source 5936 } 5937 result := &PolicySpec_AIAgentHandling_Remediation{} 5938 fixInSshMask := &PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask{} 5939 wholeFixInSshAccepted := false 5940 rebootMask := &PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask{} 5941 wholeRebootAccepted := false 5942 5943 for _, p := range fieldMask.Paths { 5944 switch tp := p.(type) { 5945 case *PolicySpecAIAgentHandlingRemediation_FieldTerminalPath: 5946 switch tp.selector { 5947 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 5948 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh); ok { 5949 result.Type = &PolicySpec_AIAgentHandling_Remediation_FixInSsh{ 5950 FixInSsh: source.FixInSsh, 5951 } 5952 } 5953 wholeFixInSshAccepted = true 5954 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 5955 if source, ok := source.Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_); ok { 5956 result.Type = &PolicySpec_AIAgentHandling_Remediation_Reboot_{ 5957 Reboot: source.Reboot, 5958 } 5959 } 5960 wholeRebootAccepted = true 5961 } 5962 case *PolicySpecAIAgentHandlingRemediation_FieldSubPath: 5963 switch tp.selector { 5964 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorFixInSsh: 5965 fixInSshMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath)) 5966 case PolicySpecAIAgentHandlingRemediation_FieldPathSelectorReboot: 5967 rebootMask.AppendPath(tp.subPath.(PolicySpecAIAgentHandlingRemediationReboot_FieldPath)) 5968 } 5969 } 5970 } 5971 if wholeFixInSshAccepted == false && len(fixInSshMask.Paths) > 0 { 5972 if asOneOf, ok := source.Type.(*PolicySpec_AIAgentHandling_Remediation_FixInSsh); ok { 5973 result.Type = (*PolicySpec_AIAgentHandling_Remediation_FixInSsh)(nil) 5974 if asOneOf != nil { 5975 oneOfRes := &PolicySpec_AIAgentHandling_Remediation_FixInSsh{} 5976 oneOfRes.FixInSsh = fixInSshMask.Project(asOneOf.FixInSsh) 5977 result.Type = oneOfRes 5978 } 5979 } 5980 } 5981 if wholeRebootAccepted == false && len(rebootMask.Paths) > 0 { 5982 if asOneOf, ok := source.Type.(*PolicySpec_AIAgentHandling_Remediation_Reboot_); ok { 5983 result.Type = (*PolicySpec_AIAgentHandling_Remediation_Reboot_)(nil) 5984 if asOneOf != nil { 5985 oneOfRes := &PolicySpec_AIAgentHandling_Remediation_Reboot_{} 5986 oneOfRes.Reboot = rebootMask.Project(asOneOf.Reboot) 5987 result.Type = oneOfRes 5988 } 5989 } 5990 } 5991 return result 5992 } 5993 5994 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 5995 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling_Remediation)) 5996 } 5997 5998 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FieldMask) PathsCount() int { 5999 if fieldMask == nil { 6000 return 0 6001 } 6002 return len(fieldMask.Paths) 6003 } 6004 6005 type PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask struct { 6006 Paths []PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath 6007 } 6008 6009 func FullPolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask() *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask { 6010 res := &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask{} 6011 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName}) 6012 return res 6013 } 6014 6015 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) String() string { 6016 if fieldMask == nil { 6017 return "<nil>" 6018 } 6019 pathsStr := make([]string, 0, len(fieldMask.Paths)) 6020 for _, path := range fieldMask.Paths { 6021 pathsStr = append(pathsStr, path.String()) 6022 } 6023 return strings.Join(pathsStr, ", ") 6024 } 6025 6026 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) IsFull() bool { 6027 if fieldMask == nil { 6028 return false 6029 } 6030 presentSelectors := make([]bool, 1) 6031 for _, path := range fieldMask.Paths { 6032 if asFinal, ok := path.(*PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath); ok { 6033 presentSelectors[int(asFinal.selector)] = true 6034 } 6035 } 6036 for _, flag := range presentSelectors { 6037 if !flag { 6038 return false 6039 } 6040 } 6041 return true 6042 } 6043 6044 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) ProtoReflect() preflect.Message { 6045 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 6046 return ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(raw) 6047 }) 6048 } 6049 6050 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) ProtoMessage() {} 6051 6052 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) Reset() { 6053 if fieldMask != nil { 6054 fieldMask.Paths = nil 6055 } 6056 } 6057 6058 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask { 6059 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask{} 6060 removedSelectors := make([]bool, 1) 6061 6062 for _, path := range other.GetPaths() { 6063 switch tp := path.(type) { 6064 case *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath: 6065 removedSelectors[int(tp.selector)] = true 6066 } 6067 } 6068 for _, path := range fieldMask.GetPaths() { 6069 if !removedSelectors[int(path.Selector())] { 6070 result.Paths = append(result.Paths, path) 6071 } 6072 } 6073 6074 if len(result.Paths) == 0 { 6075 return nil 6076 } 6077 return result 6078 } 6079 6080 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 6081 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask)) 6082 } 6083 6084 // FilterInputFields generates copy of field paths with output_only field paths removed 6085 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask { 6086 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask{} 6087 result.Paths = append(result.Paths, fieldMask.Paths...) 6088 return result 6089 } 6090 6091 // ToFieldMask is used for proto conversions 6092 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 6093 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6094 for _, path := range fieldMask.Paths { 6095 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 6096 } 6097 return protoFieldMask 6098 } 6099 6100 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 6101 if fieldMask == nil { 6102 return status.Error(codes.Internal, "target field mask is nil") 6103 } 6104 fieldMask.Paths = make([]PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath, 0, len(protoFieldMask.Paths)) 6105 for _, strPath := range protoFieldMask.Paths { 6106 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(strPath) 6107 if err != nil { 6108 return err 6109 } 6110 fieldMask.Paths = append(fieldMask.Paths, path) 6111 } 6112 return nil 6113 } 6114 6115 // implement methods required by customType 6116 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) Marshal() ([]byte, error) { 6117 protoFieldMask := fieldMask.ToProtoFieldMask() 6118 return proto.Marshal(protoFieldMask) 6119 } 6120 6121 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) Unmarshal(data []byte) error { 6122 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6123 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 6124 return err 6125 } 6126 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6127 return err 6128 } 6129 return nil 6130 } 6131 6132 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) Size() int { 6133 return proto.Size(fieldMask.ToProtoFieldMask()) 6134 } 6135 6136 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) MarshalJSON() ([]byte, error) { 6137 return json.Marshal(fieldMask.ToProtoFieldMask()) 6138 } 6139 6140 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) UnmarshalJSON(data []byte) error { 6141 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6142 if err := json.Unmarshal(data, protoFieldMask); err != nil { 6143 return err 6144 } 6145 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6146 return err 6147 } 6148 return nil 6149 } 6150 6151 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) AppendPath(path PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath) { 6152 fieldMask.Paths = append(fieldMask.Paths, path) 6153 } 6154 6155 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 6156 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath)) 6157 } 6158 6159 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) GetPaths() []PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath { 6160 if fieldMask == nil { 6161 return nil 6162 } 6163 return fieldMask.Paths 6164 } 6165 6166 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) GetRawPaths() []gotenobject.FieldPath { 6167 if fieldMask == nil { 6168 return nil 6169 } 6170 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 6171 for _, path := range fieldMask.Paths { 6172 rawPaths = append(rawPaths, path) 6173 } 6174 return rawPaths 6175 } 6176 6177 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) SetFromCliFlag(raw string) error { 6178 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPath(raw) 6179 if err != nil { 6180 return err 6181 } 6182 fieldMask.Paths = append(fieldMask.Paths, path) 6183 return nil 6184 } 6185 6186 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) Set(target, source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) { 6187 for _, path := range fieldMask.Paths { 6188 val, _ := path.GetSingle(source) 6189 // if val is nil, then field does not exist in source, skip 6190 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 6191 if val != nil { 6192 path.WithIValue(val).SetTo(&target) 6193 } 6194 } 6195 } 6196 6197 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 6198 fieldMask.Set(target.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH), source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)) 6199 } 6200 6201 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) Project(source *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH) *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH { 6202 if source == nil { 6203 return nil 6204 } 6205 if fieldMask == nil { 6206 return source 6207 } 6208 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH{} 6209 6210 for _, p := range fieldMask.Paths { 6211 switch tp := p.(type) { 6212 case *PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldTerminalPath: 6213 switch tp.selector { 6214 case PolicySpecAIAgentHandlingEdgeConnectivityDeviceSSH_FieldPathSelectorClientName: 6215 result.ClientName = source.ClientName 6216 } 6217 } 6218 } 6219 return result 6220 } 6221 6222 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 6223 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH)) 6224 } 6225 6226 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_DeviceSSH_FieldMask) PathsCount() int { 6227 if fieldMask == nil { 6228 return 0 6229 } 6230 return len(fieldMask.Paths) 6231 } 6232 6233 type PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask struct { 6234 Paths []PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath 6235 } 6236 6237 func FullPolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask() *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask { 6238 res := &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask{} 6239 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain}) 6240 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl}) 6241 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName}) 6242 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName}) 6243 return res 6244 } 6245 6246 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) String() string { 6247 if fieldMask == nil { 6248 return "<nil>" 6249 } 6250 pathsStr := make([]string, 0, len(fieldMask.Paths)) 6251 for _, path := range fieldMask.Paths { 6252 pathsStr = append(pathsStr, path.String()) 6253 } 6254 return strings.Join(pathsStr, ", ") 6255 } 6256 6257 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) IsFull() bool { 6258 if fieldMask == nil { 6259 return false 6260 } 6261 presentSelectors := make([]bool, 4) 6262 for _, path := range fieldMask.Paths { 6263 if asFinal, ok := path.(*PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath); ok { 6264 presentSelectors[int(asFinal.selector)] = true 6265 } 6266 } 6267 for _, flag := range presentSelectors { 6268 if !flag { 6269 return false 6270 } 6271 } 6272 return true 6273 } 6274 6275 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) ProtoReflect() preflect.Message { 6276 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 6277 return ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(raw) 6278 }) 6279 } 6280 6281 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) ProtoMessage() {} 6282 6283 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) Reset() { 6284 if fieldMask != nil { 6285 fieldMask.Paths = nil 6286 } 6287 } 6288 6289 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask { 6290 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask{} 6291 removedSelectors := make([]bool, 4) 6292 6293 for _, path := range other.GetPaths() { 6294 switch tp := path.(type) { 6295 case *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: 6296 removedSelectors[int(tp.selector)] = true 6297 } 6298 } 6299 for _, path := range fieldMask.GetPaths() { 6300 if !removedSelectors[int(path.Selector())] { 6301 result.Paths = append(result.Paths, path) 6302 } 6303 } 6304 6305 if len(result.Paths) == 0 { 6306 return nil 6307 } 6308 return result 6309 } 6310 6311 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 6312 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask)) 6313 } 6314 6315 // FilterInputFields generates copy of field paths with output_only field paths removed 6316 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask { 6317 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask{} 6318 result.Paths = append(result.Paths, fieldMask.Paths...) 6319 return result 6320 } 6321 6322 // ToFieldMask is used for proto conversions 6323 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 6324 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6325 for _, path := range fieldMask.Paths { 6326 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 6327 } 6328 return protoFieldMask 6329 } 6330 6331 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 6332 if fieldMask == nil { 6333 return status.Error(codes.Internal, "target field mask is nil") 6334 } 6335 fieldMask.Paths = make([]PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath, 0, len(protoFieldMask.Paths)) 6336 for _, strPath := range protoFieldMask.Paths { 6337 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(strPath) 6338 if err != nil { 6339 return err 6340 } 6341 fieldMask.Paths = append(fieldMask.Paths, path) 6342 } 6343 return nil 6344 } 6345 6346 // implement methods required by customType 6347 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) Marshal() ([]byte, error) { 6348 protoFieldMask := fieldMask.ToProtoFieldMask() 6349 return proto.Marshal(protoFieldMask) 6350 } 6351 6352 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) Unmarshal(data []byte) error { 6353 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6354 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 6355 return err 6356 } 6357 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6358 return err 6359 } 6360 return nil 6361 } 6362 6363 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) Size() int { 6364 return proto.Size(fieldMask.ToProtoFieldMask()) 6365 } 6366 6367 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) MarshalJSON() ([]byte, error) { 6368 return json.Marshal(fieldMask.ToProtoFieldMask()) 6369 } 6370 6371 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) UnmarshalJSON(data []byte) error { 6372 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6373 if err := json.Unmarshal(data, protoFieldMask); err != nil { 6374 return err 6375 } 6376 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6377 return err 6378 } 6379 return nil 6380 } 6381 6382 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) AppendPath(path PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath) { 6383 fieldMask.Paths = append(fieldMask.Paths, path) 6384 } 6385 6386 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 6387 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath)) 6388 } 6389 6390 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) GetPaths() []PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath { 6391 if fieldMask == nil { 6392 return nil 6393 } 6394 return fieldMask.Paths 6395 } 6396 6397 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) GetRawPaths() []gotenobject.FieldPath { 6398 if fieldMask == nil { 6399 return nil 6400 } 6401 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 6402 for _, path := range fieldMask.Paths { 6403 rawPaths = append(rawPaths, path) 6404 } 6405 return rawPaths 6406 } 6407 6408 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) SetFromCliFlag(raw string) error { 6409 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPath(raw) 6410 if err != nil { 6411 return err 6412 } 6413 fieldMask.Paths = append(fieldMask.Paths, path) 6414 return nil 6415 } 6416 6417 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) Set(target, source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) { 6418 for _, path := range fieldMask.Paths { 6419 val, _ := path.GetSingle(source) 6420 // if val is nil, then field does not exist in source, skip 6421 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 6422 if val != nil { 6423 path.WithIValue(val).SetTo(&target) 6424 } 6425 } 6426 } 6427 6428 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 6429 fieldMask.Set(target.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH), source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)) 6430 } 6431 6432 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) Project(source *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH) *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH { 6433 if source == nil { 6434 return nil 6435 } 6436 if fieldMask == nil { 6437 return source 6438 } 6439 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH{} 6440 6441 for _, p := range fieldMask.Paths { 6442 switch tp := p.(type) { 6443 case *PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldTerminalPath: 6444 switch tp.selector { 6445 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceDomain: 6446 result.ServiceDomain = source.ServiceDomain 6447 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorProviderNameTmpl: 6448 result.ProviderNameTmpl = source.ProviderNameTmpl 6449 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorClientName: 6450 result.ClientName = source.ClientName 6451 case PolicySpecAIAgentHandlingEdgeConnectivityProxiesSSH_FieldPathSelectorServiceName: 6452 result.ServiceName = source.ServiceName 6453 } 6454 } 6455 } 6456 return result 6457 } 6458 6459 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 6460 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH)) 6461 } 6462 6463 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_ProxiesSSH_FieldMask) PathsCount() int { 6464 if fieldMask == nil { 6465 return 0 6466 } 6467 return len(fieldMask.Paths) 6468 } 6469 6470 type PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask struct { 6471 Paths []PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath 6472 } 6473 6474 func FullPolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask() *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask { 6475 res := &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask{} 6476 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName}) 6477 res.Paths = append(res.Paths, &PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath{selector: PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername}) 6478 return res 6479 } 6480 6481 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) String() string { 6482 if fieldMask == nil { 6483 return "<nil>" 6484 } 6485 pathsStr := make([]string, 0, len(fieldMask.Paths)) 6486 for _, path := range fieldMask.Paths { 6487 pathsStr = append(pathsStr, path.String()) 6488 } 6489 return strings.Join(pathsStr, ", ") 6490 } 6491 6492 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) IsFull() bool { 6493 if fieldMask == nil { 6494 return false 6495 } 6496 presentSelectors := make([]bool, 2) 6497 for _, path := range fieldMask.Paths { 6498 if asFinal, ok := path.(*PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath); ok { 6499 presentSelectors[int(asFinal.selector)] = true 6500 } 6501 } 6502 for _, flag := range presentSelectors { 6503 if !flag { 6504 return false 6505 } 6506 } 6507 return true 6508 } 6509 6510 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) ProtoReflect() preflect.Message { 6511 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 6512 return ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(raw) 6513 }) 6514 } 6515 6516 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) ProtoMessage() {} 6517 6518 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) Reset() { 6519 if fieldMask != nil { 6520 fieldMask.Paths = nil 6521 } 6522 } 6523 6524 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask { 6525 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask{} 6526 removedSelectors := make([]bool, 2) 6527 6528 for _, path := range other.GetPaths() { 6529 switch tp := path.(type) { 6530 case *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath: 6531 removedSelectors[int(tp.selector)] = true 6532 } 6533 } 6534 for _, path := range fieldMask.GetPaths() { 6535 if !removedSelectors[int(path.Selector())] { 6536 result.Paths = append(result.Paths, path) 6537 } 6538 } 6539 6540 if len(result.Paths) == 0 { 6541 return nil 6542 } 6543 return result 6544 } 6545 6546 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 6547 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask)) 6548 } 6549 6550 // FilterInputFields generates copy of field paths with output_only field paths removed 6551 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask { 6552 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask{} 6553 result.Paths = append(result.Paths, fieldMask.Paths...) 6554 return result 6555 } 6556 6557 // ToFieldMask is used for proto conversions 6558 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 6559 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6560 for _, path := range fieldMask.Paths { 6561 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 6562 } 6563 return protoFieldMask 6564 } 6565 6566 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 6567 if fieldMask == nil { 6568 return status.Error(codes.Internal, "target field mask is nil") 6569 } 6570 fieldMask.Paths = make([]PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath, 0, len(protoFieldMask.Paths)) 6571 for _, strPath := range protoFieldMask.Paths { 6572 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(strPath) 6573 if err != nil { 6574 return err 6575 } 6576 fieldMask.Paths = append(fieldMask.Paths, path) 6577 } 6578 return nil 6579 } 6580 6581 // implement methods required by customType 6582 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) Marshal() ([]byte, error) { 6583 protoFieldMask := fieldMask.ToProtoFieldMask() 6584 return proto.Marshal(protoFieldMask) 6585 } 6586 6587 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) Unmarshal(data []byte) error { 6588 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6589 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 6590 return err 6591 } 6592 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6593 return err 6594 } 6595 return nil 6596 } 6597 6598 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) Size() int { 6599 return proto.Size(fieldMask.ToProtoFieldMask()) 6600 } 6601 6602 func (fieldMask PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) MarshalJSON() ([]byte, error) { 6603 return json.Marshal(fieldMask.ToProtoFieldMask()) 6604 } 6605 6606 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) UnmarshalJSON(data []byte) error { 6607 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6608 if err := json.Unmarshal(data, protoFieldMask); err != nil { 6609 return err 6610 } 6611 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6612 return err 6613 } 6614 return nil 6615 } 6616 6617 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) AppendPath(path PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath) { 6618 fieldMask.Paths = append(fieldMask.Paths, path) 6619 } 6620 6621 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 6622 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath)) 6623 } 6624 6625 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) GetPaths() []PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath { 6626 if fieldMask == nil { 6627 return nil 6628 } 6629 return fieldMask.Paths 6630 } 6631 6632 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) GetRawPaths() []gotenobject.FieldPath { 6633 if fieldMask == nil { 6634 return nil 6635 } 6636 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 6637 for _, path := range fieldMask.Paths { 6638 rawPaths = append(rawPaths, path) 6639 } 6640 return rawPaths 6641 } 6642 6643 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) SetFromCliFlag(raw string) error { 6644 path, err := ParsePolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPath(raw) 6645 if err != nil { 6646 return err 6647 } 6648 fieldMask.Paths = append(fieldMask.Paths, path) 6649 return nil 6650 } 6651 6652 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) Set(target, source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) { 6653 for _, path := range fieldMask.Paths { 6654 val, _ := path.GetSingle(source) 6655 // if val is nil, then field does not exist in source, skip 6656 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 6657 if val != nil { 6658 path.WithIValue(val).SetTo(&target) 6659 } 6660 } 6661 } 6662 6663 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 6664 fieldMask.Set(target.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH), source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)) 6665 } 6666 6667 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) Project(source *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH) *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH { 6668 if source == nil { 6669 return nil 6670 } 6671 if fieldMask == nil { 6672 return source 6673 } 6674 result := &PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH{} 6675 6676 for _, p := range fieldMask.Paths { 6677 switch tp := p.(type) { 6678 case *PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldTerminalPath: 6679 switch tp.selector { 6680 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorClientName: 6681 result.ClientName = source.ClientName 6682 case PolicySpecAIAgentHandlingEdgeConnectivityPodSSH_FieldPathSelectorUsername: 6683 result.Username = source.Username 6684 } 6685 } 6686 } 6687 return result 6688 } 6689 6690 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 6691 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH)) 6692 } 6693 6694 func (fieldMask *PolicySpec_AIAgentHandling_EdgeConnectivity_PodSSH_FieldMask) PathsCount() int { 6695 if fieldMask == nil { 6696 return 0 6697 } 6698 return len(fieldMask.Paths) 6699 } 6700 6701 type PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask struct { 6702 Paths []PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath 6703 } 6704 6705 func FullPolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask() *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask { 6706 res := &PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask{} 6707 return res 6708 } 6709 6710 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) String() string { 6711 if fieldMask == nil { 6712 return "<nil>" 6713 } 6714 pathsStr := make([]string, 0, len(fieldMask.Paths)) 6715 for _, path := range fieldMask.Paths { 6716 pathsStr = append(pathsStr, path.String()) 6717 } 6718 return strings.Join(pathsStr, ", ") 6719 } 6720 6721 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) IsFull() bool { 6722 if fieldMask == nil { 6723 return false 6724 } 6725 presentSelectors := make([]bool, 0) 6726 for _, path := range fieldMask.Paths { 6727 if asFinal, ok := path.(*PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath); ok { 6728 presentSelectors[int(asFinal.selector)] = true 6729 } 6730 } 6731 for _, flag := range presentSelectors { 6732 if !flag { 6733 return false 6734 } 6735 } 6736 return true 6737 } 6738 6739 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) ProtoReflect() preflect.Message { 6740 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 6741 return ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(raw) 6742 }) 6743 } 6744 6745 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) ProtoMessage() {} 6746 6747 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) Reset() { 6748 if fieldMask != nil { 6749 fieldMask.Paths = nil 6750 } 6751 } 6752 6753 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask { 6754 result := &PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask{} 6755 removedSelectors := make([]bool, 0) 6756 6757 for _, path := range other.GetPaths() { 6758 switch tp := path.(type) { 6759 case *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath: 6760 removedSelectors[int(tp.selector)] = true 6761 } 6762 } 6763 for _, path := range fieldMask.GetPaths() { 6764 if !removedSelectors[int(path.Selector())] { 6765 result.Paths = append(result.Paths, path) 6766 } 6767 } 6768 6769 if len(result.Paths) == 0 { 6770 return nil 6771 } 6772 return result 6773 } 6774 6775 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 6776 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask)) 6777 } 6778 6779 // FilterInputFields generates copy of field paths with output_only field paths removed 6780 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask { 6781 result := &PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask{} 6782 result.Paths = append(result.Paths, fieldMask.Paths...) 6783 return result 6784 } 6785 6786 // ToFieldMask is used for proto conversions 6787 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 6788 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6789 for _, path := range fieldMask.Paths { 6790 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 6791 } 6792 return protoFieldMask 6793 } 6794 6795 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 6796 if fieldMask == nil { 6797 return status.Error(codes.Internal, "target field mask is nil") 6798 } 6799 fieldMask.Paths = make([]PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath, 0, len(protoFieldMask.Paths)) 6800 for _, strPath := range protoFieldMask.Paths { 6801 path, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(strPath) 6802 if err != nil { 6803 return err 6804 } 6805 fieldMask.Paths = append(fieldMask.Paths, path) 6806 } 6807 return nil 6808 } 6809 6810 // implement methods required by customType 6811 func (fieldMask PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) Marshal() ([]byte, error) { 6812 protoFieldMask := fieldMask.ToProtoFieldMask() 6813 return proto.Marshal(protoFieldMask) 6814 } 6815 6816 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) Unmarshal(data []byte) error { 6817 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6818 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 6819 return err 6820 } 6821 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6822 return err 6823 } 6824 return nil 6825 } 6826 6827 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) Size() int { 6828 return proto.Size(fieldMask.ToProtoFieldMask()) 6829 } 6830 6831 func (fieldMask PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) MarshalJSON() ([]byte, error) { 6832 return json.Marshal(fieldMask.ToProtoFieldMask()) 6833 } 6834 6835 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) UnmarshalJSON(data []byte) error { 6836 protoFieldMask := &googlefieldmaskpb.FieldMask{} 6837 if err := json.Unmarshal(data, protoFieldMask); err != nil { 6838 return err 6839 } 6840 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 6841 return err 6842 } 6843 return nil 6844 } 6845 6846 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) AppendPath(path PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath) { 6847 fieldMask.Paths = append(fieldMask.Paths, path) 6848 } 6849 6850 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 6851 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath)) 6852 } 6853 6854 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) GetPaths() []PolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath { 6855 if fieldMask == nil { 6856 return nil 6857 } 6858 return fieldMask.Paths 6859 } 6860 6861 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) GetRawPaths() []gotenobject.FieldPath { 6862 if fieldMask == nil { 6863 return nil 6864 } 6865 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 6866 for _, path := range fieldMask.Paths { 6867 rawPaths = append(rawPaths, path) 6868 } 6869 return rawPaths 6870 } 6871 6872 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) SetFromCliFlag(raw string) error { 6873 path, err := ParsePolicySpecAIAgentHandlingRemediationFixInSSH_FieldPath(raw) 6874 if err != nil { 6875 return err 6876 } 6877 fieldMask.Paths = append(fieldMask.Paths, path) 6878 return nil 6879 } 6880 6881 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) Set(target, source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) { 6882 for _, path := range fieldMask.Paths { 6883 val, _ := path.GetSingle(source) 6884 // if val is nil, then field does not exist in source, skip 6885 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 6886 if val != nil { 6887 path.WithIValue(val).SetTo(&target) 6888 } 6889 } 6890 } 6891 6892 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 6893 fieldMask.Set(target.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH), source.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)) 6894 } 6895 6896 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) Project(source *PolicySpec_AIAgentHandling_Remediation_FixInSSH) *PolicySpec_AIAgentHandling_Remediation_FixInSSH { 6897 if source == nil { 6898 return nil 6899 } 6900 if fieldMask == nil { 6901 return source 6902 } 6903 result := &PolicySpec_AIAgentHandling_Remediation_FixInSSH{} 6904 6905 for _, p := range fieldMask.Paths { 6906 switch tp := p.(type) { 6907 case *PolicySpecAIAgentHandlingRemediationFixInSSH_FieldTerminalPath: 6908 switch tp.selector { 6909 } 6910 } 6911 } 6912 return result 6913 } 6914 6915 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 6916 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling_Remediation_FixInSSH)) 6917 } 6918 6919 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_FixInSSH_FieldMask) PathsCount() int { 6920 if fieldMask == nil { 6921 return 0 6922 } 6923 return len(fieldMask.Paths) 6924 } 6925 6926 type PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask struct { 6927 Paths []PolicySpecAIAgentHandlingRemediationReboot_FieldPath 6928 } 6929 6930 func FullPolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask() *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask { 6931 res := &PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask{} 6932 return res 6933 } 6934 6935 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) String() string { 6936 if fieldMask == nil { 6937 return "<nil>" 6938 } 6939 pathsStr := make([]string, 0, len(fieldMask.Paths)) 6940 for _, path := range fieldMask.Paths { 6941 pathsStr = append(pathsStr, path.String()) 6942 } 6943 return strings.Join(pathsStr, ", ") 6944 } 6945 6946 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) IsFull() bool { 6947 if fieldMask == nil { 6948 return false 6949 } 6950 presentSelectors := make([]bool, 0) 6951 for _, path := range fieldMask.Paths { 6952 if asFinal, ok := path.(*PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath); ok { 6953 presentSelectors[int(asFinal.selector)] = true 6954 } 6955 } 6956 for _, flag := range presentSelectors { 6957 if !flag { 6958 return false 6959 } 6960 } 6961 return true 6962 } 6963 6964 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) ProtoReflect() preflect.Message { 6965 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 6966 return ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(raw) 6967 }) 6968 } 6969 6970 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) ProtoMessage() {} 6971 6972 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) Reset() { 6973 if fieldMask != nil { 6974 fieldMask.Paths = nil 6975 } 6976 } 6977 6978 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) Subtract(other *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask { 6979 result := &PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask{} 6980 removedSelectors := make([]bool, 0) 6981 6982 for _, path := range other.GetPaths() { 6983 switch tp := path.(type) { 6984 case *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath: 6985 removedSelectors[int(tp.selector)] = true 6986 } 6987 } 6988 for _, path := range fieldMask.GetPaths() { 6989 if !removedSelectors[int(path.Selector())] { 6990 result.Paths = append(result.Paths, path) 6991 } 6992 } 6993 6994 if len(result.Paths) == 0 { 6995 return nil 6996 } 6997 return result 6998 } 6999 7000 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 7001 return fieldMask.Subtract(other.(*PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask)) 7002 } 7003 7004 // FilterInputFields generates copy of field paths with output_only field paths removed 7005 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) FilterInputFields() *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask { 7006 result := &PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask{} 7007 result.Paths = append(result.Paths, fieldMask.Paths...) 7008 return result 7009 } 7010 7011 // ToFieldMask is used for proto conversions 7012 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 7013 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7014 for _, path := range fieldMask.Paths { 7015 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 7016 } 7017 return protoFieldMask 7018 } 7019 7020 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 7021 if fieldMask == nil { 7022 return status.Error(codes.Internal, "target field mask is nil") 7023 } 7024 fieldMask.Paths = make([]PolicySpecAIAgentHandlingRemediationReboot_FieldPath, 0, len(protoFieldMask.Paths)) 7025 for _, strPath := range protoFieldMask.Paths { 7026 path, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(strPath) 7027 if err != nil { 7028 return err 7029 } 7030 fieldMask.Paths = append(fieldMask.Paths, path) 7031 } 7032 return nil 7033 } 7034 7035 // implement methods required by customType 7036 func (fieldMask PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) Marshal() ([]byte, error) { 7037 protoFieldMask := fieldMask.ToProtoFieldMask() 7038 return proto.Marshal(protoFieldMask) 7039 } 7040 7041 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) Unmarshal(data []byte) error { 7042 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7043 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 7044 return err 7045 } 7046 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7047 return err 7048 } 7049 return nil 7050 } 7051 7052 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) Size() int { 7053 return proto.Size(fieldMask.ToProtoFieldMask()) 7054 } 7055 7056 func (fieldMask PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) MarshalJSON() ([]byte, error) { 7057 return json.Marshal(fieldMask.ToProtoFieldMask()) 7058 } 7059 7060 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) UnmarshalJSON(data []byte) error { 7061 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7062 if err := json.Unmarshal(data, protoFieldMask); err != nil { 7063 return err 7064 } 7065 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7066 return err 7067 } 7068 return nil 7069 } 7070 7071 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) AppendPath(path PolicySpecAIAgentHandlingRemediationReboot_FieldPath) { 7072 fieldMask.Paths = append(fieldMask.Paths, path) 7073 } 7074 7075 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 7076 fieldMask.Paths = append(fieldMask.Paths, path.(PolicySpecAIAgentHandlingRemediationReboot_FieldPath)) 7077 } 7078 7079 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) GetPaths() []PolicySpecAIAgentHandlingRemediationReboot_FieldPath { 7080 if fieldMask == nil { 7081 return nil 7082 } 7083 return fieldMask.Paths 7084 } 7085 7086 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) GetRawPaths() []gotenobject.FieldPath { 7087 if fieldMask == nil { 7088 return nil 7089 } 7090 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 7091 for _, path := range fieldMask.Paths { 7092 rawPaths = append(rawPaths, path) 7093 } 7094 return rawPaths 7095 } 7096 7097 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) SetFromCliFlag(raw string) error { 7098 path, err := ParsePolicySpecAIAgentHandlingRemediationReboot_FieldPath(raw) 7099 if err != nil { 7100 return err 7101 } 7102 fieldMask.Paths = append(fieldMask.Paths, path) 7103 return nil 7104 } 7105 7106 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) Set(target, source *PolicySpec_AIAgentHandling_Remediation_Reboot) { 7107 for _, path := range fieldMask.Paths { 7108 val, _ := path.GetSingle(source) 7109 // if val is nil, then field does not exist in source, skip 7110 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 7111 if val != nil { 7112 path.WithIValue(val).SetTo(&target) 7113 } 7114 } 7115 } 7116 7117 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 7118 fieldMask.Set(target.(*PolicySpec_AIAgentHandling_Remediation_Reboot), source.(*PolicySpec_AIAgentHandling_Remediation_Reboot)) 7119 } 7120 7121 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) Project(source *PolicySpec_AIAgentHandling_Remediation_Reboot) *PolicySpec_AIAgentHandling_Remediation_Reboot { 7122 if source == nil { 7123 return nil 7124 } 7125 if fieldMask == nil { 7126 return source 7127 } 7128 result := &PolicySpec_AIAgentHandling_Remediation_Reboot{} 7129 7130 for _, p := range fieldMask.Paths { 7131 switch tp := p.(type) { 7132 case *PolicySpecAIAgentHandlingRemediationReboot_FieldTerminalPath: 7133 switch tp.selector { 7134 } 7135 } 7136 } 7137 return result 7138 } 7139 7140 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 7141 return fieldMask.Project(source.(*PolicySpec_AIAgentHandling_Remediation_Reboot)) 7142 } 7143 7144 func (fieldMask *PolicySpec_AIAgentHandling_Remediation_Reboot_FieldMask) PathsCount() int { 7145 if fieldMask == nil { 7146 return 0 7147 } 7148 return len(fieldMask.Paths) 7149 } 7150 7151 type NotificationChannelSpec_FieldMask struct { 7152 Paths []NotificationChannelSpec_FieldPath 7153 } 7154 7155 func FullNotificationChannelSpec_FieldMask() *NotificationChannelSpec_FieldMask { 7156 res := &NotificationChannelSpec_FieldMask{} 7157 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorEnabled}) 7158 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorType}) 7159 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorEnabledKinds}) 7160 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorEmail}) 7161 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorSlack}) 7162 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorWebhook}) 7163 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode}) 7164 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorNotificationMask}) 7165 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg}) 7166 res.Paths = append(res.Paths, &NotificationChannelSpec_FieldTerminalPath{selector: NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing}) 7167 return res 7168 } 7169 7170 func (fieldMask *NotificationChannelSpec_FieldMask) String() string { 7171 if fieldMask == nil { 7172 return "<nil>" 7173 } 7174 pathsStr := make([]string, 0, len(fieldMask.Paths)) 7175 for _, path := range fieldMask.Paths { 7176 pathsStr = append(pathsStr, path.String()) 7177 } 7178 return strings.Join(pathsStr, ", ") 7179 } 7180 7181 func (fieldMask *NotificationChannelSpec_FieldMask) IsFull() bool { 7182 if fieldMask == nil { 7183 return false 7184 } 7185 presentSelectors := make([]bool, 10) 7186 for _, path := range fieldMask.Paths { 7187 if asFinal, ok := path.(*NotificationChannelSpec_FieldTerminalPath); ok { 7188 presentSelectors[int(asFinal.selector)] = true 7189 } 7190 } 7191 for _, flag := range presentSelectors { 7192 if !flag { 7193 return false 7194 } 7195 } 7196 return true 7197 } 7198 7199 func (fieldMask *NotificationChannelSpec_FieldMask) ProtoReflect() preflect.Message { 7200 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 7201 return ParseNotificationChannelSpec_FieldPath(raw) 7202 }) 7203 } 7204 7205 func (fieldMask *NotificationChannelSpec_FieldMask) ProtoMessage() {} 7206 7207 func (fieldMask *NotificationChannelSpec_FieldMask) Reset() { 7208 if fieldMask != nil { 7209 fieldMask.Paths = nil 7210 } 7211 } 7212 7213 func (fieldMask *NotificationChannelSpec_FieldMask) Subtract(other *NotificationChannelSpec_FieldMask) *NotificationChannelSpec_FieldMask { 7214 result := &NotificationChannelSpec_FieldMask{} 7215 removedSelectors := make([]bool, 10) 7216 otherSubMasks := map[NotificationChannelSpec_FieldPathSelector]gotenobject.FieldMask{ 7217 NotificationChannelSpec_FieldPathSelectorEmail: &NotificationChannelSpec_Email_FieldMask{}, 7218 NotificationChannelSpec_FieldPathSelectorSlack: &NotificationChannelSpec_Slack_FieldMask{}, 7219 NotificationChannelSpec_FieldPathSelectorWebhook: &NotificationChannelSpec_Webhook_FieldMask{}, 7220 } 7221 mySubMasks := map[NotificationChannelSpec_FieldPathSelector]gotenobject.FieldMask{ 7222 NotificationChannelSpec_FieldPathSelectorEmail: &NotificationChannelSpec_Email_FieldMask{}, 7223 NotificationChannelSpec_FieldPathSelectorSlack: &NotificationChannelSpec_Slack_FieldMask{}, 7224 NotificationChannelSpec_FieldPathSelectorWebhook: &NotificationChannelSpec_Webhook_FieldMask{}, 7225 } 7226 7227 for _, path := range other.GetPaths() { 7228 switch tp := path.(type) { 7229 case *NotificationChannelSpec_FieldTerminalPath: 7230 removedSelectors[int(tp.selector)] = true 7231 case *NotificationChannelSpec_FieldSubPath: 7232 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 7233 } 7234 } 7235 for _, path := range fieldMask.GetPaths() { 7236 if !removedSelectors[int(path.Selector())] { 7237 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 7238 if tp, ok := path.(*NotificationChannelSpec_FieldTerminalPath); ok { 7239 switch tp.selector { 7240 case NotificationChannelSpec_FieldPathSelectorEmail: 7241 mySubMasks[NotificationChannelSpec_FieldPathSelectorEmail] = FullNotificationChannelSpec_Email_FieldMask() 7242 case NotificationChannelSpec_FieldPathSelectorSlack: 7243 mySubMasks[NotificationChannelSpec_FieldPathSelectorSlack] = FullNotificationChannelSpec_Slack_FieldMask() 7244 case NotificationChannelSpec_FieldPathSelectorWebhook: 7245 mySubMasks[NotificationChannelSpec_FieldPathSelectorWebhook] = FullNotificationChannelSpec_Webhook_FieldMask() 7246 } 7247 } else if tp, ok := path.(*NotificationChannelSpec_FieldSubPath); ok { 7248 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 7249 } 7250 } else { 7251 result.Paths = append(result.Paths, path) 7252 } 7253 } 7254 } 7255 for selector, mySubMask := range mySubMasks { 7256 if mySubMask.PathsCount() > 0 { 7257 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 7258 result.Paths = append(result.Paths, &NotificationChannelSpec_FieldSubPath{selector: selector, subPath: allowedPath}) 7259 } 7260 } 7261 } 7262 7263 if len(result.Paths) == 0 { 7264 return nil 7265 } 7266 return result 7267 } 7268 7269 func (fieldMask *NotificationChannelSpec_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 7270 return fieldMask.Subtract(other.(*NotificationChannelSpec_FieldMask)) 7271 } 7272 7273 // FilterInputFields generates copy of field paths with output_only field paths removed 7274 func (fieldMask *NotificationChannelSpec_FieldMask) FilterInputFields() *NotificationChannelSpec_FieldMask { 7275 result := &NotificationChannelSpec_FieldMask{} 7276 result.Paths = append(result.Paths, fieldMask.Paths...) 7277 return result 7278 } 7279 7280 // ToFieldMask is used for proto conversions 7281 func (fieldMask *NotificationChannelSpec_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 7282 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7283 for _, path := range fieldMask.Paths { 7284 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 7285 } 7286 return protoFieldMask 7287 } 7288 7289 func (fieldMask *NotificationChannelSpec_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 7290 if fieldMask == nil { 7291 return status.Error(codes.Internal, "target field mask is nil") 7292 } 7293 fieldMask.Paths = make([]NotificationChannelSpec_FieldPath, 0, len(protoFieldMask.Paths)) 7294 for _, strPath := range protoFieldMask.Paths { 7295 path, err := ParseNotificationChannelSpec_FieldPath(strPath) 7296 if err != nil { 7297 return err 7298 } 7299 fieldMask.Paths = append(fieldMask.Paths, path) 7300 } 7301 return nil 7302 } 7303 7304 // implement methods required by customType 7305 func (fieldMask NotificationChannelSpec_FieldMask) Marshal() ([]byte, error) { 7306 protoFieldMask := fieldMask.ToProtoFieldMask() 7307 return proto.Marshal(protoFieldMask) 7308 } 7309 7310 func (fieldMask *NotificationChannelSpec_FieldMask) Unmarshal(data []byte) error { 7311 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7312 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 7313 return err 7314 } 7315 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7316 return err 7317 } 7318 return nil 7319 } 7320 7321 func (fieldMask *NotificationChannelSpec_FieldMask) Size() int { 7322 return proto.Size(fieldMask.ToProtoFieldMask()) 7323 } 7324 7325 func (fieldMask NotificationChannelSpec_FieldMask) MarshalJSON() ([]byte, error) { 7326 return json.Marshal(fieldMask.ToProtoFieldMask()) 7327 } 7328 7329 func (fieldMask *NotificationChannelSpec_FieldMask) UnmarshalJSON(data []byte) error { 7330 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7331 if err := json.Unmarshal(data, protoFieldMask); err != nil { 7332 return err 7333 } 7334 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7335 return err 7336 } 7337 return nil 7338 } 7339 7340 func (fieldMask *NotificationChannelSpec_FieldMask) AppendPath(path NotificationChannelSpec_FieldPath) { 7341 fieldMask.Paths = append(fieldMask.Paths, path) 7342 } 7343 7344 func (fieldMask *NotificationChannelSpec_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 7345 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationChannelSpec_FieldPath)) 7346 } 7347 7348 func (fieldMask *NotificationChannelSpec_FieldMask) GetPaths() []NotificationChannelSpec_FieldPath { 7349 if fieldMask == nil { 7350 return nil 7351 } 7352 return fieldMask.Paths 7353 } 7354 7355 func (fieldMask *NotificationChannelSpec_FieldMask) GetRawPaths() []gotenobject.FieldPath { 7356 if fieldMask == nil { 7357 return nil 7358 } 7359 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 7360 for _, path := range fieldMask.Paths { 7361 rawPaths = append(rawPaths, path) 7362 } 7363 return rawPaths 7364 } 7365 7366 func (fieldMask *NotificationChannelSpec_FieldMask) SetFromCliFlag(raw string) error { 7367 path, err := ParseNotificationChannelSpec_FieldPath(raw) 7368 if err != nil { 7369 return err 7370 } 7371 fieldMask.Paths = append(fieldMask.Paths, path) 7372 return nil 7373 } 7374 7375 func (fieldMask *NotificationChannelSpec_FieldMask) Set(target, source *NotificationChannelSpec) { 7376 for _, path := range fieldMask.Paths { 7377 val, _ := path.GetSingle(source) 7378 // if val is nil, then field does not exist in source, skip 7379 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 7380 if val != nil { 7381 path.WithIValue(val).SetTo(&target) 7382 } 7383 } 7384 } 7385 7386 func (fieldMask *NotificationChannelSpec_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 7387 fieldMask.Set(target.(*NotificationChannelSpec), source.(*NotificationChannelSpec)) 7388 } 7389 7390 func (fieldMask *NotificationChannelSpec_FieldMask) Project(source *NotificationChannelSpec) *NotificationChannelSpec { 7391 if source == nil { 7392 return nil 7393 } 7394 if fieldMask == nil { 7395 return source 7396 } 7397 result := &NotificationChannelSpec{} 7398 emailMask := &NotificationChannelSpec_Email_FieldMask{} 7399 wholeEmailAccepted := false 7400 slackMask := &NotificationChannelSpec_Slack_FieldMask{} 7401 wholeSlackAccepted := false 7402 webhookMask := &NotificationChannelSpec_Webhook_FieldMask{} 7403 wholeWebhookAccepted := false 7404 7405 for _, p := range fieldMask.Paths { 7406 switch tp := p.(type) { 7407 case *NotificationChannelSpec_FieldTerminalPath: 7408 switch tp.selector { 7409 case NotificationChannelSpec_FieldPathSelectorEnabled: 7410 result.Enabled = source.Enabled 7411 case NotificationChannelSpec_FieldPathSelectorType: 7412 result.Type = source.Type 7413 case NotificationChannelSpec_FieldPathSelectorEnabledKinds: 7414 result.EnabledKinds = source.EnabledKinds 7415 case NotificationChannelSpec_FieldPathSelectorEmail: 7416 result.Email = source.Email 7417 wholeEmailAccepted = true 7418 case NotificationChannelSpec_FieldPathSelectorSlack: 7419 result.Slack = source.Slack 7420 wholeSlackAccepted = true 7421 case NotificationChannelSpec_FieldPathSelectorWebhook: 7422 result.Webhook = source.Webhook 7423 wholeWebhookAccepted = true 7424 case NotificationChannelSpec_FieldPathSelectorNotificationLanguageCode: 7425 result.NotificationLanguageCode = source.NotificationLanguageCode 7426 case NotificationChannelSpec_FieldPathSelectorNotificationMask: 7427 result.NotificationMask = source.NotificationMask 7428 case NotificationChannelSpec_FieldPathSelectorMaxAlertBodiesInMsg: 7429 result.MaxAlertBodiesInMsg = source.MaxAlertBodiesInMsg 7430 case NotificationChannelSpec_FieldPathSelectorPutOnlyAlertsCounterWhenOverflowing: 7431 result.PutOnlyAlertsCounterWhenOverflowing = source.PutOnlyAlertsCounterWhenOverflowing 7432 } 7433 case *NotificationChannelSpec_FieldSubPath: 7434 switch tp.selector { 7435 case NotificationChannelSpec_FieldPathSelectorEmail: 7436 emailMask.AppendPath(tp.subPath.(NotificationChannelSpecEmail_FieldPath)) 7437 case NotificationChannelSpec_FieldPathSelectorSlack: 7438 slackMask.AppendPath(tp.subPath.(NotificationChannelSpecSlack_FieldPath)) 7439 case NotificationChannelSpec_FieldPathSelectorWebhook: 7440 webhookMask.AppendPath(tp.subPath.(NotificationChannelSpecWebhook_FieldPath)) 7441 } 7442 } 7443 } 7444 if wholeEmailAccepted == false && len(emailMask.Paths) > 0 { 7445 result.Email = emailMask.Project(source.GetEmail()) 7446 } 7447 if wholeSlackAccepted == false && len(slackMask.Paths) > 0 { 7448 result.Slack = slackMask.Project(source.GetSlack()) 7449 } 7450 if wholeWebhookAccepted == false && len(webhookMask.Paths) > 0 { 7451 result.Webhook = webhookMask.Project(source.GetWebhook()) 7452 } 7453 return result 7454 } 7455 7456 func (fieldMask *NotificationChannelSpec_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 7457 return fieldMask.Project(source.(*NotificationChannelSpec)) 7458 } 7459 7460 func (fieldMask *NotificationChannelSpec_FieldMask) PathsCount() int { 7461 if fieldMask == nil { 7462 return 0 7463 } 7464 return len(fieldMask.Paths) 7465 } 7466 7467 type NotificationChannelSpec_Email_FieldMask struct { 7468 Paths []NotificationChannelSpecEmail_FieldPath 7469 } 7470 7471 func FullNotificationChannelSpec_Email_FieldMask() *NotificationChannelSpec_Email_FieldMask { 7472 res := &NotificationChannelSpec_Email_FieldMask{} 7473 res.Paths = append(res.Paths, &NotificationChannelSpecEmail_FieldTerminalPath{selector: NotificationChannelSpecEmail_FieldPathSelectorAddresses}) 7474 return res 7475 } 7476 7477 func (fieldMask *NotificationChannelSpec_Email_FieldMask) String() string { 7478 if fieldMask == nil { 7479 return "<nil>" 7480 } 7481 pathsStr := make([]string, 0, len(fieldMask.Paths)) 7482 for _, path := range fieldMask.Paths { 7483 pathsStr = append(pathsStr, path.String()) 7484 } 7485 return strings.Join(pathsStr, ", ") 7486 } 7487 7488 func (fieldMask *NotificationChannelSpec_Email_FieldMask) IsFull() bool { 7489 if fieldMask == nil { 7490 return false 7491 } 7492 presentSelectors := make([]bool, 1) 7493 for _, path := range fieldMask.Paths { 7494 if asFinal, ok := path.(*NotificationChannelSpecEmail_FieldTerminalPath); ok { 7495 presentSelectors[int(asFinal.selector)] = true 7496 } 7497 } 7498 for _, flag := range presentSelectors { 7499 if !flag { 7500 return false 7501 } 7502 } 7503 return true 7504 } 7505 7506 func (fieldMask *NotificationChannelSpec_Email_FieldMask) ProtoReflect() preflect.Message { 7507 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 7508 return ParseNotificationChannelSpecEmail_FieldPath(raw) 7509 }) 7510 } 7511 7512 func (fieldMask *NotificationChannelSpec_Email_FieldMask) ProtoMessage() {} 7513 7514 func (fieldMask *NotificationChannelSpec_Email_FieldMask) Reset() { 7515 if fieldMask != nil { 7516 fieldMask.Paths = nil 7517 } 7518 } 7519 7520 func (fieldMask *NotificationChannelSpec_Email_FieldMask) Subtract(other *NotificationChannelSpec_Email_FieldMask) *NotificationChannelSpec_Email_FieldMask { 7521 result := &NotificationChannelSpec_Email_FieldMask{} 7522 removedSelectors := make([]bool, 1) 7523 7524 for _, path := range other.GetPaths() { 7525 switch tp := path.(type) { 7526 case *NotificationChannelSpecEmail_FieldTerminalPath: 7527 removedSelectors[int(tp.selector)] = true 7528 } 7529 } 7530 for _, path := range fieldMask.GetPaths() { 7531 if !removedSelectors[int(path.Selector())] { 7532 result.Paths = append(result.Paths, path) 7533 } 7534 } 7535 7536 if len(result.Paths) == 0 { 7537 return nil 7538 } 7539 return result 7540 } 7541 7542 func (fieldMask *NotificationChannelSpec_Email_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 7543 return fieldMask.Subtract(other.(*NotificationChannelSpec_Email_FieldMask)) 7544 } 7545 7546 // FilterInputFields generates copy of field paths with output_only field paths removed 7547 func (fieldMask *NotificationChannelSpec_Email_FieldMask) FilterInputFields() *NotificationChannelSpec_Email_FieldMask { 7548 result := &NotificationChannelSpec_Email_FieldMask{} 7549 result.Paths = append(result.Paths, fieldMask.Paths...) 7550 return result 7551 } 7552 7553 // ToFieldMask is used for proto conversions 7554 func (fieldMask *NotificationChannelSpec_Email_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 7555 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7556 for _, path := range fieldMask.Paths { 7557 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 7558 } 7559 return protoFieldMask 7560 } 7561 7562 func (fieldMask *NotificationChannelSpec_Email_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 7563 if fieldMask == nil { 7564 return status.Error(codes.Internal, "target field mask is nil") 7565 } 7566 fieldMask.Paths = make([]NotificationChannelSpecEmail_FieldPath, 0, len(protoFieldMask.Paths)) 7567 for _, strPath := range protoFieldMask.Paths { 7568 path, err := ParseNotificationChannelSpecEmail_FieldPath(strPath) 7569 if err != nil { 7570 return err 7571 } 7572 fieldMask.Paths = append(fieldMask.Paths, path) 7573 } 7574 return nil 7575 } 7576 7577 // implement methods required by customType 7578 func (fieldMask NotificationChannelSpec_Email_FieldMask) Marshal() ([]byte, error) { 7579 protoFieldMask := fieldMask.ToProtoFieldMask() 7580 return proto.Marshal(protoFieldMask) 7581 } 7582 7583 func (fieldMask *NotificationChannelSpec_Email_FieldMask) Unmarshal(data []byte) error { 7584 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7585 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 7586 return err 7587 } 7588 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7589 return err 7590 } 7591 return nil 7592 } 7593 7594 func (fieldMask *NotificationChannelSpec_Email_FieldMask) Size() int { 7595 return proto.Size(fieldMask.ToProtoFieldMask()) 7596 } 7597 7598 func (fieldMask NotificationChannelSpec_Email_FieldMask) MarshalJSON() ([]byte, error) { 7599 return json.Marshal(fieldMask.ToProtoFieldMask()) 7600 } 7601 7602 func (fieldMask *NotificationChannelSpec_Email_FieldMask) UnmarshalJSON(data []byte) error { 7603 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7604 if err := json.Unmarshal(data, protoFieldMask); err != nil { 7605 return err 7606 } 7607 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7608 return err 7609 } 7610 return nil 7611 } 7612 7613 func (fieldMask *NotificationChannelSpec_Email_FieldMask) AppendPath(path NotificationChannelSpecEmail_FieldPath) { 7614 fieldMask.Paths = append(fieldMask.Paths, path) 7615 } 7616 7617 func (fieldMask *NotificationChannelSpec_Email_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 7618 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationChannelSpecEmail_FieldPath)) 7619 } 7620 7621 func (fieldMask *NotificationChannelSpec_Email_FieldMask) GetPaths() []NotificationChannelSpecEmail_FieldPath { 7622 if fieldMask == nil { 7623 return nil 7624 } 7625 return fieldMask.Paths 7626 } 7627 7628 func (fieldMask *NotificationChannelSpec_Email_FieldMask) GetRawPaths() []gotenobject.FieldPath { 7629 if fieldMask == nil { 7630 return nil 7631 } 7632 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 7633 for _, path := range fieldMask.Paths { 7634 rawPaths = append(rawPaths, path) 7635 } 7636 return rawPaths 7637 } 7638 7639 func (fieldMask *NotificationChannelSpec_Email_FieldMask) SetFromCliFlag(raw string) error { 7640 path, err := ParseNotificationChannelSpecEmail_FieldPath(raw) 7641 if err != nil { 7642 return err 7643 } 7644 fieldMask.Paths = append(fieldMask.Paths, path) 7645 return nil 7646 } 7647 7648 func (fieldMask *NotificationChannelSpec_Email_FieldMask) Set(target, source *NotificationChannelSpec_Email) { 7649 for _, path := range fieldMask.Paths { 7650 val, _ := path.GetSingle(source) 7651 // if val is nil, then field does not exist in source, skip 7652 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 7653 if val != nil { 7654 path.WithIValue(val).SetTo(&target) 7655 } 7656 } 7657 } 7658 7659 func (fieldMask *NotificationChannelSpec_Email_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 7660 fieldMask.Set(target.(*NotificationChannelSpec_Email), source.(*NotificationChannelSpec_Email)) 7661 } 7662 7663 func (fieldMask *NotificationChannelSpec_Email_FieldMask) Project(source *NotificationChannelSpec_Email) *NotificationChannelSpec_Email { 7664 if source == nil { 7665 return nil 7666 } 7667 if fieldMask == nil { 7668 return source 7669 } 7670 result := &NotificationChannelSpec_Email{} 7671 7672 for _, p := range fieldMask.Paths { 7673 switch tp := p.(type) { 7674 case *NotificationChannelSpecEmail_FieldTerminalPath: 7675 switch tp.selector { 7676 case NotificationChannelSpecEmail_FieldPathSelectorAddresses: 7677 result.Addresses = source.Addresses 7678 } 7679 } 7680 } 7681 return result 7682 } 7683 7684 func (fieldMask *NotificationChannelSpec_Email_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 7685 return fieldMask.Project(source.(*NotificationChannelSpec_Email)) 7686 } 7687 7688 func (fieldMask *NotificationChannelSpec_Email_FieldMask) PathsCount() int { 7689 if fieldMask == nil { 7690 return 0 7691 } 7692 return len(fieldMask.Paths) 7693 } 7694 7695 type NotificationChannelSpec_Slack_FieldMask struct { 7696 Paths []NotificationChannelSpecSlack_FieldPath 7697 } 7698 7699 func FullNotificationChannelSpec_Slack_FieldMask() *NotificationChannelSpec_Slack_FieldMask { 7700 res := &NotificationChannelSpec_Slack_FieldMask{} 7701 res.Paths = append(res.Paths, &NotificationChannelSpecSlack_FieldTerminalPath{selector: NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook}) 7702 return res 7703 } 7704 7705 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) String() string { 7706 if fieldMask == nil { 7707 return "<nil>" 7708 } 7709 pathsStr := make([]string, 0, len(fieldMask.Paths)) 7710 for _, path := range fieldMask.Paths { 7711 pathsStr = append(pathsStr, path.String()) 7712 } 7713 return strings.Join(pathsStr, ", ") 7714 } 7715 7716 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) IsFull() bool { 7717 if fieldMask == nil { 7718 return false 7719 } 7720 presentSelectors := make([]bool, 1) 7721 for _, path := range fieldMask.Paths { 7722 if asFinal, ok := path.(*NotificationChannelSpecSlack_FieldTerminalPath); ok { 7723 presentSelectors[int(asFinal.selector)] = true 7724 } 7725 } 7726 for _, flag := range presentSelectors { 7727 if !flag { 7728 return false 7729 } 7730 } 7731 return true 7732 } 7733 7734 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) ProtoReflect() preflect.Message { 7735 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 7736 return ParseNotificationChannelSpecSlack_FieldPath(raw) 7737 }) 7738 } 7739 7740 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) ProtoMessage() {} 7741 7742 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) Reset() { 7743 if fieldMask != nil { 7744 fieldMask.Paths = nil 7745 } 7746 } 7747 7748 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) Subtract(other *NotificationChannelSpec_Slack_FieldMask) *NotificationChannelSpec_Slack_FieldMask { 7749 result := &NotificationChannelSpec_Slack_FieldMask{} 7750 removedSelectors := make([]bool, 1) 7751 7752 for _, path := range other.GetPaths() { 7753 switch tp := path.(type) { 7754 case *NotificationChannelSpecSlack_FieldTerminalPath: 7755 removedSelectors[int(tp.selector)] = true 7756 } 7757 } 7758 for _, path := range fieldMask.GetPaths() { 7759 if !removedSelectors[int(path.Selector())] { 7760 result.Paths = append(result.Paths, path) 7761 } 7762 } 7763 7764 if len(result.Paths) == 0 { 7765 return nil 7766 } 7767 return result 7768 } 7769 7770 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 7771 return fieldMask.Subtract(other.(*NotificationChannelSpec_Slack_FieldMask)) 7772 } 7773 7774 // FilterInputFields generates copy of field paths with output_only field paths removed 7775 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) FilterInputFields() *NotificationChannelSpec_Slack_FieldMask { 7776 result := &NotificationChannelSpec_Slack_FieldMask{} 7777 result.Paths = append(result.Paths, fieldMask.Paths...) 7778 return result 7779 } 7780 7781 // ToFieldMask is used for proto conversions 7782 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 7783 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7784 for _, path := range fieldMask.Paths { 7785 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 7786 } 7787 return protoFieldMask 7788 } 7789 7790 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 7791 if fieldMask == nil { 7792 return status.Error(codes.Internal, "target field mask is nil") 7793 } 7794 fieldMask.Paths = make([]NotificationChannelSpecSlack_FieldPath, 0, len(protoFieldMask.Paths)) 7795 for _, strPath := range protoFieldMask.Paths { 7796 path, err := ParseNotificationChannelSpecSlack_FieldPath(strPath) 7797 if err != nil { 7798 return err 7799 } 7800 fieldMask.Paths = append(fieldMask.Paths, path) 7801 } 7802 return nil 7803 } 7804 7805 // implement methods required by customType 7806 func (fieldMask NotificationChannelSpec_Slack_FieldMask) Marshal() ([]byte, error) { 7807 protoFieldMask := fieldMask.ToProtoFieldMask() 7808 return proto.Marshal(protoFieldMask) 7809 } 7810 7811 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) Unmarshal(data []byte) error { 7812 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7813 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 7814 return err 7815 } 7816 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7817 return err 7818 } 7819 return nil 7820 } 7821 7822 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) Size() int { 7823 return proto.Size(fieldMask.ToProtoFieldMask()) 7824 } 7825 7826 func (fieldMask NotificationChannelSpec_Slack_FieldMask) MarshalJSON() ([]byte, error) { 7827 return json.Marshal(fieldMask.ToProtoFieldMask()) 7828 } 7829 7830 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) UnmarshalJSON(data []byte) error { 7831 protoFieldMask := &googlefieldmaskpb.FieldMask{} 7832 if err := json.Unmarshal(data, protoFieldMask); err != nil { 7833 return err 7834 } 7835 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 7836 return err 7837 } 7838 return nil 7839 } 7840 7841 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) AppendPath(path NotificationChannelSpecSlack_FieldPath) { 7842 fieldMask.Paths = append(fieldMask.Paths, path) 7843 } 7844 7845 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 7846 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationChannelSpecSlack_FieldPath)) 7847 } 7848 7849 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) GetPaths() []NotificationChannelSpecSlack_FieldPath { 7850 if fieldMask == nil { 7851 return nil 7852 } 7853 return fieldMask.Paths 7854 } 7855 7856 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) GetRawPaths() []gotenobject.FieldPath { 7857 if fieldMask == nil { 7858 return nil 7859 } 7860 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 7861 for _, path := range fieldMask.Paths { 7862 rawPaths = append(rawPaths, path) 7863 } 7864 return rawPaths 7865 } 7866 7867 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) SetFromCliFlag(raw string) error { 7868 path, err := ParseNotificationChannelSpecSlack_FieldPath(raw) 7869 if err != nil { 7870 return err 7871 } 7872 fieldMask.Paths = append(fieldMask.Paths, path) 7873 return nil 7874 } 7875 7876 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) Set(target, source *NotificationChannelSpec_Slack) { 7877 for _, path := range fieldMask.Paths { 7878 val, _ := path.GetSingle(source) 7879 // if val is nil, then field does not exist in source, skip 7880 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 7881 if val != nil { 7882 path.WithIValue(val).SetTo(&target) 7883 } 7884 } 7885 } 7886 7887 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 7888 fieldMask.Set(target.(*NotificationChannelSpec_Slack), source.(*NotificationChannelSpec_Slack)) 7889 } 7890 7891 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) Project(source *NotificationChannelSpec_Slack) *NotificationChannelSpec_Slack { 7892 if source == nil { 7893 return nil 7894 } 7895 if fieldMask == nil { 7896 return source 7897 } 7898 result := &NotificationChannelSpec_Slack{} 7899 7900 for _, p := range fieldMask.Paths { 7901 switch tp := p.(type) { 7902 case *NotificationChannelSpecSlack_FieldTerminalPath: 7903 switch tp.selector { 7904 case NotificationChannelSpecSlack_FieldPathSelectorIncomingWebhook: 7905 result.IncomingWebhook = source.IncomingWebhook 7906 } 7907 } 7908 } 7909 return result 7910 } 7911 7912 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 7913 return fieldMask.Project(source.(*NotificationChannelSpec_Slack)) 7914 } 7915 7916 func (fieldMask *NotificationChannelSpec_Slack_FieldMask) PathsCount() int { 7917 if fieldMask == nil { 7918 return 0 7919 } 7920 return len(fieldMask.Paths) 7921 } 7922 7923 type NotificationChannelSpec_PagerDuty_FieldMask struct { 7924 Paths []NotificationChannelSpecPagerDuty_FieldPath 7925 } 7926 7927 func FullNotificationChannelSpec_PagerDuty_FieldMask() *NotificationChannelSpec_PagerDuty_FieldMask { 7928 res := &NotificationChannelSpec_PagerDuty_FieldMask{} 7929 res.Paths = append(res.Paths, &NotificationChannelSpecPagerDuty_FieldTerminalPath{selector: NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey}) 7930 return res 7931 } 7932 7933 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) String() string { 7934 if fieldMask == nil { 7935 return "<nil>" 7936 } 7937 pathsStr := make([]string, 0, len(fieldMask.Paths)) 7938 for _, path := range fieldMask.Paths { 7939 pathsStr = append(pathsStr, path.String()) 7940 } 7941 return strings.Join(pathsStr, ", ") 7942 } 7943 7944 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) IsFull() bool { 7945 if fieldMask == nil { 7946 return false 7947 } 7948 presentSelectors := make([]bool, 1) 7949 for _, path := range fieldMask.Paths { 7950 if asFinal, ok := path.(*NotificationChannelSpecPagerDuty_FieldTerminalPath); ok { 7951 presentSelectors[int(asFinal.selector)] = true 7952 } 7953 } 7954 for _, flag := range presentSelectors { 7955 if !flag { 7956 return false 7957 } 7958 } 7959 return true 7960 } 7961 7962 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) ProtoReflect() preflect.Message { 7963 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 7964 return ParseNotificationChannelSpecPagerDuty_FieldPath(raw) 7965 }) 7966 } 7967 7968 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) ProtoMessage() {} 7969 7970 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) Reset() { 7971 if fieldMask != nil { 7972 fieldMask.Paths = nil 7973 } 7974 } 7975 7976 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) Subtract(other *NotificationChannelSpec_PagerDuty_FieldMask) *NotificationChannelSpec_PagerDuty_FieldMask { 7977 result := &NotificationChannelSpec_PagerDuty_FieldMask{} 7978 removedSelectors := make([]bool, 1) 7979 7980 for _, path := range other.GetPaths() { 7981 switch tp := path.(type) { 7982 case *NotificationChannelSpecPagerDuty_FieldTerminalPath: 7983 removedSelectors[int(tp.selector)] = true 7984 } 7985 } 7986 for _, path := range fieldMask.GetPaths() { 7987 if !removedSelectors[int(path.Selector())] { 7988 result.Paths = append(result.Paths, path) 7989 } 7990 } 7991 7992 if len(result.Paths) == 0 { 7993 return nil 7994 } 7995 return result 7996 } 7997 7998 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 7999 return fieldMask.Subtract(other.(*NotificationChannelSpec_PagerDuty_FieldMask)) 8000 } 8001 8002 // FilterInputFields generates copy of field paths with output_only field paths removed 8003 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) FilterInputFields() *NotificationChannelSpec_PagerDuty_FieldMask { 8004 result := &NotificationChannelSpec_PagerDuty_FieldMask{} 8005 result.Paths = append(result.Paths, fieldMask.Paths...) 8006 return result 8007 } 8008 8009 // ToFieldMask is used for proto conversions 8010 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 8011 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8012 for _, path := range fieldMask.Paths { 8013 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 8014 } 8015 return protoFieldMask 8016 } 8017 8018 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 8019 if fieldMask == nil { 8020 return status.Error(codes.Internal, "target field mask is nil") 8021 } 8022 fieldMask.Paths = make([]NotificationChannelSpecPagerDuty_FieldPath, 0, len(protoFieldMask.Paths)) 8023 for _, strPath := range protoFieldMask.Paths { 8024 path, err := ParseNotificationChannelSpecPagerDuty_FieldPath(strPath) 8025 if err != nil { 8026 return err 8027 } 8028 fieldMask.Paths = append(fieldMask.Paths, path) 8029 } 8030 return nil 8031 } 8032 8033 // implement methods required by customType 8034 func (fieldMask NotificationChannelSpec_PagerDuty_FieldMask) Marshal() ([]byte, error) { 8035 protoFieldMask := fieldMask.ToProtoFieldMask() 8036 return proto.Marshal(protoFieldMask) 8037 } 8038 8039 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) Unmarshal(data []byte) error { 8040 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8041 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 8042 return err 8043 } 8044 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8045 return err 8046 } 8047 return nil 8048 } 8049 8050 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) Size() int { 8051 return proto.Size(fieldMask.ToProtoFieldMask()) 8052 } 8053 8054 func (fieldMask NotificationChannelSpec_PagerDuty_FieldMask) MarshalJSON() ([]byte, error) { 8055 return json.Marshal(fieldMask.ToProtoFieldMask()) 8056 } 8057 8058 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) UnmarshalJSON(data []byte) error { 8059 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8060 if err := json.Unmarshal(data, protoFieldMask); err != nil { 8061 return err 8062 } 8063 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8064 return err 8065 } 8066 return nil 8067 } 8068 8069 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) AppendPath(path NotificationChannelSpecPagerDuty_FieldPath) { 8070 fieldMask.Paths = append(fieldMask.Paths, path) 8071 } 8072 8073 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 8074 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationChannelSpecPagerDuty_FieldPath)) 8075 } 8076 8077 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) GetPaths() []NotificationChannelSpecPagerDuty_FieldPath { 8078 if fieldMask == nil { 8079 return nil 8080 } 8081 return fieldMask.Paths 8082 } 8083 8084 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) GetRawPaths() []gotenobject.FieldPath { 8085 if fieldMask == nil { 8086 return nil 8087 } 8088 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 8089 for _, path := range fieldMask.Paths { 8090 rawPaths = append(rawPaths, path) 8091 } 8092 return rawPaths 8093 } 8094 8095 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) SetFromCliFlag(raw string) error { 8096 path, err := ParseNotificationChannelSpecPagerDuty_FieldPath(raw) 8097 if err != nil { 8098 return err 8099 } 8100 fieldMask.Paths = append(fieldMask.Paths, path) 8101 return nil 8102 } 8103 8104 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) Set(target, source *NotificationChannelSpec_PagerDuty) { 8105 for _, path := range fieldMask.Paths { 8106 val, _ := path.GetSingle(source) 8107 // if val is nil, then field does not exist in source, skip 8108 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 8109 if val != nil { 8110 path.WithIValue(val).SetTo(&target) 8111 } 8112 } 8113 } 8114 8115 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 8116 fieldMask.Set(target.(*NotificationChannelSpec_PagerDuty), source.(*NotificationChannelSpec_PagerDuty)) 8117 } 8118 8119 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) Project(source *NotificationChannelSpec_PagerDuty) *NotificationChannelSpec_PagerDuty { 8120 if source == nil { 8121 return nil 8122 } 8123 if fieldMask == nil { 8124 return source 8125 } 8126 result := &NotificationChannelSpec_PagerDuty{} 8127 8128 for _, p := range fieldMask.Paths { 8129 switch tp := p.(type) { 8130 case *NotificationChannelSpecPagerDuty_FieldTerminalPath: 8131 switch tp.selector { 8132 case NotificationChannelSpecPagerDuty_FieldPathSelectorServiceKey: 8133 result.ServiceKey = source.ServiceKey 8134 } 8135 } 8136 } 8137 return result 8138 } 8139 8140 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 8141 return fieldMask.Project(source.(*NotificationChannelSpec_PagerDuty)) 8142 } 8143 8144 func (fieldMask *NotificationChannelSpec_PagerDuty_FieldMask) PathsCount() int { 8145 if fieldMask == nil { 8146 return 0 8147 } 8148 return len(fieldMask.Paths) 8149 } 8150 8151 type NotificationChannelSpec_Webhook_FieldMask struct { 8152 Paths []NotificationChannelSpecWebhook_FieldPath 8153 } 8154 8155 func FullNotificationChannelSpec_Webhook_FieldMask() *NotificationChannelSpec_Webhook_FieldMask { 8156 res := &NotificationChannelSpec_Webhook_FieldMask{} 8157 res.Paths = append(res.Paths, &NotificationChannelSpecWebhook_FieldTerminalPath{selector: NotificationChannelSpecWebhook_FieldPathSelectorUrl}) 8158 res.Paths = append(res.Paths, &NotificationChannelSpecWebhook_FieldTerminalPath{selector: NotificationChannelSpecWebhook_FieldPathSelectorHeaders}) 8159 res.Paths = append(res.Paths, &NotificationChannelSpecWebhook_FieldTerminalPath{selector: NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb}) 8160 return res 8161 } 8162 8163 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) String() string { 8164 if fieldMask == nil { 8165 return "<nil>" 8166 } 8167 pathsStr := make([]string, 0, len(fieldMask.Paths)) 8168 for _, path := range fieldMask.Paths { 8169 pathsStr = append(pathsStr, path.String()) 8170 } 8171 return strings.Join(pathsStr, ", ") 8172 } 8173 8174 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) IsFull() bool { 8175 if fieldMask == nil { 8176 return false 8177 } 8178 presentSelectors := make([]bool, 3) 8179 for _, path := range fieldMask.Paths { 8180 if asFinal, ok := path.(*NotificationChannelSpecWebhook_FieldTerminalPath); ok { 8181 presentSelectors[int(asFinal.selector)] = true 8182 } 8183 } 8184 for _, flag := range presentSelectors { 8185 if !flag { 8186 return false 8187 } 8188 } 8189 return true 8190 } 8191 8192 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) ProtoReflect() preflect.Message { 8193 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 8194 return ParseNotificationChannelSpecWebhook_FieldPath(raw) 8195 }) 8196 } 8197 8198 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) ProtoMessage() {} 8199 8200 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) Reset() { 8201 if fieldMask != nil { 8202 fieldMask.Paths = nil 8203 } 8204 } 8205 8206 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) Subtract(other *NotificationChannelSpec_Webhook_FieldMask) *NotificationChannelSpec_Webhook_FieldMask { 8207 result := &NotificationChannelSpec_Webhook_FieldMask{} 8208 removedSelectors := make([]bool, 3) 8209 otherSubMasks := map[NotificationChannelSpecWebhook_FieldPathSelector]gotenobject.FieldMask{ 8210 NotificationChannelSpecWebhook_FieldPathSelectorHeaders: &NotificationChannelSpec_Webhook_Header_FieldMask{}, 8211 } 8212 mySubMasks := map[NotificationChannelSpecWebhook_FieldPathSelector]gotenobject.FieldMask{ 8213 NotificationChannelSpecWebhook_FieldPathSelectorHeaders: &NotificationChannelSpec_Webhook_Header_FieldMask{}, 8214 } 8215 8216 for _, path := range other.GetPaths() { 8217 switch tp := path.(type) { 8218 case *NotificationChannelSpecWebhook_FieldTerminalPath: 8219 removedSelectors[int(tp.selector)] = true 8220 case *NotificationChannelSpecWebhook_FieldSubPath: 8221 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 8222 } 8223 } 8224 for _, path := range fieldMask.GetPaths() { 8225 if !removedSelectors[int(path.Selector())] { 8226 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 8227 if tp, ok := path.(*NotificationChannelSpecWebhook_FieldTerminalPath); ok { 8228 switch tp.selector { 8229 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 8230 mySubMasks[NotificationChannelSpecWebhook_FieldPathSelectorHeaders] = FullNotificationChannelSpec_Webhook_Header_FieldMask() 8231 } 8232 } else if tp, ok := path.(*NotificationChannelSpecWebhook_FieldSubPath); ok { 8233 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 8234 } 8235 } else { 8236 result.Paths = append(result.Paths, path) 8237 } 8238 } 8239 } 8240 for selector, mySubMask := range mySubMasks { 8241 if mySubMask.PathsCount() > 0 { 8242 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 8243 result.Paths = append(result.Paths, &NotificationChannelSpecWebhook_FieldSubPath{selector: selector, subPath: allowedPath}) 8244 } 8245 } 8246 } 8247 8248 if len(result.Paths) == 0 { 8249 return nil 8250 } 8251 return result 8252 } 8253 8254 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 8255 return fieldMask.Subtract(other.(*NotificationChannelSpec_Webhook_FieldMask)) 8256 } 8257 8258 // FilterInputFields generates copy of field paths with output_only field paths removed 8259 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) FilterInputFields() *NotificationChannelSpec_Webhook_FieldMask { 8260 result := &NotificationChannelSpec_Webhook_FieldMask{} 8261 result.Paths = append(result.Paths, fieldMask.Paths...) 8262 return result 8263 } 8264 8265 // ToFieldMask is used for proto conversions 8266 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 8267 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8268 for _, path := range fieldMask.Paths { 8269 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 8270 } 8271 return protoFieldMask 8272 } 8273 8274 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 8275 if fieldMask == nil { 8276 return status.Error(codes.Internal, "target field mask is nil") 8277 } 8278 fieldMask.Paths = make([]NotificationChannelSpecWebhook_FieldPath, 0, len(protoFieldMask.Paths)) 8279 for _, strPath := range protoFieldMask.Paths { 8280 path, err := ParseNotificationChannelSpecWebhook_FieldPath(strPath) 8281 if err != nil { 8282 return err 8283 } 8284 fieldMask.Paths = append(fieldMask.Paths, path) 8285 } 8286 return nil 8287 } 8288 8289 // implement methods required by customType 8290 func (fieldMask NotificationChannelSpec_Webhook_FieldMask) Marshal() ([]byte, error) { 8291 protoFieldMask := fieldMask.ToProtoFieldMask() 8292 return proto.Marshal(protoFieldMask) 8293 } 8294 8295 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) Unmarshal(data []byte) error { 8296 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8297 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 8298 return err 8299 } 8300 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8301 return err 8302 } 8303 return nil 8304 } 8305 8306 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) Size() int { 8307 return proto.Size(fieldMask.ToProtoFieldMask()) 8308 } 8309 8310 func (fieldMask NotificationChannelSpec_Webhook_FieldMask) MarshalJSON() ([]byte, error) { 8311 return json.Marshal(fieldMask.ToProtoFieldMask()) 8312 } 8313 8314 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) UnmarshalJSON(data []byte) error { 8315 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8316 if err := json.Unmarshal(data, protoFieldMask); err != nil { 8317 return err 8318 } 8319 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8320 return err 8321 } 8322 return nil 8323 } 8324 8325 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) AppendPath(path NotificationChannelSpecWebhook_FieldPath) { 8326 fieldMask.Paths = append(fieldMask.Paths, path) 8327 } 8328 8329 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 8330 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationChannelSpecWebhook_FieldPath)) 8331 } 8332 8333 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) GetPaths() []NotificationChannelSpecWebhook_FieldPath { 8334 if fieldMask == nil { 8335 return nil 8336 } 8337 return fieldMask.Paths 8338 } 8339 8340 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) GetRawPaths() []gotenobject.FieldPath { 8341 if fieldMask == nil { 8342 return nil 8343 } 8344 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 8345 for _, path := range fieldMask.Paths { 8346 rawPaths = append(rawPaths, path) 8347 } 8348 return rawPaths 8349 } 8350 8351 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) SetFromCliFlag(raw string) error { 8352 path, err := ParseNotificationChannelSpecWebhook_FieldPath(raw) 8353 if err != nil { 8354 return err 8355 } 8356 fieldMask.Paths = append(fieldMask.Paths, path) 8357 return nil 8358 } 8359 8360 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) Set(target, source *NotificationChannelSpec_Webhook) { 8361 for _, path := range fieldMask.Paths { 8362 val, _ := path.GetSingle(source) 8363 // if val is nil, then field does not exist in source, skip 8364 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 8365 if val != nil { 8366 path.WithIValue(val).SetTo(&target) 8367 } 8368 } 8369 } 8370 8371 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 8372 fieldMask.Set(target.(*NotificationChannelSpec_Webhook), source.(*NotificationChannelSpec_Webhook)) 8373 } 8374 8375 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) Project(source *NotificationChannelSpec_Webhook) *NotificationChannelSpec_Webhook { 8376 if source == nil { 8377 return nil 8378 } 8379 if fieldMask == nil { 8380 return source 8381 } 8382 result := &NotificationChannelSpec_Webhook{} 8383 headersMask := &NotificationChannelSpec_Webhook_Header_FieldMask{} 8384 wholeHeadersAccepted := false 8385 8386 for _, p := range fieldMask.Paths { 8387 switch tp := p.(type) { 8388 case *NotificationChannelSpecWebhook_FieldTerminalPath: 8389 switch tp.selector { 8390 case NotificationChannelSpecWebhook_FieldPathSelectorUrl: 8391 result.Url = source.Url 8392 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 8393 result.Headers = source.Headers 8394 wholeHeadersAccepted = true 8395 case NotificationChannelSpecWebhook_FieldPathSelectorMaxMessageSizeMb: 8396 result.MaxMessageSizeMb = source.MaxMessageSizeMb 8397 } 8398 case *NotificationChannelSpecWebhook_FieldSubPath: 8399 switch tp.selector { 8400 case NotificationChannelSpecWebhook_FieldPathSelectorHeaders: 8401 headersMask.AppendPath(tp.subPath.(NotificationChannelSpecWebhookHeader_FieldPath)) 8402 } 8403 } 8404 } 8405 if wholeHeadersAccepted == false && len(headersMask.Paths) > 0 { 8406 for _, sourceItem := range source.GetHeaders() { 8407 result.Headers = append(result.Headers, headersMask.Project(sourceItem)) 8408 } 8409 } 8410 return result 8411 } 8412 8413 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 8414 return fieldMask.Project(source.(*NotificationChannelSpec_Webhook)) 8415 } 8416 8417 func (fieldMask *NotificationChannelSpec_Webhook_FieldMask) PathsCount() int { 8418 if fieldMask == nil { 8419 return 0 8420 } 8421 return len(fieldMask.Paths) 8422 } 8423 8424 type NotificationChannelSpec_Webhook_Header_FieldMask struct { 8425 Paths []NotificationChannelSpecWebhookHeader_FieldPath 8426 } 8427 8428 func FullNotificationChannelSpec_Webhook_Header_FieldMask() *NotificationChannelSpec_Webhook_Header_FieldMask { 8429 res := &NotificationChannelSpec_Webhook_Header_FieldMask{} 8430 res.Paths = append(res.Paths, &NotificationChannelSpecWebhookHeader_FieldTerminalPath{selector: NotificationChannelSpecWebhookHeader_FieldPathSelectorKey}) 8431 res.Paths = append(res.Paths, &NotificationChannelSpecWebhookHeader_FieldTerminalPath{selector: NotificationChannelSpecWebhookHeader_FieldPathSelectorValue}) 8432 return res 8433 } 8434 8435 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) String() string { 8436 if fieldMask == nil { 8437 return "<nil>" 8438 } 8439 pathsStr := make([]string, 0, len(fieldMask.Paths)) 8440 for _, path := range fieldMask.Paths { 8441 pathsStr = append(pathsStr, path.String()) 8442 } 8443 return strings.Join(pathsStr, ", ") 8444 } 8445 8446 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) IsFull() bool { 8447 if fieldMask == nil { 8448 return false 8449 } 8450 presentSelectors := make([]bool, 2) 8451 for _, path := range fieldMask.Paths { 8452 if asFinal, ok := path.(*NotificationChannelSpecWebhookHeader_FieldTerminalPath); ok { 8453 presentSelectors[int(asFinal.selector)] = true 8454 } 8455 } 8456 for _, flag := range presentSelectors { 8457 if !flag { 8458 return false 8459 } 8460 } 8461 return true 8462 } 8463 8464 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) ProtoReflect() preflect.Message { 8465 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 8466 return ParseNotificationChannelSpecWebhookHeader_FieldPath(raw) 8467 }) 8468 } 8469 8470 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) ProtoMessage() {} 8471 8472 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) Reset() { 8473 if fieldMask != nil { 8474 fieldMask.Paths = nil 8475 } 8476 } 8477 8478 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) Subtract(other *NotificationChannelSpec_Webhook_Header_FieldMask) *NotificationChannelSpec_Webhook_Header_FieldMask { 8479 result := &NotificationChannelSpec_Webhook_Header_FieldMask{} 8480 removedSelectors := make([]bool, 2) 8481 8482 for _, path := range other.GetPaths() { 8483 switch tp := path.(type) { 8484 case *NotificationChannelSpecWebhookHeader_FieldTerminalPath: 8485 removedSelectors[int(tp.selector)] = true 8486 } 8487 } 8488 for _, path := range fieldMask.GetPaths() { 8489 if !removedSelectors[int(path.Selector())] { 8490 result.Paths = append(result.Paths, path) 8491 } 8492 } 8493 8494 if len(result.Paths) == 0 { 8495 return nil 8496 } 8497 return result 8498 } 8499 8500 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 8501 return fieldMask.Subtract(other.(*NotificationChannelSpec_Webhook_Header_FieldMask)) 8502 } 8503 8504 // FilterInputFields generates copy of field paths with output_only field paths removed 8505 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) FilterInputFields() *NotificationChannelSpec_Webhook_Header_FieldMask { 8506 result := &NotificationChannelSpec_Webhook_Header_FieldMask{} 8507 result.Paths = append(result.Paths, fieldMask.Paths...) 8508 return result 8509 } 8510 8511 // ToFieldMask is used for proto conversions 8512 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 8513 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8514 for _, path := range fieldMask.Paths { 8515 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 8516 } 8517 return protoFieldMask 8518 } 8519 8520 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 8521 if fieldMask == nil { 8522 return status.Error(codes.Internal, "target field mask is nil") 8523 } 8524 fieldMask.Paths = make([]NotificationChannelSpecWebhookHeader_FieldPath, 0, len(protoFieldMask.Paths)) 8525 for _, strPath := range protoFieldMask.Paths { 8526 path, err := ParseNotificationChannelSpecWebhookHeader_FieldPath(strPath) 8527 if err != nil { 8528 return err 8529 } 8530 fieldMask.Paths = append(fieldMask.Paths, path) 8531 } 8532 return nil 8533 } 8534 8535 // implement methods required by customType 8536 func (fieldMask NotificationChannelSpec_Webhook_Header_FieldMask) Marshal() ([]byte, error) { 8537 protoFieldMask := fieldMask.ToProtoFieldMask() 8538 return proto.Marshal(protoFieldMask) 8539 } 8540 8541 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) Unmarshal(data []byte) error { 8542 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8543 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 8544 return err 8545 } 8546 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8547 return err 8548 } 8549 return nil 8550 } 8551 8552 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) Size() int { 8553 return proto.Size(fieldMask.ToProtoFieldMask()) 8554 } 8555 8556 func (fieldMask NotificationChannelSpec_Webhook_Header_FieldMask) MarshalJSON() ([]byte, error) { 8557 return json.Marshal(fieldMask.ToProtoFieldMask()) 8558 } 8559 8560 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) UnmarshalJSON(data []byte) error { 8561 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8562 if err := json.Unmarshal(data, protoFieldMask); err != nil { 8563 return err 8564 } 8565 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8566 return err 8567 } 8568 return nil 8569 } 8570 8571 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) AppendPath(path NotificationChannelSpecWebhookHeader_FieldPath) { 8572 fieldMask.Paths = append(fieldMask.Paths, path) 8573 } 8574 8575 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 8576 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationChannelSpecWebhookHeader_FieldPath)) 8577 } 8578 8579 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) GetPaths() []NotificationChannelSpecWebhookHeader_FieldPath { 8580 if fieldMask == nil { 8581 return nil 8582 } 8583 return fieldMask.Paths 8584 } 8585 8586 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) GetRawPaths() []gotenobject.FieldPath { 8587 if fieldMask == nil { 8588 return nil 8589 } 8590 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 8591 for _, path := range fieldMask.Paths { 8592 rawPaths = append(rawPaths, path) 8593 } 8594 return rawPaths 8595 } 8596 8597 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) SetFromCliFlag(raw string) error { 8598 path, err := ParseNotificationChannelSpecWebhookHeader_FieldPath(raw) 8599 if err != nil { 8600 return err 8601 } 8602 fieldMask.Paths = append(fieldMask.Paths, path) 8603 return nil 8604 } 8605 8606 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) Set(target, source *NotificationChannelSpec_Webhook_Header) { 8607 for _, path := range fieldMask.Paths { 8608 val, _ := path.GetSingle(source) 8609 // if val is nil, then field does not exist in source, skip 8610 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 8611 if val != nil { 8612 path.WithIValue(val).SetTo(&target) 8613 } 8614 } 8615 } 8616 8617 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 8618 fieldMask.Set(target.(*NotificationChannelSpec_Webhook_Header), source.(*NotificationChannelSpec_Webhook_Header)) 8619 } 8620 8621 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) Project(source *NotificationChannelSpec_Webhook_Header) *NotificationChannelSpec_Webhook_Header { 8622 if source == nil { 8623 return nil 8624 } 8625 if fieldMask == nil { 8626 return source 8627 } 8628 result := &NotificationChannelSpec_Webhook_Header{} 8629 8630 for _, p := range fieldMask.Paths { 8631 switch tp := p.(type) { 8632 case *NotificationChannelSpecWebhookHeader_FieldTerminalPath: 8633 switch tp.selector { 8634 case NotificationChannelSpecWebhookHeader_FieldPathSelectorKey: 8635 result.Key = source.Key 8636 case NotificationChannelSpecWebhookHeader_FieldPathSelectorValue: 8637 result.Value = source.Value 8638 } 8639 } 8640 } 8641 return result 8642 } 8643 8644 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 8645 return fieldMask.Project(source.(*NotificationChannelSpec_Webhook_Header)) 8646 } 8647 8648 func (fieldMask *NotificationChannelSpec_Webhook_Header_FieldMask) PathsCount() int { 8649 if fieldMask == nil { 8650 return 0 8651 } 8652 return len(fieldMask.Paths) 8653 } 8654 8655 type AlertingThreshold_FieldMask struct { 8656 Paths []AlertingThreshold_FieldPath 8657 } 8658 8659 func FullAlertingThreshold_FieldMask() *AlertingThreshold_FieldMask { 8660 res := &AlertingThreshold_FieldMask{} 8661 res.Paths = append(res.Paths, &AlertingThreshold_FieldTerminalPath{selector: AlertingThreshold_FieldPathSelectorValue}) 8662 res.Paths = append(res.Paths, &AlertingThreshold_FieldTerminalPath{selector: AlertingThreshold_FieldPathSelectorIsInclusive}) 8663 return res 8664 } 8665 8666 func (fieldMask *AlertingThreshold_FieldMask) String() string { 8667 if fieldMask == nil { 8668 return "<nil>" 8669 } 8670 pathsStr := make([]string, 0, len(fieldMask.Paths)) 8671 for _, path := range fieldMask.Paths { 8672 pathsStr = append(pathsStr, path.String()) 8673 } 8674 return strings.Join(pathsStr, ", ") 8675 } 8676 8677 func (fieldMask *AlertingThreshold_FieldMask) IsFull() bool { 8678 if fieldMask == nil { 8679 return false 8680 } 8681 presentSelectors := make([]bool, 2) 8682 for _, path := range fieldMask.Paths { 8683 if asFinal, ok := path.(*AlertingThreshold_FieldTerminalPath); ok { 8684 presentSelectors[int(asFinal.selector)] = true 8685 } 8686 } 8687 for _, flag := range presentSelectors { 8688 if !flag { 8689 return false 8690 } 8691 } 8692 return true 8693 } 8694 8695 func (fieldMask *AlertingThreshold_FieldMask) ProtoReflect() preflect.Message { 8696 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 8697 return ParseAlertingThreshold_FieldPath(raw) 8698 }) 8699 } 8700 8701 func (fieldMask *AlertingThreshold_FieldMask) ProtoMessage() {} 8702 8703 func (fieldMask *AlertingThreshold_FieldMask) Reset() { 8704 if fieldMask != nil { 8705 fieldMask.Paths = nil 8706 } 8707 } 8708 8709 func (fieldMask *AlertingThreshold_FieldMask) Subtract(other *AlertingThreshold_FieldMask) *AlertingThreshold_FieldMask { 8710 result := &AlertingThreshold_FieldMask{} 8711 removedSelectors := make([]bool, 2) 8712 8713 for _, path := range other.GetPaths() { 8714 switch tp := path.(type) { 8715 case *AlertingThreshold_FieldTerminalPath: 8716 removedSelectors[int(tp.selector)] = true 8717 } 8718 } 8719 for _, path := range fieldMask.GetPaths() { 8720 if !removedSelectors[int(path.Selector())] { 8721 result.Paths = append(result.Paths, path) 8722 } 8723 } 8724 8725 if len(result.Paths) == 0 { 8726 return nil 8727 } 8728 return result 8729 } 8730 8731 func (fieldMask *AlertingThreshold_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 8732 return fieldMask.Subtract(other.(*AlertingThreshold_FieldMask)) 8733 } 8734 8735 // FilterInputFields generates copy of field paths with output_only field paths removed 8736 func (fieldMask *AlertingThreshold_FieldMask) FilterInputFields() *AlertingThreshold_FieldMask { 8737 result := &AlertingThreshold_FieldMask{} 8738 result.Paths = append(result.Paths, fieldMask.Paths...) 8739 return result 8740 } 8741 8742 // ToFieldMask is used for proto conversions 8743 func (fieldMask *AlertingThreshold_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 8744 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8745 for _, path := range fieldMask.Paths { 8746 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 8747 } 8748 return protoFieldMask 8749 } 8750 8751 func (fieldMask *AlertingThreshold_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 8752 if fieldMask == nil { 8753 return status.Error(codes.Internal, "target field mask is nil") 8754 } 8755 fieldMask.Paths = make([]AlertingThreshold_FieldPath, 0, len(protoFieldMask.Paths)) 8756 for _, strPath := range protoFieldMask.Paths { 8757 path, err := ParseAlertingThreshold_FieldPath(strPath) 8758 if err != nil { 8759 return err 8760 } 8761 fieldMask.Paths = append(fieldMask.Paths, path) 8762 } 8763 return nil 8764 } 8765 8766 // implement methods required by customType 8767 func (fieldMask AlertingThreshold_FieldMask) Marshal() ([]byte, error) { 8768 protoFieldMask := fieldMask.ToProtoFieldMask() 8769 return proto.Marshal(protoFieldMask) 8770 } 8771 8772 func (fieldMask *AlertingThreshold_FieldMask) Unmarshal(data []byte) error { 8773 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8774 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 8775 return err 8776 } 8777 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8778 return err 8779 } 8780 return nil 8781 } 8782 8783 func (fieldMask *AlertingThreshold_FieldMask) Size() int { 8784 return proto.Size(fieldMask.ToProtoFieldMask()) 8785 } 8786 8787 func (fieldMask AlertingThreshold_FieldMask) MarshalJSON() ([]byte, error) { 8788 return json.Marshal(fieldMask.ToProtoFieldMask()) 8789 } 8790 8791 func (fieldMask *AlertingThreshold_FieldMask) UnmarshalJSON(data []byte) error { 8792 protoFieldMask := &googlefieldmaskpb.FieldMask{} 8793 if err := json.Unmarshal(data, protoFieldMask); err != nil { 8794 return err 8795 } 8796 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 8797 return err 8798 } 8799 return nil 8800 } 8801 8802 func (fieldMask *AlertingThreshold_FieldMask) AppendPath(path AlertingThreshold_FieldPath) { 8803 fieldMask.Paths = append(fieldMask.Paths, path) 8804 } 8805 8806 func (fieldMask *AlertingThreshold_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 8807 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingThreshold_FieldPath)) 8808 } 8809 8810 func (fieldMask *AlertingThreshold_FieldMask) GetPaths() []AlertingThreshold_FieldPath { 8811 if fieldMask == nil { 8812 return nil 8813 } 8814 return fieldMask.Paths 8815 } 8816 8817 func (fieldMask *AlertingThreshold_FieldMask) GetRawPaths() []gotenobject.FieldPath { 8818 if fieldMask == nil { 8819 return nil 8820 } 8821 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 8822 for _, path := range fieldMask.Paths { 8823 rawPaths = append(rawPaths, path) 8824 } 8825 return rawPaths 8826 } 8827 8828 func (fieldMask *AlertingThreshold_FieldMask) SetFromCliFlag(raw string) error { 8829 path, err := ParseAlertingThreshold_FieldPath(raw) 8830 if err != nil { 8831 return err 8832 } 8833 fieldMask.Paths = append(fieldMask.Paths, path) 8834 return nil 8835 } 8836 8837 func (fieldMask *AlertingThreshold_FieldMask) Set(target, source *AlertingThreshold) { 8838 for _, path := range fieldMask.Paths { 8839 val, _ := path.GetSingle(source) 8840 // if val is nil, then field does not exist in source, skip 8841 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 8842 if val != nil { 8843 path.WithIValue(val).SetTo(&target) 8844 } 8845 } 8846 } 8847 8848 func (fieldMask *AlertingThreshold_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 8849 fieldMask.Set(target.(*AlertingThreshold), source.(*AlertingThreshold)) 8850 } 8851 8852 func (fieldMask *AlertingThreshold_FieldMask) Project(source *AlertingThreshold) *AlertingThreshold { 8853 if source == nil { 8854 return nil 8855 } 8856 if fieldMask == nil { 8857 return source 8858 } 8859 result := &AlertingThreshold{} 8860 8861 for _, p := range fieldMask.Paths { 8862 switch tp := p.(type) { 8863 case *AlertingThreshold_FieldTerminalPath: 8864 switch tp.selector { 8865 case AlertingThreshold_FieldPathSelectorValue: 8866 result.Value = source.Value 8867 case AlertingThreshold_FieldPathSelectorIsInclusive: 8868 result.IsInclusive = source.IsInclusive 8869 } 8870 } 8871 } 8872 return result 8873 } 8874 8875 func (fieldMask *AlertingThreshold_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 8876 return fieldMask.Project(source.(*AlertingThreshold)) 8877 } 8878 8879 func (fieldMask *AlertingThreshold_FieldMask) PathsCount() int { 8880 if fieldMask == nil { 8881 return 0 8882 } 8883 return len(fieldMask.Paths) 8884 }