github.com/cloudwan/edgelq-sdk@v1.15.4/audit/resources/v1alpha2/activity_log/activity_log.pb.fieldmask.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/audit/proto/v1alpha2/activity_log.proto 3 // DO NOT EDIT!!! 4 5 package activity_log 6 7 import ( 8 "encoding/json" 9 "strings" 10 11 "google.golang.org/grpc/codes" 12 "google.golang.org/grpc/status" 13 "google.golang.org/protobuf/proto" 14 preflect "google.golang.org/protobuf/reflect/protoreflect" 15 googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 16 17 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 18 ) 19 20 // proto imports 21 import ( 22 common "github.com/cloudwan/edgelq-sdk/audit/resources/v1alpha2/common" 23 rpc "github.com/cloudwan/edgelq-sdk/common/rpc" 24 iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/organization" 25 iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/project" 26 anypb "google.golang.org/protobuf/types/known/anypb" 27 fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 28 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 29 ) 30 31 // ensure the imports are used 32 var ( 33 _ = new(json.Marshaler) 34 _ = strings.Builder{} 35 36 _ = codes.NotFound 37 _ = status.Status{} 38 _ = new(proto.Message) 39 _ = new(preflect.Message) 40 _ = googlefieldmaskpb.FieldMask{} 41 42 _ = new(gotenobject.FieldMask) 43 ) 44 45 // make sure we're using proto imports 46 var ( 47 _ = &common.Authentication{} 48 _ = &rpc.Status{} 49 _ = &iam_organization.Organization{} 50 _ = &iam_project.Project{} 51 _ = &anypb.Any{} 52 _ = &fieldmaskpb.FieldMask{} 53 _ = ×tamppb.Timestamp{} 54 ) 55 56 type ActivityLog_FieldMask struct { 57 Paths []ActivityLog_FieldPath 58 } 59 60 func FullActivityLog_FieldMask() *ActivityLog_FieldMask { 61 res := &ActivityLog_FieldMask{} 62 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorName}) 63 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorScope}) 64 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorRequestId}) 65 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorAuthentication}) 66 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorAuthorization}) 67 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorService}) 68 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorMethod}) 69 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorRequestMetadata}) 70 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorRequestRouting}) 71 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorResource}) 72 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorCategory}) 73 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorLabels}) 74 res.Paths = append(res.Paths, &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorEvents}) 75 return res 76 } 77 78 func (fieldMask *ActivityLog_FieldMask) String() string { 79 if fieldMask == nil { 80 return "<nil>" 81 } 82 pathsStr := make([]string, 0, len(fieldMask.Paths)) 83 for _, path := range fieldMask.Paths { 84 pathsStr = append(pathsStr, path.String()) 85 } 86 return strings.Join(pathsStr, ", ") 87 } 88 89 func (fieldMask *ActivityLog_FieldMask) IsFull() bool { 90 if fieldMask == nil { 91 return false 92 } 93 presentSelectors := make([]bool, 13) 94 for _, path := range fieldMask.Paths { 95 if asFinal, ok := path.(*ActivityLog_FieldTerminalPath); ok { 96 presentSelectors[int(asFinal.selector)] = true 97 } 98 } 99 for _, flag := range presentSelectors { 100 if !flag { 101 return false 102 } 103 } 104 return true 105 } 106 107 func (fieldMask *ActivityLog_FieldMask) ProtoReflect() preflect.Message { 108 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 109 return ParseActivityLog_FieldPath(raw) 110 }) 111 } 112 113 func (fieldMask *ActivityLog_FieldMask) ProtoMessage() {} 114 115 func (fieldMask *ActivityLog_FieldMask) Reset() { 116 if fieldMask != nil { 117 fieldMask.Paths = nil 118 } 119 } 120 121 func (fieldMask *ActivityLog_FieldMask) Subtract(other *ActivityLog_FieldMask) *ActivityLog_FieldMask { 122 result := &ActivityLog_FieldMask{} 123 removedSelectors := make([]bool, 13) 124 otherSubMasks := map[ActivityLog_FieldPathSelector]gotenobject.FieldMask{ 125 ActivityLog_FieldPathSelectorAuthentication: &common.Authentication_FieldMask{}, 126 ActivityLog_FieldPathSelectorAuthorization: &common.Authorization_FieldMask{}, 127 ActivityLog_FieldPathSelectorService: &common.ServiceData_FieldMask{}, 128 ActivityLog_FieldPathSelectorMethod: &ActivityLog_Method_FieldMask{}, 129 ActivityLog_FieldPathSelectorRequestMetadata: &ActivityLog_RequestMetadata_FieldMask{}, 130 ActivityLog_FieldPathSelectorRequestRouting: &ActivityLog_RequestRouting_FieldMask{}, 131 ActivityLog_FieldPathSelectorResource: &ActivityLog_Resource_FieldMask{}, 132 ActivityLog_FieldPathSelectorEvents: &ActivityLog_Event_FieldMask{}, 133 } 134 mySubMasks := map[ActivityLog_FieldPathSelector]gotenobject.FieldMask{ 135 ActivityLog_FieldPathSelectorAuthentication: &common.Authentication_FieldMask{}, 136 ActivityLog_FieldPathSelectorAuthorization: &common.Authorization_FieldMask{}, 137 ActivityLog_FieldPathSelectorService: &common.ServiceData_FieldMask{}, 138 ActivityLog_FieldPathSelectorMethod: &ActivityLog_Method_FieldMask{}, 139 ActivityLog_FieldPathSelectorRequestMetadata: &ActivityLog_RequestMetadata_FieldMask{}, 140 ActivityLog_FieldPathSelectorRequestRouting: &ActivityLog_RequestRouting_FieldMask{}, 141 ActivityLog_FieldPathSelectorResource: &ActivityLog_Resource_FieldMask{}, 142 ActivityLog_FieldPathSelectorEvents: &ActivityLog_Event_FieldMask{}, 143 } 144 145 for _, path := range other.GetPaths() { 146 switch tp := path.(type) { 147 case *ActivityLog_FieldTerminalPath: 148 removedSelectors[int(tp.selector)] = true 149 case *ActivityLog_FieldSubPath: 150 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 151 } 152 } 153 for _, path := range fieldMask.GetPaths() { 154 if !removedSelectors[int(path.Selector())] { 155 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 156 if tp, ok := path.(*ActivityLog_FieldTerminalPath); ok { 157 switch tp.selector { 158 case ActivityLog_FieldPathSelectorAuthentication: 159 mySubMasks[ActivityLog_FieldPathSelectorAuthentication] = common.FullAuthentication_FieldMask() 160 case ActivityLog_FieldPathSelectorAuthorization: 161 mySubMasks[ActivityLog_FieldPathSelectorAuthorization] = common.FullAuthorization_FieldMask() 162 case ActivityLog_FieldPathSelectorService: 163 mySubMasks[ActivityLog_FieldPathSelectorService] = common.FullServiceData_FieldMask() 164 case ActivityLog_FieldPathSelectorMethod: 165 mySubMasks[ActivityLog_FieldPathSelectorMethod] = FullActivityLog_Method_FieldMask() 166 case ActivityLog_FieldPathSelectorRequestMetadata: 167 mySubMasks[ActivityLog_FieldPathSelectorRequestMetadata] = FullActivityLog_RequestMetadata_FieldMask() 168 case ActivityLog_FieldPathSelectorRequestRouting: 169 mySubMasks[ActivityLog_FieldPathSelectorRequestRouting] = FullActivityLog_RequestRouting_FieldMask() 170 case ActivityLog_FieldPathSelectorResource: 171 mySubMasks[ActivityLog_FieldPathSelectorResource] = FullActivityLog_Resource_FieldMask() 172 case ActivityLog_FieldPathSelectorEvents: 173 mySubMasks[ActivityLog_FieldPathSelectorEvents] = FullActivityLog_Event_FieldMask() 174 } 175 } else if tp, ok := path.(*ActivityLog_FieldSubPath); ok { 176 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 177 } 178 } else { 179 result.Paths = append(result.Paths, path) 180 } 181 } 182 } 183 for selector, mySubMask := range mySubMasks { 184 if mySubMask.PathsCount() > 0 { 185 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 186 result.Paths = append(result.Paths, &ActivityLog_FieldSubPath{selector: selector, subPath: allowedPath}) 187 } 188 } 189 } 190 191 if len(result.Paths) == 0 { 192 return nil 193 } 194 return result 195 } 196 197 func (fieldMask *ActivityLog_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 198 return fieldMask.Subtract(other.(*ActivityLog_FieldMask)) 199 } 200 201 // FilterInputFields generates copy of field paths with output_only field paths removed 202 func (fieldMask *ActivityLog_FieldMask) FilterInputFields() *ActivityLog_FieldMask { 203 result := &ActivityLog_FieldMask{} 204 result.Paths = append(result.Paths, fieldMask.Paths...) 205 return result 206 } 207 208 // ToFieldMask is used for proto conversions 209 func (fieldMask *ActivityLog_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 210 protoFieldMask := &googlefieldmaskpb.FieldMask{} 211 for _, path := range fieldMask.Paths { 212 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 213 } 214 return protoFieldMask 215 } 216 217 func (fieldMask *ActivityLog_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 218 if fieldMask == nil { 219 return status.Error(codes.Internal, "target field mask is nil") 220 } 221 fieldMask.Paths = make([]ActivityLog_FieldPath, 0, len(protoFieldMask.Paths)) 222 for _, strPath := range protoFieldMask.Paths { 223 path, err := ParseActivityLog_FieldPath(strPath) 224 if err != nil { 225 return err 226 } 227 fieldMask.Paths = append(fieldMask.Paths, path) 228 } 229 return nil 230 } 231 232 // implement methods required by customType 233 func (fieldMask ActivityLog_FieldMask) Marshal() ([]byte, error) { 234 protoFieldMask := fieldMask.ToProtoFieldMask() 235 return proto.Marshal(protoFieldMask) 236 } 237 238 func (fieldMask *ActivityLog_FieldMask) Unmarshal(data []byte) error { 239 protoFieldMask := &googlefieldmaskpb.FieldMask{} 240 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 241 return err 242 } 243 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 244 return err 245 } 246 return nil 247 } 248 249 func (fieldMask *ActivityLog_FieldMask) Size() int { 250 return proto.Size(fieldMask.ToProtoFieldMask()) 251 } 252 253 func (fieldMask ActivityLog_FieldMask) MarshalJSON() ([]byte, error) { 254 return json.Marshal(fieldMask.ToProtoFieldMask()) 255 } 256 257 func (fieldMask *ActivityLog_FieldMask) UnmarshalJSON(data []byte) error { 258 protoFieldMask := &googlefieldmaskpb.FieldMask{} 259 if err := json.Unmarshal(data, protoFieldMask); err != nil { 260 return err 261 } 262 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 263 return err 264 } 265 return nil 266 } 267 268 func (fieldMask *ActivityLog_FieldMask) AppendPath(path ActivityLog_FieldPath) { 269 fieldMask.Paths = append(fieldMask.Paths, path) 270 } 271 272 func (fieldMask *ActivityLog_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 273 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLog_FieldPath)) 274 } 275 276 func (fieldMask *ActivityLog_FieldMask) GetPaths() []ActivityLog_FieldPath { 277 if fieldMask == nil { 278 return nil 279 } 280 return fieldMask.Paths 281 } 282 283 func (fieldMask *ActivityLog_FieldMask) GetRawPaths() []gotenobject.FieldPath { 284 if fieldMask == nil { 285 return nil 286 } 287 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 288 for _, path := range fieldMask.Paths { 289 rawPaths = append(rawPaths, path) 290 } 291 return rawPaths 292 } 293 294 func (fieldMask *ActivityLog_FieldMask) SetFromCliFlag(raw string) error { 295 path, err := ParseActivityLog_FieldPath(raw) 296 if err != nil { 297 return err 298 } 299 fieldMask.Paths = append(fieldMask.Paths, path) 300 return nil 301 } 302 303 func (fieldMask *ActivityLog_FieldMask) Set(target, source *ActivityLog) { 304 for _, path := range fieldMask.Paths { 305 val, _ := path.GetSingle(source) 306 // if val is nil, then field does not exist in source, skip 307 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 308 if val != nil { 309 path.WithIValue(val).SetTo(&target) 310 } 311 } 312 } 313 314 func (fieldMask *ActivityLog_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 315 fieldMask.Set(target.(*ActivityLog), source.(*ActivityLog)) 316 } 317 318 func (fieldMask *ActivityLog_FieldMask) Project(source *ActivityLog) *ActivityLog { 319 if source == nil { 320 return nil 321 } 322 if fieldMask == nil { 323 return source 324 } 325 result := &ActivityLog{} 326 authenticationMask := &common.Authentication_FieldMask{} 327 wholeAuthenticationAccepted := false 328 authorizationMask := &common.Authorization_FieldMask{} 329 wholeAuthorizationAccepted := false 330 serviceMask := &common.ServiceData_FieldMask{} 331 wholeServiceAccepted := false 332 methodMask := &ActivityLog_Method_FieldMask{} 333 wholeMethodAccepted := false 334 requestMetadataMask := &ActivityLog_RequestMetadata_FieldMask{} 335 wholeRequestMetadataAccepted := false 336 requestRoutingMask := &ActivityLog_RequestRouting_FieldMask{} 337 wholeRequestRoutingAccepted := false 338 resourceMask := &ActivityLog_Resource_FieldMask{} 339 wholeResourceAccepted := false 340 eventsMask := &ActivityLog_Event_FieldMask{} 341 wholeEventsAccepted := false 342 var labelsMapKeys []string 343 wholeLabelsAccepted := false 344 345 for _, p := range fieldMask.Paths { 346 switch tp := p.(type) { 347 case *ActivityLog_FieldTerminalPath: 348 switch tp.selector { 349 case ActivityLog_FieldPathSelectorName: 350 result.Name = source.Name 351 case ActivityLog_FieldPathSelectorScope: 352 result.Scope = source.Scope 353 case ActivityLog_FieldPathSelectorRequestId: 354 result.RequestId = source.RequestId 355 case ActivityLog_FieldPathSelectorAuthentication: 356 result.Authentication = source.Authentication 357 wholeAuthenticationAccepted = true 358 case ActivityLog_FieldPathSelectorAuthorization: 359 result.Authorization = source.Authorization 360 wholeAuthorizationAccepted = true 361 case ActivityLog_FieldPathSelectorService: 362 result.Service = source.Service 363 wholeServiceAccepted = true 364 case ActivityLog_FieldPathSelectorMethod: 365 result.Method = source.Method 366 wholeMethodAccepted = true 367 case ActivityLog_FieldPathSelectorRequestMetadata: 368 result.RequestMetadata = source.RequestMetadata 369 wholeRequestMetadataAccepted = true 370 case ActivityLog_FieldPathSelectorRequestRouting: 371 result.RequestRouting = source.RequestRouting 372 wholeRequestRoutingAccepted = true 373 case ActivityLog_FieldPathSelectorResource: 374 result.Resource = source.Resource 375 wholeResourceAccepted = true 376 case ActivityLog_FieldPathSelectorCategory: 377 result.Category = source.Category 378 case ActivityLog_FieldPathSelectorLabels: 379 result.Labels = source.Labels 380 wholeLabelsAccepted = true 381 case ActivityLog_FieldPathSelectorEvents: 382 result.Events = source.Events 383 wholeEventsAccepted = true 384 } 385 case *ActivityLog_FieldSubPath: 386 switch tp.selector { 387 case ActivityLog_FieldPathSelectorAuthentication: 388 authenticationMask.AppendPath(tp.subPath.(common.Authentication_FieldPath)) 389 case ActivityLog_FieldPathSelectorAuthorization: 390 authorizationMask.AppendPath(tp.subPath.(common.Authorization_FieldPath)) 391 case ActivityLog_FieldPathSelectorService: 392 serviceMask.AppendPath(tp.subPath.(common.ServiceData_FieldPath)) 393 case ActivityLog_FieldPathSelectorMethod: 394 methodMask.AppendPath(tp.subPath.(ActivityLogMethod_FieldPath)) 395 case ActivityLog_FieldPathSelectorRequestMetadata: 396 requestMetadataMask.AppendPath(tp.subPath.(ActivityLogRequestMetadata_FieldPath)) 397 case ActivityLog_FieldPathSelectorRequestRouting: 398 requestRoutingMask.AppendPath(tp.subPath.(ActivityLogRequestRouting_FieldPath)) 399 case ActivityLog_FieldPathSelectorResource: 400 resourceMask.AppendPath(tp.subPath.(ActivityLogResource_FieldPath)) 401 case ActivityLog_FieldPathSelectorEvents: 402 eventsMask.AppendPath(tp.subPath.(ActivityLogEvent_FieldPath)) 403 } 404 case *ActivityLog_FieldPathMap: 405 switch tp.selector { 406 case ActivityLog_FieldPathSelectorLabels: 407 labelsMapKeys = append(labelsMapKeys, tp.key) 408 } 409 } 410 } 411 if wholeAuthenticationAccepted == false && len(authenticationMask.Paths) > 0 { 412 result.Authentication = authenticationMask.Project(source.GetAuthentication()) 413 } 414 if wholeAuthorizationAccepted == false && len(authorizationMask.Paths) > 0 { 415 result.Authorization = authorizationMask.Project(source.GetAuthorization()) 416 } 417 if wholeServiceAccepted == false && len(serviceMask.Paths) > 0 { 418 result.Service = serviceMask.Project(source.GetService()) 419 } 420 if wholeMethodAccepted == false && len(methodMask.Paths) > 0 { 421 result.Method = methodMask.Project(source.GetMethod()) 422 } 423 if wholeRequestMetadataAccepted == false && len(requestMetadataMask.Paths) > 0 { 424 result.RequestMetadata = requestMetadataMask.Project(source.GetRequestMetadata()) 425 } 426 if wholeRequestRoutingAccepted == false && len(requestRoutingMask.Paths) > 0 { 427 result.RequestRouting = requestRoutingMask.Project(source.GetRequestRouting()) 428 } 429 if wholeResourceAccepted == false && len(resourceMask.Paths) > 0 { 430 result.Resource = resourceMask.Project(source.GetResource()) 431 } 432 if wholeLabelsAccepted == false && len(labelsMapKeys) > 0 && source.GetLabels() != nil { 433 copiedMap := map[string]string{} 434 sourceMap := source.GetLabels() 435 for _, key := range labelsMapKeys { 436 copiedMap[key] = sourceMap[key] 437 } 438 result.Labels = copiedMap 439 } 440 if wholeEventsAccepted == false && len(eventsMask.Paths) > 0 { 441 for _, sourceItem := range source.GetEvents() { 442 result.Events = append(result.Events, eventsMask.Project(sourceItem)) 443 } 444 } 445 return result 446 } 447 448 func (fieldMask *ActivityLog_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 449 return fieldMask.Project(source.(*ActivityLog)) 450 } 451 452 func (fieldMask *ActivityLog_FieldMask) PathsCount() int { 453 if fieldMask == nil { 454 return 0 455 } 456 return len(fieldMask.Paths) 457 } 458 459 type ActivityLog_Event_FieldMask struct { 460 Paths []ActivityLogEvent_FieldPath 461 } 462 463 func FullActivityLog_Event_FieldMask() *ActivityLog_Event_FieldMask { 464 res := &ActivityLog_Event_FieldMask{} 465 res.Paths = append(res.Paths, &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorClientMessage}) 466 res.Paths = append(res.Paths, &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorServerMessage}) 467 res.Paths = append(res.Paths, &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorExit}) 468 res.Paths = append(res.Paths, &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorRegionalServerMessage}) 469 res.Paths = append(res.Paths, &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorRegionalExit}) 470 return res 471 } 472 473 func (fieldMask *ActivityLog_Event_FieldMask) String() string { 474 if fieldMask == nil { 475 return "<nil>" 476 } 477 pathsStr := make([]string, 0, len(fieldMask.Paths)) 478 for _, path := range fieldMask.Paths { 479 pathsStr = append(pathsStr, path.String()) 480 } 481 return strings.Join(pathsStr, ", ") 482 } 483 484 func (fieldMask *ActivityLog_Event_FieldMask) IsFull() bool { 485 if fieldMask == nil { 486 return false 487 } 488 presentSelectors := make([]bool, 5) 489 for _, path := range fieldMask.Paths { 490 if asFinal, ok := path.(*ActivityLogEvent_FieldTerminalPath); ok { 491 presentSelectors[int(asFinal.selector)] = true 492 } 493 } 494 for _, flag := range presentSelectors { 495 if !flag { 496 return false 497 } 498 } 499 return true 500 } 501 502 func (fieldMask *ActivityLog_Event_FieldMask) ProtoReflect() preflect.Message { 503 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 504 return ParseActivityLogEvent_FieldPath(raw) 505 }) 506 } 507 508 func (fieldMask *ActivityLog_Event_FieldMask) ProtoMessage() {} 509 510 func (fieldMask *ActivityLog_Event_FieldMask) Reset() { 511 if fieldMask != nil { 512 fieldMask.Paths = nil 513 } 514 } 515 516 func (fieldMask *ActivityLog_Event_FieldMask) Subtract(other *ActivityLog_Event_FieldMask) *ActivityLog_Event_FieldMask { 517 result := &ActivityLog_Event_FieldMask{} 518 removedSelectors := make([]bool, 5) 519 otherSubMasks := map[ActivityLogEvent_FieldPathSelector]gotenobject.FieldMask{ 520 ActivityLogEvent_FieldPathSelectorClientMessage: &ActivityLog_Event_ClientMsgEvent_FieldMask{}, 521 ActivityLogEvent_FieldPathSelectorServerMessage: &ActivityLog_Event_ServerMsgEvent_FieldMask{}, 522 ActivityLogEvent_FieldPathSelectorExit: &ActivityLog_Event_ExitEvent_FieldMask{}, 523 ActivityLogEvent_FieldPathSelectorRegionalServerMessage: &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{}, 524 ActivityLogEvent_FieldPathSelectorRegionalExit: &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{}, 525 } 526 mySubMasks := map[ActivityLogEvent_FieldPathSelector]gotenobject.FieldMask{ 527 ActivityLogEvent_FieldPathSelectorClientMessage: &ActivityLog_Event_ClientMsgEvent_FieldMask{}, 528 ActivityLogEvent_FieldPathSelectorServerMessage: &ActivityLog_Event_ServerMsgEvent_FieldMask{}, 529 ActivityLogEvent_FieldPathSelectorExit: &ActivityLog_Event_ExitEvent_FieldMask{}, 530 ActivityLogEvent_FieldPathSelectorRegionalServerMessage: &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{}, 531 ActivityLogEvent_FieldPathSelectorRegionalExit: &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{}, 532 } 533 534 for _, path := range other.GetPaths() { 535 switch tp := path.(type) { 536 case *ActivityLogEvent_FieldTerminalPath: 537 removedSelectors[int(tp.selector)] = true 538 case *ActivityLogEvent_FieldSubPath: 539 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 540 } 541 } 542 for _, path := range fieldMask.GetPaths() { 543 if !removedSelectors[int(path.Selector())] { 544 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 545 if tp, ok := path.(*ActivityLogEvent_FieldTerminalPath); ok { 546 switch tp.selector { 547 case ActivityLogEvent_FieldPathSelectorClientMessage: 548 mySubMasks[ActivityLogEvent_FieldPathSelectorClientMessage] = FullActivityLog_Event_ClientMsgEvent_FieldMask() 549 case ActivityLogEvent_FieldPathSelectorServerMessage: 550 mySubMasks[ActivityLogEvent_FieldPathSelectorServerMessage] = FullActivityLog_Event_ServerMsgEvent_FieldMask() 551 case ActivityLogEvent_FieldPathSelectorExit: 552 mySubMasks[ActivityLogEvent_FieldPathSelectorExit] = FullActivityLog_Event_ExitEvent_FieldMask() 553 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 554 mySubMasks[ActivityLogEvent_FieldPathSelectorRegionalServerMessage] = FullActivityLog_Event_RegionalServerMsgEvent_FieldMask() 555 case ActivityLogEvent_FieldPathSelectorRegionalExit: 556 mySubMasks[ActivityLogEvent_FieldPathSelectorRegionalExit] = FullActivityLog_Event_RegionalServerMsgEvent_FieldMask() 557 } 558 } else if tp, ok := path.(*ActivityLogEvent_FieldSubPath); ok { 559 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 560 } 561 } else { 562 result.Paths = append(result.Paths, path) 563 } 564 } 565 } 566 for selector, mySubMask := range mySubMasks { 567 if mySubMask.PathsCount() > 0 { 568 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 569 result.Paths = append(result.Paths, &ActivityLogEvent_FieldSubPath{selector: selector, subPath: allowedPath}) 570 } 571 } 572 } 573 574 if len(result.Paths) == 0 { 575 return nil 576 } 577 return result 578 } 579 580 func (fieldMask *ActivityLog_Event_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 581 return fieldMask.Subtract(other.(*ActivityLog_Event_FieldMask)) 582 } 583 584 // FilterInputFields generates copy of field paths with output_only field paths removed 585 func (fieldMask *ActivityLog_Event_FieldMask) FilterInputFields() *ActivityLog_Event_FieldMask { 586 result := &ActivityLog_Event_FieldMask{} 587 result.Paths = append(result.Paths, fieldMask.Paths...) 588 return result 589 } 590 591 // ToFieldMask is used for proto conversions 592 func (fieldMask *ActivityLog_Event_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 593 protoFieldMask := &googlefieldmaskpb.FieldMask{} 594 for _, path := range fieldMask.Paths { 595 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 596 } 597 return protoFieldMask 598 } 599 600 func (fieldMask *ActivityLog_Event_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 601 if fieldMask == nil { 602 return status.Error(codes.Internal, "target field mask is nil") 603 } 604 fieldMask.Paths = make([]ActivityLogEvent_FieldPath, 0, len(protoFieldMask.Paths)) 605 for _, strPath := range protoFieldMask.Paths { 606 path, err := ParseActivityLogEvent_FieldPath(strPath) 607 if err != nil { 608 return err 609 } 610 fieldMask.Paths = append(fieldMask.Paths, path) 611 } 612 return nil 613 } 614 615 // implement methods required by customType 616 func (fieldMask ActivityLog_Event_FieldMask) Marshal() ([]byte, error) { 617 protoFieldMask := fieldMask.ToProtoFieldMask() 618 return proto.Marshal(protoFieldMask) 619 } 620 621 func (fieldMask *ActivityLog_Event_FieldMask) Unmarshal(data []byte) error { 622 protoFieldMask := &googlefieldmaskpb.FieldMask{} 623 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 624 return err 625 } 626 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 627 return err 628 } 629 return nil 630 } 631 632 func (fieldMask *ActivityLog_Event_FieldMask) Size() int { 633 return proto.Size(fieldMask.ToProtoFieldMask()) 634 } 635 636 func (fieldMask ActivityLog_Event_FieldMask) MarshalJSON() ([]byte, error) { 637 return json.Marshal(fieldMask.ToProtoFieldMask()) 638 } 639 640 func (fieldMask *ActivityLog_Event_FieldMask) UnmarshalJSON(data []byte) error { 641 protoFieldMask := &googlefieldmaskpb.FieldMask{} 642 if err := json.Unmarshal(data, protoFieldMask); err != nil { 643 return err 644 } 645 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 646 return err 647 } 648 return nil 649 } 650 651 func (fieldMask *ActivityLog_Event_FieldMask) AppendPath(path ActivityLogEvent_FieldPath) { 652 fieldMask.Paths = append(fieldMask.Paths, path) 653 } 654 655 func (fieldMask *ActivityLog_Event_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 656 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogEvent_FieldPath)) 657 } 658 659 func (fieldMask *ActivityLog_Event_FieldMask) GetPaths() []ActivityLogEvent_FieldPath { 660 if fieldMask == nil { 661 return nil 662 } 663 return fieldMask.Paths 664 } 665 666 func (fieldMask *ActivityLog_Event_FieldMask) GetRawPaths() []gotenobject.FieldPath { 667 if fieldMask == nil { 668 return nil 669 } 670 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 671 for _, path := range fieldMask.Paths { 672 rawPaths = append(rawPaths, path) 673 } 674 return rawPaths 675 } 676 677 func (fieldMask *ActivityLog_Event_FieldMask) SetFromCliFlag(raw string) error { 678 path, err := ParseActivityLogEvent_FieldPath(raw) 679 if err != nil { 680 return err 681 } 682 fieldMask.Paths = append(fieldMask.Paths, path) 683 return nil 684 } 685 686 func (fieldMask *ActivityLog_Event_FieldMask) Set(target, source *ActivityLog_Event) { 687 for _, path := range fieldMask.Paths { 688 val, _ := path.GetSingle(source) 689 // if val is nil, then field does not exist in source, skip 690 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 691 if val != nil { 692 path.WithIValue(val).SetTo(&target) 693 } 694 } 695 } 696 697 func (fieldMask *ActivityLog_Event_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 698 fieldMask.Set(target.(*ActivityLog_Event), source.(*ActivityLog_Event)) 699 } 700 701 func (fieldMask *ActivityLog_Event_FieldMask) Project(source *ActivityLog_Event) *ActivityLog_Event { 702 if source == nil { 703 return nil 704 } 705 if fieldMask == nil { 706 return source 707 } 708 result := &ActivityLog_Event{} 709 clientMessageMask := &ActivityLog_Event_ClientMsgEvent_FieldMask{} 710 wholeClientMessageAccepted := false 711 serverMessageMask := &ActivityLog_Event_ServerMsgEvent_FieldMask{} 712 wholeServerMessageAccepted := false 713 exitMask := &ActivityLog_Event_ExitEvent_FieldMask{} 714 wholeExitAccepted := false 715 regionalServerMessageMask := &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{} 716 wholeRegionalServerMessageAccepted := false 717 regionalExitMask := &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{} 718 wholeRegionalExitAccepted := false 719 720 for _, p := range fieldMask.Paths { 721 switch tp := p.(type) { 722 case *ActivityLogEvent_FieldTerminalPath: 723 switch tp.selector { 724 case ActivityLogEvent_FieldPathSelectorClientMessage: 725 if source, ok := source.Evt.(*ActivityLog_Event_ClientMessage); ok { 726 result.Evt = &ActivityLog_Event_ClientMessage{ 727 ClientMessage: source.ClientMessage, 728 } 729 } 730 wholeClientMessageAccepted = true 731 case ActivityLogEvent_FieldPathSelectorServerMessage: 732 if source, ok := source.Evt.(*ActivityLog_Event_ServerMessage); ok { 733 result.Evt = &ActivityLog_Event_ServerMessage{ 734 ServerMessage: source.ServerMessage, 735 } 736 } 737 wholeServerMessageAccepted = true 738 case ActivityLogEvent_FieldPathSelectorExit: 739 if source, ok := source.Evt.(*ActivityLog_Event_Exit); ok { 740 result.Evt = &ActivityLog_Event_Exit{ 741 Exit: source.Exit, 742 } 743 } 744 wholeExitAccepted = true 745 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 746 if source, ok := source.Evt.(*ActivityLog_Event_RegionalServerMessage); ok { 747 result.Evt = &ActivityLog_Event_RegionalServerMessage{ 748 RegionalServerMessage: source.RegionalServerMessage, 749 } 750 } 751 wholeRegionalServerMessageAccepted = true 752 case ActivityLogEvent_FieldPathSelectorRegionalExit: 753 if source, ok := source.Evt.(*ActivityLog_Event_RegionalExit); ok { 754 result.Evt = &ActivityLog_Event_RegionalExit{ 755 RegionalExit: source.RegionalExit, 756 } 757 } 758 wholeRegionalExitAccepted = true 759 } 760 case *ActivityLogEvent_FieldSubPath: 761 switch tp.selector { 762 case ActivityLogEvent_FieldPathSelectorClientMessage: 763 clientMessageMask.AppendPath(tp.subPath.(ActivityLogEventClientMsgEvent_FieldPath)) 764 case ActivityLogEvent_FieldPathSelectorServerMessage: 765 serverMessageMask.AppendPath(tp.subPath.(ActivityLogEventServerMsgEvent_FieldPath)) 766 case ActivityLogEvent_FieldPathSelectorExit: 767 exitMask.AppendPath(tp.subPath.(ActivityLogEventExitEvent_FieldPath)) 768 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 769 regionalServerMessageMask.AppendPath(tp.subPath.(ActivityLogEventRegionalServerMsgEvent_FieldPath)) 770 case ActivityLogEvent_FieldPathSelectorRegionalExit: 771 regionalExitMask.AppendPath(tp.subPath.(ActivityLogEventRegionalServerMsgEvent_FieldPath)) 772 } 773 } 774 } 775 if wholeClientMessageAccepted == false && len(clientMessageMask.Paths) > 0 { 776 if asOneOf, ok := source.Evt.(*ActivityLog_Event_ClientMessage); ok { 777 result.Evt = (*ActivityLog_Event_ClientMessage)(nil) 778 if asOneOf != nil { 779 oneOfRes := &ActivityLog_Event_ClientMessage{} 780 oneOfRes.ClientMessage = clientMessageMask.Project(asOneOf.ClientMessage) 781 result.Evt = oneOfRes 782 } 783 } 784 } 785 if wholeServerMessageAccepted == false && len(serverMessageMask.Paths) > 0 { 786 if asOneOf, ok := source.Evt.(*ActivityLog_Event_ServerMessage); ok { 787 result.Evt = (*ActivityLog_Event_ServerMessage)(nil) 788 if asOneOf != nil { 789 oneOfRes := &ActivityLog_Event_ServerMessage{} 790 oneOfRes.ServerMessage = serverMessageMask.Project(asOneOf.ServerMessage) 791 result.Evt = oneOfRes 792 } 793 } 794 } 795 if wholeExitAccepted == false && len(exitMask.Paths) > 0 { 796 if asOneOf, ok := source.Evt.(*ActivityLog_Event_Exit); ok { 797 result.Evt = (*ActivityLog_Event_Exit)(nil) 798 if asOneOf != nil { 799 oneOfRes := &ActivityLog_Event_Exit{} 800 oneOfRes.Exit = exitMask.Project(asOneOf.Exit) 801 result.Evt = oneOfRes 802 } 803 } 804 } 805 if wholeRegionalServerMessageAccepted == false && len(regionalServerMessageMask.Paths) > 0 { 806 if asOneOf, ok := source.Evt.(*ActivityLog_Event_RegionalServerMessage); ok { 807 result.Evt = (*ActivityLog_Event_RegionalServerMessage)(nil) 808 if asOneOf != nil { 809 oneOfRes := &ActivityLog_Event_RegionalServerMessage{} 810 oneOfRes.RegionalServerMessage = regionalServerMessageMask.Project(asOneOf.RegionalServerMessage) 811 result.Evt = oneOfRes 812 } 813 } 814 } 815 if wholeRegionalExitAccepted == false && len(regionalExitMask.Paths) > 0 { 816 if asOneOf, ok := source.Evt.(*ActivityLog_Event_RegionalExit); ok { 817 result.Evt = (*ActivityLog_Event_RegionalExit)(nil) 818 if asOneOf != nil { 819 oneOfRes := &ActivityLog_Event_RegionalExit{} 820 oneOfRes.RegionalExit = regionalExitMask.Project(asOneOf.RegionalExit) 821 result.Evt = oneOfRes 822 } 823 } 824 } 825 return result 826 } 827 828 func (fieldMask *ActivityLog_Event_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 829 return fieldMask.Project(source.(*ActivityLog_Event)) 830 } 831 832 func (fieldMask *ActivityLog_Event_FieldMask) PathsCount() int { 833 if fieldMask == nil { 834 return 0 835 } 836 return len(fieldMask.Paths) 837 } 838 839 type ActivityLog_Method_FieldMask struct { 840 Paths []ActivityLogMethod_FieldPath 841 } 842 843 func FullActivityLog_Method_FieldMask() *ActivityLog_Method_FieldMask { 844 res := &ActivityLog_Method_FieldMask{} 845 res.Paths = append(res.Paths, &ActivityLogMethod_FieldTerminalPath{selector: ActivityLogMethod_FieldPathSelectorType}) 846 res.Paths = append(res.Paths, &ActivityLogMethod_FieldTerminalPath{selector: ActivityLogMethod_FieldPathSelectorVersion}) 847 return res 848 } 849 850 func (fieldMask *ActivityLog_Method_FieldMask) String() string { 851 if fieldMask == nil { 852 return "<nil>" 853 } 854 pathsStr := make([]string, 0, len(fieldMask.Paths)) 855 for _, path := range fieldMask.Paths { 856 pathsStr = append(pathsStr, path.String()) 857 } 858 return strings.Join(pathsStr, ", ") 859 } 860 861 func (fieldMask *ActivityLog_Method_FieldMask) IsFull() bool { 862 if fieldMask == nil { 863 return false 864 } 865 presentSelectors := make([]bool, 2) 866 for _, path := range fieldMask.Paths { 867 if asFinal, ok := path.(*ActivityLogMethod_FieldTerminalPath); ok { 868 presentSelectors[int(asFinal.selector)] = true 869 } 870 } 871 for _, flag := range presentSelectors { 872 if !flag { 873 return false 874 } 875 } 876 return true 877 } 878 879 func (fieldMask *ActivityLog_Method_FieldMask) ProtoReflect() preflect.Message { 880 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 881 return ParseActivityLogMethod_FieldPath(raw) 882 }) 883 } 884 885 func (fieldMask *ActivityLog_Method_FieldMask) ProtoMessage() {} 886 887 func (fieldMask *ActivityLog_Method_FieldMask) Reset() { 888 if fieldMask != nil { 889 fieldMask.Paths = nil 890 } 891 } 892 893 func (fieldMask *ActivityLog_Method_FieldMask) Subtract(other *ActivityLog_Method_FieldMask) *ActivityLog_Method_FieldMask { 894 result := &ActivityLog_Method_FieldMask{} 895 removedSelectors := make([]bool, 2) 896 897 for _, path := range other.GetPaths() { 898 switch tp := path.(type) { 899 case *ActivityLogMethod_FieldTerminalPath: 900 removedSelectors[int(tp.selector)] = true 901 } 902 } 903 for _, path := range fieldMask.GetPaths() { 904 if !removedSelectors[int(path.Selector())] { 905 result.Paths = append(result.Paths, path) 906 } 907 } 908 909 if len(result.Paths) == 0 { 910 return nil 911 } 912 return result 913 } 914 915 func (fieldMask *ActivityLog_Method_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 916 return fieldMask.Subtract(other.(*ActivityLog_Method_FieldMask)) 917 } 918 919 // FilterInputFields generates copy of field paths with output_only field paths removed 920 func (fieldMask *ActivityLog_Method_FieldMask) FilterInputFields() *ActivityLog_Method_FieldMask { 921 result := &ActivityLog_Method_FieldMask{} 922 result.Paths = append(result.Paths, fieldMask.Paths...) 923 return result 924 } 925 926 // ToFieldMask is used for proto conversions 927 func (fieldMask *ActivityLog_Method_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 928 protoFieldMask := &googlefieldmaskpb.FieldMask{} 929 for _, path := range fieldMask.Paths { 930 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 931 } 932 return protoFieldMask 933 } 934 935 func (fieldMask *ActivityLog_Method_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 936 if fieldMask == nil { 937 return status.Error(codes.Internal, "target field mask is nil") 938 } 939 fieldMask.Paths = make([]ActivityLogMethod_FieldPath, 0, len(protoFieldMask.Paths)) 940 for _, strPath := range protoFieldMask.Paths { 941 path, err := ParseActivityLogMethod_FieldPath(strPath) 942 if err != nil { 943 return err 944 } 945 fieldMask.Paths = append(fieldMask.Paths, path) 946 } 947 return nil 948 } 949 950 // implement methods required by customType 951 func (fieldMask ActivityLog_Method_FieldMask) Marshal() ([]byte, error) { 952 protoFieldMask := fieldMask.ToProtoFieldMask() 953 return proto.Marshal(protoFieldMask) 954 } 955 956 func (fieldMask *ActivityLog_Method_FieldMask) Unmarshal(data []byte) error { 957 protoFieldMask := &googlefieldmaskpb.FieldMask{} 958 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 959 return err 960 } 961 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 962 return err 963 } 964 return nil 965 } 966 967 func (fieldMask *ActivityLog_Method_FieldMask) Size() int { 968 return proto.Size(fieldMask.ToProtoFieldMask()) 969 } 970 971 func (fieldMask ActivityLog_Method_FieldMask) MarshalJSON() ([]byte, error) { 972 return json.Marshal(fieldMask.ToProtoFieldMask()) 973 } 974 975 func (fieldMask *ActivityLog_Method_FieldMask) UnmarshalJSON(data []byte) error { 976 protoFieldMask := &googlefieldmaskpb.FieldMask{} 977 if err := json.Unmarshal(data, protoFieldMask); err != nil { 978 return err 979 } 980 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 981 return err 982 } 983 return nil 984 } 985 986 func (fieldMask *ActivityLog_Method_FieldMask) AppendPath(path ActivityLogMethod_FieldPath) { 987 fieldMask.Paths = append(fieldMask.Paths, path) 988 } 989 990 func (fieldMask *ActivityLog_Method_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 991 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogMethod_FieldPath)) 992 } 993 994 func (fieldMask *ActivityLog_Method_FieldMask) GetPaths() []ActivityLogMethod_FieldPath { 995 if fieldMask == nil { 996 return nil 997 } 998 return fieldMask.Paths 999 } 1000 1001 func (fieldMask *ActivityLog_Method_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1002 if fieldMask == nil { 1003 return nil 1004 } 1005 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1006 for _, path := range fieldMask.Paths { 1007 rawPaths = append(rawPaths, path) 1008 } 1009 return rawPaths 1010 } 1011 1012 func (fieldMask *ActivityLog_Method_FieldMask) SetFromCliFlag(raw string) error { 1013 path, err := ParseActivityLogMethod_FieldPath(raw) 1014 if err != nil { 1015 return err 1016 } 1017 fieldMask.Paths = append(fieldMask.Paths, path) 1018 return nil 1019 } 1020 1021 func (fieldMask *ActivityLog_Method_FieldMask) Set(target, source *ActivityLog_Method) { 1022 for _, path := range fieldMask.Paths { 1023 val, _ := path.GetSingle(source) 1024 // if val is nil, then field does not exist in source, skip 1025 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1026 if val != nil { 1027 path.WithIValue(val).SetTo(&target) 1028 } 1029 } 1030 } 1031 1032 func (fieldMask *ActivityLog_Method_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1033 fieldMask.Set(target.(*ActivityLog_Method), source.(*ActivityLog_Method)) 1034 } 1035 1036 func (fieldMask *ActivityLog_Method_FieldMask) Project(source *ActivityLog_Method) *ActivityLog_Method { 1037 if source == nil { 1038 return nil 1039 } 1040 if fieldMask == nil { 1041 return source 1042 } 1043 result := &ActivityLog_Method{} 1044 1045 for _, p := range fieldMask.Paths { 1046 switch tp := p.(type) { 1047 case *ActivityLogMethod_FieldTerminalPath: 1048 switch tp.selector { 1049 case ActivityLogMethod_FieldPathSelectorType: 1050 result.Type = source.Type 1051 case ActivityLogMethod_FieldPathSelectorVersion: 1052 result.Version = source.Version 1053 } 1054 } 1055 } 1056 return result 1057 } 1058 1059 func (fieldMask *ActivityLog_Method_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1060 return fieldMask.Project(source.(*ActivityLog_Method)) 1061 } 1062 1063 func (fieldMask *ActivityLog_Method_FieldMask) PathsCount() int { 1064 if fieldMask == nil { 1065 return 0 1066 } 1067 return len(fieldMask.Paths) 1068 } 1069 1070 type ActivityLog_RequestMetadata_FieldMask struct { 1071 Paths []ActivityLogRequestMetadata_FieldPath 1072 } 1073 1074 func FullActivityLog_RequestMetadata_FieldMask() *ActivityLog_RequestMetadata_FieldMask { 1075 res := &ActivityLog_RequestMetadata_FieldMask{} 1076 res.Paths = append(res.Paths, &ActivityLogRequestMetadata_FieldTerminalPath{selector: ActivityLogRequestMetadata_FieldPathSelectorIpAddress}) 1077 res.Paths = append(res.Paths, &ActivityLogRequestMetadata_FieldTerminalPath{selector: ActivityLogRequestMetadata_FieldPathSelectorUserAgent}) 1078 return res 1079 } 1080 1081 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) String() string { 1082 if fieldMask == nil { 1083 return "<nil>" 1084 } 1085 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1086 for _, path := range fieldMask.Paths { 1087 pathsStr = append(pathsStr, path.String()) 1088 } 1089 return strings.Join(pathsStr, ", ") 1090 } 1091 1092 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) IsFull() bool { 1093 if fieldMask == nil { 1094 return false 1095 } 1096 presentSelectors := make([]bool, 2) 1097 for _, path := range fieldMask.Paths { 1098 if asFinal, ok := path.(*ActivityLogRequestMetadata_FieldTerminalPath); ok { 1099 presentSelectors[int(asFinal.selector)] = true 1100 } 1101 } 1102 for _, flag := range presentSelectors { 1103 if !flag { 1104 return false 1105 } 1106 } 1107 return true 1108 } 1109 1110 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) ProtoReflect() preflect.Message { 1111 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1112 return ParseActivityLogRequestMetadata_FieldPath(raw) 1113 }) 1114 } 1115 1116 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) ProtoMessage() {} 1117 1118 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) Reset() { 1119 if fieldMask != nil { 1120 fieldMask.Paths = nil 1121 } 1122 } 1123 1124 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) Subtract(other *ActivityLog_RequestMetadata_FieldMask) *ActivityLog_RequestMetadata_FieldMask { 1125 result := &ActivityLog_RequestMetadata_FieldMask{} 1126 removedSelectors := make([]bool, 2) 1127 1128 for _, path := range other.GetPaths() { 1129 switch tp := path.(type) { 1130 case *ActivityLogRequestMetadata_FieldTerminalPath: 1131 removedSelectors[int(tp.selector)] = true 1132 } 1133 } 1134 for _, path := range fieldMask.GetPaths() { 1135 if !removedSelectors[int(path.Selector())] { 1136 result.Paths = append(result.Paths, path) 1137 } 1138 } 1139 1140 if len(result.Paths) == 0 { 1141 return nil 1142 } 1143 return result 1144 } 1145 1146 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1147 return fieldMask.Subtract(other.(*ActivityLog_RequestMetadata_FieldMask)) 1148 } 1149 1150 // FilterInputFields generates copy of field paths with output_only field paths removed 1151 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) FilterInputFields() *ActivityLog_RequestMetadata_FieldMask { 1152 result := &ActivityLog_RequestMetadata_FieldMask{} 1153 result.Paths = append(result.Paths, fieldMask.Paths...) 1154 return result 1155 } 1156 1157 // ToFieldMask is used for proto conversions 1158 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1159 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1160 for _, path := range fieldMask.Paths { 1161 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1162 } 1163 return protoFieldMask 1164 } 1165 1166 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1167 if fieldMask == nil { 1168 return status.Error(codes.Internal, "target field mask is nil") 1169 } 1170 fieldMask.Paths = make([]ActivityLogRequestMetadata_FieldPath, 0, len(protoFieldMask.Paths)) 1171 for _, strPath := range protoFieldMask.Paths { 1172 path, err := ParseActivityLogRequestMetadata_FieldPath(strPath) 1173 if err != nil { 1174 return err 1175 } 1176 fieldMask.Paths = append(fieldMask.Paths, path) 1177 } 1178 return nil 1179 } 1180 1181 // implement methods required by customType 1182 func (fieldMask ActivityLog_RequestMetadata_FieldMask) Marshal() ([]byte, error) { 1183 protoFieldMask := fieldMask.ToProtoFieldMask() 1184 return proto.Marshal(protoFieldMask) 1185 } 1186 1187 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) Unmarshal(data []byte) error { 1188 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1189 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1190 return err 1191 } 1192 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1193 return err 1194 } 1195 return nil 1196 } 1197 1198 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) Size() int { 1199 return proto.Size(fieldMask.ToProtoFieldMask()) 1200 } 1201 1202 func (fieldMask ActivityLog_RequestMetadata_FieldMask) MarshalJSON() ([]byte, error) { 1203 return json.Marshal(fieldMask.ToProtoFieldMask()) 1204 } 1205 1206 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) UnmarshalJSON(data []byte) error { 1207 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1208 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1209 return err 1210 } 1211 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1212 return err 1213 } 1214 return nil 1215 } 1216 1217 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) AppendPath(path ActivityLogRequestMetadata_FieldPath) { 1218 fieldMask.Paths = append(fieldMask.Paths, path) 1219 } 1220 1221 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1222 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogRequestMetadata_FieldPath)) 1223 } 1224 1225 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) GetPaths() []ActivityLogRequestMetadata_FieldPath { 1226 if fieldMask == nil { 1227 return nil 1228 } 1229 return fieldMask.Paths 1230 } 1231 1232 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1233 if fieldMask == nil { 1234 return nil 1235 } 1236 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1237 for _, path := range fieldMask.Paths { 1238 rawPaths = append(rawPaths, path) 1239 } 1240 return rawPaths 1241 } 1242 1243 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) SetFromCliFlag(raw string) error { 1244 path, err := ParseActivityLogRequestMetadata_FieldPath(raw) 1245 if err != nil { 1246 return err 1247 } 1248 fieldMask.Paths = append(fieldMask.Paths, path) 1249 return nil 1250 } 1251 1252 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) Set(target, source *ActivityLog_RequestMetadata) { 1253 for _, path := range fieldMask.Paths { 1254 val, _ := path.GetSingle(source) 1255 // if val is nil, then field does not exist in source, skip 1256 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1257 if val != nil { 1258 path.WithIValue(val).SetTo(&target) 1259 } 1260 } 1261 } 1262 1263 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1264 fieldMask.Set(target.(*ActivityLog_RequestMetadata), source.(*ActivityLog_RequestMetadata)) 1265 } 1266 1267 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) Project(source *ActivityLog_RequestMetadata) *ActivityLog_RequestMetadata { 1268 if source == nil { 1269 return nil 1270 } 1271 if fieldMask == nil { 1272 return source 1273 } 1274 result := &ActivityLog_RequestMetadata{} 1275 1276 for _, p := range fieldMask.Paths { 1277 switch tp := p.(type) { 1278 case *ActivityLogRequestMetadata_FieldTerminalPath: 1279 switch tp.selector { 1280 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 1281 result.IpAddress = source.IpAddress 1282 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 1283 result.UserAgent = source.UserAgent 1284 } 1285 } 1286 } 1287 return result 1288 } 1289 1290 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1291 return fieldMask.Project(source.(*ActivityLog_RequestMetadata)) 1292 } 1293 1294 func (fieldMask *ActivityLog_RequestMetadata_FieldMask) PathsCount() int { 1295 if fieldMask == nil { 1296 return 0 1297 } 1298 return len(fieldMask.Paths) 1299 } 1300 1301 type ActivityLog_RequestRouting_FieldMask struct { 1302 Paths []ActivityLogRequestRouting_FieldPath 1303 } 1304 1305 func FullActivityLog_RequestRouting_FieldMask() *ActivityLog_RequestRouting_FieldMask { 1306 res := &ActivityLog_RequestRouting_FieldMask{} 1307 res.Paths = append(res.Paths, &ActivityLogRequestRouting_FieldTerminalPath{selector: ActivityLogRequestRouting_FieldPathSelectorViaRegion}) 1308 res.Paths = append(res.Paths, &ActivityLogRequestRouting_FieldTerminalPath{selector: ActivityLogRequestRouting_FieldPathSelectorDestRegions}) 1309 return res 1310 } 1311 1312 func (fieldMask *ActivityLog_RequestRouting_FieldMask) String() string { 1313 if fieldMask == nil { 1314 return "<nil>" 1315 } 1316 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1317 for _, path := range fieldMask.Paths { 1318 pathsStr = append(pathsStr, path.String()) 1319 } 1320 return strings.Join(pathsStr, ", ") 1321 } 1322 1323 func (fieldMask *ActivityLog_RequestRouting_FieldMask) IsFull() bool { 1324 if fieldMask == nil { 1325 return false 1326 } 1327 presentSelectors := make([]bool, 2) 1328 for _, path := range fieldMask.Paths { 1329 if asFinal, ok := path.(*ActivityLogRequestRouting_FieldTerminalPath); ok { 1330 presentSelectors[int(asFinal.selector)] = true 1331 } 1332 } 1333 for _, flag := range presentSelectors { 1334 if !flag { 1335 return false 1336 } 1337 } 1338 return true 1339 } 1340 1341 func (fieldMask *ActivityLog_RequestRouting_FieldMask) ProtoReflect() preflect.Message { 1342 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1343 return ParseActivityLogRequestRouting_FieldPath(raw) 1344 }) 1345 } 1346 1347 func (fieldMask *ActivityLog_RequestRouting_FieldMask) ProtoMessage() {} 1348 1349 func (fieldMask *ActivityLog_RequestRouting_FieldMask) Reset() { 1350 if fieldMask != nil { 1351 fieldMask.Paths = nil 1352 } 1353 } 1354 1355 func (fieldMask *ActivityLog_RequestRouting_FieldMask) Subtract(other *ActivityLog_RequestRouting_FieldMask) *ActivityLog_RequestRouting_FieldMask { 1356 result := &ActivityLog_RequestRouting_FieldMask{} 1357 removedSelectors := make([]bool, 2) 1358 1359 for _, path := range other.GetPaths() { 1360 switch tp := path.(type) { 1361 case *ActivityLogRequestRouting_FieldTerminalPath: 1362 removedSelectors[int(tp.selector)] = true 1363 } 1364 } 1365 for _, path := range fieldMask.GetPaths() { 1366 if !removedSelectors[int(path.Selector())] { 1367 result.Paths = append(result.Paths, path) 1368 } 1369 } 1370 1371 if len(result.Paths) == 0 { 1372 return nil 1373 } 1374 return result 1375 } 1376 1377 func (fieldMask *ActivityLog_RequestRouting_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1378 return fieldMask.Subtract(other.(*ActivityLog_RequestRouting_FieldMask)) 1379 } 1380 1381 // FilterInputFields generates copy of field paths with output_only field paths removed 1382 func (fieldMask *ActivityLog_RequestRouting_FieldMask) FilterInputFields() *ActivityLog_RequestRouting_FieldMask { 1383 result := &ActivityLog_RequestRouting_FieldMask{} 1384 result.Paths = append(result.Paths, fieldMask.Paths...) 1385 return result 1386 } 1387 1388 // ToFieldMask is used for proto conversions 1389 func (fieldMask *ActivityLog_RequestRouting_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1390 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1391 for _, path := range fieldMask.Paths { 1392 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1393 } 1394 return protoFieldMask 1395 } 1396 1397 func (fieldMask *ActivityLog_RequestRouting_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1398 if fieldMask == nil { 1399 return status.Error(codes.Internal, "target field mask is nil") 1400 } 1401 fieldMask.Paths = make([]ActivityLogRequestRouting_FieldPath, 0, len(protoFieldMask.Paths)) 1402 for _, strPath := range protoFieldMask.Paths { 1403 path, err := ParseActivityLogRequestRouting_FieldPath(strPath) 1404 if err != nil { 1405 return err 1406 } 1407 fieldMask.Paths = append(fieldMask.Paths, path) 1408 } 1409 return nil 1410 } 1411 1412 // implement methods required by customType 1413 func (fieldMask ActivityLog_RequestRouting_FieldMask) Marshal() ([]byte, error) { 1414 protoFieldMask := fieldMask.ToProtoFieldMask() 1415 return proto.Marshal(protoFieldMask) 1416 } 1417 1418 func (fieldMask *ActivityLog_RequestRouting_FieldMask) Unmarshal(data []byte) error { 1419 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1420 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1421 return err 1422 } 1423 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1424 return err 1425 } 1426 return nil 1427 } 1428 1429 func (fieldMask *ActivityLog_RequestRouting_FieldMask) Size() int { 1430 return proto.Size(fieldMask.ToProtoFieldMask()) 1431 } 1432 1433 func (fieldMask ActivityLog_RequestRouting_FieldMask) MarshalJSON() ([]byte, error) { 1434 return json.Marshal(fieldMask.ToProtoFieldMask()) 1435 } 1436 1437 func (fieldMask *ActivityLog_RequestRouting_FieldMask) UnmarshalJSON(data []byte) error { 1438 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1439 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1440 return err 1441 } 1442 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1443 return err 1444 } 1445 return nil 1446 } 1447 1448 func (fieldMask *ActivityLog_RequestRouting_FieldMask) AppendPath(path ActivityLogRequestRouting_FieldPath) { 1449 fieldMask.Paths = append(fieldMask.Paths, path) 1450 } 1451 1452 func (fieldMask *ActivityLog_RequestRouting_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1453 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogRequestRouting_FieldPath)) 1454 } 1455 1456 func (fieldMask *ActivityLog_RequestRouting_FieldMask) GetPaths() []ActivityLogRequestRouting_FieldPath { 1457 if fieldMask == nil { 1458 return nil 1459 } 1460 return fieldMask.Paths 1461 } 1462 1463 func (fieldMask *ActivityLog_RequestRouting_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1464 if fieldMask == nil { 1465 return nil 1466 } 1467 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1468 for _, path := range fieldMask.Paths { 1469 rawPaths = append(rawPaths, path) 1470 } 1471 return rawPaths 1472 } 1473 1474 func (fieldMask *ActivityLog_RequestRouting_FieldMask) SetFromCliFlag(raw string) error { 1475 path, err := ParseActivityLogRequestRouting_FieldPath(raw) 1476 if err != nil { 1477 return err 1478 } 1479 fieldMask.Paths = append(fieldMask.Paths, path) 1480 return nil 1481 } 1482 1483 func (fieldMask *ActivityLog_RequestRouting_FieldMask) Set(target, source *ActivityLog_RequestRouting) { 1484 for _, path := range fieldMask.Paths { 1485 val, _ := path.GetSingle(source) 1486 // if val is nil, then field does not exist in source, skip 1487 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1488 if val != nil { 1489 path.WithIValue(val).SetTo(&target) 1490 } 1491 } 1492 } 1493 1494 func (fieldMask *ActivityLog_RequestRouting_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1495 fieldMask.Set(target.(*ActivityLog_RequestRouting), source.(*ActivityLog_RequestRouting)) 1496 } 1497 1498 func (fieldMask *ActivityLog_RequestRouting_FieldMask) Project(source *ActivityLog_RequestRouting) *ActivityLog_RequestRouting { 1499 if source == nil { 1500 return nil 1501 } 1502 if fieldMask == nil { 1503 return source 1504 } 1505 result := &ActivityLog_RequestRouting{} 1506 1507 for _, p := range fieldMask.Paths { 1508 switch tp := p.(type) { 1509 case *ActivityLogRequestRouting_FieldTerminalPath: 1510 switch tp.selector { 1511 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 1512 result.ViaRegion = source.ViaRegion 1513 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 1514 result.DestRegions = source.DestRegions 1515 } 1516 } 1517 } 1518 return result 1519 } 1520 1521 func (fieldMask *ActivityLog_RequestRouting_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1522 return fieldMask.Project(source.(*ActivityLog_RequestRouting)) 1523 } 1524 1525 func (fieldMask *ActivityLog_RequestRouting_FieldMask) PathsCount() int { 1526 if fieldMask == nil { 1527 return 0 1528 } 1529 return len(fieldMask.Paths) 1530 } 1531 1532 type ActivityLog_Resource_FieldMask struct { 1533 Paths []ActivityLogResource_FieldPath 1534 } 1535 1536 func FullActivityLog_Resource_FieldMask() *ActivityLog_Resource_FieldMask { 1537 res := &ActivityLog_Resource_FieldMask{} 1538 res.Paths = append(res.Paths, &ActivityLogResource_FieldTerminalPath{selector: ActivityLogResource_FieldPathSelectorName}) 1539 res.Paths = append(res.Paths, &ActivityLogResource_FieldTerminalPath{selector: ActivityLogResource_FieldPathSelectorDifference}) 1540 return res 1541 } 1542 1543 func (fieldMask *ActivityLog_Resource_FieldMask) String() string { 1544 if fieldMask == nil { 1545 return "<nil>" 1546 } 1547 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1548 for _, path := range fieldMask.Paths { 1549 pathsStr = append(pathsStr, path.String()) 1550 } 1551 return strings.Join(pathsStr, ", ") 1552 } 1553 1554 func (fieldMask *ActivityLog_Resource_FieldMask) IsFull() bool { 1555 if fieldMask == nil { 1556 return false 1557 } 1558 presentSelectors := make([]bool, 2) 1559 for _, path := range fieldMask.Paths { 1560 if asFinal, ok := path.(*ActivityLogResource_FieldTerminalPath); ok { 1561 presentSelectors[int(asFinal.selector)] = true 1562 } 1563 } 1564 for _, flag := range presentSelectors { 1565 if !flag { 1566 return false 1567 } 1568 } 1569 return true 1570 } 1571 1572 func (fieldMask *ActivityLog_Resource_FieldMask) ProtoReflect() preflect.Message { 1573 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1574 return ParseActivityLogResource_FieldPath(raw) 1575 }) 1576 } 1577 1578 func (fieldMask *ActivityLog_Resource_FieldMask) ProtoMessage() {} 1579 1580 func (fieldMask *ActivityLog_Resource_FieldMask) Reset() { 1581 if fieldMask != nil { 1582 fieldMask.Paths = nil 1583 } 1584 } 1585 1586 func (fieldMask *ActivityLog_Resource_FieldMask) Subtract(other *ActivityLog_Resource_FieldMask) *ActivityLog_Resource_FieldMask { 1587 result := &ActivityLog_Resource_FieldMask{} 1588 removedSelectors := make([]bool, 2) 1589 otherSubMasks := map[ActivityLogResource_FieldPathSelector]gotenobject.FieldMask{ 1590 ActivityLogResource_FieldPathSelectorDifference: &ActivityLog_Resource_Difference_FieldMask{}, 1591 } 1592 mySubMasks := map[ActivityLogResource_FieldPathSelector]gotenobject.FieldMask{ 1593 ActivityLogResource_FieldPathSelectorDifference: &ActivityLog_Resource_Difference_FieldMask{}, 1594 } 1595 1596 for _, path := range other.GetPaths() { 1597 switch tp := path.(type) { 1598 case *ActivityLogResource_FieldTerminalPath: 1599 removedSelectors[int(tp.selector)] = true 1600 case *ActivityLogResource_FieldSubPath: 1601 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 1602 } 1603 } 1604 for _, path := range fieldMask.GetPaths() { 1605 if !removedSelectors[int(path.Selector())] { 1606 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 1607 if tp, ok := path.(*ActivityLogResource_FieldTerminalPath); ok { 1608 switch tp.selector { 1609 case ActivityLogResource_FieldPathSelectorDifference: 1610 mySubMasks[ActivityLogResource_FieldPathSelectorDifference] = FullActivityLog_Resource_Difference_FieldMask() 1611 } 1612 } else if tp, ok := path.(*ActivityLogResource_FieldSubPath); ok { 1613 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 1614 } 1615 } else { 1616 result.Paths = append(result.Paths, path) 1617 } 1618 } 1619 } 1620 for selector, mySubMask := range mySubMasks { 1621 if mySubMask.PathsCount() > 0 { 1622 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 1623 result.Paths = append(result.Paths, &ActivityLogResource_FieldSubPath{selector: selector, subPath: allowedPath}) 1624 } 1625 } 1626 } 1627 1628 if len(result.Paths) == 0 { 1629 return nil 1630 } 1631 return result 1632 } 1633 1634 func (fieldMask *ActivityLog_Resource_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1635 return fieldMask.Subtract(other.(*ActivityLog_Resource_FieldMask)) 1636 } 1637 1638 // FilterInputFields generates copy of field paths with output_only field paths removed 1639 func (fieldMask *ActivityLog_Resource_FieldMask) FilterInputFields() *ActivityLog_Resource_FieldMask { 1640 result := &ActivityLog_Resource_FieldMask{} 1641 result.Paths = append(result.Paths, fieldMask.Paths...) 1642 return result 1643 } 1644 1645 // ToFieldMask is used for proto conversions 1646 func (fieldMask *ActivityLog_Resource_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1647 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1648 for _, path := range fieldMask.Paths { 1649 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1650 } 1651 return protoFieldMask 1652 } 1653 1654 func (fieldMask *ActivityLog_Resource_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1655 if fieldMask == nil { 1656 return status.Error(codes.Internal, "target field mask is nil") 1657 } 1658 fieldMask.Paths = make([]ActivityLogResource_FieldPath, 0, len(protoFieldMask.Paths)) 1659 for _, strPath := range protoFieldMask.Paths { 1660 path, err := ParseActivityLogResource_FieldPath(strPath) 1661 if err != nil { 1662 return err 1663 } 1664 fieldMask.Paths = append(fieldMask.Paths, path) 1665 } 1666 return nil 1667 } 1668 1669 // implement methods required by customType 1670 func (fieldMask ActivityLog_Resource_FieldMask) Marshal() ([]byte, error) { 1671 protoFieldMask := fieldMask.ToProtoFieldMask() 1672 return proto.Marshal(protoFieldMask) 1673 } 1674 1675 func (fieldMask *ActivityLog_Resource_FieldMask) Unmarshal(data []byte) error { 1676 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1677 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1678 return err 1679 } 1680 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1681 return err 1682 } 1683 return nil 1684 } 1685 1686 func (fieldMask *ActivityLog_Resource_FieldMask) Size() int { 1687 return proto.Size(fieldMask.ToProtoFieldMask()) 1688 } 1689 1690 func (fieldMask ActivityLog_Resource_FieldMask) MarshalJSON() ([]byte, error) { 1691 return json.Marshal(fieldMask.ToProtoFieldMask()) 1692 } 1693 1694 func (fieldMask *ActivityLog_Resource_FieldMask) UnmarshalJSON(data []byte) error { 1695 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1696 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1697 return err 1698 } 1699 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1700 return err 1701 } 1702 return nil 1703 } 1704 1705 func (fieldMask *ActivityLog_Resource_FieldMask) AppendPath(path ActivityLogResource_FieldPath) { 1706 fieldMask.Paths = append(fieldMask.Paths, path) 1707 } 1708 1709 func (fieldMask *ActivityLog_Resource_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1710 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogResource_FieldPath)) 1711 } 1712 1713 func (fieldMask *ActivityLog_Resource_FieldMask) GetPaths() []ActivityLogResource_FieldPath { 1714 if fieldMask == nil { 1715 return nil 1716 } 1717 return fieldMask.Paths 1718 } 1719 1720 func (fieldMask *ActivityLog_Resource_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1721 if fieldMask == nil { 1722 return nil 1723 } 1724 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1725 for _, path := range fieldMask.Paths { 1726 rawPaths = append(rawPaths, path) 1727 } 1728 return rawPaths 1729 } 1730 1731 func (fieldMask *ActivityLog_Resource_FieldMask) SetFromCliFlag(raw string) error { 1732 path, err := ParseActivityLogResource_FieldPath(raw) 1733 if err != nil { 1734 return err 1735 } 1736 fieldMask.Paths = append(fieldMask.Paths, path) 1737 return nil 1738 } 1739 1740 func (fieldMask *ActivityLog_Resource_FieldMask) Set(target, source *ActivityLog_Resource) { 1741 for _, path := range fieldMask.Paths { 1742 val, _ := path.GetSingle(source) 1743 // if val is nil, then field does not exist in source, skip 1744 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1745 if val != nil { 1746 path.WithIValue(val).SetTo(&target) 1747 } 1748 } 1749 } 1750 1751 func (fieldMask *ActivityLog_Resource_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1752 fieldMask.Set(target.(*ActivityLog_Resource), source.(*ActivityLog_Resource)) 1753 } 1754 1755 func (fieldMask *ActivityLog_Resource_FieldMask) Project(source *ActivityLog_Resource) *ActivityLog_Resource { 1756 if source == nil { 1757 return nil 1758 } 1759 if fieldMask == nil { 1760 return source 1761 } 1762 result := &ActivityLog_Resource{} 1763 differenceMask := &ActivityLog_Resource_Difference_FieldMask{} 1764 wholeDifferenceAccepted := false 1765 1766 for _, p := range fieldMask.Paths { 1767 switch tp := p.(type) { 1768 case *ActivityLogResource_FieldTerminalPath: 1769 switch tp.selector { 1770 case ActivityLogResource_FieldPathSelectorName: 1771 result.Name = source.Name 1772 case ActivityLogResource_FieldPathSelectorDifference: 1773 result.Difference = source.Difference 1774 wholeDifferenceAccepted = true 1775 } 1776 case *ActivityLogResource_FieldSubPath: 1777 switch tp.selector { 1778 case ActivityLogResource_FieldPathSelectorDifference: 1779 differenceMask.AppendPath(tp.subPath.(ActivityLogResourceDifference_FieldPath)) 1780 } 1781 } 1782 } 1783 if wholeDifferenceAccepted == false && len(differenceMask.Paths) > 0 { 1784 result.Difference = differenceMask.Project(source.GetDifference()) 1785 } 1786 return result 1787 } 1788 1789 func (fieldMask *ActivityLog_Resource_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 1790 return fieldMask.Project(source.(*ActivityLog_Resource)) 1791 } 1792 1793 func (fieldMask *ActivityLog_Resource_FieldMask) PathsCount() int { 1794 if fieldMask == nil { 1795 return 0 1796 } 1797 return len(fieldMask.Paths) 1798 } 1799 1800 type ActivityLog_Event_ClientMsgEvent_FieldMask struct { 1801 Paths []ActivityLogEventClientMsgEvent_FieldPath 1802 } 1803 1804 func FullActivityLog_Event_ClientMsgEvent_FieldMask() *ActivityLog_Event_ClientMsgEvent_FieldMask { 1805 res := &ActivityLog_Event_ClientMsgEvent_FieldMask{} 1806 res.Paths = append(res.Paths, &ActivityLogEventClientMsgEvent_FieldTerminalPath{selector: ActivityLogEventClientMsgEvent_FieldPathSelectorData}) 1807 res.Paths = append(res.Paths, &ActivityLogEventClientMsgEvent_FieldTerminalPath{selector: ActivityLogEventClientMsgEvent_FieldPathSelectorTime}) 1808 return res 1809 } 1810 1811 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) String() string { 1812 if fieldMask == nil { 1813 return "<nil>" 1814 } 1815 pathsStr := make([]string, 0, len(fieldMask.Paths)) 1816 for _, path := range fieldMask.Paths { 1817 pathsStr = append(pathsStr, path.String()) 1818 } 1819 return strings.Join(pathsStr, ", ") 1820 } 1821 1822 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) IsFull() bool { 1823 if fieldMask == nil { 1824 return false 1825 } 1826 presentSelectors := make([]bool, 2) 1827 for _, path := range fieldMask.Paths { 1828 if asFinal, ok := path.(*ActivityLogEventClientMsgEvent_FieldTerminalPath); ok { 1829 presentSelectors[int(asFinal.selector)] = true 1830 } 1831 } 1832 for _, flag := range presentSelectors { 1833 if !flag { 1834 return false 1835 } 1836 } 1837 return true 1838 } 1839 1840 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) ProtoReflect() preflect.Message { 1841 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 1842 return ParseActivityLogEventClientMsgEvent_FieldPath(raw) 1843 }) 1844 } 1845 1846 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) ProtoMessage() {} 1847 1848 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) Reset() { 1849 if fieldMask != nil { 1850 fieldMask.Paths = nil 1851 } 1852 } 1853 1854 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) Subtract(other *ActivityLog_Event_ClientMsgEvent_FieldMask) *ActivityLog_Event_ClientMsgEvent_FieldMask { 1855 result := &ActivityLog_Event_ClientMsgEvent_FieldMask{} 1856 removedSelectors := make([]bool, 2) 1857 1858 for _, path := range other.GetPaths() { 1859 switch tp := path.(type) { 1860 case *ActivityLogEventClientMsgEvent_FieldTerminalPath: 1861 removedSelectors[int(tp.selector)] = true 1862 } 1863 } 1864 for _, path := range fieldMask.GetPaths() { 1865 if !removedSelectors[int(path.Selector())] { 1866 result.Paths = append(result.Paths, path) 1867 } 1868 } 1869 1870 if len(result.Paths) == 0 { 1871 return nil 1872 } 1873 return result 1874 } 1875 1876 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 1877 return fieldMask.Subtract(other.(*ActivityLog_Event_ClientMsgEvent_FieldMask)) 1878 } 1879 1880 // FilterInputFields generates copy of field paths with output_only field paths removed 1881 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) FilterInputFields() *ActivityLog_Event_ClientMsgEvent_FieldMask { 1882 result := &ActivityLog_Event_ClientMsgEvent_FieldMask{} 1883 result.Paths = append(result.Paths, fieldMask.Paths...) 1884 return result 1885 } 1886 1887 // ToFieldMask is used for proto conversions 1888 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 1889 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1890 for _, path := range fieldMask.Paths { 1891 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 1892 } 1893 return protoFieldMask 1894 } 1895 1896 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 1897 if fieldMask == nil { 1898 return status.Error(codes.Internal, "target field mask is nil") 1899 } 1900 fieldMask.Paths = make([]ActivityLogEventClientMsgEvent_FieldPath, 0, len(protoFieldMask.Paths)) 1901 for _, strPath := range protoFieldMask.Paths { 1902 path, err := ParseActivityLogEventClientMsgEvent_FieldPath(strPath) 1903 if err != nil { 1904 return err 1905 } 1906 fieldMask.Paths = append(fieldMask.Paths, path) 1907 } 1908 return nil 1909 } 1910 1911 // implement methods required by customType 1912 func (fieldMask ActivityLog_Event_ClientMsgEvent_FieldMask) Marshal() ([]byte, error) { 1913 protoFieldMask := fieldMask.ToProtoFieldMask() 1914 return proto.Marshal(protoFieldMask) 1915 } 1916 1917 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) Unmarshal(data []byte) error { 1918 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1919 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 1920 return err 1921 } 1922 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1923 return err 1924 } 1925 return nil 1926 } 1927 1928 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) Size() int { 1929 return proto.Size(fieldMask.ToProtoFieldMask()) 1930 } 1931 1932 func (fieldMask ActivityLog_Event_ClientMsgEvent_FieldMask) MarshalJSON() ([]byte, error) { 1933 return json.Marshal(fieldMask.ToProtoFieldMask()) 1934 } 1935 1936 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) UnmarshalJSON(data []byte) error { 1937 protoFieldMask := &googlefieldmaskpb.FieldMask{} 1938 if err := json.Unmarshal(data, protoFieldMask); err != nil { 1939 return err 1940 } 1941 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 1942 return err 1943 } 1944 return nil 1945 } 1946 1947 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) AppendPath(path ActivityLogEventClientMsgEvent_FieldPath) { 1948 fieldMask.Paths = append(fieldMask.Paths, path) 1949 } 1950 1951 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 1952 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogEventClientMsgEvent_FieldPath)) 1953 } 1954 1955 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) GetPaths() []ActivityLogEventClientMsgEvent_FieldPath { 1956 if fieldMask == nil { 1957 return nil 1958 } 1959 return fieldMask.Paths 1960 } 1961 1962 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) GetRawPaths() []gotenobject.FieldPath { 1963 if fieldMask == nil { 1964 return nil 1965 } 1966 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 1967 for _, path := range fieldMask.Paths { 1968 rawPaths = append(rawPaths, path) 1969 } 1970 return rawPaths 1971 } 1972 1973 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) SetFromCliFlag(raw string) error { 1974 path, err := ParseActivityLogEventClientMsgEvent_FieldPath(raw) 1975 if err != nil { 1976 return err 1977 } 1978 fieldMask.Paths = append(fieldMask.Paths, path) 1979 return nil 1980 } 1981 1982 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) Set(target, source *ActivityLog_Event_ClientMsgEvent) { 1983 for _, path := range fieldMask.Paths { 1984 val, _ := path.GetSingle(source) 1985 // if val is nil, then field does not exist in source, skip 1986 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 1987 if val != nil { 1988 path.WithIValue(val).SetTo(&target) 1989 } 1990 } 1991 } 1992 1993 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 1994 fieldMask.Set(target.(*ActivityLog_Event_ClientMsgEvent), source.(*ActivityLog_Event_ClientMsgEvent)) 1995 } 1996 1997 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) Project(source *ActivityLog_Event_ClientMsgEvent) *ActivityLog_Event_ClientMsgEvent { 1998 if source == nil { 1999 return nil 2000 } 2001 if fieldMask == nil { 2002 return source 2003 } 2004 result := &ActivityLog_Event_ClientMsgEvent{} 2005 2006 for _, p := range fieldMask.Paths { 2007 switch tp := p.(type) { 2008 case *ActivityLogEventClientMsgEvent_FieldTerminalPath: 2009 switch tp.selector { 2010 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 2011 result.Data = source.Data 2012 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 2013 result.Time = source.Time 2014 } 2015 } 2016 } 2017 return result 2018 } 2019 2020 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2021 return fieldMask.Project(source.(*ActivityLog_Event_ClientMsgEvent)) 2022 } 2023 2024 func (fieldMask *ActivityLog_Event_ClientMsgEvent_FieldMask) PathsCount() int { 2025 if fieldMask == nil { 2026 return 0 2027 } 2028 return len(fieldMask.Paths) 2029 } 2030 2031 type ActivityLog_Event_RegionalServerMsgEvent_FieldMask struct { 2032 Paths []ActivityLogEventRegionalServerMsgEvent_FieldPath 2033 } 2034 2035 func FullActivityLog_Event_RegionalServerMsgEvent_FieldMask() *ActivityLog_Event_RegionalServerMsgEvent_FieldMask { 2036 res := &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{} 2037 res.Paths = append(res.Paths, &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData}) 2038 res.Paths = append(res.Paths, &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime}) 2039 res.Paths = append(res.Paths, &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId}) 2040 return res 2041 } 2042 2043 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) String() string { 2044 if fieldMask == nil { 2045 return "<nil>" 2046 } 2047 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2048 for _, path := range fieldMask.Paths { 2049 pathsStr = append(pathsStr, path.String()) 2050 } 2051 return strings.Join(pathsStr, ", ") 2052 } 2053 2054 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) IsFull() bool { 2055 if fieldMask == nil { 2056 return false 2057 } 2058 presentSelectors := make([]bool, 3) 2059 for _, path := range fieldMask.Paths { 2060 if asFinal, ok := path.(*ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath); ok { 2061 presentSelectors[int(asFinal.selector)] = true 2062 } 2063 } 2064 for _, flag := range presentSelectors { 2065 if !flag { 2066 return false 2067 } 2068 } 2069 return true 2070 } 2071 2072 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) ProtoReflect() preflect.Message { 2073 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2074 return ParseActivityLogEventRegionalServerMsgEvent_FieldPath(raw) 2075 }) 2076 } 2077 2078 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) ProtoMessage() {} 2079 2080 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) Reset() { 2081 if fieldMask != nil { 2082 fieldMask.Paths = nil 2083 } 2084 } 2085 2086 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) Subtract(other *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) *ActivityLog_Event_RegionalServerMsgEvent_FieldMask { 2087 result := &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{} 2088 removedSelectors := make([]bool, 3) 2089 2090 for _, path := range other.GetPaths() { 2091 switch tp := path.(type) { 2092 case *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: 2093 removedSelectors[int(tp.selector)] = true 2094 } 2095 } 2096 for _, path := range fieldMask.GetPaths() { 2097 if !removedSelectors[int(path.Selector())] { 2098 result.Paths = append(result.Paths, path) 2099 } 2100 } 2101 2102 if len(result.Paths) == 0 { 2103 return nil 2104 } 2105 return result 2106 } 2107 2108 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2109 return fieldMask.Subtract(other.(*ActivityLog_Event_RegionalServerMsgEvent_FieldMask)) 2110 } 2111 2112 // FilterInputFields generates copy of field paths with output_only field paths removed 2113 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) FilterInputFields() *ActivityLog_Event_RegionalServerMsgEvent_FieldMask { 2114 result := &ActivityLog_Event_RegionalServerMsgEvent_FieldMask{} 2115 result.Paths = append(result.Paths, fieldMask.Paths...) 2116 return result 2117 } 2118 2119 // ToFieldMask is used for proto conversions 2120 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2121 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2122 for _, path := range fieldMask.Paths { 2123 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2124 } 2125 return protoFieldMask 2126 } 2127 2128 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2129 if fieldMask == nil { 2130 return status.Error(codes.Internal, "target field mask is nil") 2131 } 2132 fieldMask.Paths = make([]ActivityLogEventRegionalServerMsgEvent_FieldPath, 0, len(protoFieldMask.Paths)) 2133 for _, strPath := range protoFieldMask.Paths { 2134 path, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPath(strPath) 2135 if err != nil { 2136 return err 2137 } 2138 fieldMask.Paths = append(fieldMask.Paths, path) 2139 } 2140 return nil 2141 } 2142 2143 // implement methods required by customType 2144 func (fieldMask ActivityLog_Event_RegionalServerMsgEvent_FieldMask) Marshal() ([]byte, error) { 2145 protoFieldMask := fieldMask.ToProtoFieldMask() 2146 return proto.Marshal(protoFieldMask) 2147 } 2148 2149 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) Unmarshal(data []byte) error { 2150 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2151 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2152 return err 2153 } 2154 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2155 return err 2156 } 2157 return nil 2158 } 2159 2160 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) Size() int { 2161 return proto.Size(fieldMask.ToProtoFieldMask()) 2162 } 2163 2164 func (fieldMask ActivityLog_Event_RegionalServerMsgEvent_FieldMask) MarshalJSON() ([]byte, error) { 2165 return json.Marshal(fieldMask.ToProtoFieldMask()) 2166 } 2167 2168 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) UnmarshalJSON(data []byte) error { 2169 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2170 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2171 return err 2172 } 2173 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2174 return err 2175 } 2176 return nil 2177 } 2178 2179 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) AppendPath(path ActivityLogEventRegionalServerMsgEvent_FieldPath) { 2180 fieldMask.Paths = append(fieldMask.Paths, path) 2181 } 2182 2183 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2184 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogEventRegionalServerMsgEvent_FieldPath)) 2185 } 2186 2187 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) GetPaths() []ActivityLogEventRegionalServerMsgEvent_FieldPath { 2188 if fieldMask == nil { 2189 return nil 2190 } 2191 return fieldMask.Paths 2192 } 2193 2194 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2195 if fieldMask == nil { 2196 return nil 2197 } 2198 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2199 for _, path := range fieldMask.Paths { 2200 rawPaths = append(rawPaths, path) 2201 } 2202 return rawPaths 2203 } 2204 2205 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) SetFromCliFlag(raw string) error { 2206 path, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPath(raw) 2207 if err != nil { 2208 return err 2209 } 2210 fieldMask.Paths = append(fieldMask.Paths, path) 2211 return nil 2212 } 2213 2214 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) Set(target, source *ActivityLog_Event_RegionalServerMsgEvent) { 2215 for _, path := range fieldMask.Paths { 2216 val, _ := path.GetSingle(source) 2217 // if val is nil, then field does not exist in source, skip 2218 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2219 if val != nil { 2220 path.WithIValue(val).SetTo(&target) 2221 } 2222 } 2223 } 2224 2225 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2226 fieldMask.Set(target.(*ActivityLog_Event_RegionalServerMsgEvent), source.(*ActivityLog_Event_RegionalServerMsgEvent)) 2227 } 2228 2229 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) Project(source *ActivityLog_Event_RegionalServerMsgEvent) *ActivityLog_Event_RegionalServerMsgEvent { 2230 if source == nil { 2231 return nil 2232 } 2233 if fieldMask == nil { 2234 return source 2235 } 2236 result := &ActivityLog_Event_RegionalServerMsgEvent{} 2237 2238 for _, p := range fieldMask.Paths { 2239 switch tp := p.(type) { 2240 case *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: 2241 switch tp.selector { 2242 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 2243 result.Data = source.Data 2244 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 2245 result.Time = source.Time 2246 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 2247 result.RegionId = source.RegionId 2248 } 2249 } 2250 } 2251 return result 2252 } 2253 2254 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2255 return fieldMask.Project(source.(*ActivityLog_Event_RegionalServerMsgEvent)) 2256 } 2257 2258 func (fieldMask *ActivityLog_Event_RegionalServerMsgEvent_FieldMask) PathsCount() int { 2259 if fieldMask == nil { 2260 return 0 2261 } 2262 return len(fieldMask.Paths) 2263 } 2264 2265 type ActivityLog_Event_ServerMsgEvent_FieldMask struct { 2266 Paths []ActivityLogEventServerMsgEvent_FieldPath 2267 } 2268 2269 func FullActivityLog_Event_ServerMsgEvent_FieldMask() *ActivityLog_Event_ServerMsgEvent_FieldMask { 2270 res := &ActivityLog_Event_ServerMsgEvent_FieldMask{} 2271 res.Paths = append(res.Paths, &ActivityLogEventServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventServerMsgEvent_FieldPathSelectorData}) 2272 res.Paths = append(res.Paths, &ActivityLogEventServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventServerMsgEvent_FieldPathSelectorTime}) 2273 return res 2274 } 2275 2276 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) String() string { 2277 if fieldMask == nil { 2278 return "<nil>" 2279 } 2280 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2281 for _, path := range fieldMask.Paths { 2282 pathsStr = append(pathsStr, path.String()) 2283 } 2284 return strings.Join(pathsStr, ", ") 2285 } 2286 2287 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) IsFull() bool { 2288 if fieldMask == nil { 2289 return false 2290 } 2291 presentSelectors := make([]bool, 2) 2292 for _, path := range fieldMask.Paths { 2293 if asFinal, ok := path.(*ActivityLogEventServerMsgEvent_FieldTerminalPath); ok { 2294 presentSelectors[int(asFinal.selector)] = true 2295 } 2296 } 2297 for _, flag := range presentSelectors { 2298 if !flag { 2299 return false 2300 } 2301 } 2302 return true 2303 } 2304 2305 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) ProtoReflect() preflect.Message { 2306 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2307 return ParseActivityLogEventServerMsgEvent_FieldPath(raw) 2308 }) 2309 } 2310 2311 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) ProtoMessage() {} 2312 2313 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) Reset() { 2314 if fieldMask != nil { 2315 fieldMask.Paths = nil 2316 } 2317 } 2318 2319 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) Subtract(other *ActivityLog_Event_ServerMsgEvent_FieldMask) *ActivityLog_Event_ServerMsgEvent_FieldMask { 2320 result := &ActivityLog_Event_ServerMsgEvent_FieldMask{} 2321 removedSelectors := make([]bool, 2) 2322 2323 for _, path := range other.GetPaths() { 2324 switch tp := path.(type) { 2325 case *ActivityLogEventServerMsgEvent_FieldTerminalPath: 2326 removedSelectors[int(tp.selector)] = true 2327 } 2328 } 2329 for _, path := range fieldMask.GetPaths() { 2330 if !removedSelectors[int(path.Selector())] { 2331 result.Paths = append(result.Paths, path) 2332 } 2333 } 2334 2335 if len(result.Paths) == 0 { 2336 return nil 2337 } 2338 return result 2339 } 2340 2341 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2342 return fieldMask.Subtract(other.(*ActivityLog_Event_ServerMsgEvent_FieldMask)) 2343 } 2344 2345 // FilterInputFields generates copy of field paths with output_only field paths removed 2346 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) FilterInputFields() *ActivityLog_Event_ServerMsgEvent_FieldMask { 2347 result := &ActivityLog_Event_ServerMsgEvent_FieldMask{} 2348 result.Paths = append(result.Paths, fieldMask.Paths...) 2349 return result 2350 } 2351 2352 // ToFieldMask is used for proto conversions 2353 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2354 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2355 for _, path := range fieldMask.Paths { 2356 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2357 } 2358 return protoFieldMask 2359 } 2360 2361 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2362 if fieldMask == nil { 2363 return status.Error(codes.Internal, "target field mask is nil") 2364 } 2365 fieldMask.Paths = make([]ActivityLogEventServerMsgEvent_FieldPath, 0, len(protoFieldMask.Paths)) 2366 for _, strPath := range protoFieldMask.Paths { 2367 path, err := ParseActivityLogEventServerMsgEvent_FieldPath(strPath) 2368 if err != nil { 2369 return err 2370 } 2371 fieldMask.Paths = append(fieldMask.Paths, path) 2372 } 2373 return nil 2374 } 2375 2376 // implement methods required by customType 2377 func (fieldMask ActivityLog_Event_ServerMsgEvent_FieldMask) Marshal() ([]byte, error) { 2378 protoFieldMask := fieldMask.ToProtoFieldMask() 2379 return proto.Marshal(protoFieldMask) 2380 } 2381 2382 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) Unmarshal(data []byte) error { 2383 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2384 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2385 return err 2386 } 2387 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2388 return err 2389 } 2390 return nil 2391 } 2392 2393 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) Size() int { 2394 return proto.Size(fieldMask.ToProtoFieldMask()) 2395 } 2396 2397 func (fieldMask ActivityLog_Event_ServerMsgEvent_FieldMask) MarshalJSON() ([]byte, error) { 2398 return json.Marshal(fieldMask.ToProtoFieldMask()) 2399 } 2400 2401 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) UnmarshalJSON(data []byte) error { 2402 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2403 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2404 return err 2405 } 2406 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2407 return err 2408 } 2409 return nil 2410 } 2411 2412 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) AppendPath(path ActivityLogEventServerMsgEvent_FieldPath) { 2413 fieldMask.Paths = append(fieldMask.Paths, path) 2414 } 2415 2416 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2417 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogEventServerMsgEvent_FieldPath)) 2418 } 2419 2420 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) GetPaths() []ActivityLogEventServerMsgEvent_FieldPath { 2421 if fieldMask == nil { 2422 return nil 2423 } 2424 return fieldMask.Paths 2425 } 2426 2427 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2428 if fieldMask == nil { 2429 return nil 2430 } 2431 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2432 for _, path := range fieldMask.Paths { 2433 rawPaths = append(rawPaths, path) 2434 } 2435 return rawPaths 2436 } 2437 2438 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) SetFromCliFlag(raw string) error { 2439 path, err := ParseActivityLogEventServerMsgEvent_FieldPath(raw) 2440 if err != nil { 2441 return err 2442 } 2443 fieldMask.Paths = append(fieldMask.Paths, path) 2444 return nil 2445 } 2446 2447 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) Set(target, source *ActivityLog_Event_ServerMsgEvent) { 2448 for _, path := range fieldMask.Paths { 2449 val, _ := path.GetSingle(source) 2450 // if val is nil, then field does not exist in source, skip 2451 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2452 if val != nil { 2453 path.WithIValue(val).SetTo(&target) 2454 } 2455 } 2456 } 2457 2458 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2459 fieldMask.Set(target.(*ActivityLog_Event_ServerMsgEvent), source.(*ActivityLog_Event_ServerMsgEvent)) 2460 } 2461 2462 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) Project(source *ActivityLog_Event_ServerMsgEvent) *ActivityLog_Event_ServerMsgEvent { 2463 if source == nil { 2464 return nil 2465 } 2466 if fieldMask == nil { 2467 return source 2468 } 2469 result := &ActivityLog_Event_ServerMsgEvent{} 2470 2471 for _, p := range fieldMask.Paths { 2472 switch tp := p.(type) { 2473 case *ActivityLogEventServerMsgEvent_FieldTerminalPath: 2474 switch tp.selector { 2475 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 2476 result.Data = source.Data 2477 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 2478 result.Time = source.Time 2479 } 2480 } 2481 } 2482 return result 2483 } 2484 2485 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2486 return fieldMask.Project(source.(*ActivityLog_Event_ServerMsgEvent)) 2487 } 2488 2489 func (fieldMask *ActivityLog_Event_ServerMsgEvent_FieldMask) PathsCount() int { 2490 if fieldMask == nil { 2491 return 0 2492 } 2493 return len(fieldMask.Paths) 2494 } 2495 2496 type ActivityLog_Event_RegionalExitEvent_FieldMask struct { 2497 Paths []ActivityLogEventRegionalExitEvent_FieldPath 2498 } 2499 2500 func FullActivityLog_Event_RegionalExitEvent_FieldMask() *ActivityLog_Event_RegionalExitEvent_FieldMask { 2501 res := &ActivityLog_Event_RegionalExitEvent_FieldMask{} 2502 res.Paths = append(res.Paths, &ActivityLogEventRegionalExitEvent_FieldTerminalPath{selector: ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus}) 2503 res.Paths = append(res.Paths, &ActivityLogEventRegionalExitEvent_FieldTerminalPath{selector: ActivityLogEventRegionalExitEvent_FieldPathSelectorTime}) 2504 res.Paths = append(res.Paths, &ActivityLogEventRegionalExitEvent_FieldTerminalPath{selector: ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId}) 2505 return res 2506 } 2507 2508 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) String() string { 2509 if fieldMask == nil { 2510 return "<nil>" 2511 } 2512 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2513 for _, path := range fieldMask.Paths { 2514 pathsStr = append(pathsStr, path.String()) 2515 } 2516 return strings.Join(pathsStr, ", ") 2517 } 2518 2519 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) IsFull() bool { 2520 if fieldMask == nil { 2521 return false 2522 } 2523 presentSelectors := make([]bool, 3) 2524 for _, path := range fieldMask.Paths { 2525 if asFinal, ok := path.(*ActivityLogEventRegionalExitEvent_FieldTerminalPath); ok { 2526 presentSelectors[int(asFinal.selector)] = true 2527 } 2528 } 2529 for _, flag := range presentSelectors { 2530 if !flag { 2531 return false 2532 } 2533 } 2534 return true 2535 } 2536 2537 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) ProtoReflect() preflect.Message { 2538 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2539 return ParseActivityLogEventRegionalExitEvent_FieldPath(raw) 2540 }) 2541 } 2542 2543 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) ProtoMessage() {} 2544 2545 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) Reset() { 2546 if fieldMask != nil { 2547 fieldMask.Paths = nil 2548 } 2549 } 2550 2551 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) Subtract(other *ActivityLog_Event_RegionalExitEvent_FieldMask) *ActivityLog_Event_RegionalExitEvent_FieldMask { 2552 result := &ActivityLog_Event_RegionalExitEvent_FieldMask{} 2553 removedSelectors := make([]bool, 3) 2554 otherSubMasks := map[ActivityLogEventRegionalExitEvent_FieldPathSelector]gotenobject.FieldMask{ 2555 ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: &rpc.Status_FieldMask{}, 2556 } 2557 mySubMasks := map[ActivityLogEventRegionalExitEvent_FieldPathSelector]gotenobject.FieldMask{ 2558 ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: &rpc.Status_FieldMask{}, 2559 } 2560 2561 for _, path := range other.GetPaths() { 2562 switch tp := path.(type) { 2563 case *ActivityLogEventRegionalExitEvent_FieldTerminalPath: 2564 removedSelectors[int(tp.selector)] = true 2565 case *ActivityLogEventRegionalExitEvent_FieldSubPath: 2566 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 2567 } 2568 } 2569 for _, path := range fieldMask.GetPaths() { 2570 if !removedSelectors[int(path.Selector())] { 2571 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 2572 if tp, ok := path.(*ActivityLogEventRegionalExitEvent_FieldTerminalPath); ok { 2573 switch tp.selector { 2574 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 2575 mySubMasks[ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus] = rpc.FullStatus_FieldMask() 2576 } 2577 } else if tp, ok := path.(*ActivityLogEventRegionalExitEvent_FieldSubPath); ok { 2578 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 2579 } 2580 } else { 2581 result.Paths = append(result.Paths, path) 2582 } 2583 } 2584 } 2585 for selector, mySubMask := range mySubMasks { 2586 if mySubMask.PathsCount() > 0 { 2587 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 2588 result.Paths = append(result.Paths, &ActivityLogEventRegionalExitEvent_FieldSubPath{selector: selector, subPath: allowedPath}) 2589 } 2590 } 2591 } 2592 2593 if len(result.Paths) == 0 { 2594 return nil 2595 } 2596 return result 2597 } 2598 2599 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2600 return fieldMask.Subtract(other.(*ActivityLog_Event_RegionalExitEvent_FieldMask)) 2601 } 2602 2603 // FilterInputFields generates copy of field paths with output_only field paths removed 2604 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) FilterInputFields() *ActivityLog_Event_RegionalExitEvent_FieldMask { 2605 result := &ActivityLog_Event_RegionalExitEvent_FieldMask{} 2606 result.Paths = append(result.Paths, fieldMask.Paths...) 2607 return result 2608 } 2609 2610 // ToFieldMask is used for proto conversions 2611 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2612 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2613 for _, path := range fieldMask.Paths { 2614 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2615 } 2616 return protoFieldMask 2617 } 2618 2619 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2620 if fieldMask == nil { 2621 return status.Error(codes.Internal, "target field mask is nil") 2622 } 2623 fieldMask.Paths = make([]ActivityLogEventRegionalExitEvent_FieldPath, 0, len(protoFieldMask.Paths)) 2624 for _, strPath := range protoFieldMask.Paths { 2625 path, err := ParseActivityLogEventRegionalExitEvent_FieldPath(strPath) 2626 if err != nil { 2627 return err 2628 } 2629 fieldMask.Paths = append(fieldMask.Paths, path) 2630 } 2631 return nil 2632 } 2633 2634 // implement methods required by customType 2635 func (fieldMask ActivityLog_Event_RegionalExitEvent_FieldMask) Marshal() ([]byte, error) { 2636 protoFieldMask := fieldMask.ToProtoFieldMask() 2637 return proto.Marshal(protoFieldMask) 2638 } 2639 2640 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) Unmarshal(data []byte) error { 2641 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2642 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2643 return err 2644 } 2645 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2646 return err 2647 } 2648 return nil 2649 } 2650 2651 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) Size() int { 2652 return proto.Size(fieldMask.ToProtoFieldMask()) 2653 } 2654 2655 func (fieldMask ActivityLog_Event_RegionalExitEvent_FieldMask) MarshalJSON() ([]byte, error) { 2656 return json.Marshal(fieldMask.ToProtoFieldMask()) 2657 } 2658 2659 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) UnmarshalJSON(data []byte) error { 2660 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2661 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2662 return err 2663 } 2664 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2665 return err 2666 } 2667 return nil 2668 } 2669 2670 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) AppendPath(path ActivityLogEventRegionalExitEvent_FieldPath) { 2671 fieldMask.Paths = append(fieldMask.Paths, path) 2672 } 2673 2674 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2675 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogEventRegionalExitEvent_FieldPath)) 2676 } 2677 2678 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) GetPaths() []ActivityLogEventRegionalExitEvent_FieldPath { 2679 if fieldMask == nil { 2680 return nil 2681 } 2682 return fieldMask.Paths 2683 } 2684 2685 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2686 if fieldMask == nil { 2687 return nil 2688 } 2689 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2690 for _, path := range fieldMask.Paths { 2691 rawPaths = append(rawPaths, path) 2692 } 2693 return rawPaths 2694 } 2695 2696 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) SetFromCliFlag(raw string) error { 2697 path, err := ParseActivityLogEventRegionalExitEvent_FieldPath(raw) 2698 if err != nil { 2699 return err 2700 } 2701 fieldMask.Paths = append(fieldMask.Paths, path) 2702 return nil 2703 } 2704 2705 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) Set(target, source *ActivityLog_Event_RegionalExitEvent) { 2706 for _, path := range fieldMask.Paths { 2707 val, _ := path.GetSingle(source) 2708 // if val is nil, then field does not exist in source, skip 2709 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2710 if val != nil { 2711 path.WithIValue(val).SetTo(&target) 2712 } 2713 } 2714 } 2715 2716 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2717 fieldMask.Set(target.(*ActivityLog_Event_RegionalExitEvent), source.(*ActivityLog_Event_RegionalExitEvent)) 2718 } 2719 2720 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) Project(source *ActivityLog_Event_RegionalExitEvent) *ActivityLog_Event_RegionalExitEvent { 2721 if source == nil { 2722 return nil 2723 } 2724 if fieldMask == nil { 2725 return source 2726 } 2727 result := &ActivityLog_Event_RegionalExitEvent{} 2728 statusMask := &rpc.Status_FieldMask{} 2729 wholeStatusAccepted := false 2730 2731 for _, p := range fieldMask.Paths { 2732 switch tp := p.(type) { 2733 case *ActivityLogEventRegionalExitEvent_FieldTerminalPath: 2734 switch tp.selector { 2735 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 2736 result.Status = source.Status 2737 wholeStatusAccepted = true 2738 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 2739 result.Time = source.Time 2740 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 2741 result.RegionId = source.RegionId 2742 } 2743 case *ActivityLogEventRegionalExitEvent_FieldSubPath: 2744 switch tp.selector { 2745 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 2746 statusMask.AppendPath(tp.subPath.(rpc.Status_FieldPath)) 2747 } 2748 } 2749 } 2750 if wholeStatusAccepted == false && len(statusMask.Paths) > 0 { 2751 result.Status = statusMask.Project(source.GetStatus()) 2752 } 2753 return result 2754 } 2755 2756 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 2757 return fieldMask.Project(source.(*ActivityLog_Event_RegionalExitEvent)) 2758 } 2759 2760 func (fieldMask *ActivityLog_Event_RegionalExitEvent_FieldMask) PathsCount() int { 2761 if fieldMask == nil { 2762 return 0 2763 } 2764 return len(fieldMask.Paths) 2765 } 2766 2767 type ActivityLog_Event_ExitEvent_FieldMask struct { 2768 Paths []ActivityLogEventExitEvent_FieldPath 2769 } 2770 2771 func FullActivityLog_Event_ExitEvent_FieldMask() *ActivityLog_Event_ExitEvent_FieldMask { 2772 res := &ActivityLog_Event_ExitEvent_FieldMask{} 2773 res.Paths = append(res.Paths, &ActivityLogEventExitEvent_FieldTerminalPath{selector: ActivityLogEventExitEvent_FieldPathSelectorStatus}) 2774 res.Paths = append(res.Paths, &ActivityLogEventExitEvent_FieldTerminalPath{selector: ActivityLogEventExitEvent_FieldPathSelectorTime}) 2775 return res 2776 } 2777 2778 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) String() string { 2779 if fieldMask == nil { 2780 return "<nil>" 2781 } 2782 pathsStr := make([]string, 0, len(fieldMask.Paths)) 2783 for _, path := range fieldMask.Paths { 2784 pathsStr = append(pathsStr, path.String()) 2785 } 2786 return strings.Join(pathsStr, ", ") 2787 } 2788 2789 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) IsFull() bool { 2790 if fieldMask == nil { 2791 return false 2792 } 2793 presentSelectors := make([]bool, 2) 2794 for _, path := range fieldMask.Paths { 2795 if asFinal, ok := path.(*ActivityLogEventExitEvent_FieldTerminalPath); ok { 2796 presentSelectors[int(asFinal.selector)] = true 2797 } 2798 } 2799 for _, flag := range presentSelectors { 2800 if !flag { 2801 return false 2802 } 2803 } 2804 return true 2805 } 2806 2807 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) ProtoReflect() preflect.Message { 2808 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 2809 return ParseActivityLogEventExitEvent_FieldPath(raw) 2810 }) 2811 } 2812 2813 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) ProtoMessage() {} 2814 2815 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) Reset() { 2816 if fieldMask != nil { 2817 fieldMask.Paths = nil 2818 } 2819 } 2820 2821 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) Subtract(other *ActivityLog_Event_ExitEvent_FieldMask) *ActivityLog_Event_ExitEvent_FieldMask { 2822 result := &ActivityLog_Event_ExitEvent_FieldMask{} 2823 removedSelectors := make([]bool, 2) 2824 otherSubMasks := map[ActivityLogEventExitEvent_FieldPathSelector]gotenobject.FieldMask{ 2825 ActivityLogEventExitEvent_FieldPathSelectorStatus: &rpc.Status_FieldMask{}, 2826 } 2827 mySubMasks := map[ActivityLogEventExitEvent_FieldPathSelector]gotenobject.FieldMask{ 2828 ActivityLogEventExitEvent_FieldPathSelectorStatus: &rpc.Status_FieldMask{}, 2829 } 2830 2831 for _, path := range other.GetPaths() { 2832 switch tp := path.(type) { 2833 case *ActivityLogEventExitEvent_FieldTerminalPath: 2834 removedSelectors[int(tp.selector)] = true 2835 case *ActivityLogEventExitEvent_FieldSubPath: 2836 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 2837 } 2838 } 2839 for _, path := range fieldMask.GetPaths() { 2840 if !removedSelectors[int(path.Selector())] { 2841 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 2842 if tp, ok := path.(*ActivityLogEventExitEvent_FieldTerminalPath); ok { 2843 switch tp.selector { 2844 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 2845 mySubMasks[ActivityLogEventExitEvent_FieldPathSelectorStatus] = rpc.FullStatus_FieldMask() 2846 } 2847 } else if tp, ok := path.(*ActivityLogEventExitEvent_FieldSubPath); ok { 2848 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 2849 } 2850 } else { 2851 result.Paths = append(result.Paths, path) 2852 } 2853 } 2854 } 2855 for selector, mySubMask := range mySubMasks { 2856 if mySubMask.PathsCount() > 0 { 2857 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 2858 result.Paths = append(result.Paths, &ActivityLogEventExitEvent_FieldSubPath{selector: selector, subPath: allowedPath}) 2859 } 2860 } 2861 } 2862 2863 if len(result.Paths) == 0 { 2864 return nil 2865 } 2866 return result 2867 } 2868 2869 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 2870 return fieldMask.Subtract(other.(*ActivityLog_Event_ExitEvent_FieldMask)) 2871 } 2872 2873 // FilterInputFields generates copy of field paths with output_only field paths removed 2874 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) FilterInputFields() *ActivityLog_Event_ExitEvent_FieldMask { 2875 result := &ActivityLog_Event_ExitEvent_FieldMask{} 2876 result.Paths = append(result.Paths, fieldMask.Paths...) 2877 return result 2878 } 2879 2880 // ToFieldMask is used for proto conversions 2881 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 2882 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2883 for _, path := range fieldMask.Paths { 2884 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 2885 } 2886 return protoFieldMask 2887 } 2888 2889 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 2890 if fieldMask == nil { 2891 return status.Error(codes.Internal, "target field mask is nil") 2892 } 2893 fieldMask.Paths = make([]ActivityLogEventExitEvent_FieldPath, 0, len(protoFieldMask.Paths)) 2894 for _, strPath := range protoFieldMask.Paths { 2895 path, err := ParseActivityLogEventExitEvent_FieldPath(strPath) 2896 if err != nil { 2897 return err 2898 } 2899 fieldMask.Paths = append(fieldMask.Paths, path) 2900 } 2901 return nil 2902 } 2903 2904 // implement methods required by customType 2905 func (fieldMask ActivityLog_Event_ExitEvent_FieldMask) Marshal() ([]byte, error) { 2906 protoFieldMask := fieldMask.ToProtoFieldMask() 2907 return proto.Marshal(protoFieldMask) 2908 } 2909 2910 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) Unmarshal(data []byte) error { 2911 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2912 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 2913 return err 2914 } 2915 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2916 return err 2917 } 2918 return nil 2919 } 2920 2921 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) Size() int { 2922 return proto.Size(fieldMask.ToProtoFieldMask()) 2923 } 2924 2925 func (fieldMask ActivityLog_Event_ExitEvent_FieldMask) MarshalJSON() ([]byte, error) { 2926 return json.Marshal(fieldMask.ToProtoFieldMask()) 2927 } 2928 2929 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) UnmarshalJSON(data []byte) error { 2930 protoFieldMask := &googlefieldmaskpb.FieldMask{} 2931 if err := json.Unmarshal(data, protoFieldMask); err != nil { 2932 return err 2933 } 2934 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 2935 return err 2936 } 2937 return nil 2938 } 2939 2940 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) AppendPath(path ActivityLogEventExitEvent_FieldPath) { 2941 fieldMask.Paths = append(fieldMask.Paths, path) 2942 } 2943 2944 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 2945 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogEventExitEvent_FieldPath)) 2946 } 2947 2948 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) GetPaths() []ActivityLogEventExitEvent_FieldPath { 2949 if fieldMask == nil { 2950 return nil 2951 } 2952 return fieldMask.Paths 2953 } 2954 2955 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) GetRawPaths() []gotenobject.FieldPath { 2956 if fieldMask == nil { 2957 return nil 2958 } 2959 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 2960 for _, path := range fieldMask.Paths { 2961 rawPaths = append(rawPaths, path) 2962 } 2963 return rawPaths 2964 } 2965 2966 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) SetFromCliFlag(raw string) error { 2967 path, err := ParseActivityLogEventExitEvent_FieldPath(raw) 2968 if err != nil { 2969 return err 2970 } 2971 fieldMask.Paths = append(fieldMask.Paths, path) 2972 return nil 2973 } 2974 2975 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) Set(target, source *ActivityLog_Event_ExitEvent) { 2976 for _, path := range fieldMask.Paths { 2977 val, _ := path.GetSingle(source) 2978 // if val is nil, then field does not exist in source, skip 2979 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 2980 if val != nil { 2981 path.WithIValue(val).SetTo(&target) 2982 } 2983 } 2984 } 2985 2986 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 2987 fieldMask.Set(target.(*ActivityLog_Event_ExitEvent), source.(*ActivityLog_Event_ExitEvent)) 2988 } 2989 2990 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) Project(source *ActivityLog_Event_ExitEvent) *ActivityLog_Event_ExitEvent { 2991 if source == nil { 2992 return nil 2993 } 2994 if fieldMask == nil { 2995 return source 2996 } 2997 result := &ActivityLog_Event_ExitEvent{} 2998 statusMask := &rpc.Status_FieldMask{} 2999 wholeStatusAccepted := false 3000 3001 for _, p := range fieldMask.Paths { 3002 switch tp := p.(type) { 3003 case *ActivityLogEventExitEvent_FieldTerminalPath: 3004 switch tp.selector { 3005 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 3006 result.Status = source.Status 3007 wholeStatusAccepted = true 3008 case ActivityLogEventExitEvent_FieldPathSelectorTime: 3009 result.Time = source.Time 3010 } 3011 case *ActivityLogEventExitEvent_FieldSubPath: 3012 switch tp.selector { 3013 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 3014 statusMask.AppendPath(tp.subPath.(rpc.Status_FieldPath)) 3015 } 3016 } 3017 } 3018 if wholeStatusAccepted == false && len(statusMask.Paths) > 0 { 3019 result.Status = statusMask.Project(source.GetStatus()) 3020 } 3021 return result 3022 } 3023 3024 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3025 return fieldMask.Project(source.(*ActivityLog_Event_ExitEvent)) 3026 } 3027 3028 func (fieldMask *ActivityLog_Event_ExitEvent_FieldMask) PathsCount() int { 3029 if fieldMask == nil { 3030 return 0 3031 } 3032 return len(fieldMask.Paths) 3033 } 3034 3035 type ActivityLog_Resource_Difference_FieldMask struct { 3036 Paths []ActivityLogResourceDifference_FieldPath 3037 } 3038 3039 func FullActivityLog_Resource_Difference_FieldMask() *ActivityLog_Resource_Difference_FieldMask { 3040 res := &ActivityLog_Resource_Difference_FieldMask{} 3041 res.Paths = append(res.Paths, &ActivityLogResourceDifference_FieldTerminalPath{selector: ActivityLogResourceDifference_FieldPathSelectorFields}) 3042 res.Paths = append(res.Paths, &ActivityLogResourceDifference_FieldTerminalPath{selector: ActivityLogResourceDifference_FieldPathSelectorBefore}) 3043 res.Paths = append(res.Paths, &ActivityLogResourceDifference_FieldTerminalPath{selector: ActivityLogResourceDifference_FieldPathSelectorAfter}) 3044 return res 3045 } 3046 3047 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) String() string { 3048 if fieldMask == nil { 3049 return "<nil>" 3050 } 3051 pathsStr := make([]string, 0, len(fieldMask.Paths)) 3052 for _, path := range fieldMask.Paths { 3053 pathsStr = append(pathsStr, path.String()) 3054 } 3055 return strings.Join(pathsStr, ", ") 3056 } 3057 3058 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) IsFull() bool { 3059 if fieldMask == nil { 3060 return false 3061 } 3062 presentSelectors := make([]bool, 3) 3063 for _, path := range fieldMask.Paths { 3064 if asFinal, ok := path.(*ActivityLogResourceDifference_FieldTerminalPath); ok { 3065 presentSelectors[int(asFinal.selector)] = true 3066 } 3067 } 3068 for _, flag := range presentSelectors { 3069 if !flag { 3070 return false 3071 } 3072 } 3073 return true 3074 } 3075 3076 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) ProtoReflect() preflect.Message { 3077 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 3078 return ParseActivityLogResourceDifference_FieldPath(raw) 3079 }) 3080 } 3081 3082 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) ProtoMessage() {} 3083 3084 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) Reset() { 3085 if fieldMask != nil { 3086 fieldMask.Paths = nil 3087 } 3088 } 3089 3090 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) Subtract(other *ActivityLog_Resource_Difference_FieldMask) *ActivityLog_Resource_Difference_FieldMask { 3091 result := &ActivityLog_Resource_Difference_FieldMask{} 3092 removedSelectors := make([]bool, 3) 3093 3094 for _, path := range other.GetPaths() { 3095 switch tp := path.(type) { 3096 case *ActivityLogResourceDifference_FieldTerminalPath: 3097 removedSelectors[int(tp.selector)] = true 3098 } 3099 } 3100 for _, path := range fieldMask.GetPaths() { 3101 if !removedSelectors[int(path.Selector())] { 3102 result.Paths = append(result.Paths, path) 3103 } 3104 } 3105 3106 if len(result.Paths) == 0 { 3107 return nil 3108 } 3109 return result 3110 } 3111 3112 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 3113 return fieldMask.Subtract(other.(*ActivityLog_Resource_Difference_FieldMask)) 3114 } 3115 3116 // FilterInputFields generates copy of field paths with output_only field paths removed 3117 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) FilterInputFields() *ActivityLog_Resource_Difference_FieldMask { 3118 result := &ActivityLog_Resource_Difference_FieldMask{} 3119 result.Paths = append(result.Paths, fieldMask.Paths...) 3120 return result 3121 } 3122 3123 // ToFieldMask is used for proto conversions 3124 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 3125 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3126 for _, path := range fieldMask.Paths { 3127 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 3128 } 3129 return protoFieldMask 3130 } 3131 3132 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 3133 if fieldMask == nil { 3134 return status.Error(codes.Internal, "target field mask is nil") 3135 } 3136 fieldMask.Paths = make([]ActivityLogResourceDifference_FieldPath, 0, len(protoFieldMask.Paths)) 3137 for _, strPath := range protoFieldMask.Paths { 3138 path, err := ParseActivityLogResourceDifference_FieldPath(strPath) 3139 if err != nil { 3140 return err 3141 } 3142 fieldMask.Paths = append(fieldMask.Paths, path) 3143 } 3144 return nil 3145 } 3146 3147 // implement methods required by customType 3148 func (fieldMask ActivityLog_Resource_Difference_FieldMask) Marshal() ([]byte, error) { 3149 protoFieldMask := fieldMask.ToProtoFieldMask() 3150 return proto.Marshal(protoFieldMask) 3151 } 3152 3153 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) Unmarshal(data []byte) error { 3154 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3155 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 3156 return err 3157 } 3158 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3159 return err 3160 } 3161 return nil 3162 } 3163 3164 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) Size() int { 3165 return proto.Size(fieldMask.ToProtoFieldMask()) 3166 } 3167 3168 func (fieldMask ActivityLog_Resource_Difference_FieldMask) MarshalJSON() ([]byte, error) { 3169 return json.Marshal(fieldMask.ToProtoFieldMask()) 3170 } 3171 3172 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) UnmarshalJSON(data []byte) error { 3173 protoFieldMask := &googlefieldmaskpb.FieldMask{} 3174 if err := json.Unmarshal(data, protoFieldMask); err != nil { 3175 return err 3176 } 3177 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 3178 return err 3179 } 3180 return nil 3181 } 3182 3183 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) AppendPath(path ActivityLogResourceDifference_FieldPath) { 3184 fieldMask.Paths = append(fieldMask.Paths, path) 3185 } 3186 3187 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 3188 fieldMask.Paths = append(fieldMask.Paths, path.(ActivityLogResourceDifference_FieldPath)) 3189 } 3190 3191 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) GetPaths() []ActivityLogResourceDifference_FieldPath { 3192 if fieldMask == nil { 3193 return nil 3194 } 3195 return fieldMask.Paths 3196 } 3197 3198 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) GetRawPaths() []gotenobject.FieldPath { 3199 if fieldMask == nil { 3200 return nil 3201 } 3202 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 3203 for _, path := range fieldMask.Paths { 3204 rawPaths = append(rawPaths, path) 3205 } 3206 return rawPaths 3207 } 3208 3209 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) SetFromCliFlag(raw string) error { 3210 path, err := ParseActivityLogResourceDifference_FieldPath(raw) 3211 if err != nil { 3212 return err 3213 } 3214 fieldMask.Paths = append(fieldMask.Paths, path) 3215 return nil 3216 } 3217 3218 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) Set(target, source *ActivityLog_Resource_Difference) { 3219 for _, path := range fieldMask.Paths { 3220 val, _ := path.GetSingle(source) 3221 // if val is nil, then field does not exist in source, skip 3222 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 3223 if val != nil { 3224 path.WithIValue(val).SetTo(&target) 3225 } 3226 } 3227 } 3228 3229 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 3230 fieldMask.Set(target.(*ActivityLog_Resource_Difference), source.(*ActivityLog_Resource_Difference)) 3231 } 3232 3233 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) Project(source *ActivityLog_Resource_Difference) *ActivityLog_Resource_Difference { 3234 if source == nil { 3235 return nil 3236 } 3237 if fieldMask == nil { 3238 return source 3239 } 3240 result := &ActivityLog_Resource_Difference{} 3241 3242 for _, p := range fieldMask.Paths { 3243 switch tp := p.(type) { 3244 case *ActivityLogResourceDifference_FieldTerminalPath: 3245 switch tp.selector { 3246 case ActivityLogResourceDifference_FieldPathSelectorFields: 3247 result.Fields = source.Fields 3248 case ActivityLogResourceDifference_FieldPathSelectorBefore: 3249 result.Before = source.Before 3250 case ActivityLogResourceDifference_FieldPathSelectorAfter: 3251 result.After = source.After 3252 } 3253 } 3254 } 3255 return result 3256 } 3257 3258 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 3259 return fieldMask.Project(source.(*ActivityLog_Resource_Difference)) 3260 } 3261 3262 func (fieldMask *ActivityLog_Resource_Difference_FieldMask) PathsCount() int { 3263 if fieldMask == nil { 3264 return 0 3265 } 3266 return len(fieldMask.Paths) 3267 }