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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1alpha2/project_invitation.proto
     3  // DO NOT EDIT!!!
     4  
     5  package project_invitation
     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_invitation "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/invitation"
    20  	project "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/project"
    21  	meta "github.com/cloudwan/goten-sdk/types/meta"
    22  )
    23  
    24  // ensure the imports are used
    25  var (
    26  	_ = new(fmt.Stringer)
    27  	_ = new(sort.Interface)
    28  
    29  	_ = new(proto.Message)
    30  	_ = googlefieldmaskpb.FieldMask{}
    31  
    32  	_ = new(gotenobject.FieldPath)
    33  )
    34  
    35  // make sure we're using proto imports
    36  var (
    37  	_ = &iam_invitation.Actor{}
    38  	_ = &project.Project{}
    39  	_ = &meta.Meta{}
    40  )
    41  
    42  func (o *ProjectInvitation) GotenObjectExt() {}
    43  
    44  func (o *ProjectInvitation) MakeFullFieldMask() *ProjectInvitation_FieldMask {
    45  	return FullProjectInvitation_FieldMask()
    46  }
    47  
    48  func (o *ProjectInvitation) MakeRawFullFieldMask() gotenobject.FieldMask {
    49  	return FullProjectInvitation_FieldMask()
    50  }
    51  
    52  func (o *ProjectInvitation) MakeDiffFieldMask(other *ProjectInvitation) *ProjectInvitation_FieldMask {
    53  	if o == nil && other == nil {
    54  		return &ProjectInvitation_FieldMask{}
    55  	}
    56  	if o == nil || other == nil {
    57  		return FullProjectInvitation_FieldMask()
    58  	}
    59  
    60  	res := &ProjectInvitation_FieldMask{}
    61  	if o.GetName().String() != other.GetName().String() {
    62  		res.Paths = append(res.Paths, &ProjectInvitation_FieldTerminalPath{selector: ProjectInvitation_FieldPathSelectorName})
    63  	}
    64  	if o.GetProjectDisplayName() != other.GetProjectDisplayName() {
    65  		res.Paths = append(res.Paths, &ProjectInvitation_FieldTerminalPath{selector: ProjectInvitation_FieldPathSelectorProjectDisplayName})
    66  	}
    67  	{
    68  		subMask := o.GetInvitation().MakeDiffFieldMask(other.GetInvitation())
    69  		if subMask.IsFull() {
    70  			res.Paths = append(res.Paths, &ProjectInvitation_FieldTerminalPath{selector: ProjectInvitation_FieldPathSelectorInvitation})
    71  		} else {
    72  			for _, subpath := range subMask.Paths {
    73  				res.Paths = append(res.Paths, &ProjectInvitation_FieldSubPath{selector: ProjectInvitation_FieldPathSelectorInvitation, subPath: subpath})
    74  			}
    75  		}
    76  	}
    77  	{
    78  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    79  		if subMask.IsFull() {
    80  			res.Paths = append(res.Paths, &ProjectInvitation_FieldTerminalPath{selector: ProjectInvitation_FieldPathSelectorMetadata})
    81  		} else {
    82  			for _, subpath := range subMask.Paths {
    83  				res.Paths = append(res.Paths, &ProjectInvitation_FieldSubPath{selector: ProjectInvitation_FieldPathSelectorMetadata, subPath: subpath})
    84  			}
    85  		}
    86  	}
    87  	return res
    88  }
    89  
    90  func (o *ProjectInvitation) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
    91  	return o.MakeDiffFieldMask(other.(*ProjectInvitation))
    92  }
    93  
    94  func (o *ProjectInvitation) Clone() *ProjectInvitation {
    95  	if o == nil {
    96  		return nil
    97  	}
    98  	result := &ProjectInvitation{}
    99  	if o.Name == nil {
   100  		result.Name = nil
   101  	} else if data, err := o.Name.ProtoString(); err != nil {
   102  		panic(err)
   103  	} else {
   104  		result.Name = &Name{}
   105  		if err := result.Name.ParseProtoString(data); err != nil {
   106  			panic(err)
   107  		}
   108  	}
   109  	result.ProjectDisplayName = o.ProjectDisplayName
   110  	result.Invitation = o.Invitation.Clone()
   111  	result.Metadata = o.Metadata.Clone()
   112  	return result
   113  }
   114  
   115  func (o *ProjectInvitation) CloneRaw() gotenobject.GotenObjectExt {
   116  	return o.Clone()
   117  }
   118  
   119  func (o *ProjectInvitation) Merge(source *ProjectInvitation) {
   120  	if source.GetName() != nil {
   121  		if data, err := source.GetName().ProtoString(); err != nil {
   122  			panic(err)
   123  		} else {
   124  			o.Name = &Name{}
   125  			if err := o.Name.ParseProtoString(data); err != nil {
   126  				panic(err)
   127  			}
   128  		}
   129  	} else {
   130  		o.Name = nil
   131  	}
   132  	o.ProjectDisplayName = source.GetProjectDisplayName()
   133  	if source.GetInvitation() != nil {
   134  		if o.Invitation == nil {
   135  			o.Invitation = new(iam_invitation.Invitation)
   136  		}
   137  		o.Invitation.Merge(source.GetInvitation())
   138  	}
   139  	if source.GetMetadata() != nil {
   140  		if o.Metadata == nil {
   141  			o.Metadata = new(meta.Meta)
   142  		}
   143  		o.Metadata.Merge(source.GetMetadata())
   144  	}
   145  }
   146  
   147  func (o *ProjectInvitation) MergeRaw(source gotenobject.GotenObjectExt) {
   148  	o.Merge(source.(*ProjectInvitation))
   149  }