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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1/group.proto
     3  // DO NOT EDIT!!!
     4  
     5  package group
     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  	organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization"
    20  	project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    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  	_ = &organization.Organization{}
    39  	_ = &project.Project{}
    40  	_ = &meta_service.Service{}
    41  	_ = &meta.Meta{}
    42  )
    43  
    44  func (o *Group) GotenObjectExt() {}
    45  
    46  func (o *Group) MakeFullFieldMask() *Group_FieldMask {
    47  	return FullGroup_FieldMask()
    48  }
    49  
    50  func (o *Group) MakeRawFullFieldMask() gotenobject.FieldMask {
    51  	return FullGroup_FieldMask()
    52  }
    53  
    54  func (o *Group) MakeDiffFieldMask(other *Group) *Group_FieldMask {
    55  	if o == nil && other == nil {
    56  		return &Group_FieldMask{}
    57  	}
    58  	if o == nil || other == nil {
    59  		return FullGroup_FieldMask()
    60  	}
    61  
    62  	res := &Group_FieldMask{}
    63  	if o.GetName().String() != other.GetName().String() {
    64  		res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorName})
    65  	}
    66  	{
    67  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    68  		if subMask.IsFull() {
    69  			res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorMetadata})
    70  		} else {
    71  			for _, subpath := range subMask.Paths {
    72  				res.Paths = append(res.Paths, &Group_FieldSubPath{selector: Group_FieldPathSelectorMetadata, subPath: subpath})
    73  			}
    74  		}
    75  	}
    76  	if o.GetDisplayName() != other.GetDisplayName() {
    77  		res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorDisplayName})
    78  	}
    79  	if o.GetDescription() != other.GetDescription() {
    80  		res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorDescription})
    81  	}
    82  	if o.GetEmail() != other.GetEmail() {
    83  		res.Paths = append(res.Paths, &Group_FieldTerminalPath{selector: Group_FieldPathSelectorEmail})
    84  	}
    85  	return res
    86  }
    87  
    88  func (o *Group) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
    89  	return o.MakeDiffFieldMask(other.(*Group))
    90  }
    91  
    92  func (o *Group) Clone() *Group {
    93  	if o == nil {
    94  		return nil
    95  	}
    96  	result := &Group{}
    97  	if o.Name == nil {
    98  		result.Name = nil
    99  	} else if data, err := o.Name.ProtoString(); err != nil {
   100  		panic(err)
   101  	} else {
   102  		result.Name = &Name{}
   103  		if err := result.Name.ParseProtoString(data); err != nil {
   104  			panic(err)
   105  		}
   106  	}
   107  	result.Metadata = o.Metadata.Clone()
   108  	result.DisplayName = o.DisplayName
   109  	result.Description = o.Description
   110  	result.Email = o.Email
   111  	return result
   112  }
   113  
   114  func (o *Group) CloneRaw() gotenobject.GotenObjectExt {
   115  	return o.Clone()
   116  }
   117  
   118  func (o *Group) Merge(source *Group) {
   119  	if source.GetName() != nil {
   120  		if data, err := source.GetName().ProtoString(); err != nil {
   121  			panic(err)
   122  		} else {
   123  			o.Name = &Name{}
   124  			if err := o.Name.ParseProtoString(data); err != nil {
   125  				panic(err)
   126  			}
   127  		}
   128  	} else {
   129  		o.Name = nil
   130  	}
   131  	if source.GetMetadata() != nil {
   132  		if o.Metadata == nil {
   133  			o.Metadata = new(meta.Meta)
   134  		}
   135  		o.Metadata.Merge(source.GetMetadata())
   136  	}
   137  	o.DisplayName = source.GetDisplayName()
   138  	o.Description = source.GetDescription()
   139  	o.Email = source.GetEmail()
   140  }
   141  
   142  func (o *Group) MergeRaw(source gotenobject.GotenObjectExt) {
   143  	o.Merge(source.(*Group))
   144  }