github.com/cloudwan/edgelq-sdk@v1.15.4/alerting/resources/v1/alert/alert.pb.fieldmask.go (about)

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