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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/alerting/proto/v1/notification_channel.proto
     3  // DO NOT EDIT!!!
     4  
     5  package notification_channel
     6  
     7  import (
     8  	"fmt"
     9  	"sort"
    10  
    11  	"google.golang.org/protobuf/proto"
    12  	googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    13  
    14  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    15  )
    16  
    17  // proto imports
    18  import (
    19  	rcommon "github.com/cloudwan/edgelq-sdk/alerting/resources/v1/common"
    20  	iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    21  	meta "github.com/cloudwan/goten-sdk/types/meta"
    22  	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
    23  )
    24  
    25  // ensure the imports are used
    26  var (
    27  	_ = new(fmt.Stringer)
    28  	_ = new(sort.Interface)
    29  
    30  	_ = new(proto.Message)
    31  	_ = googlefieldmaskpb.FieldMask{}
    32  
    33  	_ = new(gotenobject.FieldPath)
    34  )
    35  
    36  // make sure we're using proto imports
    37  var (
    38  	_ = &rcommon.LogCndSpec{}
    39  	_ = &iam_project.Project{}
    40  	_ = &timestamppb.Timestamp{}
    41  	_ = &meta.Meta{}
    42  )
    43  
    44  func (o *NotificationChannel) GotenObjectExt() {}
    45  
    46  func (o *NotificationChannel) MakeFullFieldMask() *NotificationChannel_FieldMask {
    47  	return FullNotificationChannel_FieldMask()
    48  }
    49  
    50  func (o *NotificationChannel) MakeRawFullFieldMask() gotenobject.FieldMask {
    51  	return FullNotificationChannel_FieldMask()
    52  }
    53  
    54  func (o *NotificationChannel) MakeDiffFieldMask(other *NotificationChannel) *NotificationChannel_FieldMask {
    55  	if o == nil && other == nil {
    56  		return &NotificationChannel_FieldMask{}
    57  	}
    58  	if o == nil || other == nil {
    59  		return FullNotificationChannel_FieldMask()
    60  	}
    61  
    62  	res := &NotificationChannel_FieldMask{}
    63  	if o.GetName().String() != other.GetName().String() {
    64  		res.Paths = append(res.Paths, &NotificationChannel_FieldTerminalPath{selector: NotificationChannel_FieldPathSelectorName})
    65  	}
    66  	{
    67  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    68  		if subMask.IsFull() {
    69  			res.Paths = append(res.Paths, &NotificationChannel_FieldTerminalPath{selector: NotificationChannel_FieldPathSelectorMetadata})
    70  		} else {
    71  			for _, subpath := range subMask.Paths {
    72  				res.Paths = append(res.Paths, &NotificationChannel_FieldSubPath{selector: NotificationChannel_FieldPathSelectorMetadata, subPath: subpath})
    73  			}
    74  		}
    75  	}
    76  	if o.GetDisplayName() != other.GetDisplayName() {
    77  		res.Paths = append(res.Paths, &NotificationChannel_FieldTerminalPath{selector: NotificationChannel_FieldPathSelectorDisplayName})
    78  	}
    79  	if o.GetDescription() != other.GetDescription() {
    80  		res.Paths = append(res.Paths, &NotificationChannel_FieldTerminalPath{selector: NotificationChannel_FieldPathSelectorDescription})
    81  	}
    82  	{
    83  		subMask := o.GetSpec().MakeDiffFieldMask(other.GetSpec())
    84  		if subMask.IsFull() {
    85  			res.Paths = append(res.Paths, &NotificationChannel_FieldTerminalPath{selector: NotificationChannel_FieldPathSelectorSpec})
    86  		} else {
    87  			for _, subpath := range subMask.Paths {
    88  				res.Paths = append(res.Paths, &NotificationChannel_FieldSubPath{selector: NotificationChannel_FieldPathSelectorSpec, subPath: subpath})
    89  			}
    90  		}
    91  	}
    92  	{
    93  		subMask := o.GetState().MakeDiffFieldMask(other.GetState())
    94  		if subMask.IsFull() {
    95  			res.Paths = append(res.Paths, &NotificationChannel_FieldTerminalPath{selector: NotificationChannel_FieldPathSelectorState})
    96  		} else {
    97  			for _, subpath := range subMask.Paths {
    98  				res.Paths = append(res.Paths, &NotificationChannel_FieldSubPath{selector: NotificationChannel_FieldPathSelectorState, subPath: subpath})
    99  			}
   100  		}
   101  	}
   102  	return res
   103  }
   104  
   105  func (o *NotificationChannel) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   106  	return o.MakeDiffFieldMask(other.(*NotificationChannel))
   107  }
   108  
   109  func (o *NotificationChannel) Clone() *NotificationChannel {
   110  	if o == nil {
   111  		return nil
   112  	}
   113  	result := &NotificationChannel{}
   114  	if o.Name == nil {
   115  		result.Name = nil
   116  	} else if data, err := o.Name.ProtoString(); err != nil {
   117  		panic(err)
   118  	} else {
   119  		result.Name = &Name{}
   120  		if err := result.Name.ParseProtoString(data); err != nil {
   121  			panic(err)
   122  		}
   123  	}
   124  	result.Metadata = o.Metadata.Clone()
   125  	result.DisplayName = o.DisplayName
   126  	result.Description = o.Description
   127  	result.Spec = o.Spec.Clone()
   128  	result.State = o.State.Clone()
   129  	return result
   130  }
   131  
   132  func (o *NotificationChannel) CloneRaw() gotenobject.GotenObjectExt {
   133  	return o.Clone()
   134  }
   135  
   136  func (o *NotificationChannel) Merge(source *NotificationChannel) {
   137  	if source.GetName() != nil {
   138  		if data, err := source.GetName().ProtoString(); err != nil {
   139  			panic(err)
   140  		} else {
   141  			o.Name = &Name{}
   142  			if err := o.Name.ParseProtoString(data); err != nil {
   143  				panic(err)
   144  			}
   145  		}
   146  	} else {
   147  		o.Name = nil
   148  	}
   149  	if source.GetMetadata() != nil {
   150  		if o.Metadata == nil {
   151  			o.Metadata = new(meta.Meta)
   152  		}
   153  		o.Metadata.Merge(source.GetMetadata())
   154  	}
   155  	o.DisplayName = source.GetDisplayName()
   156  	o.Description = source.GetDescription()
   157  	if source.GetSpec() != nil {
   158  		if o.Spec == nil {
   159  			o.Spec = new(rcommon.NotificationChannelSpec)
   160  		}
   161  		o.Spec.Merge(source.GetSpec())
   162  	}
   163  	if source.GetState() != nil {
   164  		if o.State == nil {
   165  			o.State = new(NotificationChannel_State)
   166  		}
   167  		o.State.Merge(source.GetState())
   168  	}
   169  }
   170  
   171  func (o *NotificationChannel) MergeRaw(source gotenobject.GotenObjectExt) {
   172  	o.Merge(source.(*NotificationChannel))
   173  }
   174  
   175  func (o *NotificationChannel_State) GotenObjectExt() {}
   176  
   177  func (o *NotificationChannel_State) MakeFullFieldMask() *NotificationChannel_State_FieldMask {
   178  	return FullNotificationChannel_State_FieldMask()
   179  }
   180  
   181  func (o *NotificationChannel_State) MakeRawFullFieldMask() gotenobject.FieldMask {
   182  	return FullNotificationChannel_State_FieldMask()
   183  }
   184  
   185  func (o *NotificationChannel_State) MakeDiffFieldMask(other *NotificationChannel_State) *NotificationChannel_State_FieldMask {
   186  	if o == nil && other == nil {
   187  		return &NotificationChannel_State_FieldMask{}
   188  	}
   189  	if o == nil || other == nil {
   190  		return FullNotificationChannel_State_FieldMask()
   191  	}
   192  
   193  	res := &NotificationChannel_State_FieldMask{}
   194  	if o.GetStatus() != other.GetStatus() {
   195  		res.Paths = append(res.Paths, &NotificationChannelState_FieldTerminalPath{selector: NotificationChannelState_FieldPathSelectorStatus})
   196  	}
   197  	{
   198  		subMask := o.GetError().MakeDiffFieldMask(other.GetError())
   199  		if subMask.IsFull() {
   200  			res.Paths = append(res.Paths, &NotificationChannelState_FieldTerminalPath{selector: NotificationChannelState_FieldPathSelectorError})
   201  		} else {
   202  			for _, subpath := range subMask.Paths {
   203  				res.Paths = append(res.Paths, &NotificationChannelState_FieldSubPath{selector: NotificationChannelState_FieldPathSelectorError, subPath: subpath})
   204  			}
   205  		}
   206  	}
   207  	return res
   208  }
   209  
   210  func (o *NotificationChannel_State) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   211  	return o.MakeDiffFieldMask(other.(*NotificationChannel_State))
   212  }
   213  
   214  func (o *NotificationChannel_State) Clone() *NotificationChannel_State {
   215  	if o == nil {
   216  		return nil
   217  	}
   218  	result := &NotificationChannel_State{}
   219  	result.Status = o.Status
   220  	result.Error = o.Error.Clone()
   221  	return result
   222  }
   223  
   224  func (o *NotificationChannel_State) CloneRaw() gotenobject.GotenObjectExt {
   225  	return o.Clone()
   226  }
   227  
   228  func (o *NotificationChannel_State) Merge(source *NotificationChannel_State) {
   229  	o.Status = source.GetStatus()
   230  	if source.GetError() != nil {
   231  		if o.Error == nil {
   232  			o.Error = new(NotificationChannel_State_Error)
   233  		}
   234  		o.Error.Merge(source.GetError())
   235  	}
   236  }
   237  
   238  func (o *NotificationChannel_State) MergeRaw(source gotenobject.GotenObjectExt) {
   239  	o.Merge(source.(*NotificationChannel_State))
   240  }
   241  
   242  func (o *NotificationChannel_State_Error) GotenObjectExt() {}
   243  
   244  func (o *NotificationChannel_State_Error) MakeFullFieldMask() *NotificationChannel_State_Error_FieldMask {
   245  	return FullNotificationChannel_State_Error_FieldMask()
   246  }
   247  
   248  func (o *NotificationChannel_State_Error) MakeRawFullFieldMask() gotenobject.FieldMask {
   249  	return FullNotificationChannel_State_Error_FieldMask()
   250  }
   251  
   252  func (o *NotificationChannel_State_Error) MakeDiffFieldMask(other *NotificationChannel_State_Error) *NotificationChannel_State_Error_FieldMask {
   253  	if o == nil && other == nil {
   254  		return &NotificationChannel_State_Error_FieldMask{}
   255  	}
   256  	if o == nil || other == nil {
   257  		return FullNotificationChannel_State_Error_FieldMask()
   258  	}
   259  
   260  	res := &NotificationChannel_State_Error_FieldMask{}
   261  	if !proto.Equal(o.GetTime(), other.GetTime()) {
   262  		res.Paths = append(res.Paths, &NotificationChannelStateError_FieldTerminalPath{selector: NotificationChannelStateError_FieldPathSelectorTime})
   263  	}
   264  	if o.GetMessage() != other.GetMessage() {
   265  		res.Paths = append(res.Paths, &NotificationChannelStateError_FieldTerminalPath{selector: NotificationChannelStateError_FieldPathSelectorMessage})
   266  	}
   267  	return res
   268  }
   269  
   270  func (o *NotificationChannel_State_Error) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   271  	return o.MakeDiffFieldMask(other.(*NotificationChannel_State_Error))
   272  }
   273  
   274  func (o *NotificationChannel_State_Error) Clone() *NotificationChannel_State_Error {
   275  	if o == nil {
   276  		return nil
   277  	}
   278  	result := &NotificationChannel_State_Error{}
   279  	result.Time = proto.Clone(o.Time).(*timestamppb.Timestamp)
   280  	result.Message = o.Message
   281  	return result
   282  }
   283  
   284  func (o *NotificationChannel_State_Error) CloneRaw() gotenobject.GotenObjectExt {
   285  	return o.Clone()
   286  }
   287  
   288  func (o *NotificationChannel_State_Error) Merge(source *NotificationChannel_State_Error) {
   289  	if source.GetTime() != nil {
   290  		if o.Time == nil {
   291  			o.Time = new(timestamppb.Timestamp)
   292  		}
   293  		proto.Merge(o.Time, source.GetTime())
   294  	}
   295  	o.Message = source.GetMessage()
   296  }
   297  
   298  func (o *NotificationChannel_State_Error) MergeRaw(source gotenobject.GotenObjectExt) {
   299  	o.Merge(source.(*NotificationChannel_State_Error))
   300  }