github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/notifications/notification_msg.pb.fieldmask.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/alerting/proto/v1/notification_msg.proto 3 // DO NOT EDIT!!! 4 5 package notification_msg 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 alert "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/alert" 23 rcommon "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/common" 24 log_condition "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/log_condition" 25 policy "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/policy" 26 ts_condition "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/ts_condition" 27 iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization" 28 iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project" 29 monitoring_common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v4/common" 30 durationpb "google.golang.org/protobuf/types/known/durationpb" 31 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 32 ) 33 34 // ensure the imports are used 35 var ( 36 _ = new(json.Marshaler) 37 _ = strings.Builder{} 38 39 _ = codes.NotFound 40 _ = status.Status{} 41 _ = new(proto.Message) 42 _ = new(preflect.Message) 43 _ = googlefieldmaskpb.FieldMask{} 44 45 _ = new(gotenobject.FieldMask) 46 ) 47 48 // make sure we're using proto imports 49 var ( 50 _ = &alert.Alert{} 51 _ = &log_condition.LogCondition{} 52 _ = &policy.Policy{} 53 _ = &rcommon.LogCndSpec{} 54 _ = &ts_condition.TsCondition{} 55 _ = &iam_organization.Organization{} 56 _ = &iam_project.Project{} 57 _ = &monitoring_common.LabelDescriptor{} 58 _ = &durationpb.Duration{} 59 _ = ×tamppb.Timestamp{} 60 ) 61 62 type NotificationMsg_FieldMask struct { 63 Paths []NotificationMsg_FieldPath 64 } 65 66 func FullNotificationMsg_FieldMask() *NotificationMsg_FieldMask { 67 res := &NotificationMsg_FieldMask{} 68 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorProjectFqn}) 69 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorProjectDisplayName}) 70 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorOrganizationFqn}) 71 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorOrganizationDisplayName}) 72 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorPolicyFqn}) 73 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorPolicyDisplayName}) 74 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorNewFiringAlerts}) 75 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorAlertsEscalatedByAiToOperator}) 76 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorAlertsAwaitingForApprovalWithAiRemediation}) 77 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorAlertsFlaggedToIgnoreByAi}) 78 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorAlertsWithConditionMarkedForAdjustingByAi}) 79 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorAlertsWithAiRemediationApplied}) 80 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorAlertsWithOperatorRemediationApplied}) 81 res.Paths = append(res.Paths, &NotificationMsg_FieldTerminalPath{selector: NotificationMsg_FieldPathSelectorStoppedAlerts}) 82 return res 83 } 84 85 func (fieldMask *NotificationMsg_FieldMask) String() string { 86 if fieldMask == nil { 87 return "<nil>" 88 } 89 pathsStr := make([]string, 0, len(fieldMask.Paths)) 90 for _, path := range fieldMask.Paths { 91 pathsStr = append(pathsStr, path.String()) 92 } 93 return strings.Join(pathsStr, ", ") 94 } 95 96 func (fieldMask *NotificationMsg_FieldMask) IsFull() bool { 97 if fieldMask == nil { 98 return false 99 } 100 presentSelectors := make([]bool, 14) 101 for _, path := range fieldMask.Paths { 102 if asFinal, ok := path.(*NotificationMsg_FieldTerminalPath); ok { 103 presentSelectors[int(asFinal.selector)] = true 104 } 105 } 106 for _, flag := range presentSelectors { 107 if !flag { 108 return false 109 } 110 } 111 return true 112 } 113 114 func (fieldMask *NotificationMsg_FieldMask) ProtoReflect() preflect.Message { 115 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 116 return ParseNotificationMsg_FieldPath(raw) 117 }) 118 } 119 120 func (fieldMask *NotificationMsg_FieldMask) ProtoMessage() {} 121 122 func (fieldMask *NotificationMsg_FieldMask) Reset() { 123 if fieldMask != nil { 124 fieldMask.Paths = nil 125 } 126 } 127 128 func (fieldMask *NotificationMsg_FieldMask) Subtract(other *NotificationMsg_FieldMask) *NotificationMsg_FieldMask { 129 result := &NotificationMsg_FieldMask{} 130 removedSelectors := make([]bool, 14) 131 otherSubMasks := map[NotificationMsg_FieldPathSelector]gotenobject.FieldMask{ 132 NotificationMsg_FieldPathSelectorNewFiringAlerts: &NotificationMsg_AlertsGroup_FieldMask{}, 133 NotificationMsg_FieldPathSelectorAlertsEscalatedByAiToOperator: &NotificationMsg_AlertsGroup_FieldMask{}, 134 NotificationMsg_FieldPathSelectorAlertsAwaitingForApprovalWithAiRemediation: &NotificationMsg_AlertsGroup_FieldMask{}, 135 NotificationMsg_FieldPathSelectorAlertsFlaggedToIgnoreByAi: &NotificationMsg_AlertsGroup_FieldMask{}, 136 NotificationMsg_FieldPathSelectorAlertsWithConditionMarkedForAdjustingByAi: &NotificationMsg_AlertsGroup_FieldMask{}, 137 NotificationMsg_FieldPathSelectorAlertsWithAiRemediationApplied: &NotificationMsg_AlertsGroup_FieldMask{}, 138 NotificationMsg_FieldPathSelectorAlertsWithOperatorRemediationApplied: &NotificationMsg_AlertsGroup_FieldMask{}, 139 NotificationMsg_FieldPathSelectorStoppedAlerts: &NotificationMsg_AlertsGroup_FieldMask{}, 140 } 141 mySubMasks := map[NotificationMsg_FieldPathSelector]gotenobject.FieldMask{ 142 NotificationMsg_FieldPathSelectorNewFiringAlerts: &NotificationMsg_AlertsGroup_FieldMask{}, 143 NotificationMsg_FieldPathSelectorAlertsEscalatedByAiToOperator: &NotificationMsg_AlertsGroup_FieldMask{}, 144 NotificationMsg_FieldPathSelectorAlertsAwaitingForApprovalWithAiRemediation: &NotificationMsg_AlertsGroup_FieldMask{}, 145 NotificationMsg_FieldPathSelectorAlertsFlaggedToIgnoreByAi: &NotificationMsg_AlertsGroup_FieldMask{}, 146 NotificationMsg_FieldPathSelectorAlertsWithConditionMarkedForAdjustingByAi: &NotificationMsg_AlertsGroup_FieldMask{}, 147 NotificationMsg_FieldPathSelectorAlertsWithAiRemediationApplied: &NotificationMsg_AlertsGroup_FieldMask{}, 148 NotificationMsg_FieldPathSelectorAlertsWithOperatorRemediationApplied: &NotificationMsg_AlertsGroup_FieldMask{}, 149 NotificationMsg_FieldPathSelectorStoppedAlerts: &NotificationMsg_AlertsGroup_FieldMask{}, 150 } 151 152 for _, path := range other.GetPaths() { 153 switch tp := path.(type) { 154 case *NotificationMsg_FieldTerminalPath: 155 removedSelectors[int(tp.selector)] = true 156 case *NotificationMsg_FieldSubPath: 157 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 158 } 159 } 160 for _, path := range fieldMask.GetPaths() { 161 if !removedSelectors[int(path.Selector())] { 162 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 163 if tp, ok := path.(*NotificationMsg_FieldTerminalPath); ok { 164 switch tp.selector { 165 case NotificationMsg_FieldPathSelectorNewFiringAlerts: 166 mySubMasks[NotificationMsg_FieldPathSelectorNewFiringAlerts] = FullNotificationMsg_AlertsGroup_FieldMask() 167 case NotificationMsg_FieldPathSelectorAlertsEscalatedByAiToOperator: 168 mySubMasks[NotificationMsg_FieldPathSelectorAlertsEscalatedByAiToOperator] = FullNotificationMsg_AlertsGroup_FieldMask() 169 case NotificationMsg_FieldPathSelectorAlertsAwaitingForApprovalWithAiRemediation: 170 mySubMasks[NotificationMsg_FieldPathSelectorAlertsAwaitingForApprovalWithAiRemediation] = FullNotificationMsg_AlertsGroup_FieldMask() 171 case NotificationMsg_FieldPathSelectorAlertsFlaggedToIgnoreByAi: 172 mySubMasks[NotificationMsg_FieldPathSelectorAlertsFlaggedToIgnoreByAi] = FullNotificationMsg_AlertsGroup_FieldMask() 173 case NotificationMsg_FieldPathSelectorAlertsWithConditionMarkedForAdjustingByAi: 174 mySubMasks[NotificationMsg_FieldPathSelectorAlertsWithConditionMarkedForAdjustingByAi] = FullNotificationMsg_AlertsGroup_FieldMask() 175 case NotificationMsg_FieldPathSelectorAlertsWithAiRemediationApplied: 176 mySubMasks[NotificationMsg_FieldPathSelectorAlertsWithAiRemediationApplied] = FullNotificationMsg_AlertsGroup_FieldMask() 177 case NotificationMsg_FieldPathSelectorAlertsWithOperatorRemediationApplied: 178 mySubMasks[NotificationMsg_FieldPathSelectorAlertsWithOperatorRemediationApplied] = FullNotificationMsg_AlertsGroup_FieldMask() 179 case NotificationMsg_FieldPathSelectorStoppedAlerts: 180 mySubMasks[NotificationMsg_FieldPathSelectorStoppedAlerts] = FullNotificationMsg_AlertsGroup_FieldMask() 181 } 182 } else if tp, ok := path.(*NotificationMsg_FieldSubPath); ok { 183 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 184 } 185 } else { 186 result.Paths = append(result.Paths, path) 187 } 188 } 189 } 190 for selector, mySubMask := range mySubMasks { 191 if mySubMask.PathsCount() > 0 { 192 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 193 result.Paths = append(result.Paths, &NotificationMsg_FieldSubPath{selector: selector, subPath: allowedPath}) 194 } 195 } 196 } 197 198 if len(result.Paths) == 0 { 199 return nil 200 } 201 return result 202 } 203 204 func (fieldMask *NotificationMsg_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 205 return fieldMask.Subtract(other.(*NotificationMsg_FieldMask)) 206 } 207 208 // FilterInputFields generates copy of field paths with output_only field paths removed 209 func (fieldMask *NotificationMsg_FieldMask) FilterInputFields() *NotificationMsg_FieldMask { 210 result := &NotificationMsg_FieldMask{} 211 result.Paths = append(result.Paths, fieldMask.Paths...) 212 return result 213 } 214 215 // ToFieldMask is used for proto conversions 216 func (fieldMask *NotificationMsg_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 217 protoFieldMask := &googlefieldmaskpb.FieldMask{} 218 for _, path := range fieldMask.Paths { 219 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 220 } 221 return protoFieldMask 222 } 223 224 func (fieldMask *NotificationMsg_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 225 if fieldMask == nil { 226 return status.Error(codes.Internal, "target field mask is nil") 227 } 228 fieldMask.Paths = make([]NotificationMsg_FieldPath, 0, len(protoFieldMask.Paths)) 229 for _, strPath := range protoFieldMask.Paths { 230 path, err := ParseNotificationMsg_FieldPath(strPath) 231 if err != nil { 232 return err 233 } 234 fieldMask.Paths = append(fieldMask.Paths, path) 235 } 236 return nil 237 } 238 239 // implement methods required by customType 240 func (fieldMask NotificationMsg_FieldMask) Marshal() ([]byte, error) { 241 protoFieldMask := fieldMask.ToProtoFieldMask() 242 return proto.Marshal(protoFieldMask) 243 } 244 245 func (fieldMask *NotificationMsg_FieldMask) Unmarshal(data []byte) error { 246 protoFieldMask := &googlefieldmaskpb.FieldMask{} 247 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 248 return err 249 } 250 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 251 return err 252 } 253 return nil 254 } 255 256 func (fieldMask *NotificationMsg_FieldMask) Size() int { 257 return proto.Size(fieldMask.ToProtoFieldMask()) 258 } 259 260 func (fieldMask NotificationMsg_FieldMask) MarshalJSON() ([]byte, error) { 261 return json.Marshal(fieldMask.ToProtoFieldMask()) 262 } 263 264 func (fieldMask *NotificationMsg_FieldMask) UnmarshalJSON(data []byte) error { 265 protoFieldMask := &googlefieldmaskpb.FieldMask{} 266 if err := json.Unmarshal(data, protoFieldMask); err != nil { 267 return err 268 } 269 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 270 return err 271 } 272 return nil 273 } 274 275 func (fieldMask *NotificationMsg_FieldMask) AppendPath(path NotificationMsg_FieldPath) { 276 fieldMask.Paths = append(fieldMask.Paths, path) 277 } 278 279 func (fieldMask *NotificationMsg_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 280 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsg_FieldPath)) 281 } 282 283 func (fieldMask *NotificationMsg_FieldMask) GetPaths() []NotificationMsg_FieldPath { 284 if fieldMask == nil { 285 return nil 286 } 287 return fieldMask.Paths 288 } 289 290 func (fieldMask *NotificationMsg_FieldMask) GetRawPaths() []gotenobject.FieldPath { 291 if fieldMask == nil { 292 return nil 293 } 294 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 295 for _, path := range fieldMask.Paths { 296 rawPaths = append(rawPaths, path) 297 } 298 return rawPaths 299 } 300 301 func (fieldMask *NotificationMsg_FieldMask) SetFromCliFlag(raw string) error { 302 path, err := ParseNotificationMsg_FieldPath(raw) 303 if err != nil { 304 return err 305 } 306 fieldMask.Paths = append(fieldMask.Paths, path) 307 return nil 308 } 309 310 func (fieldMask *NotificationMsg_FieldMask) Set(target, source *NotificationMsg) { 311 for _, path := range fieldMask.Paths { 312 val, _ := path.GetSingle(source) 313 // if val is nil, then field does not exist in source, skip 314 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 315 if val != nil { 316 path.WithIValue(val).SetTo(&target) 317 } 318 } 319 } 320 321 func (fieldMask *NotificationMsg_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 322 fieldMask.Set(target.(*NotificationMsg), source.(*NotificationMsg)) 323 } 324 325 func (fieldMask *NotificationMsg_FieldMask) Project(source *NotificationMsg) *NotificationMsg { 326 if source == nil { 327 return nil 328 } 329 if fieldMask == nil { 330 return source 331 } 332 result := &NotificationMsg{} 333 newFiringAlertsMask := &NotificationMsg_AlertsGroup_FieldMask{} 334 wholeNewFiringAlertsAccepted := false 335 alertsEscalatedByAiToOperatorMask := &NotificationMsg_AlertsGroup_FieldMask{} 336 wholeAlertsEscalatedByAiToOperatorAccepted := false 337 alertsAwaitingForApprovalWithAiRemediationMask := &NotificationMsg_AlertsGroup_FieldMask{} 338 wholeAlertsAwaitingForApprovalWithAiRemediationAccepted := false 339 alertsFlaggedToIgnoreByAiMask := &NotificationMsg_AlertsGroup_FieldMask{} 340 wholeAlertsFlaggedToIgnoreByAiAccepted := false 341 alertsWithConditionMarkedForAdjustingByAiMask := &NotificationMsg_AlertsGroup_FieldMask{} 342 wholeAlertsWithConditionMarkedForAdjustingByAiAccepted := false 343 alertsWithAiRemediationAppliedMask := &NotificationMsg_AlertsGroup_FieldMask{} 344 wholeAlertsWithAiRemediationAppliedAccepted := false 345 alertsWithOperatorRemediationAppliedMask := &NotificationMsg_AlertsGroup_FieldMask{} 346 wholeAlertsWithOperatorRemediationAppliedAccepted := false 347 stoppedAlertsMask := &NotificationMsg_AlertsGroup_FieldMask{} 348 wholeStoppedAlertsAccepted := false 349 350 for _, p := range fieldMask.Paths { 351 switch tp := p.(type) { 352 case *NotificationMsg_FieldTerminalPath: 353 switch tp.selector { 354 case NotificationMsg_FieldPathSelectorProjectFqn: 355 result.ProjectFqn = source.ProjectFqn 356 case NotificationMsg_FieldPathSelectorProjectDisplayName: 357 result.ProjectDisplayName = source.ProjectDisplayName 358 case NotificationMsg_FieldPathSelectorOrganizationFqn: 359 result.OrganizationFqn = source.OrganizationFqn 360 case NotificationMsg_FieldPathSelectorOrganizationDisplayName: 361 result.OrganizationDisplayName = source.OrganizationDisplayName 362 case NotificationMsg_FieldPathSelectorPolicyFqn: 363 result.PolicyFqn = source.PolicyFqn 364 case NotificationMsg_FieldPathSelectorPolicyDisplayName: 365 result.PolicyDisplayName = source.PolicyDisplayName 366 case NotificationMsg_FieldPathSelectorNewFiringAlerts: 367 result.NewFiringAlerts = source.NewFiringAlerts 368 wholeNewFiringAlertsAccepted = true 369 case NotificationMsg_FieldPathSelectorAlertsEscalatedByAiToOperator: 370 result.AlertsEscalatedByAiToOperator = source.AlertsEscalatedByAiToOperator 371 wholeAlertsEscalatedByAiToOperatorAccepted = true 372 case NotificationMsg_FieldPathSelectorAlertsAwaitingForApprovalWithAiRemediation: 373 result.AlertsAwaitingForApprovalWithAiRemediation = source.AlertsAwaitingForApprovalWithAiRemediation 374 wholeAlertsAwaitingForApprovalWithAiRemediationAccepted = true 375 case NotificationMsg_FieldPathSelectorAlertsFlaggedToIgnoreByAi: 376 result.AlertsFlaggedToIgnoreByAi = source.AlertsFlaggedToIgnoreByAi 377 wholeAlertsFlaggedToIgnoreByAiAccepted = true 378 case NotificationMsg_FieldPathSelectorAlertsWithConditionMarkedForAdjustingByAi: 379 result.AlertsWithConditionMarkedForAdjustingByAi = source.AlertsWithConditionMarkedForAdjustingByAi 380 wholeAlertsWithConditionMarkedForAdjustingByAiAccepted = true 381 case NotificationMsg_FieldPathSelectorAlertsWithAiRemediationApplied: 382 result.AlertsWithAiRemediationApplied = source.AlertsWithAiRemediationApplied 383 wholeAlertsWithAiRemediationAppliedAccepted = true 384 case NotificationMsg_FieldPathSelectorAlertsWithOperatorRemediationApplied: 385 result.AlertsWithOperatorRemediationApplied = source.AlertsWithOperatorRemediationApplied 386 wholeAlertsWithOperatorRemediationAppliedAccepted = true 387 case NotificationMsg_FieldPathSelectorStoppedAlerts: 388 result.StoppedAlerts = source.StoppedAlerts 389 wholeStoppedAlertsAccepted = true 390 } 391 case *NotificationMsg_FieldSubPath: 392 switch tp.selector { 393 case NotificationMsg_FieldPathSelectorNewFiringAlerts: 394 newFiringAlertsMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 395 case NotificationMsg_FieldPathSelectorAlertsEscalatedByAiToOperator: 396 alertsEscalatedByAiToOperatorMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 397 case NotificationMsg_FieldPathSelectorAlertsAwaitingForApprovalWithAiRemediation: 398 alertsAwaitingForApprovalWithAiRemediationMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 399 case NotificationMsg_FieldPathSelectorAlertsFlaggedToIgnoreByAi: 400 alertsFlaggedToIgnoreByAiMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 401 case NotificationMsg_FieldPathSelectorAlertsWithConditionMarkedForAdjustingByAi: 402 alertsWithConditionMarkedForAdjustingByAiMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 403 case NotificationMsg_FieldPathSelectorAlertsWithAiRemediationApplied: 404 alertsWithAiRemediationAppliedMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 405 case NotificationMsg_FieldPathSelectorAlertsWithOperatorRemediationApplied: 406 alertsWithOperatorRemediationAppliedMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 407 case NotificationMsg_FieldPathSelectorStoppedAlerts: 408 stoppedAlertsMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroup_FieldPath)) 409 } 410 } 411 } 412 if wholeNewFiringAlertsAccepted == false && len(newFiringAlertsMask.Paths) > 0 { 413 result.NewFiringAlerts = newFiringAlertsMask.Project(source.GetNewFiringAlerts()) 414 } 415 if wholeAlertsEscalatedByAiToOperatorAccepted == false && len(alertsEscalatedByAiToOperatorMask.Paths) > 0 { 416 result.AlertsEscalatedByAiToOperator = alertsEscalatedByAiToOperatorMask.Project(source.GetAlertsEscalatedByAiToOperator()) 417 } 418 if wholeAlertsAwaitingForApprovalWithAiRemediationAccepted == false && len(alertsAwaitingForApprovalWithAiRemediationMask.Paths) > 0 { 419 result.AlertsAwaitingForApprovalWithAiRemediation = alertsAwaitingForApprovalWithAiRemediationMask.Project(source.GetAlertsAwaitingForApprovalWithAiRemediation()) 420 } 421 if wholeAlertsFlaggedToIgnoreByAiAccepted == false && len(alertsFlaggedToIgnoreByAiMask.Paths) > 0 { 422 result.AlertsFlaggedToIgnoreByAi = alertsFlaggedToIgnoreByAiMask.Project(source.GetAlertsFlaggedToIgnoreByAi()) 423 } 424 if wholeAlertsWithConditionMarkedForAdjustingByAiAccepted == false && len(alertsWithConditionMarkedForAdjustingByAiMask.Paths) > 0 { 425 result.AlertsWithConditionMarkedForAdjustingByAi = alertsWithConditionMarkedForAdjustingByAiMask.Project(source.GetAlertsWithConditionMarkedForAdjustingByAi()) 426 } 427 if wholeAlertsWithAiRemediationAppliedAccepted == false && len(alertsWithAiRemediationAppliedMask.Paths) > 0 { 428 result.AlertsWithAiRemediationApplied = alertsWithAiRemediationAppliedMask.Project(source.GetAlertsWithAiRemediationApplied()) 429 } 430 if wholeAlertsWithOperatorRemediationAppliedAccepted == false && len(alertsWithOperatorRemediationAppliedMask.Paths) > 0 { 431 result.AlertsWithOperatorRemediationApplied = alertsWithOperatorRemediationAppliedMask.Project(source.GetAlertsWithOperatorRemediationApplied()) 432 } 433 if wholeStoppedAlertsAccepted == false && len(stoppedAlertsMask.Paths) > 0 { 434 result.StoppedAlerts = stoppedAlertsMask.Project(source.GetStoppedAlerts()) 435 } 436 return result 437 } 438 439 func (fieldMask *NotificationMsg_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 440 return fieldMask.Project(source.(*NotificationMsg)) 441 } 442 443 func (fieldMask *NotificationMsg_FieldMask) PathsCount() int { 444 if fieldMask == nil { 445 return 0 446 } 447 return len(fieldMask.Paths) 448 } 449 450 type NotificationMsg_AlertsGroup_FieldMask struct { 451 Paths []NotificationMsgAlertsGroup_FieldPath 452 } 453 454 func FullNotificationMsg_AlertsGroup_FieldMask() *NotificationMsg_AlertsGroup_FieldMask { 455 res := &NotificationMsg_AlertsGroup_FieldMask{} 456 res.Paths = append(res.Paths, &NotificationMsgAlertsGroup_FieldTerminalPath{selector: NotificationMsgAlertsGroup_FieldPathSelectorByCondition}) 457 return res 458 } 459 460 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) String() string { 461 if fieldMask == nil { 462 return "<nil>" 463 } 464 pathsStr := make([]string, 0, len(fieldMask.Paths)) 465 for _, path := range fieldMask.Paths { 466 pathsStr = append(pathsStr, path.String()) 467 } 468 return strings.Join(pathsStr, ", ") 469 } 470 471 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) IsFull() bool { 472 if fieldMask == nil { 473 return false 474 } 475 presentSelectors := make([]bool, 1) 476 for _, path := range fieldMask.Paths { 477 if asFinal, ok := path.(*NotificationMsgAlertsGroup_FieldTerminalPath); ok { 478 presentSelectors[int(asFinal.selector)] = true 479 } 480 } 481 for _, flag := range presentSelectors { 482 if !flag { 483 return false 484 } 485 } 486 return true 487 } 488 489 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) ProtoReflect() preflect.Message { 490 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 491 return ParseNotificationMsgAlertsGroup_FieldPath(raw) 492 }) 493 } 494 495 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) ProtoMessage() {} 496 497 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) Reset() { 498 if fieldMask != nil { 499 fieldMask.Paths = nil 500 } 501 } 502 503 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_FieldMask) *NotificationMsg_AlertsGroup_FieldMask { 504 result := &NotificationMsg_AlertsGroup_FieldMask{} 505 removedSelectors := make([]bool, 1) 506 otherSubMasks := map[NotificationMsgAlertsGroup_FieldPathSelector]gotenobject.FieldMask{ 507 NotificationMsgAlertsGroup_FieldPathSelectorByCondition: &NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask{}, 508 } 509 mySubMasks := map[NotificationMsgAlertsGroup_FieldPathSelector]gotenobject.FieldMask{ 510 NotificationMsgAlertsGroup_FieldPathSelectorByCondition: &NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask{}, 511 } 512 513 for _, path := range other.GetPaths() { 514 switch tp := path.(type) { 515 case *NotificationMsgAlertsGroup_FieldTerminalPath: 516 removedSelectors[int(tp.selector)] = true 517 case *NotificationMsgAlertsGroup_FieldSubPath: 518 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 519 } 520 } 521 for _, path := range fieldMask.GetPaths() { 522 if !removedSelectors[int(path.Selector())] { 523 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 524 if tp, ok := path.(*NotificationMsgAlertsGroup_FieldTerminalPath); ok { 525 switch tp.selector { 526 case NotificationMsgAlertsGroup_FieldPathSelectorByCondition: 527 mySubMasks[NotificationMsgAlertsGroup_FieldPathSelectorByCondition] = FullNotificationMsg_AlertsGroup_ConditionAlerts_FieldMask() 528 } 529 } else if tp, ok := path.(*NotificationMsgAlertsGroup_FieldSubPath); ok { 530 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 531 } 532 } else { 533 result.Paths = append(result.Paths, path) 534 } 535 } 536 } 537 for selector, mySubMask := range mySubMasks { 538 if mySubMask.PathsCount() > 0 { 539 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 540 result.Paths = append(result.Paths, &NotificationMsgAlertsGroup_FieldSubPath{selector: selector, subPath: allowedPath}) 541 } 542 } 543 } 544 545 if len(result.Paths) == 0 { 546 return nil 547 } 548 return result 549 } 550 551 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 552 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_FieldMask)) 553 } 554 555 // FilterInputFields generates copy of field paths with output_only field paths removed 556 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_FieldMask { 557 result := &NotificationMsg_AlertsGroup_FieldMask{} 558 result.Paths = append(result.Paths, fieldMask.Paths...) 559 return result 560 } 561 562 // ToFieldMask is used for proto conversions 563 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 564 protoFieldMask := &googlefieldmaskpb.FieldMask{} 565 for _, path := range fieldMask.Paths { 566 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 567 } 568 return protoFieldMask 569 } 570 571 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 572 if fieldMask == nil { 573 return status.Error(codes.Internal, "target field mask is nil") 574 } 575 fieldMask.Paths = make([]NotificationMsgAlertsGroup_FieldPath, 0, len(protoFieldMask.Paths)) 576 for _, strPath := range protoFieldMask.Paths { 577 path, err := ParseNotificationMsgAlertsGroup_FieldPath(strPath) 578 if err != nil { 579 return err 580 } 581 fieldMask.Paths = append(fieldMask.Paths, path) 582 } 583 return nil 584 } 585 586 // implement methods required by customType 587 func (fieldMask NotificationMsg_AlertsGroup_FieldMask) Marshal() ([]byte, error) { 588 protoFieldMask := fieldMask.ToProtoFieldMask() 589 return proto.Marshal(protoFieldMask) 590 } 591 592 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) Unmarshal(data []byte) error { 593 protoFieldMask := &googlefieldmaskpb.FieldMask{} 594 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 595 return err 596 } 597 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 598 return err 599 } 600 return nil 601 } 602 603 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) Size() int { 604 return proto.Size(fieldMask.ToProtoFieldMask()) 605 } 606 607 func (fieldMask NotificationMsg_AlertsGroup_FieldMask) MarshalJSON() ([]byte, error) { 608 return json.Marshal(fieldMask.ToProtoFieldMask()) 609 } 610 611 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) UnmarshalJSON(data []byte) error { 612 protoFieldMask := &googlefieldmaskpb.FieldMask{} 613 if err := json.Unmarshal(data, protoFieldMask); err != nil { 614 return err 615 } 616 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 617 return err 618 } 619 return nil 620 } 621 622 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) AppendPath(path NotificationMsgAlertsGroup_FieldPath) { 623 fieldMask.Paths = append(fieldMask.Paths, path) 624 } 625 626 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 627 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroup_FieldPath)) 628 } 629 630 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) GetPaths() []NotificationMsgAlertsGroup_FieldPath { 631 if fieldMask == nil { 632 return nil 633 } 634 return fieldMask.Paths 635 } 636 637 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) GetRawPaths() []gotenobject.FieldPath { 638 if fieldMask == nil { 639 return nil 640 } 641 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 642 for _, path := range fieldMask.Paths { 643 rawPaths = append(rawPaths, path) 644 } 645 return rawPaths 646 } 647 648 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) SetFromCliFlag(raw string) error { 649 path, err := ParseNotificationMsgAlertsGroup_FieldPath(raw) 650 if err != nil { 651 return err 652 } 653 fieldMask.Paths = append(fieldMask.Paths, path) 654 return nil 655 } 656 657 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) Set(target, source *NotificationMsg_AlertsGroup) { 658 for _, path := range fieldMask.Paths { 659 val, _ := path.GetSingle(source) 660 // if val is nil, then field does not exist in source, skip 661 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 662 if val != nil { 663 path.WithIValue(val).SetTo(&target) 664 } 665 } 666 } 667 668 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 669 fieldMask.Set(target.(*NotificationMsg_AlertsGroup), source.(*NotificationMsg_AlertsGroup)) 670 } 671 672 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) Project(source *NotificationMsg_AlertsGroup) *NotificationMsg_AlertsGroup { 673 if source == nil { 674 return nil 675 } 676 if fieldMask == nil { 677 return source 678 } 679 result := &NotificationMsg_AlertsGroup{} 680 byConditionMask := &NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask{} 681 wholeByConditionAccepted := false 682 683 for _, p := range fieldMask.Paths { 684 switch tp := p.(type) { 685 case *NotificationMsgAlertsGroup_FieldTerminalPath: 686 switch tp.selector { 687 case NotificationMsgAlertsGroup_FieldPathSelectorByCondition: 688 result.ByCondition = source.ByCondition 689 wholeByConditionAccepted = true 690 } 691 case *NotificationMsgAlertsGroup_FieldSubPath: 692 switch tp.selector { 693 case NotificationMsgAlertsGroup_FieldPathSelectorByCondition: 694 byConditionMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlerts_FieldPath)) 695 } 696 } 697 } 698 if wholeByConditionAccepted == false && len(byConditionMask.Paths) > 0 { 699 for _, sourceItem := range source.GetByCondition() { 700 result.ByCondition = append(result.ByCondition, byConditionMask.Project(sourceItem)) 701 } 702 } 703 return result 704 } 705 706 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 707 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup)) 708 } 709 710 func (fieldMask *NotificationMsg_AlertsGroup_FieldMask) PathsCount() int { 711 if fieldMask == nil { 712 return 0 713 } 714 return len(fieldMask.Paths) 715 } 716 717 type NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask struct { 718 Paths []NotificationMsgAlertsGroupConditionAlerts_FieldPath 719 } 720 721 func FullNotificationMsg_AlertsGroup_ConditionAlerts_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask { 722 res := &NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask{} 723 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorTimeSeriesCondition}) 724 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorLogCondition}) 725 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorAlerts}) 726 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorMoreAlertsCount}) 727 return res 728 } 729 730 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) String() string { 731 if fieldMask == nil { 732 return "<nil>" 733 } 734 pathsStr := make([]string, 0, len(fieldMask.Paths)) 735 for _, path := range fieldMask.Paths { 736 pathsStr = append(pathsStr, path.String()) 737 } 738 return strings.Join(pathsStr, ", ") 739 } 740 741 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) IsFull() bool { 742 if fieldMask == nil { 743 return false 744 } 745 presentSelectors := make([]bool, 4) 746 for _, path := range fieldMask.Paths { 747 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath); ok { 748 presentSelectors[int(asFinal.selector)] = true 749 } 750 } 751 for _, flag := range presentSelectors { 752 if !flag { 753 return false 754 } 755 } 756 return true 757 } 758 759 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) ProtoReflect() preflect.Message { 760 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 761 return ParseNotificationMsgAlertsGroupConditionAlerts_FieldPath(raw) 762 }) 763 } 764 765 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) ProtoMessage() {} 766 767 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) Reset() { 768 if fieldMask != nil { 769 fieldMask.Paths = nil 770 } 771 } 772 773 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask { 774 result := &NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask{} 775 removedSelectors := make([]bool, 4) 776 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlerts_FieldPathSelector]gotenobject.FieldMask{ 777 NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorTimeSeriesCondition: &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask{}, 778 NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorLogCondition: &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask{}, 779 NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorAlerts: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask{}, 780 } 781 mySubMasks := map[NotificationMsgAlertsGroupConditionAlerts_FieldPathSelector]gotenobject.FieldMask{ 782 NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorTimeSeriesCondition: &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask{}, 783 NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorLogCondition: &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask{}, 784 NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorAlerts: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask{}, 785 } 786 787 for _, path := range other.GetPaths() { 788 switch tp := path.(type) { 789 case *NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath: 790 removedSelectors[int(tp.selector)] = true 791 case *NotificationMsgAlertsGroupConditionAlerts_FieldSubPath: 792 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 793 } 794 } 795 for _, path := range fieldMask.GetPaths() { 796 if !removedSelectors[int(path.Selector())] { 797 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 798 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath); ok { 799 switch tp.selector { 800 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorTimeSeriesCondition: 801 mySubMasks[NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorTimeSeriesCondition] = FullNotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask() 802 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorLogCondition: 803 mySubMasks[NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorLogCondition] = FullNotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask() 804 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorAlerts: 805 mySubMasks[NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorAlerts] = FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask() 806 } 807 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlerts_FieldSubPath); ok { 808 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 809 } 810 } else { 811 result.Paths = append(result.Paths, path) 812 } 813 } 814 } 815 for selector, mySubMask := range mySubMasks { 816 if mySubMask.PathsCount() > 0 { 817 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 818 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlerts_FieldSubPath{selector: selector, subPath: allowedPath}) 819 } 820 } 821 } 822 823 if len(result.Paths) == 0 { 824 return nil 825 } 826 return result 827 } 828 829 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 830 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask)) 831 } 832 833 // FilterInputFields generates copy of field paths with output_only field paths removed 834 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask { 835 result := &NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask{} 836 result.Paths = append(result.Paths, fieldMask.Paths...) 837 return result 838 } 839 840 // ToFieldMask is used for proto conversions 841 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 842 protoFieldMask := &googlefieldmaskpb.FieldMask{} 843 for _, path := range fieldMask.Paths { 844 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 845 } 846 return protoFieldMask 847 } 848 849 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 850 if fieldMask == nil { 851 return status.Error(codes.Internal, "target field mask is nil") 852 } 853 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlerts_FieldPath, 0, len(protoFieldMask.Paths)) 854 for _, strPath := range protoFieldMask.Paths { 855 path, err := ParseNotificationMsgAlertsGroupConditionAlerts_FieldPath(strPath) 856 if err != nil { 857 return err 858 } 859 fieldMask.Paths = append(fieldMask.Paths, path) 860 } 861 return nil 862 } 863 864 // implement methods required by customType 865 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) Marshal() ([]byte, error) { 866 protoFieldMask := fieldMask.ToProtoFieldMask() 867 return proto.Marshal(protoFieldMask) 868 } 869 870 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) Unmarshal(data []byte) error { 871 protoFieldMask := &googlefieldmaskpb.FieldMask{} 872 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 873 return err 874 } 875 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 876 return err 877 } 878 return nil 879 } 880 881 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) Size() int { 882 return proto.Size(fieldMask.ToProtoFieldMask()) 883 } 884 885 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) MarshalJSON() ([]byte, error) { 886 return json.Marshal(fieldMask.ToProtoFieldMask()) 887 } 888 889 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) UnmarshalJSON(data []byte) error { 890 protoFieldMask := &googlefieldmaskpb.FieldMask{} 891 if err := json.Unmarshal(data, protoFieldMask); err != nil { 892 return err 893 } 894 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 895 return err 896 } 897 return nil 898 } 899 900 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlerts_FieldPath) { 901 fieldMask.Paths = append(fieldMask.Paths, path) 902 } 903 904 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 905 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlerts_FieldPath)) 906 } 907 908 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlerts_FieldPath { 909 if fieldMask == nil { 910 return nil 911 } 912 return fieldMask.Paths 913 } 914 915 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) GetRawPaths() []gotenobject.FieldPath { 916 if fieldMask == nil { 917 return nil 918 } 919 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 920 for _, path := range fieldMask.Paths { 921 rawPaths = append(rawPaths, path) 922 } 923 return rawPaths 924 } 925 926 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) SetFromCliFlag(raw string) error { 927 path, err := ParseNotificationMsgAlertsGroupConditionAlerts_FieldPath(raw) 928 if err != nil { 929 return err 930 } 931 fieldMask.Paths = append(fieldMask.Paths, path) 932 return nil 933 } 934 935 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts) { 936 for _, path := range fieldMask.Paths { 937 val, _ := path.GetSingle(source) 938 // if val is nil, then field does not exist in source, skip 939 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 940 if val != nil { 941 path.WithIValue(val).SetTo(&target) 942 } 943 } 944 } 945 946 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 947 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts), source.(*NotificationMsg_AlertsGroup_ConditionAlerts)) 948 } 949 950 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts) *NotificationMsg_AlertsGroup_ConditionAlerts { 951 if source == nil { 952 return nil 953 } 954 if fieldMask == nil { 955 return source 956 } 957 result := &NotificationMsg_AlertsGroup_ConditionAlerts{} 958 timeSeriesConditionMask := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask{} 959 wholeTimeSeriesConditionAccepted := false 960 logConditionMask := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask{} 961 wholeLogConditionAccepted := false 962 alertsMask := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask{} 963 wholeAlertsAccepted := false 964 965 for _, p := range fieldMask.Paths { 966 switch tp := p.(type) { 967 case *NotificationMsgAlertsGroupConditionAlerts_FieldTerminalPath: 968 switch tp.selector { 969 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorTimeSeriesCondition: 970 if source, ok := source.Type.(*NotificationMsg_AlertsGroup_ConditionAlerts_TimeSeriesCondition); ok { 971 result.Type = &NotificationMsg_AlertsGroup_ConditionAlerts_TimeSeriesCondition{ 972 TimeSeriesCondition: source.TimeSeriesCondition, 973 } 974 } 975 wholeTimeSeriesConditionAccepted = true 976 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorLogCondition: 977 if source, ok := source.Type.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCondition); ok { 978 result.Type = &NotificationMsg_AlertsGroup_ConditionAlerts_LogCondition{ 979 LogCondition: source.LogCondition, 980 } 981 } 982 wholeLogConditionAccepted = true 983 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorAlerts: 984 result.Alerts = source.Alerts 985 wholeAlertsAccepted = true 986 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorMoreAlertsCount: 987 result.MoreAlertsCount = source.MoreAlertsCount 988 } 989 case *NotificationMsgAlertsGroupConditionAlerts_FieldSubPath: 990 switch tp.selector { 991 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorTimeSeriesCondition: 992 timeSeriesConditionMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath)) 993 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorLogCondition: 994 logConditionMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath)) 995 case NotificationMsgAlertsGroupConditionAlerts_FieldPathSelectorAlerts: 996 alertsMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsAlert_FieldPath)) 997 } 998 } 999 } 1000 if wholeTimeSeriesConditionAccepted == false && len(timeSeriesConditionMask.Paths) > 0 { 1001 if asOneOf, ok := source.Type.(*NotificationMsg_AlertsGroup_ConditionAlerts_TimeSeriesCondition); ok { 1002 result.Type = (*NotificationMsg_AlertsGroup_ConditionAlerts_TimeSeriesCondition)(nil) 1003 if asOneOf != nil { 1004 oneOfRes := &NotificationMsg_AlertsGroup_ConditionAlerts_TimeSeriesCondition{} 1005 oneOfRes.TimeSeriesCondition = timeSeriesConditionMask.Project(asOneOf.TimeSeriesCondition) 1006 result.Type = oneOfRes 1007 } 1008 } 1009 } 1010 if wholeLogConditionAccepted == false && len(logConditionMask.Paths) > 0 { 1011 if asOneOf, ok := source.Type.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCondition); ok { 1012 result.Type = (*NotificationMsg_AlertsGroup_ConditionAlerts_LogCondition)(nil) 1013 if asOneOf != nil { 1014 oneOfRes := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCondition{} 1015 oneOfRes.LogCondition = logConditionMask.Project(asOneOf.LogCondition) 1016 result.Type = oneOfRes 1017 } 1018 } 1019 } 1020 if wholeAlertsAccepted == false && len(alertsMask.Paths) > 0 { 1021 for _, sourceItem := range source.GetAlerts() { 1022 result.Alerts = append(result.Alerts, alertsMask.Project(sourceItem)) 1023 } 1024 } 1025 return result 1026 } 1027 1028 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1029 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts)) 1030 } 1031 1032 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_FieldMask) PathsCount() int { 1033 if fieldMask == nil { 1034 return 0 1035 } 1036 return len(fieldMask.Paths) 1037 } 1038 1039 type NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask struct { 1040 Paths []NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath 1041 } 1042 1043 func FullNotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask { 1044 res := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask{} 1045 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorFqn}) 1046 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorDisplayName}) 1047 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorQueries}) 1048 return res 1049 } 1050 1051 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) String() string { 1052 if fieldMask == nil { 1053 return "<nil>" 1054 } 1055 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1056 for _, path := range fieldMask.Paths { 1057 pathsStr = append(pathsStr, path.String()) 1058 } 1059 return strings.Join(pathsStr, ", ") 1060 } 1061 1062 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) IsFull() bool { 1063 if fieldMask == nil { 1064 return false 1065 } 1066 presentSelectors := make([]bool, 3) 1067 for _, path := range fieldMask.Paths { 1068 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldTerminalPath); ok { 1069 presentSelectors[int(asFinal.selector)] = true 1070 } 1071 } 1072 for _, flag := range presentSelectors { 1073 if !flag { 1074 return false 1075 } 1076 } 1077 return true 1078 } 1079 1080 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) ProtoReflect() preflect.Message { 1081 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1082 return ParseNotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath(raw) 1083 }) 1084 } 1085 1086 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) ProtoMessage() {} 1087 1088 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) Reset() { 1089 if fieldMask != nil { 1090 fieldMask.Paths = nil 1091 } 1092 } 1093 1094 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask { 1095 result := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask{} 1096 removedSelectors := make([]bool, 3) 1097 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelector]gotenobject.FieldMask{ 1098 NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorQueries: &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask{}, 1099 } 1100 mySubMasks := map[NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelector]gotenobject.FieldMask{ 1101 NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorQueries: &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask{}, 1102 } 1103 1104 for _, path := range other.GetPaths() { 1105 switch tp := path.(type) { 1106 case *NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldTerminalPath: 1107 removedSelectors[int(tp.selector)] = true 1108 case *NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldSubPath: 1109 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1110 } 1111 } 1112 for _, path := range fieldMask.GetPaths() { 1113 if !removedSelectors[int(path.Selector())] { 1114 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1115 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldTerminalPath); ok { 1116 switch tp.selector { 1117 case NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorQueries: 1118 mySubMasks[NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorQueries] = FullNotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask() 1119 } 1120 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldSubPath); ok { 1121 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1122 } 1123 } else { 1124 result.Paths = append(result.Paths, path) 1125 } 1126 } 1127 } 1128 for selector, mySubMask := range mySubMasks { 1129 if mySubMask.PathsCount() > 0 { 1130 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1131 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldSubPath{selector: selector, subPath: allowedPath}) 1132 } 1133 } 1134 } 1135 1136 if len(result.Paths) == 0 { 1137 return nil 1138 } 1139 return result 1140 } 1141 1142 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1143 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask)) 1144 } 1145 1146 // FilterInputFields generates copy of field paths with output_only field paths removed 1147 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask { 1148 result := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask{} 1149 result.Paths = append(result.Paths, fieldMask.Paths...) 1150 return result 1151 } 1152 1153 // ToFieldMask is used for proto conversions 1154 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1155 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1156 for _, path := range fieldMask.Paths { 1157 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1158 } 1159 return protoFieldMask 1160 } 1161 1162 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1163 if fieldMask == nil { 1164 return status.Error(codes.Internal, "target field mask is nil") 1165 } 1166 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath, 0, len(protoFieldMask.Paths)) 1167 for _, strPath := range protoFieldMask.Paths { 1168 path, err := ParseNotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath(strPath) 1169 if err != nil { 1170 return err 1171 } 1172 fieldMask.Paths = append(fieldMask.Paths, path) 1173 } 1174 return nil 1175 } 1176 1177 // implement methods required by customType 1178 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) Marshal() ([]byte, error) { 1179 protoFieldMask := fieldMask.ToProtoFieldMask() 1180 return proto.Marshal(protoFieldMask) 1181 } 1182 1183 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) Unmarshal(data []byte) error { 1184 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1185 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1186 return err 1187 } 1188 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1189 return err 1190 } 1191 return nil 1192 } 1193 1194 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) Size() int { 1195 return proto.Size(fieldMask.ToProtoFieldMask()) 1196 } 1197 1198 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) MarshalJSON() ([]byte, error) { 1199 return json.Marshal(fieldMask.ToProtoFieldMask()) 1200 } 1201 1202 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) UnmarshalJSON(data []byte) error { 1203 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1204 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1205 return err 1206 } 1207 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1208 return err 1209 } 1210 return nil 1211 } 1212 1213 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath) { 1214 fieldMask.Paths = append(fieldMask.Paths, path) 1215 } 1216 1217 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1218 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath)) 1219 } 1220 1221 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath { 1222 if fieldMask == nil { 1223 return nil 1224 } 1225 return fieldMask.Paths 1226 } 1227 1228 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1229 if fieldMask == nil { 1230 return nil 1231 } 1232 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1233 for _, path := range fieldMask.Paths { 1234 rawPaths = append(rawPaths, path) 1235 } 1236 return rawPaths 1237 } 1238 1239 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) SetFromCliFlag(raw string) error { 1240 path, err := ParseNotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPath(raw) 1241 if err != nil { 1242 return err 1243 } 1244 fieldMask.Paths = append(fieldMask.Paths, path) 1245 return nil 1246 } 1247 1248 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType) { 1249 for _, path := range fieldMask.Paths { 1250 val, _ := path.GetSingle(source) 1251 // if val is nil, then field does not exist in source, skip 1252 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1253 if val != nil { 1254 path.WithIValue(val).SetTo(&target) 1255 } 1256 } 1257 } 1258 1259 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1260 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType)) 1261 } 1262 1263 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType) *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType { 1264 if source == nil { 1265 return nil 1266 } 1267 if fieldMask == nil { 1268 return source 1269 } 1270 result := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType{} 1271 queriesMask := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask{} 1272 wholeQueriesAccepted := false 1273 1274 for _, p := range fieldMask.Paths { 1275 switch tp := p.(type) { 1276 case *NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldTerminalPath: 1277 switch tp.selector { 1278 case NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorFqn: 1279 result.Fqn = source.Fqn 1280 case NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorDisplayName: 1281 result.DisplayName = source.DisplayName 1282 case NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorQueries: 1283 result.Queries = source.Queries 1284 wholeQueriesAccepted = true 1285 } 1286 case *NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldSubPath: 1287 switch tp.selector { 1288 case NotificationMsgAlertsGroupConditionAlertsTsCndType_FieldPathSelectorQueries: 1289 queriesMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath)) 1290 } 1291 } 1292 } 1293 if wholeQueriesAccepted == false && len(queriesMask.Paths) > 0 { 1294 for _, sourceItem := range source.GetQueries() { 1295 result.Queries = append(result.Queries, queriesMask.Project(sourceItem)) 1296 } 1297 } 1298 return result 1299 } 1300 1301 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1302 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType)) 1303 } 1304 1305 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_FieldMask) PathsCount() int { 1306 if fieldMask == nil { 1307 return 0 1308 } 1309 return len(fieldMask.Paths) 1310 } 1311 1312 type NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask struct { 1313 Paths []NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath 1314 } 1315 1316 func FullNotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask { 1317 res := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask{} 1318 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorFqn}) 1319 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorDisplayName}) 1320 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorQueries}) 1321 return res 1322 } 1323 1324 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) String() string { 1325 if fieldMask == nil { 1326 return "<nil>" 1327 } 1328 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1329 for _, path := range fieldMask.Paths { 1330 pathsStr = append(pathsStr, path.String()) 1331 } 1332 return strings.Join(pathsStr, ", ") 1333 } 1334 1335 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) IsFull() bool { 1336 if fieldMask == nil { 1337 return false 1338 } 1339 presentSelectors := make([]bool, 3) 1340 for _, path := range fieldMask.Paths { 1341 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldTerminalPath); ok { 1342 presentSelectors[int(asFinal.selector)] = true 1343 } 1344 } 1345 for _, flag := range presentSelectors { 1346 if !flag { 1347 return false 1348 } 1349 } 1350 return true 1351 } 1352 1353 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) ProtoReflect() preflect.Message { 1354 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1355 return ParseNotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath(raw) 1356 }) 1357 } 1358 1359 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) ProtoMessage() {} 1360 1361 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) Reset() { 1362 if fieldMask != nil { 1363 fieldMask.Paths = nil 1364 } 1365 } 1366 1367 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask { 1368 result := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask{} 1369 removedSelectors := make([]bool, 3) 1370 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelector]gotenobject.FieldMask{ 1371 NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorQueries: &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask{}, 1372 } 1373 mySubMasks := map[NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelector]gotenobject.FieldMask{ 1374 NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorQueries: &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask{}, 1375 } 1376 1377 for _, path := range other.GetPaths() { 1378 switch tp := path.(type) { 1379 case *NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldTerminalPath: 1380 removedSelectors[int(tp.selector)] = true 1381 case *NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldSubPath: 1382 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1383 } 1384 } 1385 for _, path := range fieldMask.GetPaths() { 1386 if !removedSelectors[int(path.Selector())] { 1387 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1388 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldTerminalPath); ok { 1389 switch tp.selector { 1390 case NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorQueries: 1391 mySubMasks[NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorQueries] = FullNotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask() 1392 } 1393 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldSubPath); ok { 1394 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1395 } 1396 } else { 1397 result.Paths = append(result.Paths, path) 1398 } 1399 } 1400 } 1401 for selector, mySubMask := range mySubMasks { 1402 if mySubMask.PathsCount() > 0 { 1403 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1404 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldSubPath{selector: selector, subPath: allowedPath}) 1405 } 1406 } 1407 } 1408 1409 if len(result.Paths) == 0 { 1410 return nil 1411 } 1412 return result 1413 } 1414 1415 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1416 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask)) 1417 } 1418 1419 // FilterInputFields generates copy of field paths with output_only field paths removed 1420 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask { 1421 result := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask{} 1422 result.Paths = append(result.Paths, fieldMask.Paths...) 1423 return result 1424 } 1425 1426 // ToFieldMask is used for proto conversions 1427 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1428 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1429 for _, path := range fieldMask.Paths { 1430 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1431 } 1432 return protoFieldMask 1433 } 1434 1435 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1436 if fieldMask == nil { 1437 return status.Error(codes.Internal, "target field mask is nil") 1438 } 1439 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath, 0, len(protoFieldMask.Paths)) 1440 for _, strPath := range protoFieldMask.Paths { 1441 path, err := ParseNotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath(strPath) 1442 if err != nil { 1443 return err 1444 } 1445 fieldMask.Paths = append(fieldMask.Paths, path) 1446 } 1447 return nil 1448 } 1449 1450 // implement methods required by customType 1451 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) Marshal() ([]byte, error) { 1452 protoFieldMask := fieldMask.ToProtoFieldMask() 1453 return proto.Marshal(protoFieldMask) 1454 } 1455 1456 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) Unmarshal(data []byte) error { 1457 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1458 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1459 return err 1460 } 1461 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1462 return err 1463 } 1464 return nil 1465 } 1466 1467 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) Size() int { 1468 return proto.Size(fieldMask.ToProtoFieldMask()) 1469 } 1470 1471 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) MarshalJSON() ([]byte, error) { 1472 return json.Marshal(fieldMask.ToProtoFieldMask()) 1473 } 1474 1475 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) UnmarshalJSON(data []byte) error { 1476 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1477 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1478 return err 1479 } 1480 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1481 return err 1482 } 1483 return nil 1484 } 1485 1486 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath) { 1487 fieldMask.Paths = append(fieldMask.Paths, path) 1488 } 1489 1490 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1491 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath)) 1492 } 1493 1494 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath { 1495 if fieldMask == nil { 1496 return nil 1497 } 1498 return fieldMask.Paths 1499 } 1500 1501 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1502 if fieldMask == nil { 1503 return nil 1504 } 1505 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1506 for _, path := range fieldMask.Paths { 1507 rawPaths = append(rawPaths, path) 1508 } 1509 return rawPaths 1510 } 1511 1512 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) SetFromCliFlag(raw string) error { 1513 path, err := ParseNotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPath(raw) 1514 if err != nil { 1515 return err 1516 } 1517 fieldMask.Paths = append(fieldMask.Paths, path) 1518 return nil 1519 } 1520 1521 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType) { 1522 for _, path := range fieldMask.Paths { 1523 val, _ := path.GetSingle(source) 1524 // if val is nil, then field does not exist in source, skip 1525 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1526 if val != nil { 1527 path.WithIValue(val).SetTo(&target) 1528 } 1529 } 1530 } 1531 1532 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1533 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType)) 1534 } 1535 1536 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType) *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType { 1537 if source == nil { 1538 return nil 1539 } 1540 if fieldMask == nil { 1541 return source 1542 } 1543 result := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType{} 1544 queriesMask := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask{} 1545 wholeQueriesAccepted := false 1546 1547 for _, p := range fieldMask.Paths { 1548 switch tp := p.(type) { 1549 case *NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldTerminalPath: 1550 switch tp.selector { 1551 case NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorFqn: 1552 result.Fqn = source.Fqn 1553 case NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorDisplayName: 1554 result.DisplayName = source.DisplayName 1555 case NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorQueries: 1556 result.Queries = source.Queries 1557 wholeQueriesAccepted = true 1558 } 1559 case *NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldSubPath: 1560 switch tp.selector { 1561 case NotificationMsgAlertsGroupConditionAlertsLogCndType_FieldPathSelectorQueries: 1562 queriesMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath)) 1563 } 1564 } 1565 } 1566 if wholeQueriesAccepted == false && len(queriesMask.Paths) > 0 { 1567 for _, sourceItem := range source.GetQueries() { 1568 result.Queries = append(result.Queries, queriesMask.Project(sourceItem)) 1569 } 1570 } 1571 return result 1572 } 1573 1574 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1575 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType)) 1576 } 1577 1578 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_FieldMask) PathsCount() int { 1579 if fieldMask == nil { 1580 return 0 1581 } 1582 return len(fieldMask.Paths) 1583 } 1584 1585 type NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask struct { 1586 Paths []NotificationMsgAlertsGroupConditionAlertsAlert_FieldPath 1587 } 1588 1589 func FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask { 1590 res := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask{} 1591 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorType}) 1592 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorFqn}) 1593 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorDisplayName}) 1594 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIsFiring}) 1595 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorStartTime}) 1596 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorStopTime}) 1597 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIdentification}) 1598 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorViolationInfo}) 1599 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorEscalationLevel}) 1600 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorAiHandling}) 1601 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorOperatorHandling}) 1602 return res 1603 } 1604 1605 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) String() string { 1606 if fieldMask == nil { 1607 return "<nil>" 1608 } 1609 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1610 for _, path := range fieldMask.Paths { 1611 pathsStr = append(pathsStr, path.String()) 1612 } 1613 return strings.Join(pathsStr, ", ") 1614 } 1615 1616 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) IsFull() bool { 1617 if fieldMask == nil { 1618 return false 1619 } 1620 presentSelectors := make([]bool, 11) 1621 for _, path := range fieldMask.Paths { 1622 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath); ok { 1623 presentSelectors[int(asFinal.selector)] = true 1624 } 1625 } 1626 for _, flag := range presentSelectors { 1627 if !flag { 1628 return false 1629 } 1630 } 1631 return true 1632 } 1633 1634 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) ProtoReflect() preflect.Message { 1635 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1636 return ParseNotificationMsgAlertsGroupConditionAlertsAlert_FieldPath(raw) 1637 }) 1638 } 1639 1640 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) ProtoMessage() {} 1641 1642 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) Reset() { 1643 if fieldMask != nil { 1644 fieldMask.Paths = nil 1645 } 1646 } 1647 1648 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask { 1649 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask{} 1650 removedSelectors := make([]bool, 11) 1651 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelector]gotenobject.FieldMask{ 1652 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIdentification: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask{}, 1653 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorViolationInfo: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask{}, 1654 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorAiHandling: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask{}, 1655 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorOperatorHandling: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask{}, 1656 } 1657 mySubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelector]gotenobject.FieldMask{ 1658 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIdentification: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask{}, 1659 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorViolationInfo: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask{}, 1660 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorAiHandling: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask{}, 1661 NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorOperatorHandling: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask{}, 1662 } 1663 1664 for _, path := range other.GetPaths() { 1665 switch tp := path.(type) { 1666 case *NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath: 1667 removedSelectors[int(tp.selector)] = true 1668 case *NotificationMsgAlertsGroupConditionAlertsAlert_FieldSubPath: 1669 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1670 } 1671 } 1672 for _, path := range fieldMask.GetPaths() { 1673 if !removedSelectors[int(path.Selector())] { 1674 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1675 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath); ok { 1676 switch tp.selector { 1677 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIdentification: 1678 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIdentification] = FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask() 1679 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorViolationInfo: 1680 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorViolationInfo] = FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask() 1681 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorAiHandling: 1682 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorAiHandling] = FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask() 1683 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorOperatorHandling: 1684 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorOperatorHandling] = FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask() 1685 } 1686 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlert_FieldSubPath); ok { 1687 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1688 } 1689 } else { 1690 result.Paths = append(result.Paths, path) 1691 } 1692 } 1693 } 1694 for selector, mySubMask := range mySubMasks { 1695 if mySubMask.PathsCount() > 0 { 1696 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1697 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlertsAlert_FieldSubPath{selector: selector, subPath: allowedPath}) 1698 } 1699 } 1700 } 1701 1702 if len(result.Paths) == 0 { 1703 return nil 1704 } 1705 return result 1706 } 1707 1708 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1709 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask)) 1710 } 1711 1712 // FilterInputFields generates copy of field paths with output_only field paths removed 1713 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask { 1714 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask{} 1715 result.Paths = append(result.Paths, fieldMask.Paths...) 1716 return result 1717 } 1718 1719 // ToFieldMask is used for proto conversions 1720 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1721 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1722 for _, path := range fieldMask.Paths { 1723 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1724 } 1725 return protoFieldMask 1726 } 1727 1728 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1729 if fieldMask == nil { 1730 return status.Error(codes.Internal, "target field mask is nil") 1731 } 1732 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsAlert_FieldPath, 0, len(protoFieldMask.Paths)) 1733 for _, strPath := range protoFieldMask.Paths { 1734 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlert_FieldPath(strPath) 1735 if err != nil { 1736 return err 1737 } 1738 fieldMask.Paths = append(fieldMask.Paths, path) 1739 } 1740 return nil 1741 } 1742 1743 // implement methods required by customType 1744 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) Marshal() ([]byte, error) { 1745 protoFieldMask := fieldMask.ToProtoFieldMask() 1746 return proto.Marshal(protoFieldMask) 1747 } 1748 1749 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) Unmarshal(data []byte) error { 1750 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1751 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1752 return err 1753 } 1754 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1755 return err 1756 } 1757 return nil 1758 } 1759 1760 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) Size() int { 1761 return proto.Size(fieldMask.ToProtoFieldMask()) 1762 } 1763 1764 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) MarshalJSON() ([]byte, error) { 1765 return json.Marshal(fieldMask.ToProtoFieldMask()) 1766 } 1767 1768 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) UnmarshalJSON(data []byte) error { 1769 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1770 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1771 return err 1772 } 1773 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1774 return err 1775 } 1776 return nil 1777 } 1778 1779 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsAlert_FieldPath) { 1780 fieldMask.Paths = append(fieldMask.Paths, path) 1781 } 1782 1783 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1784 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsAlert_FieldPath)) 1785 } 1786 1787 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsAlert_FieldPath { 1788 if fieldMask == nil { 1789 return nil 1790 } 1791 return fieldMask.Paths 1792 } 1793 1794 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1795 if fieldMask == nil { 1796 return nil 1797 } 1798 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1799 for _, path := range fieldMask.Paths { 1800 rawPaths = append(rawPaths, path) 1801 } 1802 return rawPaths 1803 } 1804 1805 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) SetFromCliFlag(raw string) error { 1806 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlert_FieldPath(raw) 1807 if err != nil { 1808 return err 1809 } 1810 fieldMask.Paths = append(fieldMask.Paths, path) 1811 return nil 1812 } 1813 1814 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert) { 1815 for _, path := range fieldMask.Paths { 1816 val, _ := path.GetSingle(source) 1817 // if val is nil, then field does not exist in source, skip 1818 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1819 if val != nil { 1820 path.WithIValue(val).SetTo(&target) 1821 } 1822 } 1823 } 1824 1825 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1826 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert)) 1827 } 1828 1829 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert { 1830 if source == nil { 1831 return nil 1832 } 1833 if fieldMask == nil { 1834 return source 1835 } 1836 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert{} 1837 identificationMask := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask{} 1838 wholeIdentificationAccepted := false 1839 violationInfoMask := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask{} 1840 wholeViolationInfoAccepted := false 1841 aiHandlingMask := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask{} 1842 wholeAiHandlingAccepted := false 1843 operatorHandlingMask := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask{} 1844 wholeOperatorHandlingAccepted := false 1845 1846 for _, p := range fieldMask.Paths { 1847 switch tp := p.(type) { 1848 case *NotificationMsgAlertsGroupConditionAlertsAlert_FieldTerminalPath: 1849 switch tp.selector { 1850 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorType: 1851 result.Type = source.Type 1852 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorFqn: 1853 result.Fqn = source.Fqn 1854 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorDisplayName: 1855 result.DisplayName = source.DisplayName 1856 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIsFiring: 1857 result.IsFiring = source.IsFiring 1858 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorStartTime: 1859 result.StartTime = source.StartTime 1860 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorStopTime: 1861 result.StopTime = source.StopTime 1862 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIdentification: 1863 result.Identification = source.Identification 1864 wholeIdentificationAccepted = true 1865 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorViolationInfo: 1866 result.ViolationInfo = source.ViolationInfo 1867 wholeViolationInfoAccepted = true 1868 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorEscalationLevel: 1869 result.EscalationLevel = source.EscalationLevel 1870 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorAiHandling: 1871 result.AiHandling = source.AiHandling 1872 wholeAiHandlingAccepted = true 1873 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorOperatorHandling: 1874 result.OperatorHandling = source.OperatorHandling 1875 wholeOperatorHandlingAccepted = true 1876 } 1877 case *NotificationMsgAlertsGroupConditionAlertsAlert_FieldSubPath: 1878 switch tp.selector { 1879 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorIdentification: 1880 identificationMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath)) 1881 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorViolationInfo: 1882 violationInfoMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath)) 1883 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorAiHandling: 1884 aiHandlingMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath)) 1885 case NotificationMsgAlertsGroupConditionAlertsAlert_FieldPathSelectorOperatorHandling: 1886 operatorHandlingMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath)) 1887 } 1888 } 1889 } 1890 if wholeIdentificationAccepted == false && len(identificationMask.Paths) > 0 { 1891 result.Identification = identificationMask.Project(source.GetIdentification()) 1892 } 1893 if wholeViolationInfoAccepted == false && len(violationInfoMask.Paths) > 0 { 1894 result.ViolationInfo = violationInfoMask.Project(source.GetViolationInfo()) 1895 } 1896 if wholeAiHandlingAccepted == false && len(aiHandlingMask.Paths) > 0 { 1897 result.AiHandling = aiHandlingMask.Project(source.GetAiHandling()) 1898 } 1899 if wholeOperatorHandlingAccepted == false && len(operatorHandlingMask.Paths) > 0 { 1900 result.OperatorHandling = operatorHandlingMask.Project(source.GetOperatorHandling()) 1901 } 1902 return result 1903 } 1904 1905 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1906 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert)) 1907 } 1908 1909 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_FieldMask) PathsCount() int { 1910 if fieldMask == nil { 1911 return 0 1912 } 1913 return len(fieldMask.Paths) 1914 } 1915 1916 type NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask struct { 1917 Paths []NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath 1918 } 1919 1920 func FullNotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask { 1921 res := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask{} 1922 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorDescription}) 1923 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorFilter}) 1924 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorAggregation}) 1925 return res 1926 } 1927 1928 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) String() string { 1929 if fieldMask == nil { 1930 return "<nil>" 1931 } 1932 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1933 for _, path := range fieldMask.Paths { 1934 pathsStr = append(pathsStr, path.String()) 1935 } 1936 return strings.Join(pathsStr, ", ") 1937 } 1938 1939 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) IsFull() bool { 1940 if fieldMask == nil { 1941 return false 1942 } 1943 presentSelectors := make([]bool, 3) 1944 for _, path := range fieldMask.Paths { 1945 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldTerminalPath); ok { 1946 presentSelectors[int(asFinal.selector)] = true 1947 } 1948 } 1949 for _, flag := range presentSelectors { 1950 if !flag { 1951 return false 1952 } 1953 } 1954 return true 1955 } 1956 1957 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) ProtoReflect() preflect.Message { 1958 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1959 return ParseNotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath(raw) 1960 }) 1961 } 1962 1963 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) ProtoMessage() { 1964 } 1965 1966 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) Reset() { 1967 if fieldMask != nil { 1968 fieldMask.Paths = nil 1969 } 1970 } 1971 1972 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask { 1973 result := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask{} 1974 removedSelectors := make([]bool, 3) 1975 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelector]gotenobject.FieldMask{ 1976 NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorAggregation: &monitoring_common.Aggregation_FieldMask{}, 1977 } 1978 mySubMasks := map[NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelector]gotenobject.FieldMask{ 1979 NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorAggregation: &monitoring_common.Aggregation_FieldMask{}, 1980 } 1981 1982 for _, path := range other.GetPaths() { 1983 switch tp := path.(type) { 1984 case *NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldTerminalPath: 1985 removedSelectors[int(tp.selector)] = true 1986 case *NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldSubPath: 1987 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1988 } 1989 } 1990 for _, path := range fieldMask.GetPaths() { 1991 if !removedSelectors[int(path.Selector())] { 1992 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1993 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldTerminalPath); ok { 1994 switch tp.selector { 1995 case NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorAggregation: 1996 mySubMasks[NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorAggregation] = monitoring_common.FullAggregation_FieldMask() 1997 } 1998 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldSubPath); ok { 1999 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 2000 } 2001 } else { 2002 result.Paths = append(result.Paths, path) 2003 } 2004 } 2005 } 2006 for selector, mySubMask := range mySubMasks { 2007 if mySubMask.PathsCount() > 0 { 2008 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 2009 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldSubPath{selector: selector, subPath: allowedPath}) 2010 } 2011 } 2012 } 2013 2014 if len(result.Paths) == 0 { 2015 return nil 2016 } 2017 return result 2018 } 2019 2020 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2021 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask)) 2022 } 2023 2024 // FilterInputFields generates copy of field paths with output_only field paths removed 2025 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask { 2026 result := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask{} 2027 result.Paths = append(result.Paths, fieldMask.Paths...) 2028 return result 2029 } 2030 2031 // ToFieldMask is used for proto conversions 2032 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2033 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2034 for _, path := range fieldMask.Paths { 2035 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2036 } 2037 return protoFieldMask 2038 } 2039 2040 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2041 if fieldMask == nil { 2042 return status.Error(codes.Internal, "target field mask is nil") 2043 } 2044 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath, 0, len(protoFieldMask.Paths)) 2045 for _, strPath := range protoFieldMask.Paths { 2046 path, err := ParseNotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath(strPath) 2047 if err != nil { 2048 return err 2049 } 2050 fieldMask.Paths = append(fieldMask.Paths, path) 2051 } 2052 return nil 2053 } 2054 2055 // implement methods required by customType 2056 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) Marshal() ([]byte, error) { 2057 protoFieldMask := fieldMask.ToProtoFieldMask() 2058 return proto.Marshal(protoFieldMask) 2059 } 2060 2061 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) Unmarshal(data []byte) error { 2062 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2063 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2064 return err 2065 } 2066 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2067 return err 2068 } 2069 return nil 2070 } 2071 2072 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) Size() int { 2073 return proto.Size(fieldMask.ToProtoFieldMask()) 2074 } 2075 2076 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) MarshalJSON() ([]byte, error) { 2077 return json.Marshal(fieldMask.ToProtoFieldMask()) 2078 } 2079 2080 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) UnmarshalJSON(data []byte) error { 2081 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2082 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2083 return err 2084 } 2085 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2086 return err 2087 } 2088 return nil 2089 } 2090 2091 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath) { 2092 fieldMask.Paths = append(fieldMask.Paths, path) 2093 } 2094 2095 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2096 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath)) 2097 } 2098 2099 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath { 2100 if fieldMask == nil { 2101 return nil 2102 } 2103 return fieldMask.Paths 2104 } 2105 2106 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2107 if fieldMask == nil { 2108 return nil 2109 } 2110 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2111 for _, path := range fieldMask.Paths { 2112 rawPaths = append(rawPaths, path) 2113 } 2114 return rawPaths 2115 } 2116 2117 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) SetFromCliFlag(raw string) error { 2118 path, err := ParseNotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPath(raw) 2119 if err != nil { 2120 return err 2121 } 2122 fieldMask.Paths = append(fieldMask.Paths, path) 2123 return nil 2124 } 2125 2126 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query) { 2127 for _, path := range fieldMask.Paths { 2128 val, _ := path.GetSingle(source) 2129 // if val is nil, then field does not exist in source, skip 2130 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2131 if val != nil { 2132 path.WithIValue(val).SetTo(&target) 2133 } 2134 } 2135 } 2136 2137 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2138 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query)) 2139 } 2140 2141 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query) *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query { 2142 if source == nil { 2143 return nil 2144 } 2145 if fieldMask == nil { 2146 return source 2147 } 2148 result := &NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query{} 2149 aggregationMask := &monitoring_common.Aggregation_FieldMask{} 2150 wholeAggregationAccepted := false 2151 2152 for _, p := range fieldMask.Paths { 2153 switch tp := p.(type) { 2154 case *NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldTerminalPath: 2155 switch tp.selector { 2156 case NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorDescription: 2157 result.Description = source.Description 2158 case NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorFilter: 2159 result.Filter = source.Filter 2160 case NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorAggregation: 2161 result.Aggregation = source.Aggregation 2162 wholeAggregationAccepted = true 2163 } 2164 case *NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldSubPath: 2165 switch tp.selector { 2166 case NotificationMsgAlertsGroupConditionAlertsTsCndTypeQuery_FieldPathSelectorAggregation: 2167 aggregationMask.AppendPath(tp.subPath.(monitoring_common.Aggregation_FieldPath)) 2168 } 2169 } 2170 } 2171 if wholeAggregationAccepted == false && len(aggregationMask.Paths) > 0 { 2172 result.Aggregation = aggregationMask.Project(source.GetAggregation()) 2173 } 2174 return result 2175 } 2176 2177 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2178 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query)) 2179 } 2180 2181 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_TsCndType_Query_FieldMask) PathsCount() int { 2182 if fieldMask == nil { 2183 return 0 2184 } 2185 return len(fieldMask.Paths) 2186 } 2187 2188 type NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask struct { 2189 Paths []NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath 2190 } 2191 2192 func FullNotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask { 2193 res := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask{} 2194 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPathSelectorDescription}) 2195 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPathSelectorFilter}) 2196 return res 2197 } 2198 2199 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) String() string { 2200 if fieldMask == nil { 2201 return "<nil>" 2202 } 2203 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2204 for _, path := range fieldMask.Paths { 2205 pathsStr = append(pathsStr, path.String()) 2206 } 2207 return strings.Join(pathsStr, ", ") 2208 } 2209 2210 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) IsFull() bool { 2211 if fieldMask == nil { 2212 return false 2213 } 2214 presentSelectors := make([]bool, 2) 2215 for _, path := range fieldMask.Paths { 2216 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldTerminalPath); ok { 2217 presentSelectors[int(asFinal.selector)] = true 2218 } 2219 } 2220 for _, flag := range presentSelectors { 2221 if !flag { 2222 return false 2223 } 2224 } 2225 return true 2226 } 2227 2228 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) ProtoReflect() preflect.Message { 2229 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2230 return ParseNotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath(raw) 2231 }) 2232 } 2233 2234 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) ProtoMessage() { 2235 } 2236 2237 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) Reset() { 2238 if fieldMask != nil { 2239 fieldMask.Paths = nil 2240 } 2241 } 2242 2243 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask { 2244 result := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask{} 2245 removedSelectors := make([]bool, 2) 2246 2247 for _, path := range other.GetPaths() { 2248 switch tp := path.(type) { 2249 case *NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldTerminalPath: 2250 removedSelectors[int(tp.selector)] = true 2251 } 2252 } 2253 for _, path := range fieldMask.GetPaths() { 2254 if !removedSelectors[int(path.Selector())] { 2255 result.Paths = append(result.Paths, path) 2256 } 2257 } 2258 2259 if len(result.Paths) == 0 { 2260 return nil 2261 } 2262 return result 2263 } 2264 2265 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2266 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask)) 2267 } 2268 2269 // FilterInputFields generates copy of field paths with output_only field paths removed 2270 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask { 2271 result := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask{} 2272 result.Paths = append(result.Paths, fieldMask.Paths...) 2273 return result 2274 } 2275 2276 // ToFieldMask is used for proto conversions 2277 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2278 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2279 for _, path := range fieldMask.Paths { 2280 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2281 } 2282 return protoFieldMask 2283 } 2284 2285 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2286 if fieldMask == nil { 2287 return status.Error(codes.Internal, "target field mask is nil") 2288 } 2289 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath, 0, len(protoFieldMask.Paths)) 2290 for _, strPath := range protoFieldMask.Paths { 2291 path, err := ParseNotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath(strPath) 2292 if err != nil { 2293 return err 2294 } 2295 fieldMask.Paths = append(fieldMask.Paths, path) 2296 } 2297 return nil 2298 } 2299 2300 // implement methods required by customType 2301 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) Marshal() ([]byte, error) { 2302 protoFieldMask := fieldMask.ToProtoFieldMask() 2303 return proto.Marshal(protoFieldMask) 2304 } 2305 2306 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) Unmarshal(data []byte) error { 2307 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2308 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2309 return err 2310 } 2311 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2312 return err 2313 } 2314 return nil 2315 } 2316 2317 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) Size() int { 2318 return proto.Size(fieldMask.ToProtoFieldMask()) 2319 } 2320 2321 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) MarshalJSON() ([]byte, error) { 2322 return json.Marshal(fieldMask.ToProtoFieldMask()) 2323 } 2324 2325 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) UnmarshalJSON(data []byte) error { 2326 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2327 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2328 return err 2329 } 2330 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2331 return err 2332 } 2333 return nil 2334 } 2335 2336 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath) { 2337 fieldMask.Paths = append(fieldMask.Paths, path) 2338 } 2339 2340 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2341 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath)) 2342 } 2343 2344 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath { 2345 if fieldMask == nil { 2346 return nil 2347 } 2348 return fieldMask.Paths 2349 } 2350 2351 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2352 if fieldMask == nil { 2353 return nil 2354 } 2355 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2356 for _, path := range fieldMask.Paths { 2357 rawPaths = append(rawPaths, path) 2358 } 2359 return rawPaths 2360 } 2361 2362 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) SetFromCliFlag(raw string) error { 2363 path, err := ParseNotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPath(raw) 2364 if err != nil { 2365 return err 2366 } 2367 fieldMask.Paths = append(fieldMask.Paths, path) 2368 return nil 2369 } 2370 2371 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query) { 2372 for _, path := range fieldMask.Paths { 2373 val, _ := path.GetSingle(source) 2374 // if val is nil, then field does not exist in source, skip 2375 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2376 if val != nil { 2377 path.WithIValue(val).SetTo(&target) 2378 } 2379 } 2380 } 2381 2382 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2383 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query)) 2384 } 2385 2386 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query) *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query { 2387 if source == nil { 2388 return nil 2389 } 2390 if fieldMask == nil { 2391 return source 2392 } 2393 result := &NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query{} 2394 2395 for _, p := range fieldMask.Paths { 2396 switch tp := p.(type) { 2397 case *NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldTerminalPath: 2398 switch tp.selector { 2399 case NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPathSelectorDescription: 2400 result.Description = source.Description 2401 case NotificationMsgAlertsGroupConditionAlertsLogCndTypeQuery_FieldPathSelectorFilter: 2402 result.Filter = source.Filter 2403 } 2404 } 2405 } 2406 return result 2407 } 2408 2409 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2410 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query)) 2411 } 2412 2413 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_LogCndType_Query_FieldMask) PathsCount() int { 2414 if fieldMask == nil { 2415 return 0 2416 } 2417 return len(fieldMask.Paths) 2418 } 2419 2420 type NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask struct { 2421 Paths []NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath 2422 } 2423 2424 func FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask { 2425 res := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask{} 2426 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorLogLabels}) 2427 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorMetricLabels}) 2428 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorResourceLabels}) 2429 return res 2430 } 2431 2432 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) String() string { 2433 if fieldMask == nil { 2434 return "<nil>" 2435 } 2436 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2437 for _, path := range fieldMask.Paths { 2438 pathsStr = append(pathsStr, path.String()) 2439 } 2440 return strings.Join(pathsStr, ", ") 2441 } 2442 2443 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) IsFull() bool { 2444 if fieldMask == nil { 2445 return false 2446 } 2447 presentSelectors := make([]bool, 3) 2448 for _, path := range fieldMask.Paths { 2449 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldTerminalPath); ok { 2450 presentSelectors[int(asFinal.selector)] = true 2451 } 2452 } 2453 for _, flag := range presentSelectors { 2454 if !flag { 2455 return false 2456 } 2457 } 2458 return true 2459 } 2460 2461 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) ProtoReflect() preflect.Message { 2462 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2463 return ParseNotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath(raw) 2464 }) 2465 } 2466 2467 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) ProtoMessage() { 2468 } 2469 2470 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) Reset() { 2471 if fieldMask != nil { 2472 fieldMask.Paths = nil 2473 } 2474 } 2475 2476 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask { 2477 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask{} 2478 removedSelectors := make([]bool, 3) 2479 2480 for _, path := range other.GetPaths() { 2481 switch tp := path.(type) { 2482 case *NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldTerminalPath: 2483 removedSelectors[int(tp.selector)] = true 2484 } 2485 } 2486 for _, path := range fieldMask.GetPaths() { 2487 if !removedSelectors[int(path.Selector())] { 2488 result.Paths = append(result.Paths, path) 2489 } 2490 } 2491 2492 if len(result.Paths) == 0 { 2493 return nil 2494 } 2495 return result 2496 } 2497 2498 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2499 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask)) 2500 } 2501 2502 // FilterInputFields generates copy of field paths with output_only field paths removed 2503 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask { 2504 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask{} 2505 result.Paths = append(result.Paths, fieldMask.Paths...) 2506 return result 2507 } 2508 2509 // ToFieldMask is used for proto conversions 2510 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2511 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2512 for _, path := range fieldMask.Paths { 2513 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2514 } 2515 return protoFieldMask 2516 } 2517 2518 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2519 if fieldMask == nil { 2520 return status.Error(codes.Internal, "target field mask is nil") 2521 } 2522 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath, 0, len(protoFieldMask.Paths)) 2523 for _, strPath := range protoFieldMask.Paths { 2524 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath(strPath) 2525 if err != nil { 2526 return err 2527 } 2528 fieldMask.Paths = append(fieldMask.Paths, path) 2529 } 2530 return nil 2531 } 2532 2533 // implement methods required by customType 2534 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) Marshal() ([]byte, error) { 2535 protoFieldMask := fieldMask.ToProtoFieldMask() 2536 return proto.Marshal(protoFieldMask) 2537 } 2538 2539 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) Unmarshal(data []byte) error { 2540 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2541 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2542 return err 2543 } 2544 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2545 return err 2546 } 2547 return nil 2548 } 2549 2550 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) Size() int { 2551 return proto.Size(fieldMask.ToProtoFieldMask()) 2552 } 2553 2554 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) MarshalJSON() ([]byte, error) { 2555 return json.Marshal(fieldMask.ToProtoFieldMask()) 2556 } 2557 2558 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) UnmarshalJSON(data []byte) error { 2559 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2560 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2561 return err 2562 } 2563 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2564 return err 2565 } 2566 return nil 2567 } 2568 2569 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath) { 2570 fieldMask.Paths = append(fieldMask.Paths, path) 2571 } 2572 2573 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2574 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath)) 2575 } 2576 2577 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath { 2578 if fieldMask == nil { 2579 return nil 2580 } 2581 return fieldMask.Paths 2582 } 2583 2584 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2585 if fieldMask == nil { 2586 return nil 2587 } 2588 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2589 for _, path := range fieldMask.Paths { 2590 rawPaths = append(rawPaths, path) 2591 } 2592 return rawPaths 2593 } 2594 2595 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) SetFromCliFlag(raw string) error { 2596 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPath(raw) 2597 if err != nil { 2598 return err 2599 } 2600 fieldMask.Paths = append(fieldMask.Paths, path) 2601 return nil 2602 } 2603 2604 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification) { 2605 for _, path := range fieldMask.Paths { 2606 val, _ := path.GetSingle(source) 2607 // if val is nil, then field does not exist in source, skip 2608 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2609 if val != nil { 2610 path.WithIValue(val).SetTo(&target) 2611 } 2612 } 2613 } 2614 2615 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2616 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification)) 2617 } 2618 2619 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification { 2620 if source == nil { 2621 return nil 2622 } 2623 if fieldMask == nil { 2624 return source 2625 } 2626 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification{} 2627 var logLabelsMapKeys []string 2628 wholeLogLabelsAccepted := false 2629 var metricLabelsMapKeys []string 2630 wholeMetricLabelsAccepted := false 2631 var resourceLabelsMapKeys []string 2632 wholeResourceLabelsAccepted := false 2633 2634 for _, p := range fieldMask.Paths { 2635 switch tp := p.(type) { 2636 case *NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldTerminalPath: 2637 switch tp.selector { 2638 case NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorLogLabels: 2639 result.LogLabels = source.LogLabels 2640 wholeLogLabelsAccepted = true 2641 case NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorMetricLabels: 2642 result.MetricLabels = source.MetricLabels 2643 wholeMetricLabelsAccepted = true 2644 case NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorResourceLabels: 2645 result.ResourceLabels = source.ResourceLabels 2646 wholeResourceLabelsAccepted = true 2647 } 2648 case *NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathMap: 2649 switch tp.selector { 2650 case NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorLogLabels: 2651 logLabelsMapKeys = append(logLabelsMapKeys, tp.key) 2652 case NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorMetricLabels: 2653 metricLabelsMapKeys = append(metricLabelsMapKeys, tp.key) 2654 case NotificationMsgAlertsGroupConditionAlertsAlertIdentification_FieldPathSelectorResourceLabels: 2655 resourceLabelsMapKeys = append(resourceLabelsMapKeys, tp.key) 2656 } 2657 } 2658 } 2659 if wholeLogLabelsAccepted == false && len(logLabelsMapKeys) > 0 && source.GetLogLabels() != nil { 2660 copiedMap := map[string]string{} 2661 sourceMap := source.GetLogLabels() 2662 for _, key := range logLabelsMapKeys { 2663 copiedMap[key] = sourceMap[key] 2664 } 2665 result.LogLabels = copiedMap 2666 } 2667 if wholeMetricLabelsAccepted == false && len(metricLabelsMapKeys) > 0 && source.GetMetricLabels() != nil { 2668 copiedMap := map[string]string{} 2669 sourceMap := source.GetMetricLabels() 2670 for _, key := range metricLabelsMapKeys { 2671 copiedMap[key] = sourceMap[key] 2672 } 2673 result.MetricLabels = copiedMap 2674 } 2675 if wholeResourceLabelsAccepted == false && len(resourceLabelsMapKeys) > 0 && source.GetResourceLabels() != nil { 2676 copiedMap := map[string]string{} 2677 sourceMap := source.GetResourceLabels() 2678 for _, key := range resourceLabelsMapKeys { 2679 copiedMap[key] = sourceMap[key] 2680 } 2681 result.ResourceLabels = copiedMap 2682 } 2683 return result 2684 } 2685 2686 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2687 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification)) 2688 } 2689 2690 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_Identification_FieldMask) PathsCount() int { 2691 if fieldMask == nil { 2692 return 0 2693 } 2694 return len(fieldMask.Paths) 2695 } 2696 2697 type NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask struct { 2698 Paths []NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath 2699 } 2700 2701 func FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask { 2702 res := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask{} 2703 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorLogValue}) 2704 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorTimeSeries}) 2705 return res 2706 } 2707 2708 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) String() string { 2709 if fieldMask == nil { 2710 return "<nil>" 2711 } 2712 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2713 for _, path := range fieldMask.Paths { 2714 pathsStr = append(pathsStr, path.String()) 2715 } 2716 return strings.Join(pathsStr, ", ") 2717 } 2718 2719 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) IsFull() bool { 2720 if fieldMask == nil { 2721 return false 2722 } 2723 presentSelectors := make([]bool, 2) 2724 for _, path := range fieldMask.Paths { 2725 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldTerminalPath); ok { 2726 presentSelectors[int(asFinal.selector)] = true 2727 } 2728 } 2729 for _, flag := range presentSelectors { 2730 if !flag { 2731 return false 2732 } 2733 } 2734 return true 2735 } 2736 2737 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) ProtoReflect() preflect.Message { 2738 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2739 return ParseNotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath(raw) 2740 }) 2741 } 2742 2743 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) ProtoMessage() { 2744 } 2745 2746 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) Reset() { 2747 if fieldMask != nil { 2748 fieldMask.Paths = nil 2749 } 2750 } 2751 2752 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask { 2753 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask{} 2754 removedSelectors := make([]bool, 2) 2755 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelector]gotenobject.FieldMask{ 2756 NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorTimeSeries: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask{}, 2757 } 2758 mySubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelector]gotenobject.FieldMask{ 2759 NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorTimeSeries: &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask{}, 2760 } 2761 2762 for _, path := range other.GetPaths() { 2763 switch tp := path.(type) { 2764 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldTerminalPath: 2765 removedSelectors[int(tp.selector)] = true 2766 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldSubPath: 2767 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 2768 } 2769 } 2770 for _, path := range fieldMask.GetPaths() { 2771 if !removedSelectors[int(path.Selector())] { 2772 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 2773 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldTerminalPath); ok { 2774 switch tp.selector { 2775 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorTimeSeries: 2776 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorTimeSeries] = FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask() 2777 } 2778 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldSubPath); ok { 2779 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 2780 } 2781 } else { 2782 result.Paths = append(result.Paths, path) 2783 } 2784 } 2785 } 2786 for selector, mySubMask := range mySubMasks { 2787 if mySubMask.PathsCount() > 0 { 2788 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 2789 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldSubPath{selector: selector, subPath: allowedPath}) 2790 } 2791 } 2792 } 2793 2794 if len(result.Paths) == 0 { 2795 return nil 2796 } 2797 return result 2798 } 2799 2800 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2801 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask)) 2802 } 2803 2804 // FilterInputFields generates copy of field paths with output_only field paths removed 2805 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask { 2806 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask{} 2807 result.Paths = append(result.Paths, fieldMask.Paths...) 2808 return result 2809 } 2810 2811 // ToFieldMask is used for proto conversions 2812 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2813 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2814 for _, path := range fieldMask.Paths { 2815 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2816 } 2817 return protoFieldMask 2818 } 2819 2820 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2821 if fieldMask == nil { 2822 return status.Error(codes.Internal, "target field mask is nil") 2823 } 2824 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath, 0, len(protoFieldMask.Paths)) 2825 for _, strPath := range protoFieldMask.Paths { 2826 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath(strPath) 2827 if err != nil { 2828 return err 2829 } 2830 fieldMask.Paths = append(fieldMask.Paths, path) 2831 } 2832 return nil 2833 } 2834 2835 // implement methods required by customType 2836 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) Marshal() ([]byte, error) { 2837 protoFieldMask := fieldMask.ToProtoFieldMask() 2838 return proto.Marshal(protoFieldMask) 2839 } 2840 2841 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) Unmarshal(data []byte) error { 2842 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2843 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2844 return err 2845 } 2846 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2847 return err 2848 } 2849 return nil 2850 } 2851 2852 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) Size() int { 2853 return proto.Size(fieldMask.ToProtoFieldMask()) 2854 } 2855 2856 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) MarshalJSON() ([]byte, error) { 2857 return json.Marshal(fieldMask.ToProtoFieldMask()) 2858 } 2859 2860 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) UnmarshalJSON(data []byte) error { 2861 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2862 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2863 return err 2864 } 2865 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2866 return err 2867 } 2868 return nil 2869 } 2870 2871 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath) { 2872 fieldMask.Paths = append(fieldMask.Paths, path) 2873 } 2874 2875 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2876 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath)) 2877 } 2878 2879 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath { 2880 if fieldMask == nil { 2881 return nil 2882 } 2883 return fieldMask.Paths 2884 } 2885 2886 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2887 if fieldMask == nil { 2888 return nil 2889 } 2890 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2891 for _, path := range fieldMask.Paths { 2892 rawPaths = append(rawPaths, path) 2893 } 2894 return rawPaths 2895 } 2896 2897 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) SetFromCliFlag(raw string) error { 2898 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPath(raw) 2899 if err != nil { 2900 return err 2901 } 2902 fieldMask.Paths = append(fieldMask.Paths, path) 2903 return nil 2904 } 2905 2906 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo) { 2907 for _, path := range fieldMask.Paths { 2908 val, _ := path.GetSingle(source) 2909 // if val is nil, then field does not exist in source, skip 2910 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2911 if val != nil { 2912 path.WithIValue(val).SetTo(&target) 2913 } 2914 } 2915 } 2916 2917 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2918 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo)) 2919 } 2920 2921 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo { 2922 if source == nil { 2923 return nil 2924 } 2925 if fieldMask == nil { 2926 return source 2927 } 2928 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo{} 2929 timeSeriesMask := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask{} 2930 wholeTimeSeriesAccepted := false 2931 2932 for _, p := range fieldMask.Paths { 2933 switch tp := p.(type) { 2934 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldTerminalPath: 2935 switch tp.selector { 2936 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorLogValue: 2937 result.LogValue = source.LogValue 2938 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorTimeSeries: 2939 result.TimeSeries = source.TimeSeries 2940 wholeTimeSeriesAccepted = true 2941 } 2942 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldSubPath: 2943 switch tp.selector { 2944 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfo_FieldPathSelectorTimeSeries: 2945 timeSeriesMask.AppendPath(tp.subPath.(NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath)) 2946 } 2947 } 2948 } 2949 if wholeTimeSeriesAccepted == false && len(timeSeriesMask.Paths) > 0 { 2950 for _, sourceItem := range source.GetTimeSeries() { 2951 result.TimeSeries = append(result.TimeSeries, timeSeriesMask.Project(sourceItem)) 2952 } 2953 } 2954 return result 2955 } 2956 2957 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2958 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo)) 2959 } 2960 2961 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_FieldMask) PathsCount() int { 2962 if fieldMask == nil { 2963 return 0 2964 } 2965 return len(fieldMask.Paths) 2966 } 2967 2968 type NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask struct { 2969 Paths []NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath 2970 } 2971 2972 func FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask { 2973 res := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask{} 2974 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorCurrentState}) 2975 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorTroubleshootingNotes}) 2976 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorAiRemediation}) 2977 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorRemediationArg}) 2978 return res 2979 } 2980 2981 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) String() string { 2982 if fieldMask == nil { 2983 return "<nil>" 2984 } 2985 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2986 for _, path := range fieldMask.Paths { 2987 pathsStr = append(pathsStr, path.String()) 2988 } 2989 return strings.Join(pathsStr, ", ") 2990 } 2991 2992 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) IsFull() bool { 2993 if fieldMask == nil { 2994 return false 2995 } 2996 presentSelectors := make([]bool, 4) 2997 for _, path := range fieldMask.Paths { 2998 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath); ok { 2999 presentSelectors[int(asFinal.selector)] = true 3000 } 3001 } 3002 for _, flag := range presentSelectors { 3003 if !flag { 3004 return false 3005 } 3006 } 3007 return true 3008 } 3009 3010 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) ProtoReflect() preflect.Message { 3011 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3012 return ParseNotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath(raw) 3013 }) 3014 } 3015 3016 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) ProtoMessage() { 3017 } 3018 3019 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) Reset() { 3020 if fieldMask != nil { 3021 fieldMask.Paths = nil 3022 } 3023 } 3024 3025 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask { 3026 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask{} 3027 removedSelectors := make([]bool, 4) 3028 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelector]gotenobject.FieldMask{ 3029 NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorAiRemediation: &rcommon.PolicySpec_AIAgentHandling_Remediation_FieldMask{}, 3030 } 3031 mySubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelector]gotenobject.FieldMask{ 3032 NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorAiRemediation: &rcommon.PolicySpec_AIAgentHandling_Remediation_FieldMask{}, 3033 } 3034 3035 for _, path := range other.GetPaths() { 3036 switch tp := path.(type) { 3037 case *NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath: 3038 removedSelectors[int(tp.selector)] = true 3039 case *NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldSubPath: 3040 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3041 } 3042 } 3043 for _, path := range fieldMask.GetPaths() { 3044 if !removedSelectors[int(path.Selector())] { 3045 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3046 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath); ok { 3047 switch tp.selector { 3048 case NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorAiRemediation: 3049 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorAiRemediation] = rcommon.FullPolicySpec_AIAgentHandling_Remediation_FieldMask() 3050 } 3051 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldSubPath); ok { 3052 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3053 } 3054 } else { 3055 result.Paths = append(result.Paths, path) 3056 } 3057 } 3058 } 3059 for selector, mySubMask := range mySubMasks { 3060 if mySubMask.PathsCount() > 0 { 3061 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3062 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldSubPath{selector: selector, subPath: allowedPath}) 3063 } 3064 } 3065 } 3066 3067 if len(result.Paths) == 0 { 3068 return nil 3069 } 3070 return result 3071 } 3072 3073 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3074 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask)) 3075 } 3076 3077 // FilterInputFields generates copy of field paths with output_only field paths removed 3078 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask { 3079 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask{} 3080 result.Paths = append(result.Paths, fieldMask.Paths...) 3081 return result 3082 } 3083 3084 // ToFieldMask is used for proto conversions 3085 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3086 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3087 for _, path := range fieldMask.Paths { 3088 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3089 } 3090 return protoFieldMask 3091 } 3092 3093 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3094 if fieldMask == nil { 3095 return status.Error(codes.Internal, "target field mask is nil") 3096 } 3097 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath, 0, len(protoFieldMask.Paths)) 3098 for _, strPath := range protoFieldMask.Paths { 3099 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath(strPath) 3100 if err != nil { 3101 return err 3102 } 3103 fieldMask.Paths = append(fieldMask.Paths, path) 3104 } 3105 return nil 3106 } 3107 3108 // implement methods required by customType 3109 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) Marshal() ([]byte, error) { 3110 protoFieldMask := fieldMask.ToProtoFieldMask() 3111 return proto.Marshal(protoFieldMask) 3112 } 3113 3114 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) Unmarshal(data []byte) error { 3115 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3116 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3117 return err 3118 } 3119 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3120 return err 3121 } 3122 return nil 3123 } 3124 3125 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) Size() int { 3126 return proto.Size(fieldMask.ToProtoFieldMask()) 3127 } 3128 3129 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) MarshalJSON() ([]byte, error) { 3130 return json.Marshal(fieldMask.ToProtoFieldMask()) 3131 } 3132 3133 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) UnmarshalJSON(data []byte) error { 3134 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3135 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3136 return err 3137 } 3138 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3139 return err 3140 } 3141 return nil 3142 } 3143 3144 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath) { 3145 fieldMask.Paths = append(fieldMask.Paths, path) 3146 } 3147 3148 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3149 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath)) 3150 } 3151 3152 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath { 3153 if fieldMask == nil { 3154 return nil 3155 } 3156 return fieldMask.Paths 3157 } 3158 3159 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3160 if fieldMask == nil { 3161 return nil 3162 } 3163 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3164 for _, path := range fieldMask.Paths { 3165 rawPaths = append(rawPaths, path) 3166 } 3167 return rawPaths 3168 } 3169 3170 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) SetFromCliFlag(raw string) error { 3171 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPath(raw) 3172 if err != nil { 3173 return err 3174 } 3175 fieldMask.Paths = append(fieldMask.Paths, path) 3176 return nil 3177 } 3178 3179 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling) { 3180 for _, path := range fieldMask.Paths { 3181 val, _ := path.GetSingle(source) 3182 // if val is nil, then field does not exist in source, skip 3183 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3184 if val != nil { 3185 path.WithIValue(val).SetTo(&target) 3186 } 3187 } 3188 } 3189 3190 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3191 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling)) 3192 } 3193 3194 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling { 3195 if source == nil { 3196 return nil 3197 } 3198 if fieldMask == nil { 3199 return source 3200 } 3201 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling{} 3202 aiRemediationMask := &rcommon.PolicySpec_AIAgentHandling_Remediation_FieldMask{} 3203 wholeAiRemediationAccepted := false 3204 3205 for _, p := range fieldMask.Paths { 3206 switch tp := p.(type) { 3207 case *NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldTerminalPath: 3208 switch tp.selector { 3209 case NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorCurrentState: 3210 result.CurrentState = source.CurrentState 3211 case NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorTroubleshootingNotes: 3212 result.TroubleshootingNotes = source.TroubleshootingNotes 3213 case NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorAiRemediation: 3214 result.AiRemediation = source.AiRemediation 3215 wholeAiRemediationAccepted = true 3216 case NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorRemediationArg: 3217 result.RemediationArg = source.RemediationArg 3218 } 3219 case *NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldSubPath: 3220 switch tp.selector { 3221 case NotificationMsgAlertsGroupConditionAlertsAlertAiHandling_FieldPathSelectorAiRemediation: 3222 aiRemediationMask.AppendPath(tp.subPath.(rcommon.PolicySpecAIAgentHandlingRemediation_FieldPath)) 3223 } 3224 } 3225 } 3226 if wholeAiRemediationAccepted == false && len(aiRemediationMask.Paths) > 0 { 3227 result.AiRemediation = aiRemediationMask.Project(source.GetAiRemediation()) 3228 } 3229 return result 3230 } 3231 3232 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3233 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling)) 3234 } 3235 3236 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_AiHandling_FieldMask) PathsCount() int { 3237 if fieldMask == nil { 3238 return 0 3239 } 3240 return len(fieldMask.Paths) 3241 } 3242 3243 type NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask struct { 3244 Paths []NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath 3245 } 3246 3247 func FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask { 3248 res := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask{} 3249 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPathSelectorCurrentState}) 3250 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPathSelectorNotes}) 3251 return res 3252 } 3253 3254 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) String() string { 3255 if fieldMask == nil { 3256 return "<nil>" 3257 } 3258 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3259 for _, path := range fieldMask.Paths { 3260 pathsStr = append(pathsStr, path.String()) 3261 } 3262 return strings.Join(pathsStr, ", ") 3263 } 3264 3265 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) IsFull() bool { 3266 if fieldMask == nil { 3267 return false 3268 } 3269 presentSelectors := make([]bool, 2) 3270 for _, path := range fieldMask.Paths { 3271 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldTerminalPath); ok { 3272 presentSelectors[int(asFinal.selector)] = true 3273 } 3274 } 3275 for _, flag := range presentSelectors { 3276 if !flag { 3277 return false 3278 } 3279 } 3280 return true 3281 } 3282 3283 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) ProtoReflect() preflect.Message { 3284 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3285 return ParseNotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath(raw) 3286 }) 3287 } 3288 3289 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) ProtoMessage() { 3290 } 3291 3292 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) Reset() { 3293 if fieldMask != nil { 3294 fieldMask.Paths = nil 3295 } 3296 } 3297 3298 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask { 3299 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask{} 3300 removedSelectors := make([]bool, 2) 3301 3302 for _, path := range other.GetPaths() { 3303 switch tp := path.(type) { 3304 case *NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldTerminalPath: 3305 removedSelectors[int(tp.selector)] = true 3306 } 3307 } 3308 for _, path := range fieldMask.GetPaths() { 3309 if !removedSelectors[int(path.Selector())] { 3310 result.Paths = append(result.Paths, path) 3311 } 3312 } 3313 3314 if len(result.Paths) == 0 { 3315 return nil 3316 } 3317 return result 3318 } 3319 3320 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3321 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask)) 3322 } 3323 3324 // FilterInputFields generates copy of field paths with output_only field paths removed 3325 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask { 3326 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask{} 3327 result.Paths = append(result.Paths, fieldMask.Paths...) 3328 return result 3329 } 3330 3331 // ToFieldMask is used for proto conversions 3332 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3333 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3334 for _, path := range fieldMask.Paths { 3335 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3336 } 3337 return protoFieldMask 3338 } 3339 3340 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3341 if fieldMask == nil { 3342 return status.Error(codes.Internal, "target field mask is nil") 3343 } 3344 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath, 0, len(protoFieldMask.Paths)) 3345 for _, strPath := range protoFieldMask.Paths { 3346 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath(strPath) 3347 if err != nil { 3348 return err 3349 } 3350 fieldMask.Paths = append(fieldMask.Paths, path) 3351 } 3352 return nil 3353 } 3354 3355 // implement methods required by customType 3356 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) Marshal() ([]byte, error) { 3357 protoFieldMask := fieldMask.ToProtoFieldMask() 3358 return proto.Marshal(protoFieldMask) 3359 } 3360 3361 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) Unmarshal(data []byte) error { 3362 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3363 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3364 return err 3365 } 3366 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3367 return err 3368 } 3369 return nil 3370 } 3371 3372 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) Size() int { 3373 return proto.Size(fieldMask.ToProtoFieldMask()) 3374 } 3375 3376 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) MarshalJSON() ([]byte, error) { 3377 return json.Marshal(fieldMask.ToProtoFieldMask()) 3378 } 3379 3380 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) UnmarshalJSON(data []byte) error { 3381 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3382 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3383 return err 3384 } 3385 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3386 return err 3387 } 3388 return nil 3389 } 3390 3391 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath) { 3392 fieldMask.Paths = append(fieldMask.Paths, path) 3393 } 3394 3395 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3396 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath)) 3397 } 3398 3399 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath { 3400 if fieldMask == nil { 3401 return nil 3402 } 3403 return fieldMask.Paths 3404 } 3405 3406 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3407 if fieldMask == nil { 3408 return nil 3409 } 3410 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3411 for _, path := range fieldMask.Paths { 3412 rawPaths = append(rawPaths, path) 3413 } 3414 return rawPaths 3415 } 3416 3417 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) SetFromCliFlag(raw string) error { 3418 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPath(raw) 3419 if err != nil { 3420 return err 3421 } 3422 fieldMask.Paths = append(fieldMask.Paths, path) 3423 return nil 3424 } 3425 3426 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling) { 3427 for _, path := range fieldMask.Paths { 3428 val, _ := path.GetSingle(source) 3429 // if val is nil, then field does not exist in source, skip 3430 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3431 if val != nil { 3432 path.WithIValue(val).SetTo(&target) 3433 } 3434 } 3435 } 3436 3437 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3438 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling)) 3439 } 3440 3441 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling { 3442 if source == nil { 3443 return nil 3444 } 3445 if fieldMask == nil { 3446 return source 3447 } 3448 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling{} 3449 3450 for _, p := range fieldMask.Paths { 3451 switch tp := p.(type) { 3452 case *NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldTerminalPath: 3453 switch tp.selector { 3454 case NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPathSelectorCurrentState: 3455 result.CurrentState = source.CurrentState 3456 case NotificationMsgAlertsGroupConditionAlertsAlertOperatorHandling_FieldPathSelectorNotes: 3457 result.Notes = source.Notes 3458 } 3459 } 3460 } 3461 return result 3462 } 3463 3464 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3465 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling)) 3466 } 3467 3468 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_OperatorHandling_FieldMask) PathsCount() int { 3469 if fieldMask == nil { 3470 return 0 3471 } 3472 return len(fieldMask.Paths) 3473 } 3474 3475 type NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask struct { 3476 Paths []NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath 3477 } 3478 3479 func FullNotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask { 3480 res := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask{} 3481 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorQuery}) 3482 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorValues}) 3483 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorUpperThreshold}) 3484 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorLowerThreshold}) 3485 res.Paths = append(res.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath{selector: NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorRaisedAfter}) 3486 return res 3487 } 3488 3489 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) String() string { 3490 if fieldMask == nil { 3491 return "<nil>" 3492 } 3493 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3494 for _, path := range fieldMask.Paths { 3495 pathsStr = append(pathsStr, path.String()) 3496 } 3497 return strings.Join(pathsStr, ", ") 3498 } 3499 3500 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) IsFull() bool { 3501 if fieldMask == nil { 3502 return false 3503 } 3504 presentSelectors := make([]bool, 5) 3505 for _, path := range fieldMask.Paths { 3506 if asFinal, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath); ok { 3507 presentSelectors[int(asFinal.selector)] = true 3508 } 3509 } 3510 for _, flag := range presentSelectors { 3511 if !flag { 3512 return false 3513 } 3514 } 3515 return true 3516 } 3517 3518 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) ProtoReflect() preflect.Message { 3519 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3520 return ParseNotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath(raw) 3521 }) 3522 } 3523 3524 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) ProtoMessage() { 3525 } 3526 3527 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) Reset() { 3528 if fieldMask != nil { 3529 fieldMask.Paths = nil 3530 } 3531 } 3532 3533 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) Subtract(other *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask { 3534 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask{} 3535 removedSelectors := make([]bool, 5) 3536 otherSubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelector]gotenobject.FieldMask{ 3537 NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorUpperThreshold: &rcommon.AlertingThreshold_FieldMask{}, 3538 NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorLowerThreshold: &rcommon.AlertingThreshold_FieldMask{}, 3539 } 3540 mySubMasks := map[NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelector]gotenobject.FieldMask{ 3541 NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorUpperThreshold: &rcommon.AlertingThreshold_FieldMask{}, 3542 NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorLowerThreshold: &rcommon.AlertingThreshold_FieldMask{}, 3543 } 3544 3545 for _, path := range other.GetPaths() { 3546 switch tp := path.(type) { 3547 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath: 3548 removedSelectors[int(tp.selector)] = true 3549 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldSubPath: 3550 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 3551 } 3552 } 3553 for _, path := range fieldMask.GetPaths() { 3554 if !removedSelectors[int(path.Selector())] { 3555 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 3556 if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath); ok { 3557 switch tp.selector { 3558 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorUpperThreshold: 3559 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorUpperThreshold] = rcommon.FullAlertingThreshold_FieldMask() 3560 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorLowerThreshold: 3561 mySubMasks[NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorLowerThreshold] = rcommon.FullAlertingThreshold_FieldMask() 3562 } 3563 } else if tp, ok := path.(*NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldSubPath); ok { 3564 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 3565 } 3566 } else { 3567 result.Paths = append(result.Paths, path) 3568 } 3569 } 3570 } 3571 for selector, mySubMask := range mySubMasks { 3572 if mySubMask.PathsCount() > 0 { 3573 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 3574 result.Paths = append(result.Paths, &NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldSubPath{selector: selector, subPath: allowedPath}) 3575 } 3576 } 3577 } 3578 3579 if len(result.Paths) == 0 { 3580 return nil 3581 } 3582 return result 3583 } 3584 3585 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3586 return fieldMask.Subtract(other.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask)) 3587 } 3588 3589 // FilterInputFields generates copy of field paths with output_only field paths removed 3590 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) FilterInputFields() *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask { 3591 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask{} 3592 result.Paths = append(result.Paths, fieldMask.Paths...) 3593 return result 3594 } 3595 3596 // ToFieldMask is used for proto conversions 3597 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3598 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3599 for _, path := range fieldMask.Paths { 3600 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3601 } 3602 return protoFieldMask 3603 } 3604 3605 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3606 if fieldMask == nil { 3607 return status.Error(codes.Internal, "target field mask is nil") 3608 } 3609 fieldMask.Paths = make([]NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath, 0, len(protoFieldMask.Paths)) 3610 for _, strPath := range protoFieldMask.Paths { 3611 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath(strPath) 3612 if err != nil { 3613 return err 3614 } 3615 fieldMask.Paths = append(fieldMask.Paths, path) 3616 } 3617 return nil 3618 } 3619 3620 // implement methods required by customType 3621 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) Marshal() ([]byte, error) { 3622 protoFieldMask := fieldMask.ToProtoFieldMask() 3623 return proto.Marshal(protoFieldMask) 3624 } 3625 3626 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) Unmarshal(data []byte) error { 3627 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3628 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3629 return err 3630 } 3631 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3632 return err 3633 } 3634 return nil 3635 } 3636 3637 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) Size() int { 3638 return proto.Size(fieldMask.ToProtoFieldMask()) 3639 } 3640 3641 func (fieldMask NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) MarshalJSON() ([]byte, error) { 3642 return json.Marshal(fieldMask.ToProtoFieldMask()) 3643 } 3644 3645 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) UnmarshalJSON(data []byte) error { 3646 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3647 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3648 return err 3649 } 3650 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3651 return err 3652 } 3653 return nil 3654 } 3655 3656 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) AppendPath(path NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath) { 3657 fieldMask.Paths = append(fieldMask.Paths, path) 3658 } 3659 3660 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3661 fieldMask.Paths = append(fieldMask.Paths, path.(NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath)) 3662 } 3663 3664 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) GetPaths() []NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath { 3665 if fieldMask == nil { 3666 return nil 3667 } 3668 return fieldMask.Paths 3669 } 3670 3671 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3672 if fieldMask == nil { 3673 return nil 3674 } 3675 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3676 for _, path := range fieldMask.Paths { 3677 rawPaths = append(rawPaths, path) 3678 } 3679 return rawPaths 3680 } 3681 3682 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) SetFromCliFlag(raw string) error { 3683 path, err := ParseNotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPath(raw) 3684 if err != nil { 3685 return err 3686 } 3687 fieldMask.Paths = append(fieldMask.Paths, path) 3688 return nil 3689 } 3690 3691 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) Set(target, source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries) { 3692 for _, path := range fieldMask.Paths { 3693 val, _ := path.GetSingle(source) 3694 // if val is nil, then field does not exist in source, skip 3695 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3696 if val != nil { 3697 path.WithIValue(val).SetTo(&target) 3698 } 3699 } 3700 } 3701 3702 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3703 fieldMask.Set(target.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries), source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries)) 3704 } 3705 3706 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) Project(source *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries) *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries { 3707 if source == nil { 3708 return nil 3709 } 3710 if fieldMask == nil { 3711 return source 3712 } 3713 result := &NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries{} 3714 upperThresholdMask := &rcommon.AlertingThreshold_FieldMask{} 3715 wholeUpperThresholdAccepted := false 3716 lowerThresholdMask := &rcommon.AlertingThreshold_FieldMask{} 3717 wholeLowerThresholdAccepted := false 3718 3719 for _, p := range fieldMask.Paths { 3720 switch tp := p.(type) { 3721 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldTerminalPath: 3722 switch tp.selector { 3723 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorQuery: 3724 result.Query = source.Query 3725 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorValues: 3726 result.Values = source.Values 3727 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorUpperThreshold: 3728 result.UpperThreshold = source.UpperThreshold 3729 wholeUpperThresholdAccepted = true 3730 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorLowerThreshold: 3731 result.LowerThreshold = source.LowerThreshold 3732 wholeLowerThresholdAccepted = true 3733 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorRaisedAfter: 3734 result.RaisedAfter = source.RaisedAfter 3735 } 3736 case *NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldSubPath: 3737 switch tp.selector { 3738 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorUpperThreshold: 3739 upperThresholdMask.AppendPath(tp.subPath.(rcommon.AlertingThreshold_FieldPath)) 3740 case NotificationMsgAlertsGroupConditionAlertsAlertViolationInfoTimeSeries_FieldPathSelectorLowerThreshold: 3741 lowerThresholdMask.AppendPath(tp.subPath.(rcommon.AlertingThreshold_FieldPath)) 3742 } 3743 } 3744 } 3745 if wholeUpperThresholdAccepted == false && len(upperThresholdMask.Paths) > 0 { 3746 result.UpperThreshold = upperThresholdMask.Project(source.GetUpperThreshold()) 3747 } 3748 if wholeLowerThresholdAccepted == false && len(lowerThresholdMask.Paths) > 0 { 3749 result.LowerThreshold = lowerThresholdMask.Project(source.GetLowerThreshold()) 3750 } 3751 return result 3752 } 3753 3754 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3755 return fieldMask.Project(source.(*NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries)) 3756 } 3757 3758 func (fieldMask *NotificationMsg_AlertsGroup_ConditionAlerts_Alert_ViolationInfo_TimeSeries_FieldMask) PathsCount() int { 3759 if fieldMask == nil { 3760 return 0 3761 } 3762 return len(fieldMask.Paths) 3763 }