github.com/cloudwan/edgelq-sdk@v1.15.4/monitoring/resources/v3/time_serie/time_serie.pb.object_ext.go (about)

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/monitoring/proto/v3/time_serie.proto
     3  // DO NOT EDIT!!!
     4  
     5  package time_serie
     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  	common "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/common"
    20  	metric_descriptor "github.com/cloudwan/edgelq-sdk/monitoring/resources/v3/metric_descriptor"
    21  )
    22  
    23  // ensure the imports are used
    24  var (
    25  	_ = new(fmt.Stringer)
    26  	_ = new(sort.Interface)
    27  
    28  	_ = new(proto.Message)
    29  	_ = googlefieldmaskpb.FieldMask{}
    30  
    31  	_ = new(gotenobject.FieldPath)
    32  )
    33  
    34  // make sure we're using proto imports
    35  var (
    36  	_ = &common.LabelDescriptor{}
    37  	_ = &metric_descriptor.MetricDescriptor{}
    38  )
    39  
    40  func (o *Point) GotenObjectExt() {}
    41  
    42  func (o *Point) MakeFullFieldMask() *Point_FieldMask {
    43  	return FullPoint_FieldMask()
    44  }
    45  
    46  func (o *Point) MakeRawFullFieldMask() gotenobject.FieldMask {
    47  	return FullPoint_FieldMask()
    48  }
    49  
    50  func (o *Point) MakeDiffFieldMask(other *Point) *Point_FieldMask {
    51  	if o == nil && other == nil {
    52  		return &Point_FieldMask{}
    53  	}
    54  	if o == nil || other == nil {
    55  		return FullPoint_FieldMask()
    56  	}
    57  
    58  	res := &Point_FieldMask{}
    59  	{
    60  		subMask := o.GetInterval().MakeDiffFieldMask(other.GetInterval())
    61  		if subMask.IsFull() {
    62  			res.Paths = append(res.Paths, &Point_FieldTerminalPath{selector: Point_FieldPathSelectorInterval})
    63  		} else {
    64  			for _, subpath := range subMask.Paths {
    65  				res.Paths = append(res.Paths, &Point_FieldSubPath{selector: Point_FieldPathSelectorInterval, subPath: subpath})
    66  			}
    67  		}
    68  	}
    69  	{
    70  		subMask := o.GetValue().MakeDiffFieldMask(other.GetValue())
    71  		if subMask.IsFull() {
    72  			res.Paths = append(res.Paths, &Point_FieldTerminalPath{selector: Point_FieldPathSelectorValue})
    73  		} else {
    74  			for _, subpath := range subMask.Paths {
    75  				res.Paths = append(res.Paths, &Point_FieldSubPath{selector: Point_FieldPathSelectorValue, subPath: subpath})
    76  			}
    77  		}
    78  	}
    79  	{
    80  		subMask := o.GetAggregation().MakeDiffFieldMask(other.GetAggregation())
    81  		if subMask.IsFull() {
    82  			res.Paths = append(res.Paths, &Point_FieldTerminalPath{selector: Point_FieldPathSelectorAggregation})
    83  		} else {
    84  			for _, subpath := range subMask.Paths {
    85  				res.Paths = append(res.Paths, &Point_FieldSubPath{selector: Point_FieldPathSelectorAggregation, subPath: subpath})
    86  			}
    87  		}
    88  	}
    89  	return res
    90  }
    91  
    92  func (o *Point) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
    93  	return o.MakeDiffFieldMask(other.(*Point))
    94  }
    95  
    96  func (o *Point) Clone() *Point {
    97  	if o == nil {
    98  		return nil
    99  	}
   100  	result := &Point{}
   101  	result.Interval = o.Interval.Clone()
   102  	result.Value = o.Value.Clone()
   103  	result.Aggregation = o.Aggregation.Clone()
   104  	return result
   105  }
   106  
   107  func (o *Point) CloneRaw() gotenobject.GotenObjectExt {
   108  	return o.Clone()
   109  }
   110  
   111  func (o *Point) Merge(source *Point) {
   112  	if source.GetInterval() != nil {
   113  		if o.Interval == nil {
   114  			o.Interval = new(common.TimeInterval)
   115  		}
   116  		o.Interval.Merge(source.GetInterval())
   117  	}
   118  	if source.GetValue() != nil {
   119  		if o.Value == nil {
   120  			o.Value = new(common.TypedValue)
   121  		}
   122  		o.Value.Merge(source.GetValue())
   123  	}
   124  	if source.GetAggregation() != nil {
   125  		if o.Aggregation == nil {
   126  			o.Aggregation = new(common.Aggregation)
   127  		}
   128  		o.Aggregation.Merge(source.GetAggregation())
   129  	}
   130  }
   131  
   132  func (o *Point) MergeRaw(source gotenobject.GotenObjectExt) {
   133  	o.Merge(source.(*Point))
   134  }
   135  
   136  func (o *TimeSerie) GotenObjectExt() {}
   137  
   138  func (o *TimeSerie) MakeFullFieldMask() *TimeSerie_FieldMask {
   139  	return FullTimeSerie_FieldMask()
   140  }
   141  
   142  func (o *TimeSerie) MakeRawFullFieldMask() gotenobject.FieldMask {
   143  	return FullTimeSerie_FieldMask()
   144  }
   145  
   146  func (o *TimeSerie) MakeDiffFieldMask(other *TimeSerie) *TimeSerie_FieldMask {
   147  	if o == nil && other == nil {
   148  		return &TimeSerie_FieldMask{}
   149  	}
   150  	if o == nil || other == nil {
   151  		return FullTimeSerie_FieldMask()
   152  	}
   153  
   154  	res := &TimeSerie_FieldMask{}
   155  	if string(o.GetKey()) != string(other.GetKey()) {
   156  		res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorKey})
   157  	}
   158  	if o.GetProject() != other.GetProject() {
   159  		res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorProject})
   160  	}
   161  	if o.GetRegion() != other.GetRegion() {
   162  		res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorRegion})
   163  	}
   164  	{
   165  		subMask := o.GetMetric().MakeDiffFieldMask(other.GetMetric())
   166  		if subMask.IsFull() {
   167  			res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorMetric})
   168  		} else {
   169  			for _, subpath := range subMask.Paths {
   170  				res.Paths = append(res.Paths, &TimeSerie_FieldSubPath{selector: TimeSerie_FieldPathSelectorMetric, subPath: subpath})
   171  			}
   172  		}
   173  	}
   174  	{
   175  		subMask := o.GetResource().MakeDiffFieldMask(other.GetResource())
   176  		if subMask.IsFull() {
   177  			res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorResource})
   178  		} else {
   179  			for _, subpath := range subMask.Paths {
   180  				res.Paths = append(res.Paths, &TimeSerie_FieldSubPath{selector: TimeSerie_FieldPathSelectorResource, subPath: subpath})
   181  			}
   182  		}
   183  	}
   184  	if o.GetMetricKind() != other.GetMetricKind() {
   185  		res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorMetricKind})
   186  	}
   187  	if o.GetValueType() != other.GetValueType() {
   188  		res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorValueType})
   189  	}
   190  
   191  	if len(o.GetPoints()) == len(other.GetPoints()) {
   192  		for i, lValue := range o.GetPoints() {
   193  			rValue := other.GetPoints()[i]
   194  			if len(lValue.MakeDiffFieldMask(rValue).Paths) > 0 {
   195  				res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorPoints})
   196  				break
   197  			}
   198  		}
   199  	} else {
   200  		res.Paths = append(res.Paths, &TimeSerie_FieldTerminalPath{selector: TimeSerie_FieldPathSelectorPoints})
   201  	}
   202  	return res
   203  }
   204  
   205  func (o *TimeSerie) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   206  	return o.MakeDiffFieldMask(other.(*TimeSerie))
   207  }
   208  
   209  func (o *TimeSerie) Clone() *TimeSerie {
   210  	if o == nil {
   211  		return nil
   212  	}
   213  	result := &TimeSerie{}
   214  	result.Key = make([]byte, len(o.Key))
   215  	for i, bt := range o.Key {
   216  		result.Key[i] = bt
   217  	}
   218  	result.Project = o.Project
   219  	result.Region = o.Region
   220  	result.Metric = o.Metric.Clone()
   221  	result.Resource = o.Resource.Clone()
   222  	result.MetricKind = o.MetricKind
   223  	result.ValueType = o.ValueType
   224  	result.Points = make([]*Point, len(o.Points))
   225  	for i, sourceValue := range o.Points {
   226  		result.Points[i] = sourceValue.Clone()
   227  	}
   228  	return result
   229  }
   230  
   231  func (o *TimeSerie) CloneRaw() gotenobject.GotenObjectExt {
   232  	return o.Clone()
   233  }
   234  
   235  func (o *TimeSerie) Merge(source *TimeSerie) {
   236  	o.Key = make([]byte, len(source.GetKey()))
   237  	for i, bt := range source.GetKey() {
   238  		o.Key[i] = bt
   239  	}
   240  	o.Project = source.GetProject()
   241  	o.Region = source.GetRegion()
   242  	if source.GetMetric() != nil {
   243  		if o.Metric == nil {
   244  			o.Metric = new(common.Metric)
   245  		}
   246  		o.Metric.Merge(source.GetMetric())
   247  	}
   248  	if source.GetResource() != nil {
   249  		if o.Resource == nil {
   250  			o.Resource = new(common.MonitoredResource)
   251  		}
   252  		o.Resource.Merge(source.GetResource())
   253  	}
   254  	o.MetricKind = source.GetMetricKind()
   255  	o.ValueType = source.GetValueType()
   256  	for _, sourceValue := range source.GetPoints() {
   257  		exists := false
   258  		for _, currentValue := range o.Points {
   259  			if proto.Equal(sourceValue, currentValue) {
   260  				exists = true
   261  				break
   262  			}
   263  		}
   264  		if !exists {
   265  			var newDstElement *Point
   266  			if sourceValue != nil {
   267  				newDstElement = new(Point)
   268  				newDstElement.Merge(sourceValue)
   269  			}
   270  			o.Points = append(o.Points, newDstElement)
   271  		}
   272  	}
   273  
   274  }
   275  
   276  func (o *TimeSerie) MergeRaw(source gotenobject.GotenObjectExt) {
   277  	o.Merge(source.(*TimeSerie))
   278  }
   279  
   280  func (o *BulkTimeSeries) GotenObjectExt() {}
   281  
   282  func (o *BulkTimeSeries) MakeFullFieldMask() *BulkTimeSeries_FieldMask {
   283  	return FullBulkTimeSeries_FieldMask()
   284  }
   285  
   286  func (o *BulkTimeSeries) MakeRawFullFieldMask() gotenobject.FieldMask {
   287  	return FullBulkTimeSeries_FieldMask()
   288  }
   289  
   290  func (o *BulkTimeSeries) MakeDiffFieldMask(other *BulkTimeSeries) *BulkTimeSeries_FieldMask {
   291  	if o == nil && other == nil {
   292  		return &BulkTimeSeries_FieldMask{}
   293  	}
   294  	if o == nil || other == nil {
   295  		return FullBulkTimeSeries_FieldMask()
   296  	}
   297  
   298  	res := &BulkTimeSeries_FieldMask{}
   299  
   300  	if len(o.GetTimeSeries()) == len(other.GetTimeSeries()) {
   301  		for i, lValue := range o.GetTimeSeries() {
   302  			rValue := other.GetTimeSeries()[i]
   303  			if len(lValue.MakeDiffFieldMask(rValue).Paths) > 0 {
   304  				res.Paths = append(res.Paths, &BulkTimeSeries_FieldTerminalPath{selector: BulkTimeSeries_FieldPathSelectorTimeSeries})
   305  				break
   306  			}
   307  		}
   308  	} else {
   309  		res.Paths = append(res.Paths, &BulkTimeSeries_FieldTerminalPath{selector: BulkTimeSeries_FieldPathSelectorTimeSeries})
   310  	}
   311  	if o.GetPhantomFlag() != other.GetPhantomFlag() {
   312  		res.Paths = append(res.Paths, &BulkTimeSeries_FieldTerminalPath{selector: BulkTimeSeries_FieldPathSelectorPhantomFlag})
   313  	}
   314  	return res
   315  }
   316  
   317  func (o *BulkTimeSeries) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   318  	return o.MakeDiffFieldMask(other.(*BulkTimeSeries))
   319  }
   320  
   321  func (o *BulkTimeSeries) Clone() *BulkTimeSeries {
   322  	if o == nil {
   323  		return nil
   324  	}
   325  	result := &BulkTimeSeries{}
   326  	result.TimeSeries = make([]*TimeSerie, len(o.TimeSeries))
   327  	for i, sourceValue := range o.TimeSeries {
   328  		result.TimeSeries[i] = sourceValue.Clone()
   329  	}
   330  	result.PhantomFlag = o.PhantomFlag
   331  	return result
   332  }
   333  
   334  func (o *BulkTimeSeries) CloneRaw() gotenobject.GotenObjectExt {
   335  	return o.Clone()
   336  }
   337  
   338  func (o *BulkTimeSeries) Merge(source *BulkTimeSeries) {
   339  	for _, sourceValue := range source.GetTimeSeries() {
   340  		exists := false
   341  		for _, currentValue := range o.TimeSeries {
   342  			if proto.Equal(sourceValue, currentValue) {
   343  				exists = true
   344  				break
   345  			}
   346  		}
   347  		if !exists {
   348  			var newDstElement *TimeSerie
   349  			if sourceValue != nil {
   350  				newDstElement = new(TimeSerie)
   351  				newDstElement.Merge(sourceValue)
   352  			}
   353  			o.TimeSeries = append(o.TimeSeries, newDstElement)
   354  		}
   355  	}
   356  
   357  	o.PhantomFlag = source.GetPhantomFlag()
   358  }
   359  
   360  func (o *BulkTimeSeries) MergeRaw(source gotenobject.GotenObjectExt) {
   361  	o.Merge(source.(*BulkTimeSeries))
   362  }