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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/alerting/proto/v1/log_condition.proto
     3  // DO NOT EDIT!!!
     4  
     5  package log_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 LogCondition_FieldMask struct {
    55  	Paths []LogCondition_FieldPath
    56  }
    57  
    58  func FullLogCondition_FieldMask() *LogCondition_FieldMask {
    59  	res := &LogCondition_FieldMask{}
    60  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorName})
    61  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorMetadata})
    62  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorDisplayName})
    63  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorDescription})
    64  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorSupportingDocs})
    65  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorSpec})
    66  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorInternal})
    67  	res.Paths = append(res.Paths, &LogCondition_FieldTerminalPath{selector: LogCondition_FieldPathSelectorTemplateSource})
    68  	return res
    69  }
    70  
    71  func (fieldMask *LogCondition_FieldMask) String() string {
    72  	if fieldMask == nil {
    73  		return "<nil>"
    74  	}
    75  	pathsStr := make([]string, 0, len(fieldMask.Paths))
    76  	for _, path := range fieldMask.Paths {
    77  		pathsStr = append(pathsStr, path.String())
    78  	}
    79  	return strings.Join(pathsStr, ", ")
    80  }
    81  
    82  func (fieldMask *LogCondition_FieldMask) IsFull() bool {
    83  	if fieldMask == nil {
    84  		return false
    85  	}
    86  	presentSelectors := make([]bool, 8)
    87  	for _, path := range fieldMask.Paths {
    88  		if asFinal, ok := path.(*LogCondition_FieldTerminalPath); ok {
    89  			presentSelectors[int(asFinal.selector)] = true
    90  		}
    91  	}
    92  	for _, flag := range presentSelectors {
    93  		if !flag {
    94  			return false
    95  		}
    96  	}
    97  	return true
    98  }
    99  
   100  func (fieldMask *LogCondition_FieldMask) ProtoReflect() preflect.Message {
   101  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   102  		return ParseLogCondition_FieldPath(raw)
   103  	})
   104  }
   105  
   106  func (fieldMask *LogCondition_FieldMask) ProtoMessage() {}
   107  
   108  func (fieldMask *LogCondition_FieldMask) Reset() {
   109  	if fieldMask != nil {
   110  		fieldMask.Paths = nil
   111  	}
   112  }
   113  
   114  func (fieldMask *LogCondition_FieldMask) Subtract(other *LogCondition_FieldMask) *LogCondition_FieldMask {
   115  	result := &LogCondition_FieldMask{}
   116  	removedSelectors := make([]bool, 8)
   117  	otherSubMasks := map[LogCondition_FieldPathSelector]gotenobject.FieldMask{
   118  		LogCondition_FieldPathSelectorMetadata:       &meta.Meta_FieldMask{},
   119  		LogCondition_FieldPathSelectorSpec:           &rcommon.LogCndSpec_FieldMask{},
   120  		LogCondition_FieldPathSelectorInternal:       &LogCondition_Internal_FieldMask{},
   121  		LogCondition_FieldPathSelectorTemplateSource: &LogCondition_TemplateSource_FieldMask{},
   122  	}
   123  	mySubMasks := map[LogCondition_FieldPathSelector]gotenobject.FieldMask{
   124  		LogCondition_FieldPathSelectorMetadata:       &meta.Meta_FieldMask{},
   125  		LogCondition_FieldPathSelectorSpec:           &rcommon.LogCndSpec_FieldMask{},
   126  		LogCondition_FieldPathSelectorInternal:       &LogCondition_Internal_FieldMask{},
   127  		LogCondition_FieldPathSelectorTemplateSource: &LogCondition_TemplateSource_FieldMask{},
   128  	}
   129  
   130  	for _, path := range other.GetPaths() {
   131  		switch tp := path.(type) {
   132  		case *LogCondition_FieldTerminalPath:
   133  			removedSelectors[int(tp.selector)] = true
   134  		case *LogCondition_FieldSubPath:
   135  			otherSubMasks[tp.selector].AppendRawPath(tp.subPath)
   136  		}
   137  	}
   138  	for _, path := range fieldMask.GetPaths() {
   139  		if !removedSelectors[int(path.Selector())] {
   140  			if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 {
   141  				if tp, ok := path.(*LogCondition_FieldTerminalPath); ok {
   142  					switch tp.selector {
   143  					case LogCondition_FieldPathSelectorMetadata:
   144  						mySubMasks[LogCondition_FieldPathSelectorMetadata] = meta.FullMeta_FieldMask()
   145  					case LogCondition_FieldPathSelectorSpec:
   146  						mySubMasks[LogCondition_FieldPathSelectorSpec] = rcommon.FullLogCndSpec_FieldMask()
   147  					case LogCondition_FieldPathSelectorInternal:
   148  						mySubMasks[LogCondition_FieldPathSelectorInternal] = FullLogCondition_Internal_FieldMask()
   149  					case LogCondition_FieldPathSelectorTemplateSource:
   150  						mySubMasks[LogCondition_FieldPathSelectorTemplateSource] = FullLogCondition_TemplateSource_FieldMask()
   151  					}
   152  				} else if tp, ok := path.(*LogCondition_FieldSubPath); ok {
   153  					mySubMasks[tp.selector].AppendRawPath(tp.subPath)
   154  				}
   155  			} else {
   156  				result.Paths = append(result.Paths, path)
   157  			}
   158  		}
   159  	}
   160  	for selector, mySubMask := range mySubMasks {
   161  		if mySubMask.PathsCount() > 0 {
   162  			for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() {
   163  				result.Paths = append(result.Paths, &LogCondition_FieldSubPath{selector: selector, subPath: allowedPath})
   164  			}
   165  		}
   166  	}
   167  
   168  	if len(result.Paths) == 0 {
   169  		return nil
   170  	}
   171  	return result
   172  }
   173  
   174  func (fieldMask *LogCondition_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   175  	return fieldMask.Subtract(other.(*LogCondition_FieldMask))
   176  }
   177  
   178  // FilterInputFields generates copy of field paths with output_only field paths removed
   179  func (fieldMask *LogCondition_FieldMask) FilterInputFields() *LogCondition_FieldMask {
   180  	result := &LogCondition_FieldMask{}
   181  	for _, path := range fieldMask.Paths {
   182  		switch path.Selector() {
   183  		case LogCondition_FieldPathSelectorInternal:
   184  		case LogCondition_FieldPathSelectorMetadata:
   185  			if _, ok := path.(*LogCondition_FieldTerminalPath); ok {
   186  				for _, subpath := range meta.FullMeta_FieldMask().FilterInputFields().Paths {
   187  					result.Paths = append(result.Paths, &LogCondition_FieldSubPath{selector: path.Selector(), subPath: subpath})
   188  				}
   189  			} else if sub, ok := path.(*LogCondition_FieldSubPath); ok {
   190  				selectedMask := &meta.Meta_FieldMask{
   191  					Paths: []meta.Meta_FieldPath{sub.subPath.(meta.Meta_FieldPath)},
   192  				}
   193  				for _, allowedPath := range selectedMask.FilterInputFields().Paths {
   194  					result.Paths = append(result.Paths, &LogCondition_FieldSubPath{selector: LogCondition_FieldPathSelectorMetadata, subPath: allowedPath})
   195  				}
   196  			}
   197  		default:
   198  			result.Paths = append(result.Paths, path)
   199  		}
   200  	}
   201  	return result
   202  }
   203  
   204  // ToFieldMask is used for proto conversions
   205  func (fieldMask *LogCondition_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   206  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   207  	for _, path := range fieldMask.Paths {
   208  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   209  	}
   210  	return protoFieldMask
   211  }
   212  
   213  func (fieldMask *LogCondition_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   214  	if fieldMask == nil {
   215  		return status.Error(codes.Internal, "target field mask is nil")
   216  	}
   217  	fieldMask.Paths = make([]LogCondition_FieldPath, 0, len(protoFieldMask.Paths))
   218  	for _, strPath := range protoFieldMask.Paths {
   219  		path, err := ParseLogCondition_FieldPath(strPath)
   220  		if err != nil {
   221  			return err
   222  		}
   223  		fieldMask.Paths = append(fieldMask.Paths, path)
   224  	}
   225  	return nil
   226  }
   227  
   228  // implement methods required by customType
   229  func (fieldMask LogCondition_FieldMask) Marshal() ([]byte, error) {
   230  	protoFieldMask := fieldMask.ToProtoFieldMask()
   231  	return proto.Marshal(protoFieldMask)
   232  }
   233  
   234  func (fieldMask *LogCondition_FieldMask) Unmarshal(data []byte) error {
   235  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   236  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   237  		return err
   238  	}
   239  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   240  		return err
   241  	}
   242  	return nil
   243  }
   244  
   245  func (fieldMask *LogCondition_FieldMask) Size() int {
   246  	return proto.Size(fieldMask.ToProtoFieldMask())
   247  }
   248  
   249  func (fieldMask LogCondition_FieldMask) MarshalJSON() ([]byte, error) {
   250  	return json.Marshal(fieldMask.ToProtoFieldMask())
   251  }
   252  
   253  func (fieldMask *LogCondition_FieldMask) UnmarshalJSON(data []byte) error {
   254  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   255  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   256  		return err
   257  	}
   258  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   259  		return err
   260  	}
   261  	return nil
   262  }
   263  
   264  func (fieldMask *LogCondition_FieldMask) AppendPath(path LogCondition_FieldPath) {
   265  	fieldMask.Paths = append(fieldMask.Paths, path)
   266  }
   267  
   268  func (fieldMask *LogCondition_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   269  	fieldMask.Paths = append(fieldMask.Paths, path.(LogCondition_FieldPath))
   270  }
   271  
   272  func (fieldMask *LogCondition_FieldMask) GetPaths() []LogCondition_FieldPath {
   273  	if fieldMask == nil {
   274  		return nil
   275  	}
   276  	return fieldMask.Paths
   277  }
   278  
   279  func (fieldMask *LogCondition_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   280  	if fieldMask == nil {
   281  		return nil
   282  	}
   283  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   284  	for _, path := range fieldMask.Paths {
   285  		rawPaths = append(rawPaths, path)
   286  	}
   287  	return rawPaths
   288  }
   289  
   290  func (fieldMask *LogCondition_FieldMask) SetFromCliFlag(raw string) error {
   291  	path, err := ParseLogCondition_FieldPath(raw)
   292  	if err != nil {
   293  		return err
   294  	}
   295  	fieldMask.Paths = append(fieldMask.Paths, path)
   296  	return nil
   297  }
   298  
   299  func (fieldMask *LogCondition_FieldMask) Set(target, source *LogCondition) {
   300  	for _, path := range fieldMask.Paths {
   301  		val, _ := path.GetSingle(source)
   302  		// if val is nil, then field does not exist in source, skip
   303  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   304  		if val != nil {
   305  			path.WithIValue(val).SetTo(&target)
   306  		}
   307  	}
   308  }
   309  
   310  func (fieldMask *LogCondition_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   311  	fieldMask.Set(target.(*LogCondition), source.(*LogCondition))
   312  }
   313  
   314  func (fieldMask *LogCondition_FieldMask) Project(source *LogCondition) *LogCondition {
   315  	if source == nil {
   316  		return nil
   317  	}
   318  	if fieldMask == nil {
   319  		return source
   320  	}
   321  	result := &LogCondition{}
   322  	metadataMask := &meta.Meta_FieldMask{}
   323  	wholeMetadataAccepted := false
   324  	specMask := &rcommon.LogCndSpec_FieldMask{}
   325  	wholeSpecAccepted := false
   326  	internalMask := &LogCondition_Internal_FieldMask{}
   327  	wholeInternalAccepted := false
   328  	templateSourceMask := &LogCondition_TemplateSource_FieldMask{}
   329  	wholeTemplateSourceAccepted := false
   330  
   331  	for _, p := range fieldMask.Paths {
   332  		switch tp := p.(type) {
   333  		case *LogCondition_FieldTerminalPath:
   334  			switch tp.selector {
   335  			case LogCondition_FieldPathSelectorName:
   336  				result.Name = source.Name
   337  			case LogCondition_FieldPathSelectorMetadata:
   338  				result.Metadata = source.Metadata
   339  				wholeMetadataAccepted = true
   340  			case LogCondition_FieldPathSelectorDisplayName:
   341  				result.DisplayName = source.DisplayName
   342  			case LogCondition_FieldPathSelectorDescription:
   343  				result.Description = source.Description
   344  			case LogCondition_FieldPathSelectorSupportingDocs:
   345  				result.SupportingDocs = source.SupportingDocs
   346  			case LogCondition_FieldPathSelectorSpec:
   347  				result.Spec = source.Spec
   348  				wholeSpecAccepted = true
   349  			case LogCondition_FieldPathSelectorInternal:
   350  				result.Internal = source.Internal
   351  				wholeInternalAccepted = true
   352  			case LogCondition_FieldPathSelectorTemplateSource:
   353  				result.TemplateSource = source.TemplateSource
   354  				wholeTemplateSourceAccepted = true
   355  			}
   356  		case *LogCondition_FieldSubPath:
   357  			switch tp.selector {
   358  			case LogCondition_FieldPathSelectorMetadata:
   359  				metadataMask.AppendPath(tp.subPath.(meta.Meta_FieldPath))
   360  			case LogCondition_FieldPathSelectorSpec:
   361  				specMask.AppendPath(tp.subPath.(rcommon.LogCndSpec_FieldPath))
   362  			case LogCondition_FieldPathSelectorInternal:
   363  				internalMask.AppendPath(tp.subPath.(LogConditionInternal_FieldPath))
   364  			case LogCondition_FieldPathSelectorTemplateSource:
   365  				templateSourceMask.AppendPath(tp.subPath.(LogConditionTemplateSource_FieldPath))
   366  			}
   367  		}
   368  	}
   369  	if wholeMetadataAccepted == false && len(metadataMask.Paths) > 0 {
   370  		result.Metadata = metadataMask.Project(source.GetMetadata())
   371  	}
   372  	if wholeSpecAccepted == false && len(specMask.Paths) > 0 {
   373  		result.Spec = specMask.Project(source.GetSpec())
   374  	}
   375  	if wholeInternalAccepted == false && len(internalMask.Paths) > 0 {
   376  		result.Internal = internalMask.Project(source.GetInternal())
   377  	}
   378  	if wholeTemplateSourceAccepted == false && len(templateSourceMask.Paths) > 0 {
   379  		result.TemplateSource = templateSourceMask.Project(source.GetTemplateSource())
   380  	}
   381  	return result
   382  }
   383  
   384  func (fieldMask *LogCondition_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   385  	return fieldMask.Project(source.(*LogCondition))
   386  }
   387  
   388  func (fieldMask *LogCondition_FieldMask) PathsCount() int {
   389  	if fieldMask == nil {
   390  		return 0
   391  	}
   392  	return len(fieldMask.Paths)
   393  }
   394  
   395  type LogCondition_Internal_FieldMask struct {
   396  	Paths []LogConditionInternal_FieldPath
   397  }
   398  
   399  func FullLogCondition_Internal_FieldMask() *LogCondition_Internal_FieldMask {
   400  	res := &LogCondition_Internal_FieldMask{}
   401  	res.Paths = append(res.Paths, &LogConditionInternal_FieldTerminalPath{selector: LogConditionInternal_FieldPathSelectorAlertingLocation})
   402  	return res
   403  }
   404  
   405  func (fieldMask *LogCondition_Internal_FieldMask) String() string {
   406  	if fieldMask == nil {
   407  		return "<nil>"
   408  	}
   409  	pathsStr := make([]string, 0, len(fieldMask.Paths))
   410  	for _, path := range fieldMask.Paths {
   411  		pathsStr = append(pathsStr, path.String())
   412  	}
   413  	return strings.Join(pathsStr, ", ")
   414  }
   415  
   416  func (fieldMask *LogCondition_Internal_FieldMask) IsFull() bool {
   417  	if fieldMask == nil {
   418  		return false
   419  	}
   420  	presentSelectors := make([]bool, 1)
   421  	for _, path := range fieldMask.Paths {
   422  		if asFinal, ok := path.(*LogConditionInternal_FieldTerminalPath); ok {
   423  			presentSelectors[int(asFinal.selector)] = true
   424  		}
   425  	}
   426  	for _, flag := range presentSelectors {
   427  		if !flag {
   428  			return false
   429  		}
   430  	}
   431  	return true
   432  }
   433  
   434  func (fieldMask *LogCondition_Internal_FieldMask) ProtoReflect() preflect.Message {
   435  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   436  		return ParseLogConditionInternal_FieldPath(raw)
   437  	})
   438  }
   439  
   440  func (fieldMask *LogCondition_Internal_FieldMask) ProtoMessage() {}
   441  
   442  func (fieldMask *LogCondition_Internal_FieldMask) Reset() {
   443  	if fieldMask != nil {
   444  		fieldMask.Paths = nil
   445  	}
   446  }
   447  
   448  func (fieldMask *LogCondition_Internal_FieldMask) Subtract(other *LogCondition_Internal_FieldMask) *LogCondition_Internal_FieldMask {
   449  	result := &LogCondition_Internal_FieldMask{}
   450  	removedSelectors := make([]bool, 1)
   451  
   452  	for _, path := range other.GetPaths() {
   453  		switch tp := path.(type) {
   454  		case *LogConditionInternal_FieldTerminalPath:
   455  			removedSelectors[int(tp.selector)] = true
   456  		}
   457  	}
   458  	for _, path := range fieldMask.GetPaths() {
   459  		if !removedSelectors[int(path.Selector())] {
   460  			result.Paths = append(result.Paths, path)
   461  		}
   462  	}
   463  
   464  	if len(result.Paths) == 0 {
   465  		return nil
   466  	}
   467  	return result
   468  }
   469  
   470  func (fieldMask *LogCondition_Internal_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   471  	return fieldMask.Subtract(other.(*LogCondition_Internal_FieldMask))
   472  }
   473  
   474  // FilterInputFields generates copy of field paths with output_only field paths removed
   475  func (fieldMask *LogCondition_Internal_FieldMask) FilterInputFields() *LogCondition_Internal_FieldMask {
   476  	result := &LogCondition_Internal_FieldMask{}
   477  	result.Paths = append(result.Paths, fieldMask.Paths...)
   478  	return result
   479  }
   480  
   481  // ToFieldMask is used for proto conversions
   482  func (fieldMask *LogCondition_Internal_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   483  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   484  	for _, path := range fieldMask.Paths {
   485  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   486  	}
   487  	return protoFieldMask
   488  }
   489  
   490  func (fieldMask *LogCondition_Internal_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   491  	if fieldMask == nil {
   492  		return status.Error(codes.Internal, "target field mask is nil")
   493  	}
   494  	fieldMask.Paths = make([]LogConditionInternal_FieldPath, 0, len(protoFieldMask.Paths))
   495  	for _, strPath := range protoFieldMask.Paths {
   496  		path, err := ParseLogConditionInternal_FieldPath(strPath)
   497  		if err != nil {
   498  			return err
   499  		}
   500  		fieldMask.Paths = append(fieldMask.Paths, path)
   501  	}
   502  	return nil
   503  }
   504  
   505  // implement methods required by customType
   506  func (fieldMask LogCondition_Internal_FieldMask) Marshal() ([]byte, error) {
   507  	protoFieldMask := fieldMask.ToProtoFieldMask()
   508  	return proto.Marshal(protoFieldMask)
   509  }
   510  
   511  func (fieldMask *LogCondition_Internal_FieldMask) Unmarshal(data []byte) error {
   512  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   513  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   514  		return err
   515  	}
   516  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   517  		return err
   518  	}
   519  	return nil
   520  }
   521  
   522  func (fieldMask *LogCondition_Internal_FieldMask) Size() int {
   523  	return proto.Size(fieldMask.ToProtoFieldMask())
   524  }
   525  
   526  func (fieldMask LogCondition_Internal_FieldMask) MarshalJSON() ([]byte, error) {
   527  	return json.Marshal(fieldMask.ToProtoFieldMask())
   528  }
   529  
   530  func (fieldMask *LogCondition_Internal_FieldMask) UnmarshalJSON(data []byte) error {
   531  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   532  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   533  		return err
   534  	}
   535  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   536  		return err
   537  	}
   538  	return nil
   539  }
   540  
   541  func (fieldMask *LogCondition_Internal_FieldMask) AppendPath(path LogConditionInternal_FieldPath) {
   542  	fieldMask.Paths = append(fieldMask.Paths, path)
   543  }
   544  
   545  func (fieldMask *LogCondition_Internal_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   546  	fieldMask.Paths = append(fieldMask.Paths, path.(LogConditionInternal_FieldPath))
   547  }
   548  
   549  func (fieldMask *LogCondition_Internal_FieldMask) GetPaths() []LogConditionInternal_FieldPath {
   550  	if fieldMask == nil {
   551  		return nil
   552  	}
   553  	return fieldMask.Paths
   554  }
   555  
   556  func (fieldMask *LogCondition_Internal_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   557  	if fieldMask == nil {
   558  		return nil
   559  	}
   560  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   561  	for _, path := range fieldMask.Paths {
   562  		rawPaths = append(rawPaths, path)
   563  	}
   564  	return rawPaths
   565  }
   566  
   567  func (fieldMask *LogCondition_Internal_FieldMask) SetFromCliFlag(raw string) error {
   568  	path, err := ParseLogConditionInternal_FieldPath(raw)
   569  	if err != nil {
   570  		return err
   571  	}
   572  	fieldMask.Paths = append(fieldMask.Paths, path)
   573  	return nil
   574  }
   575  
   576  func (fieldMask *LogCondition_Internal_FieldMask) Set(target, source *LogCondition_Internal) {
   577  	for _, path := range fieldMask.Paths {
   578  		val, _ := path.GetSingle(source)
   579  		// if val is nil, then field does not exist in source, skip
   580  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   581  		if val != nil {
   582  			path.WithIValue(val).SetTo(&target)
   583  		}
   584  	}
   585  }
   586  
   587  func (fieldMask *LogCondition_Internal_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   588  	fieldMask.Set(target.(*LogCondition_Internal), source.(*LogCondition_Internal))
   589  }
   590  
   591  func (fieldMask *LogCondition_Internal_FieldMask) Project(source *LogCondition_Internal) *LogCondition_Internal {
   592  	if source == nil {
   593  		return nil
   594  	}
   595  	if fieldMask == nil {
   596  		return source
   597  	}
   598  	result := &LogCondition_Internal{}
   599  
   600  	for _, p := range fieldMask.Paths {
   601  		switch tp := p.(type) {
   602  		case *LogConditionInternal_FieldTerminalPath:
   603  			switch tp.selector {
   604  			case LogConditionInternal_FieldPathSelectorAlertingLocation:
   605  				result.AlertingLocation = source.AlertingLocation
   606  			}
   607  		}
   608  	}
   609  	return result
   610  }
   611  
   612  func (fieldMask *LogCondition_Internal_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   613  	return fieldMask.Project(source.(*LogCondition_Internal))
   614  }
   615  
   616  func (fieldMask *LogCondition_Internal_FieldMask) PathsCount() int {
   617  	if fieldMask == nil {
   618  		return 0
   619  	}
   620  	return len(fieldMask.Paths)
   621  }
   622  
   623  type LogCondition_TemplateSource_FieldMask struct {
   624  	Paths []LogConditionTemplateSource_FieldPath
   625  }
   626  
   627  func FullLogCondition_TemplateSource_FieldMask() *LogCondition_TemplateSource_FieldMask {
   628  	res := &LogCondition_TemplateSource_FieldMask{}
   629  	res.Paths = append(res.Paths, &LogConditionTemplateSource_FieldTerminalPath{selector: LogConditionTemplateSource_FieldPathSelectorTemplate})
   630  	res.Paths = append(res.Paths, &LogConditionTemplateSource_FieldTerminalPath{selector: LogConditionTemplateSource_FieldPathSelectorUpdatedFields})
   631  	return res
   632  }
   633  
   634  func (fieldMask *LogCondition_TemplateSource_FieldMask) String() string {
   635  	if fieldMask == nil {
   636  		return "<nil>"
   637  	}
   638  	pathsStr := make([]string, 0, len(fieldMask.Paths))
   639  	for _, path := range fieldMask.Paths {
   640  		pathsStr = append(pathsStr, path.String())
   641  	}
   642  	return strings.Join(pathsStr, ", ")
   643  }
   644  
   645  func (fieldMask *LogCondition_TemplateSource_FieldMask) IsFull() bool {
   646  	if fieldMask == nil {
   647  		return false
   648  	}
   649  	presentSelectors := make([]bool, 2)
   650  	for _, path := range fieldMask.Paths {
   651  		if asFinal, ok := path.(*LogConditionTemplateSource_FieldTerminalPath); ok {
   652  			presentSelectors[int(asFinal.selector)] = true
   653  		}
   654  	}
   655  	for _, flag := range presentSelectors {
   656  		if !flag {
   657  			return false
   658  		}
   659  	}
   660  	return true
   661  }
   662  
   663  func (fieldMask *LogCondition_TemplateSource_FieldMask) ProtoReflect() preflect.Message {
   664  	return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) {
   665  		return ParseLogConditionTemplateSource_FieldPath(raw)
   666  	})
   667  }
   668  
   669  func (fieldMask *LogCondition_TemplateSource_FieldMask) ProtoMessage() {}
   670  
   671  func (fieldMask *LogCondition_TemplateSource_FieldMask) Reset() {
   672  	if fieldMask != nil {
   673  		fieldMask.Paths = nil
   674  	}
   675  }
   676  
   677  func (fieldMask *LogCondition_TemplateSource_FieldMask) Subtract(other *LogCondition_TemplateSource_FieldMask) *LogCondition_TemplateSource_FieldMask {
   678  	result := &LogCondition_TemplateSource_FieldMask{}
   679  	removedSelectors := make([]bool, 2)
   680  
   681  	for _, path := range other.GetPaths() {
   682  		switch tp := path.(type) {
   683  		case *LogConditionTemplateSource_FieldTerminalPath:
   684  			removedSelectors[int(tp.selector)] = true
   685  		}
   686  	}
   687  	for _, path := range fieldMask.GetPaths() {
   688  		if !removedSelectors[int(path.Selector())] {
   689  			result.Paths = append(result.Paths, path)
   690  		}
   691  	}
   692  
   693  	if len(result.Paths) == 0 {
   694  		return nil
   695  	}
   696  	return result
   697  }
   698  
   699  func (fieldMask *LogCondition_TemplateSource_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask {
   700  	return fieldMask.Subtract(other.(*LogCondition_TemplateSource_FieldMask))
   701  }
   702  
   703  // FilterInputFields generates copy of field paths with output_only field paths removed
   704  func (fieldMask *LogCondition_TemplateSource_FieldMask) FilterInputFields() *LogCondition_TemplateSource_FieldMask {
   705  	result := &LogCondition_TemplateSource_FieldMask{}
   706  	result.Paths = append(result.Paths, fieldMask.Paths...)
   707  	return result
   708  }
   709  
   710  // ToFieldMask is used for proto conversions
   711  func (fieldMask *LogCondition_TemplateSource_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask {
   712  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   713  	for _, path := range fieldMask.Paths {
   714  		protoFieldMask.Paths = append(protoFieldMask.Paths, path.String())
   715  	}
   716  	return protoFieldMask
   717  }
   718  
   719  func (fieldMask *LogCondition_TemplateSource_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error {
   720  	if fieldMask == nil {
   721  		return status.Error(codes.Internal, "target field mask is nil")
   722  	}
   723  	fieldMask.Paths = make([]LogConditionTemplateSource_FieldPath, 0, len(protoFieldMask.Paths))
   724  	for _, strPath := range protoFieldMask.Paths {
   725  		path, err := ParseLogConditionTemplateSource_FieldPath(strPath)
   726  		if err != nil {
   727  			return err
   728  		}
   729  		fieldMask.Paths = append(fieldMask.Paths, path)
   730  	}
   731  	return nil
   732  }
   733  
   734  // implement methods required by customType
   735  func (fieldMask LogCondition_TemplateSource_FieldMask) Marshal() ([]byte, error) {
   736  	protoFieldMask := fieldMask.ToProtoFieldMask()
   737  	return proto.Marshal(protoFieldMask)
   738  }
   739  
   740  func (fieldMask *LogCondition_TemplateSource_FieldMask) Unmarshal(data []byte) error {
   741  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   742  	if err := proto.Unmarshal(data, protoFieldMask); err != nil {
   743  		return err
   744  	}
   745  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   746  		return err
   747  	}
   748  	return nil
   749  }
   750  
   751  func (fieldMask *LogCondition_TemplateSource_FieldMask) Size() int {
   752  	return proto.Size(fieldMask.ToProtoFieldMask())
   753  }
   754  
   755  func (fieldMask LogCondition_TemplateSource_FieldMask) MarshalJSON() ([]byte, error) {
   756  	return json.Marshal(fieldMask.ToProtoFieldMask())
   757  }
   758  
   759  func (fieldMask *LogCondition_TemplateSource_FieldMask) UnmarshalJSON(data []byte) error {
   760  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
   761  	if err := json.Unmarshal(data, protoFieldMask); err != nil {
   762  		return err
   763  	}
   764  	if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil {
   765  		return err
   766  	}
   767  	return nil
   768  }
   769  
   770  func (fieldMask *LogCondition_TemplateSource_FieldMask) AppendPath(path LogConditionTemplateSource_FieldPath) {
   771  	fieldMask.Paths = append(fieldMask.Paths, path)
   772  }
   773  
   774  func (fieldMask *LogCondition_TemplateSource_FieldMask) AppendRawPath(path gotenobject.FieldPath) {
   775  	fieldMask.Paths = append(fieldMask.Paths, path.(LogConditionTemplateSource_FieldPath))
   776  }
   777  
   778  func (fieldMask *LogCondition_TemplateSource_FieldMask) GetPaths() []LogConditionTemplateSource_FieldPath {
   779  	if fieldMask == nil {
   780  		return nil
   781  	}
   782  	return fieldMask.Paths
   783  }
   784  
   785  func (fieldMask *LogCondition_TemplateSource_FieldMask) GetRawPaths() []gotenobject.FieldPath {
   786  	if fieldMask == nil {
   787  		return nil
   788  	}
   789  	rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths))
   790  	for _, path := range fieldMask.Paths {
   791  		rawPaths = append(rawPaths, path)
   792  	}
   793  	return rawPaths
   794  }
   795  
   796  func (fieldMask *LogCondition_TemplateSource_FieldMask) SetFromCliFlag(raw string) error {
   797  	path, err := ParseLogConditionTemplateSource_FieldPath(raw)
   798  	if err != nil {
   799  		return err
   800  	}
   801  	fieldMask.Paths = append(fieldMask.Paths, path)
   802  	return nil
   803  }
   804  
   805  func (fieldMask *LogCondition_TemplateSource_FieldMask) Set(target, source *LogCondition_TemplateSource) {
   806  	for _, path := range fieldMask.Paths {
   807  		val, _ := path.GetSingle(source)
   808  		// if val is nil, then field does not exist in source, skip
   809  		// otherwise, process (can still reflect.ValueOf(val).IsNil!)
   810  		if val != nil {
   811  			path.WithIValue(val).SetTo(&target)
   812  		}
   813  	}
   814  }
   815  
   816  func (fieldMask *LogCondition_TemplateSource_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) {
   817  	fieldMask.Set(target.(*LogCondition_TemplateSource), source.(*LogCondition_TemplateSource))
   818  }
   819  
   820  func (fieldMask *LogCondition_TemplateSource_FieldMask) Project(source *LogCondition_TemplateSource) *LogCondition_TemplateSource {
   821  	if source == nil {
   822  		return nil
   823  	}
   824  	if fieldMask == nil {
   825  		return source
   826  	}
   827  	result := &LogCondition_TemplateSource{}
   828  
   829  	for _, p := range fieldMask.Paths {
   830  		switch tp := p.(type) {
   831  		case *LogConditionTemplateSource_FieldTerminalPath:
   832  			switch tp.selector {
   833  			case LogConditionTemplateSource_FieldPathSelectorTemplate:
   834  				result.Template = source.Template
   835  			case LogConditionTemplateSource_FieldPathSelectorUpdatedFields:
   836  				result.UpdatedFields = source.UpdatedFields
   837  			}
   838  		}
   839  	}
   840  	return result
   841  }
   842  
   843  func (fieldMask *LogCondition_TemplateSource_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt {
   844  	return fieldMask.Project(source.(*LogCondition_TemplateSource))
   845  }
   846  
   847  func (fieldMask *LogCondition_TemplateSource_FieldMask) PathsCount() int {
   848  	if fieldMask == nil {
   849  		return 0
   850  	}
   851  	return len(fieldMask.Paths)
   852  }