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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/iam/proto/v1/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/v1/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  	{
    65  		subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
    66  		if subMask.IsFull() {
    67  			res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorMetadata})
    68  		} else {
    69  			for _, subpath := range subMask.Paths {
    70  				res.Paths = append(res.Paths, &ServiceAccountKey_FieldSubPath{selector: ServiceAccountKey_FieldPathSelectorMetadata, subPath: subpath})
    71  			}
    72  		}
    73  	}
    74  	if o.GetDisplayName() != other.GetDisplayName() {
    75  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorDisplayName})
    76  	}
    77  	if o.GetDescription() != other.GetDescription() {
    78  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorDescription})
    79  	}
    80  	if o.GetPublicKeyData() != other.GetPublicKeyData() {
    81  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorPublicKeyData})
    82  	}
    83  	if o.GetPrivateKeyData() != other.GetPrivateKeyData() {
    84  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorPrivateKeyData})
    85  	}
    86  	if o.GetApiKey() != other.GetApiKey() {
    87  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorApiKey})
    88  	}
    89  	if o.GetAlgorithm() != other.GetAlgorithm() {
    90  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorAlgorithm})
    91  	}
    92  	if !proto.Equal(o.GetValidNotBefore(), other.GetValidNotBefore()) {
    93  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorValidNotBefore})
    94  	}
    95  	if !proto.Equal(o.GetValidNotAfter(), other.GetValidNotAfter()) {
    96  		res.Paths = append(res.Paths, &ServiceAccountKey_FieldTerminalPath{selector: ServiceAccountKey_FieldPathSelectorValidNotAfter})
    97  	}
    98  	return res
    99  }
   100  
   101  func (o *ServiceAccountKey) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   102  	return o.MakeDiffFieldMask(other.(*ServiceAccountKey))
   103  }
   104  
   105  func (o *ServiceAccountKey) Clone() *ServiceAccountKey {
   106  	if o == nil {
   107  		return nil
   108  	}
   109  	result := &ServiceAccountKey{}
   110  	if o.Name == nil {
   111  		result.Name = nil
   112  	} else if data, err := o.Name.ProtoString(); err != nil {
   113  		panic(err)
   114  	} else {
   115  		result.Name = &Name{}
   116  		if err := result.Name.ParseProtoString(data); err != nil {
   117  			panic(err)
   118  		}
   119  	}
   120  	result.Metadata = o.Metadata.Clone()
   121  	result.DisplayName = o.DisplayName
   122  	result.Description = o.Description
   123  	result.PublicKeyData = o.PublicKeyData
   124  	result.PrivateKeyData = o.PrivateKeyData
   125  	result.ApiKey = o.ApiKey
   126  	result.Algorithm = o.Algorithm
   127  	result.ValidNotBefore = proto.Clone(o.ValidNotBefore).(*timestamppb.Timestamp)
   128  	result.ValidNotAfter = proto.Clone(o.ValidNotAfter).(*timestamppb.Timestamp)
   129  	return result
   130  }
   131  
   132  func (o *ServiceAccountKey) CloneRaw() gotenobject.GotenObjectExt {
   133  	return o.Clone()
   134  }
   135  
   136  func (o *ServiceAccountKey) Merge(source *ServiceAccountKey) {
   137  	if source.GetName() != nil {
   138  		if data, err := source.GetName().ProtoString(); err != nil {
   139  			panic(err)
   140  		} else {
   141  			o.Name = &Name{}
   142  			if err := o.Name.ParseProtoString(data); err != nil {
   143  				panic(err)
   144  			}
   145  		}
   146  	} else {
   147  		o.Name = nil
   148  	}
   149  	if source.GetMetadata() != nil {
   150  		if o.Metadata == nil {
   151  			o.Metadata = new(meta.Meta)
   152  		}
   153  		o.Metadata.Merge(source.GetMetadata())
   154  	}
   155  	o.DisplayName = source.GetDisplayName()
   156  	o.Description = source.GetDescription()
   157  	o.PublicKeyData = source.GetPublicKeyData()
   158  	o.PrivateKeyData = source.GetPrivateKeyData()
   159  	o.ApiKey = source.GetApiKey()
   160  	o.Algorithm = source.GetAlgorithm()
   161  	if source.GetValidNotBefore() != nil {
   162  		if o.ValidNotBefore == nil {
   163  			o.ValidNotBefore = new(timestamppb.Timestamp)
   164  		}
   165  		proto.Merge(o.ValidNotBefore, source.GetValidNotBefore())
   166  	}
   167  	if source.GetValidNotAfter() != nil {
   168  		if o.ValidNotAfter == nil {
   169  			o.ValidNotAfter = new(timestamppb.Timestamp)
   170  		}
   171  		proto.Merge(o.ValidNotAfter, source.GetValidNotAfter())
   172  	}
   173  }
   174  
   175  func (o *ServiceAccountKey) MergeRaw(source gotenobject.GotenObjectExt) {
   176  	o.Merge(source.(*ServiceAccountKey))
   177  }