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