github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/alert/alert.pb.object_ext.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/alerting/proto/v1/alert.proto 3 // DO NOT EDIT!!! 4 5 package alert 6 7 import ( 8 "fmt" 9 "sort" 10 11 "google.golang.org/protobuf/proto" 12 googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 13 14 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 15 ) 16 17 // proto imports 18 import ( 19 rcommon "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/common" 20 log_condition "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/log_condition" 21 notification_channel "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/notification_channel" 22 ts_condition "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/ts_condition" 23 meta "github.com/cloudwan/goten-sdk/types/meta" 24 durationpb "google.golang.org/protobuf/types/known/durationpb" 25 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 26 ) 27 28 // ensure the imports are used 29 var ( 30 _ = new(fmt.Stringer) 31 _ = new(sort.Interface) 32 33 _ = new(proto.Message) 34 _ = googlefieldmaskpb.FieldMask{} 35 36 _ = new(gotenobject.FieldPath) 37 ) 38 39 // make sure we're using proto imports 40 var ( 41 _ = &log_condition.LogCondition{} 42 _ = ¬ification_channel.NotificationChannel{} 43 _ = &rcommon.LogCndSpec{} 44 _ = &ts_condition.TsCondition{} 45 _ = &durationpb.Duration{} 46 _ = ×tamppb.Timestamp{} 47 _ = &meta.Meta{} 48 ) 49 50 func (o *Alert) GotenObjectExt() {} 51 52 func (o *Alert) MakeFullFieldMask() *Alert_FieldMask { 53 return FullAlert_FieldMask() 54 } 55 56 func (o *Alert) MakeRawFullFieldMask() gotenobject.FieldMask { 57 return FullAlert_FieldMask() 58 } 59 60 func (o *Alert) MakeDiffFieldMask(other *Alert) *Alert_FieldMask { 61 if o == nil && other == nil { 62 return &Alert_FieldMask{} 63 } 64 if o == nil || other == nil { 65 return FullAlert_FieldMask() 66 } 67 68 res := &Alert_FieldMask{} 69 if o.GetName().String() != other.GetName().String() { 70 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorName}) 71 } 72 { 73 subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata()) 74 if subMask.IsFull() { 75 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorMetadata}) 76 } else { 77 for _, subpath := range subMask.Paths { 78 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorMetadata, subPath: subpath}) 79 } 80 } 81 } 82 if o.GetDisplayName() != other.GetDisplayName() { 83 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorDisplayName}) 84 } 85 { 86 subMask := o.GetAlertingResource().MakeDiffFieldMask(other.GetAlertingResource()) 87 if subMask.IsFull() { 88 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorAlertingResource}) 89 } else { 90 for _, subpath := range subMask.Paths { 91 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorAlertingResource, subPath: subpath}) 92 } 93 } 94 } 95 { 96 _, leftSelected := o.Info.(*Alert_TsInfo_) 97 _, rightSelected := other.Info.(*Alert_TsInfo_) 98 if leftSelected == rightSelected { 99 subMask := o.GetTsInfo().MakeDiffFieldMask(other.GetTsInfo()) 100 if subMask.IsFull() { 101 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorTsInfo}) 102 } else { 103 for _, subpath := range subMask.Paths { 104 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorTsInfo, subPath: subpath}) 105 } 106 } 107 } else { 108 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorTsInfo}) 109 } 110 } 111 { 112 _, leftSelected := o.Info.(*Alert_LogInfo_) 113 _, rightSelected := other.Info.(*Alert_LogInfo_) 114 if leftSelected == rightSelected { 115 subMask := o.GetLogInfo().MakeDiffFieldMask(other.GetLogInfo()) 116 if subMask.IsFull() { 117 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorLogInfo}) 118 } else { 119 for _, subpath := range subMask.Paths { 120 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorLogInfo, subPath: subpath}) 121 } 122 } 123 } else { 124 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorLogInfo}) 125 } 126 } 127 { 128 subMask := o.GetState().MakeDiffFieldMask(other.GetState()) 129 if subMask.IsFull() { 130 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorState}) 131 } else { 132 for _, subpath := range subMask.Paths { 133 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorState, subPath: subpath}) 134 } 135 } 136 } 137 { 138 subMask := o.GetInternal().MakeDiffFieldMask(other.GetInternal()) 139 if subMask.IsFull() { 140 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorInternal}) 141 } else { 142 for _, subpath := range subMask.Paths { 143 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorInternal, subPath: subpath}) 144 } 145 } 146 } 147 return res 148 } 149 150 func (o *Alert) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 151 return o.MakeDiffFieldMask(other.(*Alert)) 152 } 153 154 func (o *Alert) Clone() *Alert { 155 if o == nil { 156 return nil 157 } 158 result := &Alert{} 159 if o.Name == nil { 160 result.Name = nil 161 } else if data, err := o.Name.ProtoString(); err != nil { 162 panic(err) 163 } else { 164 result.Name = &Name{} 165 if err := result.Name.ParseProtoString(data); err != nil { 166 panic(err) 167 } 168 } 169 result.Metadata = o.Metadata.Clone() 170 result.DisplayName = o.DisplayName 171 result.AlertingResource = o.AlertingResource.Clone() 172 if o, ok := o.Info.(*Alert_TsInfo_); ok { 173 result.Info = (*Alert_TsInfo_)(nil) 174 if o != nil { 175 result.Info = &Alert_TsInfo_{} 176 result := result.Info.(*Alert_TsInfo_) 177 result.TsInfo = o.TsInfo.Clone() 178 } 179 } 180 if o, ok := o.Info.(*Alert_LogInfo_); ok { 181 result.Info = (*Alert_LogInfo_)(nil) 182 if o != nil { 183 result.Info = &Alert_LogInfo_{} 184 result := result.Info.(*Alert_LogInfo_) 185 result.LogInfo = o.LogInfo.Clone() 186 } 187 } 188 result.State = o.State.Clone() 189 result.Internal = o.Internal.Clone() 190 return result 191 } 192 193 func (o *Alert) CloneRaw() gotenobject.GotenObjectExt { 194 return o.Clone() 195 } 196 197 func (o *Alert) Merge(source *Alert) { 198 if source.GetName() != nil { 199 if data, err := source.GetName().ProtoString(); err != nil { 200 panic(err) 201 } else { 202 o.Name = &Name{} 203 if err := o.Name.ParseProtoString(data); err != nil { 204 panic(err) 205 } 206 } 207 } else { 208 o.Name = nil 209 } 210 if source.GetMetadata() != nil { 211 if o.Metadata == nil { 212 o.Metadata = new(meta.Meta) 213 } 214 o.Metadata.Merge(source.GetMetadata()) 215 } 216 o.DisplayName = source.GetDisplayName() 217 if source.GetAlertingResource() != nil { 218 if o.AlertingResource == nil { 219 o.AlertingResource = new(meta.OwnerReference) 220 } 221 o.AlertingResource.Merge(source.GetAlertingResource()) 222 } 223 if source, ok := source.GetInfo().(*Alert_TsInfo_); ok { 224 if dstOneOf, ok := o.Info.(*Alert_TsInfo_); !ok || dstOneOf == nil { 225 o.Info = &Alert_TsInfo_{} 226 } 227 if source != nil { 228 o := o.Info.(*Alert_TsInfo_) 229 if source.TsInfo != nil { 230 if o.TsInfo == nil { 231 o.TsInfo = new(Alert_TsInfo) 232 } 233 o.TsInfo.Merge(source.TsInfo) 234 } 235 } 236 } 237 if source, ok := source.GetInfo().(*Alert_LogInfo_); ok { 238 if dstOneOf, ok := o.Info.(*Alert_LogInfo_); !ok || dstOneOf == nil { 239 o.Info = &Alert_LogInfo_{} 240 } 241 if source != nil { 242 o := o.Info.(*Alert_LogInfo_) 243 if source.LogInfo != nil { 244 if o.LogInfo == nil { 245 o.LogInfo = new(Alert_LogInfo) 246 } 247 o.LogInfo.Merge(source.LogInfo) 248 } 249 } 250 } 251 if source.GetState() != nil { 252 if o.State == nil { 253 o.State = new(Alert_State) 254 } 255 o.State.Merge(source.GetState()) 256 } 257 if source.GetInternal() != nil { 258 if o.Internal == nil { 259 o.Internal = new(Alert_Internal) 260 } 261 o.Internal.Merge(source.GetInternal()) 262 } 263 } 264 265 func (o *Alert) MergeRaw(source gotenobject.GotenObjectExt) { 266 o.Merge(source.(*Alert)) 267 } 268 269 func (o *Alert_TsInfo) GotenObjectExt() {} 270 271 func (o *Alert_TsInfo) MakeFullFieldMask() *Alert_TsInfo_FieldMask { 272 return FullAlert_TsInfo_FieldMask() 273 } 274 275 func (o *Alert_TsInfo) MakeRawFullFieldMask() gotenobject.FieldMask { 276 return FullAlert_TsInfo_FieldMask() 277 } 278 279 func (o *Alert_TsInfo) MakeDiffFieldMask(other *Alert_TsInfo) *Alert_TsInfo_FieldMask { 280 if o == nil && other == nil { 281 return &Alert_TsInfo_FieldMask{} 282 } 283 if o == nil || other == nil { 284 return FullAlert_TsInfo_FieldMask() 285 } 286 287 res := &Alert_TsInfo_FieldMask{} 288 if o.GetType() != other.GetType() { 289 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorType}) 290 } 291 if !proto.Equal(o.GetAnomalyWindowSize(), other.GetAnomalyWindowSize()) { 292 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorAnomalyWindowSize}) 293 } 294 if string(o.GetCommonKey()) != string(other.GetCommonKey()) { 295 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorCommonKey}) 296 } 297 298 if len(o.GetMetricTypes()) == len(other.GetMetricTypes()) { 299 for i, lValue := range o.GetMetricTypes() { 300 rValue := other.GetMetricTypes()[i] 301 if lValue != rValue { 302 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorMetricTypes}) 303 break 304 } 305 } 306 } else { 307 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorMetricTypes}) 308 } 309 310 if len(o.GetResourceTypes()) == len(other.GetResourceTypes()) { 311 for i, lValue := range o.GetResourceTypes() { 312 rValue := other.GetResourceTypes()[i] 313 if lValue != rValue { 314 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorResourceTypes}) 315 break 316 } 317 } 318 } else { 319 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorResourceTypes}) 320 } 321 322 if len(o.GetCommonMetricLabels()) == len(other.GetCommonMetricLabels()) { 323 for i, lValue := range o.GetCommonMetricLabels() { 324 rValue := other.GetCommonMetricLabels()[i] 325 if lValue != rValue { 326 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorCommonMetricLabels}) 327 break 328 } 329 } 330 } else { 331 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorCommonMetricLabels}) 332 } 333 334 if len(o.GetCommonResourceLabels()) == len(other.GetCommonResourceLabels()) { 335 for i, lValue := range o.GetCommonResourceLabels() { 336 rValue := other.GetCommonResourceLabels()[i] 337 if lValue != rValue { 338 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorCommonResourceLabels}) 339 break 340 } 341 } 342 } else { 343 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorCommonResourceLabels}) 344 } 345 346 if len(o.GetTimeSeries()) == len(other.GetTimeSeries()) { 347 for i, lValue := range o.GetTimeSeries() { 348 rValue := other.GetTimeSeries()[i] 349 if len(lValue.MakeDiffFieldMask(rValue).Paths) > 0 { 350 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorTimeSeries}) 351 break 352 } 353 } 354 } else { 355 res.Paths = append(res.Paths, &AlertTsInfo_FieldTerminalPath{selector: AlertTsInfo_FieldPathSelectorTimeSeries}) 356 } 357 return res 358 } 359 360 func (o *Alert_TsInfo) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 361 return o.MakeDiffFieldMask(other.(*Alert_TsInfo)) 362 } 363 364 func (o *Alert_TsInfo) Clone() *Alert_TsInfo { 365 if o == nil { 366 return nil 367 } 368 result := &Alert_TsInfo{} 369 result.Type = o.Type 370 result.AnomalyWindowSize = proto.Clone(o.AnomalyWindowSize).(*durationpb.Duration) 371 result.CommonKey = make([]byte, len(o.CommonKey)) 372 for i, bt := range o.CommonKey { 373 result.CommonKey[i] = bt 374 } 375 result.MetricTypes = make([]string, len(o.MetricTypes)) 376 for i, sourceValue := range o.MetricTypes { 377 result.MetricTypes[i] = sourceValue 378 } 379 result.ResourceTypes = make([]string, len(o.ResourceTypes)) 380 for i, sourceValue := range o.ResourceTypes { 381 result.ResourceTypes[i] = sourceValue 382 } 383 result.CommonMetricLabels = map[string]string{} 384 for key, sourceValue := range o.CommonMetricLabels { 385 result.CommonMetricLabels[key] = sourceValue 386 } 387 result.CommonResourceLabels = map[string]string{} 388 for key, sourceValue := range o.CommonResourceLabels { 389 result.CommonResourceLabels[key] = sourceValue 390 } 391 result.TimeSeries = make([]*Alert_TsInfo_TimeSeries, len(o.TimeSeries)) 392 for i, sourceValue := range o.TimeSeries { 393 result.TimeSeries[i] = sourceValue.Clone() 394 } 395 return result 396 } 397 398 func (o *Alert_TsInfo) CloneRaw() gotenobject.GotenObjectExt { 399 return o.Clone() 400 } 401 402 func (o *Alert_TsInfo) Merge(source *Alert_TsInfo) { 403 o.Type = source.GetType() 404 if source.GetAnomalyWindowSize() != nil { 405 if o.AnomalyWindowSize == nil { 406 o.AnomalyWindowSize = new(durationpb.Duration) 407 } 408 proto.Merge(o.AnomalyWindowSize, source.GetAnomalyWindowSize()) 409 } 410 o.CommonKey = make([]byte, len(source.GetCommonKey())) 411 for i, bt := range source.GetCommonKey() { 412 o.CommonKey[i] = bt 413 } 414 for _, sourceValue := range source.GetMetricTypes() { 415 exists := false 416 for _, currentValue := range o.MetricTypes { 417 if currentValue == sourceValue { 418 exists = true 419 break 420 } 421 } 422 if !exists { 423 var newDstElement string 424 newDstElement = sourceValue 425 o.MetricTypes = append(o.MetricTypes, newDstElement) 426 } 427 } 428 429 for _, sourceValue := range source.GetResourceTypes() { 430 exists := false 431 for _, currentValue := range o.ResourceTypes { 432 if currentValue == sourceValue { 433 exists = true 434 break 435 } 436 } 437 if !exists { 438 var newDstElement string 439 newDstElement = sourceValue 440 o.ResourceTypes = append(o.ResourceTypes, newDstElement) 441 } 442 } 443 444 if source.GetCommonMetricLabels() != nil { 445 if o.CommonMetricLabels == nil { 446 o.CommonMetricLabels = make(map[string]string, len(source.GetCommonMetricLabels())) 447 } 448 for key, sourceValue := range source.GetCommonMetricLabels() { 449 o.CommonMetricLabels[key] = sourceValue 450 } 451 } 452 if source.GetCommonResourceLabels() != nil { 453 if o.CommonResourceLabels == nil { 454 o.CommonResourceLabels = make(map[string]string, len(source.GetCommonResourceLabels())) 455 } 456 for key, sourceValue := range source.GetCommonResourceLabels() { 457 o.CommonResourceLabels[key] = sourceValue 458 } 459 } 460 for _, sourceValue := range source.GetTimeSeries() { 461 exists := false 462 for _, currentValue := range o.TimeSeries { 463 if proto.Equal(sourceValue, currentValue) { 464 exists = true 465 break 466 } 467 } 468 if !exists { 469 var newDstElement *Alert_TsInfo_TimeSeries 470 if sourceValue != nil { 471 newDstElement = new(Alert_TsInfo_TimeSeries) 472 newDstElement.Merge(sourceValue) 473 } 474 o.TimeSeries = append(o.TimeSeries, newDstElement) 475 } 476 } 477 478 } 479 480 func (o *Alert_TsInfo) MergeRaw(source gotenobject.GotenObjectExt) { 481 o.Merge(source.(*Alert_TsInfo)) 482 } 483 484 func (o *Alert_LogInfo) GotenObjectExt() {} 485 486 func (o *Alert_LogInfo) MakeFullFieldMask() *Alert_LogInfo_FieldMask { 487 return FullAlert_LogInfo_FieldMask() 488 } 489 490 func (o *Alert_LogInfo) MakeRawFullFieldMask() gotenobject.FieldMask { 491 return FullAlert_LogInfo_FieldMask() 492 } 493 494 func (o *Alert_LogInfo) MakeDiffFieldMask(other *Alert_LogInfo) *Alert_LogInfo_FieldMask { 495 if o == nil && other == nil { 496 return &Alert_LogInfo_FieldMask{} 497 } 498 if o == nil || other == nil { 499 return FullAlert_LogInfo_FieldMask() 500 } 501 502 res := &Alert_LogInfo_FieldMask{} 503 if string(o.GetCommonKey()) != string(other.GetCommonKey()) { 504 res.Paths = append(res.Paths, &AlertLogInfo_FieldTerminalPath{selector: AlertLogInfo_FieldPathSelectorCommonKey}) 505 } 506 507 if len(o.GetLogTypes()) == len(other.GetLogTypes()) { 508 for i, lValue := range o.GetLogTypes() { 509 rValue := other.GetLogTypes()[i] 510 if lValue != rValue { 511 res.Paths = append(res.Paths, &AlertLogInfo_FieldTerminalPath{selector: AlertLogInfo_FieldPathSelectorLogTypes}) 512 break 513 } 514 } 515 } else { 516 res.Paths = append(res.Paths, &AlertLogInfo_FieldTerminalPath{selector: AlertLogInfo_FieldPathSelectorLogTypes}) 517 } 518 519 if len(o.GetCommonLogLabels()) == len(other.GetCommonLogLabels()) { 520 for i, lValue := range o.GetCommonLogLabels() { 521 rValue := other.GetCommonLogLabels()[i] 522 if lValue != rValue { 523 res.Paths = append(res.Paths, &AlertLogInfo_FieldTerminalPath{selector: AlertLogInfo_FieldPathSelectorCommonLogLabels}) 524 break 525 } 526 } 527 } else { 528 res.Paths = append(res.Paths, &AlertLogInfo_FieldTerminalPath{selector: AlertLogInfo_FieldPathSelectorCommonLogLabels}) 529 } 530 if o.GetViolatingLog() != other.GetViolatingLog() { 531 res.Paths = append(res.Paths, &AlertLogInfo_FieldTerminalPath{selector: AlertLogInfo_FieldPathSelectorViolatingLog}) 532 } 533 return res 534 } 535 536 func (o *Alert_LogInfo) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 537 return o.MakeDiffFieldMask(other.(*Alert_LogInfo)) 538 } 539 540 func (o *Alert_LogInfo) Clone() *Alert_LogInfo { 541 if o == nil { 542 return nil 543 } 544 result := &Alert_LogInfo{} 545 result.CommonKey = make([]byte, len(o.CommonKey)) 546 for i, bt := range o.CommonKey { 547 result.CommonKey[i] = bt 548 } 549 result.LogTypes = make([]string, len(o.LogTypes)) 550 for i, sourceValue := range o.LogTypes { 551 result.LogTypes[i] = sourceValue 552 } 553 result.CommonLogLabels = map[string]string{} 554 for key, sourceValue := range o.CommonLogLabels { 555 result.CommonLogLabels[key] = sourceValue 556 } 557 result.ViolatingLog = o.ViolatingLog 558 return result 559 } 560 561 func (o *Alert_LogInfo) CloneRaw() gotenobject.GotenObjectExt { 562 return o.Clone() 563 } 564 565 func (o *Alert_LogInfo) Merge(source *Alert_LogInfo) { 566 o.CommonKey = make([]byte, len(source.GetCommonKey())) 567 for i, bt := range source.GetCommonKey() { 568 o.CommonKey[i] = bt 569 } 570 for _, sourceValue := range source.GetLogTypes() { 571 exists := false 572 for _, currentValue := range o.LogTypes { 573 if currentValue == sourceValue { 574 exists = true 575 break 576 } 577 } 578 if !exists { 579 var newDstElement string 580 newDstElement = sourceValue 581 o.LogTypes = append(o.LogTypes, newDstElement) 582 } 583 } 584 585 if source.GetCommonLogLabels() != nil { 586 if o.CommonLogLabels == nil { 587 o.CommonLogLabels = make(map[string]string, len(source.GetCommonLogLabels())) 588 } 589 for key, sourceValue := range source.GetCommonLogLabels() { 590 o.CommonLogLabels[key] = sourceValue 591 } 592 } 593 o.ViolatingLog = source.GetViolatingLog() 594 } 595 596 func (o *Alert_LogInfo) MergeRaw(source gotenobject.GotenObjectExt) { 597 o.Merge(source.(*Alert_LogInfo)) 598 } 599 600 func (o *Alert_State) GotenObjectExt() {} 601 602 func (o *Alert_State) MakeFullFieldMask() *Alert_State_FieldMask { 603 return FullAlert_State_FieldMask() 604 } 605 606 func (o *Alert_State) MakeRawFullFieldMask() gotenobject.FieldMask { 607 return FullAlert_State_FieldMask() 608 } 609 610 func (o *Alert_State) MakeDiffFieldMask(other *Alert_State) *Alert_State_FieldMask { 611 if o == nil && other == nil { 612 return &Alert_State_FieldMask{} 613 } 614 if o == nil || other == nil { 615 return FullAlert_State_FieldMask() 616 } 617 618 res := &Alert_State_FieldMask{} 619 if o.GetIsFiring() != other.GetIsFiring() { 620 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorIsFiring}) 621 } 622 if !proto.Equal(o.GetStartTime(), other.GetStartTime()) { 623 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorStartTime}) 624 } 625 if !proto.Equal(o.GetEndTime(), other.GetEndTime()) { 626 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorEndTime}) 627 } 628 629 if len(o.GetNotificationStatuses()) == len(other.GetNotificationStatuses()) { 630 for i, lValue := range o.GetNotificationStatuses() { 631 rValue := other.GetNotificationStatuses()[i] 632 if len(lValue.MakeDiffFieldMask(rValue).Paths) > 0 { 633 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorNotificationStatuses}) 634 break 635 } 636 } 637 } else { 638 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorNotificationStatuses}) 639 } 640 if o.GetEscalationLevel() != other.GetEscalationLevel() { 641 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorEscalationLevel}) 642 } 643 if o.GetAiAgentHandlingState() != other.GetAiAgentHandlingState() { 644 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorAiAgentHandlingState}) 645 } 646 if !proto.Equal(o.GetAiAgentLastStateChangeTime(), other.GetAiAgentLastStateChangeTime()) { 647 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorAiAgentLastStateChangeTime}) 648 } 649 if o.GetAiAgentDiagnosisNotes() != other.GetAiAgentDiagnosisNotes() { 650 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorAiAgentDiagnosisNotes}) 651 } 652 if o.GetAiRemediationArg() != other.GetAiRemediationArg() { 653 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorAiRemediationArg}) 654 } 655 { 656 subMask := o.GetAiRemediation().MakeDiffFieldMask(other.GetAiRemediation()) 657 if subMask.IsFull() { 658 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorAiRemediation}) 659 } else { 660 for _, subpath := range subMask.Paths { 661 res.Paths = append(res.Paths, &AlertState_FieldSubPath{selector: AlertState_FieldPathSelectorAiRemediation, subPath: subpath}) 662 } 663 } 664 } 665 if o.GetOperatorHandlingState() != other.GetOperatorHandlingState() { 666 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorOperatorHandlingState}) 667 } 668 if !proto.Equal(o.GetOperatorLastStateChangeTime(), other.GetOperatorLastStateChangeTime()) { 669 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorOperatorLastStateChangeTime}) 670 } 671 if o.GetOperatorNotes() != other.GetOperatorNotes() { 672 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorOperatorNotes}) 673 } 674 if o.GetLifecycleCompleted() != other.GetLifecycleCompleted() { 675 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorLifecycleCompleted}) 676 } 677 return res 678 } 679 680 func (o *Alert_State) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 681 return o.MakeDiffFieldMask(other.(*Alert_State)) 682 } 683 684 func (o *Alert_State) Clone() *Alert_State { 685 if o == nil { 686 return nil 687 } 688 result := &Alert_State{} 689 result.IsFiring = o.IsFiring 690 result.StartTime = proto.Clone(o.StartTime).(*timestamppb.Timestamp) 691 result.EndTime = proto.Clone(o.EndTime).(*timestamppb.Timestamp) 692 result.NotificationStatuses = make([]*Alert_State_Notification, len(o.NotificationStatuses)) 693 for i, sourceValue := range o.NotificationStatuses { 694 result.NotificationStatuses[i] = sourceValue.Clone() 695 } 696 result.EscalationLevel = o.EscalationLevel 697 result.AiAgentHandlingState = o.AiAgentHandlingState 698 result.AiAgentLastStateChangeTime = proto.Clone(o.AiAgentLastStateChangeTime).(*timestamppb.Timestamp) 699 result.AiAgentDiagnosisNotes = o.AiAgentDiagnosisNotes 700 result.AiRemediationArg = o.AiRemediationArg 701 result.AiRemediation = o.AiRemediation.Clone() 702 result.OperatorHandlingState = o.OperatorHandlingState 703 result.OperatorLastStateChangeTime = proto.Clone(o.OperatorLastStateChangeTime).(*timestamppb.Timestamp) 704 result.OperatorNotes = o.OperatorNotes 705 result.LifecycleCompleted = o.LifecycleCompleted 706 return result 707 } 708 709 func (o *Alert_State) CloneRaw() gotenobject.GotenObjectExt { 710 return o.Clone() 711 } 712 713 func (o *Alert_State) Merge(source *Alert_State) { 714 o.IsFiring = source.GetIsFiring() 715 if source.GetStartTime() != nil { 716 if o.StartTime == nil { 717 o.StartTime = new(timestamppb.Timestamp) 718 } 719 proto.Merge(o.StartTime, source.GetStartTime()) 720 } 721 if source.GetEndTime() != nil { 722 if o.EndTime == nil { 723 o.EndTime = new(timestamppb.Timestamp) 724 } 725 proto.Merge(o.EndTime, source.GetEndTime()) 726 } 727 for _, sourceValue := range source.GetNotificationStatuses() { 728 exists := false 729 for _, currentValue := range o.NotificationStatuses { 730 if proto.Equal(sourceValue, currentValue) { 731 exists = true 732 break 733 } 734 } 735 if !exists { 736 var newDstElement *Alert_State_Notification 737 if sourceValue != nil { 738 newDstElement = new(Alert_State_Notification) 739 newDstElement.Merge(sourceValue) 740 } 741 o.NotificationStatuses = append(o.NotificationStatuses, newDstElement) 742 } 743 } 744 745 o.EscalationLevel = source.GetEscalationLevel() 746 o.AiAgentHandlingState = source.GetAiAgentHandlingState() 747 if source.GetAiAgentLastStateChangeTime() != nil { 748 if o.AiAgentLastStateChangeTime == nil { 749 o.AiAgentLastStateChangeTime = new(timestamppb.Timestamp) 750 } 751 proto.Merge(o.AiAgentLastStateChangeTime, source.GetAiAgentLastStateChangeTime()) 752 } 753 o.AiAgentDiagnosisNotes = source.GetAiAgentDiagnosisNotes() 754 o.AiRemediationArg = source.GetAiRemediationArg() 755 if source.GetAiRemediation() != nil { 756 if o.AiRemediation == nil { 757 o.AiRemediation = new(rcommon.PolicySpec_AIAgentHandling_Remediation) 758 } 759 o.AiRemediation.Merge(source.GetAiRemediation()) 760 } 761 o.OperatorHandlingState = source.GetOperatorHandlingState() 762 if source.GetOperatorLastStateChangeTime() != nil { 763 if o.OperatorLastStateChangeTime == nil { 764 o.OperatorLastStateChangeTime = new(timestamppb.Timestamp) 765 } 766 proto.Merge(o.OperatorLastStateChangeTime, source.GetOperatorLastStateChangeTime()) 767 } 768 o.OperatorNotes = source.GetOperatorNotes() 769 o.LifecycleCompleted = source.GetLifecycleCompleted() 770 } 771 772 func (o *Alert_State) MergeRaw(source gotenobject.GotenObjectExt) { 773 o.Merge(source.(*Alert_State)) 774 } 775 776 func (o *Alert_Internal) GotenObjectExt() {} 777 778 func (o *Alert_Internal) MakeFullFieldMask() *Alert_Internal_FieldMask { 779 return FullAlert_Internal_FieldMask() 780 } 781 782 func (o *Alert_Internal) MakeRawFullFieldMask() gotenobject.FieldMask { 783 return FullAlert_Internal_FieldMask() 784 } 785 786 func (o *Alert_Internal) MakeDiffFieldMask(other *Alert_Internal) *Alert_Internal_FieldMask { 787 if o == nil && other == nil { 788 return &Alert_Internal_FieldMask{} 789 } 790 if o == nil || other == nil { 791 return FullAlert_Internal_FieldMask() 792 } 793 794 res := &Alert_Internal_FieldMask{} 795 if o.GetAlertingLocation() != other.GetAlertingLocation() { 796 res.Paths = append(res.Paths, &AlertInternal_FieldTerminalPath{selector: AlertInternal_FieldPathSelectorAlertingLocation}) 797 } 798 return res 799 } 800 801 func (o *Alert_Internal) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 802 return o.MakeDiffFieldMask(other.(*Alert_Internal)) 803 } 804 805 func (o *Alert_Internal) Clone() *Alert_Internal { 806 if o == nil { 807 return nil 808 } 809 result := &Alert_Internal{} 810 result.AlertingLocation = o.AlertingLocation 811 return result 812 } 813 814 func (o *Alert_Internal) CloneRaw() gotenobject.GotenObjectExt { 815 return o.Clone() 816 } 817 818 func (o *Alert_Internal) Merge(source *Alert_Internal) { 819 o.AlertingLocation = source.GetAlertingLocation() 820 } 821 822 func (o *Alert_Internal) MergeRaw(source gotenobject.GotenObjectExt) { 823 o.Merge(source.(*Alert_Internal)) 824 } 825 826 func (o *Alert_TsInfo_TimeSeries) GotenObjectExt() {} 827 828 func (o *Alert_TsInfo_TimeSeries) MakeFullFieldMask() *Alert_TsInfo_TimeSeries_FieldMask { 829 return FullAlert_TsInfo_TimeSeries_FieldMask() 830 } 831 832 func (o *Alert_TsInfo_TimeSeries) MakeRawFullFieldMask() gotenobject.FieldMask { 833 return FullAlert_TsInfo_TimeSeries_FieldMask() 834 } 835 836 func (o *Alert_TsInfo_TimeSeries) MakeDiffFieldMask(other *Alert_TsInfo_TimeSeries) *Alert_TsInfo_TimeSeries_FieldMask { 837 if o == nil && other == nil { 838 return &Alert_TsInfo_TimeSeries_FieldMask{} 839 } 840 if o == nil || other == nil { 841 return FullAlert_TsInfo_TimeSeries_FieldMask() 842 } 843 844 res := &Alert_TsInfo_TimeSeries_FieldMask{} 845 if o.GetQueryName() != other.GetQueryName() { 846 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorQueryName}) 847 } 848 849 if len(o.GetValues()) == len(other.GetValues()) { 850 for i, lValue := range o.GetValues() { 851 rValue := other.GetValues()[i] 852 if lValue != rValue { 853 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorValues}) 854 break 855 } 856 } 857 } else { 858 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorValues}) 859 } 860 861 if len(o.GetAnomalies()) == len(other.GetAnomalies()) { 862 for i, lValue := range o.GetAnomalies() { 863 rValue := other.GetAnomalies()[i] 864 if lValue != rValue { 865 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorAnomalies}) 866 break 867 } 868 } 869 } else { 870 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorAnomalies}) 871 } 872 { 873 subMask := o.GetUpperThreshold().MakeDiffFieldMask(other.GetUpperThreshold()) 874 if subMask.IsFull() { 875 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorUpperThreshold}) 876 } else { 877 for _, subpath := range subMask.Paths { 878 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldSubPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorUpperThreshold, subPath: subpath}) 879 } 880 } 881 } 882 { 883 subMask := o.GetLowerThreshold().MakeDiffFieldMask(other.GetLowerThreshold()) 884 if subMask.IsFull() { 885 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorLowerThreshold}) 886 } else { 887 for _, subpath := range subMask.Paths { 888 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldSubPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorLowerThreshold, subPath: subpath}) 889 } 890 } 891 } 892 if o.GetAnomalyThreshold() != other.GetAnomalyThreshold() { 893 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorAnomalyThreshold}) 894 } 895 if !proto.Equal(o.GetAfterDuration(), other.GetAfterDuration()) { 896 res.Paths = append(res.Paths, &AlertTsInfoTimeSeries_FieldTerminalPath{selector: AlertTsInfoTimeSeries_FieldPathSelectorAfterDuration}) 897 } 898 return res 899 } 900 901 func (o *Alert_TsInfo_TimeSeries) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 902 return o.MakeDiffFieldMask(other.(*Alert_TsInfo_TimeSeries)) 903 } 904 905 func (o *Alert_TsInfo_TimeSeries) Clone() *Alert_TsInfo_TimeSeries { 906 if o == nil { 907 return nil 908 } 909 result := &Alert_TsInfo_TimeSeries{} 910 result.QueryName = o.QueryName 911 result.Values = make([]float64, len(o.Values)) 912 for i, sourceValue := range o.Values { 913 result.Values[i] = sourceValue 914 } 915 result.Anomalies = make([]float64, len(o.Anomalies)) 916 for i, sourceValue := range o.Anomalies { 917 result.Anomalies[i] = sourceValue 918 } 919 result.UpperThreshold = o.UpperThreshold.Clone() 920 result.LowerThreshold = o.LowerThreshold.Clone() 921 result.AnomalyThreshold = o.AnomalyThreshold 922 result.AfterDuration = proto.Clone(o.AfterDuration).(*durationpb.Duration) 923 return result 924 } 925 926 func (o *Alert_TsInfo_TimeSeries) CloneRaw() gotenobject.GotenObjectExt { 927 return o.Clone() 928 } 929 930 func (o *Alert_TsInfo_TimeSeries) Merge(source *Alert_TsInfo_TimeSeries) { 931 o.QueryName = source.GetQueryName() 932 for _, sourceValue := range source.GetValues() { 933 exists := false 934 for _, currentValue := range o.Values { 935 if currentValue == sourceValue { 936 exists = true 937 break 938 } 939 } 940 if !exists { 941 var newDstElement float64 942 newDstElement = sourceValue 943 o.Values = append(o.Values, newDstElement) 944 } 945 } 946 947 for _, sourceValue := range source.GetAnomalies() { 948 exists := false 949 for _, currentValue := range o.Anomalies { 950 if currentValue == sourceValue { 951 exists = true 952 break 953 } 954 } 955 if !exists { 956 var newDstElement float64 957 newDstElement = sourceValue 958 o.Anomalies = append(o.Anomalies, newDstElement) 959 } 960 } 961 962 if source.GetUpperThreshold() != nil { 963 if o.UpperThreshold == nil { 964 o.UpperThreshold = new(rcommon.AlertingThreshold) 965 } 966 o.UpperThreshold.Merge(source.GetUpperThreshold()) 967 } 968 if source.GetLowerThreshold() != nil { 969 if o.LowerThreshold == nil { 970 o.LowerThreshold = new(rcommon.AlertingThreshold) 971 } 972 o.LowerThreshold.Merge(source.GetLowerThreshold()) 973 } 974 o.AnomalyThreshold = source.GetAnomalyThreshold() 975 if source.GetAfterDuration() != nil { 976 if o.AfterDuration == nil { 977 o.AfterDuration = new(durationpb.Duration) 978 } 979 proto.Merge(o.AfterDuration, source.GetAfterDuration()) 980 } 981 } 982 983 func (o *Alert_TsInfo_TimeSeries) MergeRaw(source gotenobject.GotenObjectExt) { 984 o.Merge(source.(*Alert_TsInfo_TimeSeries)) 985 } 986 987 func (o *Alert_State_Notification) GotenObjectExt() {} 988 989 func (o *Alert_State_Notification) MakeFullFieldMask() *Alert_State_Notification_FieldMask { 990 return FullAlert_State_Notification_FieldMask() 991 } 992 993 func (o *Alert_State_Notification) MakeRawFullFieldMask() gotenobject.FieldMask { 994 return FullAlert_State_Notification_FieldMask() 995 } 996 997 func (o *Alert_State_Notification) MakeDiffFieldMask(other *Alert_State_Notification) *Alert_State_Notification_FieldMask { 998 if o == nil && other == nil { 999 return &Alert_State_Notification_FieldMask{} 1000 } 1001 if o == nil || other == nil { 1002 return FullAlert_State_Notification_FieldMask() 1003 } 1004 1005 res := &Alert_State_Notification_FieldMask{} 1006 if o.GetKind() != other.GetKind() { 1007 res.Paths = append(res.Paths, &AlertStateNotification_FieldTerminalPath{selector: AlertStateNotification_FieldPathSelectorKind}) 1008 } 1009 1010 if len(o.GetPendingChannels()) == len(other.GetPendingChannels()) { 1011 for i, lValue := range o.GetPendingChannels() { 1012 rValue := other.GetPendingChannels()[i] 1013 if lValue.String() != rValue.String() { 1014 res.Paths = append(res.Paths, &AlertStateNotification_FieldTerminalPath{selector: AlertStateNotification_FieldPathSelectorPendingChannels}) 1015 break 1016 } 1017 } 1018 } else { 1019 res.Paths = append(res.Paths, &AlertStateNotification_FieldTerminalPath{selector: AlertStateNotification_FieldPathSelectorPendingChannels}) 1020 } 1021 return res 1022 } 1023 1024 func (o *Alert_State_Notification) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 1025 return o.MakeDiffFieldMask(other.(*Alert_State_Notification)) 1026 } 1027 1028 func (o *Alert_State_Notification) Clone() *Alert_State_Notification { 1029 if o == nil { 1030 return nil 1031 } 1032 result := &Alert_State_Notification{} 1033 result.Kind = o.Kind 1034 result.PendingChannels = make([]*notification_channel.Reference, len(o.PendingChannels)) 1035 for i, sourceValue := range o.PendingChannels { 1036 if sourceValue == nil { 1037 result.PendingChannels[i] = nil 1038 } else if data, err := sourceValue.ProtoString(); err != nil { 1039 panic(err) 1040 } else { 1041 result.PendingChannels[i] = ¬ification_channel.Reference{} 1042 if err := result.PendingChannels[i].ParseProtoString(data); err != nil { 1043 panic(err) 1044 } 1045 } 1046 } 1047 return result 1048 } 1049 1050 func (o *Alert_State_Notification) CloneRaw() gotenobject.GotenObjectExt { 1051 return o.Clone() 1052 } 1053 1054 func (o *Alert_State_Notification) Merge(source *Alert_State_Notification) { 1055 o.Kind = source.GetKind() 1056 for _, sourceValue := range source.GetPendingChannels() { 1057 exists := false 1058 for _, currentValue := range o.PendingChannels { 1059 leftProtoStr, _ := currentValue.ProtoString() 1060 rightProtoStr, _ := sourceValue.ProtoString() 1061 if leftProtoStr == rightProtoStr { 1062 exists = true 1063 break 1064 } 1065 } 1066 if !exists { 1067 var newDstElement *notification_channel.Reference 1068 if sourceValue != nil { 1069 if data, err := sourceValue.ProtoString(); err != nil { 1070 panic(err) 1071 } else { 1072 newDstElement = ¬ification_channel.Reference{} 1073 if err := newDstElement.ParseProtoString(data); err != nil { 1074 panic(err) 1075 } 1076 } 1077 } 1078 o.PendingChannels = append(o.PendingChannels, newDstElement) 1079 } 1080 } 1081 1082 } 1083 1084 func (o *Alert_State_Notification) MergeRaw(source gotenobject.GotenObjectExt) { 1085 o.Merge(source.(*Alert_State_Notification)) 1086 }