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