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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/alerting/proto/v1/ts_condition.proto
     3  // DO NOT EDIT!!!
     4  
     5  package ts_condition
     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  	document "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/document"
    24  	log_condition_template "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/log_condition_template"
    25  	policy "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/policy"
    26  	meta "github.com/cloudwan/goten-sdk/types/meta"
    27  	fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    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  	_ = &document.Document{}
    47  	_ = &log_condition_template.LogConditionTemplate{}
    48  	_ = &policy.Policy{}
    49  	_ = &rcommon.LogCndSpec{}
    50  	_ = &fieldmaskpb.FieldMask{}
    51  	_ = &meta.Meta{}
    52  )
    53  
    54  type TsCondition_FieldMask struct {
    55  	Paths []TsCondition_FieldPath
    56  }
    57  
    58  func FullTsCondition_FieldMask() *TsCondition_FieldMask {
    59  	res := &TsCondition_FieldMask{}
    60  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorName})
    61  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorMetadata})
    62  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorDisplayName})
    63  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorDescription})
    64  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorSupportingDocs})
    65  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorSpec})
    66  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorInternal})
    67  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorFilterSelector})
    68  	res.Paths = append(res.Paths, &TsCondition_FieldTerminalPath{selector: TsCondition_FieldPathSelectorTemplateSource})
    69  	return res
    70  }
    71  
    72  func (fieldMask *TsCondition_FieldMask) String() string {
    73  	if fieldMask == nil {
    74  		return "<nil>"
    75  	}
    76  	pathsStr := make([]string, 0, len(fieldMask.Paths))
    77  	for _, path := range fieldMask.Paths {
    78  		pathsStr = append(pathsStr, path.String())
    79  	}
    80  	return strings.Join(pathsStr, ", ")
    81  }
    82  
    83  func (fieldMask *TsCondition_FieldMask) IsFull() bool {
    84  	if fieldMask == nil {
    85  		return false
    86  	}
    87  	presentSelectors := make([]bool, 9)
    88  	for _, path := range fieldMask.Paths {
    89  		if asFinal, ok := path.(*TsCondition_FieldTerminalPath); ok {
    90  			presentSelectors[int(asFinal.selector)] = true
    91  		}
    92  	}
    93  	for _, flag := range presentSelectors {
    94  		if !flag {
    95  			return false
    96  		}
    97  	}
    98  	return true
    99  }
   100  
   101  func (fieldMask *TsCondition_FieldMask) ProtoReflect() preflect.Message {
   102  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   103  		return ParseTsCondition_FieldPath(raw)
   104  	})
   105  }
   106  
   107  func (fieldMask *TsCondition_FieldMask) ProtoMessage() {}
   108  
   109  func (fieldMask *TsCondition_FieldMask) Reset() {
   110  	if fieldMask != nil {
   111  		fieldMask.Paths = nil
   112  	}
   113  }
   114  
   115  func (fieldMask *TsCondition_FieldMask) Subtract(other *TsCondition_FieldMask) *TsCondition_FieldMask {
   116  	result := &TsCondition_FieldMask{}
   117  	removedSelectors := make([]bool, 9)
   118  	otherSubMasks := map[TsCondition_FieldPathSelector]gotenobject.FieldMask{
   119  		TsCondition_FieldPathSelectorMetadata:       &meta.Meta_FieldMask{},
   120  		TsCondition_FieldPathSelectorSpec:           &rcommon.TsCndSpec_FieldMask{},
   121  		TsCondition_FieldPathSelectorInternal:       &TsCondition_Internal_FieldMask{},
   122  		TsCondition_FieldPathSelectorFilterSelector: &TsCondition_Selector_FieldMask{},
   123  		TsCondition_FieldPathSelectorTemplateSource: &TsCondition_TemplateSource_FieldMask{},
   124  	}
   125  	mySubMasks := map[TsCondition_FieldPathSelector]gotenobject.FieldMask{
   126  		TsCondition_FieldPathSelectorMetadata:       &meta.Meta_FieldMask{},
   127  		TsCondition_FieldPathSelectorSpec:           &rcommon.TsCndSpec_FieldMask{},
   128  		TsCondition_FieldPathSelectorInternal:       &TsCondition_Internal_FieldMask{},
   129  		TsCondition_FieldPathSelectorFilterSelector: &TsCondition_Selector_FieldMask{},
   130  		TsCondition_FieldPathSelectorTemplateSource: &TsCondition_TemplateSource_FieldMask{},
   131  	}
   132  
   133  	for _, path := range other.GetPaths() {
   134  		switch tp := path.(type) {
   135  		case *TsCondition_FieldTerminalPath:
   136  			removedSelectors[int(tp.selector)] = true
   137  		case *TsCondition_FieldSubPath:
   138  			otherSubMasks[tp.selector].AppendRawPath(tp.subPath)
   139  		}
   140  	}
   141  	for _, path := range fieldMask.GetPaths() {
   142  		if !removedSelectors[int(path.Selector())] {
   143  			if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 {
   144  				if tp, ok := path.(*TsCondition_FieldTerminalPath); ok {
   145  					switch tp.selector {
   146  					case TsCondition_FieldPathSelectorMetadata:
   147  						mySubMasks[TsCondition_FieldPathSelectorMetadata] = meta.FullMeta_FieldMask()
   148  					case TsCondition_FieldPathSelectorSpec:
   149  						mySubMasks[TsCondition_FieldPathSelectorSpec] = rcommon.FullTsCndSpec_FieldMask()
   150  					case TsCondition_FieldPathSelectorInternal:
   151  						mySubMasks[TsCondition_FieldPathSelectorInternal] = FullTsCondition_Internal_FieldMask()
   152  					case TsCondition_FieldPathSelectorFilterSelector:
   153  						mySubMasks[TsCondition_FieldPathSelectorFilterSelector] = FullTsCondition_Selector_FieldMask()
   154  					case TsCondition_FieldPathSelectorTemplateSource:
   155  						mySubMasks[TsCondition_FieldPathSelectorTemplateSource] = FullTsCondition_TemplateSource_FieldMask()
   156  					}
   157  				} else if tp, ok := path.(*TsCondition_FieldSubPath); ok {
   158  					mySubMasks[tp.selector].AppendRawPath(tp.subPath)
   159  				}
   160  			} else {
   161  				result.Paths = append(result.Paths, path)
   162  			}
   163  		}
   164  	}
   165  	for selector, mySubMask := range mySubMasks {
   166  		if mySubMask.PathsCount() > 0 {
   167  			for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() {
   168  				result.Paths = append(result.Paths, &TsCondition_FieldSubPath{selector: selector, subPath: allowedPath})
   169  			}
   170  		}
   171  	}
   172  
   173  	if len(result.Paths) == 0 {
   174  		return nil
   175  	}
   176  	return result
   177  }
   178  
   179  func (fieldMask *TsCondition_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   180  	return fieldMask.Subtract(other.(*TsCondition_FieldMask))
   181  }
   182  
   183  // FilterInputFields generates copy of field paths with output_only field paths removed
   184  func (fieldMask *TsCondition_FieldMask) FilterInputFields() *TsCondition_FieldMask {
   185  	result := &TsCondition_FieldMask{}
   186  	for _, path := range fieldMask.Paths {
   187  		switch path.Selector() {
   188  		case TsCondition_FieldPathSelectorInternal:
   189  		case TsCondition_FieldPathSelectorFilterSelector:
   190  		case TsCondition_FieldPathSelectorMetadata:
   191  			if _, ok := path.(*TsCondition_FieldTerminalPath); ok {
   192  				for _, subpath := range meta.FullMeta_FieldMask().FilterInputFields().Paths {
   193  					result.Paths = append(result.Paths, &TsCondition_FieldSubPath{selector: path.Selector(), subPath: subpath})
   194  				}
   195  			} else if sub, ok := path.(*TsCondition_FieldSubPath); ok {
   196  				selectedMask := &meta.Meta_FieldMask{
   197  					Paths: []meta.Meta_FieldPath{sub.subPath.(meta.Meta_FieldPath)},
   198  				}
   199  				for _, allowedPath := range selectedMask.FilterInputFields().Paths {
   200  					result.Paths = append(result.Paths, &TsCondition_FieldSubPath{selector: TsCondition_FieldPathSelectorMetadata, subPath: allowedPath})
   201  				}
   202  			}
   203  		default:
   204  			result.Paths = append(result.Paths, path)
   205  		}
   206  	}
   207  	return result
   208  }
   209  
   210  // ToFieldMask is used for proto conversions
   211  func (fieldMask *TsCondition_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   212  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   213  	for _, path := range fieldMask.Paths {
   214  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   215  	}
   216  	return protoFieldMask
   217  }
   218  
   219  func (fieldMask *TsCondition_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   220  	if fieldMask == nil {
   221  		return status.Error(codes.Internal, "target field mask is nil")
   222  	}
   223  	fieldMask.Paths = make([]TsCondition_FieldPath, 0, len(protoFieldMask.Paths))
   224  	for _, strPath := range protoFieldMask.Paths {
   225  		path, err := ParseTsCondition_FieldPath(strPath)
   226  		if err != nil {
   227  			return err
   228  		}
   229  		fieldMask.Paths = append(fieldMask.Paths, path)
   230  	}
   231  	return nil
   232  }
   233  
   234  // implement methods required by customType
   235  func (fieldMask TsCondition_FieldMask) Marshal() ([]byte, error) {
   236  	protoFieldMask := fieldMask.ToProtoFieldMask()
   237  	return proto.Marshal(protoFieldMask)
   238  }
   239  
   240  func (fieldMask *TsCondition_FieldMask) Unmarshal(data []byte) error {
   241  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   242  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   243  		return err
   244  	}
   245  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   246  		return err
   247  	}
   248  	return nil
   249  }
   250  
   251  func (fieldMask *TsCondition_FieldMask) Size() int {
   252  	return proto.Size(fieldMask.ToProtoFieldMask())
   253  }
   254  
   255  func (fieldMask TsCondition_FieldMask) MarshalJSON() ([]byte, error) {
   256  	return json.Marshal(fieldMask.ToProtoFieldMask())
   257  }
   258  
   259  func (fieldMask *TsCondition_FieldMask) UnmarshalJSON(data []byte) error {
   260  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   261  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   262  		return err
   263  	}
   264  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   265  		return err
   266  	}
   267  	return nil
   268  }
   269  
   270  func (fieldMask *TsCondition_FieldMask) AppendPath(path TsCondition_FieldPath) {
   271  	fieldMask.Paths = append(fieldMask.Paths, path)
   272  }
   273  
   274  func (fieldMask *TsCondition_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   275  	fieldMask.Paths = append(fieldMask.Paths, path.(TsCondition_FieldPath))
   276  }
   277  
   278  func (fieldMask *TsCondition_FieldMask) GetPaths() []TsCondition_FieldPath {
   279  	if fieldMask == nil {
   280  		return nil
   281  	}
   282  	return fieldMask.Paths
   283  }
   284  
   285  func (fieldMask *TsCondition_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   286  	if fieldMask == nil {
   287  		return nil
   288  	}
   289  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   290  	for _, path := range fieldMask.Paths {
   291  		rawPaths = append(rawPaths, path)
   292  	}
   293  	return rawPaths
   294  }
   295  
   296  func (fieldMask *TsCondition_FieldMask) SetFromCliFlag(raw string) error {
   297  	path, err := ParseTsCondition_FieldPath(raw)
   298  	if err != nil {
   299  		return err
   300  	}
   301  	fieldMask.Paths = append(fieldMask.Paths, path)
   302  	return nil
   303  }
   304  
   305  func (fieldMask *TsCondition_FieldMask) Set(target, source *TsCondition) {
   306  	for _, path := range fieldMask.Paths {
   307  		val, _ := path.GetSingle(source)
   308  		// if val is nil, then field does not exist in source, skip
   309  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   310  		if val != nil {
   311  			path.WithIValue(val).SetTo(&target)
   312  		}
   313  	}
   314  }
   315  
   316  func (fieldMask *TsCondition_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   317  	fieldMask.Set(target.(*TsCondition), source.(*TsCondition))
   318  }
   319  
   320  func (fieldMask *TsCondition_FieldMask) Project(source *TsCondition) *TsCondition {
   321  	if source == nil {
   322  		return nil
   323  	}
   324  	if fieldMask == nil {
   325  		return source
   326  	}
   327  	result := &TsCondition{}
   328  	metadataMask := &meta.Meta_FieldMask{}
   329  	wholeMetadataAccepted := false
   330  	specMask := &rcommon.TsCndSpec_FieldMask{}
   331  	wholeSpecAccepted := false
   332  	internalMask := &TsCondition_Internal_FieldMask{}
   333  	wholeInternalAccepted := false
   334  	filterSelectorMask := &TsCondition_Selector_FieldMask{}
   335  	wholeFilterSelectorAccepted := false
   336  	templateSourceMask := &TsCondition_TemplateSource_FieldMask{}
   337  	wholeTemplateSourceAccepted := false
   338  
   339  	for _, p := range fieldMask.Paths {
   340  		switch tp := p.(type) {
   341  		case *TsCondition_FieldTerminalPath:
   342  			switch tp.selector {
   343  			case TsCondition_FieldPathSelectorName:
   344  				result.Name = source.Name
   345  			case TsCondition_FieldPathSelectorMetadata:
   346  				result.Metadata = source.Metadata
   347  				wholeMetadataAccepted = true
   348  			case TsCondition_FieldPathSelectorDisplayName:
   349  				result.DisplayName = source.DisplayName
   350  			case TsCondition_FieldPathSelectorDescription:
   351  				result.Description = source.Description
   352  			case TsCondition_FieldPathSelectorSupportingDocs:
   353  				result.SupportingDocs = source.SupportingDocs
   354  			case TsCondition_FieldPathSelectorSpec:
   355  				result.Spec = source.Spec
   356  				wholeSpecAccepted = true
   357  			case TsCondition_FieldPathSelectorInternal:
   358  				result.Internal = source.Internal
   359  				wholeInternalAccepted = true
   360  			case TsCondition_FieldPathSelectorFilterSelector:
   361  				result.FilterSelector = source.FilterSelector
   362  				wholeFilterSelectorAccepted = true
   363  			case TsCondition_FieldPathSelectorTemplateSource:
   364  				result.TemplateSource = source.TemplateSource
   365  				wholeTemplateSourceAccepted = true
   366  			}
   367  		case *TsCondition_FieldSubPath:
   368  			switch tp.selector {
   369  			case TsCondition_FieldPathSelectorMetadata:
   370  				metadataMask.AppendPath(tp.subPath.(meta.Meta_FieldPath))
   371  			case TsCondition_FieldPathSelectorSpec:
   372  				specMask.AppendPath(tp.subPath.(rcommon.TsCndSpec_FieldPath))
   373  			case TsCondition_FieldPathSelectorInternal:
   374  				internalMask.AppendPath(tp.subPath.(TsConditionInternal_FieldPath))
   375  			case TsCondition_FieldPathSelectorFilterSelector:
   376  				filterSelectorMask.AppendPath(tp.subPath.(TsConditionSelector_FieldPath))
   377  			case TsCondition_FieldPathSelectorTemplateSource:
   378  				templateSourceMask.AppendPath(tp.subPath.(TsConditionTemplateSource_FieldPath))
   379  			}
   380  		}
   381  	}
   382  	if wholeMetadataAccepted == false && len(metadataMask.Paths) > 0 {
   383  		result.Metadata = metadataMask.Project(source.GetMetadata())
   384  	}
   385  	if wholeSpecAccepted == false && len(specMask.Paths) > 0 {
   386  		result.Spec = specMask.Project(source.GetSpec())
   387  	}
   388  	if wholeInternalAccepted == false && len(internalMask.Paths) > 0 {
   389  		result.Internal = internalMask.Project(source.GetInternal())
   390  	}
   391  	if wholeFilterSelectorAccepted == false && len(filterSelectorMask.Paths) > 0 {
   392  		result.FilterSelector = filterSelectorMask.Project(source.GetFilterSelector())
   393  	}
   394  	if wholeTemplateSourceAccepted == false && len(templateSourceMask.Paths) > 0 {
   395  		result.TemplateSource = templateSourceMask.Project(source.GetTemplateSource())
   396  	}
   397  	return result
   398  }
   399  
   400  func (fieldMask *TsCondition_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   401  	return fieldMask.Project(source.(*TsCondition))
   402  }
   403  
   404  func (fieldMask *TsCondition_FieldMask) PathsCount() int {
   405  	if fieldMask == nil {
   406  		return 0
   407  	}
   408  	return len(fieldMask.Paths)
   409  }
   410  
   411  type TsCondition_Internal_FieldMask struct {
   412  	Paths []TsConditionInternal_FieldPath
   413  }
   414  
   415  func FullTsCondition_Internal_FieldMask() *TsCondition_Internal_FieldMask {
   416  	res := &TsCondition_Internal_FieldMask{}
   417  	res.Paths = append(res.Paths, &TsConditionInternal_FieldTerminalPath{selector: TsConditionInternal_FieldPathSelectorCommonKeyKset})
   418  	res.Paths = append(res.Paths, &TsConditionInternal_FieldTerminalPath{selector: TsConditionInternal_FieldPathSelectorEntrySpecGeneration})
   419  	res.Paths = append(res.Paths, &TsConditionInternal_FieldTerminalPath{selector: TsConditionInternal_FieldPathSelectorAlertingLocation})
   420  	return res
   421  }
   422  
   423  func (fieldMask *TsCondition_Internal_FieldMask) String() string {
   424  	if fieldMask == nil {
   425  		return "<nil>"
   426  	}
   427  	pathsStr := make([]string, 0, len(fieldMask.Paths))
   428  	for _, path := range fieldMask.Paths {
   429  		pathsStr = append(pathsStr, path.String())
   430  	}
   431  	return strings.Join(pathsStr, ", ")
   432  }
   433  
   434  func (fieldMask *TsCondition_Internal_FieldMask) IsFull() bool {
   435  	if fieldMask == nil {
   436  		return false
   437  	}
   438  	presentSelectors := make([]bool, 3)
   439  	for _, path := range fieldMask.Paths {
   440  		if asFinal, ok := path.(*TsConditionInternal_FieldTerminalPath); ok {
   441  			presentSelectors[int(asFinal.selector)] = true
   442  		}
   443  	}
   444  	for _, flag := range presentSelectors {
   445  		if !flag {
   446  			return false
   447  		}
   448  	}
   449  	return true
   450  }
   451  
   452  func (fieldMask *TsCondition_Internal_FieldMask) ProtoReflect() preflect.Message {
   453  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   454  		return ParseTsConditionInternal_FieldPath(raw)
   455  	})
   456  }
   457  
   458  func (fieldMask *TsCondition_Internal_FieldMask) ProtoMessage() {}
   459  
   460  func (fieldMask *TsCondition_Internal_FieldMask) Reset() {
   461  	if fieldMask != nil {
   462  		fieldMask.Paths = nil
   463  	}
   464  }
   465  
   466  func (fieldMask *TsCondition_Internal_FieldMask) Subtract(other *TsCondition_Internal_FieldMask) *TsCondition_Internal_FieldMask {
   467  	result := &TsCondition_Internal_FieldMask{}
   468  	removedSelectors := make([]bool, 3)
   469  
   470  	for _, path := range other.GetPaths() {
   471  		switch tp := path.(type) {
   472  		case *TsConditionInternal_FieldTerminalPath:
   473  			removedSelectors[int(tp.selector)] = true
   474  		}
   475  	}
   476  	for _, path := range fieldMask.GetPaths() {
   477  		if !removedSelectors[int(path.Selector())] {
   478  			result.Paths = append(result.Paths, path)
   479  		}
   480  	}
   481  
   482  	if len(result.Paths) == 0 {
   483  		return nil
   484  	}
   485  	return result
   486  }
   487  
   488  func (fieldMask *TsCondition_Internal_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   489  	return fieldMask.Subtract(other.(*TsCondition_Internal_FieldMask))
   490  }
   491  
   492  // FilterInputFields generates copy of field paths with output_only field paths removed
   493  func (fieldMask *TsCondition_Internal_FieldMask) FilterInputFields() *TsCondition_Internal_FieldMask {
   494  	result := &TsCondition_Internal_FieldMask{}
   495  	result.Paths = append(result.Paths, fieldMask.Paths...)
   496  	return result
   497  }
   498  
   499  // ToFieldMask is used for proto conversions
   500  func (fieldMask *TsCondition_Internal_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   501  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   502  	for _, path := range fieldMask.Paths {
   503  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   504  	}
   505  	return protoFieldMask
   506  }
   507  
   508  func (fieldMask *TsCondition_Internal_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   509  	if fieldMask == nil {
   510  		return status.Error(codes.Internal, "target field mask is nil")
   511  	}
   512  	fieldMask.Paths = make([]TsConditionInternal_FieldPath, 0, len(protoFieldMask.Paths))
   513  	for _, strPath := range protoFieldMask.Paths {
   514  		path, err := ParseTsConditionInternal_FieldPath(strPath)
   515  		if err != nil {
   516  			return err
   517  		}
   518  		fieldMask.Paths = append(fieldMask.Paths, path)
   519  	}
   520  	return nil
   521  }
   522  
   523  // implement methods required by customType
   524  func (fieldMask TsCondition_Internal_FieldMask) Marshal() ([]byte, error) {
   525  	protoFieldMask := fieldMask.ToProtoFieldMask()
   526  	return proto.Marshal(protoFieldMask)
   527  }
   528  
   529  func (fieldMask *TsCondition_Internal_FieldMask) Unmarshal(data []byte) error {
   530  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   531  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   532  		return err
   533  	}
   534  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   535  		return err
   536  	}
   537  	return nil
   538  }
   539  
   540  func (fieldMask *TsCondition_Internal_FieldMask) Size() int {
   541  	return proto.Size(fieldMask.ToProtoFieldMask())
   542  }
   543  
   544  func (fieldMask TsCondition_Internal_FieldMask) MarshalJSON() ([]byte, error) {
   545  	return json.Marshal(fieldMask.ToProtoFieldMask())
   546  }
   547  
   548  func (fieldMask *TsCondition_Internal_FieldMask) UnmarshalJSON(data []byte) error {
   549  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   550  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   551  		return err
   552  	}
   553  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   554  		return err
   555  	}
   556  	return nil
   557  }
   558  
   559  func (fieldMask *TsCondition_Internal_FieldMask) AppendPath(path TsConditionInternal_FieldPath) {
   560  	fieldMask.Paths = append(fieldMask.Paths, path)
   561  }
   562  
   563  func (fieldMask *TsCondition_Internal_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   564  	fieldMask.Paths = append(fieldMask.Paths, path.(TsConditionInternal_FieldPath))
   565  }
   566  
   567  func (fieldMask *TsCondition_Internal_FieldMask) GetPaths() []TsConditionInternal_FieldPath {
   568  	if fieldMask == nil {
   569  		return nil
   570  	}
   571  	return fieldMask.Paths
   572  }
   573  
   574  func (fieldMask *TsCondition_Internal_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   575  	if fieldMask == nil {
   576  		return nil
   577  	}
   578  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   579  	for _, path := range fieldMask.Paths {
   580  		rawPaths = append(rawPaths, path)
   581  	}
   582  	return rawPaths
   583  }
   584  
   585  func (fieldMask *TsCondition_Internal_FieldMask) SetFromCliFlag(raw string) error {
   586  	path, err := ParseTsConditionInternal_FieldPath(raw)
   587  	if err != nil {
   588  		return err
   589  	}
   590  	fieldMask.Paths = append(fieldMask.Paths, path)
   591  	return nil
   592  }
   593  
   594  func (fieldMask *TsCondition_Internal_FieldMask) Set(target, source *TsCondition_Internal) {
   595  	for _, path := range fieldMask.Paths {
   596  		val, _ := path.GetSingle(source)
   597  		// if val is nil, then field does not exist in source, skip
   598  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   599  		if val != nil {
   600  			path.WithIValue(val).SetTo(&target)
   601  		}
   602  	}
   603  }
   604  
   605  func (fieldMask *TsCondition_Internal_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   606  	fieldMask.Set(target.(*TsCondition_Internal), source.(*TsCondition_Internal))
   607  }
   608  
   609  func (fieldMask *TsCondition_Internal_FieldMask) Project(source *TsCondition_Internal) *TsCondition_Internal {
   610  	if source == nil {
   611  		return nil
   612  	}
   613  	if fieldMask == nil {
   614  		return source
   615  	}
   616  	result := &TsCondition_Internal{}
   617  
   618  	for _, p := range fieldMask.Paths {
   619  		switch tp := p.(type) {
   620  		case *TsConditionInternal_FieldTerminalPath:
   621  			switch tp.selector {
   622  			case TsConditionInternal_FieldPathSelectorCommonKeyKset:
   623  				result.CommonKeyKset = source.CommonKeyKset
   624  			case TsConditionInternal_FieldPathSelectorEntrySpecGeneration:
   625  				result.EntrySpecGeneration = source.EntrySpecGeneration
   626  			case TsConditionInternal_FieldPathSelectorAlertingLocation:
   627  				result.AlertingLocation = source.AlertingLocation
   628  			}
   629  		}
   630  	}
   631  	return result
   632  }
   633  
   634  func (fieldMask *TsCondition_Internal_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   635  	return fieldMask.Project(source.(*TsCondition_Internal))
   636  }
   637  
   638  func (fieldMask *TsCondition_Internal_FieldMask) PathsCount() int {
   639  	if fieldMask == nil {
   640  		return 0
   641  	}
   642  	return len(fieldMask.Paths)
   643  }
   644  
   645  type TsCondition_Selector_FieldMask struct {
   646  	Paths []TsConditionSelector_FieldPath
   647  }
   648  
   649  func FullTsCondition_Selector_FieldMask() *TsCondition_Selector_FieldMask {
   650  	res := &TsCondition_Selector_FieldMask{}
   651  	res.Paths = append(res.Paths, &TsConditionSelector_FieldTerminalPath{selector: TsConditionSelector_FieldPathSelectorMetricTypes})
   652  	res.Paths = append(res.Paths, &TsConditionSelector_FieldTerminalPath{selector: TsConditionSelector_FieldPathSelectorResourceTypes})
   653  	res.Paths = append(res.Paths, &TsConditionSelector_FieldTerminalPath{selector: TsConditionSelector_FieldPathSelectorCommonMetricLabels})
   654  	res.Paths = append(res.Paths, &TsConditionSelector_FieldTerminalPath{selector: TsConditionSelector_FieldPathSelectorCommonResourceLabels})
   655  	return res
   656  }
   657  
   658  func (fieldMask *TsCondition_Selector_FieldMask) String() string {
   659  	if fieldMask == nil {
   660  		return "<nil>"
   661  	}
   662  	pathsStr := make([]string, 0, len(fieldMask.Paths))
   663  	for _, path := range fieldMask.Paths {
   664  		pathsStr = append(pathsStr, path.String())
   665  	}
   666  	return strings.Join(pathsStr, ", ")
   667  }
   668  
   669  func (fieldMask *TsCondition_Selector_FieldMask) IsFull() bool {
   670  	if fieldMask == nil {
   671  		return false
   672  	}
   673  	presentSelectors := make([]bool, 4)
   674  	for _, path := range fieldMask.Paths {
   675  		if asFinal, ok := path.(*TsConditionSelector_FieldTerminalPath); ok {
   676  			presentSelectors[int(asFinal.selector)] = true
   677  		}
   678  	}
   679  	for _, flag := range presentSelectors {
   680  		if !flag {
   681  			return false
   682  		}
   683  	}
   684  	return true
   685  }
   686  
   687  func (fieldMask *TsCondition_Selector_FieldMask) ProtoReflect() preflect.Message {
   688  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   689  		return ParseTsConditionSelector_FieldPath(raw)
   690  	})
   691  }
   692  
   693  func (fieldMask *TsCondition_Selector_FieldMask) ProtoMessage() {}
   694  
   695  func (fieldMask *TsCondition_Selector_FieldMask) Reset() {
   696  	if fieldMask != nil {
   697  		fieldMask.Paths = nil
   698  	}
   699  }
   700  
   701  func (fieldMask *TsCondition_Selector_FieldMask) Subtract(other *TsCondition_Selector_FieldMask) *TsCondition_Selector_FieldMask {
   702  	result := &TsCondition_Selector_FieldMask{}
   703  	removedSelectors := make([]bool, 4)
   704  
   705  	for _, path := range other.GetPaths() {
   706  		switch tp := path.(type) {
   707  		case *TsConditionSelector_FieldTerminalPath:
   708  			removedSelectors[int(tp.selector)] = true
   709  		}
   710  	}
   711  	for _, path := range fieldMask.GetPaths() {
   712  		if !removedSelectors[int(path.Selector())] {
   713  			result.Paths = append(result.Paths, path)
   714  		}
   715  	}
   716  
   717  	if len(result.Paths) == 0 {
   718  		return nil
   719  	}
   720  	return result
   721  }
   722  
   723  func (fieldMask *TsCondition_Selector_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   724  	return fieldMask.Subtract(other.(*TsCondition_Selector_FieldMask))
   725  }
   726  
   727  // FilterInputFields generates copy of field paths with output_only field paths removed
   728  func (fieldMask *TsCondition_Selector_FieldMask) FilterInputFields() *TsCondition_Selector_FieldMask {
   729  	result := &TsCondition_Selector_FieldMask{}
   730  	result.Paths = append(result.Paths, fieldMask.Paths...)
   731  	return result
   732  }
   733  
   734  // ToFieldMask is used for proto conversions
   735  func (fieldMask *TsCondition_Selector_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   736  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   737  	for _, path := range fieldMask.Paths {
   738  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   739  	}
   740  	return protoFieldMask
   741  }
   742  
   743  func (fieldMask *TsCondition_Selector_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   744  	if fieldMask == nil {
   745  		return status.Error(codes.Internal, "target field mask is nil")
   746  	}
   747  	fieldMask.Paths = make([]TsConditionSelector_FieldPath, 0, len(protoFieldMask.Paths))
   748  	for _, strPath := range protoFieldMask.Paths {
   749  		path, err := ParseTsConditionSelector_FieldPath(strPath)
   750  		if err != nil {
   751  			return err
   752  		}
   753  		fieldMask.Paths = append(fieldMask.Paths, path)
   754  	}
   755  	return nil
   756  }
   757  
   758  // implement methods required by customType
   759  func (fieldMask TsCondition_Selector_FieldMask) Marshal() ([]byte, error) {
   760  	protoFieldMask := fieldMask.ToProtoFieldMask()
   761  	return proto.Marshal(protoFieldMask)
   762  }
   763  
   764  func (fieldMask *TsCondition_Selector_FieldMask) Unmarshal(data []byte) error {
   765  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   766  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   767  		return err
   768  	}
   769  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   770  		return err
   771  	}
   772  	return nil
   773  }
   774  
   775  func (fieldMask *TsCondition_Selector_FieldMask) Size() int {
   776  	return proto.Size(fieldMask.ToProtoFieldMask())
   777  }
   778  
   779  func (fieldMask TsCondition_Selector_FieldMask) MarshalJSON() ([]byte, error) {
   780  	return json.Marshal(fieldMask.ToProtoFieldMask())
   781  }
   782  
   783  func (fieldMask *TsCondition_Selector_FieldMask) UnmarshalJSON(data []byte) error {
   784  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   785  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   786  		return err
   787  	}
   788  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   789  		return err
   790  	}
   791  	return nil
   792  }
   793  
   794  func (fieldMask *TsCondition_Selector_FieldMask) AppendPath(path TsConditionSelector_FieldPath) {
   795  	fieldMask.Paths = append(fieldMask.Paths, path)
   796  }
   797  
   798  func (fieldMask *TsCondition_Selector_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   799  	fieldMask.Paths = append(fieldMask.Paths, path.(TsConditionSelector_FieldPath))
   800  }
   801  
   802  func (fieldMask *TsCondition_Selector_FieldMask) GetPaths() []TsConditionSelector_FieldPath {
   803  	if fieldMask == nil {
   804  		return nil
   805  	}
   806  	return fieldMask.Paths
   807  }
   808  
   809  func (fieldMask *TsCondition_Selector_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   810  	if fieldMask == nil {
   811  		return nil
   812  	}
   813  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   814  	for _, path := range fieldMask.Paths {
   815  		rawPaths = append(rawPaths, path)
   816  	}
   817  	return rawPaths
   818  }
   819  
   820  func (fieldMask *TsCondition_Selector_FieldMask) SetFromCliFlag(raw string) error {
   821  	path, err := ParseTsConditionSelector_FieldPath(raw)
   822  	if err != nil {
   823  		return err
   824  	}
   825  	fieldMask.Paths = append(fieldMask.Paths, path)
   826  	return nil
   827  }
   828  
   829  func (fieldMask *TsCondition_Selector_FieldMask) Set(target, source *TsCondition_Selector) {
   830  	for _, path := range fieldMask.Paths {
   831  		val, _ := path.GetSingle(source)
   832  		// if val is nil, then field does not exist in source, skip
   833  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   834  		if val != nil {
   835  			path.WithIValue(val).SetTo(&target)
   836  		}
   837  	}
   838  }
   839  
   840  func (fieldMask *TsCondition_Selector_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   841  	fieldMask.Set(target.(*TsCondition_Selector), source.(*TsCondition_Selector))
   842  }
   843  
   844  func (fieldMask *TsCondition_Selector_FieldMask) Project(source *TsCondition_Selector) *TsCondition_Selector {
   845  	if source == nil {
   846  		return nil
   847  	}
   848  	if fieldMask == nil {
   849  		return source
   850  	}
   851  	result := &TsCondition_Selector{}
   852  	var commonMetricLabelsMapKeys []string
   853  	wholeCommonMetricLabelsAccepted := false
   854  	var commonResourceLabelsMapKeys []string
   855  	wholeCommonResourceLabelsAccepted := false
   856  
   857  	for _, p := range fieldMask.Paths {
   858  		switch tp := p.(type) {
   859  		case *TsConditionSelector_FieldTerminalPath:
   860  			switch tp.selector {
   861  			case TsConditionSelector_FieldPathSelectorMetricTypes:
   862  				result.MetricTypes = source.MetricTypes
   863  			case TsConditionSelector_FieldPathSelectorResourceTypes:
   864  				result.ResourceTypes = source.ResourceTypes
   865  			case TsConditionSelector_FieldPathSelectorCommonMetricLabels:
   866  				result.CommonMetricLabels = source.CommonMetricLabels
   867  				wholeCommonMetricLabelsAccepted = true
   868  			case TsConditionSelector_FieldPathSelectorCommonResourceLabels:
   869  				result.CommonResourceLabels = source.CommonResourceLabels
   870  				wholeCommonResourceLabelsAccepted = true
   871  			}
   872  		case *TsConditionSelector_FieldPathMap:
   873  			switch tp.selector {
   874  			case TsConditionSelector_FieldPathSelectorCommonMetricLabels:
   875  				commonMetricLabelsMapKeys = append(commonMetricLabelsMapKeys, tp.key)
   876  			case TsConditionSelector_FieldPathSelectorCommonResourceLabels:
   877  				commonResourceLabelsMapKeys = append(commonResourceLabelsMapKeys, tp.key)
   878  			}
   879  		}
   880  	}
   881  	if wholeCommonMetricLabelsAccepted == false && len(commonMetricLabelsMapKeys) > 0 && source.GetCommonMetricLabels() != nil {
   882  		copiedMap := map[string]*TsCondition_Selector_Strings{}
   883  		sourceMap := source.GetCommonMetricLabels()
   884  		for _, key := range commonMetricLabelsMapKeys {
   885  			copiedMap[key] = sourceMap[key]
   886  		}
   887  		result.CommonMetricLabels = copiedMap
   888  	}
   889  	if wholeCommonResourceLabelsAccepted == false && len(commonResourceLabelsMapKeys) > 0 && source.GetCommonResourceLabels() != nil {
   890  		copiedMap := map[string]*TsCondition_Selector_Strings{}
   891  		sourceMap := source.GetCommonResourceLabels()
   892  		for _, key := range commonResourceLabelsMapKeys {
   893  			copiedMap[key] = sourceMap[key]
   894  		}
   895  		result.CommonResourceLabels = copiedMap
   896  	}
   897  	return result
   898  }
   899  
   900  func (fieldMask *TsCondition_Selector_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   901  	return fieldMask.Project(source.(*TsCondition_Selector))
   902  }
   903  
   904  func (fieldMask *TsCondition_Selector_FieldMask) PathsCount() int {
   905  	if fieldMask == nil {
   906  		return 0
   907  	}
   908  	return len(fieldMask.Paths)
   909  }
   910  
   911  type TsCondition_TemplateSource_FieldMask struct {
   912  	Paths []TsConditionTemplateSource_FieldPath
   913  }
   914  
   915  func FullTsCondition_TemplateSource_FieldMask() *TsCondition_TemplateSource_FieldMask {
   916  	res := &TsCondition_TemplateSource_FieldMask{}
   917  	res.Paths = append(res.Paths, &TsConditionTemplateSource_FieldTerminalPath{selector: TsConditionTemplateSource_FieldPathSelectorTemplate})
   918  	res.Paths = append(res.Paths, &TsConditionTemplateSource_FieldTerminalPath{selector: TsConditionTemplateSource_FieldPathSelectorUpdatedFields})
   919  	return res
   920  }
   921  
   922  func (fieldMask *TsCondition_TemplateSource_FieldMask) String() string {
   923  	if fieldMask == nil {
   924  		return "<nil>"
   925  	}
   926  	pathsStr := make([]string, 0, len(fieldMask.Paths))
   927  	for _, path := range fieldMask.Paths {
   928  		pathsStr = append(pathsStr, path.String())
   929  	}
   930  	return strings.Join(pathsStr, ", ")
   931  }
   932  
   933  func (fieldMask *TsCondition_TemplateSource_FieldMask) IsFull() bool {
   934  	if fieldMask == nil {
   935  		return false
   936  	}
   937  	presentSelectors := make([]bool, 2)
   938  	for _, path := range fieldMask.Paths {
   939  		if asFinal, ok := path.(*TsConditionTemplateSource_FieldTerminalPath); ok {
   940  			presentSelectors[int(asFinal.selector)] = true
   941  		}
   942  	}
   943  	for _, flag := range presentSelectors {
   944  		if !flag {
   945  			return false
   946  		}
   947  	}
   948  	return true
   949  }
   950  
   951  func (fieldMask *TsCondition_TemplateSource_FieldMask) ProtoReflect() preflect.Message {
   952  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   953  		return ParseTsConditionTemplateSource_FieldPath(raw)
   954  	})
   955  }
   956  
   957  func (fieldMask *TsCondition_TemplateSource_FieldMask) ProtoMessage() {}
   958  
   959  func (fieldMask *TsCondition_TemplateSource_FieldMask) Reset() {
   960  	if fieldMask != nil {
   961  		fieldMask.Paths = nil
   962  	}
   963  }
   964  
   965  func (fieldMask *TsCondition_TemplateSource_FieldMask) Subtract(other *TsCondition_TemplateSource_FieldMask) *TsCondition_TemplateSource_FieldMask {
   966  	result := &TsCondition_TemplateSource_FieldMask{}
   967  	removedSelectors := make([]bool, 2)
   968  
   969  	for _, path := range other.GetPaths() {
   970  		switch tp := path.(type) {
   971  		case *TsConditionTemplateSource_FieldTerminalPath:
   972  			removedSelectors[int(tp.selector)] = true
   973  		}
   974  	}
   975  	for _, path := range fieldMask.GetPaths() {
   976  		if !removedSelectors[int(path.Selector())] {
   977  			result.Paths = append(result.Paths, path)
   978  		}
   979  	}
   980  
   981  	if len(result.Paths) == 0 {
   982  		return nil
   983  	}
   984  	return result
   985  }
   986  
   987  func (fieldMask *TsCondition_TemplateSource_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   988  	return fieldMask.Subtract(other.(*TsCondition_TemplateSource_FieldMask))
   989  }
   990  
   991  // FilterInputFields generates copy of field paths with output_only field paths removed
   992  func (fieldMask *TsCondition_TemplateSource_FieldMask) FilterInputFields() *TsCondition_TemplateSource_FieldMask {
   993  	result := &TsCondition_TemplateSource_FieldMask{}
   994  	result.Paths = append(result.Paths, fieldMask.Paths...)
   995  	return result
   996  }
   997  
   998  // ToFieldMask is used for proto conversions
   999  func (fieldMask *TsCondition_TemplateSource_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
  1000  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
  1001  	for _, path := range fieldMask.Paths {
  1002  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
  1003  	}
  1004  	return protoFieldMask
  1005  }
  1006  
  1007  func (fieldMask *TsCondition_TemplateSource_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
  1008  	if fieldMask == nil {
  1009  		return status.Error(codes.Internal, "target field mask is nil")
  1010  	}
  1011  	fieldMask.Paths = make([]TsConditionTemplateSource_FieldPath, 0, len(protoFieldMask.Paths))
  1012  	for _, strPath := range protoFieldMask.Paths {
  1013  		path, err := ParseTsConditionTemplateSource_FieldPath(strPath)
  1014  		if err != nil {
  1015  			return err
  1016  		}
  1017  		fieldMask.Paths = append(fieldMask.Paths, path)
  1018  	}
  1019  	return nil
  1020  }
  1021  
  1022  // implement methods required by customType
  1023  func (fieldMask TsCondition_TemplateSource_FieldMask) Marshal() ([]byte, error) {
  1024  	protoFieldMask := fieldMask.ToProtoFieldMask()
  1025  	return proto.Marshal(protoFieldMask)
  1026  }
  1027  
  1028  func (fieldMask *TsCondition_TemplateSource_FieldMask) Unmarshal(data []byte) error {
  1029  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
  1030  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
  1031  		return err
  1032  	}
  1033  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
  1034  		return err
  1035  	}
  1036  	return nil
  1037  }
  1038  
  1039  func (fieldMask *TsCondition_TemplateSource_FieldMask) Size() int {
  1040  	return proto.Size(fieldMask.ToProtoFieldMask())
  1041  }
  1042  
  1043  func (fieldMask TsCondition_TemplateSource_FieldMask) MarshalJSON() ([]byte, error) {
  1044  	return json.Marshal(fieldMask.ToProtoFieldMask())
  1045  }
  1046  
  1047  func (fieldMask *TsCondition_TemplateSource_FieldMask) UnmarshalJSON(data []byte) error {
  1048  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
  1049  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
  1050  		return err
  1051  	}
  1052  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
  1053  		return err
  1054  	}
  1055  	return nil
  1056  }
  1057  
  1058  func (fieldMask *TsCondition_TemplateSource_FieldMask) AppendPath(path TsConditionTemplateSource_FieldPath) {
  1059  	fieldMask.Paths = append(fieldMask.Paths, path)
  1060  }
  1061  
  1062  func (fieldMask *TsCondition_TemplateSource_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
  1063  	fieldMask.Paths = append(fieldMask.Paths, path.(TsConditionTemplateSource_FieldPath))
  1064  }
  1065  
  1066  func (fieldMask *TsCondition_TemplateSource_FieldMask) GetPaths() []TsConditionTemplateSource_FieldPath {
  1067  	if fieldMask == nil {
  1068  		return nil
  1069  	}
  1070  	return fieldMask.Paths
  1071  }
  1072  
  1073  func (fieldMask *TsCondition_TemplateSource_FieldMask) GetRawPaths() []gotenobject.FieldPath {
  1074  	if fieldMask == nil {
  1075  		return nil
  1076  	}
  1077  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
  1078  	for _, path := range fieldMask.Paths {
  1079  		rawPaths = append(rawPaths, path)
  1080  	}
  1081  	return rawPaths
  1082  }
  1083  
  1084  func (fieldMask *TsCondition_TemplateSource_FieldMask) SetFromCliFlag(raw string) error {
  1085  	path, err := ParseTsConditionTemplateSource_FieldPath(raw)
  1086  	if err != nil {
  1087  		return err
  1088  	}
  1089  	fieldMask.Paths = append(fieldMask.Paths, path)
  1090  	return nil
  1091  }
  1092  
  1093  func (fieldMask *TsCondition_TemplateSource_FieldMask) Set(target, source *TsCondition_TemplateSource) {
  1094  	for _, path := range fieldMask.Paths {
  1095  		val, _ := path.GetSingle(source)
  1096  		// if val is nil, then field does not exist in source, skip
  1097  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
  1098  		if val != nil {
  1099  			path.WithIValue(val).SetTo(&target)
  1100  		}
  1101  	}
  1102  }
  1103  
  1104  func (fieldMask *TsCondition_TemplateSource_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
  1105  	fieldMask.Set(target.(*TsCondition_TemplateSource), source.(*TsCondition_TemplateSource))
  1106  }
  1107  
  1108  func (fieldMask *TsCondition_TemplateSource_FieldMask) Project(source *TsCondition_TemplateSource) *TsCondition_TemplateSource {
  1109  	if source == nil {
  1110  		return nil
  1111  	}
  1112  	if fieldMask == nil {
  1113  		return source
  1114  	}
  1115  	result := &TsCondition_TemplateSource{}
  1116  
  1117  	for _, p := range fieldMask.Paths {
  1118  		switch tp := p.(type) {
  1119  		case *TsConditionTemplateSource_FieldTerminalPath:
  1120  			switch tp.selector {
  1121  			case TsConditionTemplateSource_FieldPathSelectorTemplate:
  1122  				result.Template = source.Template
  1123  			case TsConditionTemplateSource_FieldPathSelectorUpdatedFields:
  1124  				result.UpdatedFields = source.UpdatedFields
  1125  			}
  1126  		}
  1127  	}
  1128  	return result
  1129  }
  1130  
  1131  func (fieldMask *TsCondition_TemplateSource_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
  1132  	return fieldMask.Project(source.(*TsCondition_TemplateSource))
  1133  }
  1134  
  1135  func (fieldMask *TsCondition_TemplateSource_FieldMask) PathsCount() int {
  1136  	if fieldMask == nil {
  1137  		return 0
  1138  	}
  1139  	return len(fieldMask.Paths)
  1140  }
  1141  
  1142  type TsCondition_Selector_Strings_FieldMask struct {
  1143  	Paths []TsConditionSelectorStrings_FieldPath
  1144  }
  1145  
  1146  func FullTsCondition_Selector_Strings_FieldMask() *TsCondition_Selector_Strings_FieldMask {
  1147  	res := &TsCondition_Selector_Strings_FieldMask{}
  1148  	res.Paths = append(res.Paths, &TsConditionSelectorStrings_FieldTerminalPath{selector: TsConditionSelectorStrings_FieldPathSelectorValues})
  1149  	return res
  1150  }
  1151  
  1152  func (fieldMask *TsCondition_Selector_Strings_FieldMask) String() string {
  1153  	if fieldMask == nil {
  1154  		return "<nil>"
  1155  	}
  1156  	pathsStr := make([]string, 0, len(fieldMask.Paths))
  1157  	for _, path := range fieldMask.Paths {
  1158  		pathsStr = append(pathsStr, path.String())
  1159  	}
  1160  	return strings.Join(pathsStr, ", ")
  1161  }
  1162  
  1163  func (fieldMask *TsCondition_Selector_Strings_FieldMask) IsFull() bool {
  1164  	if fieldMask == nil {
  1165  		return false
  1166  	}
  1167  	presentSelectors := make([]bool, 1)
  1168  	for _, path := range fieldMask.Paths {
  1169  		if asFinal, ok := path.(*TsConditionSelectorStrings_FieldTerminalPath); ok {
  1170  			presentSelectors[int(asFinal.selector)] = true
  1171  		}
  1172  	}
  1173  	for _, flag := range presentSelectors {
  1174  		if !flag {
  1175  			return false
  1176  		}
  1177  	}
  1178  	return true
  1179  }
  1180  
  1181  func (fieldMask *TsCondition_Selector_Strings_FieldMask) ProtoReflect() preflect.Message {
  1182  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
  1183  		return ParseTsConditionSelectorStrings_FieldPath(raw)
  1184  	})
  1185  }
  1186  
  1187  func (fieldMask *TsCondition_Selector_Strings_FieldMask) ProtoMessage() {}
  1188  
  1189  func (fieldMask *TsCondition_Selector_Strings_FieldMask) Reset() {
  1190  	if fieldMask != nil {
  1191  		fieldMask.Paths = nil
  1192  	}
  1193  }
  1194  
  1195  func (fieldMask *TsCondition_Selector_Strings_FieldMask) Subtract(other *TsCondition_Selector_Strings_FieldMask) *TsCondition_Selector_Strings_FieldMask {
  1196  	result := &TsCondition_Selector_Strings_FieldMask{}
  1197  	removedSelectors := make([]bool, 1)
  1198  
  1199  	for _, path := range other.GetPaths() {
  1200  		switch tp := path.(type) {
  1201  		case *TsConditionSelectorStrings_FieldTerminalPath:
  1202  			removedSelectors[int(tp.selector)] = true
  1203  		}
  1204  	}
  1205  	for _, path := range fieldMask.GetPaths() {
  1206  		if !removedSelectors[int(path.Selector())] {
  1207  			result.Paths = append(result.Paths, path)
  1208  		}
  1209  	}
  1210  
  1211  	if len(result.Paths) == 0 {
  1212  		return nil
  1213  	}
  1214  	return result
  1215  }
  1216  
  1217  func (fieldMask *TsCondition_Selector_Strings_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
  1218  	return fieldMask.Subtract(other.(*TsCondition_Selector_Strings_FieldMask))
  1219  }
  1220  
  1221  // FilterInputFields generates copy of field paths with output_only field paths removed
  1222  func (fieldMask *TsCondition_Selector_Strings_FieldMask) FilterInputFields() *TsCondition_Selector_Strings_FieldMask {
  1223  	result := &TsCondition_Selector_Strings_FieldMask{}
  1224  	result.Paths = append(result.Paths, fieldMask.Paths...)
  1225  	return result
  1226  }
  1227  
  1228  // ToFieldMask is used for proto conversions
  1229  func (fieldMask *TsCondition_Selector_Strings_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
  1230  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
  1231  	for _, path := range fieldMask.Paths {
  1232  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
  1233  	}
  1234  	return protoFieldMask
  1235  }
  1236  
  1237  func (fieldMask *TsCondition_Selector_Strings_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
  1238  	if fieldMask == nil {
  1239  		return status.Error(codes.Internal, "target field mask is nil")
  1240  	}
  1241  	fieldMask.Paths = make([]TsConditionSelectorStrings_FieldPath, 0, len(protoFieldMask.Paths))
  1242  	for _, strPath := range protoFieldMask.Paths {
  1243  		path, err := ParseTsConditionSelectorStrings_FieldPath(strPath)
  1244  		if err != nil {
  1245  			return err
  1246  		}
  1247  		fieldMask.Paths = append(fieldMask.Paths, path)
  1248  	}
  1249  	return nil
  1250  }
  1251  
  1252  // implement methods required by customType
  1253  func (fieldMask TsCondition_Selector_Strings_FieldMask) Marshal() ([]byte, error) {
  1254  	protoFieldMask := fieldMask.ToProtoFieldMask()
  1255  	return proto.Marshal(protoFieldMask)
  1256  }
  1257  
  1258  func (fieldMask *TsCondition_Selector_Strings_FieldMask) Unmarshal(data []byte) error {
  1259  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
  1260  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
  1261  		return err
  1262  	}
  1263  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
  1264  		return err
  1265  	}
  1266  	return nil
  1267  }
  1268  
  1269  func (fieldMask *TsCondition_Selector_Strings_FieldMask) Size() int {
  1270  	return proto.Size(fieldMask.ToProtoFieldMask())
  1271  }
  1272  
  1273  func (fieldMask TsCondition_Selector_Strings_FieldMask) MarshalJSON() ([]byte, error) {
  1274  	return json.Marshal(fieldMask.ToProtoFieldMask())
  1275  }
  1276  
  1277  func (fieldMask *TsCondition_Selector_Strings_FieldMask) UnmarshalJSON(data []byte) error {
  1278  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
  1279  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
  1280  		return err
  1281  	}
  1282  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
  1283  		return err
  1284  	}
  1285  	return nil
  1286  }
  1287  
  1288  func (fieldMask *TsCondition_Selector_Strings_FieldMask) AppendPath(path TsConditionSelectorStrings_FieldPath) {
  1289  	fieldMask.Paths = append(fieldMask.Paths, path)
  1290  }
  1291  
  1292  func (fieldMask *TsCondition_Selector_Strings_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
  1293  	fieldMask.Paths = append(fieldMask.Paths, path.(TsConditionSelectorStrings_FieldPath))
  1294  }
  1295  
  1296  func (fieldMask *TsCondition_Selector_Strings_FieldMask) GetPaths() []TsConditionSelectorStrings_FieldPath {
  1297  	if fieldMask == nil {
  1298  		return nil
  1299  	}
  1300  	return fieldMask.Paths
  1301  }
  1302  
  1303  func (fieldMask *TsCondition_Selector_Strings_FieldMask) GetRawPaths() []gotenobject.FieldPath {
  1304  	if fieldMask == nil {
  1305  		return nil
  1306  	}
  1307  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
  1308  	for _, path := range fieldMask.Paths {
  1309  		rawPaths = append(rawPaths, path)
  1310  	}
  1311  	return rawPaths
  1312  }
  1313  
  1314  func (fieldMask *TsCondition_Selector_Strings_FieldMask) SetFromCliFlag(raw string) error {
  1315  	path, err := ParseTsConditionSelectorStrings_FieldPath(raw)
  1316  	if err != nil {
  1317  		return err
  1318  	}
  1319  	fieldMask.Paths = append(fieldMask.Paths, path)
  1320  	return nil
  1321  }
  1322  
  1323  func (fieldMask *TsCondition_Selector_Strings_FieldMask) Set(target, source *TsCondition_Selector_Strings) {
  1324  	for _, path := range fieldMask.Paths {
  1325  		val, _ := path.GetSingle(source)
  1326  		// if val is nil, then field does not exist in source, skip
  1327  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
  1328  		if val != nil {
  1329  			path.WithIValue(val).SetTo(&target)
  1330  		}
  1331  	}
  1332  }
  1333  
  1334  func (fieldMask *TsCondition_Selector_Strings_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
  1335  	fieldMask.Set(target.(*TsCondition_Selector_Strings), source.(*TsCondition_Selector_Strings))
  1336  }
  1337  
  1338  func (fieldMask *TsCondition_Selector_Strings_FieldMask) Project(source *TsCondition_Selector_Strings) *TsCondition_Selector_Strings {
  1339  	if source == nil {
  1340  		return nil
  1341  	}
  1342  	if fieldMask == nil {
  1343  		return source
  1344  	}
  1345  	result := &TsCondition_Selector_Strings{}
  1346  
  1347  	for _, p := range fieldMask.Paths {
  1348  		switch tp := p.(type) {
  1349  		case *TsConditionSelectorStrings_FieldTerminalPath:
  1350  			switch tp.selector {
  1351  			case TsConditionSelectorStrings_FieldPathSelectorValues:
  1352  				result.Values = source.Values
  1353  			}
  1354  		}
  1355  	}
  1356  	return result
  1357  }
  1358  
  1359  func (fieldMask *TsCondition_Selector_Strings_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
  1360  	return fieldMask.Project(source.(*TsCondition_Selector_Strings))
  1361  }
  1362  
  1363  func (fieldMask *TsCondition_Selector_Strings_FieldMask) PathsCount() int {
  1364  	if fieldMask == nil {
  1365  		return 0
  1366  	}
  1367  	return len(fieldMask.Paths)
  1368  }