github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/alert/alert.pb.object_ext.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/monitoring/proto/v4/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 alerting_condition "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/alerting_condition" 20 common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 21 meta "github.com/cloudwan/goten-sdk/types/meta" 22 ) 23 24 // ensure the imports are used 25 var ( 26 _ = new(fmt.Stringer) 27 _ = new(sort.Interface) 28 29 _ = new(proto.Message) 30 _ = googlefieldmaskpb.FieldMask{} 31 32 _ = new(gotenobject.FieldPath) 33 ) 34 35 // make sure we're using proto imports 36 var ( 37 _ = &alerting_condition.AlertingCondition{} 38 _ = &common.LabelDescriptor{} 39 _ = &meta.Meta{} 40 ) 41 42 func (o *Alert) GotenObjectExt() {} 43 44 func (o *Alert) MakeFullFieldMask() *Alert_FieldMask { 45 return FullAlert_FieldMask() 46 } 47 48 func (o *Alert) MakeRawFullFieldMask() gotenobject.FieldMask { 49 return FullAlert_FieldMask() 50 } 51 52 func (o *Alert) MakeDiffFieldMask(other *Alert) *Alert_FieldMask { 53 if o == nil && other == nil { 54 return &Alert_FieldMask{} 55 } 56 if o == nil || other == nil { 57 return FullAlert_FieldMask() 58 } 59 60 res := &Alert_FieldMask{} 61 if o.GetName().String() != other.GetName().String() { 62 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorName}) 63 } 64 { 65 subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata()) 66 if subMask.IsFull() { 67 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorMetadata}) 68 } else { 69 for _, subpath := range subMask.Paths { 70 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorMetadata, subPath: subpath}) 71 } 72 } 73 } 74 if o.GetDisplayName() != other.GetDisplayName() { 75 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorDisplayName}) 76 } 77 { 78 subMask := o.GetInfo().MakeDiffFieldMask(other.GetInfo()) 79 if subMask.IsFull() { 80 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorInfo}) 81 } else { 82 for _, subpath := range subMask.Paths { 83 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorInfo, subPath: subpath}) 84 } 85 } 86 } 87 { 88 subMask := o.GetState().MakeDiffFieldMask(other.GetState()) 89 if subMask.IsFull() { 90 res.Paths = append(res.Paths, &Alert_FieldTerminalPath{selector: Alert_FieldPathSelectorState}) 91 } else { 92 for _, subpath := range subMask.Paths { 93 res.Paths = append(res.Paths, &Alert_FieldSubPath{selector: Alert_FieldPathSelectorState, subPath: subpath}) 94 } 95 } 96 } 97 return res 98 } 99 100 func (o *Alert) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 101 return o.MakeDiffFieldMask(other.(*Alert)) 102 } 103 104 func (o *Alert) Clone() *Alert { 105 if o == nil { 106 return nil 107 } 108 result := &Alert{} 109 if o.Name == nil { 110 result.Name = nil 111 } else if data, err := o.Name.ProtoString(); err != nil { 112 panic(err) 113 } else { 114 result.Name = &Name{} 115 if err := result.Name.ParseProtoString(data); err != nil { 116 panic(err) 117 } 118 } 119 result.Metadata = o.Metadata.Clone() 120 result.DisplayName = o.DisplayName 121 result.Info = o.Info.Clone() 122 result.State = o.State.Clone() 123 return result 124 } 125 126 func (o *Alert) CloneRaw() gotenobject.GotenObjectExt { 127 return o.Clone() 128 } 129 130 func (o *Alert) Merge(source *Alert) { 131 if source.GetName() != nil { 132 if data, err := source.GetName().ProtoString(); err != nil { 133 panic(err) 134 } else { 135 o.Name = &Name{} 136 if err := o.Name.ParseProtoString(data); err != nil { 137 panic(err) 138 } 139 } 140 } else { 141 o.Name = nil 142 } 143 if source.GetMetadata() != nil { 144 if o.Metadata == nil { 145 o.Metadata = new(meta.Meta) 146 } 147 o.Metadata.Merge(source.GetMetadata()) 148 } 149 o.DisplayName = source.GetDisplayName() 150 if source.GetInfo() != nil { 151 if o.Info == nil { 152 o.Info = new(Alert_Info) 153 } 154 o.Info.Merge(source.GetInfo()) 155 } 156 if source.GetState() != nil { 157 if o.State == nil { 158 o.State = new(Alert_State) 159 } 160 o.State.Merge(source.GetState()) 161 } 162 } 163 164 func (o *Alert) MergeRaw(source gotenobject.GotenObjectExt) { 165 o.Merge(source.(*Alert)) 166 } 167 168 func (o *Alert_Info) GotenObjectExt() {} 169 170 func (o *Alert_Info) MakeFullFieldMask() *Alert_Info_FieldMask { 171 return FullAlert_Info_FieldMask() 172 } 173 174 func (o *Alert_Info) MakeRawFullFieldMask() gotenobject.FieldMask { 175 return FullAlert_Info_FieldMask() 176 } 177 178 func (o *Alert_Info) MakeDiffFieldMask(other *Alert_Info) *Alert_Info_FieldMask { 179 if o == nil && other == nil { 180 return &Alert_Info_FieldMask{} 181 } 182 if o == nil || other == nil { 183 return FullAlert_Info_FieldMask() 184 } 185 186 res := &Alert_Info_FieldMask{} 187 { 188 subMask := o.GetTimeSerie().MakeDiffFieldMask(other.GetTimeSerie()) 189 if subMask.IsFull() { 190 res.Paths = append(res.Paths, &AlertInfo_FieldTerminalPath{selector: AlertInfo_FieldPathSelectorTimeSerie}) 191 } else { 192 for _, subpath := range subMask.Paths { 193 res.Paths = append(res.Paths, &AlertInfo_FieldSubPath{selector: AlertInfo_FieldPathSelectorTimeSerie, subPath: subpath}) 194 } 195 } 196 } 197 { 198 subMask := o.GetObservedValues().MakeDiffFieldMask(other.GetObservedValues()) 199 if subMask.IsFull() { 200 res.Paths = append(res.Paths, &AlertInfo_FieldTerminalPath{selector: AlertInfo_FieldPathSelectorObservedValues}) 201 } else { 202 for _, subpath := range subMask.Paths { 203 res.Paths = append(res.Paths, &AlertInfo_FieldSubPath{selector: AlertInfo_FieldPathSelectorObservedValues, subPath: subpath}) 204 } 205 } 206 } 207 return res 208 } 209 210 func (o *Alert_Info) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 211 return o.MakeDiffFieldMask(other.(*Alert_Info)) 212 } 213 214 func (o *Alert_Info) Clone() *Alert_Info { 215 if o == nil { 216 return nil 217 } 218 result := &Alert_Info{} 219 result.TimeSerie = o.TimeSerie.Clone() 220 result.ObservedValues = o.ObservedValues.Clone() 221 return result 222 } 223 224 func (o *Alert_Info) CloneRaw() gotenobject.GotenObjectExt { 225 return o.Clone() 226 } 227 228 func (o *Alert_Info) Merge(source *Alert_Info) { 229 if source.GetTimeSerie() != nil { 230 if o.TimeSerie == nil { 231 o.TimeSerie = new(Alert_Info_TimeSerie) 232 } 233 o.TimeSerie.Merge(source.GetTimeSerie()) 234 } 235 if source.GetObservedValues() != nil { 236 if o.ObservedValues == nil { 237 o.ObservedValues = new(Alert_Info_ObservedValues) 238 } 239 o.ObservedValues.Merge(source.GetObservedValues()) 240 } 241 } 242 243 func (o *Alert_Info) MergeRaw(source gotenobject.GotenObjectExt) { 244 o.Merge(source.(*Alert_Info)) 245 } 246 247 func (o *Alert_State) GotenObjectExt() {} 248 249 func (o *Alert_State) MakeFullFieldMask() *Alert_State_FieldMask { 250 return FullAlert_State_FieldMask() 251 } 252 253 func (o *Alert_State) MakeRawFullFieldMask() gotenobject.FieldMask { 254 return FullAlert_State_FieldMask() 255 } 256 257 func (o *Alert_State) MakeDiffFieldMask(other *Alert_State) *Alert_State_FieldMask { 258 if o == nil && other == nil { 259 return &Alert_State_FieldMask{} 260 } 261 if o == nil || other == nil { 262 return FullAlert_State_FieldMask() 263 } 264 265 res := &Alert_State_FieldMask{} 266 if o.GetIsFiring() != other.GetIsFiring() { 267 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorIsFiring}) 268 } 269 if o.GetIsAcknowledged() != other.GetIsAcknowledged() { 270 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorIsAcknowledged}) 271 } 272 if o.GetIsSilenced() != other.GetIsSilenced() { 273 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorIsSilenced}) 274 } 275 { 276 subMask := o.GetLifetime().MakeDiffFieldMask(other.GetLifetime()) 277 if subMask.IsFull() { 278 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorLifetime}) 279 } else { 280 for _, subpath := range subMask.Paths { 281 res.Paths = append(res.Paths, &AlertState_FieldSubPath{selector: AlertState_FieldPathSelectorLifetime, subPath: subpath}) 282 } 283 } 284 } 285 if o.GetNeedsNotification() != other.GetNeedsNotification() { 286 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorNeedsNotification}) 287 } 288 if o.GetNotificationCreated() != other.GetNotificationCreated() { 289 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorNotificationCreated}) 290 } 291 if o.GetLifecycleCompleted() != other.GetLifecycleCompleted() { 292 res.Paths = append(res.Paths, &AlertState_FieldTerminalPath{selector: AlertState_FieldPathSelectorLifecycleCompleted}) 293 } 294 return res 295 } 296 297 func (o *Alert_State) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 298 return o.MakeDiffFieldMask(other.(*Alert_State)) 299 } 300 301 func (o *Alert_State) Clone() *Alert_State { 302 if o == nil { 303 return nil 304 } 305 result := &Alert_State{} 306 result.IsFiring = o.IsFiring 307 result.IsAcknowledged = o.IsAcknowledged 308 result.IsSilenced = o.IsSilenced 309 result.Lifetime = o.Lifetime.Clone() 310 result.NeedsNotification = o.NeedsNotification 311 result.NotificationCreated = o.NotificationCreated 312 result.LifecycleCompleted = o.LifecycleCompleted 313 return result 314 } 315 316 func (o *Alert_State) CloneRaw() gotenobject.GotenObjectExt { 317 return o.Clone() 318 } 319 320 func (o *Alert_State) Merge(source *Alert_State) { 321 o.IsFiring = source.GetIsFiring() 322 o.IsAcknowledged = source.GetIsAcknowledged() 323 o.IsSilenced = source.GetIsSilenced() 324 if source.GetLifetime() != nil { 325 if o.Lifetime == nil { 326 o.Lifetime = new(common.TimeRange) 327 } 328 o.Lifetime.Merge(source.GetLifetime()) 329 } 330 o.NeedsNotification = source.GetNeedsNotification() 331 o.NotificationCreated = source.GetNotificationCreated() 332 o.LifecycleCompleted = source.GetLifecycleCompleted() 333 } 334 335 func (o *Alert_State) MergeRaw(source gotenobject.GotenObjectExt) { 336 o.Merge(source.(*Alert_State)) 337 } 338 339 func (o *Alert_Info_TimeSerie) GotenObjectExt() {} 340 341 func (o *Alert_Info_TimeSerie) MakeFullFieldMask() *Alert_Info_TimeSerie_FieldMask { 342 return FullAlert_Info_TimeSerie_FieldMask() 343 } 344 345 func (o *Alert_Info_TimeSerie) MakeRawFullFieldMask() gotenobject.FieldMask { 346 return FullAlert_Info_TimeSerie_FieldMask() 347 } 348 349 func (o *Alert_Info_TimeSerie) MakeDiffFieldMask(other *Alert_Info_TimeSerie) *Alert_Info_TimeSerie_FieldMask { 350 if o == nil && other == nil { 351 return &Alert_Info_TimeSerie_FieldMask{} 352 } 353 if o == nil || other == nil { 354 return FullAlert_Info_TimeSerie_FieldMask() 355 } 356 357 res := &Alert_Info_TimeSerie_FieldMask{} 358 if string(o.GetKey()) != string(other.GetKey()) { 359 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldTerminalPath{selector: AlertInfoTimeSerie_FieldPathSelectorKey}) 360 } 361 { 362 subMask := o.GetMetric().MakeDiffFieldMask(other.GetMetric()) 363 if subMask.IsFull() { 364 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldTerminalPath{selector: AlertInfoTimeSerie_FieldPathSelectorMetric}) 365 } else { 366 for _, subpath := range subMask.Paths { 367 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldSubPath{selector: AlertInfoTimeSerie_FieldPathSelectorMetric, subPath: subpath}) 368 } 369 } 370 } 371 { 372 subMask := o.GetMonitoredResource().MakeDiffFieldMask(other.GetMonitoredResource()) 373 if subMask.IsFull() { 374 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldTerminalPath{selector: AlertInfoTimeSerie_FieldPathSelectorMonitoredResource}) 375 } else { 376 for _, subpath := range subMask.Paths { 377 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldSubPath{selector: AlertInfoTimeSerie_FieldPathSelectorMonitoredResource, subPath: subpath}) 378 } 379 } 380 } 381 382 if len(o.GetData()) == len(other.GetData()) { 383 for i, lValue := range o.GetData() { 384 rValue := other.GetData()[i] 385 if lValue != rValue { 386 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldTerminalPath{selector: AlertInfoTimeSerie_FieldPathSelectorData}) 387 break 388 } 389 } 390 } else { 391 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldTerminalPath{selector: AlertInfoTimeSerie_FieldPathSelectorData}) 392 } 393 394 if len(o.GetBinData()) == len(other.GetBinData()) { 395 for i, lValue := range o.GetBinData() { 396 rValue := other.GetBinData()[i] 397 if string(lValue) != string(rValue) { 398 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldTerminalPath{selector: AlertInfoTimeSerie_FieldPathSelectorBinData}) 399 break 400 } 401 } 402 } else { 403 res.Paths = append(res.Paths, &AlertInfoTimeSerie_FieldTerminalPath{selector: AlertInfoTimeSerie_FieldPathSelectorBinData}) 404 } 405 return res 406 } 407 408 func (o *Alert_Info_TimeSerie) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 409 return o.MakeDiffFieldMask(other.(*Alert_Info_TimeSerie)) 410 } 411 412 func (o *Alert_Info_TimeSerie) Clone() *Alert_Info_TimeSerie { 413 if o == nil { 414 return nil 415 } 416 result := &Alert_Info_TimeSerie{} 417 result.Key = make([]byte, len(o.Key)) 418 for i, bt := range o.Key { 419 result.Key[i] = bt 420 } 421 result.Metric = o.Metric.Clone() 422 result.MonitoredResource = o.MonitoredResource.Clone() 423 result.Data = make([]string, len(o.Data)) 424 for i, sourceValue := range o.Data { 425 result.Data[i] = sourceValue 426 } 427 result.BinData = make([][]byte, len(o.BinData)) 428 for i, sourceValue := range o.BinData { 429 result.BinData[i] = sourceValue 430 } 431 return result 432 } 433 434 func (o *Alert_Info_TimeSerie) CloneRaw() gotenobject.GotenObjectExt { 435 return o.Clone() 436 } 437 438 func (o *Alert_Info_TimeSerie) Merge(source *Alert_Info_TimeSerie) { 439 o.Key = make([]byte, len(source.GetKey())) 440 for i, bt := range source.GetKey() { 441 o.Key[i] = bt 442 } 443 if source.GetMetric() != nil { 444 if o.Metric == nil { 445 o.Metric = new(common.Metric) 446 } 447 o.Metric.Merge(source.GetMetric()) 448 } 449 if source.GetMonitoredResource() != nil { 450 if o.MonitoredResource == nil { 451 o.MonitoredResource = new(common.MonitoredResource) 452 } 453 o.MonitoredResource.Merge(source.GetMonitoredResource()) 454 } 455 for _, sourceValue := range source.GetData() { 456 exists := false 457 for _, currentValue := range o.Data { 458 if currentValue == sourceValue { 459 exists = true 460 break 461 } 462 } 463 if !exists { 464 var newDstElement string 465 newDstElement = sourceValue 466 o.Data = append(o.Data, newDstElement) 467 } 468 } 469 470 for _, sourceValue := range source.GetBinData() { 471 exists := false 472 for _, currentValue := range o.BinData { 473 if string(currentValue) == string(sourceValue) { 474 exists = true 475 break 476 } 477 } 478 if !exists { 479 var newDstElement []byte 480 newDstElement = sourceValue 481 o.BinData = append(o.BinData, newDstElement) 482 } 483 } 484 485 } 486 487 func (o *Alert_Info_TimeSerie) MergeRaw(source gotenobject.GotenObjectExt) { 488 o.Merge(source.(*Alert_Info_TimeSerie)) 489 } 490 491 func (o *Alert_Info_ObservedValues) GotenObjectExt() {} 492 493 func (o *Alert_Info_ObservedValues) MakeFullFieldMask() *Alert_Info_ObservedValues_FieldMask { 494 return FullAlert_Info_ObservedValues_FieldMask() 495 } 496 497 func (o *Alert_Info_ObservedValues) MakeRawFullFieldMask() gotenobject.FieldMask { 498 return FullAlert_Info_ObservedValues_FieldMask() 499 } 500 501 func (o *Alert_Info_ObservedValues) MakeDiffFieldMask(other *Alert_Info_ObservedValues) *Alert_Info_ObservedValues_FieldMask { 502 if o == nil && other == nil { 503 return &Alert_Info_ObservedValues_FieldMask{} 504 } 505 if o == nil || other == nil { 506 return FullAlert_Info_ObservedValues_FieldMask() 507 } 508 509 res := &Alert_Info_ObservedValues_FieldMask{} 510 if o.GetExampleValue() != other.GetExampleValue() { 511 res.Paths = append(res.Paths, &AlertInfoObservedValues_FieldTerminalPath{selector: AlertInfoObservedValues_FieldPathSelectorExampleValue}) 512 } 513 514 if len(o.GetPerMetric()) == len(other.GetPerMetric()) { 515 for i, lValue := range o.GetPerMetric() { 516 rValue := other.GetPerMetric()[i] 517 if lValue != rValue { 518 res.Paths = append(res.Paths, &AlertInfoObservedValues_FieldTerminalPath{selector: AlertInfoObservedValues_FieldPathSelectorPerMetric}) 519 break 520 } 521 } 522 } else { 523 res.Paths = append(res.Paths, &AlertInfoObservedValues_FieldTerminalPath{selector: AlertInfoObservedValues_FieldPathSelectorPerMetric}) 524 } 525 return res 526 } 527 528 func (o *Alert_Info_ObservedValues) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 529 return o.MakeDiffFieldMask(other.(*Alert_Info_ObservedValues)) 530 } 531 532 func (o *Alert_Info_ObservedValues) Clone() *Alert_Info_ObservedValues { 533 if o == nil { 534 return nil 535 } 536 result := &Alert_Info_ObservedValues{} 537 result.ExampleValue = o.ExampleValue 538 result.PerMetric = map[string]float64{} 539 for key, sourceValue := range o.PerMetric { 540 result.PerMetric[key] = sourceValue 541 } 542 return result 543 } 544 545 func (o *Alert_Info_ObservedValues) CloneRaw() gotenobject.GotenObjectExt { 546 return o.Clone() 547 } 548 549 func (o *Alert_Info_ObservedValues) Merge(source *Alert_Info_ObservedValues) { 550 o.ExampleValue = source.GetExampleValue() 551 if source.GetPerMetric() != nil { 552 if o.PerMetric == nil { 553 o.PerMetric = make(map[string]float64, len(source.GetPerMetric())) 554 } 555 for key, sourceValue := range source.GetPerMetric() { 556 o.PerMetric[key] = sourceValue 557 } 558 } 559 } 560 561 func (o *Alert_Info_ObservedValues) MergeRaw(source gotenobject.GotenObjectExt) { 562 o.Merge(source.(*Alert_Info_ObservedValues)) 563 }