github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v4/notification_channel/notification_channel.pb.fieldmask.go (about)

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