github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1/invitation/invitation.pb.fieldmask.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/iam/proto/v1/invitation.proto 3 // DO NOT EDIT!!! 4 5 package iam_invitation 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 condition "github.com/cloudwan/edgelq-sdk/iam/resources/v1/condition" 23 group "github.com/cloudwan/edgelq-sdk/iam/resources/v1/group" 24 role "github.com/cloudwan/edgelq-sdk/iam/resources/v1/role" 25 service_account "github.com/cloudwan/edgelq-sdk/iam/resources/v1/service_account" 26 user "github.com/cloudwan/edgelq-sdk/iam/resources/v1/user" 27 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 28 ) 29 30 // ensure the imports are used 31 var ( 32 _ = new(json.Marshaler) 33 _ = strings.Builder{} 34 35 _ = codes.NotFound 36 _ = status.Status{} 37 _ = new(proto.Message) 38 _ = new(preflect.Message) 39 _ = googlefieldmaskpb.FieldMask{} 40 41 _ = new(gotenobject.FieldMask) 42 ) 43 44 // make sure we're using proto imports 45 var ( 46 _ = &condition.Condition{} 47 _ = &group.Group{} 48 _ = &role.Role{} 49 _ = &service_account.ServiceAccount{} 50 _ = &user.User{} 51 _ = ×tamppb.Timestamp{} 52 ) 53 54 type Actor_FieldMask struct { 55 Paths []Actor_FieldPath 56 } 57 58 func FullActor_FieldMask() *Actor_FieldMask { 59 res := &Actor_FieldMask{} 60 res.Paths = append(res.Paths, &Actor_FieldTerminalPath{selector: Actor_FieldPathSelectorUser}) 61 res.Paths = append(res.Paths, &Actor_FieldTerminalPath{selector: Actor_FieldPathSelectorServiceAccount}) 62 return res 63 } 64 65 func (fieldMask *Actor_FieldMask) String() string { 66 if fieldMask == nil { 67 return "<nil>" 68 } 69 pathsStr := make([]string, 0, len(fieldMask.Paths)) 70 for _, path := range fieldMask.Paths { 71 pathsStr = append(pathsStr, path.String()) 72 } 73 return strings.Join(pathsStr, ", ") 74 } 75 76 func (fieldMask *Actor_FieldMask) IsFull() bool { 77 if fieldMask == nil { 78 return false 79 } 80 presentSelectors := make([]bool, 2) 81 for _, path := range fieldMask.Paths { 82 if asFinal, ok := path.(*Actor_FieldTerminalPath); ok { 83 presentSelectors[int(asFinal.selector)] = true 84 } 85 } 86 for _, flag := range presentSelectors { 87 if !flag { 88 return false 89 } 90 } 91 return true 92 } 93 94 func (fieldMask *Actor_FieldMask) ProtoReflect() preflect.Message { 95 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 96 return ParseActor_FieldPath(raw) 97 }) 98 } 99 100 func (fieldMask *Actor_FieldMask) ProtoMessage() {} 101 102 func (fieldMask *Actor_FieldMask) Reset() { 103 if fieldMask != nil { 104 fieldMask.Paths = nil 105 } 106 } 107 108 func (fieldMask *Actor_FieldMask) Subtract(other *Actor_FieldMask) *Actor_FieldMask { 109 result := &Actor_FieldMask{} 110 removedSelectors := make([]bool, 2) 111 112 for _, path := range other.GetPaths() { 113 switch tp := path.(type) { 114 case *Actor_FieldTerminalPath: 115 removedSelectors[int(tp.selector)] = true 116 } 117 } 118 for _, path := range fieldMask.GetPaths() { 119 if !removedSelectors[int(path.Selector())] { 120 result.Paths = append(result.Paths, path) 121 } 122 } 123 124 if len(result.Paths) == 0 { 125 return nil 126 } 127 return result 128 } 129 130 func (fieldMask *Actor_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 131 return fieldMask.Subtract(other.(*Actor_FieldMask)) 132 } 133 134 // FilterInputFields generates copy of field paths with output_only field paths removed 135 func (fieldMask *Actor_FieldMask) FilterInputFields() *Actor_FieldMask { 136 result := &Actor_FieldMask{} 137 result.Paths = append(result.Paths, fieldMask.Paths...) 138 return result 139 } 140 141 // ToFieldMask is used for proto conversions 142 func (fieldMask *Actor_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 143 protoFieldMask := &googlefieldmaskpb.FieldMask{} 144 for _, path := range fieldMask.Paths { 145 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 146 } 147 return protoFieldMask 148 } 149 150 func (fieldMask *Actor_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 151 if fieldMask == nil { 152 return status.Error(codes.Internal, "target field mask is nil") 153 } 154 fieldMask.Paths = make([]Actor_FieldPath, 0, len(protoFieldMask.Paths)) 155 for _, strPath := range protoFieldMask.Paths { 156 path, err := ParseActor_FieldPath(strPath) 157 if err != nil { 158 return err 159 } 160 fieldMask.Paths = append(fieldMask.Paths, path) 161 } 162 return nil 163 } 164 165 // implement methods required by customType 166 func (fieldMask Actor_FieldMask) Marshal() ([]byte, error) { 167 protoFieldMask := fieldMask.ToProtoFieldMask() 168 return proto.Marshal(protoFieldMask) 169 } 170 171 func (fieldMask *Actor_FieldMask) Unmarshal(data []byte) error { 172 protoFieldMask := &googlefieldmaskpb.FieldMask{} 173 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 174 return err 175 } 176 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 177 return err 178 } 179 return nil 180 } 181 182 func (fieldMask *Actor_FieldMask) Size() int { 183 return proto.Size(fieldMask.ToProtoFieldMask()) 184 } 185 186 func (fieldMask Actor_FieldMask) MarshalJSON() ([]byte, error) { 187 return json.Marshal(fieldMask.ToProtoFieldMask()) 188 } 189 190 func (fieldMask *Actor_FieldMask) UnmarshalJSON(data []byte) error { 191 protoFieldMask := &googlefieldmaskpb.FieldMask{} 192 if err := json.Unmarshal(data, protoFieldMask); err != nil { 193 return err 194 } 195 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 196 return err 197 } 198 return nil 199 } 200 201 func (fieldMask *Actor_FieldMask) AppendPath(path Actor_FieldPath) { 202 fieldMask.Paths = append(fieldMask.Paths, path) 203 } 204 205 func (fieldMask *Actor_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 206 fieldMask.Paths = append(fieldMask.Paths, path.(Actor_FieldPath)) 207 } 208 209 func (fieldMask *Actor_FieldMask) GetPaths() []Actor_FieldPath { 210 if fieldMask == nil { 211 return nil 212 } 213 return fieldMask.Paths 214 } 215 216 func (fieldMask *Actor_FieldMask) GetRawPaths() []gotenobject.FieldPath { 217 if fieldMask == nil { 218 return nil 219 } 220 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 221 for _, path := range fieldMask.Paths { 222 rawPaths = append(rawPaths, path) 223 } 224 return rawPaths 225 } 226 227 func (fieldMask *Actor_FieldMask) SetFromCliFlag(raw string) error { 228 path, err := ParseActor_FieldPath(raw) 229 if err != nil { 230 return err 231 } 232 fieldMask.Paths = append(fieldMask.Paths, path) 233 return nil 234 } 235 236 func (fieldMask *Actor_FieldMask) Set(target, source *Actor) { 237 for _, path := range fieldMask.Paths { 238 val, _ := path.GetSingle(source) 239 // if val is nil, then field does not exist in source, skip 240 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 241 if val != nil { 242 path.WithIValue(val).SetTo(&target) 243 } 244 } 245 } 246 247 func (fieldMask *Actor_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 248 fieldMask.Set(target.(*Actor), source.(*Actor)) 249 } 250 251 func (fieldMask *Actor_FieldMask) Project(source *Actor) *Actor { 252 if source == nil { 253 return nil 254 } 255 if fieldMask == nil { 256 return source 257 } 258 result := &Actor{} 259 260 for _, p := range fieldMask.Paths { 261 switch tp := p.(type) { 262 case *Actor_FieldTerminalPath: 263 switch tp.selector { 264 case Actor_FieldPathSelectorUser: 265 result.User = source.User 266 case Actor_FieldPathSelectorServiceAccount: 267 result.ServiceAccount = source.ServiceAccount 268 } 269 } 270 } 271 return result 272 } 273 274 func (fieldMask *Actor_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 275 return fieldMask.Project(source.(*Actor)) 276 } 277 278 func (fieldMask *Actor_FieldMask) PathsCount() int { 279 if fieldMask == nil { 280 return 0 281 } 282 return len(fieldMask.Paths) 283 } 284 285 type Invitation_FieldMask struct { 286 Paths []Invitation_FieldPath 287 } 288 289 func FullInvitation_FieldMask() *Invitation_FieldMask { 290 res := &Invitation_FieldMask{} 291 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorInviteeEmail}) 292 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorInviterActor}) 293 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorInviterFullName}) 294 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorInviterEmail}) 295 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorLanguageCode}) 296 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorBindingRoles}) 297 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorGroups}) 298 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorExpirationDate}) 299 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorExtras}) 300 res.Paths = append(res.Paths, &Invitation_FieldTerminalPath{selector: Invitation_FieldPathSelectorState}) 301 return res 302 } 303 304 func (fieldMask *Invitation_FieldMask) String() string { 305 if fieldMask == nil { 306 return "<nil>" 307 } 308 pathsStr := make([]string, 0, len(fieldMask.Paths)) 309 for _, path := range fieldMask.Paths { 310 pathsStr = append(pathsStr, path.String()) 311 } 312 return strings.Join(pathsStr, ", ") 313 } 314 315 func (fieldMask *Invitation_FieldMask) IsFull() bool { 316 if fieldMask == nil { 317 return false 318 } 319 presentSelectors := make([]bool, 10) 320 for _, path := range fieldMask.Paths { 321 if asFinal, ok := path.(*Invitation_FieldTerminalPath); ok { 322 presentSelectors[int(asFinal.selector)] = true 323 } 324 } 325 for _, flag := range presentSelectors { 326 if !flag { 327 return false 328 } 329 } 330 return true 331 } 332 333 func (fieldMask *Invitation_FieldMask) ProtoReflect() preflect.Message { 334 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 335 return ParseInvitation_FieldPath(raw) 336 }) 337 } 338 339 func (fieldMask *Invitation_FieldMask) ProtoMessage() {} 340 341 func (fieldMask *Invitation_FieldMask) Reset() { 342 if fieldMask != nil { 343 fieldMask.Paths = nil 344 } 345 } 346 347 func (fieldMask *Invitation_FieldMask) Subtract(other *Invitation_FieldMask) *Invitation_FieldMask { 348 result := &Invitation_FieldMask{} 349 removedSelectors := make([]bool, 10) 350 otherSubMasks := map[Invitation_FieldPathSelector]gotenobject.FieldMask{ 351 Invitation_FieldPathSelectorInviterActor: &Actor_FieldMask{}, 352 Invitation_FieldPathSelectorBindingRoles: &Invitation_BindingRole_FieldMask{}, 353 } 354 mySubMasks := map[Invitation_FieldPathSelector]gotenobject.FieldMask{ 355 Invitation_FieldPathSelectorInviterActor: &Actor_FieldMask{}, 356 Invitation_FieldPathSelectorBindingRoles: &Invitation_BindingRole_FieldMask{}, 357 } 358 359 for _, path := range other.GetPaths() { 360 switch tp := path.(type) { 361 case *Invitation_FieldTerminalPath: 362 removedSelectors[int(tp.selector)] = true 363 case *Invitation_FieldSubPath: 364 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 365 } 366 } 367 for _, path := range fieldMask.GetPaths() { 368 if !removedSelectors[int(path.Selector())] { 369 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 370 if tp, ok := path.(*Invitation_FieldTerminalPath); ok { 371 switch tp.selector { 372 case Invitation_FieldPathSelectorInviterActor: 373 mySubMasks[Invitation_FieldPathSelectorInviterActor] = FullActor_FieldMask() 374 case Invitation_FieldPathSelectorBindingRoles: 375 mySubMasks[Invitation_FieldPathSelectorBindingRoles] = FullInvitation_BindingRole_FieldMask() 376 } 377 } else if tp, ok := path.(*Invitation_FieldSubPath); ok { 378 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 379 } 380 } else { 381 result.Paths = append(result.Paths, path) 382 } 383 } 384 } 385 for selector, mySubMask := range mySubMasks { 386 if mySubMask.PathsCount() > 0 { 387 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 388 result.Paths = append(result.Paths, &Invitation_FieldSubPath{selector: selector, subPath: allowedPath}) 389 } 390 } 391 } 392 393 if len(result.Paths) == 0 { 394 return nil 395 } 396 return result 397 } 398 399 func (fieldMask *Invitation_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 400 return fieldMask.Subtract(other.(*Invitation_FieldMask)) 401 } 402 403 // FilterInputFields generates copy of field paths with output_only field paths removed 404 func (fieldMask *Invitation_FieldMask) FilterInputFields() *Invitation_FieldMask { 405 result := &Invitation_FieldMask{} 406 for _, path := range fieldMask.Paths { 407 switch path.Selector() { 408 case Invitation_FieldPathSelectorInviterActor: 409 case Invitation_FieldPathSelectorInviterFullName: 410 case Invitation_FieldPathSelectorInviterEmail: 411 default: 412 result.Paths = append(result.Paths, path) 413 } 414 } 415 return result 416 } 417 418 // ToFieldMask is used for proto conversions 419 func (fieldMask *Invitation_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 420 protoFieldMask := &googlefieldmaskpb.FieldMask{} 421 for _, path := range fieldMask.Paths { 422 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 423 } 424 return protoFieldMask 425 } 426 427 func (fieldMask *Invitation_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 428 if fieldMask == nil { 429 return status.Error(codes.Internal, "target field mask is nil") 430 } 431 fieldMask.Paths = make([]Invitation_FieldPath, 0, len(protoFieldMask.Paths)) 432 for _, strPath := range protoFieldMask.Paths { 433 path, err := ParseInvitation_FieldPath(strPath) 434 if err != nil { 435 return err 436 } 437 fieldMask.Paths = append(fieldMask.Paths, path) 438 } 439 return nil 440 } 441 442 // implement methods required by customType 443 func (fieldMask Invitation_FieldMask) Marshal() ([]byte, error) { 444 protoFieldMask := fieldMask.ToProtoFieldMask() 445 return proto.Marshal(protoFieldMask) 446 } 447 448 func (fieldMask *Invitation_FieldMask) Unmarshal(data []byte) error { 449 protoFieldMask := &googlefieldmaskpb.FieldMask{} 450 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 451 return err 452 } 453 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 454 return err 455 } 456 return nil 457 } 458 459 func (fieldMask *Invitation_FieldMask) Size() int { 460 return proto.Size(fieldMask.ToProtoFieldMask()) 461 } 462 463 func (fieldMask Invitation_FieldMask) MarshalJSON() ([]byte, error) { 464 return json.Marshal(fieldMask.ToProtoFieldMask()) 465 } 466 467 func (fieldMask *Invitation_FieldMask) UnmarshalJSON(data []byte) error { 468 protoFieldMask := &googlefieldmaskpb.FieldMask{} 469 if err := json.Unmarshal(data, protoFieldMask); err != nil { 470 return err 471 } 472 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 473 return err 474 } 475 return nil 476 } 477 478 func (fieldMask *Invitation_FieldMask) AppendPath(path Invitation_FieldPath) { 479 fieldMask.Paths = append(fieldMask.Paths, path) 480 } 481 482 func (fieldMask *Invitation_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 483 fieldMask.Paths = append(fieldMask.Paths, path.(Invitation_FieldPath)) 484 } 485 486 func (fieldMask *Invitation_FieldMask) GetPaths() []Invitation_FieldPath { 487 if fieldMask == nil { 488 return nil 489 } 490 return fieldMask.Paths 491 } 492 493 func (fieldMask *Invitation_FieldMask) GetRawPaths() []gotenobject.FieldPath { 494 if fieldMask == nil { 495 return nil 496 } 497 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 498 for _, path := range fieldMask.Paths { 499 rawPaths = append(rawPaths, path) 500 } 501 return rawPaths 502 } 503 504 func (fieldMask *Invitation_FieldMask) SetFromCliFlag(raw string) error { 505 path, err := ParseInvitation_FieldPath(raw) 506 if err != nil { 507 return err 508 } 509 fieldMask.Paths = append(fieldMask.Paths, path) 510 return nil 511 } 512 513 func (fieldMask *Invitation_FieldMask) Set(target, source *Invitation) { 514 for _, path := range fieldMask.Paths { 515 val, _ := path.GetSingle(source) 516 // if val is nil, then field does not exist in source, skip 517 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 518 if val != nil { 519 path.WithIValue(val).SetTo(&target) 520 } 521 } 522 } 523 524 func (fieldMask *Invitation_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 525 fieldMask.Set(target.(*Invitation), source.(*Invitation)) 526 } 527 528 func (fieldMask *Invitation_FieldMask) Project(source *Invitation) *Invitation { 529 if source == nil { 530 return nil 531 } 532 if fieldMask == nil { 533 return source 534 } 535 result := &Invitation{} 536 inviterActorMask := &Actor_FieldMask{} 537 wholeInviterActorAccepted := false 538 bindingRolesMask := &Invitation_BindingRole_FieldMask{} 539 wholeBindingRolesAccepted := false 540 var extrasMapKeys []string 541 wholeExtrasAccepted := false 542 543 for _, p := range fieldMask.Paths { 544 switch tp := p.(type) { 545 case *Invitation_FieldTerminalPath: 546 switch tp.selector { 547 case Invitation_FieldPathSelectorInviteeEmail: 548 result.InviteeEmail = source.InviteeEmail 549 case Invitation_FieldPathSelectorInviterActor: 550 result.InviterActor = source.InviterActor 551 wholeInviterActorAccepted = true 552 case Invitation_FieldPathSelectorInviterFullName: 553 result.InviterFullName = source.InviterFullName 554 case Invitation_FieldPathSelectorInviterEmail: 555 result.InviterEmail = source.InviterEmail 556 case Invitation_FieldPathSelectorLanguageCode: 557 result.LanguageCode = source.LanguageCode 558 case Invitation_FieldPathSelectorBindingRoles: 559 result.BindingRoles = source.BindingRoles 560 wholeBindingRolesAccepted = true 561 case Invitation_FieldPathSelectorGroups: 562 result.Groups = source.Groups 563 case Invitation_FieldPathSelectorExpirationDate: 564 result.ExpirationDate = source.ExpirationDate 565 case Invitation_FieldPathSelectorExtras: 566 result.Extras = source.Extras 567 wholeExtrasAccepted = true 568 case Invitation_FieldPathSelectorState: 569 result.State = source.State 570 } 571 case *Invitation_FieldSubPath: 572 switch tp.selector { 573 case Invitation_FieldPathSelectorInviterActor: 574 inviterActorMask.AppendPath(tp.subPath.(Actor_FieldPath)) 575 case Invitation_FieldPathSelectorBindingRoles: 576 bindingRolesMask.AppendPath(tp.subPath.(InvitationBindingRole_FieldPath)) 577 } 578 case *Invitation_FieldPathMap: 579 switch tp.selector { 580 case Invitation_FieldPathSelectorExtras: 581 extrasMapKeys = append(extrasMapKeys, tp.key) 582 } 583 } 584 } 585 if wholeInviterActorAccepted == false && len(inviterActorMask.Paths) > 0 { 586 result.InviterActor = inviterActorMask.Project(source.GetInviterActor()) 587 } 588 if wholeBindingRolesAccepted == false && len(bindingRolesMask.Paths) > 0 { 589 for _, sourceItem := range source.GetBindingRoles() { 590 result.BindingRoles = append(result.BindingRoles, bindingRolesMask.Project(sourceItem)) 591 } 592 } 593 if wholeExtrasAccepted == false && len(extrasMapKeys) > 0 && source.GetExtras() != nil { 594 copiedMap := map[string]string{} 595 sourceMap := source.GetExtras() 596 for _, key := range extrasMapKeys { 597 copiedMap[key] = sourceMap[key] 598 } 599 result.Extras = copiedMap 600 } 601 return result 602 } 603 604 func (fieldMask *Invitation_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 605 return fieldMask.Project(source.(*Invitation)) 606 } 607 608 func (fieldMask *Invitation_FieldMask) PathsCount() int { 609 if fieldMask == nil { 610 return 0 611 } 612 return len(fieldMask.Paths) 613 } 614 615 type Invitation_BindingRole_FieldMask struct { 616 Paths []InvitationBindingRole_FieldPath 617 } 618 619 func FullInvitation_BindingRole_FieldMask() *Invitation_BindingRole_FieldMask { 620 res := &Invitation_BindingRole_FieldMask{} 621 res.Paths = append(res.Paths, &InvitationBindingRole_FieldTerminalPath{selector: InvitationBindingRole_FieldPathSelectorRole}) 622 res.Paths = append(res.Paths, &InvitationBindingRole_FieldTerminalPath{selector: InvitationBindingRole_FieldPathSelectorExecutableConditions}) 623 res.Paths = append(res.Paths, &InvitationBindingRole_FieldTerminalPath{selector: InvitationBindingRole_FieldPathSelectorScopeParams}) 624 return res 625 } 626 627 func (fieldMask *Invitation_BindingRole_FieldMask) String() string { 628 if fieldMask == nil { 629 return "<nil>" 630 } 631 pathsStr := make([]string, 0, len(fieldMask.Paths)) 632 for _, path := range fieldMask.Paths { 633 pathsStr = append(pathsStr, path.String()) 634 } 635 return strings.Join(pathsStr, ", ") 636 } 637 638 func (fieldMask *Invitation_BindingRole_FieldMask) IsFull() bool { 639 if fieldMask == nil { 640 return false 641 } 642 presentSelectors := make([]bool, 3) 643 for _, path := range fieldMask.Paths { 644 if asFinal, ok := path.(*InvitationBindingRole_FieldTerminalPath); ok { 645 presentSelectors[int(asFinal.selector)] = true 646 } 647 } 648 for _, flag := range presentSelectors { 649 if !flag { 650 return false 651 } 652 } 653 return true 654 } 655 656 func (fieldMask *Invitation_BindingRole_FieldMask) ProtoReflect() preflect.Message { 657 return gotenobject.MakeFieldMaskReflection(fieldMask, func(raw string) (gotenobject.FieldPath, error) { 658 return ParseInvitationBindingRole_FieldPath(raw) 659 }) 660 } 661 662 func (fieldMask *Invitation_BindingRole_FieldMask) ProtoMessage() {} 663 664 func (fieldMask *Invitation_BindingRole_FieldMask) Reset() { 665 if fieldMask != nil { 666 fieldMask.Paths = nil 667 } 668 } 669 670 func (fieldMask *Invitation_BindingRole_FieldMask) Subtract(other *Invitation_BindingRole_FieldMask) *Invitation_BindingRole_FieldMask { 671 result := &Invitation_BindingRole_FieldMask{} 672 removedSelectors := make([]bool, 3) 673 otherSubMasks := map[InvitationBindingRole_FieldPathSelector]gotenobject.FieldMask{ 674 InvitationBindingRole_FieldPathSelectorExecutableConditions: &condition.ExecutableCondition_FieldMask{}, 675 InvitationBindingRole_FieldPathSelectorScopeParams: &role.ScopeParam_FieldMask{}, 676 } 677 mySubMasks := map[InvitationBindingRole_FieldPathSelector]gotenobject.FieldMask{ 678 InvitationBindingRole_FieldPathSelectorExecutableConditions: &condition.ExecutableCondition_FieldMask{}, 679 InvitationBindingRole_FieldPathSelectorScopeParams: &role.ScopeParam_FieldMask{}, 680 } 681 682 for _, path := range other.GetPaths() { 683 switch tp := path.(type) { 684 case *InvitationBindingRole_FieldTerminalPath: 685 removedSelectors[int(tp.selector)] = true 686 case *InvitationBindingRole_FieldSubPath: 687 otherSubMasks[tp.selector].AppendRawPath(tp.subPath) 688 } 689 } 690 for _, path := range fieldMask.GetPaths() { 691 if !removedSelectors[int(path.Selector())] { 692 if otherSubMask := otherSubMasks[path.Selector()]; otherSubMask != nil && otherSubMask.PathsCount() > 0 { 693 if tp, ok := path.(*InvitationBindingRole_FieldTerminalPath); ok { 694 switch tp.selector { 695 case InvitationBindingRole_FieldPathSelectorExecutableConditions: 696 mySubMasks[InvitationBindingRole_FieldPathSelectorExecutableConditions] = condition.FullExecutableCondition_FieldMask() 697 case InvitationBindingRole_FieldPathSelectorScopeParams: 698 mySubMasks[InvitationBindingRole_FieldPathSelectorScopeParams] = role.FullScopeParam_FieldMask() 699 } 700 } else if tp, ok := path.(*InvitationBindingRole_FieldSubPath); ok { 701 mySubMasks[tp.selector].AppendRawPath(tp.subPath) 702 } 703 } else { 704 result.Paths = append(result.Paths, path) 705 } 706 } 707 } 708 for selector, mySubMask := range mySubMasks { 709 if mySubMask.PathsCount() > 0 { 710 for _, allowedPath := range mySubMask.SubtractRaw(otherSubMasks[selector]).GetRawPaths() { 711 result.Paths = append(result.Paths, &InvitationBindingRole_FieldSubPath{selector: selector, subPath: allowedPath}) 712 } 713 } 714 } 715 716 if len(result.Paths) == 0 { 717 return nil 718 } 719 return result 720 } 721 722 func (fieldMask *Invitation_BindingRole_FieldMask) SubtractRaw(other gotenobject.FieldMask) gotenobject.FieldMask { 723 return fieldMask.Subtract(other.(*Invitation_BindingRole_FieldMask)) 724 } 725 726 // FilterInputFields generates copy of field paths with output_only field paths removed 727 func (fieldMask *Invitation_BindingRole_FieldMask) FilterInputFields() *Invitation_BindingRole_FieldMask { 728 result := &Invitation_BindingRole_FieldMask{} 729 result.Paths = append(result.Paths, fieldMask.Paths...) 730 return result 731 } 732 733 // ToFieldMask is used for proto conversions 734 func (fieldMask *Invitation_BindingRole_FieldMask) ToProtoFieldMask() *googlefieldmaskpb.FieldMask { 735 protoFieldMask := &googlefieldmaskpb.FieldMask{} 736 for _, path := range fieldMask.Paths { 737 protoFieldMask.Paths = append(protoFieldMask.Paths, path.String()) 738 } 739 return protoFieldMask 740 } 741 742 func (fieldMask *Invitation_BindingRole_FieldMask) FromProtoFieldMask(protoFieldMask *googlefieldmaskpb.FieldMask) error { 743 if fieldMask == nil { 744 return status.Error(codes.Internal, "target field mask is nil") 745 } 746 fieldMask.Paths = make([]InvitationBindingRole_FieldPath, 0, len(protoFieldMask.Paths)) 747 for _, strPath := range protoFieldMask.Paths { 748 path, err := ParseInvitationBindingRole_FieldPath(strPath) 749 if err != nil { 750 return err 751 } 752 fieldMask.Paths = append(fieldMask.Paths, path) 753 } 754 return nil 755 } 756 757 // implement methods required by customType 758 func (fieldMask Invitation_BindingRole_FieldMask) Marshal() ([]byte, error) { 759 protoFieldMask := fieldMask.ToProtoFieldMask() 760 return proto.Marshal(protoFieldMask) 761 } 762 763 func (fieldMask *Invitation_BindingRole_FieldMask) Unmarshal(data []byte) error { 764 protoFieldMask := &googlefieldmaskpb.FieldMask{} 765 if err := proto.Unmarshal(data, protoFieldMask); err != nil { 766 return err 767 } 768 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 769 return err 770 } 771 return nil 772 } 773 774 func (fieldMask *Invitation_BindingRole_FieldMask) Size() int { 775 return proto.Size(fieldMask.ToProtoFieldMask()) 776 } 777 778 func (fieldMask Invitation_BindingRole_FieldMask) MarshalJSON() ([]byte, error) { 779 return json.Marshal(fieldMask.ToProtoFieldMask()) 780 } 781 782 func (fieldMask *Invitation_BindingRole_FieldMask) UnmarshalJSON(data []byte) error { 783 protoFieldMask := &googlefieldmaskpb.FieldMask{} 784 if err := json.Unmarshal(data, protoFieldMask); err != nil { 785 return err 786 } 787 if err := fieldMask.FromProtoFieldMask(protoFieldMask); err != nil { 788 return err 789 } 790 return nil 791 } 792 793 func (fieldMask *Invitation_BindingRole_FieldMask) AppendPath(path InvitationBindingRole_FieldPath) { 794 fieldMask.Paths = append(fieldMask.Paths, path) 795 } 796 797 func (fieldMask *Invitation_BindingRole_FieldMask) AppendRawPath(path gotenobject.FieldPath) { 798 fieldMask.Paths = append(fieldMask.Paths, path.(InvitationBindingRole_FieldPath)) 799 } 800 801 func (fieldMask *Invitation_BindingRole_FieldMask) GetPaths() []InvitationBindingRole_FieldPath { 802 if fieldMask == nil { 803 return nil 804 } 805 return fieldMask.Paths 806 } 807 808 func (fieldMask *Invitation_BindingRole_FieldMask) GetRawPaths() []gotenobject.FieldPath { 809 if fieldMask == nil { 810 return nil 811 } 812 rawPaths := make([]gotenobject.FieldPath, 0, len(fieldMask.Paths)) 813 for _, path := range fieldMask.Paths { 814 rawPaths = append(rawPaths, path) 815 } 816 return rawPaths 817 } 818 819 func (fieldMask *Invitation_BindingRole_FieldMask) SetFromCliFlag(raw string) error { 820 path, err := ParseInvitationBindingRole_FieldPath(raw) 821 if err != nil { 822 return err 823 } 824 fieldMask.Paths = append(fieldMask.Paths, path) 825 return nil 826 } 827 828 func (fieldMask *Invitation_BindingRole_FieldMask) Set(target, source *Invitation_BindingRole) { 829 for _, path := range fieldMask.Paths { 830 val, _ := path.GetSingle(source) 831 // if val is nil, then field does not exist in source, skip 832 // otherwise, process (can still reflect.ValueOf(val).IsNil!) 833 if val != nil { 834 path.WithIValue(val).SetTo(&target) 835 } 836 } 837 } 838 839 func (fieldMask *Invitation_BindingRole_FieldMask) SetRaw(target, source gotenobject.GotenObjectExt) { 840 fieldMask.Set(target.(*Invitation_BindingRole), source.(*Invitation_BindingRole)) 841 } 842 843 func (fieldMask *Invitation_BindingRole_FieldMask) Project(source *Invitation_BindingRole) *Invitation_BindingRole { 844 if source == nil { 845 return nil 846 } 847 if fieldMask == nil { 848 return source 849 } 850 result := &Invitation_BindingRole{} 851 executableConditionsMask := &condition.ExecutableCondition_FieldMask{} 852 wholeExecutableConditionsAccepted := false 853 scopeParamsMask := &role.ScopeParam_FieldMask{} 854 wholeScopeParamsAccepted := false 855 856 for _, p := range fieldMask.Paths { 857 switch tp := p.(type) { 858 case *InvitationBindingRole_FieldTerminalPath: 859 switch tp.selector { 860 case InvitationBindingRole_FieldPathSelectorRole: 861 result.Role = source.Role 862 case InvitationBindingRole_FieldPathSelectorExecutableConditions: 863 result.ExecutableConditions = source.ExecutableConditions 864 wholeExecutableConditionsAccepted = true 865 case InvitationBindingRole_FieldPathSelectorScopeParams: 866 result.ScopeParams = source.ScopeParams 867 wholeScopeParamsAccepted = true 868 } 869 case *InvitationBindingRole_FieldSubPath: 870 switch tp.selector { 871 case InvitationBindingRole_FieldPathSelectorExecutableConditions: 872 executableConditionsMask.AppendPath(tp.subPath.(condition.ExecutableCondition_FieldPath)) 873 case InvitationBindingRole_FieldPathSelectorScopeParams: 874 scopeParamsMask.AppendPath(tp.subPath.(role.ScopeParam_FieldPath)) 875 } 876 } 877 } 878 if wholeExecutableConditionsAccepted == false && len(executableConditionsMask.Paths) > 0 { 879 for _, sourceItem := range source.GetExecutableConditions() { 880 result.ExecutableConditions = append(result.ExecutableConditions, executableConditionsMask.Project(sourceItem)) 881 } 882 } 883 if wholeScopeParamsAccepted == false && len(scopeParamsMask.Paths) > 0 { 884 for _, sourceItem := range source.GetScopeParams() { 885 result.ScopeParams = append(result.ScopeParams, scopeParamsMask.Project(sourceItem)) 886 } 887 } 888 return result 889 } 890 891 func (fieldMask *Invitation_BindingRole_FieldMask) ProjectRaw(source gotenobject.GotenObjectExt) gotenobject.GotenObjectExt { 892 return fieldMask.Project(source.(*Invitation_BindingRole)) 893 } 894 895 func (fieldMask *Invitation_BindingRole_FieldMask) PathsCount() int { 896 if fieldMask == nil { 897 return 0 898 } 899 return len(fieldMask.Paths) 900 }