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

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