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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1alpha2/service_account_key.proto
     3  // DO NOT EDIT!!!
     4  
     5  package service_account_key
     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  	service_account "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/service_account"
    20  	meta "github.com/cloudwan/goten-sdk/types/meta"
    21  	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
    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  	_ = &service_account.ServiceAccount{}
    38  	_ = &timestamppb.Timestamp{}
    39  	_ = &meta.Meta{}
    40  )
    41  
    42  func (o *ServiceAccountKey) GotenObjectExt() {}
    43  
    44  func (o *ServiceAccountKey) MakeFullFieldMask() *ServiceAccountKey_FieldMask {
    45  	return FullServiceAccountKey_FieldMask()
    46  }
    47  
    48  func (o *ServiceAccountKey) MakeRawFullFieldMask() gotenobject.FieldMask {
    49  	return FullServiceAccountKey_FieldMask()
    50  }
    51  
    52  func (o *ServiceAccountKey) MakeDiffFieldMask(other *ServiceAccountKey) *ServiceAccountKey_FieldMask {
    53  	if o == nil && other == nil {
    54  		return &ServiceAccountKey_FieldMask{}
    55  	}
    56  	if o == nil || other == nil {
    57  		return FullServiceAccountKey_FieldMask()
    58  	}
    59  
    60  	res := &ServiceAccountKey_FieldMask{}
    61  	if o.GetName().String() != other.GetName().String() {
    62  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorName})
    63  	}
    64  	if o.GetDisplayName() != other.GetDisplayName() {
    65  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorDisplayName})
    66  	}
    67  	if o.GetPublicKeyData() != other.GetPublicKeyData() {
    68  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorPublicKeyData})
    69  	}
    70  	if o.GetPrivateKeyData() != other.GetPrivateKeyData() {
    71  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorPrivateKeyData})
    72  	}
    73  	if o.GetApiKey() != other.GetApiKey() {
    74  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorApiKey})
    75  	}
    76  	if o.GetAlgorithm() != other.GetAlgorithm() {
    77  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorAlgorithm})
    78  	}
    79  	if !proto.Equal(o.GetValidNotBefore(), other.GetValidNotBefore()) {
    80  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorValidNotBefore})
    81  	}
    82  	if !proto.Equal(o.GetValidNotAfter(), other.GetValidNotAfter()) {
    83  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorValidNotAfter})
    84  	}
    85  	{
    86  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    87  		if subMask.IsFull() {
    88  			res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorMetadata})
    89  		} else {
    90  			for _, subpath := range subMask.Paths {
    91  				res.Paths = append(res.Paths, &ServiceAccountKey_FieldSubPath{selector: ServiceAccountKey_FieldPathSelectorMetadata, subPath: subpath})
    92  			}
    93  		}
    94  	}
    95  	return res
    96  }
    97  
    98  func (o *ServiceAccountKey) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
    99  	return o.MakeDiffFieldMask(other.(*ServiceAccountKey))
   100  }
   101  
   102  func (o *ServiceAccountKey) Clone() *ServiceAccountKey {
   103  	if o == nil {
   104  		return nil
   105  	}
   106  	result := &ServiceAccountKey{}
   107  	if o.Name == nil {
   108  		result.Name = nil
   109  	} else if data, err := o.Name.ProtoString(); err != nil {
   110  		panic(err)
   111  	} else {
   112  		result.Name = &Name{}
   113  		if err := result.Name.ParseProtoString(data); err != nil {
   114  			panic(err)
   115  		}
   116  	}
   117  	result.DisplayName = o.DisplayName
   118  	result.PublicKeyData = o.PublicKeyData
   119  	result.PrivateKeyData = o.PrivateKeyData
   120  	result.ApiKey = o.ApiKey
   121  	result.Algorithm = o.Algorithm
   122  	result.ValidNotBefore = proto.Clone(o.ValidNotBefore).(*timestamppb.Timestamp)
   123  	result.ValidNotAfter = proto.Clone(o.ValidNotAfter).(*timestamppb.Timestamp)
   124  	result.Metadata = o.Metadata.Clone()
   125  	return result
   126  }
   127  
   128  func (o *ServiceAccountKey) CloneRaw() gotenobject.GotenObjectExt {
   129  	return o.Clone()
   130  }
   131  
   132  func (o *ServiceAccountKey) Merge(source *ServiceAccountKey) {
   133  	if source.GetName() != nil {
   134  		if data, err := source.GetName().ProtoString(); err != nil {
   135  			panic(err)
   136  		} else {
   137  			o.Name = &Name{}
   138  			if err := o.Name.ParseProtoString(data); err != nil {
   139  				panic(err)
   140  			}
   141  		}
   142  	} else {
   143  		o.Name = nil
   144  	}
   145  	o.DisplayName = source.GetDisplayName()
   146  	o.PublicKeyData = source.GetPublicKeyData()
   147  	o.PrivateKeyData = source.GetPrivateKeyData()
   148  	o.ApiKey = source.GetApiKey()
   149  	o.Algorithm = source.GetAlgorithm()
   150  	if source.GetValidNotBefore() != nil {
   151  		if o.ValidNotBefore == nil {
   152  			o.ValidNotBefore = new(timestamppb.Timestamp)
   153  		}
   154  		proto.Merge(o.ValidNotBefore, source.GetValidNotBefore())
   155  	}
   156  	if source.GetValidNotAfter() != nil {
   157  		if o.ValidNotAfter == nil {
   158  			o.ValidNotAfter = new(timestamppb.Timestamp)
   159  		}
   160  		proto.Merge(o.ValidNotAfter, source.GetValidNotAfter())
   161  	}
   162  	if source.GetMetadata() != nil {
   163  		if o.Metadata == nil {
   164  			o.Metadata = new(meta.Meta)
   165  		}
   166  		o.Metadata.Merge(source.GetMetadata())
   167  	}
   168  }
   169  
   170  func (o *ServiceAccountKey) MergeRaw(source gotenobject.GotenObjectExt) {
   171  	o.Merge(source.(*ServiceAccountKey))
   172  }