github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/alerting_condition/alerting_condition.pb.fieldmask.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/monitoring/proto/v4/alerting_condition.proto 3 // DO NOT EDIT!!! 4 5 package alerting_condition 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 alerting_policy "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_policy" 23 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 24 time_serie "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/time_serie" 25 meta "github.com/cloudwan/goten-sdk/types/meta" 26 durationpb "google.golang.org/protobuf/types/known/durationpb" 27 ) 28 29 // ensure the imports are used 30 var ( 31 _ = new(json.Marshaler) 32 _ = strings.Builder{} 33 34 _ = codes.NotFound 35 _ = status.Status{} 36 _ = new(proto.Message) 37 _ = new(preflect.Message) 38 _ = googlefieldmaskpb.FieldMask{} 39 40 _ = new(gotenobject.FieldMask) 41 ) 42 43 // make sure we're using proto imports 44 var ( 45 _ = &alerting_policy.AlertingPolicy{} 46 _ = &common.LabelDescriptor{} 47 _ = &time_serie.Point{} 48 _ = &durationpb.Duration{} 49 _ = &meta.Meta{} 50 ) 51 52 type AlertingCondition_FieldMask struct { 53 Paths []AlertingCondition_FieldPath 54 } 55 56 func FullAlertingCondition_FieldMask() *AlertingCondition_FieldMask { 57 res := &AlertingCondition_FieldMask{} 58 res.Paths = append(res.Paths, &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorName}) 59 res.Paths = append(res.Paths, &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorMetadata}) 60 res.Paths = append(res.Paths, &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorDisplayName}) 61 res.Paths = append(res.Paths, &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorDescription}) 62 res.Paths = append(res.Paths, &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorSpec}) 63 res.Paths = append(res.Paths, &AlertingCondition_FieldTerminalPath{selector: AlertingCondition_FieldPathSelectorState}) 64 return res 65 } 66 67 func (fieldMask *AlertingCondition_FieldMask) String() string { 68 if fieldMask == nil { 69 return "<nil>" 70 } 71 pathsStr := make([]string, 0, len(fieldMask.Paths)) 72 for _, path := range fieldMask.Paths { 73 pathsStr = append(pathsStr, path.String()) 74 } 75 return strings.Join(pathsStr, ", ") 76 } 77 78 func (fieldMask *AlertingCondition_FieldMask) IsFull() bool { 79 if fieldMask == nil { 80 return false 81 } 82 presentSelectors := make([]bool, 6) 83 for _, path := range fieldMask.Paths { 84 if asFinal, ok := path.(*AlertingCondition_FieldTerminalPath); ok { 85 presentSelectors[int(asFinal.selector)] = true 86 } 87 } 88 for _, flag := range presentSelectors { 89 if !flag { 90 return false 91 } 92 } 93 return true 94 } 95 96 func (fieldMask *AlertingCondition_FieldMask) ProtoReflect() preflect.Message { 97 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 98 return ParseAlertingCondition_FieldPath(raw) 99 }) 100 } 101 102 func (fieldMask *AlertingCondition_FieldMask) ProtoMessage() {} 103 104 func (fieldMask *AlertingCondition_FieldMask) Reset() { 105 if fieldMask != nil { 106 fieldMask.Paths = nil 107 } 108 } 109 110 func (fieldMask *AlertingCondition_FieldMask) Subtract(other *AlertingCondition_FieldMask) *AlertingCondition_FieldMask { 111 result := &AlertingCondition_FieldMask{} 112 removedSelectors := make([]bool, 6) 113 otherSubMasks := map[AlertingCondition_FieldPathSelector]gotenobject.FieldMask{ 114 AlertingCondition_FieldPathSelectorMetadata: &meta.Meta_FieldMask{}, 115 AlertingCondition_FieldPathSelectorSpec: &AlertingCondition_Spec_FieldMask{}, 116 AlertingCondition_FieldPathSelectorState: &AlertingCondition_State_FieldMask{}, 117 } 118 mySubMasks := map[AlertingCondition_FieldPathSelector]gotenobject.FieldMask{ 119 AlertingCondition_FieldPathSelectorMetadata: &meta.Meta_FieldMask{}, 120 AlertingCondition_FieldPathSelectorSpec: &AlertingCondition_Spec_FieldMask{}, 121 AlertingCondition_FieldPathSelectorState: &AlertingCondition_State_FieldMask{}, 122 } 123 124 for _, path := range other.GetPaths() { 125 switch tp := path.(type) { 126 case *AlertingCondition_FieldTerminalPath: 127 removedSelectors[int(tp.selector)] = true 128 case *AlertingCondition_FieldSubPath: 129 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 130 } 131 } 132 for _, path := range fieldMask.GetPaths() { 133 if !removedSelectors[int(path.Selector())] { 134 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 135 if tp, ok := path.(*AlertingCondition_FieldTerminalPath); ok { 136 switch tp.selector { 137 case AlertingCondition_FieldPathSelectorMetadata: 138 mySubMasks[AlertingCondition_FieldPathSelectorMetadata] = meta.FullMeta_FieldMask() 139 case AlertingCondition_FieldPathSelectorSpec: 140 mySubMasks[AlertingCondition_FieldPathSelectorSpec] = FullAlertingCondition_Spec_FieldMask() 141 case AlertingCondition_FieldPathSelectorState: 142 mySubMasks[AlertingCondition_FieldPathSelectorState] = FullAlertingCondition_State_FieldMask() 143 } 144 } else if tp, ok := path.(*AlertingCondition_FieldSubPath); ok { 145 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 146 } 147 } else { 148 result.Paths = append(result.Paths, path) 149 } 150 } 151 } 152 for selector, mySubMask := range mySubMasks { 153 if mySubMask.PathsCount() > 0 { 154 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 155 result.Paths = append(result.Paths, &AlertingCondition_FieldSubPath{selector: selector, subPath: allowedPath}) 156 } 157 } 158 } 159 160 if len(result.Paths) == 0 { 161 return nil 162 } 163 return result 164 } 165 166 func (fieldMask *AlertingCondition_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 167 return fieldMask.Subtract(other.(*AlertingCondition_FieldMask)) 168 } 169 170 // FilterInputFields generates copy of field paths with output_only field paths removed 171 func (fieldMask *AlertingCondition_FieldMask) FilterInputFields() *AlertingCondition_FieldMask { 172 result := &AlertingCondition_FieldMask{} 173 for _, path := range fieldMask.Paths { 174 switch path.Selector() { 175 case AlertingCondition_FieldPathSelectorMetadata: 176 if _, ok := path.(*AlertingCondition_FieldTerminalPath); ok { 177 for _, subpath := range meta.FullMeta_FieldMask().FilterInputFields().Paths { 178 result.Paths = append(result.Paths, &AlertingCondition_FieldSubPath{selector: path.Selector(), subPath: subpath}) 179 } 180 } else if sub, ok := path.(*AlertingCondition_FieldSubPath); ok { 181 selectedMask := &meta.Meta_FieldMask{ 182 Paths: []meta.Meta_FieldPath{sub.subPath.(meta.Meta_FieldPath)}, 183 } 184 for _, allowedPath := range selectedMask.FilterInputFields().Paths { 185 result.Paths = append(result.Paths, &AlertingCondition_FieldSubPath{selector: AlertingCondition_FieldPathSelectorMetadata, subPath: allowedPath}) 186 } 187 } 188 case AlertingCondition_FieldPathSelectorSpec: 189 if _, ok := path.(*AlertingCondition_FieldTerminalPath); ok { 190 for _, subpath := range FullAlertingCondition_Spec_FieldMask().FilterInputFields().Paths { 191 result.Paths = append(result.Paths, &AlertingCondition_FieldSubPath{selector: path.Selector(), subPath: subpath}) 192 } 193 } else if sub, ok := path.(*AlertingCondition_FieldSubPath); ok { 194 selectedMask := &AlertingCondition_Spec_FieldMask{ 195 Paths: []AlertingConditionSpec_FieldPath{sub.subPath.(AlertingConditionSpec_FieldPath)}, 196 } 197 for _, allowedPath := range selectedMask.FilterInputFields().Paths { 198 result.Paths = append(result.Paths, &AlertingCondition_FieldSubPath{selector: AlertingCondition_FieldPathSelectorSpec, subPath: allowedPath}) 199 } 200 } 201 default: 202 result.Paths = append(result.Paths, path) 203 } 204 } 205 return result 206 } 207 208 // ToFieldMask is used for proto conversions 209 func (fieldMask *AlertingCondition_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 210 protoFieldMask := &googlefieldmaskpb.FieldMask{} 211 for _, path := range fieldMask.Paths { 212 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 213 } 214 return protoFieldMask 215 } 216 217 func (fieldMask *AlertingCondition_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 218 if fieldMask == nil { 219 return status.Error(codes.Internal, "target field mask is nil") 220 } 221 fieldMask.Paths = make([]AlertingCondition_FieldPath, 0, len(protoFieldMask.Paths)) 222 for _, strPath := range protoFieldMask.Paths { 223 path, err := ParseAlertingCondition_FieldPath(strPath) 224 if err != nil { 225 return err 226 } 227 fieldMask.Paths = append(fieldMask.Paths, path) 228 } 229 return nil 230 } 231 232 // implement methods required by customType 233 func (fieldMask AlertingCondition_FieldMask) Marshal() ([]byte, error) { 234 protoFieldMask := fieldMask.ToProtoFieldMask() 235 return proto.Marshal(protoFieldMask) 236 } 237 238 func (fieldMask *AlertingCondition_FieldMask) Unmarshal(data []byte) error { 239 protoFieldMask := &googlefieldmaskpb.FieldMask{} 240 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 241 return err 242 } 243 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 244 return err 245 } 246 return nil 247 } 248 249 func (fieldMask *AlertingCondition_FieldMask) Size() int { 250 return proto.Size(fieldMask.ToProtoFieldMask()) 251 } 252 253 func (fieldMask AlertingCondition_FieldMask) MarshalJSON() ([]byte, error) { 254 return json.Marshal(fieldMask.ToProtoFieldMask()) 255 } 256 257 func (fieldMask *AlertingCondition_FieldMask) UnmarshalJSON(data []byte) error { 258 protoFieldMask := &googlefieldmaskpb.FieldMask{} 259 if err := json.Unmarshal(data, protoFieldMask); err != nil { 260 return err 261 } 262 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 263 return err 264 } 265 return nil 266 } 267 268 func (fieldMask *AlertingCondition_FieldMask) AppendPath(path AlertingCondition_FieldPath) { 269 fieldMask.Paths = append(fieldMask.Paths, path) 270 } 271 272 func (fieldMask *AlertingCondition_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 273 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingCondition_FieldPath)) 274 } 275 276 func (fieldMask *AlertingCondition_FieldMask) GetPaths() []AlertingCondition_FieldPath { 277 if fieldMask == nil { 278 return nil 279 } 280 return fieldMask.Paths 281 } 282 283 func (fieldMask *AlertingCondition_FieldMask) GetRawPaths() []gotenobject.FieldPath { 284 if fieldMask == nil { 285 return nil 286 } 287 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 288 for _, path := range fieldMask.Paths { 289 rawPaths = append(rawPaths, path) 290 } 291 return rawPaths 292 } 293 294 func (fieldMask *AlertingCondition_FieldMask) SetFromCliFlag(raw string) error { 295 path, err := ParseAlertingCondition_FieldPath(raw) 296 if err != nil { 297 return err 298 } 299 fieldMask.Paths = append(fieldMask.Paths, path) 300 return nil 301 } 302 303 func (fieldMask *AlertingCondition_FieldMask) Set(target, source *AlertingCondition) { 304 for _, path := range fieldMask.Paths { 305 val, _ := path.GetSingle(source) 306 // if val is nil, then field does not exist in source, skip 307 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 308 if val != nil { 309 path.WithIValue(val).SetTo(&target) 310 } 311 } 312 } 313 314 func (fieldMask *AlertingCondition_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 315 fieldMask.Set(target.(*AlertingCondition), source.(*AlertingCondition)) 316 } 317 318 func (fieldMask *AlertingCondition_FieldMask) Project(source *AlertingCondition) *AlertingCondition { 319 if source == nil { 320 return nil 321 } 322 if fieldMask == nil { 323 return source 324 } 325 result := &AlertingCondition{} 326 metadataMask := &meta.Meta_FieldMask{} 327 wholeMetadataAccepted := false 328 specMask := &AlertingCondition_Spec_FieldMask{} 329 wholeSpecAccepted := false 330 stateMask := &AlertingCondition_State_FieldMask{} 331 wholeStateAccepted := false 332 333 for _, p := range fieldMask.Paths { 334 switch tp := p.(type) { 335 case *AlertingCondition_FieldTerminalPath: 336 switch tp.selector { 337 case AlertingCondition_FieldPathSelectorName: 338 result.Name = source.Name 339 case AlertingCondition_FieldPathSelectorMetadata: 340 result.Metadata = source.Metadata 341 wholeMetadataAccepted = true 342 case AlertingCondition_FieldPathSelectorDisplayName: 343 result.DisplayName = source.DisplayName 344 case AlertingCondition_FieldPathSelectorDescription: 345 result.Description = source.Description 346 case AlertingCondition_FieldPathSelectorSpec: 347 result.Spec = source.Spec 348 wholeSpecAccepted = true 349 case AlertingCondition_FieldPathSelectorState: 350 result.State = source.State 351 wholeStateAccepted = true 352 } 353 case *AlertingCondition_FieldSubPath: 354 switch tp.selector { 355 case AlertingCondition_FieldPathSelectorMetadata: 356 metadataMask.AppendPath(tp.subPath.(meta.Meta_FieldPath)) 357 case AlertingCondition_FieldPathSelectorSpec: 358 specMask.AppendPath(tp.subPath.(AlertingConditionSpec_FieldPath)) 359 case AlertingCondition_FieldPathSelectorState: 360 stateMask.AppendPath(tp.subPath.(AlertingConditionState_FieldPath)) 361 } 362 } 363 } 364 if wholeMetadataAccepted == false && len(metadataMask.Paths) > 0 { 365 result.Metadata = metadataMask.Project(source.GetMetadata()) 366 } 367 if wholeSpecAccepted == false && len(specMask.Paths) > 0 { 368 result.Spec = specMask.Project(source.GetSpec()) 369 } 370 if wholeStateAccepted == false && len(stateMask.Paths) > 0 { 371 result.State = stateMask.Project(source.GetState()) 372 } 373 return result 374 } 375 376 func (fieldMask *AlertingCondition_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 377 return fieldMask.Project(source.(*AlertingCondition)) 378 } 379 380 func (fieldMask *AlertingCondition_FieldMask) PathsCount() int { 381 if fieldMask == nil { 382 return 0 383 } 384 return len(fieldMask.Paths) 385 } 386 387 type AlertingCondition_Spec_FieldMask struct { 388 Paths []AlertingConditionSpec_FieldPath 389 } 390 391 func FullAlertingCondition_Spec_FieldMask() *AlertingCondition_Spec_FieldMask { 392 res := &AlertingCondition_Spec_FieldMask{} 393 res.Paths = append(res.Paths, &AlertingConditionSpec_FieldTerminalPath{selector: AlertingConditionSpec_FieldPathSelectorTimeSeries}) 394 return res 395 } 396 397 func (fieldMask *AlertingCondition_Spec_FieldMask) String() string { 398 if fieldMask == nil { 399 return "<nil>" 400 } 401 pathsStr := make([]string, 0, len(fieldMask.Paths)) 402 for _, path := range fieldMask.Paths { 403 pathsStr = append(pathsStr, path.String()) 404 } 405 return strings.Join(pathsStr, ", ") 406 } 407 408 func (fieldMask *AlertingCondition_Spec_FieldMask) IsFull() bool { 409 if fieldMask == nil { 410 return false 411 } 412 presentSelectors := make([]bool, 1) 413 for _, path := range fieldMask.Paths { 414 if asFinal, ok := path.(*AlertingConditionSpec_FieldTerminalPath); ok { 415 presentSelectors[int(asFinal.selector)] = true 416 } 417 } 418 for _, flag := range presentSelectors { 419 if !flag { 420 return false 421 } 422 } 423 return true 424 } 425 426 func (fieldMask *AlertingCondition_Spec_FieldMask) ProtoReflect() preflect.Message { 427 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 428 return ParseAlertingConditionSpec_FieldPath(raw) 429 }) 430 } 431 432 func (fieldMask *AlertingCondition_Spec_FieldMask) ProtoMessage() {} 433 434 func (fieldMask *AlertingCondition_Spec_FieldMask) Reset() { 435 if fieldMask != nil { 436 fieldMask.Paths = nil 437 } 438 } 439 440 func (fieldMask *AlertingCondition_Spec_FieldMask) Subtract(other *AlertingCondition_Spec_FieldMask) *AlertingCondition_Spec_FieldMask { 441 result := &AlertingCondition_Spec_FieldMask{} 442 removedSelectors := make([]bool, 1) 443 otherSubMasks := map[AlertingConditionSpec_FieldPathSelector]gotenobject.FieldMask{ 444 AlertingConditionSpec_FieldPathSelectorTimeSeries: &AlertingCondition_Spec_TimeSeries_FieldMask{}, 445 } 446 mySubMasks := map[AlertingConditionSpec_FieldPathSelector]gotenobject.FieldMask{ 447 AlertingConditionSpec_FieldPathSelectorTimeSeries: &AlertingCondition_Spec_TimeSeries_FieldMask{}, 448 } 449 450 for _, path := range other.GetPaths() { 451 switch tp := path.(type) { 452 case *AlertingConditionSpec_FieldTerminalPath: 453 removedSelectors[int(tp.selector)] = true 454 case *AlertingConditionSpec_FieldSubPath: 455 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 456 } 457 } 458 for _, path := range fieldMask.GetPaths() { 459 if !removedSelectors[int(path.Selector())] { 460 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 461 if tp, ok := path.(*AlertingConditionSpec_FieldTerminalPath); ok { 462 switch tp.selector { 463 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 464 mySubMasks[AlertingConditionSpec_FieldPathSelectorTimeSeries] = FullAlertingCondition_Spec_TimeSeries_FieldMask() 465 } 466 } else if tp, ok := path.(*AlertingConditionSpec_FieldSubPath); ok { 467 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 468 } 469 } else { 470 result.Paths = append(result.Paths, path) 471 } 472 } 473 } 474 for selector, mySubMask := range mySubMasks { 475 if mySubMask.PathsCount() > 0 { 476 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 477 result.Paths = append(result.Paths, &AlertingConditionSpec_FieldSubPath{selector: selector, subPath: allowedPath}) 478 } 479 } 480 } 481 482 if len(result.Paths) == 0 { 483 return nil 484 } 485 return result 486 } 487 488 func (fieldMask *AlertingCondition_Spec_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 489 return fieldMask.Subtract(other.(*AlertingCondition_Spec_FieldMask)) 490 } 491 492 // FilterInputFields generates copy of field paths with output_only field paths removed 493 func (fieldMask *AlertingCondition_Spec_FieldMask) FilterInputFields() *AlertingCondition_Spec_FieldMask { 494 result := &AlertingCondition_Spec_FieldMask{} 495 for _, path := range fieldMask.Paths { 496 switch path.Selector() { 497 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 498 if _, ok := path.(*AlertingConditionSpec_FieldTerminalPath); ok { 499 for _, subpath := range FullAlertingCondition_Spec_TimeSeries_FieldMask().FilterInputFields().Paths { 500 result.Paths = append(result.Paths, &AlertingConditionSpec_FieldSubPath{selector: path.Selector(), subPath: subpath}) 501 } 502 } else if sub, ok := path.(*AlertingConditionSpec_FieldSubPath); ok { 503 selectedMask := &AlertingCondition_Spec_TimeSeries_FieldMask{ 504 Paths: []AlertingConditionSpecTimeSeries_FieldPath{sub.subPath.(AlertingConditionSpecTimeSeries_FieldPath)}, 505 } 506 for _, allowedPath := range selectedMask.FilterInputFields().Paths { 507 result.Paths = append(result.Paths, &AlertingConditionSpec_FieldSubPath{selector: AlertingConditionSpec_FieldPathSelectorTimeSeries, subPath: allowedPath}) 508 } 509 } 510 default: 511 result.Paths = append(result.Paths, path) 512 } 513 } 514 return result 515 } 516 517 // ToFieldMask is used for proto conversions 518 func (fieldMask *AlertingCondition_Spec_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 519 protoFieldMask := &googlefieldmaskpb.FieldMask{} 520 for _, path := range fieldMask.Paths { 521 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 522 } 523 return protoFieldMask 524 } 525 526 func (fieldMask *AlertingCondition_Spec_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 527 if fieldMask == nil { 528 return status.Error(codes.Internal, "target field mask is nil") 529 } 530 fieldMask.Paths = make([]AlertingConditionSpec_FieldPath, 0, len(protoFieldMask.Paths)) 531 for _, strPath := range protoFieldMask.Paths { 532 path, err := ParseAlertingConditionSpec_FieldPath(strPath) 533 if err != nil { 534 return err 535 } 536 fieldMask.Paths = append(fieldMask.Paths, path) 537 } 538 return nil 539 } 540 541 // implement methods required by customType 542 func (fieldMask AlertingCondition_Spec_FieldMask) Marshal() ([]byte, error) { 543 protoFieldMask := fieldMask.ToProtoFieldMask() 544 return proto.Marshal(protoFieldMask) 545 } 546 547 func (fieldMask *AlertingCondition_Spec_FieldMask) Unmarshal(data []byte) error { 548 protoFieldMask := &googlefieldmaskpb.FieldMask{} 549 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 550 return err 551 } 552 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 553 return err 554 } 555 return nil 556 } 557 558 func (fieldMask *AlertingCondition_Spec_FieldMask) Size() int { 559 return proto.Size(fieldMask.ToProtoFieldMask()) 560 } 561 562 func (fieldMask AlertingCondition_Spec_FieldMask) MarshalJSON() ([]byte, error) { 563 return json.Marshal(fieldMask.ToProtoFieldMask()) 564 } 565 566 func (fieldMask *AlertingCondition_Spec_FieldMask) UnmarshalJSON(data []byte) error { 567 protoFieldMask := &googlefieldmaskpb.FieldMask{} 568 if err := json.Unmarshal(data, protoFieldMask); err != nil { 569 return err 570 } 571 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 572 return err 573 } 574 return nil 575 } 576 577 func (fieldMask *AlertingCondition_Spec_FieldMask) AppendPath(path AlertingConditionSpec_FieldPath) { 578 fieldMask.Paths = append(fieldMask.Paths, path) 579 } 580 581 func (fieldMask *AlertingCondition_Spec_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 582 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingConditionSpec_FieldPath)) 583 } 584 585 func (fieldMask *AlertingCondition_Spec_FieldMask) GetPaths() []AlertingConditionSpec_FieldPath { 586 if fieldMask == nil { 587 return nil 588 } 589 return fieldMask.Paths 590 } 591 592 func (fieldMask *AlertingCondition_Spec_FieldMask) GetRawPaths() []gotenobject.FieldPath { 593 if fieldMask == nil { 594 return nil 595 } 596 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 597 for _, path := range fieldMask.Paths { 598 rawPaths = append(rawPaths, path) 599 } 600 return rawPaths 601 } 602 603 func (fieldMask *AlertingCondition_Spec_FieldMask) SetFromCliFlag(raw string) error { 604 path, err := ParseAlertingConditionSpec_FieldPath(raw) 605 if err != nil { 606 return err 607 } 608 fieldMask.Paths = append(fieldMask.Paths, path) 609 return nil 610 } 611 612 func (fieldMask *AlertingCondition_Spec_FieldMask) Set(target, source *AlertingCondition_Spec) { 613 for _, path := range fieldMask.Paths { 614 val, _ := path.GetSingle(source) 615 // if val is nil, then field does not exist in source, skip 616 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 617 if val != nil { 618 path.WithIValue(val).SetTo(&target) 619 } 620 } 621 } 622 623 func (fieldMask *AlertingCondition_Spec_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 624 fieldMask.Set(target.(*AlertingCondition_Spec), source.(*AlertingCondition_Spec)) 625 } 626 627 func (fieldMask *AlertingCondition_Spec_FieldMask) Project(source *AlertingCondition_Spec) *AlertingCondition_Spec { 628 if source == nil { 629 return nil 630 } 631 if fieldMask == nil { 632 return source 633 } 634 result := &AlertingCondition_Spec{} 635 timeSeriesMask := &AlertingCondition_Spec_TimeSeries_FieldMask{} 636 wholeTimeSeriesAccepted := false 637 638 for _, p := range fieldMask.Paths { 639 switch tp := p.(type) { 640 case *AlertingConditionSpec_FieldTerminalPath: 641 switch tp.selector { 642 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 643 result.TimeSeries = source.TimeSeries 644 wholeTimeSeriesAccepted = true 645 } 646 case *AlertingConditionSpec_FieldSubPath: 647 switch tp.selector { 648 case AlertingConditionSpec_FieldPathSelectorTimeSeries: 649 timeSeriesMask.AppendPath(tp.subPath.(AlertingConditionSpecTimeSeries_FieldPath)) 650 } 651 } 652 } 653 if wholeTimeSeriesAccepted == false && len(timeSeriesMask.Paths) > 0 { 654 result.TimeSeries = timeSeriesMask.Project(source.GetTimeSeries()) 655 } 656 return result 657 } 658 659 func (fieldMask *AlertingCondition_Spec_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 660 return fieldMask.Project(source.(*AlertingCondition_Spec)) 661 } 662 663 func (fieldMask *AlertingCondition_Spec_FieldMask) PathsCount() int { 664 if fieldMask == nil { 665 return 0 666 } 667 return len(fieldMask.Paths) 668 } 669 670 type AlertingCondition_State_FieldMask struct { 671 Paths []AlertingConditionState_FieldPath 672 } 673 674 func FullAlertingCondition_State_FieldMask() *AlertingCondition_State_FieldMask { 675 res := &AlertingCondition_State_FieldMask{} 676 res.Paths = append(res.Paths, &AlertingConditionState_FieldTerminalPath{selector: AlertingConditionState_FieldPathSelectorFiringAlertsCount}) 677 return res 678 } 679 680 func (fieldMask *AlertingCondition_State_FieldMask) String() string { 681 if fieldMask == nil { 682 return "<nil>" 683 } 684 pathsStr := make([]string, 0, len(fieldMask.Paths)) 685 for _, path := range fieldMask.Paths { 686 pathsStr = append(pathsStr, path.String()) 687 } 688 return strings.Join(pathsStr, ", ") 689 } 690 691 func (fieldMask *AlertingCondition_State_FieldMask) IsFull() bool { 692 if fieldMask == nil { 693 return false 694 } 695 presentSelectors := make([]bool, 1) 696 for _, path := range fieldMask.Paths { 697 if asFinal, ok := path.(*AlertingConditionState_FieldTerminalPath); ok { 698 presentSelectors[int(asFinal.selector)] = true 699 } 700 } 701 for _, flag := range presentSelectors { 702 if !flag { 703 return false 704 } 705 } 706 return true 707 } 708 709 func (fieldMask *AlertingCondition_State_FieldMask) ProtoReflect() preflect.Message { 710 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 711 return ParseAlertingConditionState_FieldPath(raw) 712 }) 713 } 714 715 func (fieldMask *AlertingCondition_State_FieldMask) ProtoMessage() {} 716 717 func (fieldMask *AlertingCondition_State_FieldMask) Reset() { 718 if fieldMask != nil { 719 fieldMask.Paths = nil 720 } 721 } 722 723 func (fieldMask *AlertingCondition_State_FieldMask) Subtract(other *AlertingCondition_State_FieldMask) *AlertingCondition_State_FieldMask { 724 result := &AlertingCondition_State_FieldMask{} 725 removedSelectors := make([]bool, 1) 726 727 for _, path := range other.GetPaths() { 728 switch tp := path.(type) { 729 case *AlertingConditionState_FieldTerminalPath: 730 removedSelectors[int(tp.selector)] = true 731 } 732 } 733 for _, path := range fieldMask.GetPaths() { 734 if !removedSelectors[int(path.Selector())] { 735 result.Paths = append(result.Paths, path) 736 } 737 } 738 739 if len(result.Paths) == 0 { 740 return nil 741 } 742 return result 743 } 744 745 func (fieldMask *AlertingCondition_State_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 746 return fieldMask.Subtract(other.(*AlertingCondition_State_FieldMask)) 747 } 748 749 // FilterInputFields generates copy of field paths with output_only field paths removed 750 func (fieldMask *AlertingCondition_State_FieldMask) FilterInputFields() *AlertingCondition_State_FieldMask { 751 result := &AlertingCondition_State_FieldMask{} 752 result.Paths = append(result.Paths, fieldMask.Paths...) 753 return result 754 } 755 756 // ToFieldMask is used for proto conversions 757 func (fieldMask *AlertingCondition_State_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 758 protoFieldMask := &googlefieldmaskpb.FieldMask{} 759 for _, path := range fieldMask.Paths { 760 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 761 } 762 return protoFieldMask 763 } 764 765 func (fieldMask *AlertingCondition_State_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 766 if fieldMask == nil { 767 return status.Error(codes.Internal, "target field mask is nil") 768 } 769 fieldMask.Paths = make([]AlertingConditionState_FieldPath, 0, len(protoFieldMask.Paths)) 770 for _, strPath := range protoFieldMask.Paths { 771 path, err := ParseAlertingConditionState_FieldPath(strPath) 772 if err != nil { 773 return err 774 } 775 fieldMask.Paths = append(fieldMask.Paths, path) 776 } 777 return nil 778 } 779 780 // implement methods required by customType 781 func (fieldMask AlertingCondition_State_FieldMask) Marshal() ([]byte, error) { 782 protoFieldMask := fieldMask.ToProtoFieldMask() 783 return proto.Marshal(protoFieldMask) 784 } 785 786 func (fieldMask *AlertingCondition_State_FieldMask) Unmarshal(data []byte) error { 787 protoFieldMask := &googlefieldmaskpb.FieldMask{} 788 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 789 return err 790 } 791 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 792 return err 793 } 794 return nil 795 } 796 797 func (fieldMask *AlertingCondition_State_FieldMask) Size() int { 798 return proto.Size(fieldMask.ToProtoFieldMask()) 799 } 800 801 func (fieldMask AlertingCondition_State_FieldMask) MarshalJSON() ([]byte, error) { 802 return json.Marshal(fieldMask.ToProtoFieldMask()) 803 } 804 805 func (fieldMask *AlertingCondition_State_FieldMask) UnmarshalJSON(data []byte) error { 806 protoFieldMask := &googlefieldmaskpb.FieldMask{} 807 if err := json.Unmarshal(data, protoFieldMask); err != nil { 808 return err 809 } 810 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 811 return err 812 } 813 return nil 814 } 815 816 func (fieldMask *AlertingCondition_State_FieldMask) AppendPath(path AlertingConditionState_FieldPath) { 817 fieldMask.Paths = append(fieldMask.Paths, path) 818 } 819 820 func (fieldMask *AlertingCondition_State_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 821 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingConditionState_FieldPath)) 822 } 823 824 func (fieldMask *AlertingCondition_State_FieldMask) GetPaths() []AlertingConditionState_FieldPath { 825 if fieldMask == nil { 826 return nil 827 } 828 return fieldMask.Paths 829 } 830 831 func (fieldMask *AlertingCondition_State_FieldMask) GetRawPaths() []gotenobject.FieldPath { 832 if fieldMask == nil { 833 return nil 834 } 835 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 836 for _, path := range fieldMask.Paths { 837 rawPaths = append(rawPaths, path) 838 } 839 return rawPaths 840 } 841 842 func (fieldMask *AlertingCondition_State_FieldMask) SetFromCliFlag(raw string) error { 843 path, err := ParseAlertingConditionState_FieldPath(raw) 844 if err != nil { 845 return err 846 } 847 fieldMask.Paths = append(fieldMask.Paths, path) 848 return nil 849 } 850 851 func (fieldMask *AlertingCondition_State_FieldMask) Set(target, source *AlertingCondition_State) { 852 for _, path := range fieldMask.Paths { 853 val, _ := path.GetSingle(source) 854 // if val is nil, then field does not exist in source, skip 855 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 856 if val != nil { 857 path.WithIValue(val).SetTo(&target) 858 } 859 } 860 } 861 862 func (fieldMask *AlertingCondition_State_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 863 fieldMask.Set(target.(*AlertingCondition_State), source.(*AlertingCondition_State)) 864 } 865 866 func (fieldMask *AlertingCondition_State_FieldMask) Project(source *AlertingCondition_State) *AlertingCondition_State { 867 if source == nil { 868 return nil 869 } 870 if fieldMask == nil { 871 return source 872 } 873 result := &AlertingCondition_State{} 874 875 for _, p := range fieldMask.Paths { 876 switch tp := p.(type) { 877 case *AlertingConditionState_FieldTerminalPath: 878 switch tp.selector { 879 case AlertingConditionState_FieldPathSelectorFiringAlertsCount: 880 result.FiringAlertsCount = source.FiringAlertsCount 881 } 882 } 883 } 884 return result 885 } 886 887 func (fieldMask *AlertingCondition_State_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 888 return fieldMask.Project(source.(*AlertingCondition_State)) 889 } 890 891 func (fieldMask *AlertingCondition_State_FieldMask) PathsCount() int { 892 if fieldMask == nil { 893 return 0 894 } 895 return len(fieldMask.Paths) 896 } 897 898 type AlertingCondition_Spec_TimeSeries_FieldMask struct { 899 Paths []AlertingConditionSpecTimeSeries_FieldPath 900 } 901 902 func FullAlertingCondition_Spec_TimeSeries_FieldMask() *AlertingCondition_Spec_TimeSeries_FieldMask { 903 res := &AlertingCondition_Spec_TimeSeries_FieldMask{} 904 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorQuery}) 905 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold}) 906 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold}) 907 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeries_FieldTerminalPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorDuration}) 908 return res 909 } 910 911 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) String() string { 912 if fieldMask == nil { 913 return "<nil>" 914 } 915 pathsStr := make([]string, 0, len(fieldMask.Paths)) 916 for _, path := range fieldMask.Paths { 917 pathsStr = append(pathsStr, path.String()) 918 } 919 return strings.Join(pathsStr, ", ") 920 } 921 922 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) IsFull() bool { 923 if fieldMask == nil { 924 return false 925 } 926 presentSelectors := make([]bool, 4) 927 for _, path := range fieldMask.Paths { 928 if asFinal, ok := path.(*AlertingConditionSpecTimeSeries_FieldTerminalPath); ok { 929 presentSelectors[int(asFinal.selector)] = true 930 } 931 } 932 for _, flag := range presentSelectors { 933 if !flag { 934 return false 935 } 936 } 937 return true 938 } 939 940 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) ProtoReflect() preflect.Message { 941 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 942 return ParseAlertingConditionSpecTimeSeries_FieldPath(raw) 943 }) 944 } 945 946 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) ProtoMessage() {} 947 948 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) Reset() { 949 if fieldMask != nil { 950 fieldMask.Paths = nil 951 } 952 } 953 954 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) Subtract(other *AlertingCondition_Spec_TimeSeries_FieldMask) *AlertingCondition_Spec_TimeSeries_FieldMask { 955 result := &AlertingCondition_Spec_TimeSeries_FieldMask{} 956 removedSelectors := make([]bool, 4) 957 otherSubMasks := map[AlertingConditionSpecTimeSeries_FieldPathSelector]gotenobject.FieldMask{ 958 AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: &AlertingCondition_Spec_TimeSeries_Query_FieldMask{}, 959 AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: &AlertingCondition_Spec_TimeSeries_Threshold_FieldMask{}, 960 AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: &AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask{}, 961 } 962 mySubMasks := map[AlertingConditionSpecTimeSeries_FieldPathSelector]gotenobject.FieldMask{ 963 AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: &AlertingCondition_Spec_TimeSeries_Query_FieldMask{}, 964 AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: &AlertingCondition_Spec_TimeSeries_Threshold_FieldMask{}, 965 AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: &AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask{}, 966 } 967 968 for _, path := range other.GetPaths() { 969 switch tp := path.(type) { 970 case *AlertingConditionSpecTimeSeries_FieldTerminalPath: 971 removedSelectors[int(tp.selector)] = true 972 case *AlertingConditionSpecTimeSeries_FieldSubPath: 973 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 974 } 975 } 976 for _, path := range fieldMask.GetPaths() { 977 if !removedSelectors[int(path.Selector())] { 978 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 979 if tp, ok := path.(*AlertingConditionSpecTimeSeries_FieldTerminalPath); ok { 980 switch tp.selector { 981 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 982 mySubMasks[AlertingConditionSpecTimeSeries_FieldPathSelectorQuery] = FullAlertingCondition_Spec_TimeSeries_Query_FieldMask() 983 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 984 mySubMasks[AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold] = FullAlertingCondition_Spec_TimeSeries_Threshold_FieldMask() 985 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 986 mySubMasks[AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold] = FullAlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask() 987 } 988 } else if tp, ok := path.(*AlertingConditionSpecTimeSeries_FieldSubPath); ok { 989 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 990 } 991 } else { 992 result.Paths = append(result.Paths, path) 993 } 994 } 995 } 996 for selector, mySubMask := range mySubMasks { 997 if mySubMask.PathsCount() > 0 { 998 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 999 result.Paths = append(result.Paths, &AlertingConditionSpecTimeSeries_FieldSubPath{selector: selector, subPath: allowedPath}) 1000 } 1001 } 1002 } 1003 1004 if len(result.Paths) == 0 { 1005 return nil 1006 } 1007 return result 1008 } 1009 1010 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1011 return fieldMask.Subtract(other.(*AlertingCondition_Spec_TimeSeries_FieldMask)) 1012 } 1013 1014 // FilterInputFields generates copy of field paths with output_only field paths removed 1015 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) FilterInputFields() *AlertingCondition_Spec_TimeSeries_FieldMask { 1016 result := &AlertingCondition_Spec_TimeSeries_FieldMask{} 1017 for _, path := range fieldMask.Paths { 1018 switch path.Selector() { 1019 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 1020 if _, ok := path.(*AlertingConditionSpecTimeSeries_FieldTerminalPath); ok { 1021 for _, subpath := range FullAlertingCondition_Spec_TimeSeries_Query_FieldMask().FilterInputFields().Paths { 1022 result.Paths = append(result.Paths, &AlertingConditionSpecTimeSeries_FieldSubPath{selector: path.Selector(), subPath: subpath}) 1023 } 1024 } else if sub, ok := path.(*AlertingConditionSpecTimeSeries_FieldSubPath); ok { 1025 selectedMask := &AlertingCondition_Spec_TimeSeries_Query_FieldMask{ 1026 Paths: []AlertingConditionSpecTimeSeriesQuery_FieldPath{sub.subPath.(AlertingConditionSpecTimeSeriesQuery_FieldPath)}, 1027 } 1028 for _, allowedPath := range selectedMask.FilterInputFields().Paths { 1029 result.Paths = append(result.Paths, &AlertingConditionSpecTimeSeries_FieldSubPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorQuery, subPath: allowedPath}) 1030 } 1031 } 1032 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 1033 if _, ok := path.(*AlertingConditionSpecTimeSeries_FieldTerminalPath); ok { 1034 for _, subpath := range FullAlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask().FilterInputFields().Paths { 1035 result.Paths = append(result.Paths, &AlertingConditionSpecTimeSeries_FieldSubPath{selector: path.Selector(), subPath: subpath}) 1036 } 1037 } else if sub, ok := path.(*AlertingConditionSpecTimeSeries_FieldSubPath); ok { 1038 selectedMask := &AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask{ 1039 Paths: []AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath{sub.subPath.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath)}, 1040 } 1041 for _, allowedPath := range selectedMask.FilterInputFields().Paths { 1042 result.Paths = append(result.Paths, &AlertingConditionSpecTimeSeries_FieldSubPath{selector: AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold, subPath: allowedPath}) 1043 } 1044 } 1045 default: 1046 result.Paths = append(result.Paths, path) 1047 } 1048 } 1049 return result 1050 } 1051 1052 // ToFieldMask is used for proto conversions 1053 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1054 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1055 for _, path := range fieldMask.Paths { 1056 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1057 } 1058 return protoFieldMask 1059 } 1060 1061 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1062 if fieldMask == nil { 1063 return status.Error(codes.Internal, "target field mask is nil") 1064 } 1065 fieldMask.Paths = make([]AlertingConditionSpecTimeSeries_FieldPath, 0, len(protoFieldMask.Paths)) 1066 for _, strPath := range protoFieldMask.Paths { 1067 path, err := ParseAlertingConditionSpecTimeSeries_FieldPath(strPath) 1068 if err != nil { 1069 return err 1070 } 1071 fieldMask.Paths = append(fieldMask.Paths, path) 1072 } 1073 return nil 1074 } 1075 1076 // implement methods required by customType 1077 func (fieldMask AlertingCondition_Spec_TimeSeries_FieldMask) Marshal() ([]byte, error) { 1078 protoFieldMask := fieldMask.ToProtoFieldMask() 1079 return proto.Marshal(protoFieldMask) 1080 } 1081 1082 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) Unmarshal(data []byte) error { 1083 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1084 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1085 return err 1086 } 1087 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1088 return err 1089 } 1090 return nil 1091 } 1092 1093 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) Size() int { 1094 return proto.Size(fieldMask.ToProtoFieldMask()) 1095 } 1096 1097 func (fieldMask AlertingCondition_Spec_TimeSeries_FieldMask) MarshalJSON() ([]byte, error) { 1098 return json.Marshal(fieldMask.ToProtoFieldMask()) 1099 } 1100 1101 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) UnmarshalJSON(data []byte) error { 1102 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1103 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1104 return err 1105 } 1106 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1107 return err 1108 } 1109 return nil 1110 } 1111 1112 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) AppendPath(path AlertingConditionSpecTimeSeries_FieldPath) { 1113 fieldMask.Paths = append(fieldMask.Paths, path) 1114 } 1115 1116 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1117 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingConditionSpecTimeSeries_FieldPath)) 1118 } 1119 1120 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) GetPaths() []AlertingConditionSpecTimeSeries_FieldPath { 1121 if fieldMask == nil { 1122 return nil 1123 } 1124 return fieldMask.Paths 1125 } 1126 1127 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1128 if fieldMask == nil { 1129 return nil 1130 } 1131 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1132 for _, path := range fieldMask.Paths { 1133 rawPaths = append(rawPaths, path) 1134 } 1135 return rawPaths 1136 } 1137 1138 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) SetFromCliFlag(raw string) error { 1139 path, err := ParseAlertingConditionSpecTimeSeries_FieldPath(raw) 1140 if err != nil { 1141 return err 1142 } 1143 fieldMask.Paths = append(fieldMask.Paths, path) 1144 return nil 1145 } 1146 1147 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) Set(target, source *AlertingCondition_Spec_TimeSeries) { 1148 for _, path := range fieldMask.Paths { 1149 val, _ := path.GetSingle(source) 1150 // if val is nil, then field does not exist in source, skip 1151 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1152 if val != nil { 1153 path.WithIValue(val).SetTo(&target) 1154 } 1155 } 1156 } 1157 1158 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1159 fieldMask.Set(target.(*AlertingCondition_Spec_TimeSeries), source.(*AlertingCondition_Spec_TimeSeries)) 1160 } 1161 1162 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) Project(source *AlertingCondition_Spec_TimeSeries) *AlertingCondition_Spec_TimeSeries { 1163 if source == nil { 1164 return nil 1165 } 1166 if fieldMask == nil { 1167 return source 1168 } 1169 result := &AlertingCondition_Spec_TimeSeries{} 1170 queryMask := &AlertingCondition_Spec_TimeSeries_Query_FieldMask{} 1171 wholeQueryAccepted := false 1172 thresholdMask := &AlertingCondition_Spec_TimeSeries_Threshold_FieldMask{} 1173 wholeThresholdAccepted := false 1174 combineThresholdMask := &AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask{} 1175 wholeCombineThresholdAccepted := false 1176 1177 for _, p := range fieldMask.Paths { 1178 switch tp := p.(type) { 1179 case *AlertingConditionSpecTimeSeries_FieldTerminalPath: 1180 switch tp.selector { 1181 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 1182 result.Query = source.Query 1183 wholeQueryAccepted = true 1184 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 1185 result.Threshold = source.Threshold 1186 wholeThresholdAccepted = true 1187 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 1188 result.CombineThreshold = source.CombineThreshold 1189 wholeCombineThresholdAccepted = true 1190 case AlertingConditionSpecTimeSeries_FieldPathSelectorDuration: 1191 result.Duration = source.Duration 1192 } 1193 case *AlertingConditionSpecTimeSeries_FieldSubPath: 1194 switch tp.selector { 1195 case AlertingConditionSpecTimeSeries_FieldPathSelectorQuery: 1196 queryMask.AppendPath(tp.subPath.(AlertingConditionSpecTimeSeriesQuery_FieldPath)) 1197 case AlertingConditionSpecTimeSeries_FieldPathSelectorThreshold: 1198 thresholdMask.AppendPath(tp.subPath.(AlertingConditionSpecTimeSeriesThreshold_FieldPath)) 1199 case AlertingConditionSpecTimeSeries_FieldPathSelectorCombineThreshold: 1200 combineThresholdMask.AppendPath(tp.subPath.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath)) 1201 } 1202 } 1203 } 1204 if wholeQueryAccepted == false && len(queryMask.Paths) > 0 { 1205 result.Query = queryMask.Project(source.GetQuery()) 1206 } 1207 if wholeThresholdAccepted == false && len(thresholdMask.Paths) > 0 { 1208 result.Threshold = thresholdMask.Project(source.GetThreshold()) 1209 } 1210 if wholeCombineThresholdAccepted == false && len(combineThresholdMask.Paths) > 0 { 1211 result.CombineThreshold = combineThresholdMask.Project(source.GetCombineThreshold()) 1212 } 1213 return result 1214 } 1215 1216 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1217 return fieldMask.Project(source.(*AlertingCondition_Spec_TimeSeries)) 1218 } 1219 1220 func (fieldMask *AlertingCondition_Spec_TimeSeries_FieldMask) PathsCount() int { 1221 if fieldMask == nil { 1222 return 0 1223 } 1224 return len(fieldMask.Paths) 1225 } 1226 1227 type AlertingCondition_Spec_TimeSeries_Query_FieldMask struct { 1228 Paths []AlertingConditionSpecTimeSeriesQuery_FieldPath 1229 } 1230 1231 func FullAlertingCondition_Spec_TimeSeries_Query_FieldMask() *AlertingCondition_Spec_TimeSeries_Query_FieldMask { 1232 res := &AlertingCondition_Spec_TimeSeries_Query_FieldMask{} 1233 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter}) 1234 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector}) 1235 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation}) 1236 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations}) 1237 return res 1238 } 1239 1240 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) String() string { 1241 if fieldMask == nil { 1242 return "<nil>" 1243 } 1244 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1245 for _, path := range fieldMask.Paths { 1246 pathsStr = append(pathsStr, path.String()) 1247 } 1248 return strings.Join(pathsStr, ", ") 1249 } 1250 1251 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) IsFull() bool { 1252 if fieldMask == nil { 1253 return false 1254 } 1255 presentSelectors := make([]bool, 4) 1256 for _, path := range fieldMask.Paths { 1257 if asFinal, ok := path.(*AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath); ok { 1258 presentSelectors[int(asFinal.selector)] = true 1259 } 1260 } 1261 for _, flag := range presentSelectors { 1262 if !flag { 1263 return false 1264 } 1265 } 1266 return true 1267 } 1268 1269 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) ProtoReflect() preflect.Message { 1270 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1271 return ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(raw) 1272 }) 1273 } 1274 1275 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) ProtoMessage() {} 1276 1277 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) Reset() { 1278 if fieldMask != nil { 1279 fieldMask.Paths = nil 1280 } 1281 } 1282 1283 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) Subtract(other *AlertingCondition_Spec_TimeSeries_Query_FieldMask) *AlertingCondition_Spec_TimeSeries_Query_FieldMask { 1284 result := &AlertingCondition_Spec_TimeSeries_Query_FieldMask{} 1285 removedSelectors := make([]bool, 4) 1286 otherSubMasks := map[AlertingConditionSpecTimeSeriesQuery_FieldPathSelector]gotenobject.FieldMask{ 1287 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: &common.TimeSeriesSelector_FieldMask{}, 1288 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: &common.Aggregation_FieldMask{}, 1289 } 1290 mySubMasks := map[AlertingConditionSpecTimeSeriesQuery_FieldPathSelector]gotenobject.FieldMask{ 1291 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: &common.TimeSeriesSelector_FieldMask{}, 1292 AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: &common.Aggregation_FieldMask{}, 1293 } 1294 1295 for _, path := range other.GetPaths() { 1296 switch tp := path.(type) { 1297 case *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: 1298 removedSelectors[int(tp.selector)] = true 1299 case *AlertingConditionSpecTimeSeriesQuery_FieldSubPath: 1300 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1301 } 1302 } 1303 for _, path := range fieldMask.GetPaths() { 1304 if !removedSelectors[int(path.Selector())] { 1305 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1306 if tp, ok := path.(*AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath); ok { 1307 switch tp.selector { 1308 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 1309 mySubMasks[AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector] = common.FullTimeSeriesSelector_FieldMask() 1310 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 1311 mySubMasks[AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation] = common.FullAggregation_FieldMask() 1312 } 1313 } else if tp, ok := path.(*AlertingConditionSpecTimeSeriesQuery_FieldSubPath); ok { 1314 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1315 } 1316 } else { 1317 result.Paths = append(result.Paths, path) 1318 } 1319 } 1320 } 1321 for selector, mySubMask := range mySubMasks { 1322 if mySubMask.PathsCount() > 0 { 1323 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1324 result.Paths = append(result.Paths, &AlertingConditionSpecTimeSeriesQuery_FieldSubPath{selector: selector, subPath: allowedPath}) 1325 } 1326 } 1327 } 1328 1329 if len(result.Paths) == 0 { 1330 return nil 1331 } 1332 return result 1333 } 1334 1335 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1336 return fieldMask.Subtract(other.(*AlertingCondition_Spec_TimeSeries_Query_FieldMask)) 1337 } 1338 1339 // FilterInputFields generates copy of field paths with output_only field paths removed 1340 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) FilterInputFields() *AlertingCondition_Spec_TimeSeries_Query_FieldMask { 1341 result := &AlertingCondition_Spec_TimeSeries_Query_FieldMask{} 1342 for _, path := range fieldMask.Paths { 1343 switch path.Selector() { 1344 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 1345 default: 1346 result.Paths = append(result.Paths, path) 1347 } 1348 } 1349 return result 1350 } 1351 1352 // ToFieldMask is used for proto conversions 1353 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1354 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1355 for _, path := range fieldMask.Paths { 1356 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1357 } 1358 return protoFieldMask 1359 } 1360 1361 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1362 if fieldMask == nil { 1363 return status.Error(codes.Internal, "target field mask is nil") 1364 } 1365 fieldMask.Paths = make([]AlertingConditionSpecTimeSeriesQuery_FieldPath, 0, len(protoFieldMask.Paths)) 1366 for _, strPath := range protoFieldMask.Paths { 1367 path, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(strPath) 1368 if err != nil { 1369 return err 1370 } 1371 fieldMask.Paths = append(fieldMask.Paths, path) 1372 } 1373 return nil 1374 } 1375 1376 // implement methods required by customType 1377 func (fieldMask AlertingCondition_Spec_TimeSeries_Query_FieldMask) Marshal() ([]byte, error) { 1378 protoFieldMask := fieldMask.ToProtoFieldMask() 1379 return proto.Marshal(protoFieldMask) 1380 } 1381 1382 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) Unmarshal(data []byte) error { 1383 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1384 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1385 return err 1386 } 1387 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1388 return err 1389 } 1390 return nil 1391 } 1392 1393 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) Size() int { 1394 return proto.Size(fieldMask.ToProtoFieldMask()) 1395 } 1396 1397 func (fieldMask AlertingCondition_Spec_TimeSeries_Query_FieldMask) MarshalJSON() ([]byte, error) { 1398 return json.Marshal(fieldMask.ToProtoFieldMask()) 1399 } 1400 1401 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) UnmarshalJSON(data []byte) error { 1402 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1403 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1404 return err 1405 } 1406 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1407 return err 1408 } 1409 return nil 1410 } 1411 1412 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) AppendPath(path AlertingConditionSpecTimeSeriesQuery_FieldPath) { 1413 fieldMask.Paths = append(fieldMask.Paths, path) 1414 } 1415 1416 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1417 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingConditionSpecTimeSeriesQuery_FieldPath)) 1418 } 1419 1420 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) GetPaths() []AlertingConditionSpecTimeSeriesQuery_FieldPath { 1421 if fieldMask == nil { 1422 return nil 1423 } 1424 return fieldMask.Paths 1425 } 1426 1427 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1428 if fieldMask == nil { 1429 return nil 1430 } 1431 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1432 for _, path := range fieldMask.Paths { 1433 rawPaths = append(rawPaths, path) 1434 } 1435 return rawPaths 1436 } 1437 1438 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) SetFromCliFlag(raw string) error { 1439 path, err := ParseAlertingConditionSpecTimeSeriesQuery_FieldPath(raw) 1440 if err != nil { 1441 return err 1442 } 1443 fieldMask.Paths = append(fieldMask.Paths, path) 1444 return nil 1445 } 1446 1447 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) Set(target, source *AlertingCondition_Spec_TimeSeries_Query) { 1448 for _, path := range fieldMask.Paths { 1449 val, _ := path.GetSingle(source) 1450 // if val is nil, then field does not exist in source, skip 1451 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1452 if val != nil { 1453 path.WithIValue(val).SetTo(&target) 1454 } 1455 } 1456 } 1457 1458 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1459 fieldMask.Set(target.(*AlertingCondition_Spec_TimeSeries_Query), source.(*AlertingCondition_Spec_TimeSeries_Query)) 1460 } 1461 1462 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) Project(source *AlertingCondition_Spec_TimeSeries_Query) *AlertingCondition_Spec_TimeSeries_Query { 1463 if source == nil { 1464 return nil 1465 } 1466 if fieldMask == nil { 1467 return source 1468 } 1469 result := &AlertingCondition_Spec_TimeSeries_Query{} 1470 selectorMask := &common.TimeSeriesSelector_FieldMask{} 1471 wholeSelectorAccepted := false 1472 aggregationMask := &common.Aggregation_FieldMask{} 1473 wholeAggregationAccepted := false 1474 var perMetricAggregationsMapKeys []string 1475 wholePerMetricAggregationsAccepted := false 1476 1477 for _, p := range fieldMask.Paths { 1478 switch tp := p.(type) { 1479 case *AlertingConditionSpecTimeSeriesQuery_FieldTerminalPath: 1480 switch tp.selector { 1481 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorFilter: 1482 result.Filter = source.Filter 1483 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 1484 result.Selector = source.Selector 1485 wholeSelectorAccepted = true 1486 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 1487 result.Aggregation = source.Aggregation 1488 wholeAggregationAccepted = true 1489 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 1490 result.PerMetricAggregations = source.PerMetricAggregations 1491 wholePerMetricAggregationsAccepted = true 1492 } 1493 case *AlertingConditionSpecTimeSeriesQuery_FieldSubPath: 1494 switch tp.selector { 1495 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorSelector: 1496 selectorMask.AppendPath(tp.subPath.(common.TimeSeriesSelector_FieldPath)) 1497 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorAggregation: 1498 aggregationMask.AppendPath(tp.subPath.(common.Aggregation_FieldPath)) 1499 } 1500 case *AlertingConditionSpecTimeSeriesQuery_FieldPathMap: 1501 switch tp.selector { 1502 case AlertingConditionSpecTimeSeriesQuery_FieldPathSelectorPerMetricAggregations: 1503 perMetricAggregationsMapKeys = append(perMetricAggregationsMapKeys, tp.key) 1504 } 1505 } 1506 } 1507 if wholeSelectorAccepted == false && len(selectorMask.Paths) > 0 { 1508 result.Selector = selectorMask.Project(source.GetSelector()) 1509 } 1510 if wholeAggregationAccepted == false && len(aggregationMask.Paths) > 0 { 1511 result.Aggregation = aggregationMask.Project(source.GetAggregation()) 1512 } 1513 if wholePerMetricAggregationsAccepted == false && len(perMetricAggregationsMapKeys) > 0 && source.GetPerMetricAggregations() != nil { 1514 copiedMap := map[string]*common.Aggregation{} 1515 sourceMap := source.GetPerMetricAggregations() 1516 for _, key := range perMetricAggregationsMapKeys { 1517 copiedMap[key] = sourceMap[key] 1518 } 1519 result.PerMetricAggregations = copiedMap 1520 } 1521 return result 1522 } 1523 1524 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1525 return fieldMask.Project(source.(*AlertingCondition_Spec_TimeSeries_Query)) 1526 } 1527 1528 func (fieldMask *AlertingCondition_Spec_TimeSeries_Query_FieldMask) PathsCount() int { 1529 if fieldMask == nil { 1530 return 0 1531 } 1532 return len(fieldMask.Paths) 1533 } 1534 1535 type AlertingCondition_Spec_TimeSeries_Threshold_FieldMask struct { 1536 Paths []AlertingConditionSpecTimeSeriesThreshold_FieldPath 1537 } 1538 1539 func FullAlertingCondition_Spec_TimeSeries_Threshold_FieldMask() *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask { 1540 res := &AlertingCondition_Spec_TimeSeries_Threshold_FieldMask{} 1541 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare}) 1542 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue}) 1543 return res 1544 } 1545 1546 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) String() string { 1547 if fieldMask == nil { 1548 return "<nil>" 1549 } 1550 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1551 for _, path := range fieldMask.Paths { 1552 pathsStr = append(pathsStr, path.String()) 1553 } 1554 return strings.Join(pathsStr, ", ") 1555 } 1556 1557 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) IsFull() bool { 1558 if fieldMask == nil { 1559 return false 1560 } 1561 presentSelectors := make([]bool, 2) 1562 for _, path := range fieldMask.Paths { 1563 if asFinal, ok := path.(*AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath); ok { 1564 presentSelectors[int(asFinal.selector)] = true 1565 } 1566 } 1567 for _, flag := range presentSelectors { 1568 if !flag { 1569 return false 1570 } 1571 } 1572 return true 1573 } 1574 1575 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) ProtoReflect() preflect.Message { 1576 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1577 return ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(raw) 1578 }) 1579 } 1580 1581 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) ProtoMessage() {} 1582 1583 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) Reset() { 1584 if fieldMask != nil { 1585 fieldMask.Paths = nil 1586 } 1587 } 1588 1589 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) Subtract(other *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask { 1590 result := &AlertingCondition_Spec_TimeSeries_Threshold_FieldMask{} 1591 removedSelectors := make([]bool, 2) 1592 1593 for _, path := range other.GetPaths() { 1594 switch tp := path.(type) { 1595 case *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath: 1596 removedSelectors[int(tp.selector)] = true 1597 } 1598 } 1599 for _, path := range fieldMask.GetPaths() { 1600 if !removedSelectors[int(path.Selector())] { 1601 result.Paths = append(result.Paths, path) 1602 } 1603 } 1604 1605 if len(result.Paths) == 0 { 1606 return nil 1607 } 1608 return result 1609 } 1610 1611 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1612 return fieldMask.Subtract(other.(*AlertingCondition_Spec_TimeSeries_Threshold_FieldMask)) 1613 } 1614 1615 // FilterInputFields generates copy of field paths with output_only field paths removed 1616 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) FilterInputFields() *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask { 1617 result := &AlertingCondition_Spec_TimeSeries_Threshold_FieldMask{} 1618 result.Paths = append(result.Paths, fieldMask.Paths...) 1619 return result 1620 } 1621 1622 // ToFieldMask is used for proto conversions 1623 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1624 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1625 for _, path := range fieldMask.Paths { 1626 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1627 } 1628 return protoFieldMask 1629 } 1630 1631 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1632 if fieldMask == nil { 1633 return status.Error(codes.Internal, "target field mask is nil") 1634 } 1635 fieldMask.Paths = make([]AlertingConditionSpecTimeSeriesThreshold_FieldPath, 0, len(protoFieldMask.Paths)) 1636 for _, strPath := range protoFieldMask.Paths { 1637 path, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(strPath) 1638 if err != nil { 1639 return err 1640 } 1641 fieldMask.Paths = append(fieldMask.Paths, path) 1642 } 1643 return nil 1644 } 1645 1646 // implement methods required by customType 1647 func (fieldMask AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) Marshal() ([]byte, error) { 1648 protoFieldMask := fieldMask.ToProtoFieldMask() 1649 return proto.Marshal(protoFieldMask) 1650 } 1651 1652 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) Unmarshal(data []byte) error { 1653 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1654 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1655 return err 1656 } 1657 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1658 return err 1659 } 1660 return nil 1661 } 1662 1663 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) Size() int { 1664 return proto.Size(fieldMask.ToProtoFieldMask()) 1665 } 1666 1667 func (fieldMask AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) MarshalJSON() ([]byte, error) { 1668 return json.Marshal(fieldMask.ToProtoFieldMask()) 1669 } 1670 1671 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) UnmarshalJSON(data []byte) error { 1672 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1673 if err := json.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 *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) AppendPath(path AlertingConditionSpecTimeSeriesThreshold_FieldPath) { 1683 fieldMask.Paths = append(fieldMask.Paths, path) 1684 } 1685 1686 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1687 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingConditionSpecTimeSeriesThreshold_FieldPath)) 1688 } 1689 1690 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) GetPaths() []AlertingConditionSpecTimeSeriesThreshold_FieldPath { 1691 if fieldMask == nil { 1692 return nil 1693 } 1694 return fieldMask.Paths 1695 } 1696 1697 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1698 if fieldMask == nil { 1699 return nil 1700 } 1701 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1702 for _, path := range fieldMask.Paths { 1703 rawPaths = append(rawPaths, path) 1704 } 1705 return rawPaths 1706 } 1707 1708 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) SetFromCliFlag(raw string) error { 1709 path, err := ParseAlertingConditionSpecTimeSeriesThreshold_FieldPath(raw) 1710 if err != nil { 1711 return err 1712 } 1713 fieldMask.Paths = append(fieldMask.Paths, path) 1714 return nil 1715 } 1716 1717 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) Set(target, source *AlertingCondition_Spec_TimeSeries_Threshold) { 1718 for _, path := range fieldMask.Paths { 1719 val, _ := path.GetSingle(source) 1720 // if val is nil, then field does not exist in source, skip 1721 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1722 if val != nil { 1723 path.WithIValue(val).SetTo(&target) 1724 } 1725 } 1726 } 1727 1728 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1729 fieldMask.Set(target.(*AlertingCondition_Spec_TimeSeries_Threshold), source.(*AlertingCondition_Spec_TimeSeries_Threshold)) 1730 } 1731 1732 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) Project(source *AlertingCondition_Spec_TimeSeries_Threshold) *AlertingCondition_Spec_TimeSeries_Threshold { 1733 if source == nil { 1734 return nil 1735 } 1736 if fieldMask == nil { 1737 return source 1738 } 1739 result := &AlertingCondition_Spec_TimeSeries_Threshold{} 1740 1741 for _, p := range fieldMask.Paths { 1742 switch tp := p.(type) { 1743 case *AlertingConditionSpecTimeSeriesThreshold_FieldTerminalPath: 1744 switch tp.selector { 1745 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorCompare: 1746 result.Compare = source.Compare 1747 case AlertingConditionSpecTimeSeriesThreshold_FieldPathSelectorValue: 1748 result.Value = source.Value 1749 } 1750 } 1751 } 1752 return result 1753 } 1754 1755 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1756 return fieldMask.Project(source.(*AlertingCondition_Spec_TimeSeries_Threshold)) 1757 } 1758 1759 func (fieldMask *AlertingCondition_Spec_TimeSeries_Threshold_FieldMask) PathsCount() int { 1760 if fieldMask == nil { 1761 return 0 1762 } 1763 return len(fieldMask.Paths) 1764 } 1765 1766 type AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask struct { 1767 Paths []AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath 1768 } 1769 1770 func FullAlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask() *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask { 1771 res := &AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask{} 1772 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric}) 1773 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType}) 1774 res.Paths = append(res.Paths, &AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath{selector: AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv}) 1775 return res 1776 } 1777 1778 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) String() string { 1779 if fieldMask == nil { 1780 return "<nil>" 1781 } 1782 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1783 for _, path := range fieldMask.Paths { 1784 pathsStr = append(pathsStr, path.String()) 1785 } 1786 return strings.Join(pathsStr, ", ") 1787 } 1788 1789 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) IsFull() bool { 1790 if fieldMask == nil { 1791 return false 1792 } 1793 presentSelectors := make([]bool, 3) 1794 for _, path := range fieldMask.Paths { 1795 if asFinal, ok := path.(*AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath); ok { 1796 presentSelectors[int(asFinal.selector)] = true 1797 } 1798 } 1799 for _, flag := range presentSelectors { 1800 if !flag { 1801 return false 1802 } 1803 } 1804 return true 1805 } 1806 1807 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) ProtoReflect() preflect.Message { 1808 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1809 return ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(raw) 1810 }) 1811 } 1812 1813 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) ProtoMessage() {} 1814 1815 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) Reset() { 1816 if fieldMask != nil { 1817 fieldMask.Paths = nil 1818 } 1819 } 1820 1821 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) Subtract(other *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask { 1822 result := &AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask{} 1823 removedSelectors := make([]bool, 3) 1824 1825 for _, path := range other.GetPaths() { 1826 switch tp := path.(type) { 1827 case *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: 1828 removedSelectors[int(tp.selector)] = true 1829 } 1830 } 1831 for _, path := range fieldMask.GetPaths() { 1832 if !removedSelectors[int(path.Selector())] { 1833 result.Paths = append(result.Paths, path) 1834 } 1835 } 1836 1837 if len(result.Paths) == 0 { 1838 return nil 1839 } 1840 return result 1841 } 1842 1843 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1844 return fieldMask.Subtract(other.(*AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask)) 1845 } 1846 1847 // FilterInputFields generates copy of field paths with output_only field paths removed 1848 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) FilterInputFields() *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask { 1849 result := &AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask{} 1850 for _, path := range fieldMask.Paths { 1851 switch path.Selector() { 1852 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 1853 default: 1854 result.Paths = append(result.Paths, path) 1855 } 1856 } 1857 return result 1858 } 1859 1860 // ToFieldMask is used for proto conversions 1861 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1862 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1863 for _, path := range fieldMask.Paths { 1864 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1865 } 1866 return protoFieldMask 1867 } 1868 1869 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1870 if fieldMask == nil { 1871 return status.Error(codes.Internal, "target field mask is nil") 1872 } 1873 fieldMask.Paths = make([]AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath, 0, len(protoFieldMask.Paths)) 1874 for _, strPath := range protoFieldMask.Paths { 1875 path, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(strPath) 1876 if err != nil { 1877 return err 1878 } 1879 fieldMask.Paths = append(fieldMask.Paths, path) 1880 } 1881 return nil 1882 } 1883 1884 // implement methods required by customType 1885 func (fieldMask AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) Marshal() ([]byte, error) { 1886 protoFieldMask := fieldMask.ToProtoFieldMask() 1887 return proto.Marshal(protoFieldMask) 1888 } 1889 1890 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) Unmarshal(data []byte) error { 1891 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1892 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1893 return err 1894 } 1895 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1896 return err 1897 } 1898 return nil 1899 } 1900 1901 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) Size() int { 1902 return proto.Size(fieldMask.ToProtoFieldMask()) 1903 } 1904 1905 func (fieldMask AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) MarshalJSON() ([]byte, error) { 1906 return json.Marshal(fieldMask.ToProtoFieldMask()) 1907 } 1908 1909 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) UnmarshalJSON(data []byte) error { 1910 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1911 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1912 return err 1913 } 1914 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1915 return err 1916 } 1917 return nil 1918 } 1919 1920 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) AppendPath(path AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath) { 1921 fieldMask.Paths = append(fieldMask.Paths, path) 1922 } 1923 1924 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1925 fieldMask.Paths = append(fieldMask.Paths, path.(AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath)) 1926 } 1927 1928 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) GetPaths() []AlertingConditionSpecTimeSeriesCombineThreshold_FieldPath { 1929 if fieldMask == nil { 1930 return nil 1931 } 1932 return fieldMask.Paths 1933 } 1934 1935 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1936 if fieldMask == nil { 1937 return nil 1938 } 1939 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1940 for _, path := range fieldMask.Paths { 1941 rawPaths = append(rawPaths, path) 1942 } 1943 return rawPaths 1944 } 1945 1946 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) SetFromCliFlag(raw string) error { 1947 path, err := ParseAlertingConditionSpecTimeSeriesCombineThreshold_FieldPath(raw) 1948 if err != nil { 1949 return err 1950 } 1951 fieldMask.Paths = append(fieldMask.Paths, path) 1952 return nil 1953 } 1954 1955 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) Set(target, source *AlertingCondition_Spec_TimeSeries_CombineThreshold) { 1956 for _, path := range fieldMask.Paths { 1957 val, _ := path.GetSingle(source) 1958 // if val is nil, then field does not exist in source, skip 1959 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1960 if val != nil { 1961 path.WithIValue(val).SetTo(&target) 1962 } 1963 } 1964 } 1965 1966 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1967 fieldMask.Set(target.(*AlertingCondition_Spec_TimeSeries_CombineThreshold), source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 1968 } 1969 1970 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) Project(source *AlertingCondition_Spec_TimeSeries_CombineThreshold) *AlertingCondition_Spec_TimeSeries_CombineThreshold { 1971 if source == nil { 1972 return nil 1973 } 1974 if fieldMask == nil { 1975 return source 1976 } 1977 result := &AlertingCondition_Spec_TimeSeries_CombineThreshold{} 1978 var perMetricMapKeys []string 1979 wholePerMetricAccepted := false 1980 var perMetricTypeKvMapKeys []string 1981 wholePerMetricTypeKvAccepted := false 1982 1983 for _, p := range fieldMask.Paths { 1984 switch tp := p.(type) { 1985 case *AlertingConditionSpecTimeSeriesCombineThreshold_FieldTerminalPath: 1986 switch tp.selector { 1987 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 1988 result.PerMetric = source.PerMetric 1989 wholePerMetricAccepted = true 1990 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorMainMetricType: 1991 result.MainMetricType = source.MainMetricType 1992 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 1993 result.PerMetricTypeKv = source.PerMetricTypeKv 1994 wholePerMetricTypeKvAccepted = true 1995 } 1996 case *AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathMap: 1997 switch tp.selector { 1998 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetric: 1999 perMetricMapKeys = append(perMetricMapKeys, tp.key) 2000 case AlertingConditionSpecTimeSeriesCombineThreshold_FieldPathSelectorPerMetricTypeKv: 2001 perMetricTypeKvMapKeys = append(perMetricTypeKvMapKeys, tp.key) 2002 } 2003 } 2004 } 2005 if wholePerMetricAccepted == false && len(perMetricMapKeys) > 0 && source.GetPerMetric() != nil { 2006 copiedMap := map[string]*AlertingCondition_Spec_TimeSeries_Threshold{} 2007 sourceMap := source.GetPerMetric() 2008 for _, key := range perMetricMapKeys { 2009 copiedMap[key] = sourceMap[key] 2010 } 2011 result.PerMetric = copiedMap 2012 } 2013 if wholePerMetricTypeKvAccepted == false && len(perMetricTypeKvMapKeys) > 0 && source.GetPerMetricTypeKv() != nil { 2014 copiedMap := map[string][]byte{} 2015 sourceMap := source.GetPerMetricTypeKv() 2016 for _, key := range perMetricTypeKvMapKeys { 2017 copiedMap[key] = sourceMap[key] 2018 } 2019 result.PerMetricTypeKv = copiedMap 2020 } 2021 return result 2022 } 2023 2024 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2025 return fieldMask.Project(source.(*AlertingCondition_Spec_TimeSeries_CombineThreshold)) 2026 } 2027 2028 func (fieldMask *AlertingCondition_Spec_TimeSeries_CombineThreshold_FieldMask) PathsCount() int { 2029 if fieldMask == nil { 2030 return 0 2031 } 2032 return len(fieldMask.Paths) 2033 }