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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/limits/proto/v1/limit_pool.proto
     3  // DO NOT EDIT!!!
     4  
     5  package limit_pool
     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  	iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization"
    20  	meta_resource "github.com/cloudwan/goten-sdk/meta-service/resources/v1/resource"
    21  	meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service"
    22  	meta "github.com/cloudwan/goten-sdk/types/meta"
    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  	_ = &iam_organization.Organization{}
    39  	_ = &meta_resource.Resource{}
    40  	_ = &meta_service.Service{}
    41  	_ = &meta.Meta{}
    42  )
    43  
    44  func (o *LimitPool) GotenObjectExt() {}
    45  
    46  func (o *LimitPool) MakeFullFieldMask() *LimitPool_FieldMask {
    47  	return FullLimitPool_FieldMask()
    48  }
    49  
    50  func (o *LimitPool) MakeRawFullFieldMask() gotenobject.FieldMask {
    51  	return FullLimitPool_FieldMask()
    52  }
    53  
    54  func (o *LimitPool) MakeDiffFieldMask(other *LimitPool) *LimitPool_FieldMask {
    55  	if o == nil && other == nil {
    56  		return &LimitPool_FieldMask{}
    57  	}
    58  	if o == nil || other == nil {
    59  		return FullLimitPool_FieldMask()
    60  	}
    61  
    62  	res := &LimitPool_FieldMask{}
    63  	if o.GetName().String() != other.GetName().String() {
    64  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorName})
    65  	}
    66  	{
    67  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    68  		if subMask.IsFull() {
    69  			res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorMetadata})
    70  		} else {
    71  			for _, subpath := range subMask.Paths {
    72  				res.Paths = append(res.Paths, &LimitPool_FieldSubPath{selector: LimitPool_FieldPathSelectorMetadata, subPath: subpath})
    73  			}
    74  		}
    75  	}
    76  	if o.GetService().String() != other.GetService().String() {
    77  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorService})
    78  	}
    79  	if o.GetResource().String() != other.GetResource().String() {
    80  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorResource})
    81  	}
    82  	if o.GetRegion() != other.GetRegion() {
    83  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorRegion})
    84  	}
    85  	if o.GetConfiguredSize() != other.GetConfiguredSize() {
    86  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorConfiguredSize})
    87  	}
    88  	if o.GetActiveSize() != other.GetActiveSize() {
    89  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorActiveSize})
    90  	}
    91  	if o.GetReserved() != other.GetReserved() {
    92  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorReserved})
    93  	}
    94  	if o.GetSource().String() != other.GetSource().String() {
    95  		res.Paths = append(res.Paths, &LimitPool_FieldTerminalPath{selector: LimitPool_FieldPathSelectorSource})
    96  	}
    97  	return res
    98  }
    99  
   100  func (o *LimitPool) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   101  	return o.MakeDiffFieldMask(other.(*LimitPool))
   102  }
   103  
   104  func (o *LimitPool) Clone() *LimitPool {
   105  	if o == nil {
   106  		return nil
   107  	}
   108  	result := &LimitPool{}
   109  	if o.Name == nil {
   110  		result.Name = nil
   111  	} else if data, err := o.Name.ProtoString(); err != nil {
   112  		panic(err)
   113  	} else {
   114  		result.Name = &Name{}
   115  		if err := result.Name.ParseProtoString(data); err != nil {
   116  			panic(err)
   117  		}
   118  	}
   119  	result.Metadata = o.Metadata.Clone()
   120  	if o.Service == nil {
   121  		result.Service = nil
   122  	} else if data, err := o.Service.ProtoString(); err != nil {
   123  		panic(err)
   124  	} else {
   125  		result.Service = &meta_service.Reference{}
   126  		if err := result.Service.ParseProtoString(data); err != nil {
   127  			panic(err)
   128  		}
   129  	}
   130  	if o.Resource == nil {
   131  		result.Resource = nil
   132  	} else if data, err := o.Resource.ProtoString(); err != nil {
   133  		panic(err)
   134  	} else {
   135  		result.Resource = &meta_resource.Reference{}
   136  		if err := result.Resource.ParseProtoString(data); err != nil {
   137  			panic(err)
   138  		}
   139  	}
   140  	result.Region = o.Region
   141  	result.ConfiguredSize = o.ConfiguredSize
   142  	result.ActiveSize = o.ActiveSize
   143  	result.Reserved = o.Reserved
   144  	if o.Source == nil {
   145  		result.Source = nil
   146  	} else if data, err := o.Source.ProtoString(); err != nil {
   147  		panic(err)
   148  	} else {
   149  		result.Source = &Reference{}
   150  		if err := result.Source.ParseProtoString(data); err != nil {
   151  			panic(err)
   152  		}
   153  	}
   154  	return result
   155  }
   156  
   157  func (o *LimitPool) CloneRaw() gotenobject.GotenObjectExt {
   158  	return o.Clone()
   159  }
   160  
   161  func (o *LimitPool) Merge(source *LimitPool) {
   162  	if source.GetName() != nil {
   163  		if data, err := source.GetName().ProtoString(); err != nil {
   164  			panic(err)
   165  		} else {
   166  			o.Name = &Name{}
   167  			if err := o.Name.ParseProtoString(data); err != nil {
   168  				panic(err)
   169  			}
   170  		}
   171  	} else {
   172  		o.Name = nil
   173  	}
   174  	if source.GetMetadata() != nil {
   175  		if o.Metadata == nil {
   176  			o.Metadata = new(meta.Meta)
   177  		}
   178  		o.Metadata.Merge(source.GetMetadata())
   179  	}
   180  	if source.GetService() != nil {
   181  		if data, err := source.GetService().ProtoString(); err != nil {
   182  			panic(err)
   183  		} else {
   184  			o.Service = &meta_service.Reference{}
   185  			if err := o.Service.ParseProtoString(data); err != nil {
   186  				panic(err)
   187  			}
   188  		}
   189  	} else {
   190  		o.Service = nil
   191  	}
   192  	if source.GetResource() != nil {
   193  		if data, err := source.GetResource().ProtoString(); err != nil {
   194  			panic(err)
   195  		} else {
   196  			o.Resource = &meta_resource.Reference{}
   197  			if err := o.Resource.ParseProtoString(data); err != nil {
   198  				panic(err)
   199  			}
   200  		}
   201  	} else {
   202  		o.Resource = nil
   203  	}
   204  	o.Region = source.GetRegion()
   205  	o.ConfiguredSize = source.GetConfiguredSize()
   206  	o.ActiveSize = source.GetActiveSize()
   207  	o.Reserved = source.GetReserved()
   208  	if source.GetSource() != nil {
   209  		if data, err := source.GetSource().ProtoString(); err != nil {
   210  			panic(err)
   211  		} else {
   212  			o.Source = &Reference{}
   213  			if err := o.Source.ParseProtoString(data); err != nil {
   214  				panic(err)
   215  			}
   216  		}
   217  	} else {
   218  		o.Source = nil
   219  	}
   220  }
   221  
   222  func (o *LimitPool) MergeRaw(source gotenobject.GotenObjectExt) {
   223  	o.Merge(source.(*LimitPool))
   224  }