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

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/audit/proto/v1/resource_change_log.proto
     3  // DO NOT EDIT!!!
     4  
     5  package resource_change_log
     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  	common "github.com/cloudwan/edgelq-sdk/audit/resources/v1/common"
    20  	iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization"
    21  	iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    22  	meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service"
    23  	anypb "google.golang.org/protobuf/types/known/anypb"
    24  	fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    25  	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
    26  )
    27  
    28  // ensure the imports are used
    29  var (
    30  	_ = new(fmt.Stringer)
    31  	_ = new(sort.Interface)
    32  
    33  	_ = new(proto.Message)
    34  	_ = googlefieldmaskpb.FieldMask{}
    35  
    36  	_ = new(gotenobject.FieldPath)
    37  )
    38  
    39  // make sure we're using proto imports
    40  var (
    41  	_ = &common.Authentication{}
    42  	_ = &iam_organization.Organization{}
    43  	_ = &iam_project.Project{}
    44  	_ = &anypb.Any{}
    45  	_ = &fieldmaskpb.FieldMask{}
    46  	_ = &timestamppb.Timestamp{}
    47  	_ = &meta_service.Service{}
    48  )
    49  
    50  func (o *ResourceChangeLog) GotenObjectExt() {}
    51  
    52  func (o *ResourceChangeLog) MakeFullFieldMask() *ResourceChangeLog_FieldMask {
    53  	return FullResourceChangeLog_FieldMask()
    54  }
    55  
    56  func (o *ResourceChangeLog) MakeRawFullFieldMask() gotenobject.FieldMask {
    57  	return FullResourceChangeLog_FieldMask()
    58  }
    59  
    60  func (o *ResourceChangeLog) MakeDiffFieldMask(other *ResourceChangeLog) *ResourceChangeLog_FieldMask {
    61  	if o == nil && other == nil {
    62  		return &ResourceChangeLog_FieldMask{}
    63  	}
    64  	if o == nil || other == nil {
    65  		return FullResourceChangeLog_FieldMask()
    66  	}
    67  
    68  	res := &ResourceChangeLog_FieldMask{}
    69  	if o.GetName().String() != other.GetName().String() {
    70  		res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorName})
    71  	}
    72  	if o.GetScope() != other.GetScope() {
    73  		res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorScope})
    74  	}
    75  	if o.GetRequestId() != other.GetRequestId() {
    76  		res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorRequestId})
    77  	}
    78  	if !proto.Equal(o.GetTimestamp(), other.GetTimestamp()) {
    79  		res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorTimestamp})
    80  	}
    81  	{
    82  		subMask := o.GetAuthentication().MakeDiffFieldMask(other.GetAuthentication())
    83  		if subMask.IsFull() {
    84  			res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorAuthentication})
    85  		} else {
    86  			for _, subpath := range subMask.Paths {
    87  				res.Paths = append(res.Paths, &ResourceChangeLog_FieldSubPath{selector: ResourceChangeLog_FieldPathSelectorAuthentication, subPath: subpath})
    88  			}
    89  		}
    90  	}
    91  	{
    92  		subMask := o.GetService().MakeDiffFieldMask(other.GetService())
    93  		if subMask.IsFull() {
    94  			res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorService})
    95  		} else {
    96  			for _, subpath := range subMask.Paths {
    97  				res.Paths = append(res.Paths, &ResourceChangeLog_FieldSubPath{selector: ResourceChangeLog_FieldPathSelectorService, subPath: subpath})
    98  			}
    99  		}
   100  	}
   101  	{
   102  		subMask := o.GetResource().MakeDiffFieldMask(other.GetResource())
   103  		if subMask.IsFull() {
   104  			res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorResource})
   105  		} else {
   106  			for _, subpath := range subMask.Paths {
   107  				res.Paths = append(res.Paths, &ResourceChangeLog_FieldSubPath{selector: ResourceChangeLog_FieldPathSelectorResource, subPath: subpath})
   108  			}
   109  		}
   110  	}
   111  	{
   112  		subMask := o.GetTransaction().MakeDiffFieldMask(other.GetTransaction())
   113  		if subMask.IsFull() {
   114  			res.Paths = append(res.Paths, &ResourceChangeLog_FieldTerminalPath{selector: ResourceChangeLog_FieldPathSelectorTransaction})
   115  		} else {
   116  			for _, subpath := range subMask.Paths {
   117  				res.Paths = append(res.Paths, &ResourceChangeLog_FieldSubPath{selector: ResourceChangeLog_FieldPathSelectorTransaction, subPath: subpath})
   118  			}
   119  		}
   120  	}
   121  	return res
   122  }
   123  
   124  func (o *ResourceChangeLog) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   125  	return o.MakeDiffFieldMask(other.(*ResourceChangeLog))
   126  }
   127  
   128  func (o *ResourceChangeLog) Clone() *ResourceChangeLog {
   129  	if o == nil {
   130  		return nil
   131  	}
   132  	result := &ResourceChangeLog{}
   133  	if o.Name == nil {
   134  		result.Name = nil
   135  	} else if data, err := o.Name.ProtoString(); err != nil {
   136  		panic(err)
   137  	} else {
   138  		result.Name = &Name{}
   139  		if err := result.Name.ParseProtoString(data); err != nil {
   140  			panic(err)
   141  		}
   142  	}
   143  	result.Scope = o.Scope
   144  	result.RequestId = o.RequestId
   145  	result.Timestamp = proto.Clone(o.Timestamp).(*timestamppb.Timestamp)
   146  	result.Authentication = o.Authentication.Clone()
   147  	result.Service = o.Service.Clone()
   148  	result.Resource = o.Resource.Clone()
   149  	result.Transaction = o.Transaction.Clone()
   150  	return result
   151  }
   152  
   153  func (o *ResourceChangeLog) CloneRaw() gotenobject.GotenObjectExt {
   154  	return o.Clone()
   155  }
   156  
   157  func (o *ResourceChangeLog) Merge(source *ResourceChangeLog) {
   158  	if source.GetName() != nil {
   159  		if data, err := source.GetName().ProtoString(); err != nil {
   160  			panic(err)
   161  		} else {
   162  			o.Name = &Name{}
   163  			if err := o.Name.ParseProtoString(data); err != nil {
   164  				panic(err)
   165  			}
   166  		}
   167  	} else {
   168  		o.Name = nil
   169  	}
   170  	o.Scope = source.GetScope()
   171  	o.RequestId = source.GetRequestId()
   172  	if source.GetTimestamp() != nil {
   173  		if o.Timestamp == nil {
   174  			o.Timestamp = new(timestamppb.Timestamp)
   175  		}
   176  		proto.Merge(o.Timestamp, source.GetTimestamp())
   177  	}
   178  	if source.GetAuthentication() != nil {
   179  		if o.Authentication == nil {
   180  			o.Authentication = new(common.Authentication)
   181  		}
   182  		o.Authentication.Merge(source.GetAuthentication())
   183  	}
   184  	if source.GetService() != nil {
   185  		if o.Service == nil {
   186  			o.Service = new(common.ServiceData)
   187  		}
   188  		o.Service.Merge(source.GetService())
   189  	}
   190  	if source.GetResource() != nil {
   191  		if o.Resource == nil {
   192  			o.Resource = new(ResourceChangeLog_ResourceChange)
   193  		}
   194  		o.Resource.Merge(source.GetResource())
   195  	}
   196  	if source.GetTransaction() != nil {
   197  		if o.Transaction == nil {
   198  			o.Transaction = new(ResourceChangeLog_TransactionInfo)
   199  		}
   200  		o.Transaction.Merge(source.GetTransaction())
   201  	}
   202  }
   203  
   204  func (o *ResourceChangeLog) MergeRaw(source gotenobject.GotenObjectExt) {
   205  	o.Merge(source.(*ResourceChangeLog))
   206  }
   207  
   208  func (o *ResourceChangeLog_ResourceChange) GotenObjectExt() {}
   209  
   210  func (o *ResourceChangeLog_ResourceChange) MakeFullFieldMask() *ResourceChangeLog_ResourceChange_FieldMask {
   211  	return FullResourceChangeLog_ResourceChange_FieldMask()
   212  }
   213  
   214  func (o *ResourceChangeLog_ResourceChange) MakeRawFullFieldMask() gotenobject.FieldMask {
   215  	return FullResourceChangeLog_ResourceChange_FieldMask()
   216  }
   217  
   218  func (o *ResourceChangeLog_ResourceChange) MakeDiffFieldMask(other *ResourceChangeLog_ResourceChange) *ResourceChangeLog_ResourceChange_FieldMask {
   219  	if o == nil && other == nil {
   220  		return &ResourceChangeLog_ResourceChange_FieldMask{}
   221  	}
   222  	if o == nil || other == nil {
   223  		return FullResourceChangeLog_ResourceChange_FieldMask()
   224  	}
   225  
   226  	res := &ResourceChangeLog_ResourceChange_FieldMask{}
   227  	if o.GetName() != other.GetName() {
   228  		res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorName})
   229  	}
   230  	if o.GetType() != other.GetType() {
   231  		res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorType})
   232  	}
   233  	if o.GetAction() != other.GetAction() {
   234  		res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorAction})
   235  	}
   236  	if !proto.Equal(o.GetUpdatedFields(), other.GetUpdatedFields()) {
   237  		res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorUpdatedFields})
   238  	}
   239  	if !proto.Equal(o.GetPrevious(), other.GetPrevious()) {
   240  		res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorPrevious})
   241  	}
   242  	if !proto.Equal(o.GetCurrent(), other.GetCurrent()) {
   243  		res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorCurrent})
   244  	}
   245  
   246  	if len(o.GetLabels()) == len(other.GetLabels()) {
   247  		for i, lValue := range o.GetLabels() {
   248  			rValue := other.GetLabels()[i]
   249  			if lValue != rValue {
   250  				res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorLabels})
   251  				break
   252  			}
   253  		}
   254  	} else {
   255  		res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorLabels})
   256  	}
   257  	{
   258  		subMask := o.GetPre().MakeDiffFieldMask(other.GetPre())
   259  		if subMask.IsFull() {
   260  			res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorPre})
   261  		} else {
   262  			for _, subpath := range subMask.Paths {
   263  				res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldSubPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorPre, subPath: subpath})
   264  			}
   265  		}
   266  	}
   267  	{
   268  		subMask := o.GetPost().MakeDiffFieldMask(other.GetPost())
   269  		if subMask.IsFull() {
   270  			res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldTerminalPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorPost})
   271  		} else {
   272  			for _, subpath := range subMask.Paths {
   273  				res.Paths = append(res.Paths, &ResourceChangeLogResourceChange_FieldSubPath{selector: ResourceChangeLogResourceChange_FieldPathSelectorPost, subPath: subpath})
   274  			}
   275  		}
   276  	}
   277  	return res
   278  }
   279  
   280  func (o *ResourceChangeLog_ResourceChange) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   281  	return o.MakeDiffFieldMask(other.(*ResourceChangeLog_ResourceChange))
   282  }
   283  
   284  func (o *ResourceChangeLog_ResourceChange) Clone() *ResourceChangeLog_ResourceChange {
   285  	if o == nil {
   286  		return nil
   287  	}
   288  	result := &ResourceChangeLog_ResourceChange{}
   289  	result.Name = o.Name
   290  	result.Type = o.Type
   291  	result.Action = o.Action
   292  	result.UpdatedFields = proto.Clone(o.UpdatedFields).(*fieldmaskpb.FieldMask)
   293  	result.Previous = proto.Clone(o.Previous).(*anypb.Any)
   294  	result.Current = proto.Clone(o.Current).(*anypb.Any)
   295  	result.Labels = map[string]string{}
   296  	for key, sourceValue := range o.Labels {
   297  		result.Labels[key] = sourceValue
   298  	}
   299  	result.Pre = o.Pre.Clone()
   300  	result.Post = o.Post.Clone()
   301  	return result
   302  }
   303  
   304  func (o *ResourceChangeLog_ResourceChange) CloneRaw() gotenobject.GotenObjectExt {
   305  	return o.Clone()
   306  }
   307  
   308  func (o *ResourceChangeLog_ResourceChange) Merge(source *ResourceChangeLog_ResourceChange) {
   309  	o.Name = source.GetName()
   310  	o.Type = source.GetType()
   311  	o.Action = source.GetAction()
   312  	if source.GetUpdatedFields() != nil {
   313  		if o.UpdatedFields == nil {
   314  			o.UpdatedFields = new(fieldmaskpb.FieldMask)
   315  		}
   316  		proto.Merge(o.UpdatedFields, source.GetUpdatedFields())
   317  	}
   318  	if source.GetPrevious() != nil {
   319  		if o.Previous == nil {
   320  			o.Previous = new(anypb.Any)
   321  		}
   322  		proto.Merge(o.Previous, source.GetPrevious())
   323  	}
   324  	if source.GetCurrent() != nil {
   325  		if o.Current == nil {
   326  			o.Current = new(anypb.Any)
   327  		}
   328  		proto.Merge(o.Current, source.GetCurrent())
   329  	}
   330  	if source.GetLabels() != nil {
   331  		if o.Labels == nil {
   332  			o.Labels = make(map[string]string, len(source.GetLabels()))
   333  		}
   334  		for key, sourceValue := range source.GetLabels() {
   335  			o.Labels[key] = sourceValue
   336  		}
   337  	}
   338  	if source.GetPre() != nil {
   339  		if o.Pre == nil {
   340  			o.Pre = new(common.ObjectState)
   341  		}
   342  		o.Pre.Merge(source.GetPre())
   343  	}
   344  	if source.GetPost() != nil {
   345  		if o.Post == nil {
   346  			o.Post = new(common.ObjectState)
   347  		}
   348  		o.Post.Merge(source.GetPost())
   349  	}
   350  }
   351  
   352  func (o *ResourceChangeLog_ResourceChange) MergeRaw(source gotenobject.GotenObjectExt) {
   353  	o.Merge(source.(*ResourceChangeLog_ResourceChange))
   354  }
   355  
   356  func (o *ResourceChangeLog_TransactionInfo) GotenObjectExt() {}
   357  
   358  func (o *ResourceChangeLog_TransactionInfo) MakeFullFieldMask() *ResourceChangeLog_TransactionInfo_FieldMask {
   359  	return FullResourceChangeLog_TransactionInfo_FieldMask()
   360  }
   361  
   362  func (o *ResourceChangeLog_TransactionInfo) MakeRawFullFieldMask() gotenobject.FieldMask {
   363  	return FullResourceChangeLog_TransactionInfo_FieldMask()
   364  }
   365  
   366  func (o *ResourceChangeLog_TransactionInfo) MakeDiffFieldMask(other *ResourceChangeLog_TransactionInfo) *ResourceChangeLog_TransactionInfo_FieldMask {
   367  	if o == nil && other == nil {
   368  		return &ResourceChangeLog_TransactionInfo_FieldMask{}
   369  	}
   370  	if o == nil || other == nil {
   371  		return FullResourceChangeLog_TransactionInfo_FieldMask()
   372  	}
   373  
   374  	res := &ResourceChangeLog_TransactionInfo_FieldMask{}
   375  	if o.GetIdentifier() != other.GetIdentifier() {
   376  		res.Paths = append(res.Paths, &ResourceChangeLogTransactionInfo_FieldTerminalPath{selector: ResourceChangeLogTransactionInfo_FieldPathSelectorIdentifier})
   377  	}
   378  	if o.GetTryCounter() != other.GetTryCounter() {
   379  		res.Paths = append(res.Paths, &ResourceChangeLogTransactionInfo_FieldTerminalPath{selector: ResourceChangeLogTransactionInfo_FieldPathSelectorTryCounter})
   380  	}
   381  	if o.GetState() != other.GetState() {
   382  		res.Paths = append(res.Paths, &ResourceChangeLogTransactionInfo_FieldTerminalPath{selector: ResourceChangeLogTransactionInfo_FieldPathSelectorState})
   383  	}
   384  	return res
   385  }
   386  
   387  func (o *ResourceChangeLog_TransactionInfo) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
   388  	return o.MakeDiffFieldMask(other.(*ResourceChangeLog_TransactionInfo))
   389  }
   390  
   391  func (o *ResourceChangeLog_TransactionInfo) Clone() *ResourceChangeLog_TransactionInfo {
   392  	if o == nil {
   393  		return nil
   394  	}
   395  	result := &ResourceChangeLog_TransactionInfo{}
   396  	result.Identifier = o.Identifier
   397  	result.TryCounter = o.TryCounter
   398  	result.State = o.State
   399  	return result
   400  }
   401  
   402  func (o *ResourceChangeLog_TransactionInfo) CloneRaw() gotenobject.GotenObjectExt {
   403  	return o.Clone()
   404  }
   405  
   406  func (o *ResourceChangeLog_TransactionInfo) Merge(source *ResourceChangeLog_TransactionInfo) {
   407  	o.Identifier = source.GetIdentifier()
   408  	o.TryCounter = source.GetTryCounter()
   409  	o.State = source.GetState()
   410  }
   411  
   412  func (o *ResourceChangeLog_TransactionInfo) MergeRaw(source gotenobject.GotenObjectExt) {
   413  	o.Merge(source.(*ResourceChangeLog_TransactionInfo))
   414  }